1
0

amber-cli.js 2.2 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883
  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 v4.2.6+9869a4bc
  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. var type = typeof x;
  21. return x !== null && (type === 'object' || type === 'function');
  22. }
  23. function isFunction(x) {
  24. return typeof x === 'function';
  25. }
  26. var _isArray = void 0;
  27. if (Array.isArray) {
  28. _isArray = Array.isArray;
  29. } else {
  30. _isArray = function (x) {
  31. return Object.prototype.toString.call(x) === '[object Array]';
  32. };
  33. }
  34. var isArray = _isArray;
  35. var len = 0;
  36. var vertxNext = void 0;
  37. var customSchedulerFn = void 0;
  38. var asap = function asap(callback, arg) {
  39. queue[len] = callback;
  40. queue[len + 1] = arg;
  41. len += 2;
  42. if (len === 2) {
  43. // If len is 2, that means that we need to schedule an async flush.
  44. // If additional callbacks are queued before the queue is flushed, they
  45. // will be processed by this flush that we are scheduling.
  46. if (customSchedulerFn) {
  47. customSchedulerFn(flush);
  48. } else {
  49. scheduleFlush();
  50. }
  51. }
  52. };
  53. function setScheduler(scheduleFn) {
  54. customSchedulerFn = scheduleFn;
  55. }
  56. function setAsap(asapFn) {
  57. asap = asapFn;
  58. }
  59. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  60. var browserGlobal = browserWindow || {};
  61. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  62. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
  63. // test for web worker but not in IE10
  64. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  65. // node
  66. function useNextTick() {
  67. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  68. // see https://github.com/cujojs/when/issues/410 for details
  69. return function () {
  70. return process.nextTick(flush);
  71. };
  72. }
  73. // vertx
  74. function useVertxTimer() {
  75. if (typeof vertxNext !== 'undefined') {
  76. return function () {
  77. vertxNext(flush);
  78. };
  79. }
  80. return useSetTimeout();
  81. }
  82. function useMutationObserver() {
  83. var iterations = 0;
  84. var observer = new BrowserMutationObserver(flush);
  85. var node = document.createTextNode('');
  86. observer.observe(node, { characterData: true });
  87. return function () {
  88. node.data = iterations = ++iterations % 2;
  89. };
  90. }
  91. // web worker
  92. function useMessageChannel() {
  93. var channel = new MessageChannel();
  94. channel.port1.onmessage = flush;
  95. return function () {
  96. return channel.port2.postMessage(0);
  97. };
  98. }
  99. function useSetTimeout() {
  100. // Store setTimeout reference so es6-promise will be unaffected by
  101. // other code modifying setTimeout (like sinon.useFakeTimers())
  102. var globalSetTimeout = setTimeout;
  103. return function () {
  104. return globalSetTimeout(flush, 1);
  105. };
  106. }
  107. var queue = new Array(1000);
  108. function flush() {
  109. for (var i = 0; i < len; i += 2) {
  110. var callback = queue[i];
  111. var arg = queue[i + 1];
  112. callback(arg);
  113. queue[i] = undefined;
  114. queue[i + 1] = undefined;
  115. }
  116. len = 0;
  117. }
  118. function attemptVertx() {
  119. try {
  120. var vertx = Function('return this')().require('vertx');
  121. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  122. return useVertxTimer();
  123. } catch (e) {
  124. return useSetTimeout();
  125. }
  126. }
  127. var scheduleFlush = void 0;
  128. // Decide what async method to use to triggering processing of queued callbacks:
  129. if (isNode) {
  130. scheduleFlush = useNextTick();
  131. } else if (BrowserMutationObserver) {
  132. scheduleFlush = useMutationObserver();
  133. } else if (isWorker) {
  134. scheduleFlush = useMessageChannel();
  135. } else if (browserWindow === undefined && typeof require === 'function') {
  136. scheduleFlush = attemptVertx();
  137. } else {
  138. scheduleFlush = useSetTimeout();
  139. }
  140. function then(onFulfillment, onRejection) {
  141. var parent = this;
  142. var child = new this.constructor(noop);
  143. if (child[PROMISE_ID] === undefined) {
  144. makePromise(child);
  145. }
  146. var _state = parent._state;
  147. if (_state) {
  148. var callback = arguments[_state - 1];
  149. asap(function () {
  150. return invokeCallback(_state, child, callback, parent._result);
  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$1(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(2);
  193. function noop() {}
  194. var PENDING = void 0;
  195. var FULFILLED = 1;
  196. var REJECTED = 2;
  197. var TRY_CATCH_ERROR = { error: null };
  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. TRY_CATCH_ERROR.error = error;
  209. return TRY_CATCH_ERROR;
  210. }
  211. }
  212. function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
  213. try {
  214. then$$1.call(value, fulfillmentHandler, rejectionHandler);
  215. } catch (e) {
  216. return e;
  217. }
  218. }
  219. function handleForeignThenable(promise, thenable, then$$1) {
  220. asap(function (promise) {
  221. var sealed = false;
  222. var error = tryThen(then$$1, 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$$1) {
  259. if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
  260. handleOwnThenable(promise, maybeThenable);
  261. } else {
  262. if (then$$1 === TRY_CATCH_ERROR) {
  263. reject(promise, TRY_CATCH_ERROR.error);
  264. TRY_CATCH_ERROR.error = null;
  265. } else if (then$$1 === undefined) {
  266. fulfill(promise, maybeThenable);
  267. } else if (isFunction(then$$1)) {
  268. handleForeignThenable(promise, maybeThenable, then$$1);
  269. } else {
  270. fulfill(promise, maybeThenable);
  271. }
  272. }
  273. }
  274. function resolve(promise, value) {
  275. if (promise === value) {
  276. reject(promise, selfFulfillment());
  277. } else if (objectOrFunction(value)) {
  278. handleMaybeThenable(promise, value, getThen(value));
  279. } else {
  280. fulfill(promise, value);
  281. }
  282. }
  283. function publishRejection(promise) {
  284. if (promise._onerror) {
  285. promise._onerror(promise._result);
  286. }
  287. publish(promise);
  288. }
  289. function fulfill(promise, value) {
  290. if (promise._state !== PENDING) {
  291. return;
  292. }
  293. promise._result = value;
  294. promise._state = FULFILLED;
  295. if (promise._subscribers.length !== 0) {
  296. asap(publish, promise);
  297. }
  298. }
  299. function reject(promise, reason) {
  300. if (promise._state !== PENDING) {
  301. return;
  302. }
  303. promise._state = REJECTED;
  304. promise._result = reason;
  305. asap(publishRejection, promise);
  306. }
  307. function subscribe(parent, child, onFulfillment, onRejection) {
  308. var _subscribers = parent._subscribers;
  309. var length = _subscribers.length;
  310. parent._onerror = null;
  311. _subscribers[length] = child;
  312. _subscribers[length + FULFILLED] = onFulfillment;
  313. _subscribers[length + REJECTED] = onRejection;
  314. if (length === 0 && parent._state) {
  315. asap(publish, parent);
  316. }
  317. }
  318. function publish(promise) {
  319. var subscribers = promise._subscribers;
  320. var settled = promise._state;
  321. if (subscribers.length === 0) {
  322. return;
  323. }
  324. var child = void 0,
  325. callback = void 0,
  326. detail = promise._result;
  327. for (var i = 0; i < subscribers.length; i += 3) {
  328. child = subscribers[i];
  329. callback = subscribers[i + settled];
  330. if (child) {
  331. invokeCallback(settled, child, callback, detail);
  332. } else {
  333. callback(detail);
  334. }
  335. }
  336. promise._subscribers.length = 0;
  337. }
  338. function tryCatch(callback, detail) {
  339. try {
  340. return callback(detail);
  341. } catch (e) {
  342. TRY_CATCH_ERROR.error = e;
  343. return TRY_CATCH_ERROR;
  344. }
  345. }
  346. function invokeCallback(settled, promise, callback, detail) {
  347. var hasCallback = isFunction(callback),
  348. value = void 0,
  349. error = void 0,
  350. succeeded = void 0,
  351. failed = void 0;
  352. if (hasCallback) {
  353. value = tryCatch(callback, detail);
  354. if (value === TRY_CATCH_ERROR) {
  355. failed = true;
  356. error = value.error;
  357. value.error = null;
  358. } else {
  359. succeeded = true;
  360. }
  361. if (promise === value) {
  362. reject(promise, cannotReturnOwn());
  363. return;
  364. }
  365. } else {
  366. value = detail;
  367. succeeded = true;
  368. }
  369. if (promise._state !== PENDING) {
  370. // noop
  371. } else if (hasCallback && succeeded) {
  372. resolve(promise, value);
  373. } else if (failed) {
  374. reject(promise, error);
  375. } else if (settled === FULFILLED) {
  376. fulfill(promise, value);
  377. } else if (settled === REJECTED) {
  378. reject(promise, value);
  379. }
  380. }
  381. function initializePromise(promise, resolver) {
  382. try {
  383. resolver(function resolvePromise(value) {
  384. resolve(promise, value);
  385. }, function rejectPromise(reason) {
  386. reject(promise, reason);
  387. });
  388. } catch (e) {
  389. reject(promise, e);
  390. }
  391. }
  392. var id = 0;
  393. function nextId() {
  394. return id++;
  395. }
  396. function makePromise(promise) {
  397. promise[PROMISE_ID] = id++;
  398. promise._state = undefined;
  399. promise._result = undefined;
  400. promise._subscribers = [];
  401. }
  402. function validationError() {
  403. return new Error('Array Methods must be provided an Array');
  404. }
  405. var Enumerator = function () {
  406. function Enumerator(Constructor, input) {
  407. this._instanceConstructor = Constructor;
  408. this.promise = new Constructor(noop);
  409. if (!this.promise[PROMISE_ID]) {
  410. makePromise(this.promise);
  411. }
  412. if (isArray(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(input);
  421. if (this._remaining === 0) {
  422. fulfill(this.promise, this._result);
  423. }
  424. }
  425. } else {
  426. reject(this.promise, validationError());
  427. }
  428. }
  429. Enumerator.prototype._enumerate = function _enumerate(input) {
  430. for (var i = 0; this._state === PENDING && i < input.length; i++) {
  431. this._eachEntry(input[i], i);
  432. }
  433. };
  434. Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {
  435. var c = this._instanceConstructor;
  436. var resolve$$1 = c.resolve;
  437. if (resolve$$1 === resolve$1) {
  438. var _then = getThen(entry);
  439. if (_then === then && entry._state !== PENDING) {
  440. this._settledAt(entry._state, i, entry._result);
  441. } else if (typeof _then !== 'function') {
  442. this._remaining--;
  443. this._result[i] = entry;
  444. } else if (c === Promise$1) {
  445. var promise = new c(noop);
  446. handleMaybeThenable(promise, entry, _then);
  447. this._willSettleAt(promise, i);
  448. } else {
  449. this._willSettleAt(new c(function (resolve$$1) {
  450. return resolve$$1(entry);
  451. }), i);
  452. }
  453. } else {
  454. this._willSettleAt(resolve$$1(entry), i);
  455. }
  456. };
  457. Enumerator.prototype._settledAt = function _settledAt(state, i, value) {
  458. var promise = this.promise;
  459. if (promise._state === PENDING) {
  460. this._remaining--;
  461. if (state === REJECTED) {
  462. reject(promise, value);
  463. } else {
  464. this._result[i] = value;
  465. }
  466. }
  467. if (this._remaining === 0) {
  468. fulfill(promise, this._result);
  469. }
  470. };
  471. Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {
  472. var enumerator = this;
  473. subscribe(promise, undefined, function (value) {
  474. return enumerator._settledAt(FULFILLED, i, value);
  475. }, function (reason) {
  476. return enumerator._settledAt(REJECTED, i, reason);
  477. });
  478. };
  479. return Enumerator;
  480. }();
  481. /**
  482. `Promise.all` accepts an array of promises, and returns a new promise which
  483. is fulfilled with an array of fulfillment values for the passed promises, or
  484. rejected with the reason of the first passed promise to be rejected. It casts all
  485. elements of the passed iterable to promises as it runs this algorithm.
  486. Example:
  487. ```javascript
  488. let promise1 = resolve(1);
  489. let promise2 = resolve(2);
  490. let promise3 = resolve(3);
  491. let promises = [ promise1, promise2, promise3 ];
  492. Promise.all(promises).then(function(array){
  493. // The array here would be [ 1, 2, 3 ];
  494. });
  495. ```
  496. If any of the `promises` given to `all` are rejected, the first promise
  497. that is rejected will be given as an argument to the returned promises's
  498. rejection handler. For example:
  499. Example:
  500. ```javascript
  501. let promise1 = resolve(1);
  502. let promise2 = reject(new Error("2"));
  503. let promise3 = reject(new Error("3"));
  504. let promises = [ promise1, promise2, promise3 ];
  505. Promise.all(promises).then(function(array){
  506. // Code here never runs because there are rejected promises!
  507. }, function(error) {
  508. // error.message === "2"
  509. });
  510. ```
  511. @method all
  512. @static
  513. @param {Array} entries array of promises
  514. @param {String} label optional string for labeling the promise.
  515. Useful for tooling.
  516. @return {Promise} promise that is fulfilled when all `promises` have been
  517. fulfilled, or rejected if any of them become rejected.
  518. @static
  519. */
  520. function all(entries) {
  521. return new Enumerator(this, entries).promise;
  522. }
  523. /**
  524. `Promise.race` returns a new promise which is settled in the same way as the
  525. first passed promise to settle.
  526. Example:
  527. ```javascript
  528. let promise1 = new Promise(function(resolve, reject){
  529. setTimeout(function(){
  530. resolve('promise 1');
  531. }, 200);
  532. });
  533. let promise2 = new Promise(function(resolve, reject){
  534. setTimeout(function(){
  535. resolve('promise 2');
  536. }, 100);
  537. });
  538. Promise.race([promise1, promise2]).then(function(result){
  539. // result === 'promise 2' because it was resolved before promise1
  540. // was resolved.
  541. });
  542. ```
  543. `Promise.race` is deterministic in that only the state of the first
  544. settled promise matters. For example, even if other promises given to the
  545. `promises` array argument are resolved, but the first settled promise has
  546. become rejected before the other promises became fulfilled, the returned
  547. promise will become rejected:
  548. ```javascript
  549. let promise1 = new Promise(function(resolve, reject){
  550. setTimeout(function(){
  551. resolve('promise 1');
  552. }, 200);
  553. });
  554. let promise2 = new Promise(function(resolve, reject){
  555. setTimeout(function(){
  556. reject(new Error('promise 2'));
  557. }, 100);
  558. });
  559. Promise.race([promise1, promise2]).then(function(result){
  560. // Code here never runs
  561. }, function(reason){
  562. // reason.message === 'promise 2' because promise 2 became rejected before
  563. // promise 1 became fulfilled
  564. });
  565. ```
  566. An example real-world use case is implementing timeouts:
  567. ```javascript
  568. Promise.race([ajax('foo.json'), timeout(5000)])
  569. ```
  570. @method race
  571. @static
  572. @param {Array} promises array of promises to observe
  573. Useful for tooling.
  574. @return {Promise} a promise which settles in the same way as the first passed
  575. promise to settle.
  576. */
  577. function race(entries) {
  578. /*jshint validthis:true */
  579. var Constructor = this;
  580. if (!isArray(entries)) {
  581. return new Constructor(function (_, reject) {
  582. return reject(new TypeError('You must pass an array to race.'));
  583. });
  584. } else {
  585. return new Constructor(function (resolve, reject) {
  586. var length = entries.length;
  587. for (var i = 0; i < length; i++) {
  588. Constructor.resolve(entries[i]).then(resolve, reject);
  589. }
  590. });
  591. }
  592. }
  593. /**
  594. `Promise.reject` returns a promise rejected with the passed `reason`.
  595. It is shorthand for the following:
  596. ```javascript
  597. let promise = new Promise(function(resolve, reject){
  598. reject(new Error('WHOOPS'));
  599. });
  600. promise.then(function(value){
  601. // Code here doesn't run because the promise is rejected!
  602. }, function(reason){
  603. // reason.message === 'WHOOPS'
  604. });
  605. ```
  606. Instead of writing the above, your code now simply becomes the following:
  607. ```javascript
  608. let promise = Promise.reject(new Error('WHOOPS'));
  609. promise.then(function(value){
  610. // Code here doesn't run because the promise is rejected!
  611. }, function(reason){
  612. // reason.message === 'WHOOPS'
  613. });
  614. ```
  615. @method reject
  616. @static
  617. @param {Any} reason value that the returned promise will be rejected with.
  618. Useful for tooling.
  619. @return {Promise} a promise rejected with the given `reason`.
  620. */
  621. function reject$1(reason) {
  622. /*jshint validthis:true */
  623. var Constructor = this;
  624. var promise = new Constructor(noop);
  625. reject(promise, reason);
  626. return promise;
  627. }
  628. function needsResolver() {
  629. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  630. }
  631. function needsNew() {
  632. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  633. }
  634. /**
  635. Promise objects represent the eventual result of an asynchronous operation. The
  636. primary way of interacting with a promise is through its `then` method, which
  637. registers callbacks to receive either a promise's eventual value or the reason
  638. why the promise cannot be fulfilled.
  639. Terminology
  640. -----------
  641. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  642. - `thenable` is an object or function that defines a `then` method.
  643. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  644. - `exception` is a value that is thrown using the throw statement.
  645. - `reason` is a value that indicates why a promise was rejected.
  646. - `settled` the final resting state of a promise, fulfilled or rejected.
  647. A promise can be in one of three states: pending, fulfilled, or rejected.
  648. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  649. state. Promises that are rejected have a rejection reason and are in the
  650. rejected state. A fulfillment value is never a thenable.
  651. Promises can also be said to *resolve* a value. If this value is also a
  652. promise, then the original promise's settled state will match the value's
  653. settled state. So a promise that *resolves* a promise that rejects will
  654. itself reject, and a promise that *resolves* a promise that fulfills will
  655. itself fulfill.
  656. Basic Usage:
  657. ------------
  658. ```js
  659. let promise = new Promise(function(resolve, reject) {
  660. // on success
  661. resolve(value);
  662. // on failure
  663. reject(reason);
  664. });
  665. promise.then(function(value) {
  666. // on fulfillment
  667. }, function(reason) {
  668. // on rejection
  669. });
  670. ```
  671. Advanced Usage:
  672. ---------------
  673. Promises shine when abstracting away asynchronous interactions such as
  674. `XMLHttpRequest`s.
  675. ```js
  676. function getJSON(url) {
  677. return new Promise(function(resolve, reject){
  678. let xhr = new XMLHttpRequest();
  679. xhr.open('GET', url);
  680. xhr.onreadystatechange = handler;
  681. xhr.responseType = 'json';
  682. xhr.setRequestHeader('Accept', 'application/json');
  683. xhr.send();
  684. function handler() {
  685. if (this.readyState === this.DONE) {
  686. if (this.status === 200) {
  687. resolve(this.response);
  688. } else {
  689. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  690. }
  691. }
  692. };
  693. });
  694. }
  695. getJSON('/posts.json').then(function(json) {
  696. // on fulfillment
  697. }, function(reason) {
  698. // on rejection
  699. });
  700. ```
  701. Unlike callbacks, promises are great composable primitives.
  702. ```js
  703. Promise.all([
  704. getJSON('/posts'),
  705. getJSON('/comments')
  706. ]).then(function(values){
  707. values[0] // => postsJSON
  708. values[1] // => commentsJSON
  709. return values;
  710. });
  711. ```
  712. @class Promise
  713. @param {Function} resolver
  714. Useful for tooling.
  715. @constructor
  716. */
  717. var Promise$1 = function () {
  718. function Promise(resolver) {
  719. this[PROMISE_ID] = nextId();
  720. this._result = this._state = undefined;
  721. this._subscribers = [];
  722. if (noop !== resolver) {
  723. typeof resolver !== 'function' && needsResolver();
  724. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  725. }
  726. }
  727. /**
  728. The primary way of interacting with a promise is through its `then` method,
  729. which registers callbacks to receive either a promise's eventual value or the
  730. reason why the promise cannot be fulfilled.
  731. ```js
  732. findUser().then(function(user){
  733. // user is available
  734. }, function(reason){
  735. // user is unavailable, and you are given the reason why
  736. });
  737. ```
  738. Chaining
  739. --------
  740. The return value of `then` is itself a promise. This second, 'downstream'
  741. promise is resolved with the return value of the first promise's fulfillment
  742. or rejection handler, or rejected if the handler throws an exception.
  743. ```js
  744. findUser().then(function (user) {
  745. return user.name;
  746. }, function (reason) {
  747. return 'default name';
  748. }).then(function (userName) {
  749. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  750. // will be `'default name'`
  751. });
  752. findUser().then(function (user) {
  753. throw new Error('Found user, but still unhappy');
  754. }, function (reason) {
  755. throw new Error('`findUser` rejected and we're unhappy');
  756. }).then(function (value) {
  757. // never reached
  758. }, function (reason) {
  759. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  760. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  761. });
  762. ```
  763. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  764. ```js
  765. findUser().then(function (user) {
  766. throw new PedagogicalException('Upstream error');
  767. }).then(function (value) {
  768. // never reached
  769. }).then(function (value) {
  770. // never reached
  771. }, function (reason) {
  772. // The `PedgagocialException` is propagated all the way down to here
  773. });
  774. ```
  775. Assimilation
  776. ------------
  777. Sometimes the value you want to propagate to a downstream promise can only be
  778. retrieved asynchronously. This can be achieved by returning a promise in the
  779. fulfillment or rejection handler. The downstream promise will then be pending
  780. until the returned promise is settled. This is called *assimilation*.
  781. ```js
  782. findUser().then(function (user) {
  783. return findCommentsByAuthor(user);
  784. }).then(function (comments) {
  785. // The user's comments are now available
  786. });
  787. ```
  788. If the assimliated promise rejects, then the downstream promise will also reject.
  789. ```js
  790. findUser().then(function (user) {
  791. return findCommentsByAuthor(user);
  792. }).then(function (comments) {
  793. // If `findCommentsByAuthor` fulfills, we'll have the value here
  794. }, function (reason) {
  795. // If `findCommentsByAuthor` rejects, we'll have the reason here
  796. });
  797. ```
  798. Simple Example
  799. --------------
  800. Synchronous Example
  801. ```javascript
  802. let result;
  803. try {
  804. result = findResult();
  805. // success
  806. } catch(reason) {
  807. // failure
  808. }
  809. ```
  810. Errback Example
  811. ```js
  812. findResult(function(result, err){
  813. if (err) {
  814. // failure
  815. } else {
  816. // success
  817. }
  818. });
  819. ```
  820. Promise Example;
  821. ```javascript
  822. findResult().then(function(result){
  823. // success
  824. }, function(reason){
  825. // failure
  826. });
  827. ```
  828. Advanced Example
  829. --------------
  830. Synchronous Example
  831. ```javascript
  832. let author, books;
  833. try {
  834. author = findAuthor();
  835. books = findBooksByAuthor(author);
  836. // success
  837. } catch(reason) {
  838. // failure
  839. }
  840. ```
  841. Errback Example
  842. ```js
  843. function foundBooks(books) {
  844. }
  845. function failure(reason) {
  846. }
  847. findAuthor(function(author, err){
  848. if (err) {
  849. failure(err);
  850. // failure
  851. } else {
  852. try {
  853. findBoooksByAuthor(author, function(books, err) {
  854. if (err) {
  855. failure(err);
  856. } else {
  857. try {
  858. foundBooks(books);
  859. } catch(reason) {
  860. failure(reason);
  861. }
  862. }
  863. });
  864. } catch(error) {
  865. failure(err);
  866. }
  867. // success
  868. }
  869. });
  870. ```
  871. Promise Example;
  872. ```javascript
  873. findAuthor().
  874. then(findBooksByAuthor).
  875. then(function(books){
  876. // found books
  877. }).catch(function(reason){
  878. // something went wrong
  879. });
  880. ```
  881. @method then
  882. @param {Function} onFulfilled
  883. @param {Function} onRejected
  884. Useful for tooling.
  885. @return {Promise}
  886. */
  887. /**
  888. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  889. as the catch block of a try/catch statement.
  890. ```js
  891. function findAuthor(){
  892. throw new Error('couldn't find that author');
  893. }
  894. // synchronous
  895. try {
  896. findAuthor();
  897. } catch(reason) {
  898. // something went wrong
  899. }
  900. // async with promises
  901. findAuthor().catch(function(reason){
  902. // something went wrong
  903. });
  904. ```
  905. @method catch
  906. @param {Function} onRejection
  907. Useful for tooling.
  908. @return {Promise}
  909. */
  910. Promise.prototype.catch = function _catch(onRejection) {
  911. return this.then(null, onRejection);
  912. };
  913. /**
  914. `finally` will be invoked regardless of the promise's fate just as native
  915. try/catch/finally behaves
  916. Synchronous example:
  917. ```js
  918. findAuthor() {
  919. if (Math.random() > 0.5) {
  920. throw new Error();
  921. }
  922. return new Author();
  923. }
  924. try {
  925. return findAuthor(); // succeed or fail
  926. } catch(error) {
  927. return findOtherAuther();
  928. } finally {
  929. // always runs
  930. // doesn't affect the return value
  931. }
  932. ```
  933. Asynchronous example:
  934. ```js
  935. findAuthor().catch(function(reason){
  936. return findOtherAuther();
  937. }).finally(function(){
  938. // author was either found, or not
  939. });
  940. ```
  941. @method finally
  942. @param {Function} callback
  943. @return {Promise}
  944. */
  945. Promise.prototype.finally = function _finally(callback) {
  946. var promise = this;
  947. var constructor = promise.constructor;
  948. if (isFunction(callback)) {
  949. return promise.then(function (value) {
  950. return constructor.resolve(callback()).then(function () {
  951. return value;
  952. });
  953. }, function (reason) {
  954. return constructor.resolve(callback()).then(function () {
  955. throw reason;
  956. });
  957. });
  958. }
  959. return promise.then(callback, callback);
  960. };
  961. return Promise;
  962. }();
  963. Promise$1.prototype.then = then;
  964. Promise$1.all = all;
  965. Promise$1.race = race;
  966. Promise$1.resolve = resolve$1;
  967. Promise$1.reject = reject$1;
  968. Promise$1._setScheduler = setScheduler;
  969. Promise$1._setAsap = setAsap;
  970. Promise$1._asap = asap;
  971. /*global self*/
  972. function polyfill() {
  973. var local = void 0;
  974. if (typeof global !== 'undefined') {
  975. local = global;
  976. } else if (typeof self !== 'undefined') {
  977. local = self;
  978. } else {
  979. try {
  980. local = Function('return this')();
  981. } catch (e) {
  982. throw new Error('polyfill failed because global object is unavailable in this environment');
  983. }
  984. }
  985. var P = local.Promise;
  986. if (P) {
  987. var promiseToString = null;
  988. try {
  989. promiseToString = Object.prototype.toString.call(P.resolve());
  990. } catch (e) {
  991. // silently ignored
  992. }
  993. if (promiseToString === '[object Promise]' && !P.cast) {
  994. return;
  995. }
  996. }
  997. local.Promise = Promise$1;
  998. }
  999. // Strange compat..
  1000. Promise$1.polyfill = polyfill;
  1001. Promise$1.Promise = Promise$1;
  1002. return Promise$1;
  1003. })));
  1004. //# sourceMappingURL=es6-promise.map
  1005. ;
  1006. //jshint eqnull:true
  1007. define('amber/kernel-checks',[],function () {
  1008. "use strict";
  1009. function assert (fn) {
  1010. try {
  1011. if (fn()) return;
  1012. } catch (ex) {
  1013. throw new Error("Error:\n" + ex + "in assertion:\n" + fn);
  1014. }
  1015. throw new Error("Assertion failed:\n" + fn);
  1016. }
  1017. assert(function () {
  1018. return !("hasOwnProperty" in Object.create(null));
  1019. });
  1020. assert(function () {
  1021. return Object.getPrototypeOf(Object.create(null)) === null;
  1022. });
  1023. assert(function () {
  1024. var p = {};
  1025. return Object.getPrototypeOf(Object.create(p)) === p;
  1026. });
  1027. // assert(function () {
  1028. // return new Function("return this")().Object === Object;
  1029. // });
  1030. // assert(function () {
  1031. // return Object.create(new Function("return this")()).Object === Object;
  1032. // });
  1033. assert(function () {
  1034. return typeof global !== "undefined";
  1035. });
  1036. assert(function () {
  1037. return global.Object === Object;
  1038. });
  1039. assert(function () {
  1040. return Object.create(global).Object === Object;
  1041. });
  1042. assert(function () {
  1043. return (function () {
  1044. return this;
  1045. }).apply(void 0) === void 0;
  1046. });
  1047. assert(function () {
  1048. return (function () {
  1049. return this;
  1050. }).apply(null) === null;
  1051. });
  1052. assert(function () {
  1053. return (function () {
  1054. return this;
  1055. }).apply(3) === 3;
  1056. });
  1057. assert(function () {
  1058. return (function () {
  1059. return this;
  1060. }).apply("foo") === "foo";
  1061. });
  1062. assert(function () {
  1063. return (function () {
  1064. return this;
  1065. }).apply(true) === true;
  1066. });
  1067. assert(function () {
  1068. var o = Object.freeze({});
  1069. try {
  1070. o.foo = "bar";
  1071. } catch (ex) {
  1072. }
  1073. return o.foo == null;
  1074. });
  1075. assert(function () {
  1076. return typeof Promise === "function";
  1077. });
  1078. assert(function () {
  1079. return typeof Promise.resolve === "function";
  1080. });
  1081. assert(function () {
  1082. return typeof Promise.reject === "function";
  1083. });
  1084. assert(function () {
  1085. return typeof new Promise(function () {
  1086. }).then === "function";
  1087. });
  1088. });
  1089. define('amber/brikz',[], function () {
  1090. return function Brikz(api, apiKey, initKey) {
  1091. "use strict";
  1092. //jshint eqnull:true
  1093. var brikz = this,
  1094. backup = {};
  1095. apiKey = apiKey || 'exports';
  1096. initKey = initKey || '__init__';
  1097. function mixin(src, target, what) {
  1098. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  1099. if (src == null) {
  1100. target[keys[i]] = undefined;
  1101. } else {
  1102. var value = src[keys[i]];
  1103. if (typeof value !== "undefined") {
  1104. target[keys[i]] = value;
  1105. }
  1106. }
  1107. }
  1108. return target;
  1109. }
  1110. Object.defineProperties(this, {
  1111. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  1112. });
  1113. var exclude = mixin(this, {});
  1114. this.rebuild = function () {
  1115. Object.keys(backup).forEach(function (key) {
  1116. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  1117. });
  1118. var oapi = mixin(api, {}),
  1119. order = [],
  1120. chk = {};
  1121. function ensure(key) {
  1122. if (key in exclude) {
  1123. return null;
  1124. }
  1125. var b = brikz[key],
  1126. bak = backup[key];
  1127. mixin(null, api, api);
  1128. while (typeof b === "function") {
  1129. (b.deps || []).forEach(ensure);
  1130. b = new b(brikz, api, bak);
  1131. }
  1132. brikz[key] = b;
  1133. if (b && !chk[key]) {
  1134. chk[key] = true;
  1135. order.push(b);
  1136. }
  1137. if (b && !b[apiKey]) {
  1138. b[apiKey] = mixin(api, {});
  1139. }
  1140. }
  1141. Object.keys(brikz).forEach(ensure);
  1142. mixin(oapi, mixin(null, api, api));
  1143. order.forEach(function (brik) {
  1144. mixin(brik[apiKey] || {}, api);
  1145. });
  1146. order.forEach(function (brik) {
  1147. if (brik[initKey]) {
  1148. brik[initKey]();
  1149. if (brik[initKey].once) {
  1150. delete brik[initKey];
  1151. }
  1152. }
  1153. });
  1154. backup = mixin(brikz, {});
  1155. };
  1156. };
  1157. });
  1158. /* ====================================================================
  1159. |
  1160. | Amber Smalltalk
  1161. | http://amber-lang.net
  1162. |
  1163. ======================================================================
  1164. ======================================================================
  1165. |
  1166. | Copyright (c) 2010-2014
  1167. | Nicolas Petton <petton.nicolas@gmail.com>
  1168. |
  1169. | Copyright (c) 2012-2017
  1170. | The Amber team https://lolg.it/org/amber/members
  1171. | Amber contributors (see /CONTRIBUTORS)
  1172. |
  1173. | Amber is released under the MIT license
  1174. |
  1175. | Permission is hereby granted, free of charge, to any person obtaining
  1176. | a copy of this software and associated documentation files (the
  1177. | 'Software'), to deal in the Software without restriction, including
  1178. | without limitation the rights to use, copy, modify, merge, publish,
  1179. | distribute, sublicense, and/or sell copies of the Software, and to
  1180. | permit persons to whom the Software is furnished to do so, subject to
  1181. | the following conditions:
  1182. |
  1183. | The above copyright notice and this permission notice shall be
  1184. | included in all copies or substantial portions of the Software.
  1185. |
  1186. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1187. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1188. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1189. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1190. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1191. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1192. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1193. |
  1194. ==================================================================== */
  1195. //jshint eqnull:true
  1196. define('amber/kernel-fundamentals',[],function () {
  1197. "use strict";
  1198. function inherits (child, parent) {
  1199. child.prototype = Object.create(parent.prototype, {
  1200. constructor: {
  1201. value: child,
  1202. enumerable: false, configurable: true, writable: true
  1203. }
  1204. });
  1205. return child;
  1206. }
  1207. function SmalltalkGlobalsBrik (brikz, st) {
  1208. var globals = Object.create(global);
  1209. globals.SmalltalkSettings = {};
  1210. this.globals = globals;
  1211. }
  1212. function EventBrik (brikz, st) {
  1213. var emit = {};
  1214. this.emit = emit;
  1215. this.declareEvent = function (event) {
  1216. if (!emit[event]) emit[event] = function () {
  1217. };
  1218. }
  1219. }
  1220. function RootBrik (brikz, st) {
  1221. /* Smalltalk foundational objects */
  1222. var coreFns = this.coreFns = {};
  1223. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1224. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1225. Detached roots (eg. wrapped JS classes like Number or Date)
  1226. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1227. function SmalltalkRoot () {
  1228. }
  1229. function SmalltalkProtoObject () {
  1230. }
  1231. function SmalltalkObject () {
  1232. }
  1233. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1234. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1235. this.Root = SmalltalkRoot;
  1236. this.Object = SmalltalkObject;
  1237. }
  1238. function SelectorsBrik (brikz, st) {
  1239. var selectorSet = Object.create(null);
  1240. var selectors = this.selectors = [];
  1241. this.registerSelector = function (stSelector) {
  1242. if (selectorSet[stSelector]) return false;
  1243. selectors.push(stSelector);
  1244. return selectorSet[stSelector] = true;
  1245. };
  1246. st.allSelectors = function () {
  1247. return selectors;
  1248. };
  1249. }
  1250. function PackagesBrik (brikz, st) {
  1251. st.packages = st.packageDescriptors = {};
  1252. /* Add a package load descriptor to the system */
  1253. st.addPackage = function (name, properties) {
  1254. if (!name) return null;
  1255. return st.packageDescriptors[name] = {properties: properties};
  1256. };
  1257. }
  1258. BehaviorsBrik.deps = ["root", "smalltalkGlobals", "arraySet"];
  1259. function BehaviorsBrik (brikz, st) {
  1260. var globals = brikz.smalltalkGlobals.globals;
  1261. var addElement = brikz.arraySet.addElement;
  1262. var removeElement = brikz.arraySet.removeElement;
  1263. /* Smalltalk classes and traits */
  1264. var traitsOrClasses = [];
  1265. this.buildTraitOrClass = function (category, builder) {
  1266. var traitOrClass = globals.hasOwnProperty(builder.name) && globals[builder.name];
  1267. if (traitOrClass) {
  1268. builder.updateExisting(traitOrClass);
  1269. } else {
  1270. traitOrClass = builder.make();
  1271. traitOrClass.category = category;
  1272. addTraitOrClass(traitOrClass);
  1273. }
  1274. return traitOrClass;
  1275. };
  1276. function addTraitOrClass (traitOrClass) {
  1277. globals[traitOrClass.name] = traitOrClass;
  1278. addElement(traitsOrClasses, traitOrClass);
  1279. traitOrClass.added();
  1280. }
  1281. function removeTraitOrClass (traitOrClass) {
  1282. traitOrClass.removed();
  1283. removeElement(traitsOrClasses, traitOrClass);
  1284. delete globals[traitOrClass.name];
  1285. }
  1286. this.removeTraitOrClass = removeTraitOrClass;
  1287. st.traitsOrClasses = this.traitsOrClasses = traitsOrClasses;
  1288. }
  1289. MethodsBrik.deps = ["event", "selectors", "root"];
  1290. function MethodsBrik (brikz, st) {
  1291. var registerSelector = brikz.selectors.registerSelector;
  1292. var SmalltalkObject = brikz.root.Object;
  1293. var coreFns = brikz.root.coreFns;
  1294. var emit = brikz.event.emit;
  1295. var declareEvent = brikz.event.declareEvent;
  1296. function SmalltalkMethod () {
  1297. }
  1298. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1299. /* Smalltalk method object. To add a method to a class,
  1300. use api.addMethod() */
  1301. st.method = function (spec) {
  1302. var that = new SmalltalkMethod();
  1303. var selector = spec.selector;
  1304. that.selector = selector;
  1305. that.args = spec.args || [];
  1306. that.protocol = spec.protocol;
  1307. that.source = spec.source;
  1308. that.messageSends = spec.messageSends || [];
  1309. // TODO remove .referencedClasses, have .referencedGlobals
  1310. that.referencedClasses = spec.referencedClasses || [];
  1311. that.fn = spec.fn;
  1312. return that;
  1313. };
  1314. /* Add/remove a method to/from a class */
  1315. st.addMethod = function (method, traitOrBehavior) {
  1316. if (method.owner != null) {
  1317. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.owner);
  1318. }
  1319. method.owner = traitOrBehavior;
  1320. registerNewSelectors(method);
  1321. traitOrBehavior.localMethods[method.selector] = method;
  1322. updateMethod(method.selector, traitOrBehavior);
  1323. };
  1324. declareEvent("selectorsAdded");
  1325. function registerNewSelectors (method) {
  1326. var newSelectors = [];
  1327. function selectorInUse (stSelector) {
  1328. if (registerSelector(stSelector)) {
  1329. newSelectors.push(stSelector);
  1330. }
  1331. }
  1332. selectorInUse(method.selector);
  1333. method.messageSends.forEach(selectorInUse);
  1334. emit.selectorsAdded(newSelectors);
  1335. }
  1336. st.removeMethod = function (method, traitOrBehavior) {
  1337. if (traitOrBehavior.localMethods[method.selector] !== method) return;
  1338. delete traitOrBehavior.localMethods[method.selector];
  1339. updateMethod(method.selector, traitOrBehavior);
  1340. };
  1341. this.setupMethods = function (traitOrBehavior) {
  1342. traitOrBehavior.localMethods = Object.create(null);
  1343. traitOrBehavior.methods = Object.create(null);
  1344. };
  1345. declareEvent("methodReplaced");
  1346. function updateMethod (selector, traitOrBehavior) {
  1347. var oldMethod = traitOrBehavior.methods[selector],
  1348. newMethod = traitOrBehavior.localMethods[selector];
  1349. if (oldMethod == null && newMethod == null) {
  1350. console.warn("Removal of nonexistent method " + traitOrBehavior + " >> " + selector);
  1351. return;
  1352. }
  1353. if (newMethod === oldMethod) return;
  1354. if (newMethod != null) {
  1355. traitOrBehavior.methods[selector] = newMethod;
  1356. traitOrBehavior.methodAdded(newMethod);
  1357. } else {
  1358. delete traitOrBehavior.methods[selector];
  1359. traitOrBehavior.methodRemoved(oldMethod);
  1360. }
  1361. emit.methodReplaced(newMethod, oldMethod, traitOrBehavior);
  1362. }
  1363. this.updateMethod = updateMethod;
  1364. }
  1365. function ArraySetBrik (brikz, st) {
  1366. st.addElement = this.addElement = function (array, el) {
  1367. if (typeof el === 'undefined') {
  1368. return;
  1369. }
  1370. if (array.indexOf(el) === -1) {
  1371. array.push(el);
  1372. }
  1373. };
  1374. st.removeElement = this.removeElement = function (array, el) {
  1375. var i = array.indexOf(el);
  1376. if (i !== -1) {
  1377. array.splice(i, 1);
  1378. }
  1379. };
  1380. }
  1381. NilBrik.deps = ["root"];
  1382. function NilBrik (brikz, st) {
  1383. var SmalltalkObject = brikz.root.Object;
  1384. var coreFns = brikz.root.coreFns;
  1385. function SmalltalkNil () {
  1386. }
  1387. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1388. this.nilAsReceiver = new SmalltalkNil();
  1389. this.nilAsValue = this.nilAsReceiver; // TODO null
  1390. // Adds an `a$nil` (and legacy `isNil`) property to the `nil` object. When sending
  1391. // nil objects from one environment to another, doing
  1392. // `anObject == nil` (in JavaScript) does not always answer
  1393. // true as the referenced nil object might come from the other
  1394. // environment.
  1395. Object.defineProperty(this.nilAsReceiver, 'a$nil', {
  1396. value: true,
  1397. enumerable: false, configurable: false, writable: false
  1398. });
  1399. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1400. value: true,
  1401. enumerable: false, configurable: false, writable: false
  1402. });
  1403. }
  1404. /* Making smalltalk that has basic building blocks */
  1405. function configureWithFundamentals (brikz) {
  1406. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1407. brikz.root = RootBrik;
  1408. brikz.nil = NilBrik;
  1409. brikz.event = EventBrik;
  1410. brikz.arraySet = ArraySetBrik;
  1411. brikz.selectors = SelectorsBrik;
  1412. brikz.packages = PackagesBrik;
  1413. brikz.behaviors = BehaviorsBrik;
  1414. brikz.methods = MethodsBrik;
  1415. brikz.rebuild();
  1416. }
  1417. return configureWithFundamentals;
  1418. });
  1419. /* ====================================================================
  1420. |
  1421. | Amber Smalltalk
  1422. | http://amber-lang.net
  1423. |
  1424. ======================================================================
  1425. ======================================================================
  1426. |
  1427. | Copyright (c) 2010-2014
  1428. | Nicolas Petton <petton.nicolas@gmail.com>
  1429. |
  1430. | Copyright (c) 2012-2017
  1431. | The Amber team https://lolg.it/org/amber/members
  1432. | Amber contributors (see /CONTRIBUTORS)
  1433. |
  1434. | Amber is released under the MIT license
  1435. |
  1436. | Permission is hereby granted, free of charge, to any person obtaining
  1437. | a copy of this software and associated documentation files (the
  1438. | 'Software'), to deal in the Software without restriction, including
  1439. | without limitation the rights to use, copy, modify, merge, publish,
  1440. | distribute, sublicense, and/or sell copies of the Software, and to
  1441. | permit persons to whom the Software is furnished to do so, subject to
  1442. | the following conditions:
  1443. |
  1444. | The above copyright notice and this permission notice shall be
  1445. | included in all copies or substantial portions of the Software.
  1446. |
  1447. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1448. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1449. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1450. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1451. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1452. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1453. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1454. |
  1455. ==================================================================== */
  1456. //jshint eqnull:true
  1457. define('amber/kernel-language',[],function () {
  1458. "use strict";
  1459. function inherits (child, parent) {
  1460. child.prototype = Object.create(parent.prototype, {
  1461. constructor: {
  1462. value: child,
  1463. enumerable: false, configurable: true, writable: true
  1464. }
  1465. });
  1466. return child;
  1467. }
  1468. function defineMethod (klass, name, method) {
  1469. Object.defineProperty(klass.prototype, name, {
  1470. value: method,
  1471. enumerable: false, configurable: true, writable: true
  1472. });
  1473. }
  1474. TraitsBrik.deps = ["event", "behaviors", "methods", "composition", "root"];
  1475. function TraitsBrik (brikz, st) {
  1476. var coreFns = brikz.root.coreFns;
  1477. var SmalltalkObject = brikz.root.Object;
  1478. var setupMethods = brikz.methods.setupMethods;
  1479. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1480. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1481. var emit = brikz.event.emit;
  1482. var declareEvent = brikz.event.declareEvent;
  1483. function SmalltalkTrait () {
  1484. }
  1485. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkObject);
  1486. SmalltalkTrait.prototype.trait = true;
  1487. defineMethod(SmalltalkTrait, "toString", function () {
  1488. return 'Smalltalk Trait ' + this.name;
  1489. });
  1490. declareEvent("traitAdded");
  1491. defineMethod(SmalltalkTrait, "added", function () {
  1492. emit.traitAdded(this);
  1493. });
  1494. declareEvent("traitRemoved");
  1495. defineMethod(SmalltalkTrait, "removed", function () {
  1496. emit.traitRemoved(this);
  1497. });
  1498. declareEvent("traitMethodAdded");
  1499. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1500. var self = this;
  1501. this.traitUsers.forEach(function (each) {
  1502. traitMethodChanged(method.selector, method, self, each);
  1503. });
  1504. emit.traitMethodAdded(method, this);
  1505. });
  1506. declareEvent("traitMethodRemoved");
  1507. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1508. var self = this;
  1509. this.traitUsers.forEach(function (each) {
  1510. traitMethodChanged(method.selector, null, self, each);
  1511. });
  1512. emit.traitMethodRemoved(method, this);
  1513. });
  1514. function traitBuilder (traitName) {
  1515. return {
  1516. name: traitName,
  1517. make: function () {
  1518. var that = new SmalltalkTrait();
  1519. that.name = traitName;
  1520. that.traitUsers = [];
  1521. setupMethods(that);
  1522. return that;
  1523. },
  1524. updateExisting: function (trait) {
  1525. }
  1526. };
  1527. }
  1528. st.addTrait = function (className, category) {
  1529. return buildTraitOrClass(category, traitBuilder(className));
  1530. };
  1531. }
  1532. MethodCompositionBrik.deps = ["methods", "arraySet"];
  1533. function MethodCompositionBrik (brikz, st) {
  1534. var updateMethod = brikz.methods.updateMethod;
  1535. var addElement = brikz.arraySet.addElement;
  1536. var removeElement = brikz.arraySet.removeElement;
  1537. function aliased (selector, method) {
  1538. if (method.selector === selector) return method;
  1539. var result = st.method({
  1540. selector: selector,
  1541. args: method.args,
  1542. protocol: method.protocol,
  1543. source: '"Aliased as ' + selector + '"\n' + method.source,
  1544. messageSends: method.messageSends,
  1545. referencesClasses: method.referencedClasses,
  1546. fn: method.fn
  1547. });
  1548. result.owner = method.owner;
  1549. return result;
  1550. }
  1551. function deleteKeysFrom (keys, obj) {
  1552. keys.forEach(function (each) {
  1553. delete obj[each];
  1554. });
  1555. }
  1556. function fillTraitTransformation (traitTransformation, obj) {
  1557. // assert(Object.getOwnProperties(obj).length === 0)
  1558. var traitMethods = traitTransformation.trait.methods;
  1559. Object.keys(traitMethods).forEach(function (selector) {
  1560. obj[selector] = traitMethods[selector];
  1561. });
  1562. var traitAliases = traitTransformation.aliases;
  1563. if (traitAliases) {
  1564. Object.keys(traitAliases).forEach(function (aliasSelector) {
  1565. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  1566. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  1567. // else delete obj[aliasSelector]; // semantically correct; optimized away
  1568. });
  1569. }
  1570. var traitExclusions = traitTransformation.exclusions;
  1571. if (traitExclusions) {
  1572. deleteKeysFrom(traitExclusions, obj);
  1573. }
  1574. return obj;
  1575. }
  1576. function buildCompositionChain (traitComposition) {
  1577. return traitComposition.reduce(function (soFar, each) {
  1578. return fillTraitTransformation(each, Object.create(soFar));
  1579. }, null);
  1580. }
  1581. st.setTraitComposition = function (traitComposition, traitOrBehavior) {
  1582. var oldLocalMethods = traitOrBehavior.localMethods,
  1583. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  1584. Object.keys(oldLocalMethods).forEach(function (selector) {
  1585. newLocalMethods[selector] = oldLocalMethods[selector];
  1586. });
  1587. var selector;
  1588. traitOrBehavior.localMethods = newLocalMethods;
  1589. for (selector in newLocalMethods) {
  1590. updateMethod(selector, traitOrBehavior);
  1591. }
  1592. for (selector in oldLocalMethods) {
  1593. updateMethod(selector, traitOrBehavior);
  1594. }
  1595. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  1596. removeElement(each.trait.traitUsers, traitOrBehavior);
  1597. });
  1598. traitOrBehavior.traitComposition = traitComposition && traitComposition.length ? traitComposition : null;
  1599. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  1600. addElement(each.trait.traitUsers, traitOrBehavior);
  1601. });
  1602. };
  1603. function aliasesOfSelector (selector, traitAliases) {
  1604. if (!traitAliases) return [selector];
  1605. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  1606. return traitAliases[aliasSelector] === selector
  1607. });
  1608. if (!traitAliases[selector]) result.push(selector);
  1609. return result;
  1610. }
  1611. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  1612. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  1613. changes.forEach(function (aliasSelector) {
  1614. obj[aliasSelector] = aliased(aliasSelector, method);
  1615. });
  1616. var traitExclusions = traitTransformation.exclusions;
  1617. if (traitExclusions) {
  1618. deleteKeysFrom(traitExclusions, obj);
  1619. }
  1620. return changes;
  1621. }
  1622. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  1623. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  1624. deleteKeysFrom(changes, obj);
  1625. return changes;
  1626. }
  1627. function traitMethodChanged (selector, method, trait, traitOrBehavior) {
  1628. var traitComposition = traitOrBehavior.traitComposition,
  1629. chain = traitOrBehavior.localMethods,
  1630. changes = [];
  1631. for (var i = traitComposition.length - 1; i >= 0; --i) {
  1632. chain = Object.getPrototypeOf(chain);
  1633. var traitTransformation = traitComposition[i];
  1634. if (traitTransformation.trait !== trait) continue;
  1635. changes.push.apply(changes, method ?
  1636. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  1637. applyTraitMethodDeletion(selector, traitTransformation, chain));
  1638. }
  1639. // assert(chain === null);
  1640. changes.forEach(function (each) {
  1641. updateMethod(each, traitOrBehavior);
  1642. });
  1643. }
  1644. this.traitMethodChanged = traitMethodChanged;
  1645. }
  1646. ClassesBrik.deps = ["root", "event", "behaviors", "methods", "arraySet", "smalltalkGlobals"];
  1647. function ClassesBrik (brikz, st) {
  1648. var SmalltalkRoot = brikz.root.Root;
  1649. var coreFns = brikz.root.coreFns;
  1650. var globals = brikz.smalltalkGlobals.globals;
  1651. var SmalltalkObject = brikz.root.Object;
  1652. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1653. var setupMethods = brikz.methods.setupMethods;
  1654. var removeTraitOrClass = brikz.behaviors.removeTraitOrClass;
  1655. var addElement = brikz.arraySet.addElement;
  1656. var removeElement = brikz.arraySet.removeElement;
  1657. var emit = brikz.event.emit;
  1658. var declareEvent = brikz.event.declareEvent;
  1659. function SmalltalkBehavior () {
  1660. }
  1661. function SmalltalkClass () {
  1662. }
  1663. function SmalltalkMetaclass () {
  1664. }
  1665. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkObject);
  1666. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  1667. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  1668. // Fake root class of the system.
  1669. // Effective superclass of all classes created with `nil subclass: ...`.
  1670. var nilAsClass = this.nilAsClass = {
  1671. fn: SmalltalkRoot,
  1672. a$cls: {fn: SmalltalkClass}
  1673. };
  1674. SmalltalkMetaclass.prototype.meta = true;
  1675. defineMethod(SmalltalkClass, "toString", function () {
  1676. return 'Smalltalk ' + this.name;
  1677. });
  1678. defineMethod(SmalltalkMetaclass, "toString", function () {
  1679. return 'Smalltalk Metaclass ' + this.instanceClass.name;
  1680. });
  1681. declareEvent("classAdded");
  1682. defineMethod(SmalltalkClass, "added", function () {
  1683. addSubclass(this);
  1684. emit.classAdded(this);
  1685. });
  1686. declareEvent("classRemoved");
  1687. defineMethod(SmalltalkClass, "removed", function () {
  1688. emit.classRemoved(this);
  1689. removeSubclass(this);
  1690. });
  1691. declareEvent("behaviorMethodAdded");
  1692. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  1693. emit.behaviorMethodAdded(method, this);
  1694. });
  1695. declareEvent("behaviorMethodRemove");
  1696. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  1697. emit.behaviorMethodRemoved(method, this);
  1698. });
  1699. // TODO remove, ["@foo"] backward compatibility
  1700. function installIvarCompat (klass) {
  1701. var ivars = klass.slots;
  1702. ivars.forEach(function (ivar) {
  1703. Object.defineProperty(klass.fn.prototype, "@" + ivar, {
  1704. get: function () {
  1705. return this[ivar];
  1706. },
  1707. set: function (value) {
  1708. return this[ivar] = value;
  1709. },
  1710. enumerable: false,
  1711. configurable: true
  1712. });
  1713. });
  1714. }
  1715. this.installIvarCompat = installIvarCompat;
  1716. function setSlots (klass, slots) {
  1717. slots.forEach(function (name) {
  1718. if (!name.match(/^[a-zA-Z][a-zA-Z0-9]*$/))
  1719. throw new Error("Wrong identifier name: " + name);
  1720. });
  1721. klass.slots = slots;
  1722. installIvarCompat(klass);
  1723. }
  1724. st.setSlots = setSlots;
  1725. // TODO remove, .iVarNames backward compatibility
  1726. Object.defineProperty(SmalltalkBehavior.prototype, "iVarNames", {
  1727. enumerable: true,
  1728. configurable: true,
  1729. get: function () {
  1730. return this.slots;
  1731. },
  1732. set: function (instanceVariableNames) {
  1733. setSlots(this, instanceVariableNames);
  1734. }
  1735. });
  1736. this.bootstrapHierarchy = function () {
  1737. var nilSubclasses = [globals.ProtoObject];
  1738. nilAsClass.a$cls = globals.Class;
  1739. nilSubclasses.forEach(function (each) {
  1740. each.a$cls.superclass = globals.Class;
  1741. addSubclass(each.a$cls);
  1742. });
  1743. };
  1744. /* Smalltalk class creation. A class is an instance of an automatically
  1745. created metaclass object. Newly created classes (not their metaclass)
  1746. should be added to the system, see smalltalk.addClass().
  1747. Superclass linking is *not* handled here, see api.initialize() */
  1748. function classBuilder (className, superclass, fn) {
  1749. var logicalSuperclass = superclass;
  1750. if (superclass == null || superclass.a$nil) {
  1751. superclass = nilAsClass;
  1752. logicalSuperclass = null;
  1753. }
  1754. function klass () {
  1755. var that = metaclass().instanceClass;
  1756. that.superclass = logicalSuperclass;
  1757. that.fn = fn || inherits(function () {
  1758. }, superclass.fn);
  1759. that.slots = [];
  1760. that.name = className;
  1761. that.subclasses = [];
  1762. setupMethods(that);
  1763. return that;
  1764. }
  1765. function metaclass () {
  1766. var that = new SmalltalkMetaclass();
  1767. that.superclass = superclass.a$cls;
  1768. that.fn = inherits(function () {
  1769. }, that.superclass.fn);
  1770. that.slots = [];
  1771. that.instanceClass = new that.fn();
  1772. wireKlass(that);
  1773. setupMethods(that);
  1774. return that;
  1775. }
  1776. return {
  1777. name: className,
  1778. make: klass,
  1779. updateExisting: function (klass) {
  1780. if (klass.superclass != logicalSuperclass || fn && fn !== klass.fn)
  1781. throw new Error("Incompatible change of class: " + klass.name);
  1782. }
  1783. };
  1784. }
  1785. function wireKlass (klass) {
  1786. Object.defineProperty(klass.fn.prototype, "a$cls", {
  1787. value: klass,
  1788. enumerable: false, configurable: true, writable: true
  1789. });
  1790. }
  1791. this.wireKlass = wireKlass;
  1792. /* Add a class to the system, creating a new one if needed.
  1793. A Package is lazily created if one with given name does not exist. */
  1794. st.addClass = function (className, superclass, category) {
  1795. // TODO remove, backward compatibility
  1796. if (arguments[3]) {
  1797. var added = st.addClass(className, superclass, arguments[3]);
  1798. setSlots(added, category);
  1799. return added;
  1800. }
  1801. // While subclassing nil is allowed, it might be an error, so
  1802. // warn about it.
  1803. if (typeof superclass === 'undefined' || superclass && superclass.a$nil) {
  1804. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  1805. }
  1806. return buildTraitOrClass(category, classBuilder(className, superclass, coreFns[className]));
  1807. };
  1808. st.removeClass = removeTraitOrClass;
  1809. function addSubclass (klass) {
  1810. if (klass.superclass) {
  1811. addElement(klass.superclass.subclasses, klass);
  1812. }
  1813. }
  1814. function removeSubclass (klass) {
  1815. if (klass.superclass) {
  1816. removeElement(klass.superclass.subclasses, klass);
  1817. }
  1818. }
  1819. function metaSubclasses (metaclass) {
  1820. return metaclass.instanceClass.subclasses
  1821. .filter(function (each) {
  1822. return !each.meta;
  1823. })
  1824. .map(function (each) {
  1825. return each.a$cls;
  1826. });
  1827. }
  1828. st.metaSubclasses = metaSubclasses;
  1829. st.traverseClassTree = function (klass, fn) {
  1830. var queue = [klass], sentinel = {};
  1831. for (var i = 0; i < queue.length; ++i) {
  1832. var item = queue[i];
  1833. if (fn(item, sentinel) === sentinel) continue;
  1834. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  1835. queue.push.apply(queue, subclasses);
  1836. }
  1837. };
  1838. }
  1839. /* Making smalltalk that can load */
  1840. function configureWithHierarchy (brikz) {
  1841. brikz.traits = TraitsBrik;
  1842. brikz.composition = MethodCompositionBrik;
  1843. brikz.classes = ClassesBrik;
  1844. brikz.rebuild();
  1845. }
  1846. return configureWithHierarchy;
  1847. });
  1848. //jshint eqnull:true
  1849. define('amber/kernel-runtime',[],function () {
  1850. "use strict";
  1851. function defineMethod (klass, name, method) {
  1852. Object.defineProperty(klass.prototype, name, {
  1853. value: method,
  1854. enumerable: false, configurable: true, writable: true
  1855. });
  1856. }
  1857. function installJSMethod (obj, jsSelector, fn) {
  1858. Object.defineProperty(obj, jsSelector, {
  1859. value: fn,
  1860. enumerable: false, configurable: true, writable: true
  1861. });
  1862. }
  1863. RuntimeSelectorsBrik.deps = ["selectors", "selectorConversion", "smalltalkGlobals", "classes"];
  1864. function RuntimeSelectorsBrik (brikz, st) {
  1865. var selectors = brikz.selectors.selectors;
  1866. var globals = brikz.smalltalkGlobals.globals;
  1867. var nilAsClass = brikz.classes.nilAsClass;
  1868. var st2js = brikz.selectorConversion.st2js;
  1869. var jsSelectors = this.jsSelectors = [];
  1870. /* Method not implemented handlers */
  1871. function installNewSelectors (newSelectors, targetClasses) {
  1872. newSelectors.forEach(function (selector) {
  1873. var jsSelector = st2js(selector);
  1874. jsSelectors.push(jsSelector);
  1875. var fn = createDnuHandler(selector);
  1876. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  1877. targetClasses.forEach(function (target) {
  1878. installJSMethod(target.fn.prototype, jsSelector, fn);
  1879. });
  1880. });
  1881. }
  1882. this.installNewSelectors = installNewSelectors;
  1883. /* Dnu handler method */
  1884. function createDnuHandler (stSelector) {
  1885. return function () {
  1886. return globals.Message._selector_arguments_notUnderstoodBy_(
  1887. stSelector, [].slice.call(arguments), this
  1888. );
  1889. };
  1890. }
  1891. installNewSelectors(selectors, []);
  1892. }
  1893. RuntimeClassesBrik.deps = ["event", "smalltalkGlobals", "runtimeSelectors", "behaviors", "classes", "runtimeMethods"];
  1894. function RuntimeClassesBrik (brikz, st) {
  1895. var globals = brikz.smalltalkGlobals.globals;
  1896. var jsSelectors = brikz.runtimeSelectors.jsSelectors;
  1897. var installNewSelectors = brikz.runtimeSelectors.installNewSelectors;
  1898. var installMethod = brikz.runtimeMethods.installMethod;
  1899. var traitsOrClasses = brikz.behaviors.traitsOrClasses;
  1900. var wireKlass = brikz.classes.wireKlass;
  1901. var installIvarCompat = brikz.classes.installIvarCompat;
  1902. var emit = brikz.event.emit;
  1903. var detachedRootClasses = [];
  1904. function markClassDetachedRoot (klass) {
  1905. klass.detachedRoot = true;
  1906. detachedRootClasses = traitsOrClasses.filter(function (klass) {
  1907. return klass.detachedRoot;
  1908. });
  1909. }
  1910. emit.selectorsAdded = function (newSelectors) {
  1911. installNewSelectors(newSelectors, detachedRootClasses);
  1912. };
  1913. /* Initialize a class in its class hierarchy. Handle both classes and
  1914. metaclasses. */
  1915. function initClassAndMetaclass (klass) {
  1916. initClass(klass);
  1917. if (klass.a$cls && !klass.meta) {
  1918. initClass(klass.a$cls);
  1919. }
  1920. }
  1921. traitsOrClasses.forEach(function (traitOrClass) {
  1922. if (!traitOrClass.trait) initClassAndMetaclass(traitOrClass);
  1923. });
  1924. emit.classAdded = function (klass) {
  1925. initClassAndMetaclass(klass);
  1926. klass._enterOrganization();
  1927. };
  1928. emit.traitAdded = function (trait) {
  1929. trait._enterOrganization();
  1930. };
  1931. emit.classRemoved = function (klass) {
  1932. klass._leaveOrganization();
  1933. };
  1934. emit.traitRemoved = function (trait) {
  1935. trait._leaveOrganization();
  1936. };
  1937. function initClass (klass) {
  1938. wireKlass(klass);
  1939. if (klass.detachedRoot) {
  1940. copySuperclass(klass);
  1941. }
  1942. installMethods(klass);
  1943. }
  1944. function copySuperclass (klass) {
  1945. var myproto = klass.fn.prototype,
  1946. superproto = klass.superclass.fn.prototype;
  1947. jsSelectors.forEach(function (jsSelector) {
  1948. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  1949. });
  1950. }
  1951. function installMethods (klass) {
  1952. var methods = klass.methods;
  1953. Object.keys(methods).forEach(function (selector) {
  1954. installMethod(methods[selector], klass);
  1955. });
  1956. }
  1957. /* Create an alias for an existing class */
  1958. st.alias = function (traitOrClass, alias) {
  1959. globals[alias] = traitOrClass;
  1960. };
  1961. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  1962. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  1963. markClassDetachedRoot(klass);
  1964. klass.fn = constructor;
  1965. installIvarCompat(klass);
  1966. initClass(klass);
  1967. };
  1968. }
  1969. FrameBindingBrik.deps = ["smalltalkGlobals", "runtimeClasses"];
  1970. function FrameBindingBrik (brikz, st) {
  1971. var globals = brikz.smalltalkGlobals.globals;
  1972. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1973. setClassConstructor(globals.Number, Number);
  1974. setClassConstructor(globals.BlockClosure, Function);
  1975. setClassConstructor(globals.Boolean, Boolean);
  1976. setClassConstructor(globals.Date, Date);
  1977. setClassConstructor(globals.String, String);
  1978. setClassConstructor(globals.Array, Array);
  1979. setClassConstructor(globals.RegularExpression, RegExp);
  1980. setClassConstructor(globals.Error, Error);
  1981. setClassConstructor(globals.Promise, Promise);
  1982. this.__init__ = function () {
  1983. st.alias(globals.Array, "OrderedCollection");
  1984. st.alias(globals.Date, "Time");
  1985. }
  1986. }
  1987. RuntimeMethodsBrik.deps = ["event", "selectorConversion"];
  1988. function RuntimeMethodsBrik (brikz, st) {
  1989. var st2js = brikz.selectorConversion.st2js;
  1990. var emit = brikz.event.emit;
  1991. function installMethod (method, klass) {
  1992. var jsSelector = method.jsSelector;
  1993. if (!jsSelector) {
  1994. jsSelector = method.jsSelector = st2js(method.selector);
  1995. }
  1996. installJSMethod(klass.fn.prototype, jsSelector, method.fn);
  1997. }
  1998. this.installMethod = installMethod;
  1999. emit.behaviorMethodAdded = function (method, klass) {
  2000. installMethod(method, klass);
  2001. propagateMethodChange(klass, method, klass);
  2002. };
  2003. emit.behaviorMethodRemoved = function (method, klass) {
  2004. delete klass.fn.prototype[method.jsSelector];
  2005. propagateMethodChange(klass, method, null);
  2006. };
  2007. emit.methodReplaced = function (newMethod, oldMethod, traitOrBehavior) {
  2008. traitOrBehavior._methodOrganizationEnter_andLeave_(newMethod, oldMethod);
  2009. };
  2010. function propagateMethodChange (klass, method, exclude) {
  2011. var selector = method.selector;
  2012. var jsSelector = method.jsSelector;
  2013. st.traverseClassTree(klass, function (subclass, sentinel) {
  2014. if (subclass === exclude) return;
  2015. if (subclass.methods[selector]) return sentinel;
  2016. if (subclass.detachedRoot) {
  2017. installJSMethod(subclass.fn.prototype, jsSelector, subclass.superclass.fn.prototype[jsSelector]);
  2018. }
  2019. });
  2020. }
  2021. }
  2022. PrimitivesBrik.deps = ["smalltalkGlobals"];
  2023. function PrimitivesBrik (brikz, st) {
  2024. var globals = brikz.smalltalkGlobals.globals;
  2025. /* Converts a JavaScript object to valid Smalltalk Object */
  2026. st.readJSObject = function (js) {
  2027. if (js == null) return null;
  2028. else if (Array.isArray(js)) return js.map(st.readJSObject);
  2029. else if (js.constructor !== Object) return js;
  2030. var pairs = [];
  2031. for (var i in js) {
  2032. pairs.push(i, st.readJSObject(js[i]));
  2033. }
  2034. return globals.Dictionary._newFromPairs_(pairs);
  2035. };
  2036. /* Boolean assertion */
  2037. st.assert = function (shouldBeBoolean) {
  2038. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  2039. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  2040. shouldBeBoolean = shouldBeBoolean.valueOf();
  2041. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  2042. }
  2043. globals.NonBooleanReceiver._signalOn_(shouldBeBoolean);
  2044. };
  2045. }
  2046. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  2047. function RuntimeBrik (brikz, st) {
  2048. var globals = brikz.smalltalkGlobals.globals;
  2049. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  2050. function SmalltalkMethodContext (home, setup) {
  2051. // TODO lazy fill of .sendIdx
  2052. this.sendIdx = {};
  2053. // TODO very likely .senderContext, not .homeContext here
  2054. this.homeContext = home;
  2055. this.setup = setup;
  2056. }
  2057. // Fallbacks
  2058. SmalltalkMethodContext.prototype.supercall = false;
  2059. SmalltalkMethodContext.prototype.locals = Object.freeze({});
  2060. SmalltalkMethodContext.prototype.receiver = null;
  2061. SmalltalkMethodContext.prototype.selector = null;
  2062. SmalltalkMethodContext.prototype.lookupClass = null;
  2063. SmalltalkMethodContext.prototype.outerContext = null;
  2064. SmalltalkMethodContext.prototype.index = 0;
  2065. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals, lookupClass) {
  2066. this.receiver = receiver;
  2067. this.selector = selector;
  2068. if (locals != null) this.locals = locals;
  2069. this.lookupClass = lookupClass;
  2070. if (this.homeContext) {
  2071. this.homeContext.evaluatedSelector = selector;
  2072. }
  2073. });
  2074. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  2075. if (locals != null) this.locals = locals;
  2076. this.outerContext = ctx;
  2077. if (index) this.index = index;
  2078. });
  2079. defineMethod(SmalltalkMethodContext, "method", function () {
  2080. var method;
  2081. var lookup = this.lookupClass || this.receiver.a$cls;
  2082. while (!method && lookup) {
  2083. method = lookup.methods[st.js2st(this.selector)];
  2084. lookup = lookup.superclass;
  2085. }
  2086. return method;
  2087. });
  2088. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  2089. /* This is the current call context object.
  2090. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  2091. In JS code, use api.getThisContext() (see below).
  2092. */
  2093. var thisContext = null;
  2094. /*
  2095. Runs worker function so that error handler is not set up
  2096. if there isn't one. This is accomplished by unconditional
  2097. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  2098. which then stops error handler setup (see st.withContext above).
  2099. The effect is, $core.seamless(fn)'s exceptions are not
  2100. handed into ST error handler and caller should process them.
  2101. */
  2102. st.seamless = function (worker) {
  2103. var oldContext = thisContext;
  2104. thisContext = new SmalltalkMethodContext(thisContext, function (ctx) {
  2105. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  2106. });
  2107. var result = worker(thisContext);
  2108. thisContext = oldContext;
  2109. return result;
  2110. };
  2111. function resultWithErrorHandling (worker) {
  2112. try {
  2113. return worker(thisContext);
  2114. } catch (error) {
  2115. globals.ErrorHandler._handleError_(error);
  2116. thisContext = null;
  2117. // Rethrow the error in any case.
  2118. throw error;
  2119. }
  2120. }
  2121. /*
  2122. Standard way to run within context.
  2123. Sets up error handler if entering first ST context in a stack.
  2124. */
  2125. st.withContext = function (worker, setup) {
  2126. var oldContext = thisContext;
  2127. thisContext = new SmalltalkMethodContext(thisContext, setup);
  2128. var result = oldContext == null ? resultWithErrorHandling(worker) : worker(thisContext);
  2129. thisContext = oldContext;
  2130. return result;
  2131. };
  2132. /* Handle thisContext pseudo variable */
  2133. st.getThisContext = function () {
  2134. if (!thisContext) return null;
  2135. for (var frame = thisContext; frame; frame = frame.homeContext) {
  2136. frame.setup(frame);
  2137. }
  2138. return thisContext;
  2139. };
  2140. }
  2141. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  2142. function MessageSendBrik (brikz, st) {
  2143. var globals = brikz.smalltalkGlobals.globals;
  2144. var nilAsReceiver = brikz.root.nilAsReceiver;
  2145. /* Send message programmatically. Used to implement #perform: & Co. */
  2146. st.send2 = function (self, selector, args, klass) {
  2147. if (self == null) {
  2148. self = nilAsReceiver;
  2149. }
  2150. var method = klass ? klass.fn.prototype[st.st2js(selector)] : self.a$cls && self[st.st2js(selector)];
  2151. return method != null ?
  2152. method.apply(self, args || []) :
  2153. globals.Message._selector_arguments_notUnderstoodBy_(
  2154. selector, [].slice.call(args), self.a$cls ? self : wrapJavaScript(self)
  2155. );
  2156. };
  2157. function wrapJavaScript (o) {
  2158. return globals.JSObjectProxy._on_(o);
  2159. }
  2160. st.wrapJavaScript = wrapJavaScript;
  2161. /* If the object property is a function, then call it, except if it starts with
  2162. an uppercase character (we probably want to answer the function itself in this
  2163. case and send it #new from Amber).
  2164. */
  2165. st.accessJavaScript = function (self, propertyName, args) {
  2166. var propertyValue = self[propertyName];
  2167. if (typeof propertyValue === "function" && !(args.length === 0 && /^[A-Z]/.test(propertyName)))
  2168. return propertyValue.apply(self, args);
  2169. switch (args.length) {
  2170. case 0:
  2171. return propertyValue;
  2172. case 1:
  2173. self[propertyName] = args[0];
  2174. return self;
  2175. default:
  2176. throw new Error("Cannot interpret " + propertyName + " with " + args.length + " arguments; field is a " + typeof propertyValue + ", not a function")
  2177. }
  2178. };
  2179. }
  2180. function SelectorConversionBrik (brikz, st) {
  2181. var st2jsMemo = Object.create(null);
  2182. /* Convert a Smalltalk selector into a JS selector */
  2183. function st2js (string) {
  2184. return '_' + string
  2185. .replace(/:/g, '_')
  2186. .replace(/[\&]/g, '_and')
  2187. .replace(/[\|]/g, '_or')
  2188. .replace(/[+]/g, '_plus')
  2189. .replace(/-/g, '_minus')
  2190. .replace(/[*]/g, '_star')
  2191. .replace(/[\/]/g, '_slash')
  2192. .replace(/[\\]/g, '_backslash')
  2193. .replace(/[\~]/g, '_tild')
  2194. .replace(/%/g, '_percent')
  2195. .replace(/>/g, '_gt')
  2196. .replace(/</g, '_lt')
  2197. .replace(/=/g, '_eq')
  2198. .replace(/,/g, '_comma')
  2199. .replace(/[@]/g, '_at');
  2200. };
  2201. st.st2js = function (stSelector) {
  2202. return st2jsMemo[stSelector] || st2js(stSelector);
  2203. };
  2204. this.st2js = function (stSelector) {
  2205. return st2jsMemo[stSelector] || (st2jsMemo[stSelector] = st2js(stSelector));
  2206. };
  2207. /* Convert a string to a valid smalltalk selector.
  2208. if you modify the following functions, also change st2js
  2209. accordingly */
  2210. st.js2st = function (selector) {
  2211. if (selector.match(/^__/)) {
  2212. return binaryJsToSt(selector);
  2213. } else {
  2214. return keywordJsToSt(selector);
  2215. }
  2216. };
  2217. function keywordJsToSt (selector) {
  2218. return selector.replace(/^_/, '').replace(/_/g, ':');
  2219. }
  2220. function binaryJsToSt (selector) {
  2221. return selector
  2222. .replace(/^_/, '')
  2223. .replace(/_and/g, '&')
  2224. .replace(/_or/g, '|')
  2225. .replace(/_plus/g, '+')
  2226. .replace(/_minus/g, '-')
  2227. .replace(/_star/g, '*')
  2228. .replace(/_slash/g, '/')
  2229. .replace(/_backslash/g, '\\')
  2230. .replace(/_tild/g, '~')
  2231. .replace(/_percent/g, '%')
  2232. .replace(/_gt/g, '>')
  2233. .replace(/_lt/g, '<')
  2234. .replace(/_eq/g, '=')
  2235. .replace(/_comma/g, ',')
  2236. .replace(/_at/g, '@');
  2237. }
  2238. st.st2prop = function (stSelector) {
  2239. var colonPosition = stSelector.indexOf(':');
  2240. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  2241. };
  2242. }
  2243. StartImageBrik.deps = ["smalltalkGlobals"];
  2244. function StartImageBrik (brikz, st) {
  2245. var globals = brikz.smalltalkGlobals.globals;
  2246. this.run = function () {
  2247. return globals.AmberBootstrapInitialization._run();
  2248. };
  2249. }
  2250. /* Making smalltalk that can run */
  2251. function configureWithRuntime (brikz) {
  2252. brikz.runtimeSelectors = RuntimeSelectorsBrik;
  2253. brikz.runtimeClasses = RuntimeClassesBrik;
  2254. brikz.frameBinding = FrameBindingBrik;
  2255. brikz.runtimeMethods = RuntimeMethodsBrik;
  2256. brikz.messageSend = MessageSendBrik;
  2257. brikz.runtime = RuntimeBrik;
  2258. brikz.primitives = PrimitivesBrik;
  2259. brikz.selectorConversion = SelectorConversionBrik;
  2260. brikz.startImage = StartImageBrik;
  2261. brikz.rebuild();
  2262. }
  2263. return configureWithRuntime;
  2264. });
  2265. /* ====================================================================
  2266. |
  2267. | Amber Smalltalk
  2268. | http://amber-lang.net
  2269. |
  2270. ======================================================================
  2271. ======================================================================
  2272. |
  2273. | Copyright (c) 2010-2014
  2274. | Nicolas Petton <petton.nicolas@gmail.com>
  2275. |
  2276. | Copyright (c) 2012-2017
  2277. | The Amber team https://lolg.it/org/amber/members
  2278. | Amber contributors (see /CONTRIBUTORS)
  2279. |
  2280. | Amber is released under the MIT license
  2281. |
  2282. | Permission is hereby granted, free of charge, to any person obtaining
  2283. | a copy of this software and associated documentation files (the
  2284. | 'Software'), to deal in the Software without restriction, including
  2285. | without limitation the rights to use, copy, modify, merge, publish,
  2286. | distribute, sublicense, and/or sell copies of the Software, and to
  2287. | permit persons to whom the Software is furnished to do so, subject to
  2288. | the following conditions:
  2289. |
  2290. | The above copyright notice and this permission notice shall be
  2291. | included in all copies or substantial portions of the Software.
  2292. |
  2293. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  2294. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2295. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  2296. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  2297. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  2298. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  2299. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  2300. |
  2301. ==================================================================== */
  2302. //jshint eqnull:true
  2303. define('amber/boot',[
  2304. 'require', './kernel-checks', './brikz', './kernel-fundamentals', './kernel-language'
  2305. ], function (require, _, Brikz, configureWithFundamentals, configureWithHierarchy) {
  2306. "use strict";
  2307. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  2308. require(['./kernel-runtime'], resolve, reject);
  2309. });
  2310. function SmalltalkInitBrik (brikz, st) {
  2311. var initialized = false;
  2312. /* Smalltalk initialization. Called on page load */
  2313. st.initialize = function () {
  2314. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  2315. if (initialized) return;
  2316. brikz.classes.bootstrapHierarchy();
  2317. configureWithRuntime(brikz);
  2318. return Promise.resolve(brikz.startImage.run())
  2319. .then(function () {
  2320. initialized = true;
  2321. });
  2322. });
  2323. };
  2324. }
  2325. /* Adds AMD and requirejs related methods to the api */
  2326. function AMDBrik (brikz, st) {
  2327. st.amdRequire = require;
  2328. st.defaultTransportType = st.defaultTransportType || "amd";
  2329. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber/core";
  2330. }
  2331. /* Defines asReceiver to be present at load time */
  2332. /* (logically it belongs more to PrimitiveBrik) */
  2333. AsReceiverBrik.deps = ["nil"];
  2334. function AsReceiverBrik (brikz, st) {
  2335. var nilAsReceiver = brikz.nil.nilAsReceiver;
  2336. /**
  2337. * This function is used all over the compiled amber code.
  2338. * It takes any value (JavaScript or Smalltalk)
  2339. * and returns a proper Amber Smalltalk receiver.
  2340. *
  2341. * null or undefined -> nilAsReceiver,
  2342. * object having Smalltalk signature -> unchanged,
  2343. * otherwise wrapped foreign (JS) object
  2344. */
  2345. this.asReceiver = function (o) {
  2346. if (o == null) return nilAsReceiver;
  2347. else if (o.a$cls != null) return o;
  2348. else return st.wrapJavaScript(o);
  2349. };
  2350. }
  2351. var api = {};
  2352. var brikz = new Brikz(api);
  2353. configureWithFundamentals(brikz);
  2354. configureWithHierarchy(brikz);
  2355. brikz.asReceiver = AsReceiverBrik;
  2356. brikz.stInit = SmalltalkInitBrik;
  2357. brikz.amd = AMDBrik;
  2358. brikz.rebuild();
  2359. // TODO deprecated, remove
  2360. Object.defineProperty(brikz.smalltalkGlobals.globals, "CharacterArray", {
  2361. enumerable: true,
  2362. configurable: true,
  2363. get: function () {
  2364. return this.String;
  2365. }
  2366. });
  2367. return {
  2368. api: api,
  2369. nilAsReceiver: brikz.nil.nilAsReceiver,
  2370. nilAsValue: brikz.nil.nilAsValue,
  2371. nilAsClass: brikz.classes.nilAsClass,
  2372. globals: brikz.smalltalkGlobals.globals,
  2373. asReceiver: brikz.asReceiver.asReceiver
  2374. };
  2375. });
  2376. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  2377. var globals = boot.globals,
  2378. exports = {},
  2379. api = boot.api,
  2380. nil = boot.nilAsReceiver;
  2381. // API
  2382. exports.popupHelios = function () {
  2383. require(['helios/index'], function (helios) {
  2384. helios.popup();
  2385. }, function (err) {
  2386. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  2387. });
  2388. };
  2389. Object.defineProperty(exports, "api", {
  2390. value: api,
  2391. enumerable: true, configurable: true, writable: false
  2392. });
  2393. Object.defineProperty(exports, "globals", {
  2394. value: globals,
  2395. enumerable: true, configurable: true, writable: false
  2396. });
  2397. Object.defineProperty(exports, "nil", {
  2398. value: nil,
  2399. enumerable: true, configurable: true, writable: false
  2400. });
  2401. function mixinToSettings (source) {
  2402. var settings = globals.SmalltalkSettings;
  2403. Object.keys(source).forEach(function (key) {
  2404. settings[key] = source[key];
  2405. });
  2406. }
  2407. function settingsInLocalStorage () {
  2408. //jshint evil:true
  2409. var storage = 'localStorage' in global && global.localStorage;
  2410. if (storage) {
  2411. var fromStorage;
  2412. try {
  2413. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  2414. } catch (ex) {
  2415. // pass
  2416. }
  2417. mixinToSettings(fromStorage || {});
  2418. if (typeof window !== "undefined") {
  2419. window.addEventListener('beforeunload', function () {
  2420. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  2421. });
  2422. }
  2423. }
  2424. }
  2425. exports.initialize = function (options) {
  2426. return new Promise(function (resolve) {
  2427. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  2428. settingsInLocalStorage();
  2429. mixinToSettings(options || {});
  2430. resolve(api.initialize());
  2431. });
  2432. };
  2433. exports.loadPackages = function (modules) {
  2434. return new Promise(function (resolve, reject) {
  2435. require(modules, resolve, reject);
  2436. }).then(function () {
  2437. return globals.Smalltalk._postLoad();
  2438. });
  2439. };
  2440. exports.beClean = function () {
  2441. return globals.Smalltalk._beClean();
  2442. };
  2443. // Exports
  2444. return exports;
  2445. });
  2446. define('amber/core/Kernel-Helpers',["amber/boot", "require"], function($boot,requirejs){"use strict";
  2447. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2448. var $pkg = $core.addPackage("Kernel-Helpers");
  2449. $pkg.innerEval = function (expr) { return eval(expr); };
  2450. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  2451. $core.addTrait("TSubclassable", "Kernel-Helpers");
  2452. $core.addMethod(
  2453. $core.method({
  2454. selector: "subclass:",
  2455. protocol: "class creation",
  2456. fn: function (aString){
  2457. var self=this,$self=this;
  2458. return $core.withContext(function($ctx1) {
  2459. return $self._subclass_slots_package_(aString,[],nil);
  2460. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.TSubclassable)});
  2461. },
  2462. args: ["aString"],
  2463. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString slots: #() package: nil",
  2464. referencedClasses: [],
  2465. messageSends: ["subclass:slots:package:"]
  2466. }),
  2467. $globals.TSubclassable);
  2468. $core.addMethod(
  2469. $core.method({
  2470. selector: "subclass:instanceVariableNames:",
  2471. protocol: "class creation",
  2472. fn: function (aString,anotherString){
  2473. var self=this,$self=this;
  2474. return $core.withContext(function($ctx1) {
  2475. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  2476. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.TSubclassable)});
  2477. },
  2478. args: ["aString", "anotherString"],
  2479. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  2480. referencedClasses: [],
  2481. messageSends: ["subclass:instanceVariableNames:package:"]
  2482. }),
  2483. $globals.TSubclassable);
  2484. $core.addMethod(
  2485. $core.method({
  2486. selector: "subclass:instanceVariableNames:category:",
  2487. protocol: "class creation",
  2488. fn: function (aString,aString2,aString3){
  2489. var self=this,$self=this;
  2490. return $core.withContext(function($ctx1) {
  2491. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2492. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2493. },
  2494. args: ["aString", "aString2", "aString3"],
  2495. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2496. referencedClasses: [],
  2497. messageSends: ["subclass:instanceVariableNames:package:"]
  2498. }),
  2499. $globals.TSubclassable);
  2500. $core.addMethod(
  2501. $core.method({
  2502. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2503. protocol: "class creation",
  2504. fn: function (aString,aString2,classVars,pools,aString3){
  2505. var self=this,$self=this;
  2506. return $core.withContext(function($ctx1) {
  2507. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2508. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2509. },
  2510. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  2511. 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",
  2512. referencedClasses: [],
  2513. messageSends: ["subclass:instanceVariableNames:package:"]
  2514. }),
  2515. $globals.TSubclassable);
  2516. $core.addMethod(
  2517. $core.method({
  2518. selector: "subclass:instanceVariableNames:package:",
  2519. protocol: "class creation",
  2520. fn: function (aString,aString2,aString3){
  2521. var self=this,$self=this;
  2522. return $core.withContext(function($ctx1) {
  2523. return $self._subclass_slots_package_(aString,$recv(aString2)._instanceVariablesStringAsSlotList(),aString3);
  2524. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2525. },
  2526. args: ["aString", "aString2", "aString3"],
  2527. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString slots: aString2 instanceVariablesStringAsSlotList package: aString3",
  2528. referencedClasses: [],
  2529. messageSends: ["subclass:slots:package:", "instanceVariablesStringAsSlotList"]
  2530. }),
  2531. $globals.TSubclassable);
  2532. $core.addMethod(
  2533. $core.method({
  2534. selector: "subclass:slots:",
  2535. protocol: "class creation",
  2536. fn: function (aString,aCollection){
  2537. var self=this,$self=this;
  2538. return $core.withContext(function($ctx1) {
  2539. return $self._subclass_slots_package_(aString,aCollection,nil);
  2540. }, function($ctx1) {$ctx1.fill(self,"subclass:slots:",{aString:aString,aCollection:aCollection},$globals.TSubclassable)});
  2541. },
  2542. args: ["aString", "aCollection"],
  2543. source: "subclass: aString slots: aCollection\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString slots: aCollection package: nil",
  2544. referencedClasses: [],
  2545. messageSends: ["subclass:slots:package:"]
  2546. }),
  2547. $globals.TSubclassable);
  2548. $core.addMethod(
  2549. $core.method({
  2550. selector: "subclass:slots:classVariables:package:",
  2551. protocol: "class creation",
  2552. fn: function (aString,aCollection,anObject,anotherString){
  2553. var self=this,$self=this;
  2554. return $core.withContext(function($ctx1) {
  2555. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_slots_package_(self,aString,aCollection,anotherString);
  2556. }, function($ctx1) {$ctx1.fill(self,"subclass:slots:classVariables:package:",{aString:aString,aCollection:aCollection,anObject:anObject,anotherString:anotherString},$globals.TSubclassable)});
  2557. },
  2558. args: ["aString", "aCollection", "anObject", "anotherString"],
  2559. source: "subclass: aString slots: aCollection classVariables: anObject package: anotherString\x0a\x09\x22Kept for file-in compatibility. ignores class variables.\x22\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString slots: aCollection package: anotherString",
  2560. referencedClasses: ["ClassBuilder"],
  2561. messageSends: ["superclass:subclass:slots:package:", "new"]
  2562. }),
  2563. $globals.TSubclassable);
  2564. $core.addMethod(
  2565. $core.method({
  2566. selector: "subclass:slots:classVariables:poolDictionaries:package:",
  2567. protocol: "class creation",
  2568. fn: function (aString,aCollection,anObject,anotherObject,anotherString){
  2569. var self=this,$self=this;
  2570. return $core.withContext(function($ctx1) {
  2571. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_slots_package_(self,aString,aCollection,anotherString);
  2572. }, function($ctx1) {$ctx1.fill(self,"subclass:slots:classVariables:poolDictionaries:package:",{aString:aString,aCollection:aCollection,anObject:anObject,anotherObject:anotherObject,anotherString:anotherString},$globals.TSubclassable)});
  2573. },
  2574. args: ["aString", "aCollection", "anObject", "anotherObject", "anotherString"],
  2575. source: "subclass: aString slots: aCollection classVariables: anObject poolDictionaries: anotherObject package: anotherString\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString slots: aCollection package: anotherString",
  2576. referencedClasses: ["ClassBuilder"],
  2577. messageSends: ["superclass:subclass:slots:package:", "new"]
  2578. }),
  2579. $globals.TSubclassable);
  2580. $core.addMethod(
  2581. $core.method({
  2582. selector: "subclass:slots:package:",
  2583. protocol: "class creation",
  2584. fn: function (aString,aCollection,anotherString){
  2585. var self=this,$self=this;
  2586. return $core.withContext(function($ctx1) {
  2587. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_slots_package_(self,aString,aCollection,anotherString);
  2588. }, function($ctx1) {$ctx1.fill(self,"subclass:slots:package:",{aString:aString,aCollection:aCollection,anotherString:anotherString},$globals.TSubclassable)});
  2589. },
  2590. args: ["aString", "aCollection", "anotherString"],
  2591. source: "subclass: aString slots: aCollection package: anotherString\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString slots: aCollection package: anotherString",
  2592. referencedClasses: ["ClassBuilder"],
  2593. messageSends: ["superclass:subclass:slots:package:", "new"]
  2594. }),
  2595. $globals.TSubclassable);
  2596. $core.addMethod(
  2597. $core.method({
  2598. selector: "subclass:uses:",
  2599. protocol: "class creation",
  2600. fn: function (aString,aTraitCompositionDescription){
  2601. var self=this,$self=this;
  2602. return $core.withContext(function($ctx1) {
  2603. return $self._subclass_uses_slots_package_(aString,aTraitCompositionDescription,[],nil);
  2604. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.TSubclassable)});
  2605. },
  2606. args: ["aString", "aTraitCompositionDescription"],
  2607. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription slots: #() package: nil",
  2608. referencedClasses: [],
  2609. messageSends: ["subclass:uses:slots:package:"]
  2610. }),
  2611. $globals.TSubclassable);
  2612. $core.addMethod(
  2613. $core.method({
  2614. selector: "subclass:uses:instanceVariableNames:",
  2615. protocol: "class creation",
  2616. fn: function (aString,aTraitCompositionDescription,anotherString){
  2617. var self=this,$self=this;
  2618. return $core.withContext(function($ctx1) {
  2619. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  2620. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.TSubclassable)});
  2621. },
  2622. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  2623. 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",
  2624. referencedClasses: [],
  2625. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2626. }),
  2627. $globals.TSubclassable);
  2628. $core.addMethod(
  2629. $core.method({
  2630. selector: "subclass:uses:instanceVariableNames:category:",
  2631. protocol: "class creation",
  2632. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2633. var self=this,$self=this;
  2634. return $core.withContext(function($ctx1) {
  2635. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2636. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2637. },
  2638. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2639. 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",
  2640. referencedClasses: [],
  2641. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2642. }),
  2643. $globals.TSubclassable);
  2644. $core.addMethod(
  2645. $core.method({
  2646. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2647. protocol: "class creation",
  2648. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  2649. var self=this,$self=this;
  2650. return $core.withContext(function($ctx1) {
  2651. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2652. }, 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)});
  2653. },
  2654. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  2655. 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",
  2656. referencedClasses: [],
  2657. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2658. }),
  2659. $globals.TSubclassable);
  2660. $core.addMethod(
  2661. $core.method({
  2662. selector: "subclass:uses:instanceVariableNames:package:",
  2663. protocol: "class creation",
  2664. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2665. var self=this,$self=this;
  2666. return $core.withContext(function($ctx1) {
  2667. return $self._subclass_uses_slots_package_(aString,aTraitCompositionDescription,$recv(aString2)._instanceVariablesStringAsSlotList(),aString3);
  2668. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2669. },
  2670. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2671. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription slots: aString2 instanceVariablesStringAsSlotList package: aString3",
  2672. referencedClasses: [],
  2673. messageSends: ["subclass:uses:slots:package:", "instanceVariablesStringAsSlotList"]
  2674. }),
  2675. $globals.TSubclassable);
  2676. $core.addMethod(
  2677. $core.method({
  2678. selector: "subclass:uses:slots:",
  2679. protocol: "class creation",
  2680. fn: function (aString,aTraitCompositionDescription,aCollection){
  2681. var self=this,$self=this;
  2682. return $core.withContext(function($ctx1) {
  2683. return $self._subclass_uses_slots_package_(aString,aTraitCompositionDescription,aCollection,nil);
  2684. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:slots:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection},$globals.TSubclassable)});
  2685. },
  2686. args: ["aString", "aTraitCompositionDescription", "aCollection"],
  2687. source: "subclass: aString uses: aTraitCompositionDescription slots: aCollection\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription slots: aCollection package: nil",
  2688. referencedClasses: [],
  2689. messageSends: ["subclass:uses:slots:package:"]
  2690. }),
  2691. $globals.TSubclassable);
  2692. $core.addMethod(
  2693. $core.method({
  2694. selector: "subclass:uses:slots:package:",
  2695. protocol: "class creation",
  2696. fn: function (aString,aTraitCompositionDescription,aCollection,aString3){
  2697. var self=this,$self=this;
  2698. var cls;
  2699. return $core.withContext(function($ctx1) {
  2700. cls=$self._subclass_slots_package_(aString,aCollection,aString3);
  2701. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  2702. return cls;
  2703. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:slots:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,aString3:aString3,cls:cls},$globals.TSubclassable)});
  2704. },
  2705. args: ["aString", "aTraitCompositionDescription", "aCollection", "aString3"],
  2706. source: "subclass: aString uses: aTraitCompositionDescription slots: aCollection package: aString3\x0a\x09| cls |\x0a\x09cls := self subclass: aString slots: aCollection package: aString3.\x0a\x09cls setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ cls",
  2707. referencedClasses: [],
  2708. messageSends: ["subclass:slots:package:", "setTraitComposition:", "asTraitComposition"]
  2709. }),
  2710. $globals.TSubclassable);
  2711. });
  2712. define('amber/core/Kernel-Objects',["amber/boot", "require", "amber/core/Kernel-Helpers"], function($boot,requirejs){"use strict";
  2713. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2714. var $pkg = $core.addPackage("Kernel-Objects");
  2715. $pkg.innerEval = function (expr) { return eval(expr); };
  2716. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  2717. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2718. $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.";
  2719. $core.addMethod(
  2720. $core.method({
  2721. selector: "=",
  2722. protocol: "comparing",
  2723. fn: function (anObject){
  2724. var self=this,$self=this;
  2725. return $core.withContext(function($ctx1) {
  2726. return $self.__eq_eq(anObject);
  2727. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  2728. },
  2729. args: ["anObject"],
  2730. source: "= anObject\x0a\x09^ self == anObject",
  2731. referencedClasses: [],
  2732. messageSends: ["=="]
  2733. }),
  2734. $globals.ProtoObject);
  2735. $core.addMethod(
  2736. $core.method({
  2737. selector: "==",
  2738. protocol: "comparing",
  2739. fn: function (anObject){
  2740. var self=this,$self=this;
  2741. return $core.withContext(function($ctx1) {
  2742. return self === anObject;
  2743. return self;
  2744. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  2745. },
  2746. args: ["anObject"],
  2747. source: "== anObject\x0a<inlineJS: 'return self === anObject'>",
  2748. referencedClasses: [],
  2749. messageSends: []
  2750. }),
  2751. $globals.ProtoObject);
  2752. $core.addMethod(
  2753. $core.method({
  2754. selector: "asString",
  2755. protocol: "converting",
  2756. fn: function (){
  2757. var self=this,$self=this;
  2758. return $core.withContext(function($ctx1) {
  2759. return $self._printString();
  2760. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  2761. },
  2762. args: [],
  2763. source: "asString\x0a\x09^ self printString",
  2764. referencedClasses: [],
  2765. messageSends: ["printString"]
  2766. }),
  2767. $globals.ProtoObject);
  2768. $core.addMethod(
  2769. $core.method({
  2770. selector: "class",
  2771. protocol: "accessing",
  2772. fn: function (){
  2773. var self=this,$self=this;
  2774. return $core.withContext(function($ctx1) {
  2775. return $self.a$cls;
  2776. return self;
  2777. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  2778. },
  2779. args: [],
  2780. source: "class\x0a\x09<inlineJS: 'return $self.a$cls'>",
  2781. referencedClasses: [],
  2782. messageSends: []
  2783. }),
  2784. $globals.ProtoObject);
  2785. $core.addMethod(
  2786. $core.method({
  2787. selector: "doesNotUnderstand:",
  2788. protocol: "error handling",
  2789. fn: function (aMessage){
  2790. var self=this,$self=this;
  2791. return $core.withContext(function($ctx1) {
  2792. var $1;
  2793. $1=$recv($globals.MessageNotUnderstood)._new();
  2794. $recv($1)._receiver_(self);
  2795. $recv($1)._message_(aMessage);
  2796. $recv($1)._signal();
  2797. return self;
  2798. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  2799. },
  2800. args: ["aMessage"],
  2801. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2802. referencedClasses: ["MessageNotUnderstood"],
  2803. messageSends: ["receiver:", "new", "message:", "signal"]
  2804. }),
  2805. $globals.ProtoObject);
  2806. $core.addMethod(
  2807. $core.method({
  2808. selector: "evaluate:on:",
  2809. protocol: "evaluating",
  2810. fn: function (aString,anEvaluator){
  2811. var self=this,$self=this;
  2812. return $core.withContext(function($ctx1) {
  2813. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2814. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  2815. },
  2816. args: ["aString", "anEvaluator"],
  2817. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2818. referencedClasses: [],
  2819. messageSends: ["evaluate:receiver:"]
  2820. }),
  2821. $globals.ProtoObject);
  2822. $core.addMethod(
  2823. $core.method({
  2824. selector: "identityHash",
  2825. protocol: "accessing",
  2826. fn: function (){
  2827. var self=this,$self=this;
  2828. return $core.withContext(function($ctx1) {
  2829. self._deprecatedAPI();
  2830. var hash=self.identityHash;
  2831. if (hash) return hash;
  2832. hash=$core.nextId();
  2833. Object.defineProperty(self, 'identityHash', {value:hash});
  2834. return hash;
  2835. ;
  2836. return self;
  2837. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  2838. },
  2839. args: [],
  2840. 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'>",
  2841. referencedClasses: [],
  2842. messageSends: []
  2843. }),
  2844. $globals.ProtoObject);
  2845. $core.addMethod(
  2846. $core.method({
  2847. selector: "ifNil:",
  2848. protocol: "testing",
  2849. fn: function (aBlock){
  2850. var self=this,$self=this;
  2851. return self;
  2852. },
  2853. args: ["aBlock"],
  2854. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2855. referencedClasses: [],
  2856. messageSends: []
  2857. }),
  2858. $globals.ProtoObject);
  2859. $core.addMethod(
  2860. $core.method({
  2861. selector: "ifNil:ifNotNil:",
  2862. protocol: "testing",
  2863. fn: function (aBlock,anotherBlock){
  2864. var self=this,$self=this;
  2865. return $core.withContext(function($ctx1) {
  2866. return $recv(anotherBlock)._value_(self);
  2867. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2868. },
  2869. args: ["aBlock", "anotherBlock"],
  2870. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2871. referencedClasses: [],
  2872. messageSends: ["value:"]
  2873. }),
  2874. $globals.ProtoObject);
  2875. $core.addMethod(
  2876. $core.method({
  2877. selector: "ifNotNil:",
  2878. protocol: "testing",
  2879. fn: function (aBlock){
  2880. var self=this,$self=this;
  2881. return $core.withContext(function($ctx1) {
  2882. return $recv(aBlock)._value_(self);
  2883. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  2884. },
  2885. args: ["aBlock"],
  2886. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2887. referencedClasses: [],
  2888. messageSends: ["value:"]
  2889. }),
  2890. $globals.ProtoObject);
  2891. $core.addMethod(
  2892. $core.method({
  2893. selector: "ifNotNil:ifNil:",
  2894. protocol: "testing",
  2895. fn: function (aBlock,anotherBlock){
  2896. var self=this,$self=this;
  2897. return $core.withContext(function($ctx1) {
  2898. return $recv(aBlock)._value_(self);
  2899. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2900. },
  2901. args: ["aBlock", "anotherBlock"],
  2902. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2903. referencedClasses: [],
  2904. messageSends: ["value:"]
  2905. }),
  2906. $globals.ProtoObject);
  2907. $core.addMethod(
  2908. $core.method({
  2909. selector: "initialize",
  2910. protocol: "initialization",
  2911. fn: function (){
  2912. var self=this,$self=this;
  2913. return self;
  2914. },
  2915. args: [],
  2916. source: "initialize",
  2917. referencedClasses: [],
  2918. messageSends: []
  2919. }),
  2920. $globals.ProtoObject);
  2921. $core.addMethod(
  2922. $core.method({
  2923. selector: "inspect",
  2924. protocol: "inspecting",
  2925. fn: function (){
  2926. var self=this,$self=this;
  2927. return $core.withContext(function($ctx1) {
  2928. $recv($globals.Inspector)._inspect_(self);
  2929. return self;
  2930. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  2931. },
  2932. args: [],
  2933. source: "inspect\x0a\x09Inspector inspect: self",
  2934. referencedClasses: ["Inspector"],
  2935. messageSends: ["inspect:"]
  2936. }),
  2937. $globals.ProtoObject);
  2938. $core.addMethod(
  2939. $core.method({
  2940. selector: "inspectOn:",
  2941. protocol: "inspecting",
  2942. fn: function (anInspector){
  2943. var self=this,$self=this;
  2944. return self;
  2945. },
  2946. args: ["anInspector"],
  2947. source: "inspectOn: anInspector",
  2948. referencedClasses: [],
  2949. messageSends: []
  2950. }),
  2951. $globals.ProtoObject);
  2952. $core.addMethod(
  2953. $core.method({
  2954. selector: "instVarAt:",
  2955. protocol: "accessing",
  2956. fn: function (aString){
  2957. var self=this,$self=this;
  2958. return $core.withContext(function($ctx1) {
  2959. return $self[aString];
  2960. return self;
  2961. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  2962. },
  2963. args: ["aString"],
  2964. source: "instVarAt: aString\x0a\x09<inlineJS: 'return $self[aString]'>",
  2965. referencedClasses: [],
  2966. messageSends: []
  2967. }),
  2968. $globals.ProtoObject);
  2969. $core.addMethod(
  2970. $core.method({
  2971. selector: "instVarAt:put:",
  2972. protocol: "accessing",
  2973. fn: function (aString,anObject){
  2974. var self=this,$self=this;
  2975. return $core.withContext(function($ctx1) {
  2976. $self[aString] = anObject;
  2977. return self;
  2978. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  2979. },
  2980. args: ["aString", "anObject"],
  2981. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: '$self[aString] = anObject'>",
  2982. referencedClasses: [],
  2983. messageSends: []
  2984. }),
  2985. $globals.ProtoObject);
  2986. $core.addMethod(
  2987. $core.method({
  2988. selector: "isKindOf:",
  2989. protocol: "testing",
  2990. fn: function (aClass){
  2991. var self=this,$self=this;
  2992. return $core.withContext(function($ctx1) {
  2993. var $1;
  2994. $1=$self._isMemberOf_(aClass);
  2995. if($core.assert($1)){
  2996. return true;
  2997. } else {
  2998. return $recv($self._class())._inheritsFrom_(aClass);
  2999. }
  3000. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  3001. },
  3002. args: ["aClass"],
  3003. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  3004. referencedClasses: [],
  3005. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  3006. }),
  3007. $globals.ProtoObject);
  3008. $core.addMethod(
  3009. $core.method({
  3010. selector: "isNil",
  3011. protocol: "testing",
  3012. fn: function (){
  3013. var self=this,$self=this;
  3014. return false;
  3015. },
  3016. args: [],
  3017. source: "isNil\x0a\x09^ false",
  3018. referencedClasses: [],
  3019. messageSends: []
  3020. }),
  3021. $globals.ProtoObject);
  3022. $core.addMethod(
  3023. $core.method({
  3024. selector: "notNil",
  3025. protocol: "testing",
  3026. fn: function (){
  3027. var self=this,$self=this;
  3028. return $core.withContext(function($ctx1) {
  3029. return $recv($self._isNil())._not();
  3030. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  3031. },
  3032. args: [],
  3033. source: "notNil\x0a\x09^ self isNil not",
  3034. referencedClasses: [],
  3035. messageSends: ["not", "isNil"]
  3036. }),
  3037. $globals.ProtoObject);
  3038. $core.addMethod(
  3039. $core.method({
  3040. selector: "perform:",
  3041. protocol: "message handling",
  3042. fn: function (aString){
  3043. var self=this,$self=this;
  3044. return $core.withContext(function($ctx1) {
  3045. return $self._perform_withArguments_(aString,[]);
  3046. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  3047. },
  3048. args: ["aString"],
  3049. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  3050. referencedClasses: [],
  3051. messageSends: ["perform:withArguments:"]
  3052. }),
  3053. $globals.ProtoObject);
  3054. $core.addMethod(
  3055. $core.method({
  3056. selector: "perform:withArguments:",
  3057. protocol: "message handling",
  3058. fn: function (aString,aCollection){
  3059. var self=this,$self=this;
  3060. return $core.withContext(function($ctx1) {
  3061. return $core.send2(self, aString, aCollection);
  3062. return self;
  3063. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  3064. },
  3065. args: ["aString", "aCollection"],
  3066. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  3067. referencedClasses: [],
  3068. messageSends: []
  3069. }),
  3070. $globals.ProtoObject);
  3071. $core.addMethod(
  3072. $core.method({
  3073. selector: "printOn:",
  3074. protocol: "printing",
  3075. fn: function (aStream){
  3076. var self=this,$self=this;
  3077. return $core.withContext(function($ctx1) {
  3078. var $5,$4,$3,$2,$1;
  3079. $5=$self._class();
  3080. $ctx1.sendIdx["class"]=1;
  3081. $4=$recv($5)._name();
  3082. $ctx1.sendIdx["name"]=1;
  3083. $3=$recv($4)._first();
  3084. $2=$recv($3)._isVowel();
  3085. if($core.assert($2)){
  3086. $1="an ";
  3087. } else {
  3088. $1="a ";
  3089. }
  3090. $recv(aStream)._nextPutAll_($1);
  3091. $ctx1.sendIdx["nextPutAll:"]=1;
  3092. $recv(aStream)._nextPutAll_($recv($self._class())._name());
  3093. return self;
  3094. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  3095. },
  3096. args: ["aStream"],
  3097. 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",
  3098. referencedClasses: [],
  3099. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  3100. }),
  3101. $globals.ProtoObject);
  3102. $core.addMethod(
  3103. $core.method({
  3104. selector: "printString",
  3105. protocol: "printing",
  3106. fn: function (){
  3107. var self=this,$self=this;
  3108. return $core.withContext(function($ctx1) {
  3109. return $recv($globals.String)._streamContents_((function(str){
  3110. return $core.withContext(function($ctx2) {
  3111. return $self._printOn_(str);
  3112. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3113. }));
  3114. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  3115. },
  3116. args: [],
  3117. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  3118. referencedClasses: ["String"],
  3119. messageSends: ["streamContents:", "printOn:"]
  3120. }),
  3121. $globals.ProtoObject);
  3122. $core.addMethod(
  3123. $core.method({
  3124. selector: "yourself",
  3125. protocol: "accessing",
  3126. fn: function (){
  3127. var self=this,$self=this;
  3128. return self;
  3129. },
  3130. args: [],
  3131. source: "yourself\x0a\x09^ self",
  3132. referencedClasses: [],
  3133. messageSends: []
  3134. }),
  3135. $globals.ProtoObject);
  3136. $core.addMethod(
  3137. $core.method({
  3138. selector: "~=",
  3139. protocol: "comparing",
  3140. fn: function (anObject){
  3141. var self=this,$self=this;
  3142. return $core.withContext(function($ctx1) {
  3143. var $1;
  3144. $1=$recv($self.__eq(anObject)).__eq(false);
  3145. $ctx1.sendIdx["="]=1;
  3146. return $1;
  3147. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  3148. },
  3149. args: ["anObject"],
  3150. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  3151. referencedClasses: [],
  3152. messageSends: ["="]
  3153. }),
  3154. $globals.ProtoObject);
  3155. $core.addMethod(
  3156. $core.method({
  3157. selector: "~~",
  3158. protocol: "comparing",
  3159. fn: function (anObject){
  3160. var self=this,$self=this;
  3161. return $core.withContext(function($ctx1) {
  3162. return $recv($self.__eq_eq(anObject)).__eq(false);
  3163. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  3164. },
  3165. args: ["anObject"],
  3166. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  3167. referencedClasses: [],
  3168. messageSends: ["=", "=="]
  3169. }),
  3170. $globals.ProtoObject);
  3171. $core.addMethod(
  3172. $core.method({
  3173. selector: "initialize",
  3174. protocol: "initialization",
  3175. fn: function (){
  3176. var self=this,$self=this;
  3177. return self;
  3178. },
  3179. args: [],
  3180. source: "initialize",
  3181. referencedClasses: [],
  3182. messageSends: []
  3183. }),
  3184. $globals.ProtoObject.a$cls);
  3185. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  3186. $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.";
  3187. $core.addMethod(
  3188. $core.method({
  3189. selector: "->",
  3190. protocol: "converting",
  3191. fn: function (anObject){
  3192. var self=this,$self=this;
  3193. return $core.withContext(function($ctx1) {
  3194. return $recv($globals.Association)._key_value_(self,anObject);
  3195. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  3196. },
  3197. args: ["anObject"],
  3198. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  3199. referencedClasses: ["Association"],
  3200. messageSends: ["key:value:"]
  3201. }),
  3202. $globals.Object);
  3203. $core.addMethod(
  3204. $core.method({
  3205. selector: "asJSONString",
  3206. protocol: "converting",
  3207. fn: function (){
  3208. var self=this,$self=this;
  3209. return $core.withContext(function($ctx1) {
  3210. return $recv($globals.JSON)._stringify_($self._asJavaScriptObject());
  3211. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  3212. },
  3213. args: [],
  3214. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  3215. referencedClasses: ["JSON"],
  3216. messageSends: ["stringify:", "asJavaScriptObject"]
  3217. }),
  3218. $globals.Object);
  3219. $core.addMethod(
  3220. $core.method({
  3221. selector: "asJavaScriptObject",
  3222. protocol: "converting",
  3223. fn: function (){
  3224. var self=this,$self=this;
  3225. var variables;
  3226. return $core.withContext(function($ctx1) {
  3227. variables=$recv($globals.HashedCollection)._new();
  3228. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  3229. return $core.withContext(function($ctx2) {
  3230. return $recv(variables)._at_put_(each,$recv($self._instVarAt_(each))._asJavaScriptObject());
  3231. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3232. }));
  3233. return variables;
  3234. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables},$globals.Object)});
  3235. },
  3236. args: [],
  3237. 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",
  3238. referencedClasses: ["HashedCollection"],
  3239. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarAt:"]
  3240. }),
  3241. $globals.Object);
  3242. $core.addMethod(
  3243. $core.method({
  3244. selector: "asJavaScriptSource",
  3245. protocol: "converting",
  3246. fn: function (){
  3247. var self=this,$self=this;
  3248. return $core.withContext(function($ctx1) {
  3249. return $self._asString();
  3250. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Object)});
  3251. },
  3252. args: [],
  3253. source: "asJavaScriptSource\x0a\x09^ self asString",
  3254. referencedClasses: [],
  3255. messageSends: ["asString"]
  3256. }),
  3257. $globals.Object);
  3258. $core.addMethod(
  3259. $core.method({
  3260. selector: "basicAt:",
  3261. protocol: "accessing",
  3262. fn: function (aString){
  3263. var self=this,$self=this;
  3264. return $core.withContext(function($ctx1) {
  3265. return self[aString];
  3266. return self;
  3267. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  3268. },
  3269. args: ["aString"],
  3270. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  3271. referencedClasses: [],
  3272. messageSends: []
  3273. }),
  3274. $globals.Object);
  3275. $core.addMethod(
  3276. $core.method({
  3277. selector: "basicAt:put:",
  3278. protocol: "accessing",
  3279. fn: function (aString,anObject){
  3280. var self=this,$self=this;
  3281. return $core.withContext(function($ctx1) {
  3282. return self[aString] = anObject;
  3283. return self;
  3284. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  3285. },
  3286. args: ["aString", "anObject"],
  3287. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  3288. referencedClasses: [],
  3289. messageSends: []
  3290. }),
  3291. $globals.Object);
  3292. $core.addMethod(
  3293. $core.method({
  3294. selector: "basicDelete:",
  3295. protocol: "accessing",
  3296. fn: function (aString){
  3297. var self=this,$self=this;
  3298. return $core.withContext(function($ctx1) {
  3299. delete self[aString]; return aString;
  3300. return self;
  3301. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  3302. },
  3303. args: ["aString"],
  3304. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  3305. referencedClasses: [],
  3306. messageSends: []
  3307. }),
  3308. $globals.Object);
  3309. $core.addMethod(
  3310. $core.method({
  3311. selector: "basicPerform:",
  3312. protocol: "message handling",
  3313. fn: function (aString){
  3314. var self=this,$self=this;
  3315. return $core.withContext(function($ctx1) {
  3316. return $self._basicPerform_withArguments_(aString,[]);
  3317. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  3318. },
  3319. args: ["aString"],
  3320. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  3321. referencedClasses: [],
  3322. messageSends: ["basicPerform:withArguments:"]
  3323. }),
  3324. $globals.Object);
  3325. $core.addMethod(
  3326. $core.method({
  3327. selector: "basicPerform:withArguments:",
  3328. protocol: "message handling",
  3329. fn: function (aString,aCollection){
  3330. var self=this,$self=this;
  3331. return $core.withContext(function($ctx1) {
  3332. return self[aString].apply(self, aCollection);;
  3333. return self;
  3334. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  3335. },
  3336. args: ["aString", "aCollection"],
  3337. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  3338. referencedClasses: [],
  3339. messageSends: []
  3340. }),
  3341. $globals.Object);
  3342. $core.addMethod(
  3343. $core.method({
  3344. selector: "browse",
  3345. protocol: "browsing",
  3346. fn: function (){
  3347. var self=this,$self=this;
  3348. return $core.withContext(function($ctx1) {
  3349. $recv($globals.Finder)._findClass_($self._class());
  3350. return self;
  3351. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  3352. },
  3353. args: [],
  3354. source: "browse\x0a\x09Finder findClass: self class",
  3355. referencedClasses: ["Finder"],
  3356. messageSends: ["findClass:", "class"]
  3357. }),
  3358. $globals.Object);
  3359. $core.addMethod(
  3360. $core.method({
  3361. selector: "copy",
  3362. protocol: "copying",
  3363. fn: function (){
  3364. var self=this,$self=this;
  3365. return $core.withContext(function($ctx1) {
  3366. return $recv($self._shallowCopy())._postCopy();
  3367. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  3368. },
  3369. args: [],
  3370. source: "copy\x0a\x09^ self shallowCopy postCopy",
  3371. referencedClasses: [],
  3372. messageSends: ["postCopy", "shallowCopy"]
  3373. }),
  3374. $globals.Object);
  3375. $core.addMethod(
  3376. $core.method({
  3377. selector: "deepCopy",
  3378. protocol: "copying",
  3379. fn: function (){
  3380. var self=this,$self=this;
  3381. return $core.withContext(function($ctx1) {
  3382. var copy = self.a$cls._new();
  3383. Object.keys(self).forEach(function (i) {
  3384. copy[i] = $recv(self[i])._deepCopy();
  3385. });
  3386. return copy;
  3387. ;
  3388. return self;
  3389. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  3390. },
  3391. args: [],
  3392. source: "deepCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09\x09copy[i] = $recv(self[i])._deepCopy();\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  3393. referencedClasses: [],
  3394. messageSends: []
  3395. }),
  3396. $globals.Object);
  3397. $core.addMethod(
  3398. $core.method({
  3399. selector: "deprecatedAPI",
  3400. protocol: "error handling",
  3401. fn: function (){
  3402. var self=this,$self=this;
  3403. return $core.withContext(function($ctx1) {
  3404. var $1,$6,$5,$4,$8,$7,$3,$2;
  3405. $1=console;
  3406. $6=$core.getThisContext()._home();
  3407. $ctx1.sendIdx["home"]=1;
  3408. $5=$recv($6)._asString();
  3409. $ctx1.sendIdx["asString"]=1;
  3410. $4=$recv($5).__comma(" is deprecated! (in ");
  3411. $8=$recv($core.getThisContext()._home())._home();
  3412. $ctx1.sendIdx["home"]=2;
  3413. $7=$recv($8)._asString();
  3414. $3=$recv($4).__comma($7);
  3415. $ctx1.sendIdx[","]=2;
  3416. $2=$recv($3).__comma(")");
  3417. $ctx1.sendIdx[","]=1;
  3418. $recv($1)._warn_($2);
  3419. return self;
  3420. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  3421. },
  3422. args: [],
  3423. 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, ')'.",
  3424. referencedClasses: [],
  3425. messageSends: ["warn:", ",", "asString", "home"]
  3426. }),
  3427. $globals.Object);
  3428. $core.addMethod(
  3429. $core.method({
  3430. selector: "deprecatedAPI:",
  3431. protocol: "error handling",
  3432. fn: function (aString){
  3433. var self=this,$self=this;
  3434. return $core.withContext(function($ctx1) {
  3435. var $1,$6,$5,$4,$8,$7,$3,$2;
  3436. $1=console;
  3437. $6=$core.getThisContext()._home();
  3438. $ctx1.sendIdx["home"]=1;
  3439. $5=$recv($6)._asString();
  3440. $ctx1.sendIdx["asString"]=1;
  3441. $4=$recv($5).__comma(" is deprecated! (in ");
  3442. $8=$recv($core.getThisContext()._home())._home();
  3443. $ctx1.sendIdx["home"]=2;
  3444. $7=$recv($8)._asString();
  3445. $3=$recv($4).__comma($7);
  3446. $ctx1.sendIdx[","]=2;
  3447. $2=$recv($3).__comma(")");
  3448. $ctx1.sendIdx[","]=1;
  3449. $recv($1)._warn_($2);
  3450. $ctx1.sendIdx["warn:"]=1;
  3451. $recv(console)._warn_(aString);
  3452. return self;
  3453. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  3454. },
  3455. args: ["aString"],
  3456. 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",
  3457. referencedClasses: [],
  3458. messageSends: ["warn:", ",", "asString", "home"]
  3459. }),
  3460. $globals.Object);
  3461. $core.addMethod(
  3462. $core.method({
  3463. selector: "error:",
  3464. protocol: "error handling",
  3465. fn: function (aString){
  3466. var self=this,$self=this;
  3467. return $core.withContext(function($ctx1) {
  3468. $recv($globals.Error)._signal_(aString);
  3469. return self;
  3470. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  3471. },
  3472. args: ["aString"],
  3473. source: "error: aString\x0a\x09Error signal: aString",
  3474. referencedClasses: ["Error"],
  3475. messageSends: ["signal:"]
  3476. }),
  3477. $globals.Object);
  3478. $core.addMethod(
  3479. $core.method({
  3480. selector: "halt",
  3481. protocol: "error handling",
  3482. fn: function (){
  3483. var self=this,$self=this;
  3484. return $core.withContext(function($ctx1) {
  3485. $recv($globals.Halt)._signal();
  3486. return self;
  3487. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  3488. },
  3489. args: [],
  3490. source: "halt\x0a\x09Halt signal",
  3491. referencedClasses: ["Halt"],
  3492. messageSends: ["signal"]
  3493. }),
  3494. $globals.Object);
  3495. $core.addMethod(
  3496. $core.method({
  3497. selector: "in:",
  3498. protocol: "evaluating",
  3499. fn: function (aValuable){
  3500. var self=this,$self=this;
  3501. return $core.withContext(function($ctx1) {
  3502. return $recv(aValuable)._value_(self);
  3503. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  3504. },
  3505. args: ["aValuable"],
  3506. source: "in: aValuable\x0a\x09^ aValuable value: self",
  3507. referencedClasses: [],
  3508. messageSends: ["value:"]
  3509. }),
  3510. $globals.Object);
  3511. $core.addMethod(
  3512. $core.method({
  3513. selector: "isBehavior",
  3514. protocol: "testing",
  3515. fn: function (){
  3516. var self=this,$self=this;
  3517. return false;
  3518. },
  3519. args: [],
  3520. source: "isBehavior\x0a\x09^ false",
  3521. referencedClasses: [],
  3522. messageSends: []
  3523. }),
  3524. $globals.Object);
  3525. $core.addMethod(
  3526. $core.method({
  3527. selector: "isBoolean",
  3528. protocol: "testing",
  3529. fn: function (){
  3530. var self=this,$self=this;
  3531. return false;
  3532. },
  3533. args: [],
  3534. source: "isBoolean\x0a\x09^ false",
  3535. referencedClasses: [],
  3536. messageSends: []
  3537. }),
  3538. $globals.Object);
  3539. $core.addMethod(
  3540. $core.method({
  3541. selector: "isClass",
  3542. protocol: "testing",
  3543. fn: function (){
  3544. var self=this,$self=this;
  3545. return false;
  3546. },
  3547. args: [],
  3548. source: "isClass\x0a\x09^ false",
  3549. referencedClasses: [],
  3550. messageSends: []
  3551. }),
  3552. $globals.Object);
  3553. $core.addMethod(
  3554. $core.method({
  3555. selector: "isCompiledMethod",
  3556. protocol: "testing",
  3557. fn: function (){
  3558. var self=this,$self=this;
  3559. return false;
  3560. },
  3561. args: [],
  3562. source: "isCompiledMethod\x0a\x09^ false",
  3563. referencedClasses: [],
  3564. messageSends: []
  3565. }),
  3566. $globals.Object);
  3567. $core.addMethod(
  3568. $core.method({
  3569. selector: "isImmutable",
  3570. protocol: "testing",
  3571. fn: function (){
  3572. var self=this,$self=this;
  3573. return false;
  3574. },
  3575. args: [],
  3576. source: "isImmutable\x0a\x09^ false",
  3577. referencedClasses: [],
  3578. messageSends: []
  3579. }),
  3580. $globals.Object);
  3581. $core.addMethod(
  3582. $core.method({
  3583. selector: "isMemberOf:",
  3584. protocol: "testing",
  3585. fn: function (aClass){
  3586. var self=this,$self=this;
  3587. return $core.withContext(function($ctx1) {
  3588. return $recv($self._class()).__eq(aClass);
  3589. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  3590. },
  3591. args: ["aClass"],
  3592. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  3593. referencedClasses: [],
  3594. messageSends: ["=", "class"]
  3595. }),
  3596. $globals.Object);
  3597. $core.addMethod(
  3598. $core.method({
  3599. selector: "isMetaclass",
  3600. protocol: "testing",
  3601. fn: function (){
  3602. var self=this,$self=this;
  3603. return false;
  3604. },
  3605. args: [],
  3606. source: "isMetaclass\x0a\x09^ false",
  3607. referencedClasses: [],
  3608. messageSends: []
  3609. }),
  3610. $globals.Object);
  3611. $core.addMethod(
  3612. $core.method({
  3613. selector: "isNumber",
  3614. protocol: "testing",
  3615. fn: function (){
  3616. var self=this,$self=this;
  3617. return false;
  3618. },
  3619. args: [],
  3620. source: "isNumber\x0a\x09^ false",
  3621. referencedClasses: [],
  3622. messageSends: []
  3623. }),
  3624. $globals.Object);
  3625. $core.addMethod(
  3626. $core.method({
  3627. selector: "isPackage",
  3628. protocol: "testing",
  3629. fn: function (){
  3630. var self=this,$self=this;
  3631. return false;
  3632. },
  3633. args: [],
  3634. source: "isPackage\x0a\x09^ false",
  3635. referencedClasses: [],
  3636. messageSends: []
  3637. }),
  3638. $globals.Object);
  3639. $core.addMethod(
  3640. $core.method({
  3641. selector: "isParseFailure",
  3642. protocol: "testing",
  3643. fn: function (){
  3644. var self=this,$self=this;
  3645. return false;
  3646. },
  3647. args: [],
  3648. source: "isParseFailure\x0a\x09^ false",
  3649. referencedClasses: [],
  3650. messageSends: []
  3651. }),
  3652. $globals.Object);
  3653. $core.addMethod(
  3654. $core.method({
  3655. selector: "isString",
  3656. protocol: "testing",
  3657. fn: function (){
  3658. var self=this,$self=this;
  3659. return false;
  3660. },
  3661. args: [],
  3662. source: "isString\x0a\x09^ false",
  3663. referencedClasses: [],
  3664. messageSends: []
  3665. }),
  3666. $globals.Object);
  3667. $core.addMethod(
  3668. $core.method({
  3669. selector: "isSymbol",
  3670. protocol: "testing",
  3671. fn: function (){
  3672. var self=this,$self=this;
  3673. return false;
  3674. },
  3675. args: [],
  3676. source: "isSymbol\x0a\x09^ false",
  3677. referencedClasses: [],
  3678. messageSends: []
  3679. }),
  3680. $globals.Object);
  3681. $core.addMethod(
  3682. $core.method({
  3683. selector: "postCopy",
  3684. protocol: "copying",
  3685. fn: function (){
  3686. var self=this,$self=this;
  3687. return self;
  3688. },
  3689. args: [],
  3690. source: "postCopy",
  3691. referencedClasses: [],
  3692. messageSends: []
  3693. }),
  3694. $globals.Object);
  3695. $core.addMethod(
  3696. $core.method({
  3697. selector: "putOn:",
  3698. protocol: "streaming",
  3699. fn: function (aStream){
  3700. var self=this,$self=this;
  3701. return $core.withContext(function($ctx1) {
  3702. $recv(aStream)._nextPut_(self);
  3703. return self;
  3704. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  3705. },
  3706. args: ["aStream"],
  3707. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3708. referencedClasses: [],
  3709. messageSends: ["nextPut:"]
  3710. }),
  3711. $globals.Object);
  3712. $core.addMethod(
  3713. $core.method({
  3714. selector: "respondsTo:",
  3715. protocol: "testing",
  3716. fn: function (aSelector){
  3717. var self=this,$self=this;
  3718. return $core.withContext(function($ctx1) {
  3719. return $recv($self._class())._canUnderstand_(aSelector);
  3720. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  3721. },
  3722. args: ["aSelector"],
  3723. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3724. referencedClasses: [],
  3725. messageSends: ["canUnderstand:", "class"]
  3726. }),
  3727. $globals.Object);
  3728. $core.addMethod(
  3729. $core.method({
  3730. selector: "shallowCopy",
  3731. protocol: "copying",
  3732. fn: function (){
  3733. var self=this,$self=this;
  3734. return $core.withContext(function($ctx1) {
  3735. var copy = self.a$cls._new();
  3736. Object.keys(self).forEach(function(i) {
  3737. copy[i] = self[i];
  3738. });
  3739. return copy;
  3740. ;
  3741. return self;
  3742. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  3743. },
  3744. args: [],
  3745. source: "shallowCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  3746. referencedClasses: [],
  3747. messageSends: []
  3748. }),
  3749. $globals.Object);
  3750. $core.addMethod(
  3751. $core.method({
  3752. selector: "shouldNotImplement",
  3753. protocol: "error handling",
  3754. fn: function (){
  3755. var self=this,$self=this;
  3756. return $core.withContext(function($ctx1) {
  3757. $self._error_("This method should not be implemented in ".__comma($recv($self._class())._name()));
  3758. return self;
  3759. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  3760. },
  3761. args: [],
  3762. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3763. referencedClasses: [],
  3764. messageSends: ["error:", ",", "name", "class"]
  3765. }),
  3766. $globals.Object);
  3767. $core.addMethod(
  3768. $core.method({
  3769. selector: "size",
  3770. protocol: "accessing",
  3771. fn: function (){
  3772. var self=this,$self=this;
  3773. return $core.withContext(function($ctx1) {
  3774. $self._error_("Object not indexable");
  3775. return self;
  3776. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  3777. },
  3778. args: [],
  3779. source: "size\x0a\x09self error: 'Object not indexable'",
  3780. referencedClasses: [],
  3781. messageSends: ["error:"]
  3782. }),
  3783. $globals.Object);
  3784. $core.addMethod(
  3785. $core.method({
  3786. selector: "subclassResponsibility",
  3787. protocol: "error handling",
  3788. fn: function (){
  3789. var self=this,$self=this;
  3790. return $core.withContext(function($ctx1) {
  3791. $self._error_("This method is a responsibility of a subclass");
  3792. return self;
  3793. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  3794. },
  3795. args: [],
  3796. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3797. referencedClasses: [],
  3798. messageSends: ["error:"]
  3799. }),
  3800. $globals.Object);
  3801. $core.addMethod(
  3802. $core.method({
  3803. selector: "value",
  3804. protocol: "evaluating",
  3805. fn: function (){
  3806. var self=this,$self=this;
  3807. return $core.withContext(function($ctx1) {
  3808. return self.valueOf();
  3809. return self;
  3810. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  3811. },
  3812. args: [],
  3813. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3814. referencedClasses: [],
  3815. messageSends: []
  3816. }),
  3817. $globals.Object);
  3818. $core.addMethod(
  3819. $core.method({
  3820. selector: "accessorProtocolWith:",
  3821. protocol: "helios",
  3822. fn: function (aGenerator){
  3823. var self=this,$self=this;
  3824. return $core.withContext(function($ctx1) {
  3825. $recv(aGenerator)._accessorProtocolForObject();
  3826. return self;
  3827. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3828. },
  3829. args: ["aGenerator"],
  3830. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3831. referencedClasses: [],
  3832. messageSends: ["accessorProtocolForObject"]
  3833. }),
  3834. $globals.Object.a$cls);
  3835. $core.addMethod(
  3836. $core.method({
  3837. selector: "accessorsSourceCodesWith:",
  3838. protocol: "helios",
  3839. fn: function (aGenerator){
  3840. var self=this,$self=this;
  3841. return $core.withContext(function($ctx1) {
  3842. $recv(aGenerator)._accessorsForObject();
  3843. return self;
  3844. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3845. },
  3846. args: ["aGenerator"],
  3847. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3848. referencedClasses: [],
  3849. messageSends: ["accessorsForObject"]
  3850. }),
  3851. $globals.Object.a$cls);
  3852. $core.addMethod(
  3853. $core.method({
  3854. selector: "initialize",
  3855. protocol: "initialization",
  3856. fn: function (){
  3857. var self=this,$self=this;
  3858. return self;
  3859. },
  3860. args: [],
  3861. source: "initialize\x0a\x09\x22no op\x22",
  3862. referencedClasses: [],
  3863. messageSends: []
  3864. }),
  3865. $globals.Object.a$cls);
  3866. $core.addMethod(
  3867. $core.method({
  3868. selector: "initializeProtocolWith:",
  3869. protocol: "helios",
  3870. fn: function (aGenerator){
  3871. var self=this,$self=this;
  3872. return $core.withContext(function($ctx1) {
  3873. $recv(aGenerator)._initializeProtocolForObject();
  3874. return self;
  3875. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3876. },
  3877. args: ["aGenerator"],
  3878. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3879. referencedClasses: [],
  3880. messageSends: ["initializeProtocolForObject"]
  3881. }),
  3882. $globals.Object.a$cls);
  3883. $core.addMethod(
  3884. $core.method({
  3885. selector: "initializeSourceCodesWith:",
  3886. protocol: "helios",
  3887. fn: function (aGenerator){
  3888. var self=this,$self=this;
  3889. return $core.withContext(function($ctx1) {
  3890. $recv(aGenerator)._initializeForObject();
  3891. return self;
  3892. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3893. },
  3894. args: ["aGenerator"],
  3895. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3896. referencedClasses: [],
  3897. messageSends: ["initializeForObject"]
  3898. }),
  3899. $globals.Object.a$cls);
  3900. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3901. $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: [ ... ]";
  3902. $core.addMethod(
  3903. $core.method({
  3904. selector: "&",
  3905. protocol: "controlling",
  3906. fn: function (aBoolean){
  3907. var self=this,$self=this;
  3908. return $core.withContext(function($ctx1) {
  3909. if(self == true) {
  3910. return aBoolean;
  3911. } else {
  3912. return false;
  3913. }
  3914. ;
  3915. return self;
  3916. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  3917. },
  3918. args: ["aBoolean"],
  3919. 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'>",
  3920. referencedClasses: [],
  3921. messageSends: []
  3922. }),
  3923. $globals.Boolean);
  3924. $core.addMethod(
  3925. $core.method({
  3926. selector: "==",
  3927. protocol: "comparing",
  3928. fn: function (aBoolean){
  3929. var self=this,$self=this;
  3930. return $core.withContext(function($ctx1) {
  3931. if (typeof aBoolean === "boolean") return (self == true) === aBoolean;
  3932. else if (aBoolean != null && typeof aBoolean === "object") return (self == true) === aBoolean.valueOf();
  3933. else return false;;
  3934. return self;
  3935. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  3936. },
  3937. args: ["aBoolean"],
  3938. 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'>",
  3939. referencedClasses: [],
  3940. messageSends: []
  3941. }),
  3942. $globals.Boolean);
  3943. $core.addMethod(
  3944. $core.method({
  3945. selector: "and:",
  3946. protocol: "controlling",
  3947. fn: function (aBlock){
  3948. var self=this,$self=this;
  3949. return $core.withContext(function($ctx1) {
  3950. if($core.assert(self)){
  3951. return $recv(aBlock)._value();
  3952. } else {
  3953. return false;
  3954. }
  3955. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  3956. },
  3957. args: ["aBlock"],
  3958. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  3959. referencedClasses: [],
  3960. messageSends: ["ifTrue:ifFalse:", "value"]
  3961. }),
  3962. $globals.Boolean);
  3963. $core.addMethod(
  3964. $core.method({
  3965. selector: "asBit",
  3966. protocol: "converting",
  3967. fn: function (){
  3968. var self=this,$self=this;
  3969. return $core.withContext(function($ctx1) {
  3970. if($core.assert(self)){
  3971. return (1);
  3972. } else {
  3973. return (0);
  3974. }
  3975. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  3976. },
  3977. args: [],
  3978. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3979. referencedClasses: [],
  3980. messageSends: ["ifTrue:ifFalse:"]
  3981. }),
  3982. $globals.Boolean);
  3983. $core.addMethod(
  3984. $core.method({
  3985. selector: "asJavaScriptObject",
  3986. protocol: "converting",
  3987. fn: function (){
  3988. var self=this,$self=this;
  3989. return self;
  3990. },
  3991. args: [],
  3992. source: "asJavaScriptObject\x0a\x09^ self",
  3993. referencedClasses: [],
  3994. messageSends: []
  3995. }),
  3996. $globals.Boolean);
  3997. $core.addMethod(
  3998. $core.method({
  3999. selector: "asString",
  4000. protocol: "converting",
  4001. fn: function (){
  4002. var self=this,$self=this;
  4003. return $core.withContext(function($ctx1) {
  4004. return self.toString();
  4005. return self;
  4006. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  4007. },
  4008. args: [],
  4009. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4010. referencedClasses: [],
  4011. messageSends: []
  4012. }),
  4013. $globals.Boolean);
  4014. $core.addMethod(
  4015. $core.method({
  4016. selector: "deepCopy",
  4017. protocol: "copying",
  4018. fn: function (){
  4019. var self=this,$self=this;
  4020. return self;
  4021. },
  4022. args: [],
  4023. source: "deepCopy\x0a\x09^ self",
  4024. referencedClasses: [],
  4025. messageSends: []
  4026. }),
  4027. $globals.Boolean);
  4028. $core.addMethod(
  4029. $core.method({
  4030. selector: "ifFalse:",
  4031. protocol: "controlling",
  4032. fn: function (aBlock){
  4033. var self=this,$self=this;
  4034. return $core.withContext(function($ctx1) {
  4035. return $self._ifTrue_ifFalse_((function(){
  4036. }),aBlock);
  4037. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  4038. },
  4039. args: ["aBlock"],
  4040. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  4041. referencedClasses: [],
  4042. messageSends: ["ifTrue:ifFalse:"]
  4043. }),
  4044. $globals.Boolean);
  4045. $core.addMethod(
  4046. $core.method({
  4047. selector: "ifFalse:ifTrue:",
  4048. protocol: "controlling",
  4049. fn: function (aBlock,anotherBlock){
  4050. var self=this,$self=this;
  4051. return $core.withContext(function($ctx1) {
  4052. return $self._ifTrue_ifFalse_(anotherBlock,aBlock);
  4053. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  4054. },
  4055. args: ["aBlock", "anotherBlock"],
  4056. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  4057. referencedClasses: [],
  4058. messageSends: ["ifTrue:ifFalse:"]
  4059. }),
  4060. $globals.Boolean);
  4061. $core.addMethod(
  4062. $core.method({
  4063. selector: "ifTrue:",
  4064. protocol: "controlling",
  4065. fn: function (aBlock){
  4066. var self=this,$self=this;
  4067. return $core.withContext(function($ctx1) {
  4068. return $self._ifTrue_ifFalse_(aBlock,(function(){
  4069. }));
  4070. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  4071. },
  4072. args: ["aBlock"],
  4073. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  4074. referencedClasses: [],
  4075. messageSends: ["ifTrue:ifFalse:"]
  4076. }),
  4077. $globals.Boolean);
  4078. $core.addMethod(
  4079. $core.method({
  4080. selector: "ifTrue:ifFalse:",
  4081. protocol: "controlling",
  4082. fn: function (aBlock,anotherBlock){
  4083. var self=this,$self=this;
  4084. return $core.withContext(function($ctx1) {
  4085. if(self == true) {
  4086. return aBlock._value();
  4087. } else {
  4088. return anotherBlock._value();
  4089. }
  4090. ;
  4091. return self;
  4092. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  4093. },
  4094. args: ["aBlock", "anotherBlock"],
  4095. 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'>",
  4096. referencedClasses: [],
  4097. messageSends: []
  4098. }),
  4099. $globals.Boolean);
  4100. $core.addMethod(
  4101. $core.method({
  4102. selector: "isBoolean",
  4103. protocol: "testing",
  4104. fn: function (){
  4105. var self=this,$self=this;
  4106. return true;
  4107. },
  4108. args: [],
  4109. source: "isBoolean\x0a\x09^ true",
  4110. referencedClasses: [],
  4111. messageSends: []
  4112. }),
  4113. $globals.Boolean);
  4114. $core.addMethod(
  4115. $core.method({
  4116. selector: "isImmutable",
  4117. protocol: "testing",
  4118. fn: function (){
  4119. var self=this,$self=this;
  4120. return true;
  4121. },
  4122. args: [],
  4123. source: "isImmutable\x0a\x09^ true",
  4124. referencedClasses: [],
  4125. messageSends: []
  4126. }),
  4127. $globals.Boolean);
  4128. $core.addMethod(
  4129. $core.method({
  4130. selector: "not",
  4131. protocol: "controlling",
  4132. fn: function (){
  4133. var self=this,$self=this;
  4134. return $core.withContext(function($ctx1) {
  4135. return $self.__eq(false);
  4136. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  4137. },
  4138. args: [],
  4139. source: "not\x0a\x09^ self = false",
  4140. referencedClasses: [],
  4141. messageSends: ["="]
  4142. }),
  4143. $globals.Boolean);
  4144. $core.addMethod(
  4145. $core.method({
  4146. selector: "or:",
  4147. protocol: "controlling",
  4148. fn: function (aBlock){
  4149. var self=this,$self=this;
  4150. return $core.withContext(function($ctx1) {
  4151. if($core.assert(self)){
  4152. return true;
  4153. } else {
  4154. return $recv(aBlock)._value();
  4155. }
  4156. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  4157. },
  4158. args: ["aBlock"],
  4159. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  4160. referencedClasses: [],
  4161. messageSends: ["ifTrue:ifFalse:", "value"]
  4162. }),
  4163. $globals.Boolean);
  4164. $core.addMethod(
  4165. $core.method({
  4166. selector: "printOn:",
  4167. protocol: "printing",
  4168. fn: function (aStream){
  4169. var self=this,$self=this;
  4170. return $core.withContext(function($ctx1) {
  4171. $recv(aStream)._nextPutAll_($self._asString());
  4172. return self;
  4173. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  4174. },
  4175. args: ["aStream"],
  4176. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4177. referencedClasses: [],
  4178. messageSends: ["nextPutAll:", "asString"]
  4179. }),
  4180. $globals.Boolean);
  4181. $core.addMethod(
  4182. $core.method({
  4183. selector: "shallowCopy",
  4184. protocol: "copying",
  4185. fn: function (){
  4186. var self=this,$self=this;
  4187. return self;
  4188. },
  4189. args: [],
  4190. source: "shallowCopy\x0a\x09^ self",
  4191. referencedClasses: [],
  4192. messageSends: []
  4193. }),
  4194. $globals.Boolean);
  4195. $core.addMethod(
  4196. $core.method({
  4197. selector: "|",
  4198. protocol: "controlling",
  4199. fn: function (aBoolean){
  4200. var self=this,$self=this;
  4201. return $core.withContext(function($ctx1) {
  4202. if(self == true) {
  4203. return true;
  4204. } else {
  4205. return aBoolean;
  4206. }
  4207. ;
  4208. return self;
  4209. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  4210. },
  4211. args: ["aBoolean"],
  4212. 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'>",
  4213. referencedClasses: [],
  4214. messageSends: []
  4215. }),
  4216. $globals.Boolean);
  4217. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  4218. $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.).";
  4219. $core.addMethod(
  4220. $core.method({
  4221. selector: "+",
  4222. protocol: "arithmetic",
  4223. fn: function (aDate){
  4224. var self=this,$self=this;
  4225. return $core.withContext(function($ctx1) {
  4226. return self + aDate;
  4227. return self;
  4228. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  4229. },
  4230. args: ["aDate"],
  4231. source: "+ aDate\x0a\x09<inlineJS: 'return self + aDate'>",
  4232. referencedClasses: [],
  4233. messageSends: []
  4234. }),
  4235. $globals.Date);
  4236. $core.addMethod(
  4237. $core.method({
  4238. selector: "-",
  4239. protocol: "arithmetic",
  4240. fn: function (aDate){
  4241. var self=this,$self=this;
  4242. return $core.withContext(function($ctx1) {
  4243. return self - aDate;
  4244. return self;
  4245. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  4246. },
  4247. args: ["aDate"],
  4248. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  4249. referencedClasses: [],
  4250. messageSends: []
  4251. }),
  4252. $globals.Date);
  4253. $core.addMethod(
  4254. $core.method({
  4255. selector: "<",
  4256. protocol: "comparing",
  4257. fn: function (aDate){
  4258. var self=this,$self=this;
  4259. return $core.withContext(function($ctx1) {
  4260. return self < aDate;
  4261. return self;
  4262. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  4263. },
  4264. args: ["aDate"],
  4265. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  4266. referencedClasses: [],
  4267. messageSends: []
  4268. }),
  4269. $globals.Date);
  4270. $core.addMethod(
  4271. $core.method({
  4272. selector: "<=",
  4273. protocol: "comparing",
  4274. fn: function (aDate){
  4275. var self=this,$self=this;
  4276. return $core.withContext(function($ctx1) {
  4277. return self <= aDate;
  4278. return self;
  4279. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  4280. },
  4281. args: ["aDate"],
  4282. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  4283. referencedClasses: [],
  4284. messageSends: []
  4285. }),
  4286. $globals.Date);
  4287. $core.addMethod(
  4288. $core.method({
  4289. selector: "=",
  4290. protocol: "comparing",
  4291. fn: function (aDate){
  4292. var self=this,$self=this;
  4293. return $core.withContext(function($ctx1) {
  4294. var $2,$1,$3;
  4295. $2=$recv(aDate)._class();
  4296. $ctx1.sendIdx["class"]=1;
  4297. $1=$recv($2).__eq_eq($self._class());
  4298. $ctx1.sendIdx["=="]=1;
  4299. return $recv($1)._and_((function(){
  4300. return $core.withContext(function($ctx2) {
  4301. $3=$self._asMilliseconds();
  4302. $ctx2.sendIdx["asMilliseconds"]=1;
  4303. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  4304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4305. }));
  4306. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  4307. },
  4308. args: ["aDate"],
  4309. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  4310. referencedClasses: [],
  4311. messageSends: ["and:", "==", "class", "asMilliseconds"]
  4312. }),
  4313. $globals.Date);
  4314. $core.addMethod(
  4315. $core.method({
  4316. selector: ">",
  4317. protocol: "comparing",
  4318. fn: function (aDate){
  4319. var self=this,$self=this;
  4320. return $core.withContext(function($ctx1) {
  4321. return self > aDate;
  4322. return self;
  4323. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  4324. },
  4325. args: ["aDate"],
  4326. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  4327. referencedClasses: [],
  4328. messageSends: []
  4329. }),
  4330. $globals.Date);
  4331. $core.addMethod(
  4332. $core.method({
  4333. selector: ">=",
  4334. protocol: "comparing",
  4335. fn: function (aDate){
  4336. var self=this,$self=this;
  4337. return $core.withContext(function($ctx1) {
  4338. return self >= aDate;
  4339. return self;
  4340. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  4341. },
  4342. args: ["aDate"],
  4343. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  4344. referencedClasses: [],
  4345. messageSends: []
  4346. }),
  4347. $globals.Date);
  4348. $core.addMethod(
  4349. $core.method({
  4350. selector: "asDateString",
  4351. protocol: "converting",
  4352. fn: function (){
  4353. var self=this,$self=this;
  4354. return $core.withContext(function($ctx1) {
  4355. return self.toDateString();
  4356. return self;
  4357. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  4358. },
  4359. args: [],
  4360. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  4361. referencedClasses: [],
  4362. messageSends: []
  4363. }),
  4364. $globals.Date);
  4365. $core.addMethod(
  4366. $core.method({
  4367. selector: "asLocaleString",
  4368. protocol: "converting",
  4369. fn: function (){
  4370. var self=this,$self=this;
  4371. return $core.withContext(function($ctx1) {
  4372. return self.toLocaleString();
  4373. return self;
  4374. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  4375. },
  4376. args: [],
  4377. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  4378. referencedClasses: [],
  4379. messageSends: []
  4380. }),
  4381. $globals.Date);
  4382. $core.addMethod(
  4383. $core.method({
  4384. selector: "asMilliseconds",
  4385. protocol: "converting",
  4386. fn: function (){
  4387. var self=this,$self=this;
  4388. return $core.withContext(function($ctx1) {
  4389. return $self._time();
  4390. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  4391. },
  4392. args: [],
  4393. source: "asMilliseconds\x0a\x09^ self time",
  4394. referencedClasses: [],
  4395. messageSends: ["time"]
  4396. }),
  4397. $globals.Date);
  4398. $core.addMethod(
  4399. $core.method({
  4400. selector: "asNumber",
  4401. protocol: "converting",
  4402. fn: function (){
  4403. var self=this,$self=this;
  4404. return $core.withContext(function($ctx1) {
  4405. return $self._asMilliseconds();
  4406. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  4407. },
  4408. args: [],
  4409. source: "asNumber\x0a\x09^ self asMilliseconds",
  4410. referencedClasses: [],
  4411. messageSends: ["asMilliseconds"]
  4412. }),
  4413. $globals.Date);
  4414. $core.addMethod(
  4415. $core.method({
  4416. selector: "asString",
  4417. protocol: "converting",
  4418. fn: function (){
  4419. var self=this,$self=this;
  4420. return $core.withContext(function($ctx1) {
  4421. return self.toString();
  4422. return self;
  4423. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  4424. },
  4425. args: [],
  4426. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4427. referencedClasses: [],
  4428. messageSends: []
  4429. }),
  4430. $globals.Date);
  4431. $core.addMethod(
  4432. $core.method({
  4433. selector: "asTimeString",
  4434. protocol: "converting",
  4435. fn: function (){
  4436. var self=this,$self=this;
  4437. return $core.withContext(function($ctx1) {
  4438. return self.toTimeString();
  4439. return self;
  4440. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  4441. },
  4442. args: [],
  4443. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  4444. referencedClasses: [],
  4445. messageSends: []
  4446. }),
  4447. $globals.Date);
  4448. $core.addMethod(
  4449. $core.method({
  4450. selector: "day",
  4451. protocol: "accessing",
  4452. fn: function (){
  4453. var self=this,$self=this;
  4454. return $core.withContext(function($ctx1) {
  4455. return $self._dayOfWeek();
  4456. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  4457. },
  4458. args: [],
  4459. source: "day\x0a\x09^ self dayOfWeek",
  4460. referencedClasses: [],
  4461. messageSends: ["dayOfWeek"]
  4462. }),
  4463. $globals.Date);
  4464. $core.addMethod(
  4465. $core.method({
  4466. selector: "day:",
  4467. protocol: "accessing",
  4468. fn: function (aNumber){
  4469. var self=this,$self=this;
  4470. return $core.withContext(function($ctx1) {
  4471. $self._dayOfWeek_(aNumber);
  4472. return self;
  4473. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  4474. },
  4475. args: ["aNumber"],
  4476. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  4477. referencedClasses: [],
  4478. messageSends: ["dayOfWeek:"]
  4479. }),
  4480. $globals.Date);
  4481. $core.addMethod(
  4482. $core.method({
  4483. selector: "dayOfMonth",
  4484. protocol: "accessing",
  4485. fn: function (){
  4486. var self=this,$self=this;
  4487. return $core.withContext(function($ctx1) {
  4488. return self.getDate();
  4489. return self;
  4490. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  4491. },
  4492. args: [],
  4493. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  4494. referencedClasses: [],
  4495. messageSends: []
  4496. }),
  4497. $globals.Date);
  4498. $core.addMethod(
  4499. $core.method({
  4500. selector: "dayOfMonth:",
  4501. protocol: "accessing",
  4502. fn: function (aNumber){
  4503. var self=this,$self=this;
  4504. return $core.withContext(function($ctx1) {
  4505. self.setDate(aNumber);
  4506. return self;
  4507. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  4508. },
  4509. args: ["aNumber"],
  4510. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  4511. referencedClasses: [],
  4512. messageSends: []
  4513. }),
  4514. $globals.Date);
  4515. $core.addMethod(
  4516. $core.method({
  4517. selector: "dayOfWeek",
  4518. protocol: "accessing",
  4519. fn: function (){
  4520. var self=this,$self=this;
  4521. return $core.withContext(function($ctx1) {
  4522. return self.getDay() + 1;
  4523. return self;
  4524. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  4525. },
  4526. args: [],
  4527. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  4528. referencedClasses: [],
  4529. messageSends: []
  4530. }),
  4531. $globals.Date);
  4532. $core.addMethod(
  4533. $core.method({
  4534. selector: "dayOfWeek:",
  4535. protocol: "accessing",
  4536. fn: function (aNumber){
  4537. var self=this,$self=this;
  4538. return $core.withContext(function($ctx1) {
  4539. return self.setDay(aNumber - 1);
  4540. return self;
  4541. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  4542. },
  4543. args: ["aNumber"],
  4544. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  4545. referencedClasses: [],
  4546. messageSends: []
  4547. }),
  4548. $globals.Date);
  4549. $core.addMethod(
  4550. $core.method({
  4551. selector: "hours",
  4552. protocol: "accessing",
  4553. fn: function (){
  4554. var self=this,$self=this;
  4555. return $core.withContext(function($ctx1) {
  4556. return self.getHours();
  4557. return self;
  4558. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  4559. },
  4560. args: [],
  4561. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  4562. referencedClasses: [],
  4563. messageSends: []
  4564. }),
  4565. $globals.Date);
  4566. $core.addMethod(
  4567. $core.method({
  4568. selector: "hours:",
  4569. protocol: "accessing",
  4570. fn: function (aNumber){
  4571. var self=this,$self=this;
  4572. return $core.withContext(function($ctx1) {
  4573. self.setHours(aNumber);
  4574. return self;
  4575. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  4576. },
  4577. args: ["aNumber"],
  4578. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  4579. referencedClasses: [],
  4580. messageSends: []
  4581. }),
  4582. $globals.Date);
  4583. $core.addMethod(
  4584. $core.method({
  4585. selector: "milliseconds",
  4586. protocol: "accessing",
  4587. fn: function (){
  4588. var self=this,$self=this;
  4589. return $core.withContext(function($ctx1) {
  4590. return self.getMilliseconds();
  4591. return self;
  4592. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  4593. },
  4594. args: [],
  4595. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  4596. referencedClasses: [],
  4597. messageSends: []
  4598. }),
  4599. $globals.Date);
  4600. $core.addMethod(
  4601. $core.method({
  4602. selector: "milliseconds:",
  4603. protocol: "accessing",
  4604. fn: function (aNumber){
  4605. var self=this,$self=this;
  4606. return $core.withContext(function($ctx1) {
  4607. self.setMilliseconds(aNumber);
  4608. return self;
  4609. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  4610. },
  4611. args: ["aNumber"],
  4612. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  4613. referencedClasses: [],
  4614. messageSends: []
  4615. }),
  4616. $globals.Date);
  4617. $core.addMethod(
  4618. $core.method({
  4619. selector: "minutes",
  4620. protocol: "accessing",
  4621. fn: function (){
  4622. var self=this,$self=this;
  4623. return $core.withContext(function($ctx1) {
  4624. return self.getMinutes();
  4625. return self;
  4626. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  4627. },
  4628. args: [],
  4629. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  4630. referencedClasses: [],
  4631. messageSends: []
  4632. }),
  4633. $globals.Date);
  4634. $core.addMethod(
  4635. $core.method({
  4636. selector: "minutes:",
  4637. protocol: "accessing",
  4638. fn: function (aNumber){
  4639. var self=this,$self=this;
  4640. return $core.withContext(function($ctx1) {
  4641. self.setMinutes(aNumber);
  4642. return self;
  4643. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  4644. },
  4645. args: ["aNumber"],
  4646. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  4647. referencedClasses: [],
  4648. messageSends: []
  4649. }),
  4650. $globals.Date);
  4651. $core.addMethod(
  4652. $core.method({
  4653. selector: "month",
  4654. protocol: "accessing",
  4655. fn: function (){
  4656. var self=this,$self=this;
  4657. return $core.withContext(function($ctx1) {
  4658. return self.getMonth() + 1;
  4659. return self;
  4660. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  4661. },
  4662. args: [],
  4663. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4664. referencedClasses: [],
  4665. messageSends: []
  4666. }),
  4667. $globals.Date);
  4668. $core.addMethod(
  4669. $core.method({
  4670. selector: "month:",
  4671. protocol: "accessing",
  4672. fn: function (aNumber){
  4673. var self=this,$self=this;
  4674. return $core.withContext(function($ctx1) {
  4675. self.setMonth(aNumber - 1);
  4676. return self;
  4677. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  4678. },
  4679. args: ["aNumber"],
  4680. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4681. referencedClasses: [],
  4682. messageSends: []
  4683. }),
  4684. $globals.Date);
  4685. $core.addMethod(
  4686. $core.method({
  4687. selector: "printOn:",
  4688. protocol: "printing",
  4689. fn: function (aStream){
  4690. var self=this,$self=this;
  4691. return $core.withContext(function($ctx1) {
  4692. $recv(aStream)._nextPutAll_($self._asString());
  4693. return self;
  4694. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  4695. },
  4696. args: ["aStream"],
  4697. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4698. referencedClasses: [],
  4699. messageSends: ["nextPutAll:", "asString"]
  4700. }),
  4701. $globals.Date);
  4702. $core.addMethod(
  4703. $core.method({
  4704. selector: "seconds",
  4705. protocol: "accessing",
  4706. fn: function (){
  4707. var self=this,$self=this;
  4708. return $core.withContext(function($ctx1) {
  4709. return self.getSeconds();
  4710. return self;
  4711. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  4712. },
  4713. args: [],
  4714. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4715. referencedClasses: [],
  4716. messageSends: []
  4717. }),
  4718. $globals.Date);
  4719. $core.addMethod(
  4720. $core.method({
  4721. selector: "seconds:",
  4722. protocol: "accessing",
  4723. fn: function (aNumber){
  4724. var self=this,$self=this;
  4725. return $core.withContext(function($ctx1) {
  4726. self.setSeconds(aNumber);
  4727. return self;
  4728. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  4729. },
  4730. args: ["aNumber"],
  4731. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4732. referencedClasses: [],
  4733. messageSends: []
  4734. }),
  4735. $globals.Date);
  4736. $core.addMethod(
  4737. $core.method({
  4738. selector: "time",
  4739. protocol: "accessing",
  4740. fn: function (){
  4741. var self=this,$self=this;
  4742. return $core.withContext(function($ctx1) {
  4743. return self.getTime();
  4744. return self;
  4745. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  4746. },
  4747. args: [],
  4748. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4749. referencedClasses: [],
  4750. messageSends: []
  4751. }),
  4752. $globals.Date);
  4753. $core.addMethod(
  4754. $core.method({
  4755. selector: "time:",
  4756. protocol: "accessing",
  4757. fn: function (aNumber){
  4758. var self=this,$self=this;
  4759. return $core.withContext(function($ctx1) {
  4760. self.setTime(aNumber);
  4761. return self;
  4762. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  4763. },
  4764. args: ["aNumber"],
  4765. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4766. referencedClasses: [],
  4767. messageSends: []
  4768. }),
  4769. $globals.Date);
  4770. $core.addMethod(
  4771. $core.method({
  4772. selector: "year",
  4773. protocol: "accessing",
  4774. fn: function (){
  4775. var self=this,$self=this;
  4776. return $core.withContext(function($ctx1) {
  4777. return self.getFullYear();
  4778. return self;
  4779. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  4780. },
  4781. args: [],
  4782. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4783. referencedClasses: [],
  4784. messageSends: []
  4785. }),
  4786. $globals.Date);
  4787. $core.addMethod(
  4788. $core.method({
  4789. selector: "year:",
  4790. protocol: "accessing",
  4791. fn: function (aNumber){
  4792. var self=this,$self=this;
  4793. return $core.withContext(function($ctx1) {
  4794. self.setFullYear(aNumber);
  4795. return self;
  4796. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  4797. },
  4798. args: ["aNumber"],
  4799. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4800. referencedClasses: [],
  4801. messageSends: []
  4802. }),
  4803. $globals.Date);
  4804. $core.addMethod(
  4805. $core.method({
  4806. selector: "classTag",
  4807. protocol: "accessing",
  4808. fn: function (){
  4809. var self=this,$self=this;
  4810. return "magnitude";
  4811. },
  4812. args: [],
  4813. 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'",
  4814. referencedClasses: [],
  4815. messageSends: []
  4816. }),
  4817. $globals.Date.a$cls);
  4818. $core.addMethod(
  4819. $core.method({
  4820. selector: "fromMilliseconds:",
  4821. protocol: "instance creation",
  4822. fn: function (aNumber){
  4823. var self=this,$self=this;
  4824. return $core.withContext(function($ctx1) {
  4825. return $self._new_(aNumber);
  4826. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4827. },
  4828. args: ["aNumber"],
  4829. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4830. referencedClasses: [],
  4831. messageSends: ["new:"]
  4832. }),
  4833. $globals.Date.a$cls);
  4834. $core.addMethod(
  4835. $core.method({
  4836. selector: "fromSeconds:",
  4837. protocol: "instance creation",
  4838. fn: function (aNumber){
  4839. var self=this,$self=this;
  4840. return $core.withContext(function($ctx1) {
  4841. return $self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4842. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4843. },
  4844. args: ["aNumber"],
  4845. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4846. referencedClasses: [],
  4847. messageSends: ["fromMilliseconds:", "*"]
  4848. }),
  4849. $globals.Date.a$cls);
  4850. $core.addMethod(
  4851. $core.method({
  4852. selector: "fromString:",
  4853. protocol: "instance creation",
  4854. fn: function (aString){
  4855. var self=this,$self=this;
  4856. return $core.withContext(function($ctx1) {
  4857. return $self._new_(aString);
  4858. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.a$cls)});
  4859. },
  4860. args: ["aString"],
  4861. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4862. referencedClasses: [],
  4863. messageSends: ["new:"]
  4864. }),
  4865. $globals.Date.a$cls);
  4866. $core.addMethod(
  4867. $core.method({
  4868. selector: "millisecondsToRun:",
  4869. protocol: "instance creation",
  4870. fn: function (aBlock){
  4871. var self=this,$self=this;
  4872. var t;
  4873. return $core.withContext(function($ctx1) {
  4874. t=$recv($globals.Date)._now();
  4875. $ctx1.sendIdx["now"]=1;
  4876. $recv(aBlock)._value();
  4877. return $recv($recv($globals.Date)._now()).__minus(t);
  4878. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.a$cls)});
  4879. },
  4880. args: ["aBlock"],
  4881. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4882. referencedClasses: ["Date"],
  4883. messageSends: ["now", "value", "-"]
  4884. }),
  4885. $globals.Date.a$cls);
  4886. $core.addMethod(
  4887. $core.method({
  4888. selector: "new:",
  4889. protocol: "instance creation",
  4890. fn: function (anObject){
  4891. var self=this,$self=this;
  4892. return $core.withContext(function($ctx1) {
  4893. return new Date(anObject);
  4894. return self;
  4895. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.a$cls)});
  4896. },
  4897. args: ["anObject"],
  4898. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  4899. referencedClasses: [],
  4900. messageSends: []
  4901. }),
  4902. $globals.Date.a$cls);
  4903. $core.addMethod(
  4904. $core.method({
  4905. selector: "now",
  4906. protocol: "instance creation",
  4907. fn: function (){
  4908. var self=this,$self=this;
  4909. return $core.withContext(function($ctx1) {
  4910. return $self._today();
  4911. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.a$cls)});
  4912. },
  4913. args: [],
  4914. source: "now\x0a\x09^ self today",
  4915. referencedClasses: [],
  4916. messageSends: ["today"]
  4917. }),
  4918. $globals.Date.a$cls);
  4919. $core.addMethod(
  4920. $core.method({
  4921. selector: "today",
  4922. protocol: "instance creation",
  4923. fn: function (){
  4924. var self=this,$self=this;
  4925. return $core.withContext(function($ctx1) {
  4926. return $self._new();
  4927. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.a$cls)});
  4928. },
  4929. args: [],
  4930. source: "today\x0a\x09^ self new",
  4931. referencedClasses: [],
  4932. messageSends: ["new"]
  4933. }),
  4934. $globals.Date.a$cls);
  4935. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  4936. $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 ].";
  4937. $core.addMethod(
  4938. $core.method({
  4939. selector: "&",
  4940. protocol: "converting",
  4941. fn: function (aNumber){
  4942. var self=this,$self=this;
  4943. return $core.withContext(function($ctx1) {
  4944. return self & aNumber;
  4945. return self;
  4946. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  4947. },
  4948. args: ["aNumber"],
  4949. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  4950. referencedClasses: [],
  4951. messageSends: []
  4952. }),
  4953. $globals.Number);
  4954. $core.addMethod(
  4955. $core.method({
  4956. selector: "*",
  4957. protocol: "arithmetic",
  4958. fn: function (aNumber){
  4959. var self=this,$self=this;
  4960. return $core.withContext(function($ctx1) {
  4961. return self * aNumber;
  4962. return self;
  4963. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  4964. },
  4965. args: ["aNumber"],
  4966. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self * aNumber'>",
  4967. referencedClasses: [],
  4968. messageSends: []
  4969. }),
  4970. $globals.Number);
  4971. $core.addMethod(
  4972. $core.method({
  4973. selector: "**",
  4974. protocol: "mathematical functions",
  4975. fn: function (exponent){
  4976. var self=this,$self=this;
  4977. return $core.withContext(function($ctx1) {
  4978. return $self._raisedTo_(exponent);
  4979. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4980. },
  4981. args: ["exponent"],
  4982. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4983. referencedClasses: [],
  4984. messageSends: ["raisedTo:"]
  4985. }),
  4986. $globals.Number);
  4987. $core.addMethod(
  4988. $core.method({
  4989. selector: "+",
  4990. protocol: "arithmetic",
  4991. fn: function (aNumber){
  4992. var self=this,$self=this;
  4993. return $core.withContext(function($ctx1) {
  4994. return self + aNumber;
  4995. return self;
  4996. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4997. },
  4998. args: ["aNumber"],
  4999. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self + aNumber'>",
  5000. referencedClasses: [],
  5001. messageSends: []
  5002. }),
  5003. $globals.Number);
  5004. $core.addMethod(
  5005. $core.method({
  5006. selector: "-",
  5007. protocol: "arithmetic",
  5008. fn: function (aNumber){
  5009. var self=this,$self=this;
  5010. return $core.withContext(function($ctx1) {
  5011. return self - aNumber;
  5012. return self;
  5013. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  5014. },
  5015. args: ["aNumber"],
  5016. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self - aNumber'>",
  5017. referencedClasses: [],
  5018. messageSends: []
  5019. }),
  5020. $globals.Number);
  5021. $core.addMethod(
  5022. $core.method({
  5023. selector: "/",
  5024. protocol: "arithmetic",
  5025. fn: function (aNumber){
  5026. var self=this,$self=this;
  5027. return $core.withContext(function($ctx1) {
  5028. return self / aNumber;
  5029. return self;
  5030. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  5031. },
  5032. args: ["aNumber"],
  5033. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self / aNumber'>",
  5034. referencedClasses: [],
  5035. messageSends: []
  5036. }),
  5037. $globals.Number);
  5038. $core.addMethod(
  5039. $core.method({
  5040. selector: "//",
  5041. protocol: "arithmetic",
  5042. fn: function (aNumber){
  5043. var self=this,$self=this;
  5044. return $core.withContext(function($ctx1) {
  5045. return $recv($self.__slash(aNumber))._floor();
  5046. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  5047. },
  5048. args: ["aNumber"],
  5049. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  5050. referencedClasses: [],
  5051. messageSends: ["floor", "/"]
  5052. }),
  5053. $globals.Number);
  5054. $core.addMethod(
  5055. $core.method({
  5056. selector: "<",
  5057. protocol: "comparing",
  5058. fn: function (aNumber){
  5059. var self=this,$self=this;
  5060. return $core.withContext(function($ctx1) {
  5061. return self < aNumber;
  5062. return self;
  5063. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  5064. },
  5065. args: ["aNumber"],
  5066. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self < aNumber'>",
  5067. referencedClasses: [],
  5068. messageSends: []
  5069. }),
  5070. $globals.Number);
  5071. $core.addMethod(
  5072. $core.method({
  5073. selector: "<=",
  5074. protocol: "comparing",
  5075. fn: function (aNumber){
  5076. var self=this,$self=this;
  5077. return $core.withContext(function($ctx1) {
  5078. return self <= aNumber;
  5079. return self;
  5080. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  5081. },
  5082. args: ["aNumber"],
  5083. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self <= aNumber'>",
  5084. referencedClasses: [],
  5085. messageSends: []
  5086. }),
  5087. $globals.Number);
  5088. $core.addMethod(
  5089. $core.method({
  5090. selector: "==",
  5091. protocol: "comparing",
  5092. fn: function (aNumber){
  5093. var self=this,$self=this;
  5094. return $core.withContext(function($ctx1) {
  5095. if (typeof aNumber === "number") return Number(self) === aNumber;
  5096. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  5097. else return false;;
  5098. return self;
  5099. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  5100. },
  5101. args: ["aNumber"],
  5102. 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'>",
  5103. referencedClasses: [],
  5104. messageSends: []
  5105. }),
  5106. $globals.Number);
  5107. $core.addMethod(
  5108. $core.method({
  5109. selector: ">",
  5110. protocol: "comparing",
  5111. fn: function (aNumber){
  5112. var self=this,$self=this;
  5113. return $core.withContext(function($ctx1) {
  5114. return self > aNumber;
  5115. return self;
  5116. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  5117. },
  5118. args: ["aNumber"],
  5119. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self > aNumber'>",
  5120. referencedClasses: [],
  5121. messageSends: []
  5122. }),
  5123. $globals.Number);
  5124. $core.addMethod(
  5125. $core.method({
  5126. selector: ">=",
  5127. protocol: "comparing",
  5128. fn: function (aNumber){
  5129. var self=this,$self=this;
  5130. return $core.withContext(function($ctx1) {
  5131. return self >= aNumber;
  5132. return self;
  5133. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  5134. },
  5135. args: ["aNumber"],
  5136. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self >= aNumber'>",
  5137. referencedClasses: [],
  5138. messageSends: []
  5139. }),
  5140. $globals.Number);
  5141. $core.addMethod(
  5142. $core.method({
  5143. selector: "@",
  5144. protocol: "converting",
  5145. fn: function (aNumber){
  5146. var self=this,$self=this;
  5147. return $core.withContext(function($ctx1) {
  5148. return $recv($globals.Point)._x_y_(self,aNumber);
  5149. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  5150. },
  5151. args: ["aNumber"],
  5152. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  5153. referencedClasses: ["Point"],
  5154. messageSends: ["x:y:"]
  5155. }),
  5156. $globals.Number);
  5157. $core.addMethod(
  5158. $core.method({
  5159. selector: "\x5c\x5c",
  5160. protocol: "arithmetic",
  5161. fn: function (aNumber){
  5162. var self=this,$self=this;
  5163. return $core.withContext(function($ctx1) {
  5164. return self % aNumber;
  5165. return self;
  5166. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  5167. },
  5168. args: ["aNumber"],
  5169. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  5170. referencedClasses: [],
  5171. messageSends: []
  5172. }),
  5173. $globals.Number);
  5174. $core.addMethod(
  5175. $core.method({
  5176. selector: "abs",
  5177. protocol: "arithmetic",
  5178. fn: function (){
  5179. var self=this,$self=this;
  5180. return $core.withContext(function($ctx1) {
  5181. return Math.abs(self);;
  5182. return self;
  5183. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  5184. },
  5185. args: [],
  5186. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  5187. referencedClasses: [],
  5188. messageSends: []
  5189. }),
  5190. $globals.Number);
  5191. $core.addMethod(
  5192. $core.method({
  5193. selector: "arcCos",
  5194. protocol: "mathematical functions",
  5195. fn: function (){
  5196. var self=this,$self=this;
  5197. return $core.withContext(function($ctx1) {
  5198. return Math.acos(self);;
  5199. return self;
  5200. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  5201. },
  5202. args: [],
  5203. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  5204. referencedClasses: [],
  5205. messageSends: []
  5206. }),
  5207. $globals.Number);
  5208. $core.addMethod(
  5209. $core.method({
  5210. selector: "arcSin",
  5211. protocol: "mathematical functions",
  5212. fn: function (){
  5213. var self=this,$self=this;
  5214. return $core.withContext(function($ctx1) {
  5215. return Math.asin(self);;
  5216. return self;
  5217. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  5218. },
  5219. args: [],
  5220. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  5221. referencedClasses: [],
  5222. messageSends: []
  5223. }),
  5224. $globals.Number);
  5225. $core.addMethod(
  5226. $core.method({
  5227. selector: "arcTan",
  5228. protocol: "mathematical functions",
  5229. fn: function (){
  5230. var self=this,$self=this;
  5231. return $core.withContext(function($ctx1) {
  5232. return Math.atan(self);;
  5233. return self;
  5234. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  5235. },
  5236. args: [],
  5237. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  5238. referencedClasses: [],
  5239. messageSends: []
  5240. }),
  5241. $globals.Number);
  5242. $core.addMethod(
  5243. $core.method({
  5244. selector: "arcTan:",
  5245. protocol: "mathematical functions",
  5246. fn: function (aNumber){
  5247. var self=this,$self=this;
  5248. return $core.withContext(function($ctx1) {
  5249. return Math.atan2(self, aNumber);;
  5250. return self;
  5251. }, function($ctx1) {$ctx1.fill(self,"arcTan:",{aNumber:aNumber},$globals.Number)});
  5252. },
  5253. args: ["aNumber"],
  5254. source: "arcTan: aNumber\x0a\x09<inlineJS: 'return Math.atan2(self, aNumber);'>",
  5255. referencedClasses: [],
  5256. messageSends: []
  5257. }),
  5258. $globals.Number);
  5259. $core.addMethod(
  5260. $core.method({
  5261. selector: "asJavaScriptObject",
  5262. protocol: "converting",
  5263. fn: function (){
  5264. var self=this,$self=this;
  5265. return self;
  5266. },
  5267. args: [],
  5268. source: "asJavaScriptObject\x0a\x09^ self",
  5269. referencedClasses: [],
  5270. messageSends: []
  5271. }),
  5272. $globals.Number);
  5273. $core.addMethod(
  5274. $core.method({
  5275. selector: "asJavaScriptSource",
  5276. protocol: "converting",
  5277. fn: function (){
  5278. var self=this,$self=this;
  5279. return $core.withContext(function($ctx1) {
  5280. var $1;
  5281. $1=$recv("(".__comma($self._printString())).__comma(")");
  5282. $ctx1.sendIdx[","]=1;
  5283. return $1;
  5284. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Number)});
  5285. },
  5286. args: [],
  5287. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  5288. referencedClasses: [],
  5289. messageSends: [",", "printString"]
  5290. }),
  5291. $globals.Number);
  5292. $core.addMethod(
  5293. $core.method({
  5294. selector: "asNumber",
  5295. protocol: "converting",
  5296. fn: function (){
  5297. var self=this,$self=this;
  5298. return self;
  5299. },
  5300. args: [],
  5301. source: "asNumber\x0a\x09^ self",
  5302. referencedClasses: [],
  5303. messageSends: []
  5304. }),
  5305. $globals.Number);
  5306. $core.addMethod(
  5307. $core.method({
  5308. selector: "asPoint",
  5309. protocol: "converting",
  5310. fn: function (){
  5311. var self=this,$self=this;
  5312. return $core.withContext(function($ctx1) {
  5313. return $recv($globals.Point)._x_y_(self,self);
  5314. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  5315. },
  5316. args: [],
  5317. source: "asPoint\x0a\x09^ Point x: self y: self",
  5318. referencedClasses: ["Point"],
  5319. messageSends: ["x:y:"]
  5320. }),
  5321. $globals.Number);
  5322. $core.addMethod(
  5323. $core.method({
  5324. selector: "asString",
  5325. protocol: "converting",
  5326. fn: function (){
  5327. var self=this,$self=this;
  5328. return $core.withContext(function($ctx1) {
  5329. return String(self);
  5330. return self;
  5331. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  5332. },
  5333. args: [],
  5334. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  5335. referencedClasses: [],
  5336. messageSends: []
  5337. }),
  5338. $globals.Number);
  5339. $core.addMethod(
  5340. $core.method({
  5341. selector: "atRandom",
  5342. protocol: "converting",
  5343. fn: function (){
  5344. var self=this,$self=this;
  5345. return $core.withContext(function($ctx1) {
  5346. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  5347. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  5348. },
  5349. args: [],
  5350. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  5351. referencedClasses: ["Random"],
  5352. messageSends: ["+", "truncated", "*", "next", "new"]
  5353. }),
  5354. $globals.Number);
  5355. $core.addMethod(
  5356. $core.method({
  5357. selector: "between:and:",
  5358. protocol: "testing",
  5359. fn: function (min,max){
  5360. var self=this,$self=this;
  5361. return $core.withContext(function($ctx1) {
  5362. return $recv($self.__gt_eq(min))._and_((function(){
  5363. return $core.withContext(function($ctx2) {
  5364. return $self.__lt_eq(max);
  5365. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5366. }));
  5367. }, function($ctx1) {$ctx1.fill(self,"between:and:",{min:min,max:max},$globals.Number)});
  5368. },
  5369. args: ["min", "max"],
  5370. source: "between: min and: max\x0a ^ self >= min and: [ self <= max ]",
  5371. referencedClasses: [],
  5372. messageSends: ["and:", ">=", "<="]
  5373. }),
  5374. $globals.Number);
  5375. $core.addMethod(
  5376. $core.method({
  5377. selector: "bitAnd:",
  5378. protocol: "converting",
  5379. fn: function (aNumber){
  5380. var self=this,$self=this;
  5381. return $core.withContext(function($ctx1) {
  5382. return self & aNumber;
  5383. return self;
  5384. }, function($ctx1) {$ctx1.fill(self,"bitAnd:",{aNumber:aNumber},$globals.Number)});
  5385. },
  5386. args: ["aNumber"],
  5387. source: "bitAnd: aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  5388. referencedClasses: [],
  5389. messageSends: []
  5390. }),
  5391. $globals.Number);
  5392. $core.addMethod(
  5393. $core.method({
  5394. selector: "bitNot",
  5395. protocol: "converting",
  5396. fn: function (){
  5397. var self=this,$self=this;
  5398. return $core.withContext(function($ctx1) {
  5399. return ~self;
  5400. return self;
  5401. }, function($ctx1) {$ctx1.fill(self,"bitNot",{},$globals.Number)});
  5402. },
  5403. args: [],
  5404. source: "bitNot\x0a\x09<inlineJS: 'return ~self'>",
  5405. referencedClasses: [],
  5406. messageSends: []
  5407. }),
  5408. $globals.Number);
  5409. $core.addMethod(
  5410. $core.method({
  5411. selector: "bitOr:",
  5412. protocol: "converting",
  5413. fn: function (aNumber){
  5414. var self=this,$self=this;
  5415. return $core.withContext(function($ctx1) {
  5416. return self | aNumber;
  5417. return self;
  5418. }, function($ctx1) {$ctx1.fill(self,"bitOr:",{aNumber:aNumber},$globals.Number)});
  5419. },
  5420. args: ["aNumber"],
  5421. source: "bitOr: aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5422. referencedClasses: [],
  5423. messageSends: []
  5424. }),
  5425. $globals.Number);
  5426. $core.addMethod(
  5427. $core.method({
  5428. selector: "bitXor:",
  5429. protocol: "converting",
  5430. fn: function (aNumber){
  5431. var self=this,$self=this;
  5432. return $core.withContext(function($ctx1) {
  5433. return self ^ aNumber;
  5434. return self;
  5435. }, function($ctx1) {$ctx1.fill(self,"bitXor:",{aNumber:aNumber},$globals.Number)});
  5436. },
  5437. args: ["aNumber"],
  5438. source: "bitXor: aNumber\x0a\x09<inlineJS: 'return self ^ aNumber'>",
  5439. referencedClasses: [],
  5440. messageSends: []
  5441. }),
  5442. $globals.Number);
  5443. $core.addMethod(
  5444. $core.method({
  5445. selector: "ceiling",
  5446. protocol: "converting",
  5447. fn: function (){
  5448. var self=this,$self=this;
  5449. return $core.withContext(function($ctx1) {
  5450. return Math.ceil(self);;
  5451. return self;
  5452. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  5453. },
  5454. args: [],
  5455. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  5456. referencedClasses: [],
  5457. messageSends: []
  5458. }),
  5459. $globals.Number);
  5460. $core.addMethod(
  5461. $core.method({
  5462. selector: "copy",
  5463. protocol: "copying",
  5464. fn: function (){
  5465. var self=this,$self=this;
  5466. return self;
  5467. },
  5468. args: [],
  5469. source: "copy\x0a\x09^ self",
  5470. referencedClasses: [],
  5471. messageSends: []
  5472. }),
  5473. $globals.Number);
  5474. $core.addMethod(
  5475. $core.method({
  5476. selector: "cos",
  5477. protocol: "mathematical functions",
  5478. fn: function (){
  5479. var self=this,$self=this;
  5480. return $core.withContext(function($ctx1) {
  5481. return Math.cos(self);;
  5482. return self;
  5483. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  5484. },
  5485. args: [],
  5486. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  5487. referencedClasses: [],
  5488. messageSends: []
  5489. }),
  5490. $globals.Number);
  5491. $core.addMethod(
  5492. $core.method({
  5493. selector: "deepCopy",
  5494. protocol: "copying",
  5495. fn: function (){
  5496. var self=this,$self=this;
  5497. return $core.withContext(function($ctx1) {
  5498. return $self._copy();
  5499. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  5500. },
  5501. args: [],
  5502. source: "deepCopy\x0a\x09^ self copy",
  5503. referencedClasses: [],
  5504. messageSends: ["copy"]
  5505. }),
  5506. $globals.Number);
  5507. $core.addMethod(
  5508. $core.method({
  5509. selector: "degreesToRadians",
  5510. protocol: "converting",
  5511. fn: function (){
  5512. var self=this,$self=this;
  5513. return $core.withContext(function($ctx1) {
  5514. return $self.__star($recv($globals.Number)._radiansPerDegree());
  5515. }, function($ctx1) {$ctx1.fill(self,"degreesToRadians",{},$globals.Number)});
  5516. },
  5517. args: [],
  5518. source: "degreesToRadians\x0a\x09^ self * Number radiansPerDegree",
  5519. referencedClasses: ["Number"],
  5520. messageSends: ["*", "radiansPerDegree"]
  5521. }),
  5522. $globals.Number);
  5523. $core.addMethod(
  5524. $core.method({
  5525. selector: "even",
  5526. protocol: "testing",
  5527. fn: function (){
  5528. var self=this,$self=this;
  5529. return $core.withContext(function($ctx1) {
  5530. return (0).__eq($self.__backslash_backslash((2)));
  5531. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  5532. },
  5533. args: [],
  5534. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  5535. referencedClasses: [],
  5536. messageSends: ["=", "\x5c\x5c"]
  5537. }),
  5538. $globals.Number);
  5539. $core.addMethod(
  5540. $core.method({
  5541. selector: "floor",
  5542. protocol: "converting",
  5543. fn: function (){
  5544. var self=this,$self=this;
  5545. return $core.withContext(function($ctx1) {
  5546. return Math.floor(self);;
  5547. return self;
  5548. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  5549. },
  5550. args: [],
  5551. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  5552. referencedClasses: [],
  5553. messageSends: []
  5554. }),
  5555. $globals.Number);
  5556. $core.addMethod(
  5557. $core.method({
  5558. selector: "isImmutable",
  5559. protocol: "testing",
  5560. fn: function (){
  5561. var self=this,$self=this;
  5562. return true;
  5563. },
  5564. args: [],
  5565. source: "isImmutable\x0a\x09^ true",
  5566. referencedClasses: [],
  5567. messageSends: []
  5568. }),
  5569. $globals.Number);
  5570. $core.addMethod(
  5571. $core.method({
  5572. selector: "isNumber",
  5573. protocol: "testing",
  5574. fn: function (){
  5575. var self=this,$self=this;
  5576. return true;
  5577. },
  5578. args: [],
  5579. source: "isNumber\x0a\x09^ true",
  5580. referencedClasses: [],
  5581. messageSends: []
  5582. }),
  5583. $globals.Number);
  5584. $core.addMethod(
  5585. $core.method({
  5586. selector: "isZero",
  5587. protocol: "testing",
  5588. fn: function (){
  5589. var self=this,$self=this;
  5590. return $core.withContext(function($ctx1) {
  5591. return $self.__eq((0));
  5592. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  5593. },
  5594. args: [],
  5595. source: "isZero\x0a\x09^ self = 0",
  5596. referencedClasses: [],
  5597. messageSends: ["="]
  5598. }),
  5599. $globals.Number);
  5600. $core.addMethod(
  5601. $core.method({
  5602. selector: "ln",
  5603. protocol: "mathematical functions",
  5604. fn: function (){
  5605. var self=this,$self=this;
  5606. return $core.withContext(function($ctx1) {
  5607. return Math.log(self);;
  5608. return self;
  5609. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  5610. },
  5611. args: [],
  5612. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  5613. referencedClasses: [],
  5614. messageSends: []
  5615. }),
  5616. $globals.Number);
  5617. $core.addMethod(
  5618. $core.method({
  5619. selector: "ln1p",
  5620. protocol: "mathematical functions",
  5621. fn: function (){
  5622. var self=this,$self=this;
  5623. return $core.withContext(function($ctx1) {
  5624. return Math.log1p(self);;
  5625. return self;
  5626. }, function($ctx1) {$ctx1.fill(self,"ln1p",{},$globals.Number)});
  5627. },
  5628. args: [],
  5629. source: "ln1p\x0a\x09<inlineJS: 'return Math.log1p(self);'>",
  5630. referencedClasses: [],
  5631. messageSends: []
  5632. }),
  5633. $globals.Number);
  5634. $core.addMethod(
  5635. $core.method({
  5636. selector: "log",
  5637. protocol: "mathematical functions",
  5638. fn: function (){
  5639. var self=this,$self=this;
  5640. return $core.withContext(function($ctx1) {
  5641. return Math.log(self) / Math.LN10;;
  5642. return self;
  5643. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  5644. },
  5645. args: [],
  5646. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  5647. referencedClasses: [],
  5648. messageSends: []
  5649. }),
  5650. $globals.Number);
  5651. $core.addMethod(
  5652. $core.method({
  5653. selector: "log:",
  5654. protocol: "mathematical functions",
  5655. fn: function (aNumber){
  5656. var self=this,$self=this;
  5657. return $core.withContext(function($ctx1) {
  5658. return Math.log(self) / Math.log(aNumber);;
  5659. return self;
  5660. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  5661. },
  5662. args: ["aNumber"],
  5663. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  5664. referencedClasses: [],
  5665. messageSends: []
  5666. }),
  5667. $globals.Number);
  5668. $core.addMethod(
  5669. $core.method({
  5670. selector: "max:",
  5671. protocol: "arithmetic",
  5672. fn: function (aNumber){
  5673. var self=this,$self=this;
  5674. return $core.withContext(function($ctx1) {
  5675. return Math.max(self, aNumber);;
  5676. return self;
  5677. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  5678. },
  5679. args: ["aNumber"],
  5680. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  5681. referencedClasses: [],
  5682. messageSends: []
  5683. }),
  5684. $globals.Number);
  5685. $core.addMethod(
  5686. $core.method({
  5687. selector: "min:",
  5688. protocol: "arithmetic",
  5689. fn: function (aNumber){
  5690. var self=this,$self=this;
  5691. return $core.withContext(function($ctx1) {
  5692. return Math.min(self, aNumber);;
  5693. return self;
  5694. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  5695. },
  5696. args: ["aNumber"],
  5697. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  5698. referencedClasses: [],
  5699. messageSends: []
  5700. }),
  5701. $globals.Number);
  5702. $core.addMethod(
  5703. $core.method({
  5704. selector: "min:max:",
  5705. protocol: "arithmetic",
  5706. fn: function (aMin,aMax){
  5707. var self=this,$self=this;
  5708. return $core.withContext(function($ctx1) {
  5709. return $recv($self._min_(aMin))._max_(aMax);
  5710. }, function($ctx1) {$ctx1.fill(self,"min:max:",{aMin:aMin,aMax:aMax},$globals.Number)});
  5711. },
  5712. args: ["aMin", "aMax"],
  5713. source: "min: aMin max: aMax\x0a\x09^ (self min: aMin) max: aMax",
  5714. referencedClasses: [],
  5715. messageSends: ["max:", "min:"]
  5716. }),
  5717. $globals.Number);
  5718. $core.addMethod(
  5719. $core.method({
  5720. selector: "negated",
  5721. protocol: "arithmetic",
  5722. fn: function (){
  5723. var self=this,$self=this;
  5724. return $core.withContext(function($ctx1) {
  5725. return (0).__minus(self);
  5726. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  5727. },
  5728. args: [],
  5729. source: "negated\x0a\x09^ 0 - self",
  5730. referencedClasses: [],
  5731. messageSends: ["-"]
  5732. }),
  5733. $globals.Number);
  5734. $core.addMethod(
  5735. $core.method({
  5736. selector: "negative",
  5737. protocol: "testing",
  5738. fn: function (){
  5739. var self=this,$self=this;
  5740. return $core.withContext(function($ctx1) {
  5741. return $self.__lt((0));
  5742. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  5743. },
  5744. args: [],
  5745. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5746. referencedClasses: [],
  5747. messageSends: ["<"]
  5748. }),
  5749. $globals.Number);
  5750. $core.addMethod(
  5751. $core.method({
  5752. selector: "odd",
  5753. protocol: "testing",
  5754. fn: function (){
  5755. var self=this,$self=this;
  5756. return $core.withContext(function($ctx1) {
  5757. return $recv($self._even())._not();
  5758. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  5759. },
  5760. args: [],
  5761. source: "odd\x0a\x09^ self even not",
  5762. referencedClasses: [],
  5763. messageSends: ["not", "even"]
  5764. }),
  5765. $globals.Number);
  5766. $core.addMethod(
  5767. $core.method({
  5768. selector: "positive",
  5769. protocol: "testing",
  5770. fn: function (){
  5771. var self=this,$self=this;
  5772. return $core.withContext(function($ctx1) {
  5773. return $self.__gt_eq((0));
  5774. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  5775. },
  5776. args: [],
  5777. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5778. referencedClasses: [],
  5779. messageSends: [">="]
  5780. }),
  5781. $globals.Number);
  5782. $core.addMethod(
  5783. $core.method({
  5784. selector: "printOn:",
  5785. protocol: "printing",
  5786. fn: function (aStream){
  5787. var self=this,$self=this;
  5788. return $core.withContext(function($ctx1) {
  5789. $recv(aStream)._nextPutAll_($self._asString());
  5790. return self;
  5791. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  5792. },
  5793. args: ["aStream"],
  5794. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5795. referencedClasses: [],
  5796. messageSends: ["nextPutAll:", "asString"]
  5797. }),
  5798. $globals.Number);
  5799. $core.addMethod(
  5800. $core.method({
  5801. selector: "printShowingDecimalPlaces:",
  5802. protocol: "printing",
  5803. fn: function (placesDesired){
  5804. var self=this,$self=this;
  5805. return $core.withContext(function($ctx1) {
  5806. return self.toFixed(placesDesired);
  5807. return self;
  5808. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  5809. },
  5810. args: ["placesDesired"],
  5811. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5812. referencedClasses: [],
  5813. messageSends: []
  5814. }),
  5815. $globals.Number);
  5816. $core.addMethod(
  5817. $core.method({
  5818. selector: "printStringBase:",
  5819. protocol: "converting",
  5820. fn: function (aBase){
  5821. var self=this,$self=this;
  5822. return $core.withContext(function($ctx1) {
  5823. return self.toString(aBase);
  5824. return self;
  5825. }, function($ctx1) {$ctx1.fill(self,"printStringBase:",{aBase:aBase},$globals.Number)});
  5826. },
  5827. args: ["aBase"],
  5828. source: "printStringBase: aBase\x0a\x09<inlineJS: 'return self.toString(aBase)'>",
  5829. referencedClasses: [],
  5830. messageSends: []
  5831. }),
  5832. $globals.Number);
  5833. $core.addMethod(
  5834. $core.method({
  5835. selector: "radiansToDegrees",
  5836. protocol: "converting",
  5837. fn: function (){
  5838. var self=this,$self=this;
  5839. return $core.withContext(function($ctx1) {
  5840. return $self.__slash($recv($globals.Number)._radiansPerDegree());
  5841. }, function($ctx1) {$ctx1.fill(self,"radiansToDegrees",{},$globals.Number)});
  5842. },
  5843. args: [],
  5844. source: "radiansToDegrees\x0a\x09^ self / Number radiansPerDegree",
  5845. referencedClasses: ["Number"],
  5846. messageSends: ["/", "radiansPerDegree"]
  5847. }),
  5848. $globals.Number);
  5849. $core.addMethod(
  5850. $core.method({
  5851. selector: "raisedTo:",
  5852. protocol: "mathematical functions",
  5853. fn: function (exponent){
  5854. var self=this,$self=this;
  5855. return $core.withContext(function($ctx1) {
  5856. return Math.pow(self, exponent);;
  5857. return self;
  5858. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  5859. },
  5860. args: ["exponent"],
  5861. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  5862. referencedClasses: [],
  5863. messageSends: []
  5864. }),
  5865. $globals.Number);
  5866. $core.addMethod(
  5867. $core.method({
  5868. selector: "rounded",
  5869. protocol: "converting",
  5870. fn: function (){
  5871. var self=this,$self=this;
  5872. return $core.withContext(function($ctx1) {
  5873. return Math.round(self);;
  5874. return self;
  5875. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  5876. },
  5877. args: [],
  5878. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  5879. referencedClasses: [],
  5880. messageSends: []
  5881. }),
  5882. $globals.Number);
  5883. $core.addMethod(
  5884. $core.method({
  5885. selector: "sign",
  5886. protocol: "mathematical functions",
  5887. fn: function (){
  5888. var self=this,$self=this;
  5889. return $core.withContext(function($ctx1) {
  5890. var $1,$2;
  5891. $1=$self._isZero();
  5892. if($core.assert($1)){
  5893. return (0);
  5894. }
  5895. $2=$self._positive();
  5896. if($core.assert($2)){
  5897. return (1);
  5898. } else {
  5899. return (-1);
  5900. }
  5901. return self;
  5902. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  5903. },
  5904. args: [],
  5905. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5906. referencedClasses: [],
  5907. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5908. }),
  5909. $globals.Number);
  5910. $core.addMethod(
  5911. $core.method({
  5912. selector: "sin",
  5913. protocol: "mathematical functions",
  5914. fn: function (){
  5915. var self=this,$self=this;
  5916. return $core.withContext(function($ctx1) {
  5917. return Math.sin(self);;
  5918. return self;
  5919. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  5920. },
  5921. args: [],
  5922. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  5923. referencedClasses: [],
  5924. messageSends: []
  5925. }),
  5926. $globals.Number);
  5927. $core.addMethod(
  5928. $core.method({
  5929. selector: "sqrt",
  5930. protocol: "mathematical functions",
  5931. fn: function (){
  5932. var self=this,$self=this;
  5933. return $core.withContext(function($ctx1) {
  5934. return Math.sqrt(self);
  5935. return self;
  5936. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  5937. },
  5938. args: [],
  5939. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  5940. referencedClasses: [],
  5941. messageSends: []
  5942. }),
  5943. $globals.Number);
  5944. $core.addMethod(
  5945. $core.method({
  5946. selector: "squared",
  5947. protocol: "mathematical functions",
  5948. fn: function (){
  5949. var self=this,$self=this;
  5950. return $core.withContext(function($ctx1) {
  5951. return $self.__star(self);
  5952. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  5953. },
  5954. args: [],
  5955. source: "squared\x0a\x09^ self * self",
  5956. referencedClasses: [],
  5957. messageSends: ["*"]
  5958. }),
  5959. $globals.Number);
  5960. $core.addMethod(
  5961. $core.method({
  5962. selector: "tan",
  5963. protocol: "mathematical functions",
  5964. fn: function (){
  5965. var self=this,$self=this;
  5966. return $core.withContext(function($ctx1) {
  5967. return Math.tan(self);;
  5968. return self;
  5969. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  5970. },
  5971. args: [],
  5972. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  5973. referencedClasses: [],
  5974. messageSends: []
  5975. }),
  5976. $globals.Number);
  5977. $core.addMethod(
  5978. $core.method({
  5979. selector: "timesRepeat:",
  5980. protocol: "enumerating",
  5981. fn: function (aBlock){
  5982. var self=this,$self=this;
  5983. var count;
  5984. return $core.withContext(function($ctx1) {
  5985. count=(1);
  5986. $recv((function(){
  5987. return $core.withContext(function($ctx2) {
  5988. return $recv(count).__gt(self);
  5989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5990. }))._whileFalse_((function(){
  5991. return $core.withContext(function($ctx2) {
  5992. $recv(aBlock)._value();
  5993. count=$recv(count).__plus((1));
  5994. return count;
  5995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5996. }));
  5997. return self;
  5998. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  5999. },
  6000. args: ["aBlock"],
  6001. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  6002. referencedClasses: [],
  6003. messageSends: ["whileFalse:", ">", "value", "+"]
  6004. }),
  6005. $globals.Number);
  6006. $core.addMethod(
  6007. $core.method({
  6008. selector: "to:",
  6009. protocol: "converting",
  6010. fn: function (aNumber){
  6011. var self=this,$self=this;
  6012. var array,first,last,count;
  6013. return $core.withContext(function($ctx1) {
  6014. first=$self._truncated();
  6015. $ctx1.sendIdx["truncated"]=1;
  6016. last=$recv($recv(aNumber)._truncated()).__plus((1));
  6017. $ctx1.sendIdx["+"]=1;
  6018. count=(1);
  6019. array=$recv($globals.Array)._new();
  6020. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  6021. return $core.withContext(function($ctx2) {
  6022. $recv(array)._at_put_(count,first);
  6023. count=$recv(count).__plus((1));
  6024. $ctx2.sendIdx["+"]=2;
  6025. first=$recv(first).__plus((1));
  6026. return first;
  6027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6028. }));
  6029. return array;
  6030. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  6031. },
  6032. args: ["aNumber"],
  6033. 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",
  6034. referencedClasses: ["Array"],
  6035. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  6036. }),
  6037. $globals.Number);
  6038. $core.addMethod(
  6039. $core.method({
  6040. selector: "to:by:",
  6041. protocol: "converting",
  6042. fn: function (stop,step){
  6043. var self=this,$self=this;
  6044. var array,value,pos;
  6045. return $core.withContext(function($ctx1) {
  6046. var $1,$2;
  6047. value=self;
  6048. array=$recv($globals.Array)._new();
  6049. pos=(1);
  6050. $1=$recv(step).__eq((0));
  6051. if($core.assert($1)){
  6052. $self._error_("step must be non-zero");
  6053. }
  6054. $2=$recv(step).__lt((0));
  6055. if($core.assert($2)){
  6056. $recv((function(){
  6057. return $core.withContext(function($ctx2) {
  6058. return $recv(value).__gt_eq(stop);
  6059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  6060. }))._whileTrue_((function(){
  6061. return $core.withContext(function($ctx2) {
  6062. $recv(array)._at_put_(pos,value);
  6063. $ctx2.sendIdx["at:put:"]=1;
  6064. pos=$recv(pos).__plus((1));
  6065. $ctx2.sendIdx["+"]=1;
  6066. value=$recv(value).__plus(step);
  6067. $ctx2.sendIdx["+"]=2;
  6068. return value;
  6069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  6070. }));
  6071. $ctx1.sendIdx["whileTrue:"]=1;
  6072. } else {
  6073. $recv((function(){
  6074. return $core.withContext(function($ctx2) {
  6075. return $recv(value).__lt_eq(stop);
  6076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  6077. }))._whileTrue_((function(){
  6078. return $core.withContext(function($ctx2) {
  6079. $recv(array)._at_put_(pos,value);
  6080. pos=$recv(pos).__plus((1));
  6081. $ctx2.sendIdx["+"]=3;
  6082. value=$recv(value).__plus(step);
  6083. return value;
  6084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6085. }));
  6086. }
  6087. return array;
  6088. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  6089. },
  6090. args: ["stop", "step"],
  6091. 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",
  6092. referencedClasses: ["Array"],
  6093. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  6094. }),
  6095. $globals.Number);
  6096. $core.addMethod(
  6097. $core.method({
  6098. selector: "to:by:do:",
  6099. protocol: "enumerating",
  6100. fn: function (stop,step,aBlock){
  6101. var self=this,$self=this;
  6102. var value;
  6103. return $core.withContext(function($ctx1) {
  6104. var $1,$2;
  6105. value=self;
  6106. $1=$recv(step).__eq((0));
  6107. if($core.assert($1)){
  6108. $self._error_("step must be non-zero");
  6109. }
  6110. $2=$recv(step).__lt((0));
  6111. if($core.assert($2)){
  6112. $recv((function(){
  6113. return $core.withContext(function($ctx2) {
  6114. return $recv(value).__gt_eq(stop);
  6115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  6116. }))._whileTrue_((function(){
  6117. return $core.withContext(function($ctx2) {
  6118. $recv(aBlock)._value_(value);
  6119. $ctx2.sendIdx["value:"]=1;
  6120. value=$recv(value).__plus(step);
  6121. $ctx2.sendIdx["+"]=1;
  6122. return value;
  6123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  6124. }));
  6125. $ctx1.sendIdx["whileTrue:"]=1;
  6126. } else {
  6127. $recv((function(){
  6128. return $core.withContext(function($ctx2) {
  6129. return $recv(value).__lt_eq(stop);
  6130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  6131. }))._whileTrue_((function(){
  6132. return $core.withContext(function($ctx2) {
  6133. $recv(aBlock)._value_(value);
  6134. value=$recv(value).__plus(step);
  6135. return value;
  6136. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6137. }));
  6138. }
  6139. return self;
  6140. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  6141. },
  6142. args: ["stop", "step", "aBlock"],
  6143. 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 ]]",
  6144. referencedClasses: [],
  6145. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  6146. }),
  6147. $globals.Number);
  6148. $core.addMethod(
  6149. $core.method({
  6150. selector: "to:do:",
  6151. protocol: "enumerating",
  6152. fn: function (stop,aBlock){
  6153. var self=this,$self=this;
  6154. var nextValue;
  6155. return $core.withContext(function($ctx1) {
  6156. nextValue=self;
  6157. $recv((function(){
  6158. return $core.withContext(function($ctx2) {
  6159. return $recv(nextValue).__lt_eq(stop);
  6160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6161. }))._whileTrue_((function(){
  6162. return $core.withContext(function($ctx2) {
  6163. $recv(aBlock)._value_(nextValue);
  6164. nextValue=$recv(nextValue).__plus((1));
  6165. return nextValue;
  6166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6167. }));
  6168. return self;
  6169. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  6170. },
  6171. args: ["stop", "aBlock"],
  6172. 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 ]",
  6173. referencedClasses: [],
  6174. messageSends: ["whileTrue:", "<=", "value:", "+"]
  6175. }),
  6176. $globals.Number);
  6177. $core.addMethod(
  6178. $core.method({
  6179. selector: "truncated",
  6180. protocol: "converting",
  6181. fn: function (){
  6182. var self=this,$self=this;
  6183. return $core.withContext(function($ctx1) {
  6184. if(self >= 0) {
  6185. return Math.floor(self);
  6186. } else {
  6187. return Math.floor(self * (-1)) * (-1);
  6188. };
  6189. ;
  6190. return self;
  6191. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  6192. },
  6193. args: [],
  6194. 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'>",
  6195. referencedClasses: [],
  6196. messageSends: []
  6197. }),
  6198. $globals.Number);
  6199. $core.addMethod(
  6200. $core.method({
  6201. selector: "|",
  6202. protocol: "converting",
  6203. fn: function (aNumber){
  6204. var self=this,$self=this;
  6205. return $core.withContext(function($ctx1) {
  6206. return self | aNumber;
  6207. return self;
  6208. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  6209. },
  6210. args: ["aNumber"],
  6211. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  6212. referencedClasses: [],
  6213. messageSends: []
  6214. }),
  6215. $globals.Number);
  6216. $core.addMethod(
  6217. $core.method({
  6218. selector: "classTag",
  6219. protocol: "accessing",
  6220. fn: function (){
  6221. var self=this,$self=this;
  6222. return "magnitude";
  6223. },
  6224. args: [],
  6225. 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'",
  6226. referencedClasses: [],
  6227. messageSends: []
  6228. }),
  6229. $globals.Number.a$cls);
  6230. $core.addMethod(
  6231. $core.method({
  6232. selector: "e",
  6233. protocol: "instance creation",
  6234. fn: function (){
  6235. var self=this,$self=this;
  6236. return $core.withContext(function($ctx1) {
  6237. return Math.E;;
  6238. return self;
  6239. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.a$cls)});
  6240. },
  6241. args: [],
  6242. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  6243. referencedClasses: [],
  6244. messageSends: []
  6245. }),
  6246. $globals.Number.a$cls);
  6247. $core.addMethod(
  6248. $core.method({
  6249. selector: "pi",
  6250. protocol: "instance creation",
  6251. fn: function (){
  6252. var self=this,$self=this;
  6253. return $core.withContext(function($ctx1) {
  6254. return Math.PI;
  6255. return self;
  6256. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.a$cls)});
  6257. },
  6258. args: [],
  6259. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  6260. referencedClasses: [],
  6261. messageSends: []
  6262. }),
  6263. $globals.Number.a$cls);
  6264. $core.addMethod(
  6265. $core.method({
  6266. selector: "radiansPerDegree",
  6267. protocol: "instance creation",
  6268. fn: function (){
  6269. var self=this,$self=this;
  6270. return $core.withContext(function($ctx1) {
  6271. return $recv($self._pi()).__slash((180));
  6272. }, function($ctx1) {$ctx1.fill(self,"radiansPerDegree",{},$globals.Number.a$cls)});
  6273. },
  6274. args: [],
  6275. source: "radiansPerDegree\x0a\x09^ (self pi) / 180",
  6276. referencedClasses: [],
  6277. messageSends: ["/", "pi"]
  6278. }),
  6279. $globals.Number.a$cls);
  6280. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  6281. $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";
  6282. $core.addMethod(
  6283. $core.method({
  6284. selector: "*",
  6285. protocol: "arithmetic",
  6286. fn: function (aPoint){
  6287. var self=this,$self=this;
  6288. return $core.withContext(function($ctx1) {
  6289. var $2,$4,$3,$1,$6,$5;
  6290. $2=$self._x();
  6291. $ctx1.sendIdx["x"]=1;
  6292. $4=$recv(aPoint)._asPoint();
  6293. $ctx1.sendIdx["asPoint"]=1;
  6294. $3=$recv($4)._x();
  6295. $1=$recv($2).__star($3);
  6296. $ctx1.sendIdx["*"]=1;
  6297. $6=$self._y();
  6298. $ctx1.sendIdx["y"]=1;
  6299. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  6300. return $recv($globals.Point)._x_y_($1,$5);
  6301. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  6302. },
  6303. args: ["aPoint"],
  6304. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  6305. referencedClasses: ["Point"],
  6306. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  6307. }),
  6308. $globals.Point);
  6309. $core.addMethod(
  6310. $core.method({
  6311. selector: "+",
  6312. protocol: "arithmetic",
  6313. fn: function (aPoint){
  6314. var self=this,$self=this;
  6315. return $core.withContext(function($ctx1) {
  6316. var $2,$4,$3,$1,$6,$5;
  6317. $2=$self._x();
  6318. $ctx1.sendIdx["x"]=1;
  6319. $4=$recv(aPoint)._asPoint();
  6320. $ctx1.sendIdx["asPoint"]=1;
  6321. $3=$recv($4)._x();
  6322. $1=$recv($2).__plus($3);
  6323. $ctx1.sendIdx["+"]=1;
  6324. $6=$self._y();
  6325. $ctx1.sendIdx["y"]=1;
  6326. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  6327. return $recv($globals.Point)._x_y_($1,$5);
  6328. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  6329. },
  6330. args: ["aPoint"],
  6331. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  6332. referencedClasses: ["Point"],
  6333. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  6334. }),
  6335. $globals.Point);
  6336. $core.addMethod(
  6337. $core.method({
  6338. selector: "-",
  6339. protocol: "arithmetic",
  6340. fn: function (aPoint){
  6341. var self=this,$self=this;
  6342. return $core.withContext(function($ctx1) {
  6343. var $2,$4,$3,$1,$6,$5;
  6344. $2=$self._x();
  6345. $ctx1.sendIdx["x"]=1;
  6346. $4=$recv(aPoint)._asPoint();
  6347. $ctx1.sendIdx["asPoint"]=1;
  6348. $3=$recv($4)._x();
  6349. $1=$recv($2).__minus($3);
  6350. $ctx1.sendIdx["-"]=1;
  6351. $6=$self._y();
  6352. $ctx1.sendIdx["y"]=1;
  6353. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  6354. return $recv($globals.Point)._x_y_($1,$5);
  6355. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  6356. },
  6357. args: ["aPoint"],
  6358. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  6359. referencedClasses: ["Point"],
  6360. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  6361. }),
  6362. $globals.Point);
  6363. $core.addMethod(
  6364. $core.method({
  6365. selector: "/",
  6366. protocol: "arithmetic",
  6367. fn: function (aPoint){
  6368. var self=this,$self=this;
  6369. return $core.withContext(function($ctx1) {
  6370. var $2,$4,$3,$1,$6,$5;
  6371. $2=$self._x();
  6372. $ctx1.sendIdx["x"]=1;
  6373. $4=$recv(aPoint)._asPoint();
  6374. $ctx1.sendIdx["asPoint"]=1;
  6375. $3=$recv($4)._x();
  6376. $1=$recv($2).__slash($3);
  6377. $ctx1.sendIdx["/"]=1;
  6378. $6=$self._y();
  6379. $ctx1.sendIdx["y"]=1;
  6380. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  6381. return $recv($globals.Point)._x_y_($1,$5);
  6382. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  6383. },
  6384. args: ["aPoint"],
  6385. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6386. referencedClasses: ["Point"],
  6387. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  6388. }),
  6389. $globals.Point);
  6390. $core.addMethod(
  6391. $core.method({
  6392. selector: "<",
  6393. protocol: "comparing",
  6394. fn: function (aPoint){
  6395. var self=this,$self=this;
  6396. return $core.withContext(function($ctx1) {
  6397. var $2,$1,$3;
  6398. $2=$self._x();
  6399. $ctx1.sendIdx["x"]=1;
  6400. $1=$recv($2).__lt($recv(aPoint)._x());
  6401. $ctx1.sendIdx["<"]=1;
  6402. return $recv($1)._and_((function(){
  6403. return $core.withContext(function($ctx2) {
  6404. $3=$self._y();
  6405. $ctx2.sendIdx["y"]=1;
  6406. return $recv($3).__lt($recv(aPoint)._y());
  6407. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6408. }));
  6409. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  6410. },
  6411. args: ["aPoint"],
  6412. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  6413. referencedClasses: [],
  6414. messageSends: ["and:", "<", "x", "y"]
  6415. }),
  6416. $globals.Point);
  6417. $core.addMethod(
  6418. $core.method({
  6419. selector: "<=",
  6420. protocol: "comparing",
  6421. fn: function (aPoint){
  6422. var self=this,$self=this;
  6423. return $core.withContext(function($ctx1) {
  6424. var $2,$1,$3;
  6425. $2=$self._x();
  6426. $ctx1.sendIdx["x"]=1;
  6427. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  6428. $ctx1.sendIdx["<="]=1;
  6429. return $recv($1)._and_((function(){
  6430. return $core.withContext(function($ctx2) {
  6431. $3=$self._y();
  6432. $ctx2.sendIdx["y"]=1;
  6433. return $recv($3).__lt_eq($recv(aPoint)._y());
  6434. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6435. }));
  6436. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  6437. },
  6438. args: ["aPoint"],
  6439. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6440. referencedClasses: [],
  6441. messageSends: ["and:", "<=", "x", "y"]
  6442. }),
  6443. $globals.Point);
  6444. $core.addMethod(
  6445. $core.method({
  6446. selector: "=",
  6447. protocol: "comparing",
  6448. fn: function (aPoint){
  6449. var self=this,$self=this;
  6450. return $core.withContext(function($ctx1) {
  6451. var $2,$1,$4,$3,$6,$5;
  6452. $2=$recv(aPoint)._class();
  6453. $ctx1.sendIdx["class"]=1;
  6454. $1=$recv($2).__eq($self._class());
  6455. $ctx1.sendIdx["="]=1;
  6456. return $recv($1)._and_((function(){
  6457. return $core.withContext(function($ctx2) {
  6458. $4=$recv(aPoint)._x();
  6459. $ctx2.sendIdx["x"]=1;
  6460. $3=$recv($4).__eq($self._x());
  6461. $ctx2.sendIdx["="]=2;
  6462. $6=$recv(aPoint)._y();
  6463. $ctx2.sendIdx["y"]=1;
  6464. $5=$recv($6).__eq($self._y());
  6465. return $recv($3).__and($5);
  6466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6467. }));
  6468. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  6469. },
  6470. args: ["aPoint"],
  6471. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6472. referencedClasses: [],
  6473. messageSends: ["and:", "=", "class", "&", "x", "y"]
  6474. }),
  6475. $globals.Point);
  6476. $core.addMethod(
  6477. $core.method({
  6478. selector: ">",
  6479. protocol: "comparing",
  6480. fn: function (aPoint){
  6481. var self=this,$self=this;
  6482. return $core.withContext(function($ctx1) {
  6483. var $2,$1,$3;
  6484. $2=$self._x();
  6485. $ctx1.sendIdx["x"]=1;
  6486. $1=$recv($2).__gt($recv(aPoint)._x());
  6487. $ctx1.sendIdx[">"]=1;
  6488. return $recv($1)._and_((function(){
  6489. return $core.withContext(function($ctx2) {
  6490. $3=$self._y();
  6491. $ctx2.sendIdx["y"]=1;
  6492. return $recv($3).__gt($recv(aPoint)._y());
  6493. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6494. }));
  6495. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  6496. },
  6497. args: ["aPoint"],
  6498. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  6499. referencedClasses: [],
  6500. messageSends: ["and:", ">", "x", "y"]
  6501. }),
  6502. $globals.Point);
  6503. $core.addMethod(
  6504. $core.method({
  6505. selector: ">=",
  6506. protocol: "comparing",
  6507. fn: function (aPoint){
  6508. var self=this,$self=this;
  6509. return $core.withContext(function($ctx1) {
  6510. var $2,$1,$3;
  6511. $2=$self._x();
  6512. $ctx1.sendIdx["x"]=1;
  6513. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  6514. $ctx1.sendIdx[">="]=1;
  6515. return $recv($1)._and_((function(){
  6516. return $core.withContext(function($ctx2) {
  6517. $3=$self._y();
  6518. $ctx2.sendIdx["y"]=1;
  6519. return $recv($3).__gt_eq($recv(aPoint)._y());
  6520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6521. }));
  6522. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  6523. },
  6524. args: ["aPoint"],
  6525. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6526. referencedClasses: [],
  6527. messageSends: ["and:", ">=", "x", "y"]
  6528. }),
  6529. $globals.Point);
  6530. $core.addMethod(
  6531. $core.method({
  6532. selector: "angle",
  6533. protocol: "geometry",
  6534. fn: function (){
  6535. var self=this,$self=this;
  6536. return $core.withContext(function($ctx1) {
  6537. return $recv($self._y())._arcTan_($self._x());
  6538. }, function($ctx1) {$ctx1.fill(self,"angle",{},$globals.Point)});
  6539. },
  6540. args: [],
  6541. source: "angle\x0a\x09^ self y arcTan: self x",
  6542. referencedClasses: [],
  6543. messageSends: ["arcTan:", "y", "x"]
  6544. }),
  6545. $globals.Point);
  6546. $core.addMethod(
  6547. $core.method({
  6548. selector: "asPoint",
  6549. protocol: "converting",
  6550. fn: function (){
  6551. var self=this,$self=this;
  6552. return self;
  6553. },
  6554. args: [],
  6555. source: "asPoint\x0a\x09^ self",
  6556. referencedClasses: [],
  6557. messageSends: []
  6558. }),
  6559. $globals.Point);
  6560. $core.addMethod(
  6561. $core.method({
  6562. selector: "corner:",
  6563. protocol: "rectangle creation",
  6564. fn: function (aPoint){
  6565. var self=this,$self=this;
  6566. return $core.withContext(function($ctx1) {
  6567. return $recv($globals.Rectangle)._origin_corner_(self,aPoint);
  6568. }, function($ctx1) {$ctx1.fill(self,"corner:",{aPoint:aPoint},$globals.Point)});
  6569. },
  6570. args: ["aPoint"],
  6571. source: "corner: aPoint\x0a\x09^ Rectangle origin: self corner: aPoint",
  6572. referencedClasses: ["Rectangle"],
  6573. messageSends: ["origin:corner:"]
  6574. }),
  6575. $globals.Point);
  6576. $core.addMethod(
  6577. $core.method({
  6578. selector: "dist:",
  6579. protocol: "transforming",
  6580. fn: function (aPoint){
  6581. var self=this,$self=this;
  6582. var dx,dy;
  6583. return $core.withContext(function($ctx1) {
  6584. var $2,$1;
  6585. dx=$recv($recv(aPoint)._x()).__minus($self.x);
  6586. $ctx1.sendIdx["-"]=1;
  6587. dy=$recv($recv(aPoint)._y()).__minus($self.y);
  6588. $2=$recv(dx).__star(dx);
  6589. $ctx1.sendIdx["*"]=1;
  6590. $1=$recv($2).__plus($recv(dy).__star(dy));
  6591. return $recv($1)._sqrt();
  6592. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  6593. },
  6594. args: ["aPoint"],
  6595. 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",
  6596. referencedClasses: [],
  6597. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6598. }),
  6599. $globals.Point);
  6600. $core.addMethod(
  6601. $core.method({
  6602. selector: "dotProduct:",
  6603. protocol: "point functions",
  6604. fn: function (aPoint){
  6605. var self=this,$self=this;
  6606. return $core.withContext(function($ctx1) {
  6607. var $1;
  6608. $1=$recv($self.x).__star($recv(aPoint)._x());
  6609. $ctx1.sendIdx["*"]=1;
  6610. return $recv($1).__plus($recv($self.y).__star($recv(aPoint)._y()));
  6611. }, function($ctx1) {$ctx1.fill(self,"dotProduct:",{aPoint:aPoint},$globals.Point)});
  6612. },
  6613. args: ["aPoint"],
  6614. source: "dotProduct: aPoint\x0a\x09^ (x * aPoint x) + (y * aPoint y)",
  6615. referencedClasses: [],
  6616. messageSends: ["+", "*", "x", "y"]
  6617. }),
  6618. $globals.Point);
  6619. $core.addMethod(
  6620. $core.method({
  6621. selector: "extent:",
  6622. protocol: "rectangle creation",
  6623. fn: function (aPoint){
  6624. var self=this,$self=this;
  6625. return $core.withContext(function($ctx1) {
  6626. return $recv($globals.Rectangle)._origin_extent_(self,aPoint);
  6627. }, function($ctx1) {$ctx1.fill(self,"extent:",{aPoint:aPoint},$globals.Point)});
  6628. },
  6629. args: ["aPoint"],
  6630. source: "extent: aPoint\x0a\x09^ Rectangle origin: self extent: aPoint",
  6631. referencedClasses: ["Rectangle"],
  6632. messageSends: ["origin:extent:"]
  6633. }),
  6634. $globals.Point);
  6635. $core.addMethod(
  6636. $core.method({
  6637. selector: "normal",
  6638. protocol: "point functions",
  6639. fn: function (){
  6640. var self=this,$self=this;
  6641. var n,d;
  6642. return $core.withContext(function($ctx1) {
  6643. var $4,$3,$6,$5,$2,$1;
  6644. n=$recv($recv($self.y)._negated()).__at($self.x);
  6645. $ctx1.sendIdx["@"]=1;
  6646. $4=$recv(n)._x();
  6647. $ctx1.sendIdx["x"]=1;
  6648. $3=$recv($4).__star($recv(n)._x());
  6649. $ctx1.sendIdx["*"]=1;
  6650. $6=$recv(n)._y();
  6651. $ctx1.sendIdx["y"]=1;
  6652. $5=$recv($6).__star($recv(n)._y());
  6653. d=$recv($3).__plus($5);
  6654. $2=d;
  6655. $1=$recv($2).__eq((0));
  6656. if($core.assert($1)){
  6657. return (-1).__at((0));
  6658. }
  6659. return $recv(n).__slash($recv(d)._sqrt());
  6660. }, function($ctx1) {$ctx1.fill(self,"normal",{n:n,d:d},$globals.Point)});
  6661. },
  6662. args: [],
  6663. 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",
  6664. referencedClasses: [],
  6665. messageSends: ["@", "negated", "ifTrue:", "=", "+", "*", "x", "y", "/", "sqrt"]
  6666. }),
  6667. $globals.Point);
  6668. $core.addMethod(
  6669. $core.method({
  6670. selector: "normalized",
  6671. protocol: "point functions",
  6672. fn: function (){
  6673. var self=this,$self=this;
  6674. var r;
  6675. return $core.withContext(function($ctx1) {
  6676. var $1,$2,$3;
  6677. r=$self._r();
  6678. $1=$recv(r).__eq((0));
  6679. if($core.assert($1)){
  6680. $2=$recv($globals.Point)._x_y_((0),(0));
  6681. $ctx1.sendIdx["x:y:"]=1;
  6682. return $2;
  6683. } else {
  6684. $3=$recv($self.x).__slash(r);
  6685. $ctx1.sendIdx["/"]=1;
  6686. return $recv($globals.Point)._x_y_($3,$recv($self.y).__slash(r));
  6687. }
  6688. return self;
  6689. }, function($ctx1) {$ctx1.fill(self,"normalized",{r:r},$globals.Point)});
  6690. },
  6691. args: [],
  6692. 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 ]",
  6693. referencedClasses: ["Point"],
  6694. messageSends: ["r", "ifTrue:ifFalse:", "=", "x:y:", "/"]
  6695. }),
  6696. $globals.Point);
  6697. $core.addMethod(
  6698. $core.method({
  6699. selector: "printOn:",
  6700. protocol: "printing",
  6701. fn: function (aStream){
  6702. var self=this,$self=this;
  6703. return $core.withContext(function($ctx1) {
  6704. var $1;
  6705. $recv($self.x)._printOn_(aStream);
  6706. $ctx1.sendIdx["printOn:"]=1;
  6707. $recv(aStream)._nextPutAll_("@");
  6708. $1=$recv($recv($self.y)._notNil())._and_((function(){
  6709. return $core.withContext(function($ctx2) {
  6710. return $recv($self.y)._negative();
  6711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6712. }));
  6713. if($core.assert($1)){
  6714. $recv(aStream)._space();
  6715. }
  6716. $recv($self.y)._printOn_(aStream);
  6717. return self;
  6718. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  6719. },
  6720. args: ["aStream"],
  6721. 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",
  6722. referencedClasses: [],
  6723. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6724. }),
  6725. $globals.Point);
  6726. $core.addMethod(
  6727. $core.method({
  6728. selector: "r",
  6729. protocol: "polar coordinates",
  6730. fn: function (){
  6731. var self=this,$self=this;
  6732. return $core.withContext(function($ctx1) {
  6733. var $2,$1;
  6734. $2=$recv($self.x).__star($self.x);
  6735. $ctx1.sendIdx["*"]=1;
  6736. $1=$recv($2).__plus($recv($self.y).__star($self.y));
  6737. return $recv($1)._sqrt();
  6738. }, function($ctx1) {$ctx1.fill(self,"r",{},$globals.Point)});
  6739. },
  6740. args: [],
  6741. source: "r\x0a\x09^ ((x * x) + (y * y)) sqrt",
  6742. referencedClasses: [],
  6743. messageSends: ["sqrt", "+", "*"]
  6744. }),
  6745. $globals.Point);
  6746. $core.addMethod(
  6747. $core.method({
  6748. selector: "rectangle:",
  6749. protocol: "rectangle creation",
  6750. fn: function (aPoint){
  6751. var self=this,$self=this;
  6752. return $core.withContext(function($ctx1) {
  6753. return $recv($globals.Rectangle)._point_point_(self,aPoint);
  6754. }, function($ctx1) {$ctx1.fill(self,"rectangle:",{aPoint:aPoint},$globals.Point)});
  6755. },
  6756. args: ["aPoint"],
  6757. source: "rectangle: aPoint\x0a\x09^ Rectangle point: self point: aPoint",
  6758. referencedClasses: ["Rectangle"],
  6759. messageSends: ["point:point:"]
  6760. }),
  6761. $globals.Point);
  6762. $core.addMethod(
  6763. $core.method({
  6764. selector: "translateBy:",
  6765. protocol: "transforming",
  6766. fn: function (delta){
  6767. var self=this,$self=this;
  6768. return $core.withContext(function($ctx1) {
  6769. var $1;
  6770. $1=$recv($recv(delta)._x()).__plus($self.x);
  6771. $ctx1.sendIdx["+"]=1;
  6772. return $recv($1).__at($recv($recv(delta)._y()).__plus($self.y));
  6773. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  6774. },
  6775. args: ["delta"],
  6776. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6777. referencedClasses: [],
  6778. messageSends: ["@", "+", "x", "y"]
  6779. }),
  6780. $globals.Point);
  6781. $core.addMethod(
  6782. $core.method({
  6783. selector: "x",
  6784. protocol: "accessing",
  6785. fn: function (){
  6786. var self=this,$self=this;
  6787. return $self.x;
  6788. },
  6789. args: [],
  6790. source: "x\x0a\x09^ x",
  6791. referencedClasses: [],
  6792. messageSends: []
  6793. }),
  6794. $globals.Point);
  6795. $core.addMethod(
  6796. $core.method({
  6797. selector: "x:",
  6798. protocol: "accessing",
  6799. fn: function (aNumber){
  6800. var self=this,$self=this;
  6801. $self.x=aNumber;
  6802. return self;
  6803. },
  6804. args: ["aNumber"],
  6805. source: "x: aNumber\x0a\x09x := aNumber",
  6806. referencedClasses: [],
  6807. messageSends: []
  6808. }),
  6809. $globals.Point);
  6810. $core.addMethod(
  6811. $core.method({
  6812. selector: "y",
  6813. protocol: "accessing",
  6814. fn: function (){
  6815. var self=this,$self=this;
  6816. return $self.y;
  6817. },
  6818. args: [],
  6819. source: "y\x0a\x09^ y",
  6820. referencedClasses: [],
  6821. messageSends: []
  6822. }),
  6823. $globals.Point);
  6824. $core.addMethod(
  6825. $core.method({
  6826. selector: "y:",
  6827. protocol: "accessing",
  6828. fn: function (aNumber){
  6829. var self=this,$self=this;
  6830. $self.y=aNumber;
  6831. return self;
  6832. },
  6833. args: ["aNumber"],
  6834. source: "y: aNumber\x0a\x09y := aNumber",
  6835. referencedClasses: [],
  6836. messageSends: []
  6837. }),
  6838. $globals.Point);
  6839. $core.addMethod(
  6840. $core.method({
  6841. selector: "classTag",
  6842. protocol: "accessing",
  6843. fn: function (){
  6844. var self=this,$self=this;
  6845. return "magnitude";
  6846. },
  6847. args: [],
  6848. 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'",
  6849. referencedClasses: [],
  6850. messageSends: []
  6851. }),
  6852. $globals.Point.a$cls);
  6853. $core.addMethod(
  6854. $core.method({
  6855. selector: "x:y:",
  6856. protocol: "instance creation",
  6857. fn: function (aNumber,anotherNumber){
  6858. var self=this,$self=this;
  6859. return $core.withContext(function($ctx1) {
  6860. var $1;
  6861. $1=$self._new();
  6862. $recv($1)._x_(aNumber);
  6863. $recv($1)._y_(anotherNumber);
  6864. return $recv($1)._yourself();
  6865. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.a$cls)});
  6866. },
  6867. args: ["aNumber", "anotherNumber"],
  6868. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  6869. referencedClasses: [],
  6870. messageSends: ["x:", "new", "y:", "yourself"]
  6871. }),
  6872. $globals.Point.a$cls);
  6873. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  6874. $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'`.";
  6875. $core.addMethod(
  6876. $core.method({
  6877. selector: "next",
  6878. protocol: "accessing",
  6879. fn: function (){
  6880. var self=this,$self=this;
  6881. return $core.withContext(function($ctx1) {
  6882. return Math.random();
  6883. return self;
  6884. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  6885. },
  6886. args: [],
  6887. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  6888. referencedClasses: [],
  6889. messageSends: []
  6890. }),
  6891. $globals.Random);
  6892. $core.addMethod(
  6893. $core.method({
  6894. selector: "next:",
  6895. protocol: "accessing",
  6896. fn: function (anInteger){
  6897. var self=this,$self=this;
  6898. return $core.withContext(function($ctx1) {
  6899. return $recv((1)._to_(anInteger))._collect_((function(each){
  6900. return $core.withContext(function($ctx2) {
  6901. return $self._next();
  6902. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6903. }));
  6904. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  6905. },
  6906. args: ["anInteger"],
  6907. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  6908. referencedClasses: [],
  6909. messageSends: ["collect:", "to:", "next"]
  6910. }),
  6911. $globals.Random);
  6912. $core.addClass("Rectangle", $globals.Object, ["origin", "corner"], "Kernel-Objects");
  6913. $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.";
  6914. $core.addMethod(
  6915. $core.method({
  6916. selector: "=",
  6917. protocol: "testing",
  6918. fn: function (aRectangle){
  6919. var self=this,$self=this;
  6920. return $core.withContext(function($ctx1) {
  6921. var $1;
  6922. $1=$recv($self.origin).__eq($recv(aRectangle)._origin());
  6923. $ctx1.sendIdx["="]=1;
  6924. return $recv($1)._and_((function(){
  6925. return $core.withContext(function($ctx2) {
  6926. return $recv($self.corner).__eq($recv(aRectangle)._corner());
  6927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6928. }));
  6929. }, function($ctx1) {$ctx1.fill(self,"=",{aRectangle:aRectangle},$globals.Rectangle)});
  6930. },
  6931. args: ["aRectangle"],
  6932. source: "= aRectangle\x0a\x09^ origin = aRectangle origin and: [ corner = aRectangle corner ]",
  6933. referencedClasses: [],
  6934. messageSends: ["and:", "=", "origin", "corner"]
  6935. }),
  6936. $globals.Rectangle);
  6937. $core.addMethod(
  6938. $core.method({
  6939. selector: "containsPoint:",
  6940. protocol: "testing",
  6941. fn: function (aPoint){
  6942. var self=this,$self=this;
  6943. return $core.withContext(function($ctx1) {
  6944. return $recv($recv($self.origin).__lt_eq(aPoint))._and_((function(){
  6945. return $core.withContext(function($ctx2) {
  6946. return $recv($self.corner).__gt_eq(aPoint);
  6947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6948. }));
  6949. }, function($ctx1) {$ctx1.fill(self,"containsPoint:",{aPoint:aPoint},$globals.Rectangle)});
  6950. },
  6951. args: ["aPoint"],
  6952. source: "containsPoint: aPoint\x0a\x09^ origin <= aPoint and: [ corner >= aPoint ]",
  6953. referencedClasses: [],
  6954. messageSends: ["and:", "<=", ">="]
  6955. }),
  6956. $globals.Rectangle);
  6957. $core.addMethod(
  6958. $core.method({
  6959. selector: "containsRect:",
  6960. protocol: "testing",
  6961. fn: function (aRect){
  6962. var self=this,$self=this;
  6963. return $core.withContext(function($ctx1) {
  6964. return $recv($recv($recv(aRect)._origin()).__gt_eq($self.origin))._and_((function(){
  6965. return $core.withContext(function($ctx2) {
  6966. return $recv($recv(aRect)._corner()).__lt_eq($self.corner);
  6967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6968. }));
  6969. }, function($ctx1) {$ctx1.fill(self,"containsRect:",{aRect:aRect},$globals.Rectangle)});
  6970. },
  6971. args: ["aRect"],
  6972. source: "containsRect: aRect\x0a\x09^ aRect origin >= origin and: [ aRect corner <= corner ]",
  6973. referencedClasses: [],
  6974. messageSends: ["and:", ">=", "origin", "<=", "corner"]
  6975. }),
  6976. $globals.Rectangle);
  6977. $core.addMethod(
  6978. $core.method({
  6979. selector: "corner",
  6980. protocol: "accessing",
  6981. fn: function (){
  6982. var self=this,$self=this;
  6983. return $self.corner;
  6984. },
  6985. args: [],
  6986. source: "corner\x0a\x09^ corner",
  6987. referencedClasses: [],
  6988. messageSends: []
  6989. }),
  6990. $globals.Rectangle);
  6991. $core.addMethod(
  6992. $core.method({
  6993. selector: "origin",
  6994. protocol: "accessing",
  6995. fn: function (){
  6996. var self=this,$self=this;
  6997. return $self.origin;
  6998. },
  6999. args: [],
  7000. source: "origin\x0a\x09^ origin",
  7001. referencedClasses: [],
  7002. messageSends: []
  7003. }),
  7004. $globals.Rectangle);
  7005. $core.addMethod(
  7006. $core.method({
  7007. selector: "printOn:",
  7008. protocol: "testing",
  7009. fn: function (aStream){
  7010. var self=this,$self=this;
  7011. return $core.withContext(function($ctx1) {
  7012. $recv($self.origin)._printOn_(aStream);
  7013. $ctx1.sendIdx["printOn:"]=1;
  7014. $recv(aStream)._nextPutAll_(" corner: ");
  7015. $recv($self.corner)._printOn_(aStream);
  7016. return self;
  7017. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Rectangle)});
  7018. },
  7019. args: ["aStream"],
  7020. source: "printOn: aStream\x0a\x09origin printOn: aStream.\x0a\x09aStream nextPutAll: ' corner: '.\x0a\x09corner printOn: aStream.",
  7021. referencedClasses: [],
  7022. messageSends: ["printOn:", "nextPutAll:"]
  7023. }),
  7024. $globals.Rectangle);
  7025. $core.addMethod(
  7026. $core.method({
  7027. selector: "setPoint:point:",
  7028. protocol: "private",
  7029. fn: function (pt1,pt2){
  7030. var self=this,$self=this;
  7031. return $core.withContext(function($ctx1) {
  7032. var $2,$3,$1,$5,$6,$4,$8,$7,$10,$9;
  7033. $2=$recv(pt1)._x();
  7034. $ctx1.sendIdx["x"]=1;
  7035. $3=$recv(pt2)._x();
  7036. $ctx1.sendIdx["x"]=2;
  7037. $1=$recv($2)._min_($3);
  7038. $ctx1.sendIdx["min:"]=1;
  7039. $5=$recv(pt1)._y();
  7040. $ctx1.sendIdx["y"]=1;
  7041. $6=$recv(pt2)._y();
  7042. $ctx1.sendIdx["y"]=2;
  7043. $4=$recv($5)._min_($6);
  7044. $self.origin=$recv($1).__at($4);
  7045. $ctx1.sendIdx["@"]=1;
  7046. $8=$recv(pt1)._x();
  7047. $ctx1.sendIdx["x"]=3;
  7048. $7=$recv($8)._max_($recv(pt2)._x());
  7049. $ctx1.sendIdx["max:"]=1;
  7050. $10=$recv(pt1)._y();
  7051. $ctx1.sendIdx["y"]=3;
  7052. $9=$recv($10)._max_($recv(pt2)._y());
  7053. $self.corner=$recv($7).__at($9);
  7054. return self;
  7055. }, function($ctx1) {$ctx1.fill(self,"setPoint:point:",{pt1:pt1,pt2:pt2},$globals.Rectangle)});
  7056. },
  7057. args: ["pt1", "pt2"],
  7058. 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).",
  7059. referencedClasses: [],
  7060. messageSends: ["@", "min:", "x", "y", "max:"]
  7061. }),
  7062. $globals.Rectangle);
  7063. $core.addMethod(
  7064. $core.method({
  7065. selector: "origin:corner:",
  7066. protocol: "instance creation",
  7067. fn: function (anOrigin,aCorner){
  7068. var self=this,$self=this;
  7069. return $core.withContext(function($ctx1) {
  7070. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  7071. }, function($ctx1) {$ctx1.fill(self,"origin:corner:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  7072. },
  7073. args: ["anOrigin", "aCorner"],
  7074. source: "origin: anOrigin corner: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  7075. referencedClasses: [],
  7076. messageSends: ["setPoint:point:", "basicNew"]
  7077. }),
  7078. $globals.Rectangle.a$cls);
  7079. $core.addMethod(
  7080. $core.method({
  7081. selector: "origin:extent:",
  7082. protocol: "instance creation",
  7083. fn: function (anOrigin,anExtent){
  7084. var self=this,$self=this;
  7085. return $core.withContext(function($ctx1) {
  7086. return $recv($self._basicNew())._setPoint_point_(anOrigin,$recv(anOrigin).__plus(anExtent));
  7087. }, function($ctx1) {$ctx1.fill(self,"origin:extent:",{anOrigin:anOrigin,anExtent:anExtent},$globals.Rectangle.a$cls)});
  7088. },
  7089. args: ["anOrigin", "anExtent"],
  7090. source: "origin: anOrigin extent: anExtent\x0a\x09^ self basicNew setPoint: anOrigin point: anOrigin + anExtent.",
  7091. referencedClasses: [],
  7092. messageSends: ["setPoint:point:", "basicNew", "+"]
  7093. }),
  7094. $globals.Rectangle.a$cls);
  7095. $core.addMethod(
  7096. $core.method({
  7097. selector: "point:point:",
  7098. protocol: "instance creation",
  7099. fn: function (anOrigin,aCorner){
  7100. var self=this,$self=this;
  7101. return $core.withContext(function($ctx1) {
  7102. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  7103. }, function($ctx1) {$ctx1.fill(self,"point:point:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  7104. },
  7105. args: ["anOrigin", "aCorner"],
  7106. source: "point: anOrigin point: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  7107. referencedClasses: [],
  7108. messageSends: ["setPoint:point:", "basicNew"]
  7109. }),
  7110. $globals.Rectangle.a$cls);
  7111. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  7112. $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`.";
  7113. $core.addMethod(
  7114. $core.method({
  7115. selector: "==",
  7116. protocol: "testing",
  7117. fn: function (anObject){
  7118. var self=this,$self=this;
  7119. return $core.withContext(function($ctx1) {
  7120. return $recv(anObject)._isNil();
  7121. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.UndefinedObject)});
  7122. },
  7123. args: ["anObject"],
  7124. source: "== anObject\x0a\x09^ anObject isNil",
  7125. referencedClasses: [],
  7126. messageSends: ["isNil"]
  7127. }),
  7128. $globals.UndefinedObject);
  7129. $core.addMethod(
  7130. $core.method({
  7131. selector: "asJavaScriptObject",
  7132. protocol: "converting",
  7133. fn: function (){
  7134. var self=this,$self=this;
  7135. return null;
  7136. },
  7137. args: [],
  7138. source: "asJavaScriptObject\x0a\x09^ null",
  7139. referencedClasses: [],
  7140. messageSends: []
  7141. }),
  7142. $globals.UndefinedObject);
  7143. $core.addMethod(
  7144. $core.method({
  7145. selector: "deepCopy",
  7146. protocol: "copying",
  7147. fn: function (){
  7148. var self=this,$self=this;
  7149. return self;
  7150. },
  7151. args: [],
  7152. source: "deepCopy\x0a\x09^ self",
  7153. referencedClasses: [],
  7154. messageSends: []
  7155. }),
  7156. $globals.UndefinedObject);
  7157. $core.addMethod(
  7158. $core.method({
  7159. selector: "identityHash",
  7160. protocol: "accessing",
  7161. fn: function (){
  7162. var self=this,$self=this;
  7163. return "NIL";
  7164. },
  7165. args: [],
  7166. source: "identityHash\x0a\x09^ 'NIL'",
  7167. referencedClasses: [],
  7168. messageSends: []
  7169. }),
  7170. $globals.UndefinedObject);
  7171. $core.addMethod(
  7172. $core.method({
  7173. selector: "ifNil:",
  7174. protocol: "testing",
  7175. fn: function (aBlock){
  7176. var self=this,$self=this;
  7177. return $core.withContext(function($ctx1) {
  7178. return $self._ifNil_ifNotNil_(aBlock,(function(){
  7179. }));
  7180. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  7181. },
  7182. args: ["aBlock"],
  7183. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  7184. referencedClasses: [],
  7185. messageSends: ["ifNil:ifNotNil:"]
  7186. }),
  7187. $globals.UndefinedObject);
  7188. $core.addMethod(
  7189. $core.method({
  7190. selector: "ifNil:ifNotNil:",
  7191. protocol: "testing",
  7192. fn: function (aBlock,anotherBlock){
  7193. var self=this,$self=this;
  7194. return $core.withContext(function($ctx1) {
  7195. return $recv(aBlock)._value();
  7196. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7197. },
  7198. args: ["aBlock", "anotherBlock"],
  7199. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  7200. referencedClasses: [],
  7201. messageSends: ["value"]
  7202. }),
  7203. $globals.UndefinedObject);
  7204. $core.addMethod(
  7205. $core.method({
  7206. selector: "ifNotNil:",
  7207. protocol: "testing",
  7208. fn: function (aBlock){
  7209. var self=this,$self=this;
  7210. return self;
  7211. },
  7212. args: ["aBlock"],
  7213. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  7214. referencedClasses: [],
  7215. messageSends: []
  7216. }),
  7217. $globals.UndefinedObject);
  7218. $core.addMethod(
  7219. $core.method({
  7220. selector: "ifNotNil:ifNil:",
  7221. protocol: "testing",
  7222. fn: function (aBlock,anotherBlock){
  7223. var self=this,$self=this;
  7224. return $core.withContext(function($ctx1) {
  7225. return $recv(anotherBlock)._value();
  7226. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7227. },
  7228. args: ["aBlock", "anotherBlock"],
  7229. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  7230. referencedClasses: [],
  7231. messageSends: ["value"]
  7232. }),
  7233. $globals.UndefinedObject);
  7234. $core.addMethod(
  7235. $core.method({
  7236. selector: "isImmutable",
  7237. protocol: "testing",
  7238. fn: function (){
  7239. var self=this,$self=this;
  7240. return true;
  7241. },
  7242. args: [],
  7243. source: "isImmutable\x0a\x09^ true",
  7244. referencedClasses: [],
  7245. messageSends: []
  7246. }),
  7247. $globals.UndefinedObject);
  7248. $core.addMethod(
  7249. $core.method({
  7250. selector: "isNil",
  7251. protocol: "testing",
  7252. fn: function (){
  7253. var self=this,$self=this;
  7254. return true;
  7255. },
  7256. args: [],
  7257. source: "isNil\x0a\x09^ true",
  7258. referencedClasses: [],
  7259. messageSends: []
  7260. }),
  7261. $globals.UndefinedObject);
  7262. $core.addMethod(
  7263. $core.method({
  7264. selector: "notNil",
  7265. protocol: "testing",
  7266. fn: function (){
  7267. var self=this,$self=this;
  7268. return false;
  7269. },
  7270. args: [],
  7271. source: "notNil\x0a\x09^ false",
  7272. referencedClasses: [],
  7273. messageSends: []
  7274. }),
  7275. $globals.UndefinedObject);
  7276. $core.addMethod(
  7277. $core.method({
  7278. selector: "printOn:",
  7279. protocol: "printing",
  7280. fn: function (aStream){
  7281. var self=this,$self=this;
  7282. return $core.withContext(function($ctx1) {
  7283. $recv(aStream)._nextPutAll_("nil");
  7284. return self;
  7285. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  7286. },
  7287. args: ["aStream"],
  7288. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  7289. referencedClasses: [],
  7290. messageSends: ["nextPutAll:"]
  7291. }),
  7292. $globals.UndefinedObject);
  7293. $core.addMethod(
  7294. $core.method({
  7295. selector: "shallowCopy",
  7296. protocol: "copying",
  7297. fn: function (){
  7298. var self=this,$self=this;
  7299. return self;
  7300. },
  7301. args: [],
  7302. source: "shallowCopy\x0a\x09^ self",
  7303. referencedClasses: [],
  7304. messageSends: []
  7305. }),
  7306. $globals.UndefinedObject);
  7307. $core.addMethod(
  7308. $core.method({
  7309. selector: "value",
  7310. protocol: "evaluating",
  7311. fn: function (){
  7312. var self=this,$self=this;
  7313. return $core.withContext(function($ctx1) {
  7314. return null;
  7315. return self;
  7316. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.UndefinedObject)});
  7317. },
  7318. args: [],
  7319. source: "value\x0a\x09<inlineJS: 'return null'>",
  7320. referencedClasses: [],
  7321. messageSends: []
  7322. }),
  7323. $globals.UndefinedObject);
  7324. $core.addMethod(
  7325. $core.method({
  7326. selector: "new",
  7327. protocol: "instance creation",
  7328. fn: function (){
  7329. var self=this,$self=this;
  7330. return $core.withContext(function($ctx1) {
  7331. $self._error_("You cannot create new instances of UndefinedObject. Use nil");
  7332. return self;
  7333. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.a$cls)});
  7334. },
  7335. args: [],
  7336. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  7337. referencedClasses: [],
  7338. messageSends: ["error:"]
  7339. }),
  7340. $globals.UndefinedObject.a$cls);
  7341. $core.setTraitComposition([{trait: $globals.TSubclassable}], $globals.UndefinedObject);
  7342. });
  7343. define('amber/core/Kernel-Collections',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  7344. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7345. var $pkg = $core.addPackage("Kernel-Collections");
  7346. $pkg.innerEval = function (expr) { return eval(expr); };
  7347. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  7348. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7349. $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:`";
  7350. $core.addMethod(
  7351. $core.method({
  7352. selector: "=",
  7353. protocol: "comparing",
  7354. fn: function (anAssociation){
  7355. var self=this,$self=this;
  7356. return $core.withContext(function($ctx1) {
  7357. var $3,$2,$5,$4,$6,$1;
  7358. $3=$self._class();
  7359. $ctx1.sendIdx["class"]=1;
  7360. $2=$recv($3).__eq($recv(anAssociation)._class());
  7361. $ctx1.sendIdx["="]=1;
  7362. $1=$recv($2)._and_((function(){
  7363. return $core.withContext(function($ctx2) {
  7364. $5=$self._key();
  7365. $ctx2.sendIdx["key"]=1;
  7366. $4=$recv($5).__eq($recv(anAssociation)._key());
  7367. $ctx2.sendIdx["="]=2;
  7368. return $recv($4)._and_((function(){
  7369. return $core.withContext(function($ctx3) {
  7370. $6=$self._value();
  7371. $ctx3.sendIdx["value"]=1;
  7372. return $recv($6).__eq($recv(anAssociation)._value());
  7373. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7374. }));
  7375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7376. }));
  7377. $ctx1.sendIdx["and:"]=1;
  7378. return $1;
  7379. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  7380. },
  7381. args: ["anAssociation"],
  7382. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  7383. referencedClasses: [],
  7384. messageSends: ["and:", "=", "class", "key", "value"]
  7385. }),
  7386. $globals.Association);
  7387. $core.addMethod(
  7388. $core.method({
  7389. selector: "key",
  7390. protocol: "accessing",
  7391. fn: function (){
  7392. var self=this,$self=this;
  7393. return $self.key;
  7394. },
  7395. args: [],
  7396. source: "key\x0a\x09^ key",
  7397. referencedClasses: [],
  7398. messageSends: []
  7399. }),
  7400. $globals.Association);
  7401. $core.addMethod(
  7402. $core.method({
  7403. selector: "key:",
  7404. protocol: "accessing",
  7405. fn: function (aKey){
  7406. var self=this,$self=this;
  7407. $self.key=aKey;
  7408. return self;
  7409. },
  7410. args: ["aKey"],
  7411. source: "key: aKey\x0a\x09key := aKey",
  7412. referencedClasses: [],
  7413. messageSends: []
  7414. }),
  7415. $globals.Association);
  7416. $core.addMethod(
  7417. $core.method({
  7418. selector: "printOn:",
  7419. protocol: "printing",
  7420. fn: function (aStream){
  7421. var self=this,$self=this;
  7422. return $core.withContext(function($ctx1) {
  7423. $recv($self._key())._printOn_(aStream);
  7424. $ctx1.sendIdx["printOn:"]=1;
  7425. $recv(aStream)._nextPutAll_(" -> ");
  7426. $recv($self._value())._printOn_(aStream);
  7427. return self;
  7428. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  7429. },
  7430. args: ["aStream"],
  7431. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  7432. referencedClasses: [],
  7433. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  7434. }),
  7435. $globals.Association);
  7436. $core.addMethod(
  7437. $core.method({
  7438. selector: "value",
  7439. protocol: "accessing",
  7440. fn: function (){
  7441. var self=this,$self=this;
  7442. return $self.value;
  7443. },
  7444. args: [],
  7445. source: "value\x0a\x09^ value",
  7446. referencedClasses: [],
  7447. messageSends: []
  7448. }),
  7449. $globals.Association);
  7450. $core.addMethod(
  7451. $core.method({
  7452. selector: "value:",
  7453. protocol: "accessing",
  7454. fn: function (aValue){
  7455. var self=this,$self=this;
  7456. $self.value=aValue;
  7457. return self;
  7458. },
  7459. args: ["aValue"],
  7460. source: "value: aValue\x0a\x09value := aValue",
  7461. referencedClasses: [],
  7462. messageSends: []
  7463. }),
  7464. $globals.Association);
  7465. $core.addMethod(
  7466. $core.method({
  7467. selector: "key:value:",
  7468. protocol: "instance creation",
  7469. fn: function (aKey,aValue){
  7470. var self=this,$self=this;
  7471. return $core.withContext(function($ctx1) {
  7472. var $1;
  7473. $1=$self._new();
  7474. $recv($1)._key_(aKey);
  7475. $recv($1)._value_(aValue);
  7476. return $recv($1)._yourself();
  7477. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  7478. },
  7479. args: ["aKey", "aValue"],
  7480. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7481. referencedClasses: [],
  7482. messageSends: ["key:", "new", "value:", "yourself"]
  7483. }),
  7484. $globals.Association.a$cls);
  7485. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  7486. $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`.";
  7487. $core.addMethod(
  7488. $core.method({
  7489. selector: "bucketOfElement:",
  7490. protocol: "accessing",
  7491. fn: function (anObject){
  7492. var self=this,$self=this;
  7493. return $core.withContext(function($ctx1) {
  7494. var hash = $self.hashBlock(anObject);
  7495. if (!hash) return null;
  7496. var buckets = $self.buckets,
  7497. bucket = buckets[hash];
  7498. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  7499. return bucket;
  7500. ;
  7501. return self;
  7502. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  7503. },
  7504. args: ["anObject"],
  7505. 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'>",
  7506. referencedClasses: [],
  7507. messageSends: []
  7508. }),
  7509. $globals.BucketStore);
  7510. $core.addMethod(
  7511. $core.method({
  7512. selector: "do:",
  7513. protocol: "enumerating",
  7514. fn: function (aBlock){
  7515. var self=this,$self=this;
  7516. return $core.withContext(function($ctx1) {
  7517. var buckets = $self.buckets;
  7518. var keys = Object.keys(buckets);
  7519. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  7520. ;
  7521. return self;
  7522. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  7523. },
  7524. args: ["aBlock"],
  7525. 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'>",
  7526. referencedClasses: [],
  7527. messageSends: []
  7528. }),
  7529. $globals.BucketStore);
  7530. $core.addMethod(
  7531. $core.method({
  7532. selector: "hashBlock:",
  7533. protocol: "accessing",
  7534. fn: function (aBlock){
  7535. var self=this,$self=this;
  7536. $self.hashBlock=aBlock;
  7537. return self;
  7538. },
  7539. args: ["aBlock"],
  7540. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  7541. referencedClasses: [],
  7542. messageSends: []
  7543. }),
  7544. $globals.BucketStore);
  7545. $core.addMethod(
  7546. $core.method({
  7547. selector: "initialize",
  7548. protocol: "initialization",
  7549. fn: function (){
  7550. var self=this,$self=this;
  7551. return $core.withContext(function($ctx1) {
  7552. (
  7553. $ctx1.supercall = true,
  7554. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7555. $ctx1.supercall = false;
  7556. $self._removeAll();
  7557. return self;
  7558. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  7559. },
  7560. args: [],
  7561. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  7562. referencedClasses: [],
  7563. messageSends: ["initialize", "removeAll"]
  7564. }),
  7565. $globals.BucketStore);
  7566. $core.addMethod(
  7567. $core.method({
  7568. selector: "newBucket",
  7569. protocol: "private",
  7570. fn: function (){
  7571. var self=this,$self=this;
  7572. return $core.withContext(function($ctx1) {
  7573. $self._subclassResponsibility();
  7574. return self;
  7575. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  7576. },
  7577. args: [],
  7578. source: "newBucket\x0a\x09self subclassResponsibility",
  7579. referencedClasses: [],
  7580. messageSends: ["subclassResponsibility"]
  7581. }),
  7582. $globals.BucketStore);
  7583. $core.addMethod(
  7584. $core.method({
  7585. selector: "removeAll",
  7586. protocol: "adding/removing",
  7587. fn: function (){
  7588. var self=this,$self=this;
  7589. return $core.withContext(function($ctx1) {
  7590. $self.buckets = Object.create(null);;
  7591. return self;
  7592. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  7593. },
  7594. args: [],
  7595. source: "removeAll\x0a\x09<inlineJS: '$self.buckets = Object.create(null);'>",
  7596. referencedClasses: [],
  7597. messageSends: []
  7598. }),
  7599. $globals.BucketStore);
  7600. $core.addMethod(
  7601. $core.method({
  7602. selector: "hashBlock:",
  7603. protocol: "instance creation",
  7604. fn: function (aBlock){
  7605. var self=this,$self=this;
  7606. return $core.withContext(function($ctx1) {
  7607. var $1;
  7608. $1=$self._new();
  7609. $recv($1)._hashBlock_(aBlock);
  7610. return $recv($1)._yourself();
  7611. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  7612. },
  7613. args: ["aBlock"],
  7614. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  7615. referencedClasses: [],
  7616. messageSends: ["hashBlock:", "new", "yourself"]
  7617. }),
  7618. $globals.BucketStore.a$cls);
  7619. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  7620. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  7621. $core.addMethod(
  7622. $core.method({
  7623. selector: "newBucket",
  7624. protocol: "private",
  7625. fn: function (){
  7626. var self=this,$self=this;
  7627. return [];
  7628. },
  7629. args: [],
  7630. source: "newBucket\x0a\x09^ #()",
  7631. referencedClasses: [],
  7632. messageSends: []
  7633. }),
  7634. $globals.ArrayBucketStore);
  7635. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  7636. $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.";
  7637. $core.addMethod(
  7638. $core.method({
  7639. selector: ",",
  7640. protocol: "copying",
  7641. fn: function (aCollection){
  7642. var self=this,$self=this;
  7643. return $core.withContext(function($ctx1) {
  7644. var $1;
  7645. $1=$self._copy();
  7646. $recv($1)._addAll_(aCollection);
  7647. return $recv($1)._yourself();
  7648. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  7649. },
  7650. args: ["aCollection"],
  7651. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7652. referencedClasses: [],
  7653. messageSends: ["addAll:", "copy", "yourself"]
  7654. }),
  7655. $globals.Collection);
  7656. $core.addMethod(
  7657. $core.method({
  7658. selector: "add:",
  7659. protocol: "adding/removing",
  7660. fn: function (anObject){
  7661. var self=this,$self=this;
  7662. return $core.withContext(function($ctx1) {
  7663. $self._subclassResponsibility();
  7664. return self;
  7665. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  7666. },
  7667. args: ["anObject"],
  7668. source: "add: anObject\x0a\x09self subclassResponsibility",
  7669. referencedClasses: [],
  7670. messageSends: ["subclassResponsibility"]
  7671. }),
  7672. $globals.Collection);
  7673. $core.addMethod(
  7674. $core.method({
  7675. selector: "addAll:",
  7676. protocol: "adding/removing",
  7677. fn: function (aCollection){
  7678. var self=this,$self=this;
  7679. return $core.withContext(function($ctx1) {
  7680. $recv(aCollection)._do_((function(each){
  7681. return $core.withContext(function($ctx2) {
  7682. return $self._add_(each);
  7683. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7684. }));
  7685. return aCollection;
  7686. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  7687. },
  7688. args: ["aCollection"],
  7689. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  7690. referencedClasses: [],
  7691. messageSends: ["do:", "add:"]
  7692. }),
  7693. $globals.Collection);
  7694. $core.addMethod(
  7695. $core.method({
  7696. selector: "allSatisfy:",
  7697. protocol: "enumerating",
  7698. fn: function (aBlock){
  7699. var self=this,$self=this;
  7700. return $core.withContext(function($ctx1) {
  7701. var $1;
  7702. var $early={};
  7703. try {
  7704. $self._do_((function(each){
  7705. return $core.withContext(function($ctx2) {
  7706. $1=$recv(aBlock)._value_(each);
  7707. if(!$core.assert($1)){
  7708. throw $early=[false];
  7709. }
  7710. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7711. }));
  7712. return true;
  7713. }
  7714. catch(e) {if(e===$early)return e[0]; throw e}
  7715. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  7716. },
  7717. args: ["aBlock"],
  7718. 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",
  7719. referencedClasses: [],
  7720. messageSends: ["do:", "ifFalse:", "value:"]
  7721. }),
  7722. $globals.Collection);
  7723. $core.addMethod(
  7724. $core.method({
  7725. selector: "anyOne",
  7726. protocol: "accessing",
  7727. fn: function (){
  7728. var self=this,$self=this;
  7729. return $core.withContext(function($ctx1) {
  7730. var $early={};
  7731. try {
  7732. $self._ifEmpty_((function(){
  7733. return $core.withContext(function($ctx2) {
  7734. return $self._error_("Collection is empty");
  7735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7736. }));
  7737. $self._do_((function(each){
  7738. throw $early=[each];
  7739. }));
  7740. return self;
  7741. }
  7742. catch(e) {if(e===$early)return e[0]; throw e}
  7743. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  7744. },
  7745. args: [],
  7746. 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 ]",
  7747. referencedClasses: [],
  7748. messageSends: ["ifEmpty:", "error:", "do:"]
  7749. }),
  7750. $globals.Collection);
  7751. $core.addMethod(
  7752. $core.method({
  7753. selector: "anySatisfy:",
  7754. protocol: "enumerating",
  7755. fn: function (aBlock){
  7756. var self=this,$self=this;
  7757. return $core.withContext(function($ctx1) {
  7758. var $1;
  7759. var $early={};
  7760. try {
  7761. $self._do_((function(each){
  7762. return $core.withContext(function($ctx2) {
  7763. $1=$recv(aBlock)._value_(each);
  7764. if($core.assert($1)){
  7765. throw $early=[true];
  7766. }
  7767. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7768. }));
  7769. return false;
  7770. }
  7771. catch(e) {if(e===$early)return e[0]; throw e}
  7772. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  7773. },
  7774. args: ["aBlock"],
  7775. 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",
  7776. referencedClasses: [],
  7777. messageSends: ["do:", "ifTrue:", "value:"]
  7778. }),
  7779. $globals.Collection);
  7780. $core.addMethod(
  7781. $core.method({
  7782. selector: "asArray",
  7783. protocol: "converting",
  7784. fn: function (){
  7785. var self=this,$self=this;
  7786. return $core.withContext(function($ctx1) {
  7787. return $recv($globals.Array)._withAll_(self);
  7788. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  7789. },
  7790. args: [],
  7791. source: "asArray\x0a\x09^ Array withAll: self",
  7792. referencedClasses: ["Array"],
  7793. messageSends: ["withAll:"]
  7794. }),
  7795. $globals.Collection);
  7796. $core.addMethod(
  7797. $core.method({
  7798. selector: "asJavaScriptObject",
  7799. protocol: "converting",
  7800. fn: function (){
  7801. var self=this,$self=this;
  7802. return $core.withContext(function($ctx1) {
  7803. return $recv($self._asArray())._collect_((function(each){
  7804. return $core.withContext(function($ctx2) {
  7805. return $recv(each)._asJavaScriptObject();
  7806. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7807. }));
  7808. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  7809. },
  7810. args: [],
  7811. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  7812. referencedClasses: [],
  7813. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  7814. }),
  7815. $globals.Collection);
  7816. $core.addMethod(
  7817. $core.method({
  7818. selector: "asOrderedCollection",
  7819. protocol: "converting",
  7820. fn: function (){
  7821. var self=this,$self=this;
  7822. return $core.withContext(function($ctx1) {
  7823. return $self._asArray();
  7824. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  7825. },
  7826. args: [],
  7827. source: "asOrderedCollection\x0a\x09^ self asArray",
  7828. referencedClasses: [],
  7829. messageSends: ["asArray"]
  7830. }),
  7831. $globals.Collection);
  7832. $core.addMethod(
  7833. $core.method({
  7834. selector: "asSet",
  7835. protocol: "converting",
  7836. fn: function (){
  7837. var self=this,$self=this;
  7838. return $core.withContext(function($ctx1) {
  7839. return $recv($globals.Set)._withAll_(self);
  7840. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  7841. },
  7842. args: [],
  7843. source: "asSet\x0a\x09^ Set withAll: self",
  7844. referencedClasses: ["Set"],
  7845. messageSends: ["withAll:"]
  7846. }),
  7847. $globals.Collection);
  7848. $core.addMethod(
  7849. $core.method({
  7850. selector: "collect:",
  7851. protocol: "enumerating",
  7852. fn: function (aBlock){
  7853. var self=this,$self=this;
  7854. var stream;
  7855. return $core.withContext(function($ctx1) {
  7856. stream=$recv($recv($self._class())._new())._writeStream();
  7857. $self._do_((function(each){
  7858. return $core.withContext(function($ctx2) {
  7859. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  7860. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7861. }));
  7862. return $recv(stream)._contents();
  7863. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  7864. },
  7865. args: ["aBlock"],
  7866. 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",
  7867. referencedClasses: [],
  7868. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  7869. }),
  7870. $globals.Collection);
  7871. $core.addMethod(
  7872. $core.method({
  7873. selector: "copyWith:",
  7874. protocol: "copying",
  7875. fn: function (anObject){
  7876. var self=this,$self=this;
  7877. return $core.withContext(function($ctx1) {
  7878. var $1;
  7879. $1=$self._copy();
  7880. $recv($1)._add_(anObject);
  7881. return $recv($1)._yourself();
  7882. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  7883. },
  7884. args: ["anObject"],
  7885. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  7886. referencedClasses: [],
  7887. messageSends: ["add:", "copy", "yourself"]
  7888. }),
  7889. $globals.Collection);
  7890. $core.addMethod(
  7891. $core.method({
  7892. selector: "copyWithAll:",
  7893. protocol: "copying",
  7894. fn: function (aCollection){
  7895. var self=this,$self=this;
  7896. return $core.withContext(function($ctx1) {
  7897. $self._deprecatedAPI_("Use #, instead.");
  7898. return $self.__comma(aCollection);
  7899. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  7900. },
  7901. args: ["aCollection"],
  7902. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  7903. referencedClasses: [],
  7904. messageSends: ["deprecatedAPI:", ","]
  7905. }),
  7906. $globals.Collection);
  7907. $core.addMethod(
  7908. $core.method({
  7909. selector: "copyWithout:",
  7910. protocol: "copying",
  7911. fn: function (anObject){
  7912. var self=this,$self=this;
  7913. return $core.withContext(function($ctx1) {
  7914. return $self._reject_((function(each){
  7915. return $core.withContext(function($ctx2) {
  7916. return $recv(each).__eq(anObject);
  7917. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7918. }));
  7919. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  7920. },
  7921. args: ["anObject"],
  7922. 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 ]",
  7923. referencedClasses: [],
  7924. messageSends: ["reject:", "="]
  7925. }),
  7926. $globals.Collection);
  7927. $core.addMethod(
  7928. $core.method({
  7929. selector: "copyWithoutAll:",
  7930. protocol: "copying",
  7931. fn: function (aCollection){
  7932. var self=this,$self=this;
  7933. return $core.withContext(function($ctx1) {
  7934. return $self._reject_((function(each){
  7935. return $core.withContext(function($ctx2) {
  7936. return $recv(aCollection)._includes_(each);
  7937. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7938. }));
  7939. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  7940. },
  7941. args: ["aCollection"],
  7942. 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 ]",
  7943. referencedClasses: [],
  7944. messageSends: ["reject:", "includes:"]
  7945. }),
  7946. $globals.Collection);
  7947. $core.addMethod(
  7948. $core.method({
  7949. selector: "deepCopy",
  7950. protocol: "copying",
  7951. fn: function (){
  7952. var self=this,$self=this;
  7953. return $core.withContext(function($ctx1) {
  7954. return $self._collect_((function(each){
  7955. return $core.withContext(function($ctx2) {
  7956. return $recv(each)._deepCopy();
  7957. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7958. }));
  7959. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  7960. },
  7961. args: [],
  7962. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  7963. referencedClasses: [],
  7964. messageSends: ["collect:", "deepCopy"]
  7965. }),
  7966. $globals.Collection);
  7967. $core.addMethod(
  7968. $core.method({
  7969. selector: "detect:",
  7970. protocol: "enumerating",
  7971. fn: function (aBlock){
  7972. var self=this,$self=this;
  7973. return $core.withContext(function($ctx1) {
  7974. return $self._detect_ifNone_(aBlock,(function(){
  7975. return $core.withContext(function($ctx2) {
  7976. return $self._errorNotFound();
  7977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7978. }));
  7979. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  7980. },
  7981. args: ["aBlock"],
  7982. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  7983. referencedClasses: [],
  7984. messageSends: ["detect:ifNone:", "errorNotFound"]
  7985. }),
  7986. $globals.Collection);
  7987. $core.addMethod(
  7988. $core.method({
  7989. selector: "detect:ifNone:",
  7990. protocol: "enumerating",
  7991. fn: function (aBlock,anotherBlock){
  7992. var self=this,$self=this;
  7993. return $core.withContext(function($ctx1) {
  7994. var $1;
  7995. var $early={};
  7996. try {
  7997. $self._do_((function(each){
  7998. return $core.withContext(function($ctx2) {
  7999. $1=$recv(aBlock)._value_(each);
  8000. if($core.assert($1)){
  8001. throw $early=[each];
  8002. }
  8003. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8004. }));
  8005. return $recv(anotherBlock)._value();
  8006. }
  8007. catch(e) {if(e===$early)return e[0]; throw e}
  8008. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8009. },
  8010. args: ["aBlock", "anotherBlock"],
  8011. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  8012. referencedClasses: [],
  8013. messageSends: ["do:", "ifTrue:", "value:", "value"]
  8014. }),
  8015. $globals.Collection);
  8016. $core.addMethod(
  8017. $core.method({
  8018. selector: "do:",
  8019. protocol: "enumerating",
  8020. fn: function (aBlock){
  8021. var self=this,$self=this;
  8022. return $core.withContext(function($ctx1) {
  8023. $self._subclassResponsibility();
  8024. return self;
  8025. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  8026. },
  8027. args: ["aBlock"],
  8028. source: "do: aBlock\x0a\x09self subclassResponsibility",
  8029. referencedClasses: [],
  8030. messageSends: ["subclassResponsibility"]
  8031. }),
  8032. $globals.Collection);
  8033. $core.addMethod(
  8034. $core.method({
  8035. selector: "do:separatedBy:",
  8036. protocol: "enumerating",
  8037. fn: function (aBlock,anotherBlock){
  8038. var self=this,$self=this;
  8039. var actionBeforeElement;
  8040. return $core.withContext(function($ctx1) {
  8041. actionBeforeElement=(function(){
  8042. actionBeforeElement=anotherBlock;
  8043. return actionBeforeElement;
  8044. });
  8045. $self._do_((function(each){
  8046. return $core.withContext(function($ctx2) {
  8047. $recv(actionBeforeElement)._value();
  8048. return $recv(aBlock)._value_(each);
  8049. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  8050. }));
  8051. return self;
  8052. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  8053. },
  8054. args: ["aBlock", "anotherBlock"],
  8055. 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 ]",
  8056. referencedClasses: [],
  8057. messageSends: ["do:", "value", "value:"]
  8058. }),
  8059. $globals.Collection);
  8060. $core.addMethod(
  8061. $core.method({
  8062. selector: "errorNotFound",
  8063. protocol: "error handling",
  8064. fn: function (){
  8065. var self=this,$self=this;
  8066. return $core.withContext(function($ctx1) {
  8067. $self._error_("Object is not in the collection");
  8068. return self;
  8069. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  8070. },
  8071. args: [],
  8072. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  8073. referencedClasses: [],
  8074. messageSends: ["error:"]
  8075. }),
  8076. $globals.Collection);
  8077. $core.addMethod(
  8078. $core.method({
  8079. selector: "ifEmpty:",
  8080. protocol: "testing",
  8081. fn: function (aBlock){
  8082. var self=this,$self=this;
  8083. return $core.withContext(function($ctx1) {
  8084. var $1;
  8085. $1=$self._isEmpty();
  8086. if($core.assert($1)){
  8087. return $recv(aBlock)._value();
  8088. } else {
  8089. return self;
  8090. }
  8091. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  8092. },
  8093. args: ["aBlock"],
  8094. 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 ]",
  8095. referencedClasses: [],
  8096. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  8097. }),
  8098. $globals.Collection);
  8099. $core.addMethod(
  8100. $core.method({
  8101. selector: "ifEmpty:ifNotEmpty:",
  8102. protocol: "testing",
  8103. fn: function (aBlock,anotherBlock){
  8104. var self=this,$self=this;
  8105. return $core.withContext(function($ctx1) {
  8106. var $1;
  8107. $1=$self._isEmpty();
  8108. if($core.assert($1)){
  8109. return $recv(aBlock)._value();
  8110. } else {
  8111. return $recv(anotherBlock)._value_(self);
  8112. }
  8113. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8114. },
  8115. args: ["aBlock", "anotherBlock"],
  8116. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  8117. referencedClasses: [],
  8118. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  8119. }),
  8120. $globals.Collection);
  8121. $core.addMethod(
  8122. $core.method({
  8123. selector: "ifNotEmpty:",
  8124. protocol: "testing",
  8125. fn: function (aBlock){
  8126. var self=this,$self=this;
  8127. return $core.withContext(function($ctx1) {
  8128. var $1;
  8129. $1=$self._notEmpty();
  8130. if($core.assert($1)){
  8131. return $recv(aBlock)._value_(self);
  8132. } else {
  8133. return self;
  8134. }
  8135. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  8136. },
  8137. args: ["aBlock"],
  8138. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  8139. referencedClasses: [],
  8140. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  8141. }),
  8142. $globals.Collection);
  8143. $core.addMethod(
  8144. $core.method({
  8145. selector: "ifNotEmpty:ifEmpty:",
  8146. protocol: "testing",
  8147. fn: function (aBlock,anotherBlock){
  8148. var self=this,$self=this;
  8149. return $core.withContext(function($ctx1) {
  8150. var $1;
  8151. $1=$self._notEmpty();
  8152. if($core.assert($1)){
  8153. return $recv(aBlock)._value_(self);
  8154. } else {
  8155. return $recv(anotherBlock)._value();
  8156. }
  8157. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8158. },
  8159. args: ["aBlock", "anotherBlock"],
  8160. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  8161. referencedClasses: [],
  8162. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  8163. }),
  8164. $globals.Collection);
  8165. $core.addMethod(
  8166. $core.method({
  8167. selector: "includes:",
  8168. protocol: "testing",
  8169. fn: function (anObject){
  8170. var self=this,$self=this;
  8171. return $core.withContext(function($ctx1) {
  8172. return $self._anySatisfy_((function(each){
  8173. return $core.withContext(function($ctx2) {
  8174. return $recv(each).__eq(anObject);
  8175. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8176. }));
  8177. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  8178. },
  8179. args: ["anObject"],
  8180. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  8181. referencedClasses: [],
  8182. messageSends: ["anySatisfy:", "="]
  8183. }),
  8184. $globals.Collection);
  8185. $core.addMethod(
  8186. $core.method({
  8187. selector: "inject:into:",
  8188. protocol: "enumerating",
  8189. fn: function (anObject,aBlock){
  8190. var self=this,$self=this;
  8191. var result;
  8192. return $core.withContext(function($ctx1) {
  8193. result=anObject;
  8194. $self._do_((function(each){
  8195. return $core.withContext(function($ctx2) {
  8196. result=$recv(aBlock)._value_value_(result,each);
  8197. return result;
  8198. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8199. }));
  8200. return result;
  8201. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  8202. },
  8203. args: ["anObject", "aBlock"],
  8204. 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",
  8205. referencedClasses: [],
  8206. messageSends: ["do:", "value:value:"]
  8207. }),
  8208. $globals.Collection);
  8209. $core.addMethod(
  8210. $core.method({
  8211. selector: "intersection:",
  8212. protocol: "enumerating",
  8213. fn: function (aCollection){
  8214. var self=this,$self=this;
  8215. var set,outputSet;
  8216. return $core.withContext(function($ctx1) {
  8217. var $2,$1;
  8218. set=$self._asSet();
  8219. outputSet=$recv($globals.Set)._new();
  8220. $recv(aCollection)._do_((function(each){
  8221. return $core.withContext(function($ctx2) {
  8222. $2=$recv(set)._includes_(each);
  8223. $ctx2.sendIdx["includes:"]=1;
  8224. $1=$recv($2)._and_((function(){
  8225. return $core.withContext(function($ctx3) {
  8226. return $recv($recv(outputSet)._includes_(each))._not();
  8227. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8228. }));
  8229. if($core.assert($1)){
  8230. return $recv(outputSet)._add_(each);
  8231. }
  8232. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8233. }));
  8234. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  8235. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  8236. },
  8237. args: ["aCollection"],
  8238. 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",
  8239. referencedClasses: ["Set"],
  8240. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  8241. }),
  8242. $globals.Collection);
  8243. $core.addMethod(
  8244. $core.method({
  8245. selector: "isEmpty",
  8246. protocol: "testing",
  8247. fn: function (){
  8248. var self=this,$self=this;
  8249. return $core.withContext(function($ctx1) {
  8250. return $recv($self._size()).__eq((0));
  8251. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  8252. },
  8253. args: [],
  8254. source: "isEmpty\x0a\x09^ self size = 0",
  8255. referencedClasses: [],
  8256. messageSends: ["=", "size"]
  8257. }),
  8258. $globals.Collection);
  8259. $core.addMethod(
  8260. $core.method({
  8261. selector: "noneSatisfy:",
  8262. protocol: "enumerating",
  8263. fn: function (aBlock){
  8264. var self=this,$self=this;
  8265. return $core.withContext(function($ctx1) {
  8266. var $1;
  8267. var $early={};
  8268. try {
  8269. $self._do_((function(item){
  8270. return $core.withContext(function($ctx2) {
  8271. $1=$recv(aBlock)._value_(item);
  8272. if($core.assert($1)){
  8273. throw $early=[false];
  8274. }
  8275. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  8276. }));
  8277. return true;
  8278. }
  8279. catch(e) {if(e===$early)return e[0]; throw e}
  8280. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  8281. },
  8282. args: ["aBlock"],
  8283. 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",
  8284. referencedClasses: [],
  8285. messageSends: ["do:", "ifTrue:", "value:"]
  8286. }),
  8287. $globals.Collection);
  8288. $core.addMethod(
  8289. $core.method({
  8290. selector: "notEmpty",
  8291. protocol: "testing",
  8292. fn: function (){
  8293. var self=this,$self=this;
  8294. return $core.withContext(function($ctx1) {
  8295. return $recv($self._isEmpty())._not();
  8296. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  8297. },
  8298. args: [],
  8299. source: "notEmpty\x0a\x09^ self isEmpty not",
  8300. referencedClasses: [],
  8301. messageSends: ["not", "isEmpty"]
  8302. }),
  8303. $globals.Collection);
  8304. $core.addMethod(
  8305. $core.method({
  8306. selector: "occurrencesOf:",
  8307. protocol: "accessing",
  8308. fn: function (anObject){
  8309. var self=this,$self=this;
  8310. var tally;
  8311. return $core.withContext(function($ctx1) {
  8312. var $1;
  8313. tally=(0);
  8314. $self._do_((function(each){
  8315. return $core.withContext(function($ctx2) {
  8316. $1=$recv(anObject).__eq(each);
  8317. if($core.assert($1)){
  8318. tally=$recv(tally).__plus((1));
  8319. return tally;
  8320. }
  8321. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8322. }));
  8323. return tally;
  8324. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  8325. },
  8326. args: ["anObject"],
  8327. 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",
  8328. referencedClasses: [],
  8329. messageSends: ["do:", "ifTrue:", "=", "+"]
  8330. }),
  8331. $globals.Collection);
  8332. $core.addMethod(
  8333. $core.method({
  8334. selector: "putOn:",
  8335. protocol: "streaming",
  8336. fn: function (aStream){
  8337. var self=this,$self=this;
  8338. return $core.withContext(function($ctx1) {
  8339. $self._do_((function(each){
  8340. return $core.withContext(function($ctx2) {
  8341. return $recv(each)._putOn_(aStream);
  8342. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8343. }));
  8344. return self;
  8345. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  8346. },
  8347. args: ["aStream"],
  8348. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  8349. referencedClasses: [],
  8350. messageSends: ["do:", "putOn:"]
  8351. }),
  8352. $globals.Collection);
  8353. $core.addMethod(
  8354. $core.method({
  8355. selector: "reject:",
  8356. protocol: "enumerating",
  8357. fn: function (aBlock){
  8358. var self=this,$self=this;
  8359. return $core.withContext(function($ctx1) {
  8360. return $self._select_((function(each){
  8361. return $core.withContext(function($ctx2) {
  8362. return $recv($recv(aBlock)._value_(each)).__eq(false);
  8363. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8364. }));
  8365. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  8366. },
  8367. args: ["aBlock"],
  8368. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  8369. referencedClasses: [],
  8370. messageSends: ["select:", "=", "value:"]
  8371. }),
  8372. $globals.Collection);
  8373. $core.addMethod(
  8374. $core.method({
  8375. selector: "remove:",
  8376. protocol: "adding/removing",
  8377. fn: function (anObject){
  8378. var self=this,$self=this;
  8379. return $core.withContext(function($ctx1) {
  8380. return $self._remove_ifAbsent_(anObject,(function(){
  8381. return $core.withContext(function($ctx2) {
  8382. return $self._errorNotFound();
  8383. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8384. }));
  8385. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  8386. },
  8387. args: ["anObject"],
  8388. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  8389. referencedClasses: [],
  8390. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  8391. }),
  8392. $globals.Collection);
  8393. $core.addMethod(
  8394. $core.method({
  8395. selector: "remove:ifAbsent:",
  8396. protocol: "adding/removing",
  8397. fn: function (anObject,aBlock){
  8398. var self=this,$self=this;
  8399. return $core.withContext(function($ctx1) {
  8400. $self._subclassResponsibility();
  8401. return self;
  8402. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  8403. },
  8404. args: ["anObject", "aBlock"],
  8405. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8406. referencedClasses: [],
  8407. messageSends: ["subclassResponsibility"]
  8408. }),
  8409. $globals.Collection);
  8410. $core.addMethod(
  8411. $core.method({
  8412. selector: "removeAll",
  8413. protocol: "adding/removing",
  8414. fn: function (){
  8415. var self=this,$self=this;
  8416. return $core.withContext(function($ctx1) {
  8417. $self._subclassResponsibility();
  8418. return self;
  8419. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  8420. },
  8421. args: [],
  8422. source: "removeAll\x0a\x09self subclassResponsibility",
  8423. referencedClasses: [],
  8424. messageSends: ["subclassResponsibility"]
  8425. }),
  8426. $globals.Collection);
  8427. $core.addMethod(
  8428. $core.method({
  8429. selector: "select:",
  8430. protocol: "enumerating",
  8431. fn: function (aBlock){
  8432. var self=this,$self=this;
  8433. var stream;
  8434. return $core.withContext(function($ctx1) {
  8435. var $1;
  8436. stream=$recv($recv($self._class())._new())._writeStream();
  8437. $self._do_((function(each){
  8438. return $core.withContext(function($ctx2) {
  8439. $1=$recv(aBlock)._value_(each);
  8440. if($core.assert($1)){
  8441. return $recv(stream)._nextPut_(each);
  8442. }
  8443. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8444. }));
  8445. return $recv(stream)._contents();
  8446. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  8447. },
  8448. args: ["aBlock"],
  8449. 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",
  8450. referencedClasses: [],
  8451. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8452. }),
  8453. $globals.Collection);
  8454. $core.addMethod(
  8455. $core.method({
  8456. selector: "select:thenCollect:",
  8457. protocol: "enumerating",
  8458. fn: function (selectBlock,collectBlock){
  8459. var self=this,$self=this;
  8460. var stream;
  8461. return $core.withContext(function($ctx1) {
  8462. var $1;
  8463. stream=$recv($recv($self._class())._new())._writeStream();
  8464. $self._do_((function(each){
  8465. return $core.withContext(function($ctx2) {
  8466. $1=$recv(selectBlock)._value_(each);
  8467. $ctx2.sendIdx["value:"]=1;
  8468. if($core.assert($1)){
  8469. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  8470. }
  8471. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8472. }));
  8473. return $recv(stream)._contents();
  8474. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  8475. },
  8476. args: ["selectBlock", "collectBlock"],
  8477. 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",
  8478. referencedClasses: [],
  8479. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8480. }),
  8481. $globals.Collection);
  8482. $core.addMethod(
  8483. $core.method({
  8484. selector: "shallowCopy",
  8485. protocol: "copying",
  8486. fn: function (){
  8487. var self=this,$self=this;
  8488. return $core.withContext(function($ctx1) {
  8489. return $self._collect_((function(each){
  8490. return each;
  8491. }));
  8492. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  8493. },
  8494. args: [],
  8495. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  8496. referencedClasses: [],
  8497. messageSends: ["collect:"]
  8498. }),
  8499. $globals.Collection);
  8500. $core.addMethod(
  8501. $core.method({
  8502. selector: "single",
  8503. protocol: "accessing",
  8504. fn: function (){
  8505. var self=this,$self=this;
  8506. return $core.withContext(function($ctx1) {
  8507. var $1;
  8508. $self._ifEmpty_((function(){
  8509. return $core.withContext(function($ctx2) {
  8510. return $self._error_("Collection is empty");
  8511. $ctx2.sendIdx["error:"]=1;
  8512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8513. }));
  8514. $1=$recv($self._size()).__gt((1));
  8515. if($core.assert($1)){
  8516. $self._error_("Collection holds more than one element");
  8517. }
  8518. return $self._anyOne();
  8519. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  8520. },
  8521. args: [],
  8522. 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",
  8523. referencedClasses: [],
  8524. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  8525. }),
  8526. $globals.Collection);
  8527. $core.addMethod(
  8528. $core.method({
  8529. selector: "size",
  8530. protocol: "accessing",
  8531. fn: function (){
  8532. var self=this,$self=this;
  8533. return $core.withContext(function($ctx1) {
  8534. $self._subclassResponsibility();
  8535. return self;
  8536. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  8537. },
  8538. args: [],
  8539. source: "size\x0a\x09self subclassResponsibility",
  8540. referencedClasses: [],
  8541. messageSends: ["subclassResponsibility"]
  8542. }),
  8543. $globals.Collection);
  8544. $core.addMethod(
  8545. $core.method({
  8546. selector: "classTag",
  8547. protocol: "accessing",
  8548. fn: function (){
  8549. var self=this,$self=this;
  8550. return "collection";
  8551. },
  8552. args: [],
  8553. 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'",
  8554. referencedClasses: [],
  8555. messageSends: []
  8556. }),
  8557. $globals.Collection.a$cls);
  8558. $core.addMethod(
  8559. $core.method({
  8560. selector: "new:",
  8561. protocol: "instance creation",
  8562. fn: function (anInteger){
  8563. var self=this,$self=this;
  8564. return $core.withContext(function($ctx1) {
  8565. return $self._new();
  8566. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  8567. },
  8568. args: ["anInteger"],
  8569. source: "new: anInteger\x0a\x09^ self new",
  8570. referencedClasses: [],
  8571. messageSends: ["new"]
  8572. }),
  8573. $globals.Collection.a$cls);
  8574. $core.addMethod(
  8575. $core.method({
  8576. selector: "with:",
  8577. protocol: "instance creation",
  8578. fn: function (anObject){
  8579. var self=this,$self=this;
  8580. return $core.withContext(function($ctx1) {
  8581. var $1;
  8582. $1=$self._new();
  8583. $recv($1)._add_(anObject);
  8584. return $recv($1)._yourself();
  8585. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  8586. },
  8587. args: ["anObject"],
  8588. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8589. referencedClasses: [],
  8590. messageSends: ["add:", "new", "yourself"]
  8591. }),
  8592. $globals.Collection.a$cls);
  8593. $core.addMethod(
  8594. $core.method({
  8595. selector: "with:with:",
  8596. protocol: "instance creation",
  8597. fn: function (anObject,anotherObject){
  8598. var self=this,$self=this;
  8599. return $core.withContext(function($ctx1) {
  8600. var $1;
  8601. $1=$self._new();
  8602. $recv($1)._add_(anObject);
  8603. $ctx1.sendIdx["add:"]=1;
  8604. $recv($1)._add_(anotherObject);
  8605. return $recv($1)._yourself();
  8606. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  8607. },
  8608. args: ["anObject", "anotherObject"],
  8609. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8610. referencedClasses: [],
  8611. messageSends: ["add:", "new", "yourself"]
  8612. }),
  8613. $globals.Collection.a$cls);
  8614. $core.addMethod(
  8615. $core.method({
  8616. selector: "with:with:with:",
  8617. protocol: "instance creation",
  8618. fn: function (firstObject,secondObject,thirdObject){
  8619. var self=this,$self=this;
  8620. return $core.withContext(function($ctx1) {
  8621. var $1;
  8622. $1=$self._new();
  8623. $recv($1)._add_(firstObject);
  8624. $ctx1.sendIdx["add:"]=1;
  8625. $recv($1)._add_(secondObject);
  8626. $ctx1.sendIdx["add:"]=2;
  8627. $recv($1)._add_(thirdObject);
  8628. return $recv($1)._yourself();
  8629. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  8630. },
  8631. args: ["firstObject", "secondObject", "thirdObject"],
  8632. 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",
  8633. referencedClasses: [],
  8634. messageSends: ["add:", "new", "yourself"]
  8635. }),
  8636. $globals.Collection.a$cls);
  8637. $core.addMethod(
  8638. $core.method({
  8639. selector: "withAll:",
  8640. protocol: "instance creation",
  8641. fn: function (aCollection){
  8642. var self=this,$self=this;
  8643. return $core.withContext(function($ctx1) {
  8644. var $1;
  8645. $1=$self._new();
  8646. $recv($1)._addAll_(aCollection);
  8647. return $recv($1)._yourself();
  8648. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  8649. },
  8650. args: ["aCollection"],
  8651. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8652. referencedClasses: [],
  8653. messageSends: ["addAll:", "new", "yourself"]
  8654. }),
  8655. $globals.Collection.a$cls);
  8656. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  8657. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  8658. $core.addMethod(
  8659. $core.method({
  8660. selector: "=",
  8661. protocol: "comparing",
  8662. fn: function (anAssocitativeCollection){
  8663. var self=this,$self=this;
  8664. return $core.withContext(function($ctx1) {
  8665. var $2,$1,$4,$3,$5;
  8666. $2=$self._class();
  8667. $ctx1.sendIdx["class"]=1;
  8668. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  8669. $ctx1.sendIdx["="]=1;
  8670. if(!$core.assert($1)){
  8671. return false;
  8672. }
  8673. $4=$self._size();
  8674. $ctx1.sendIdx["size"]=1;
  8675. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  8676. $ctx1.sendIdx["="]=2;
  8677. if(!$core.assert($3)){
  8678. return false;
  8679. }
  8680. $5=$self._associations();
  8681. $ctx1.sendIdx["associations"]=1;
  8682. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  8683. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  8684. },
  8685. args: ["anAssocitativeCollection"],
  8686. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  8687. referencedClasses: [],
  8688. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  8689. }),
  8690. $globals.AssociativeCollection);
  8691. $core.addMethod(
  8692. $core.method({
  8693. selector: "add:",
  8694. protocol: "adding/removing",
  8695. fn: function (anAssociation){
  8696. var self=this,$self=this;
  8697. return $core.withContext(function($ctx1) {
  8698. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  8699. return self;
  8700. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  8701. },
  8702. args: ["anAssociation"],
  8703. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  8704. referencedClasses: [],
  8705. messageSends: ["at:put:", "key", "value"]
  8706. }),
  8707. $globals.AssociativeCollection);
  8708. $core.addMethod(
  8709. $core.method({
  8710. selector: "addAll:",
  8711. protocol: "adding/removing",
  8712. fn: function (anAssociativeCollection){
  8713. var self=this,$self=this;
  8714. return $core.withContext(function($ctx1) {
  8715. (
  8716. $ctx1.supercall = true,
  8717. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  8718. $ctx1.supercall = false;
  8719. return anAssociativeCollection;
  8720. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  8721. },
  8722. args: ["anAssociativeCollection"],
  8723. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  8724. referencedClasses: [],
  8725. messageSends: ["addAll:", "associations"]
  8726. }),
  8727. $globals.AssociativeCollection);
  8728. $core.addMethod(
  8729. $core.method({
  8730. selector: "asDictionary",
  8731. protocol: "converting",
  8732. fn: function (){
  8733. var self=this,$self=this;
  8734. return $core.withContext(function($ctx1) {
  8735. return $recv($globals.Dictionary)._from_($self._associations());
  8736. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  8737. },
  8738. args: [],
  8739. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  8740. referencedClasses: ["Dictionary"],
  8741. messageSends: ["from:", "associations"]
  8742. }),
  8743. $globals.AssociativeCollection);
  8744. $core.addMethod(
  8745. $core.method({
  8746. selector: "asHashedCollection",
  8747. protocol: "converting",
  8748. fn: function (){
  8749. var self=this,$self=this;
  8750. return $core.withContext(function($ctx1) {
  8751. return $recv($globals.HashedCollection)._from_($self._associations());
  8752. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  8753. },
  8754. args: [],
  8755. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  8756. referencedClasses: ["HashedCollection"],
  8757. messageSends: ["from:", "associations"]
  8758. }),
  8759. $globals.AssociativeCollection);
  8760. $core.addMethod(
  8761. $core.method({
  8762. selector: "asJavaScriptObject",
  8763. protocol: "converting",
  8764. fn: function (){
  8765. var self=this,$self=this;
  8766. var hash;
  8767. return $core.withContext(function($ctx1) {
  8768. hash=$recv($globals.HashedCollection)._new();
  8769. $self._keysAndValuesDo_((function(key,value){
  8770. return $core.withContext(function($ctx2) {
  8771. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  8772. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8773. }));
  8774. return hash;
  8775. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  8776. },
  8777. args: [],
  8778. 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",
  8779. referencedClasses: ["HashedCollection"],
  8780. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  8781. }),
  8782. $globals.AssociativeCollection);
  8783. $core.addMethod(
  8784. $core.method({
  8785. selector: "associations",
  8786. protocol: "accessing",
  8787. fn: function (){
  8788. var self=this,$self=this;
  8789. var associations;
  8790. return $core.withContext(function($ctx1) {
  8791. associations=[];
  8792. $self._associationsDo_((function(each){
  8793. return $core.withContext(function($ctx2) {
  8794. return $recv(associations)._add_(each);
  8795. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8796. }));
  8797. return associations;
  8798. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  8799. },
  8800. args: [],
  8801. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  8802. referencedClasses: [],
  8803. messageSends: ["associationsDo:", "add:"]
  8804. }),
  8805. $globals.AssociativeCollection);
  8806. $core.addMethod(
  8807. $core.method({
  8808. selector: "associationsDo:",
  8809. protocol: "enumerating",
  8810. fn: function (aBlock){
  8811. var self=this,$self=this;
  8812. return $core.withContext(function($ctx1) {
  8813. $self._keysAndValuesDo_((function(key,value){
  8814. return $core.withContext(function($ctx2) {
  8815. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  8816. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8817. }));
  8818. return self;
  8819. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8820. },
  8821. args: ["aBlock"],
  8822. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  8823. referencedClasses: ["Association"],
  8824. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  8825. }),
  8826. $globals.AssociativeCollection);
  8827. $core.addMethod(
  8828. $core.method({
  8829. selector: "at:ifPresent:ifAbsent:",
  8830. protocol: "accessing",
  8831. fn: function (aKey,aBlock,anotherBlock){
  8832. var self=this,$self=this;
  8833. return $core.withContext(function($ctx1) {
  8834. var $1;
  8835. $1=$self._includesKey_(aKey);
  8836. if($core.assert($1)){
  8837. return $recv(aBlock)._value_($self._at_(aKey));
  8838. } else {
  8839. return $recv(anotherBlock)._value();
  8840. }
  8841. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8842. },
  8843. args: ["aKey", "aBlock", "anotherBlock"],
  8844. 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 ]",
  8845. referencedClasses: [],
  8846. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  8847. }),
  8848. $globals.AssociativeCollection);
  8849. $core.addMethod(
  8850. $core.method({
  8851. selector: "collect:",
  8852. protocol: "enumerating",
  8853. fn: function (aBlock){
  8854. var self=this,$self=this;
  8855. var newDict;
  8856. return $core.withContext(function($ctx1) {
  8857. newDict=$recv($self._class())._new();
  8858. $self._keysAndValuesDo_((function(key,value){
  8859. return $core.withContext(function($ctx2) {
  8860. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  8861. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8862. }));
  8863. return newDict;
  8864. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  8865. },
  8866. args: ["aBlock"],
  8867. 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",
  8868. referencedClasses: [],
  8869. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  8870. }),
  8871. $globals.AssociativeCollection);
  8872. $core.addMethod(
  8873. $core.method({
  8874. selector: "deepCopy",
  8875. protocol: "copying",
  8876. fn: function (){
  8877. var self=this,$self=this;
  8878. var copy;
  8879. return $core.withContext(function($ctx1) {
  8880. copy=$recv($self._class())._new();
  8881. $self._keysAndValuesDo_((function(key,value){
  8882. return $core.withContext(function($ctx2) {
  8883. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  8884. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8885. }));
  8886. return copy;
  8887. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  8888. },
  8889. args: [],
  8890. 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",
  8891. referencedClasses: [],
  8892. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  8893. }),
  8894. $globals.AssociativeCollection);
  8895. $core.addMethod(
  8896. $core.method({
  8897. selector: "detect:ifNone:",
  8898. protocol: "enumerating",
  8899. fn: function (aBlock,anotherBlock){
  8900. var self=this,$self=this;
  8901. return $core.withContext(function($ctx1) {
  8902. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  8903. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8904. },
  8905. args: ["aBlock", "anotherBlock"],
  8906. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  8907. referencedClasses: [],
  8908. messageSends: ["detect:ifNone:", "values"]
  8909. }),
  8910. $globals.AssociativeCollection);
  8911. $core.addMethod(
  8912. $core.method({
  8913. selector: "do:",
  8914. protocol: "enumerating",
  8915. fn: function (aBlock){
  8916. var self=this,$self=this;
  8917. return $core.withContext(function($ctx1) {
  8918. $self._valuesDo_(aBlock);
  8919. return self;
  8920. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8921. },
  8922. args: ["aBlock"],
  8923. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  8924. referencedClasses: [],
  8925. messageSends: ["valuesDo:"]
  8926. }),
  8927. $globals.AssociativeCollection);
  8928. $core.addMethod(
  8929. $core.method({
  8930. selector: "includes:",
  8931. protocol: "enumerating",
  8932. fn: function (anObject){
  8933. var self=this,$self=this;
  8934. return $core.withContext(function($ctx1) {
  8935. return $recv($self._values())._includes_(anObject);
  8936. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  8937. },
  8938. args: ["anObject"],
  8939. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  8940. referencedClasses: [],
  8941. messageSends: ["includes:", "values"]
  8942. }),
  8943. $globals.AssociativeCollection);
  8944. $core.addMethod(
  8945. $core.method({
  8946. selector: "includesKey:",
  8947. protocol: "testing",
  8948. fn: function (aKey){
  8949. var self=this,$self=this;
  8950. return $core.withContext(function($ctx1) {
  8951. $self._subclassResponsibility();
  8952. return self;
  8953. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  8954. },
  8955. args: ["aKey"],
  8956. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  8957. referencedClasses: [],
  8958. messageSends: ["subclassResponsibility"]
  8959. }),
  8960. $globals.AssociativeCollection);
  8961. $core.addMethod(
  8962. $core.method({
  8963. selector: "indexOf:ifAbsent:",
  8964. protocol: "accessing",
  8965. fn: function (anObject,aBlock){
  8966. var self=this,$self=this;
  8967. return $core.withContext(function($ctx1) {
  8968. return $recv($self._keys())._detect_ifNone_((function(each){
  8969. return $core.withContext(function($ctx2) {
  8970. return $recv($self._at_(each)).__eq(anObject);
  8971. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8972. }),aBlock);
  8973. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  8974. },
  8975. args: ["anObject", "aBlock"],
  8976. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  8977. referencedClasses: [],
  8978. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  8979. }),
  8980. $globals.AssociativeCollection);
  8981. $core.addMethod(
  8982. $core.method({
  8983. selector: "keyAtValue:",
  8984. protocol: "accessing",
  8985. fn: function (anObject){
  8986. var self=this,$self=this;
  8987. return $core.withContext(function($ctx1) {
  8988. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  8989. return $core.withContext(function($ctx2) {
  8990. return $self._errorNotFound();
  8991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8992. }));
  8993. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  8994. },
  8995. args: ["anObject"],
  8996. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  8997. referencedClasses: [],
  8998. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  8999. }),
  9000. $globals.AssociativeCollection);
  9001. $core.addMethod(
  9002. $core.method({
  9003. selector: "keyAtValue:ifAbsent:",
  9004. protocol: "accessing",
  9005. fn: function (anObject,aBlock){
  9006. var self=this,$self=this;
  9007. return $core.withContext(function($ctx1) {
  9008. return $self._indexOf_ifAbsent_(anObject,aBlock);
  9009. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  9010. },
  9011. args: ["anObject", "aBlock"],
  9012. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  9013. referencedClasses: [],
  9014. messageSends: ["indexOf:ifAbsent:"]
  9015. }),
  9016. $globals.AssociativeCollection);
  9017. $core.addMethod(
  9018. $core.method({
  9019. selector: "keys",
  9020. protocol: "accessing",
  9021. fn: function (){
  9022. var self=this,$self=this;
  9023. return $core.withContext(function($ctx1) {
  9024. $self._subclassResponsibility();
  9025. return self;
  9026. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  9027. },
  9028. args: [],
  9029. source: "keys\x0a\x09self subclassResponsibility",
  9030. referencedClasses: [],
  9031. messageSends: ["subclassResponsibility"]
  9032. }),
  9033. $globals.AssociativeCollection);
  9034. $core.addMethod(
  9035. $core.method({
  9036. selector: "keysAndValuesDo:",
  9037. protocol: "enumerating",
  9038. fn: function (aBlock){
  9039. var self=this,$self=this;
  9040. return $core.withContext(function($ctx1) {
  9041. $self._keysDo_((function(each){
  9042. return $core.withContext(function($ctx2) {
  9043. return $recv(aBlock)._value_value_(each,$self._at_(each));
  9044. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9045. }));
  9046. return self;
  9047. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9048. },
  9049. args: ["aBlock"],
  9050. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  9051. referencedClasses: [],
  9052. messageSends: ["keysDo:", "value:value:", "at:"]
  9053. }),
  9054. $globals.AssociativeCollection);
  9055. $core.addMethod(
  9056. $core.method({
  9057. selector: "keysDo:",
  9058. protocol: "enumerating",
  9059. fn: function (aBlock){
  9060. var self=this,$self=this;
  9061. return $core.withContext(function($ctx1) {
  9062. $self._subclassResponsibility();
  9063. return self;
  9064. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9065. },
  9066. args: ["aBlock"],
  9067. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  9068. referencedClasses: [],
  9069. messageSends: ["subclassResponsibility"]
  9070. }),
  9071. $globals.AssociativeCollection);
  9072. $core.addMethod(
  9073. $core.method({
  9074. selector: "printOn:",
  9075. protocol: "printing",
  9076. fn: function (aStream){
  9077. var self=this,$self=this;
  9078. return $core.withContext(function($ctx1) {
  9079. (
  9080. $ctx1.supercall = true,
  9081. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  9082. $ctx1.supercall = false;
  9083. $ctx1.sendIdx["printOn:"]=1;
  9084. $recv(aStream)._nextPutAll_(" (");
  9085. $ctx1.sendIdx["nextPutAll:"]=1;
  9086. $recv($self._associations())._do_separatedBy_((function(each){
  9087. return $core.withContext(function($ctx2) {
  9088. return $recv(each)._printOn_(aStream);
  9089. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9090. }),(function(){
  9091. return $core.withContext(function($ctx2) {
  9092. return $recv(aStream)._nextPutAll_(" , ");
  9093. $ctx2.sendIdx["nextPutAll:"]=2;
  9094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9095. }));
  9096. $recv(aStream)._nextPutAll_(")");
  9097. return self;
  9098. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  9099. },
  9100. args: ["aStream"],
  9101. 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: ')'",
  9102. referencedClasses: [],
  9103. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  9104. }),
  9105. $globals.AssociativeCollection);
  9106. $core.addMethod(
  9107. $core.method({
  9108. selector: "remove:ifAbsent:",
  9109. protocol: "adding/removing",
  9110. fn: function (aKey,aBlock){
  9111. var self=this,$self=this;
  9112. return $core.withContext(function($ctx1) {
  9113. return $self._removeKey_ifAbsent_(aKey,aBlock);
  9114. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9115. },
  9116. args: ["aKey", "aBlock"],
  9117. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  9118. referencedClasses: [],
  9119. messageSends: ["removeKey:ifAbsent:"]
  9120. }),
  9121. $globals.AssociativeCollection);
  9122. $core.addMethod(
  9123. $core.method({
  9124. selector: "removeAll",
  9125. protocol: "adding/removing",
  9126. fn: function (){
  9127. var self=this,$self=this;
  9128. return $core.withContext(function($ctx1) {
  9129. return $recv($self._keys())._do_((function(each){
  9130. return $core.withContext(function($ctx2) {
  9131. return $self._removeKey_(each);
  9132. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9133. }));
  9134. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  9135. },
  9136. args: [],
  9137. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  9138. referencedClasses: [],
  9139. messageSends: ["do:", "keys", "removeKey:"]
  9140. }),
  9141. $globals.AssociativeCollection);
  9142. $core.addMethod(
  9143. $core.method({
  9144. selector: "removeKey:",
  9145. protocol: "adding/removing",
  9146. fn: function (aKey){
  9147. var self=this,$self=this;
  9148. return $core.withContext(function($ctx1) {
  9149. return $self._remove_(aKey);
  9150. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  9151. },
  9152. args: ["aKey"],
  9153. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  9154. referencedClasses: [],
  9155. messageSends: ["remove:"]
  9156. }),
  9157. $globals.AssociativeCollection);
  9158. $core.addMethod(
  9159. $core.method({
  9160. selector: "removeKey:ifAbsent:",
  9161. protocol: "adding/removing",
  9162. fn: function (aKey,aBlock){
  9163. var self=this,$self=this;
  9164. return $core.withContext(function($ctx1) {
  9165. $self._subclassResponsibility();
  9166. return self;
  9167. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9168. },
  9169. args: ["aKey", "aBlock"],
  9170. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9171. referencedClasses: [],
  9172. messageSends: ["subclassResponsibility"]
  9173. }),
  9174. $globals.AssociativeCollection);
  9175. $core.addMethod(
  9176. $core.method({
  9177. selector: "select:",
  9178. protocol: "enumerating",
  9179. fn: function (aBlock){
  9180. var self=this,$self=this;
  9181. var newDict;
  9182. return $core.withContext(function($ctx1) {
  9183. var $1;
  9184. newDict=$recv($self._class())._new();
  9185. $self._keysAndValuesDo_((function(key,value){
  9186. return $core.withContext(function($ctx2) {
  9187. $1=$recv(aBlock)._value_(value);
  9188. if($core.assert($1)){
  9189. return $recv(newDict)._at_put_(key,value);
  9190. }
  9191. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9192. }));
  9193. return newDict;
  9194. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  9195. },
  9196. args: ["aBlock"],
  9197. 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",
  9198. referencedClasses: [],
  9199. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9200. }),
  9201. $globals.AssociativeCollection);
  9202. $core.addMethod(
  9203. $core.method({
  9204. selector: "select:thenCollect:",
  9205. protocol: "enumerating",
  9206. fn: function (selectBlock,collectBlock){
  9207. var self=this,$self=this;
  9208. var newDict;
  9209. return $core.withContext(function($ctx1) {
  9210. var $1;
  9211. newDict=$recv($self._class())._new();
  9212. $self._keysAndValuesDo_((function(key,value){
  9213. return $core.withContext(function($ctx2) {
  9214. $1=$recv(selectBlock)._value_(value);
  9215. $ctx2.sendIdx["value:"]=1;
  9216. if($core.assert($1)){
  9217. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  9218. }
  9219. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9220. }));
  9221. return newDict;
  9222. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  9223. },
  9224. args: ["selectBlock", "collectBlock"],
  9225. 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",
  9226. referencedClasses: [],
  9227. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9228. }),
  9229. $globals.AssociativeCollection);
  9230. $core.addMethod(
  9231. $core.method({
  9232. selector: "shallowCopy",
  9233. protocol: "copying",
  9234. fn: function (){
  9235. var self=this,$self=this;
  9236. var copy;
  9237. return $core.withContext(function($ctx1) {
  9238. copy=$recv($self._class())._new();
  9239. $self._keysAndValuesDo_((function(key,value){
  9240. return $core.withContext(function($ctx2) {
  9241. return $recv(copy)._at_put_(key,value);
  9242. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9243. }));
  9244. return copy;
  9245. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  9246. },
  9247. args: [],
  9248. 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",
  9249. referencedClasses: [],
  9250. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  9251. }),
  9252. $globals.AssociativeCollection);
  9253. $core.addMethod(
  9254. $core.method({
  9255. selector: "size",
  9256. protocol: "accessing",
  9257. fn: function (){
  9258. var self=this,$self=this;
  9259. return $core.withContext(function($ctx1) {
  9260. return $recv($self._keys())._size();
  9261. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  9262. },
  9263. args: [],
  9264. source: "size\x0a\x09^ self keys size",
  9265. referencedClasses: [],
  9266. messageSends: ["size", "keys"]
  9267. }),
  9268. $globals.AssociativeCollection);
  9269. $core.addMethod(
  9270. $core.method({
  9271. selector: "values",
  9272. protocol: "accessing",
  9273. fn: function (){
  9274. var self=this,$self=this;
  9275. return $core.withContext(function($ctx1) {
  9276. $self._subclassResponsibility();
  9277. return self;
  9278. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  9279. },
  9280. args: [],
  9281. source: "values\x0a\x09self subclassResponsibility",
  9282. referencedClasses: [],
  9283. messageSends: ["subclassResponsibility"]
  9284. }),
  9285. $globals.AssociativeCollection);
  9286. $core.addMethod(
  9287. $core.method({
  9288. selector: "valuesDo:",
  9289. protocol: "enumerating",
  9290. fn: function (aBlock){
  9291. var self=this,$self=this;
  9292. return $core.withContext(function($ctx1) {
  9293. $self._subclassResponsibility();
  9294. return self;
  9295. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9296. },
  9297. args: ["aBlock"],
  9298. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  9299. referencedClasses: [],
  9300. messageSends: ["subclassResponsibility"]
  9301. }),
  9302. $globals.AssociativeCollection);
  9303. $core.addMethod(
  9304. $core.method({
  9305. selector: "withIndexDo:",
  9306. protocol: "enumerating",
  9307. fn: function (aBlock){
  9308. var self=this,$self=this;
  9309. return $core.withContext(function($ctx1) {
  9310. $self._keysAndValuesDo_((function(key,value){
  9311. return $core.withContext(function($ctx2) {
  9312. return $recv(aBlock)._value_value_(value,key);
  9313. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9314. }));
  9315. return self;
  9316. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9317. },
  9318. args: ["aBlock"],
  9319. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  9320. referencedClasses: [],
  9321. messageSends: ["keysAndValuesDo:", "value:value:"]
  9322. }),
  9323. $globals.AssociativeCollection);
  9324. $core.addMethod(
  9325. $core.method({
  9326. selector: "from:",
  9327. protocol: "instance creation",
  9328. fn: function (aCollection){
  9329. var self=this,$self=this;
  9330. var newCollection;
  9331. return $core.withContext(function($ctx1) {
  9332. newCollection=$self._new();
  9333. $recv(aCollection)._do_((function(each){
  9334. return $core.withContext(function($ctx2) {
  9335. return $recv(newCollection)._add_(each);
  9336. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9337. }));
  9338. return newCollection;
  9339. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9340. },
  9341. args: ["aCollection"],
  9342. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  9343. referencedClasses: [],
  9344. messageSends: ["new", "do:", "add:"]
  9345. }),
  9346. $globals.AssociativeCollection.a$cls);
  9347. $core.addMethod(
  9348. $core.method({
  9349. selector: "fromPairs:",
  9350. protocol: "instance creation",
  9351. fn: function (aCollection){
  9352. var self=this,$self=this;
  9353. return $core.withContext(function($ctx1) {
  9354. return $self._from_(aCollection);
  9355. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  9356. },
  9357. args: ["aCollection"],
  9358. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  9359. referencedClasses: [],
  9360. messageSends: ["from:"]
  9361. }),
  9362. $globals.AssociativeCollection.a$cls);
  9363. $core.addMethod(
  9364. $core.method({
  9365. selector: "newFromPairs:",
  9366. protocol: "instance creation",
  9367. fn: function (aCollection){
  9368. var self=this,$self=this;
  9369. var newCollection;
  9370. return $core.withContext(function($ctx1) {
  9371. var $2,$1,$3,$4;
  9372. $2=$recv(aCollection)._size();
  9373. $ctx1.sendIdx["size"]=1;
  9374. $1=$recv($2)._even();
  9375. if(!$core.assert($1)){
  9376. $self._error_("#newFromPairs only accepts arrays of an even length");
  9377. }
  9378. newCollection=$self._new();
  9379. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  9380. return $core.withContext(function($ctx2) {
  9381. $3=newCollection;
  9382. $4=$recv(aCollection)._at_(each);
  9383. $ctx2.sendIdx["at:"]=1;
  9384. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  9385. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9386. }));
  9387. return newCollection;
  9388. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9389. },
  9390. args: ["aCollection"],
  9391. 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",
  9392. referencedClasses: [],
  9393. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  9394. }),
  9395. $globals.AssociativeCollection.a$cls);
  9396. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  9397. $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.";
  9398. $core.addMethod(
  9399. $core.method({
  9400. selector: "at:ifAbsent:",
  9401. protocol: "accessing",
  9402. fn: function (aKey,aBlock){
  9403. var self=this,$self=this;
  9404. return $core.withContext(function($ctx1) {
  9405. var index = $self._positionOfKey_(aKey);
  9406. return index >=0 ? $self.values[index] : aBlock._value();
  9407. ;
  9408. return self;
  9409. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9410. },
  9411. args: ["aKey", "aBlock"],
  9412. 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'>",
  9413. referencedClasses: [],
  9414. messageSends: []
  9415. }),
  9416. $globals.Dictionary);
  9417. $core.addMethod(
  9418. $core.method({
  9419. selector: "at:put:",
  9420. protocol: "accessing",
  9421. fn: function (aKey,aValue){
  9422. var self=this,$self=this;
  9423. return $core.withContext(function($ctx1) {
  9424. var index = $self._positionOfKey_(aKey);
  9425. if(index === -1) {
  9426. var keys = $self.keys;
  9427. index = keys.length;
  9428. keys.push(aKey);
  9429. }
  9430. return $self.values[index] = aValue;
  9431. ;
  9432. return self;
  9433. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  9434. },
  9435. args: ["aKey", "aValue"],
  9436. 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'>",
  9437. referencedClasses: [],
  9438. messageSends: []
  9439. }),
  9440. $globals.Dictionary);
  9441. $core.addMethod(
  9442. $core.method({
  9443. selector: "includesKey:",
  9444. protocol: "testing",
  9445. fn: function (aKey){
  9446. var self=this,$self=this;
  9447. return $core.withContext(function($ctx1) {
  9448. return $self._positionOfKey_(aKey) >= 0;;
  9449. return self;
  9450. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  9451. },
  9452. args: ["aKey"],
  9453. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  9454. referencedClasses: [],
  9455. messageSends: []
  9456. }),
  9457. $globals.Dictionary);
  9458. $core.addMethod(
  9459. $core.method({
  9460. selector: "indexOf:ifAbsent:",
  9461. protocol: "accessing",
  9462. fn: function (anObject,aBlock){
  9463. var self=this,$self=this;
  9464. var index;
  9465. return $core.withContext(function($ctx1) {
  9466. var $1;
  9467. index=$recv($self.values)._indexOf_ifAbsent_(anObject,(function(){
  9468. return (0);
  9469. }));
  9470. $1=$recv(index).__eq((0));
  9471. if($core.assert($1)){
  9472. return $recv(aBlock)._value();
  9473. } else {
  9474. return $recv($self.keys)._at_(index);
  9475. }
  9476. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  9477. },
  9478. args: ["anObject", "aBlock"],
  9479. 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 ]",
  9480. referencedClasses: [],
  9481. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  9482. }),
  9483. $globals.Dictionary);
  9484. $core.addMethod(
  9485. $core.method({
  9486. selector: "initialize",
  9487. protocol: "initialization",
  9488. fn: function (){
  9489. var self=this,$self=this;
  9490. return $core.withContext(function($ctx1) {
  9491. (
  9492. $ctx1.supercall = true,
  9493. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9494. $ctx1.supercall = false;
  9495. $self.keys=[];
  9496. $self.values=[];
  9497. return self;
  9498. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  9499. },
  9500. args: [],
  9501. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9502. referencedClasses: [],
  9503. messageSends: ["initialize"]
  9504. }),
  9505. $globals.Dictionary);
  9506. $core.addMethod(
  9507. $core.method({
  9508. selector: "keys",
  9509. protocol: "accessing",
  9510. fn: function (){
  9511. var self=this,$self=this;
  9512. return $core.withContext(function($ctx1) {
  9513. return $recv($self.keys)._copy();
  9514. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  9515. },
  9516. args: [],
  9517. source: "keys\x0a\x09^ keys copy",
  9518. referencedClasses: [],
  9519. messageSends: ["copy"]
  9520. }),
  9521. $globals.Dictionary);
  9522. $core.addMethod(
  9523. $core.method({
  9524. selector: "keysAndValuesDo:",
  9525. protocol: "enumerating",
  9526. fn: function (aBlock){
  9527. var self=this,$self=this;
  9528. return $core.withContext(function($ctx1) {
  9529. return $recv($self.keys)._with_do_($self.values,aBlock);
  9530. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9531. },
  9532. args: ["aBlock"],
  9533. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  9534. referencedClasses: [],
  9535. messageSends: ["with:do:"]
  9536. }),
  9537. $globals.Dictionary);
  9538. $core.addMethod(
  9539. $core.method({
  9540. selector: "keysDo:",
  9541. protocol: "enumerating",
  9542. fn: function (aBlock){
  9543. var self=this,$self=this;
  9544. return $core.withContext(function($ctx1) {
  9545. return $recv($self.keys)._do_(aBlock);
  9546. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  9547. },
  9548. args: ["aBlock"],
  9549. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  9550. referencedClasses: [],
  9551. messageSends: ["do:"]
  9552. }),
  9553. $globals.Dictionary);
  9554. $core.addMethod(
  9555. $core.method({
  9556. selector: "positionOfKey:",
  9557. protocol: "private",
  9558. fn: function (anObject){
  9559. var self=this,$self=this;
  9560. return $core.withContext(function($ctx1) {
  9561. var keys = $self.keys;
  9562. for(var i=0;i<keys.length;i++){
  9563. if(keys[i].__eq(anObject)) { return i;}
  9564. }
  9565. return -1;
  9566. ;
  9567. return self;
  9568. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  9569. },
  9570. args: ["anObject"],
  9571. 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'>",
  9572. referencedClasses: [],
  9573. messageSends: []
  9574. }),
  9575. $globals.Dictionary);
  9576. $core.addMethod(
  9577. $core.method({
  9578. selector: "removeAll",
  9579. protocol: "adding/removing",
  9580. fn: function (){
  9581. var self=this,$self=this;
  9582. return $core.withContext(function($ctx1) {
  9583. $recv($self.keys)._removeAll();
  9584. $ctx1.sendIdx["removeAll"]=1;
  9585. $recv($self.values)._removeAll();
  9586. return self;
  9587. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  9588. },
  9589. args: [],
  9590. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  9591. referencedClasses: [],
  9592. messageSends: ["removeAll"]
  9593. }),
  9594. $globals.Dictionary);
  9595. $core.addMethod(
  9596. $core.method({
  9597. selector: "removeKey:ifAbsent:",
  9598. protocol: "adding/removing",
  9599. fn: function (aKey,aBlock){
  9600. var self=this,$self=this;
  9601. return $core.withContext(function($ctx1) {
  9602. var index = $self._positionOfKey_(aKey);
  9603. if(index === -1) {
  9604. return aBlock._value()
  9605. } else {
  9606. var keys = $self.keys, values = $self.values;
  9607. var value = values[index], l = keys.length;
  9608. keys[index] = keys[l-1];
  9609. keys.pop();
  9610. values[index] = values[l-1];
  9611. values.pop();
  9612. return value;
  9613. }
  9614. ;
  9615. return self;
  9616. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9617. },
  9618. args: ["aKey", "aBlock"],
  9619. 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'>",
  9620. referencedClasses: [],
  9621. messageSends: []
  9622. }),
  9623. $globals.Dictionary);
  9624. $core.addMethod(
  9625. $core.method({
  9626. selector: "values",
  9627. protocol: "accessing",
  9628. fn: function (){
  9629. var self=this,$self=this;
  9630. return $self.values;
  9631. },
  9632. args: [],
  9633. source: "values\x0a\x09^ values",
  9634. referencedClasses: [],
  9635. messageSends: []
  9636. }),
  9637. $globals.Dictionary);
  9638. $core.addMethod(
  9639. $core.method({
  9640. selector: "valuesDo:",
  9641. protocol: "enumerating",
  9642. fn: function (aBlock){
  9643. var self=this,$self=this;
  9644. return $core.withContext(function($ctx1) {
  9645. return $recv($self.values)._do_(aBlock);
  9646. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9647. },
  9648. args: ["aBlock"],
  9649. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  9650. referencedClasses: [],
  9651. messageSends: ["do:"]
  9652. }),
  9653. $globals.Dictionary);
  9654. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  9655. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  9656. $core.addMethod(
  9657. $core.method({
  9658. selector: "at:ifAbsent:",
  9659. protocol: "accessing",
  9660. fn: function (aKey,aBlock){
  9661. var self=this,$self=this;
  9662. return $core.withContext(function($ctx1) {
  9663. var $1;
  9664. $1=$self._includesKey_(aKey);
  9665. if($core.assert($1)){
  9666. return $self._basicAt_(aKey);
  9667. } else {
  9668. return $recv(aBlock)._value();
  9669. }
  9670. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9671. },
  9672. args: ["aKey", "aBlock"],
  9673. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  9674. referencedClasses: [],
  9675. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  9676. }),
  9677. $globals.HashedCollection);
  9678. $core.addMethod(
  9679. $core.method({
  9680. selector: "at:put:",
  9681. protocol: "accessing",
  9682. fn: function (aKey,aValue){
  9683. var self=this,$self=this;
  9684. return $core.withContext(function($ctx1) {
  9685. return $self._basicAt_put_(aKey,aValue);
  9686. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  9687. },
  9688. args: ["aKey", "aValue"],
  9689. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  9690. referencedClasses: [],
  9691. messageSends: ["basicAt:put:"]
  9692. }),
  9693. $globals.HashedCollection);
  9694. $core.addMethod(
  9695. $core.method({
  9696. selector: "includesKey:",
  9697. protocol: "testing",
  9698. fn: function (aKey){
  9699. var self=this,$self=this;
  9700. return $core.withContext(function($ctx1) {
  9701. return self.hasOwnProperty(aKey);
  9702. return self;
  9703. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  9704. },
  9705. args: ["aKey"],
  9706. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  9707. referencedClasses: [],
  9708. messageSends: []
  9709. }),
  9710. $globals.HashedCollection);
  9711. $core.addMethod(
  9712. $core.method({
  9713. selector: "keys",
  9714. protocol: "accessing",
  9715. fn: function (){
  9716. var self=this,$self=this;
  9717. return $core.withContext(function($ctx1) {
  9718. return Object.keys(self);
  9719. return self;
  9720. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  9721. },
  9722. args: [],
  9723. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  9724. referencedClasses: [],
  9725. messageSends: []
  9726. }),
  9727. $globals.HashedCollection);
  9728. $core.addMethod(
  9729. $core.method({
  9730. selector: "keysDo:",
  9731. protocol: "enumerating",
  9732. fn: function (aBlock){
  9733. var self=this,$self=this;
  9734. return $core.withContext(function($ctx1) {
  9735. $recv($self._keys())._do_(aBlock);
  9736. return self;
  9737. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9738. },
  9739. args: ["aBlock"],
  9740. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  9741. referencedClasses: [],
  9742. messageSends: ["do:", "keys"]
  9743. }),
  9744. $globals.HashedCollection);
  9745. $core.addMethod(
  9746. $core.method({
  9747. selector: "removeKey:ifAbsent:",
  9748. protocol: "adding/removing",
  9749. fn: function (aKey,aBlock){
  9750. var self=this,$self=this;
  9751. return $core.withContext(function($ctx1) {
  9752. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  9753. return $core.withContext(function($ctx2) {
  9754. $self._basicDelete_(aKey);
  9755. return removed;
  9756. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  9757. }),(function(){
  9758. return $core.withContext(function($ctx2) {
  9759. return $recv(aBlock)._value();
  9760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9761. }));
  9762. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9763. },
  9764. args: ["aKey", "aBlock"],
  9765. 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 ]",
  9766. referencedClasses: [],
  9767. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  9768. }),
  9769. $globals.HashedCollection);
  9770. $core.addMethod(
  9771. $core.method({
  9772. selector: "values",
  9773. protocol: "accessing",
  9774. fn: function (){
  9775. var self=this,$self=this;
  9776. return $core.withContext(function($ctx1) {
  9777. return $self._keys().map(function(key){
  9778. return $self._at_(key);
  9779. });
  9780. ;
  9781. return self;
  9782. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  9783. },
  9784. args: [],
  9785. 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'>",
  9786. referencedClasses: [],
  9787. messageSends: []
  9788. }),
  9789. $globals.HashedCollection);
  9790. $core.addMethod(
  9791. $core.method({
  9792. selector: "valuesDo:",
  9793. protocol: "enumerating",
  9794. fn: function (aBlock){
  9795. var self=this,$self=this;
  9796. return $core.withContext(function($ctx1) {
  9797. $recv($self._values())._do_(aBlock);
  9798. return self;
  9799. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9800. },
  9801. args: ["aBlock"],
  9802. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  9803. referencedClasses: [],
  9804. messageSends: ["do:", "values"]
  9805. }),
  9806. $globals.HashedCollection);
  9807. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  9808. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  9809. $core.addMethod(
  9810. $core.method({
  9811. selector: "=",
  9812. protocol: "comparing",
  9813. fn: function (aCollection){
  9814. var self=this,$self=this;
  9815. return $core.withContext(function($ctx1) {
  9816. var $3,$2,$4,$1,$5;
  9817. var $early={};
  9818. try {
  9819. $3=$self._class();
  9820. $ctx1.sendIdx["class"]=1;
  9821. $2=$recv($3).__eq($recv(aCollection)._class());
  9822. $ctx1.sendIdx["="]=1;
  9823. $1=$recv($2)._and_((function(){
  9824. return $core.withContext(function($ctx2) {
  9825. $4=$self._size();
  9826. $ctx2.sendIdx["size"]=1;
  9827. return $recv($4).__eq($recv(aCollection)._size());
  9828. $ctx2.sendIdx["="]=2;
  9829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9830. }));
  9831. if(!$core.assert($1)){
  9832. return false;
  9833. }
  9834. $self._withIndexDo_((function(each,i){
  9835. return $core.withContext(function($ctx2) {
  9836. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  9837. if(!$core.assert($5)){
  9838. throw $early=[false];
  9839. }
  9840. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  9841. }));
  9842. return true;
  9843. }
  9844. catch(e) {if(e===$early)return e[0]; throw e}
  9845. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  9846. },
  9847. args: ["aCollection"],
  9848. 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",
  9849. referencedClasses: [],
  9850. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  9851. }),
  9852. $globals.SequenceableCollection);
  9853. $core.addMethod(
  9854. $core.method({
  9855. selector: "addLast:",
  9856. protocol: "adding/removing",
  9857. fn: function (anObject){
  9858. var self=this,$self=this;
  9859. return $core.withContext(function($ctx1) {
  9860. $self._add_(anObject);
  9861. return self;
  9862. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  9863. },
  9864. args: ["anObject"],
  9865. source: "addLast: anObject\x0a\x09self add: anObject",
  9866. referencedClasses: [],
  9867. messageSends: ["add:"]
  9868. }),
  9869. $globals.SequenceableCollection);
  9870. $core.addMethod(
  9871. $core.method({
  9872. selector: "allButFirst",
  9873. protocol: "accessing",
  9874. fn: function (){
  9875. var self=this,$self=this;
  9876. return $core.withContext(function($ctx1) {
  9877. return $self._copyFrom_to_((2),$self._size());
  9878. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  9879. },
  9880. args: [],
  9881. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  9882. referencedClasses: [],
  9883. messageSends: ["copyFrom:to:", "size"]
  9884. }),
  9885. $globals.SequenceableCollection);
  9886. $core.addMethod(
  9887. $core.method({
  9888. selector: "allButLast",
  9889. protocol: "accessing",
  9890. fn: function (){
  9891. var self=this,$self=this;
  9892. return $core.withContext(function($ctx1) {
  9893. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  9894. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  9895. },
  9896. args: [],
  9897. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  9898. referencedClasses: [],
  9899. messageSends: ["copyFrom:to:", "-", "size"]
  9900. }),
  9901. $globals.SequenceableCollection);
  9902. $core.addMethod(
  9903. $core.method({
  9904. selector: "anyOne",
  9905. protocol: "accessing",
  9906. fn: function (){
  9907. var self=this,$self=this;
  9908. return $core.withContext(function($ctx1) {
  9909. return $self._at_((1));
  9910. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  9911. },
  9912. args: [],
  9913. source: "anyOne\x0a\x09^ self at: 1",
  9914. referencedClasses: [],
  9915. messageSends: ["at:"]
  9916. }),
  9917. $globals.SequenceableCollection);
  9918. $core.addMethod(
  9919. $core.method({
  9920. selector: "atRandom",
  9921. protocol: "accessing",
  9922. fn: function (){
  9923. var self=this,$self=this;
  9924. return $core.withContext(function($ctx1) {
  9925. return $self._at_($recv($self._size())._atRandom());
  9926. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  9927. },
  9928. args: [],
  9929. source: "atRandom\x0a\x09^ self at: self size atRandom",
  9930. referencedClasses: [],
  9931. messageSends: ["at:", "atRandom", "size"]
  9932. }),
  9933. $globals.SequenceableCollection);
  9934. $core.addMethod(
  9935. $core.method({
  9936. selector: "beginsWith:",
  9937. protocol: "testing",
  9938. fn: function (prefix){
  9939. var self=this,$self=this;
  9940. return $core.withContext(function($ctx1) {
  9941. var $2,$3,$1;
  9942. $2=$self._size();
  9943. $ctx1.sendIdx["size"]=1;
  9944. $3=$recv(prefix)._size();
  9945. $ctx1.sendIdx["size"]=2;
  9946. $1=$recv($2).__lt($3);
  9947. if($core.assert($1)){
  9948. return false;
  9949. }
  9950. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  9951. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  9952. },
  9953. args: ["prefix"],
  9954. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  9955. referencedClasses: [],
  9956. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  9957. }),
  9958. $globals.SequenceableCollection);
  9959. $core.addMethod(
  9960. $core.method({
  9961. selector: "copyFrom:to:",
  9962. protocol: "copying",
  9963. fn: function (anIndex,anotherIndex){
  9964. var self=this,$self=this;
  9965. return $core.withContext(function($ctx1) {
  9966. $self._subclassResponsibility();
  9967. return self;
  9968. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  9969. },
  9970. args: ["anIndex", "anotherIndex"],
  9971. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  9972. referencedClasses: [],
  9973. messageSends: ["subclassResponsibility"]
  9974. }),
  9975. $globals.SequenceableCollection);
  9976. $core.addMethod(
  9977. $core.method({
  9978. selector: "endsWith:",
  9979. protocol: "testing",
  9980. fn: function (suffix){
  9981. var self=this,$self=this;
  9982. return $core.withContext(function($ctx1) {
  9983. var $2,$3,$1;
  9984. $2=$self._size();
  9985. $ctx1.sendIdx["size"]=1;
  9986. $3=$recv(suffix)._size();
  9987. $ctx1.sendIdx["size"]=2;
  9988. $1=$recv($2).__lt($3);
  9989. if($core.assert($1)){
  9990. return false;
  9991. }
  9992. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  9993. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  9994. },
  9995. args: ["suffix"],
  9996. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  9997. referencedClasses: [],
  9998. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  9999. }),
  10000. $globals.SequenceableCollection);
  10001. $core.addMethod(
  10002. $core.method({
  10003. selector: "first",
  10004. protocol: "accessing",
  10005. fn: function (){
  10006. var self=this,$self=this;
  10007. return $core.withContext(function($ctx1) {
  10008. return $self._at_((1));
  10009. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  10010. },
  10011. args: [],
  10012. source: "first\x0a\x09^ self at: 1",
  10013. referencedClasses: [],
  10014. messageSends: ["at:"]
  10015. }),
  10016. $globals.SequenceableCollection);
  10017. $core.addMethod(
  10018. $core.method({
  10019. selector: "first:",
  10020. protocol: "accessing",
  10021. fn: function (aNumber){
  10022. var self=this,$self=this;
  10023. return $core.withContext(function($ctx1) {
  10024. var $1;
  10025. $1=$recv($self._size()).__lt(aNumber);
  10026. if($core.assert($1)){
  10027. $self._error_("Invalid number of elements");
  10028. }
  10029. return $self._copyFrom_to_((1),aNumber);
  10030. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10031. },
  10032. args: ["aNumber"],
  10033. 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",
  10034. referencedClasses: [],
  10035. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  10036. }),
  10037. $globals.SequenceableCollection);
  10038. $core.addMethod(
  10039. $core.method({
  10040. selector: "fourth",
  10041. protocol: "accessing",
  10042. fn: function (){
  10043. var self=this,$self=this;
  10044. return $core.withContext(function($ctx1) {
  10045. return $self._at_((4));
  10046. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  10047. },
  10048. args: [],
  10049. source: "fourth\x0a\x09^ self at: 4",
  10050. referencedClasses: [],
  10051. messageSends: ["at:"]
  10052. }),
  10053. $globals.SequenceableCollection);
  10054. $core.addMethod(
  10055. $core.method({
  10056. selector: "includes:",
  10057. protocol: "testing",
  10058. fn: function (anObject){
  10059. var self=this,$self=this;
  10060. return $core.withContext(function($ctx1) {
  10061. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  10062. return nil;
  10063. })))._notNil();
  10064. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  10065. },
  10066. args: ["anObject"],
  10067. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  10068. referencedClasses: [],
  10069. messageSends: ["notNil", "indexOf:ifAbsent:"]
  10070. }),
  10071. $globals.SequenceableCollection);
  10072. $core.addMethod(
  10073. $core.method({
  10074. selector: "indexOf:startingAt:",
  10075. protocol: "accessing",
  10076. fn: function (anObject,start){
  10077. var self=this,$self=this;
  10078. return $core.withContext(function($ctx1) {
  10079. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  10080. return (0);
  10081. }));
  10082. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  10083. },
  10084. args: ["anObject", "start"],
  10085. 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 ]",
  10086. referencedClasses: [],
  10087. messageSends: ["indexOf:startingAt:ifAbsent:"]
  10088. }),
  10089. $globals.SequenceableCollection);
  10090. $core.addMethod(
  10091. $core.method({
  10092. selector: "indexOf:startingAt:ifAbsent:",
  10093. protocol: "accessing",
  10094. fn: function (anObject,start,aBlock){
  10095. var self=this,$self=this;
  10096. return $core.withContext(function($ctx1) {
  10097. $self._subclassResponsibility();
  10098. return self;
  10099. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  10100. },
  10101. args: ["anObject", "start", "aBlock"],
  10102. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  10103. referencedClasses: [],
  10104. messageSends: ["subclassResponsibility"]
  10105. }),
  10106. $globals.SequenceableCollection);
  10107. $core.addMethod(
  10108. $core.method({
  10109. selector: "last",
  10110. protocol: "accessing",
  10111. fn: function (){
  10112. var self=this,$self=this;
  10113. return $core.withContext(function($ctx1) {
  10114. return $self._at_($self._size());
  10115. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  10116. },
  10117. args: [],
  10118. source: "last\x0a\x09^ self at: self size",
  10119. referencedClasses: [],
  10120. messageSends: ["at:", "size"]
  10121. }),
  10122. $globals.SequenceableCollection);
  10123. $core.addMethod(
  10124. $core.method({
  10125. selector: "last:",
  10126. protocol: "accessing",
  10127. fn: function (aNumber){
  10128. var self=this,$self=this;
  10129. return $core.withContext(function($ctx1) {
  10130. var $2,$1,$5,$4,$3;
  10131. $2=$self._size();
  10132. $ctx1.sendIdx["size"]=1;
  10133. $1=$recv($2).__lt(aNumber);
  10134. if($core.assert($1)){
  10135. $self._error_("Invalid number of elements");
  10136. }
  10137. $5=$self._size();
  10138. $ctx1.sendIdx["size"]=2;
  10139. $4=$recv($5).__minus(aNumber);
  10140. $3=$recv($4).__plus((1));
  10141. return $self._copyFrom_to_($3,$self._size());
  10142. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10143. },
  10144. args: ["aNumber"],
  10145. 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",
  10146. referencedClasses: [],
  10147. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  10148. }),
  10149. $globals.SequenceableCollection);
  10150. $core.addMethod(
  10151. $core.method({
  10152. selector: "newStream",
  10153. protocol: "streaming",
  10154. fn: function (){
  10155. var self=this,$self=this;
  10156. return $core.withContext(function($ctx1) {
  10157. return $recv($self._streamClass())._on_(self);
  10158. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  10159. },
  10160. args: [],
  10161. source: "newStream\x0a\x09^ self streamClass on: self",
  10162. referencedClasses: [],
  10163. messageSends: ["on:", "streamClass"]
  10164. }),
  10165. $globals.SequenceableCollection);
  10166. $core.addMethod(
  10167. $core.method({
  10168. selector: "readStream",
  10169. protocol: "streaming",
  10170. fn: function (){
  10171. var self=this,$self=this;
  10172. return $core.withContext(function($ctx1) {
  10173. return $self._stream();
  10174. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  10175. },
  10176. args: [],
  10177. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10178. referencedClasses: [],
  10179. messageSends: ["stream"]
  10180. }),
  10181. $globals.SequenceableCollection);
  10182. $core.addMethod(
  10183. $core.method({
  10184. selector: "removeLast",
  10185. protocol: "adding/removing",
  10186. fn: function (){
  10187. var self=this,$self=this;
  10188. return $core.withContext(function($ctx1) {
  10189. return $self._remove_($self._last());
  10190. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  10191. },
  10192. args: [],
  10193. source: "removeLast\x0a\x09^ self remove: self last",
  10194. referencedClasses: [],
  10195. messageSends: ["remove:", "last"]
  10196. }),
  10197. $globals.SequenceableCollection);
  10198. $core.addMethod(
  10199. $core.method({
  10200. selector: "reverseDo:",
  10201. protocol: "enumerating",
  10202. fn: function (aBlock){
  10203. var self=this,$self=this;
  10204. return $core.withContext(function($ctx1) {
  10205. $recv($self._reversed())._do_(aBlock);
  10206. return self;
  10207. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10208. },
  10209. args: ["aBlock"],
  10210. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  10211. referencedClasses: [],
  10212. messageSends: ["do:", "reversed"]
  10213. }),
  10214. $globals.SequenceableCollection);
  10215. $core.addMethod(
  10216. $core.method({
  10217. selector: "reversed",
  10218. protocol: "converting",
  10219. fn: function (){
  10220. var self=this,$self=this;
  10221. return $core.withContext(function($ctx1) {
  10222. $self._subclassResponsibility();
  10223. return self;
  10224. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  10225. },
  10226. args: [],
  10227. source: "reversed\x0a\x09self subclassResponsibility",
  10228. referencedClasses: [],
  10229. messageSends: ["subclassResponsibility"]
  10230. }),
  10231. $globals.SequenceableCollection);
  10232. $core.addMethod(
  10233. $core.method({
  10234. selector: "second",
  10235. protocol: "accessing",
  10236. fn: function (){
  10237. var self=this,$self=this;
  10238. return $core.withContext(function($ctx1) {
  10239. return $self._at_((2));
  10240. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  10241. },
  10242. args: [],
  10243. source: "second\x0a\x09^ self at: 2",
  10244. referencedClasses: [],
  10245. messageSends: ["at:"]
  10246. }),
  10247. $globals.SequenceableCollection);
  10248. $core.addMethod(
  10249. $core.method({
  10250. selector: "stream",
  10251. protocol: "streaming",
  10252. fn: function (){
  10253. var self=this,$self=this;
  10254. return $core.withContext(function($ctx1) {
  10255. return $self._newStream();
  10256. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  10257. },
  10258. args: [],
  10259. source: "stream\x0a\x09^ self newStream",
  10260. referencedClasses: [],
  10261. messageSends: ["newStream"]
  10262. }),
  10263. $globals.SequenceableCollection);
  10264. $core.addMethod(
  10265. $core.method({
  10266. selector: "streamClass",
  10267. protocol: "streaming",
  10268. fn: function (){
  10269. var self=this,$self=this;
  10270. return $core.withContext(function($ctx1) {
  10271. return $recv($self._class())._streamClass();
  10272. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  10273. },
  10274. args: [],
  10275. source: "streamClass\x0a\x09^ self class streamClass",
  10276. referencedClasses: [],
  10277. messageSends: ["streamClass", "class"]
  10278. }),
  10279. $globals.SequenceableCollection);
  10280. $core.addMethod(
  10281. $core.method({
  10282. selector: "third",
  10283. protocol: "accessing",
  10284. fn: function (){
  10285. var self=this,$self=this;
  10286. return $core.withContext(function($ctx1) {
  10287. return $self._at_((3));
  10288. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  10289. },
  10290. args: [],
  10291. source: "third\x0a\x09^ self at: 3",
  10292. referencedClasses: [],
  10293. messageSends: ["at:"]
  10294. }),
  10295. $globals.SequenceableCollection);
  10296. $core.addMethod(
  10297. $core.method({
  10298. selector: "writeStream",
  10299. protocol: "streaming",
  10300. fn: function (){
  10301. var self=this,$self=this;
  10302. return $core.withContext(function($ctx1) {
  10303. return $self._stream();
  10304. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  10305. },
  10306. args: [],
  10307. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10308. referencedClasses: [],
  10309. messageSends: ["stream"]
  10310. }),
  10311. $globals.SequenceableCollection);
  10312. $core.addMethod(
  10313. $core.method({
  10314. selector: "streamClass",
  10315. protocol: "accessing",
  10316. fn: function (){
  10317. var self=this,$self=this;
  10318. return $globals.Stream;
  10319. },
  10320. args: [],
  10321. source: "streamClass\x0a\x09\x09^ Stream",
  10322. referencedClasses: ["Stream"],
  10323. messageSends: []
  10324. }),
  10325. $globals.SequenceableCollection.a$cls);
  10326. $core.addMethod(
  10327. $core.method({
  10328. selector: "streamContents:",
  10329. protocol: "streaming",
  10330. fn: function (aBlock){
  10331. var self=this,$self=this;
  10332. var stream;
  10333. return $core.withContext(function($ctx1) {
  10334. stream=$recv($self._streamClass())._on_($self._new());
  10335. $recv(aBlock)._value_(stream);
  10336. return $recv(stream)._contents();
  10337. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  10338. },
  10339. args: ["aBlock"],
  10340. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  10341. referencedClasses: [],
  10342. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  10343. }),
  10344. $globals.SequenceableCollection.a$cls);
  10345. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  10346. $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`.";
  10347. $core.addMethod(
  10348. $core.method({
  10349. selector: "add:",
  10350. protocol: "adding/removing",
  10351. fn: function (anObject){
  10352. var self=this,$self=this;
  10353. return $core.withContext(function($ctx1) {
  10354. self.push(anObject); return anObject;;
  10355. return self;
  10356. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  10357. },
  10358. args: ["anObject"],
  10359. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  10360. referencedClasses: [],
  10361. messageSends: []
  10362. }),
  10363. $globals.Array);
  10364. $core.addMethod(
  10365. $core.method({
  10366. selector: "addAll:",
  10367. protocol: "adding/removing",
  10368. fn: function (aCollection){
  10369. var self=this,$self=this;
  10370. return $core.withContext(function($ctx1) {
  10371. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  10372. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  10373. return aCollection;;
  10374. return self;
  10375. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  10376. },
  10377. args: ["aCollection"],
  10378. 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'>",
  10379. referencedClasses: [],
  10380. messageSends: []
  10381. }),
  10382. $globals.Array);
  10383. $core.addMethod(
  10384. $core.method({
  10385. selector: "addFirst:",
  10386. protocol: "adding/removing",
  10387. fn: function (anObject){
  10388. var self=this,$self=this;
  10389. return $core.withContext(function($ctx1) {
  10390. self.unshift(anObject); return anObject;;
  10391. return self;
  10392. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  10393. },
  10394. args: ["anObject"],
  10395. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  10396. referencedClasses: [],
  10397. messageSends: []
  10398. }),
  10399. $globals.Array);
  10400. $core.addMethod(
  10401. $core.method({
  10402. selector: "asJavaScriptSource",
  10403. protocol: "converting",
  10404. fn: function (){
  10405. var self=this,$self=this;
  10406. return $core.withContext(function($ctx1) {
  10407. var $1;
  10408. $1=$recv("[".__comma($recv($self._collect_((function(each){
  10409. return $core.withContext(function($ctx2) {
  10410. return $recv(each)._asJavaScriptSource();
  10411. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10412. })))._join_(", "))).__comma("]");
  10413. $ctx1.sendIdx[","]=1;
  10414. return $1;
  10415. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  10416. },
  10417. args: [],
  10418. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  10419. referencedClasses: [],
  10420. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  10421. }),
  10422. $globals.Array);
  10423. $core.addMethod(
  10424. $core.method({
  10425. selector: "at:put:",
  10426. protocol: "accessing",
  10427. fn: function (anIndex,anObject){
  10428. var self=this,$self=this;
  10429. return $core.withContext(function($ctx1) {
  10430. return self[anIndex - 1] = anObject;
  10431. return self;
  10432. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  10433. },
  10434. args: ["anIndex", "anObject"],
  10435. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  10436. referencedClasses: [],
  10437. messageSends: []
  10438. }),
  10439. $globals.Array);
  10440. $core.addMethod(
  10441. $core.method({
  10442. selector: "collect:",
  10443. protocol: "enumerating",
  10444. fn: function (aBlock){
  10445. var self=this,$self=this;
  10446. return $core.withContext(function($ctx1) {
  10447. return self.map(function(each) {return aBlock._value_(each)});
  10448. return self;
  10449. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  10450. },
  10451. args: ["aBlock"],
  10452. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  10453. referencedClasses: [],
  10454. messageSends: []
  10455. }),
  10456. $globals.Array);
  10457. $core.addMethod(
  10458. $core.method({
  10459. selector: "copyFrom:to:",
  10460. protocol: "copying",
  10461. fn: function (anIndex,anotherIndex){
  10462. var self=this,$self=this;
  10463. return $core.withContext(function($ctx1) {
  10464. if (anIndex >= 1 && anotherIndex <= self.length) {
  10465. return self.slice(anIndex - 1, anotherIndex);
  10466. } else {
  10467. self._at_(anIndex);
  10468. self._at_(self.length + 1);
  10469. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  10470. };
  10471. return self;
  10472. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  10473. },
  10474. args: ["anIndex", "anotherIndex"],
  10475. 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'>",
  10476. referencedClasses: [],
  10477. messageSends: []
  10478. }),
  10479. $globals.Array);
  10480. $core.addMethod(
  10481. $core.method({
  10482. selector: "join:",
  10483. protocol: "enumerating",
  10484. fn: function (aString){
  10485. var self=this,$self=this;
  10486. return $core.withContext(function($ctx1) {
  10487. return self.join(aString);
  10488. return self;
  10489. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  10490. },
  10491. args: ["aString"],
  10492. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  10493. referencedClasses: [],
  10494. messageSends: []
  10495. }),
  10496. $globals.Array);
  10497. $core.addMethod(
  10498. $core.method({
  10499. selector: "printOn:",
  10500. protocol: "printing",
  10501. fn: function (aStream){
  10502. var self=this,$self=this;
  10503. return $core.withContext(function($ctx1) {
  10504. (
  10505. $ctx1.supercall = true,
  10506. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  10507. $ctx1.supercall = false;
  10508. $ctx1.sendIdx["printOn:"]=1;
  10509. $recv(aStream)._nextPutAll_(" (");
  10510. $ctx1.sendIdx["nextPutAll:"]=1;
  10511. $self._do_separatedBy_((function(each){
  10512. return $core.withContext(function($ctx2) {
  10513. return $recv(each)._printOn_(aStream);
  10514. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10515. }),(function(){
  10516. return $core.withContext(function($ctx2) {
  10517. return $recv(aStream)._nextPutAll_(" ");
  10518. $ctx2.sendIdx["nextPutAll:"]=2;
  10519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10520. }));
  10521. $recv(aStream)._nextPutAll_(")");
  10522. return self;
  10523. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  10524. },
  10525. args: ["aStream"],
  10526. 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: ')'",
  10527. referencedClasses: [],
  10528. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  10529. }),
  10530. $globals.Array);
  10531. $core.addMethod(
  10532. $core.method({
  10533. selector: "remove:ifAbsent:",
  10534. protocol: "adding/removing",
  10535. fn: function (anObject,aBlock){
  10536. var self=this,$self=this;
  10537. var index;
  10538. return $core.withContext(function($ctx1) {
  10539. var $1;
  10540. index=$self._indexOf_ifAbsent_(anObject,(function(){
  10541. return (0);
  10542. }));
  10543. $1=$recv(index).__eq((0));
  10544. if($core.assert($1)){
  10545. return $recv(aBlock)._value();
  10546. } else {
  10547. $self._removeIndex_(index);
  10548. return anObject;
  10549. }
  10550. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  10551. },
  10552. args: ["anObject", "aBlock"],
  10553. 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 ]",
  10554. referencedClasses: [],
  10555. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  10556. }),
  10557. $globals.Array);
  10558. $core.addMethod(
  10559. $core.method({
  10560. selector: "removeAll",
  10561. protocol: "adding/removing",
  10562. fn: function (){
  10563. var self=this,$self=this;
  10564. return $core.withContext(function($ctx1) {
  10565. self.length = 0;
  10566. return self;
  10567. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  10568. },
  10569. args: [],
  10570. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  10571. referencedClasses: [],
  10572. messageSends: []
  10573. }),
  10574. $globals.Array);
  10575. $core.addMethod(
  10576. $core.method({
  10577. selector: "removeFrom:to:",
  10578. protocol: "adding/removing",
  10579. fn: function (aNumber,anotherNumber){
  10580. var self=this,$self=this;
  10581. return $core.withContext(function($ctx1) {
  10582. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  10583. return self;
  10584. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  10585. },
  10586. args: ["aNumber", "anotherNumber"],
  10587. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  10588. referencedClasses: [],
  10589. messageSends: []
  10590. }),
  10591. $globals.Array);
  10592. $core.addMethod(
  10593. $core.method({
  10594. selector: "removeIndex:",
  10595. protocol: "adding/removing",
  10596. fn: function (anInteger){
  10597. var self=this,$self=this;
  10598. return $core.withContext(function($ctx1) {
  10599. self.splice(anInteger - 1, 1);
  10600. return self;
  10601. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  10602. },
  10603. args: ["anInteger"],
  10604. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  10605. referencedClasses: [],
  10606. messageSends: []
  10607. }),
  10608. $globals.Array);
  10609. $core.addMethod(
  10610. $core.method({
  10611. selector: "removeLast",
  10612. protocol: "adding/removing",
  10613. fn: function (){
  10614. var self=this,$self=this;
  10615. return $core.withContext(function($ctx1) {
  10616. return self.pop();;
  10617. return self;
  10618. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  10619. },
  10620. args: [],
  10621. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  10622. referencedClasses: [],
  10623. messageSends: []
  10624. }),
  10625. $globals.Array);
  10626. $core.addMethod(
  10627. $core.method({
  10628. selector: "reversed",
  10629. protocol: "converting",
  10630. fn: function (){
  10631. var self=this,$self=this;
  10632. return $core.withContext(function($ctx1) {
  10633. return self.slice().reverse();
  10634. return self;
  10635. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  10636. },
  10637. args: [],
  10638. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  10639. referencedClasses: [],
  10640. messageSends: []
  10641. }),
  10642. $globals.Array);
  10643. $core.addMethod(
  10644. $core.method({
  10645. selector: "select:",
  10646. protocol: "enumerating",
  10647. fn: function (aBlock){
  10648. var self=this,$self=this;
  10649. return $core.withContext(function($ctx1) {
  10650. return self.filter(function(each) {return aBlock._value_(each)});
  10651. return self;
  10652. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  10653. },
  10654. args: ["aBlock"],
  10655. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  10656. referencedClasses: [],
  10657. messageSends: []
  10658. }),
  10659. $globals.Array);
  10660. $core.addMethod(
  10661. $core.method({
  10662. selector: "shallowCopy",
  10663. protocol: "copying",
  10664. fn: function (){
  10665. var self=this,$self=this;
  10666. return $core.withContext(function($ctx1) {
  10667. return self.slice();
  10668. return self;
  10669. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  10670. },
  10671. args: [],
  10672. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  10673. referencedClasses: [],
  10674. messageSends: []
  10675. }),
  10676. $globals.Array);
  10677. $core.addMethod(
  10678. $core.method({
  10679. selector: "sort",
  10680. protocol: "enumerating",
  10681. fn: function (){
  10682. var self=this,$self=this;
  10683. return $core.withContext(function($ctx1) {
  10684. return $self._sort_((function(a,b){
  10685. return $core.withContext(function($ctx2) {
  10686. return $recv(a).__lt(b);
  10687. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  10688. }));
  10689. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  10690. },
  10691. args: [],
  10692. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  10693. referencedClasses: [],
  10694. messageSends: ["sort:", "<"]
  10695. }),
  10696. $globals.Array);
  10697. $core.addMethod(
  10698. $core.method({
  10699. selector: "sort:",
  10700. protocol: "enumerating",
  10701. fn: function (aBlock){
  10702. var self=this,$self=this;
  10703. return $core.withContext(function($ctx1) {
  10704. return self.sort(function(a, b) {
  10705. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  10706. })
  10707. ;
  10708. return self;
  10709. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  10710. },
  10711. args: ["aBlock"],
  10712. 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'>",
  10713. referencedClasses: [],
  10714. messageSends: []
  10715. }),
  10716. $globals.Array);
  10717. $core.addMethod(
  10718. $core.method({
  10719. selector: "sorted",
  10720. protocol: "enumerating",
  10721. fn: function (){
  10722. var self=this,$self=this;
  10723. return $core.withContext(function($ctx1) {
  10724. return $recv($self._copy())._sort();
  10725. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  10726. },
  10727. args: [],
  10728. source: "sorted\x0a\x09^ self copy sort",
  10729. referencedClasses: [],
  10730. messageSends: ["sort", "copy"]
  10731. }),
  10732. $globals.Array);
  10733. $core.addMethod(
  10734. $core.method({
  10735. selector: "sorted:",
  10736. protocol: "enumerating",
  10737. fn: function (aBlock){
  10738. var self=this,$self=this;
  10739. return $core.withContext(function($ctx1) {
  10740. return $recv($self._copy())._sort_(aBlock);
  10741. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  10742. },
  10743. args: ["aBlock"],
  10744. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  10745. referencedClasses: [],
  10746. messageSends: ["sort:", "copy"]
  10747. }),
  10748. $globals.Array);
  10749. $core.addMethod(
  10750. $core.method({
  10751. selector: "new:",
  10752. protocol: "instance creation",
  10753. fn: function (anInteger){
  10754. var self=this,$self=this;
  10755. return $core.withContext(function($ctx1) {
  10756. return new Array(anInteger);
  10757. return self;
  10758. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  10759. },
  10760. args: ["anInteger"],
  10761. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  10762. referencedClasses: [],
  10763. messageSends: []
  10764. }),
  10765. $globals.Array.a$cls);
  10766. $core.addMethod(
  10767. $core.method({
  10768. selector: "with:",
  10769. protocol: "instance creation",
  10770. fn: function (anObject){
  10771. var self=this,$self=this;
  10772. return $core.withContext(function($ctx1) {
  10773. var $1;
  10774. $1=$self._new_((1));
  10775. $recv($1)._at_put_((1),anObject);
  10776. return $recv($1)._yourself();
  10777. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  10778. },
  10779. args: ["anObject"],
  10780. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  10781. referencedClasses: [],
  10782. messageSends: ["at:put:", "new:", "yourself"]
  10783. }),
  10784. $globals.Array.a$cls);
  10785. $core.addMethod(
  10786. $core.method({
  10787. selector: "with:with:",
  10788. protocol: "instance creation",
  10789. fn: function (anObject,anObject2){
  10790. var self=this,$self=this;
  10791. return $core.withContext(function($ctx1) {
  10792. var $1;
  10793. $1=$self._new_((2));
  10794. $recv($1)._at_put_((1),anObject);
  10795. $ctx1.sendIdx["at:put:"]=1;
  10796. $recv($1)._at_put_((2),anObject2);
  10797. return $recv($1)._yourself();
  10798. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  10799. },
  10800. args: ["anObject", "anObject2"],
  10801. 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",
  10802. referencedClasses: [],
  10803. messageSends: ["at:put:", "new:", "yourself"]
  10804. }),
  10805. $globals.Array.a$cls);
  10806. $core.addMethod(
  10807. $core.method({
  10808. selector: "with:with:with:",
  10809. protocol: "instance creation",
  10810. fn: function (anObject,anObject2,anObject3){
  10811. var self=this,$self=this;
  10812. return $core.withContext(function($ctx1) {
  10813. var $1;
  10814. $1=$self._new_((3));
  10815. $recv($1)._at_put_((1),anObject);
  10816. $ctx1.sendIdx["at:put:"]=1;
  10817. $recv($1)._at_put_((2),anObject2);
  10818. $ctx1.sendIdx["at:put:"]=2;
  10819. $recv($1)._at_put_((3),anObject3);
  10820. return $recv($1)._yourself();
  10821. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  10822. },
  10823. args: ["anObject", "anObject2", "anObject3"],
  10824. 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",
  10825. referencedClasses: [],
  10826. messageSends: ["at:put:", "new:", "yourself"]
  10827. }),
  10828. $globals.Array.a$cls);
  10829. $core.addMethod(
  10830. $core.method({
  10831. selector: "withAll:",
  10832. protocol: "instance creation",
  10833. fn: function (aCollection){
  10834. var self=this,$self=this;
  10835. var instance,index;
  10836. return $core.withContext(function($ctx1) {
  10837. index=(1);
  10838. instance=$self._new_($recv(aCollection)._size());
  10839. $recv(aCollection)._do_((function(each){
  10840. return $core.withContext(function($ctx2) {
  10841. $recv(instance)._at_put_(index,each);
  10842. index=$recv(index).__plus((1));
  10843. return index;
  10844. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10845. }));
  10846. return instance;
  10847. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  10848. },
  10849. args: ["aCollection"],
  10850. 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",
  10851. referencedClasses: [],
  10852. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  10853. }),
  10854. $globals.Array.a$cls);
  10855. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  10856. $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 >> #,`";
  10857. $core.addMethod(
  10858. $core.method({
  10859. selector: ",",
  10860. protocol: "copying",
  10861. fn: function (aString){
  10862. var self=this,$self=this;
  10863. return $core.withContext(function($ctx1) {
  10864. return String(self) + aString;
  10865. return self;
  10866. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  10867. },
  10868. args: ["aString"],
  10869. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  10870. referencedClasses: [],
  10871. messageSends: []
  10872. }),
  10873. $globals.String);
  10874. $core.addMethod(
  10875. $core.method({
  10876. selector: "<",
  10877. protocol: "comparing",
  10878. fn: function (aString){
  10879. var self=this,$self=this;
  10880. return $core.withContext(function($ctx1) {
  10881. return String(self) < aString._asString();
  10882. return self;
  10883. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  10884. },
  10885. args: ["aString"],
  10886. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  10887. referencedClasses: [],
  10888. messageSends: []
  10889. }),
  10890. $globals.String);
  10891. $core.addMethod(
  10892. $core.method({
  10893. selector: "<=",
  10894. protocol: "comparing",
  10895. fn: function (aString){
  10896. var self=this,$self=this;
  10897. return $core.withContext(function($ctx1) {
  10898. return String(self) <= aString._asString();
  10899. return self;
  10900. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  10901. },
  10902. args: ["aString"],
  10903. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  10904. referencedClasses: [],
  10905. messageSends: []
  10906. }),
  10907. $globals.String);
  10908. $core.addMethod(
  10909. $core.method({
  10910. selector: "=",
  10911. protocol: "comparing",
  10912. fn: function (aString){
  10913. var self=this,$self=this;
  10914. return $core.withContext(function($ctx1) {
  10915. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  10916. return self;
  10917. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  10918. },
  10919. args: ["aString"],
  10920. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  10921. referencedClasses: [],
  10922. messageSends: []
  10923. }),
  10924. $globals.String);
  10925. $core.addMethod(
  10926. $core.method({
  10927. selector: "==",
  10928. protocol: "comparing",
  10929. fn: function (aString){
  10930. var self=this,$self=this;
  10931. return $core.withContext(function($ctx1) {
  10932. if (typeof aString === "string") return String(self) === aString;
  10933. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  10934. else return false;;
  10935. return self;
  10936. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  10937. },
  10938. args: ["aString"],
  10939. 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'>",
  10940. referencedClasses: [],
  10941. messageSends: []
  10942. }),
  10943. $globals.String);
  10944. $core.addMethod(
  10945. $core.method({
  10946. selector: ">",
  10947. protocol: "comparing",
  10948. fn: function (aString){
  10949. var self=this,$self=this;
  10950. return $core.withContext(function($ctx1) {
  10951. return String(self) > aString._asString();
  10952. return self;
  10953. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  10954. },
  10955. args: ["aString"],
  10956. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  10957. referencedClasses: [],
  10958. messageSends: []
  10959. }),
  10960. $globals.String);
  10961. $core.addMethod(
  10962. $core.method({
  10963. selector: ">=",
  10964. protocol: "comparing",
  10965. fn: function (aString){
  10966. var self=this,$self=this;
  10967. return $core.withContext(function($ctx1) {
  10968. return String(self) >= aString._asString();
  10969. return self;
  10970. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  10971. },
  10972. args: ["aString"],
  10973. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  10974. referencedClasses: [],
  10975. messageSends: []
  10976. }),
  10977. $globals.String);
  10978. $core.addMethod(
  10979. $core.method({
  10980. selector: "add:",
  10981. protocol: "adding/removing",
  10982. fn: function (anObject){
  10983. var self=this,$self=this;
  10984. return $core.withContext(function($ctx1) {
  10985. $self._errorReadOnly();
  10986. return self;
  10987. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.String)});
  10988. },
  10989. args: ["anObject"],
  10990. source: "add: anObject\x0a\x09self errorReadOnly",
  10991. referencedClasses: [],
  10992. messageSends: ["errorReadOnly"]
  10993. }),
  10994. $globals.String);
  10995. $core.addMethod(
  10996. $core.method({
  10997. selector: "asJavaScriptMethodName",
  10998. protocol: "converting",
  10999. fn: function (){
  11000. var self=this,$self=this;
  11001. return $core.withContext(function($ctx1) {
  11002. return $core.st2js(self);
  11003. return self;
  11004. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  11005. },
  11006. args: [],
  11007. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  11008. referencedClasses: [],
  11009. messageSends: []
  11010. }),
  11011. $globals.String);
  11012. $core.addMethod(
  11013. $core.method({
  11014. selector: "asJavaScriptObject",
  11015. protocol: "converting",
  11016. fn: function (){
  11017. var self=this,$self=this;
  11018. return self;
  11019. },
  11020. args: [],
  11021. source: "asJavaScriptObject\x0a\x09^ self",
  11022. referencedClasses: [],
  11023. messageSends: []
  11024. }),
  11025. $globals.String);
  11026. $core.addMethod(
  11027. $core.method({
  11028. selector: "asJavaScriptSource",
  11029. protocol: "converting",
  11030. fn: function (){
  11031. var self=this,$self=this;
  11032. return $core.withContext(function($ctx1) {
  11033. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  11034. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  11035. else
  11036. return "\"" + self + "\"";
  11037. ;
  11038. return self;
  11039. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  11040. },
  11041. args: [],
  11042. 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'>",
  11043. referencedClasses: [],
  11044. messageSends: []
  11045. }),
  11046. $globals.String);
  11047. $core.addMethod(
  11048. $core.method({
  11049. selector: "asLowercase",
  11050. protocol: "converting",
  11051. fn: function (){
  11052. var self=this,$self=this;
  11053. return $core.withContext(function($ctx1) {
  11054. return self.toLowerCase();
  11055. return self;
  11056. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  11057. },
  11058. args: [],
  11059. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  11060. referencedClasses: [],
  11061. messageSends: []
  11062. }),
  11063. $globals.String);
  11064. $core.addMethod(
  11065. $core.method({
  11066. selector: "asMutator",
  11067. protocol: "converting",
  11068. fn: function (){
  11069. var self=this,$self=this;
  11070. return $core.withContext(function($ctx1) {
  11071. var $1;
  11072. $1=$recv($self._last()).__eq(":");
  11073. if(!$core.assert($1)){
  11074. return $self.__comma(":");
  11075. }
  11076. return self;
  11077. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  11078. },
  11079. args: [],
  11080. 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",
  11081. referencedClasses: [],
  11082. messageSends: ["ifFalse:", "=", "last", ","]
  11083. }),
  11084. $globals.String);
  11085. $core.addMethod(
  11086. $core.method({
  11087. selector: "asNumber",
  11088. protocol: "converting",
  11089. fn: function (){
  11090. var self=this,$self=this;
  11091. return $core.withContext(function($ctx1) {
  11092. return Number(self);
  11093. return self;
  11094. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  11095. },
  11096. args: [],
  11097. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  11098. referencedClasses: [],
  11099. messageSends: []
  11100. }),
  11101. $globals.String);
  11102. $core.addMethod(
  11103. $core.method({
  11104. selector: "asRegexp",
  11105. protocol: "converting",
  11106. fn: function (){
  11107. var self=this,$self=this;
  11108. return $core.withContext(function($ctx1) {
  11109. return $recv($globals.RegularExpression)._fromString_(self);
  11110. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  11111. },
  11112. args: [],
  11113. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11114. referencedClasses: ["RegularExpression"],
  11115. messageSends: ["fromString:"]
  11116. }),
  11117. $globals.String);
  11118. $core.addMethod(
  11119. $core.method({
  11120. selector: "asString",
  11121. protocol: "converting",
  11122. fn: function (){
  11123. var self=this,$self=this;
  11124. return self;
  11125. },
  11126. args: [],
  11127. source: "asString\x0a\x09^ self",
  11128. referencedClasses: [],
  11129. messageSends: []
  11130. }),
  11131. $globals.String);
  11132. $core.addMethod(
  11133. $core.method({
  11134. selector: "asSymbol",
  11135. protocol: "converting",
  11136. fn: function (){
  11137. var self=this,$self=this;
  11138. return self;
  11139. },
  11140. args: [],
  11141. source: "asSymbol\x0a\x09^ self",
  11142. referencedClasses: [],
  11143. messageSends: []
  11144. }),
  11145. $globals.String);
  11146. $core.addMethod(
  11147. $core.method({
  11148. selector: "asSymbolPrintOn:",
  11149. protocol: "printing",
  11150. fn: function (aStream){
  11151. var self=this,$self=this;
  11152. return $core.withContext(function($ctx1) {
  11153. var $1;
  11154. $recv(aStream)._nextPutAll_("#");
  11155. $1=$recv($self._asString())._isSelector();
  11156. if($core.assert($1)){
  11157. $recv(aStream)._nextPut_(self);
  11158. } else {
  11159. $self._printOn_(aStream);
  11160. }
  11161. return self;
  11162. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.String)});
  11163. },
  11164. args: ["aStream"],
  11165. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  11166. referencedClasses: [],
  11167. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  11168. }),
  11169. $globals.String);
  11170. $core.addMethod(
  11171. $core.method({
  11172. selector: "asUppercase",
  11173. protocol: "converting",
  11174. fn: function (){
  11175. var self=this,$self=this;
  11176. return $core.withContext(function($ctx1) {
  11177. return self.toUpperCase();
  11178. return self;
  11179. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  11180. },
  11181. args: [],
  11182. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  11183. referencedClasses: [],
  11184. messageSends: []
  11185. }),
  11186. $globals.String);
  11187. $core.addMethod(
  11188. $core.method({
  11189. selector: "asciiValue",
  11190. protocol: "accessing",
  11191. fn: function (){
  11192. var self=this,$self=this;
  11193. return $core.withContext(function($ctx1) {
  11194. return self.charCodeAt(0);;
  11195. return self;
  11196. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  11197. },
  11198. args: [],
  11199. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  11200. referencedClasses: [],
  11201. messageSends: []
  11202. }),
  11203. $globals.String);
  11204. $core.addMethod(
  11205. $core.method({
  11206. selector: "at:ifAbsent:",
  11207. protocol: "accessing",
  11208. fn: function (anIndex,aBlock){
  11209. var self=this,$self=this;
  11210. return $core.withContext(function($ctx1) {
  11211. return String(self)[anIndex - 1] || aBlock._value();
  11212. return self;
  11213. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  11214. },
  11215. args: ["anIndex", "aBlock"],
  11216. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  11217. referencedClasses: [],
  11218. messageSends: []
  11219. }),
  11220. $globals.String);
  11221. $core.addMethod(
  11222. $core.method({
  11223. selector: "at:ifPresent:ifAbsent:",
  11224. protocol: "accessing",
  11225. fn: function (anIndex,aBlock,anotherBlock){
  11226. var self=this,$self=this;
  11227. return $core.withContext(function($ctx1) {
  11228. var result = String(self)[anIndex - 1];
  11229. return result ? aBlock._value_(result) : anotherBlock._value();
  11230. ;
  11231. return self;
  11232. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  11233. },
  11234. args: ["anIndex", "aBlock", "anotherBlock"],
  11235. 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'>",
  11236. referencedClasses: [],
  11237. messageSends: []
  11238. }),
  11239. $globals.String);
  11240. $core.addMethod(
  11241. $core.method({
  11242. selector: "at:put:",
  11243. protocol: "accessing",
  11244. fn: function (anIndex,anObject){
  11245. var self=this,$self=this;
  11246. return $core.withContext(function($ctx1) {
  11247. $self._errorReadOnly();
  11248. return self;
  11249. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.String)});
  11250. },
  11251. args: ["anIndex", "anObject"],
  11252. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  11253. referencedClasses: [],
  11254. messageSends: ["errorReadOnly"]
  11255. }),
  11256. $globals.String);
  11257. $core.addMethod(
  11258. $core.method({
  11259. selector: "capitalized",
  11260. protocol: "converting",
  11261. fn: function (){
  11262. var self=this,$self=this;
  11263. return $core.withContext(function($ctx1) {
  11264. return $self._ifNotEmpty_((function(){
  11265. return $core.withContext(function($ctx2) {
  11266. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  11267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11268. }));
  11269. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  11270. },
  11271. args: [],
  11272. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  11273. referencedClasses: [],
  11274. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  11275. }),
  11276. $globals.String);
  11277. $core.addMethod(
  11278. $core.method({
  11279. selector: "charCodeAt:",
  11280. protocol: "accessing",
  11281. fn: function (anInteger){
  11282. var self=this,$self=this;
  11283. return $core.withContext(function($ctx1) {
  11284. return self.charCodeAt(anInteger - 1);
  11285. return self;
  11286. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  11287. },
  11288. args: ["anInteger"],
  11289. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  11290. referencedClasses: [],
  11291. messageSends: []
  11292. }),
  11293. $globals.String);
  11294. $core.addMethod(
  11295. $core.method({
  11296. selector: "copyFrom:to:",
  11297. protocol: "copying",
  11298. fn: function (anIndex,anotherIndex){
  11299. var self=this,$self=this;
  11300. return $core.withContext(function($ctx1) {
  11301. return self.substring(anIndex - 1, anotherIndex);
  11302. return self;
  11303. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  11304. },
  11305. args: ["anIndex", "anotherIndex"],
  11306. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  11307. referencedClasses: [],
  11308. messageSends: []
  11309. }),
  11310. $globals.String);
  11311. $core.addMethod(
  11312. $core.method({
  11313. selector: "crlfSanitized",
  11314. protocol: "converting",
  11315. fn: function (){
  11316. var self=this,$self=this;
  11317. return $core.withContext(function($ctx1) {
  11318. return $recv($self._lines())._join_($recv($globals.String)._lf());
  11319. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  11320. },
  11321. args: [],
  11322. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  11323. referencedClasses: ["String"],
  11324. messageSends: ["join:", "lines", "lf"]
  11325. }),
  11326. $globals.String);
  11327. $core.addMethod(
  11328. $core.method({
  11329. selector: "deepCopy",
  11330. protocol: "copying",
  11331. fn: function (){
  11332. var self=this,$self=this;
  11333. return $core.withContext(function($ctx1) {
  11334. return $self._shallowCopy();
  11335. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  11336. },
  11337. args: [],
  11338. source: "deepCopy\x0a\x09^ self shallowCopy",
  11339. referencedClasses: [],
  11340. messageSends: ["shallowCopy"]
  11341. }),
  11342. $globals.String);
  11343. $core.addMethod(
  11344. $core.method({
  11345. selector: "errorReadOnly",
  11346. protocol: "error handling",
  11347. fn: function (){
  11348. var self=this,$self=this;
  11349. return $core.withContext(function($ctx1) {
  11350. $self._error_("Object is read-only");
  11351. return self;
  11352. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.String)});
  11353. },
  11354. args: [],
  11355. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  11356. referencedClasses: [],
  11357. messageSends: ["error:"]
  11358. }),
  11359. $globals.String);
  11360. $core.addMethod(
  11361. $core.method({
  11362. selector: "escaped",
  11363. protocol: "converting",
  11364. fn: function (){
  11365. var self=this,$self=this;
  11366. return $core.withContext(function($ctx1) {
  11367. return escape(self);
  11368. return self;
  11369. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  11370. },
  11371. args: [],
  11372. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  11373. referencedClasses: [],
  11374. messageSends: []
  11375. }),
  11376. $globals.String);
  11377. $core.addMethod(
  11378. $core.method({
  11379. selector: "includesSubString:",
  11380. protocol: "testing",
  11381. fn: function (subString){
  11382. var self=this,$self=this;
  11383. return $core.withContext(function($ctx1) {
  11384. return self.indexOf(subString) != -1;
  11385. return self;
  11386. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  11387. },
  11388. args: ["subString"],
  11389. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  11390. referencedClasses: [],
  11391. messageSends: []
  11392. }),
  11393. $globals.String);
  11394. $core.addMethod(
  11395. $core.method({
  11396. selector: "isCapitalized",
  11397. protocol: "testing",
  11398. fn: function (){
  11399. var self=this,$self=this;
  11400. return $core.withContext(function($ctx1) {
  11401. var $2,$1;
  11402. $2=$self._first();
  11403. $ctx1.sendIdx["first"]=1;
  11404. $1=$recv($2)._asUppercase();
  11405. return $recv($1).__eq_eq($self._first());
  11406. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  11407. },
  11408. args: [],
  11409. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  11410. referencedClasses: [],
  11411. messageSends: ["==", "asUppercase", "first"]
  11412. }),
  11413. $globals.String);
  11414. $core.addMethod(
  11415. $core.method({
  11416. selector: "isImmutable",
  11417. protocol: "testing",
  11418. fn: function (){
  11419. var self=this,$self=this;
  11420. return true;
  11421. },
  11422. args: [],
  11423. source: "isImmutable\x0a\x09^ true",
  11424. referencedClasses: [],
  11425. messageSends: []
  11426. }),
  11427. $globals.String);
  11428. $core.addMethod(
  11429. $core.method({
  11430. selector: "isSelector",
  11431. protocol: "testing",
  11432. fn: function (){
  11433. var self=this,$self=this;
  11434. return $core.withContext(function($ctx1) {
  11435. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  11436. return self;
  11437. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  11438. },
  11439. args: [],
  11440. 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>",
  11441. referencedClasses: [],
  11442. messageSends: []
  11443. }),
  11444. $globals.String);
  11445. $core.addMethod(
  11446. $core.method({
  11447. selector: "isString",
  11448. protocol: "testing",
  11449. fn: function (){
  11450. var self=this,$self=this;
  11451. return true;
  11452. },
  11453. args: [],
  11454. source: "isString\x0a\x09^ true",
  11455. referencedClasses: [],
  11456. messageSends: []
  11457. }),
  11458. $globals.String);
  11459. $core.addMethod(
  11460. $core.method({
  11461. selector: "isVowel",
  11462. protocol: "testing",
  11463. fn: function (){
  11464. var self=this,$self=this;
  11465. return $core.withContext(function($ctx1) {
  11466. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  11467. return $core.withContext(function($ctx2) {
  11468. return "aeiou"._includes_($self._asLowercase());
  11469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11470. }));
  11471. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  11472. },
  11473. args: [],
  11474. 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 ]",
  11475. referencedClasses: [],
  11476. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  11477. }),
  11478. $globals.String);
  11479. $core.addMethod(
  11480. $core.method({
  11481. selector: "join:",
  11482. protocol: "split join",
  11483. fn: function (aCollection){
  11484. var self=this,$self=this;
  11485. return $core.withContext(function($ctx1) {
  11486. return $recv($globals.String)._streamContents_((function(stream){
  11487. return $core.withContext(function($ctx2) {
  11488. return $recv(aCollection)._do_separatedBy_((function(each){
  11489. return $core.withContext(function($ctx3) {
  11490. return $recv(stream)._nextPutAll_($recv(each)._asString());
  11491. $ctx3.sendIdx["nextPutAll:"]=1;
  11492. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  11493. }),(function(){
  11494. return $core.withContext(function($ctx3) {
  11495. return $recv(stream)._nextPutAll_(self);
  11496. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11497. }));
  11498. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  11499. }));
  11500. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  11501. },
  11502. args: ["aCollection"],
  11503. 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 ]]",
  11504. referencedClasses: ["String"],
  11505. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  11506. }),
  11507. $globals.String);
  11508. $core.addMethod(
  11509. $core.method({
  11510. selector: "lineIndicesDo:",
  11511. protocol: "split join",
  11512. fn: function (aBlock){
  11513. var self=this,$self=this;
  11514. var cr,lf,start,sz,nextLF,nextCR;
  11515. return $core.withContext(function($ctx1) {
  11516. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  11517. var $early={};
  11518. try {
  11519. start=(1);
  11520. sz=$self._size();
  11521. cr=$recv($globals.String)._cr();
  11522. nextCR=$self._indexOf_startingAt_(cr,(1));
  11523. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  11524. lf=$recv($globals.String)._lf();
  11525. nextLF=$self._indexOf_startingAt_(lf,(1));
  11526. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  11527. $recv((function(){
  11528. return $core.withContext(function($ctx2) {
  11529. return $recv(start).__lt_eq(sz);
  11530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11531. }))._whileTrue_((function(){
  11532. return $core.withContext(function($ctx2) {
  11533. $2=$recv(nextLF).__eq((0));
  11534. $ctx2.sendIdx["="]=1;
  11535. $1=$recv($2)._and_((function(){
  11536. return $core.withContext(function($ctx3) {
  11537. return $recv(nextCR).__eq((0));
  11538. $ctx3.sendIdx["="]=2;
  11539. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11540. }));
  11541. $ctx2.sendIdx["and:"]=1;
  11542. if($core.assert($1)){
  11543. $recv(aBlock)._value_value_value_(start,sz,sz);
  11544. $ctx2.sendIdx["value:value:value:"]=1;
  11545. throw $early=[self];
  11546. }
  11547. $4=$recv(nextCR).__eq((0));
  11548. $ctx2.sendIdx["="]=3;
  11549. $3=$recv($4)._or_((function(){
  11550. return $core.withContext(function($ctx3) {
  11551. $5=(0).__lt(nextLF);
  11552. $ctx3.sendIdx["<"]=1;
  11553. return $recv($5)._and_((function(){
  11554. return $core.withContext(function($ctx4) {
  11555. return $recv(nextLF).__lt(nextCR);
  11556. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  11557. }));
  11558. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  11559. }));
  11560. if($core.assert($3)){
  11561. $6=start;
  11562. $7=$recv(nextLF).__minus((1));
  11563. $ctx2.sendIdx["-"]=1;
  11564. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  11565. $ctx2.sendIdx["value:value:value:"]=2;
  11566. start=(1).__plus(nextLF);
  11567. $ctx2.sendIdx["+"]=1;
  11568. nextLF=$self._indexOf_startingAt_(lf,start);
  11569. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  11570. return nextLF;
  11571. } else {
  11572. $9=(1).__plus(nextCR);
  11573. $ctx2.sendIdx["+"]=2;
  11574. $8=$recv($9).__eq(nextLF);
  11575. if($core.assert($8)){
  11576. $10=start;
  11577. $11=$recv(nextCR).__minus((1));
  11578. $ctx2.sendIdx["-"]=2;
  11579. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  11580. $ctx2.sendIdx["value:value:value:"]=3;
  11581. start=(1).__plus(nextLF);
  11582. $ctx2.sendIdx["+"]=3;
  11583. nextCR=$self._indexOf_startingAt_(cr,start);
  11584. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  11585. nextLF=$self._indexOf_startingAt_(lf,start);
  11586. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  11587. return nextLF;
  11588. } else {
  11589. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  11590. start=(1).__plus(nextCR);
  11591. nextCR=$self._indexOf_startingAt_(cr,start);
  11592. return nextCR;
  11593. }
  11594. }
  11595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  11596. }));
  11597. return self;
  11598. }
  11599. catch(e) {if(e===$early)return e[0]; throw e}
  11600. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  11601. },
  11602. args: ["aBlock"],
  11603. 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 ] ]]",
  11604. referencedClasses: ["String"],
  11605. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  11606. }),
  11607. $globals.String);
  11608. $core.addMethod(
  11609. $core.method({
  11610. selector: "lineNumber:",
  11611. protocol: "split join",
  11612. fn: function (anIndex){
  11613. var self=this,$self=this;
  11614. var lineCount;
  11615. return $core.withContext(function($ctx1) {
  11616. var $2,$1;
  11617. var $early={};
  11618. try {
  11619. lineCount=(0);
  11620. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  11621. return $core.withContext(function($ctx2) {
  11622. lineCount=$recv(lineCount).__plus((1));
  11623. $2=lineCount;
  11624. $1=$recv($2).__eq(anIndex);
  11625. if($core.assert($1)){
  11626. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  11627. }
  11628. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  11629. }));
  11630. return nil;
  11631. }
  11632. catch(e) {if(e===$early)return e[0]; throw e}
  11633. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  11634. },
  11635. args: ["anIndex"],
  11636. 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",
  11637. referencedClasses: [],
  11638. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  11639. }),
  11640. $globals.String);
  11641. $core.addMethod(
  11642. $core.method({
  11643. selector: "lines",
  11644. protocol: "split join",
  11645. fn: function (){
  11646. var self=this,$self=this;
  11647. return $core.withContext(function($ctx1) {
  11648. var result = self.split(/\r\n|\r|\n/);
  11649. if (!result[result.length-1]) result.pop();
  11650. return result;;
  11651. return self;
  11652. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  11653. },
  11654. args: [],
  11655. 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'>",
  11656. referencedClasses: [],
  11657. messageSends: []
  11658. }),
  11659. $globals.String);
  11660. $core.addMethod(
  11661. $core.method({
  11662. selector: "linesDo:",
  11663. protocol: "split join",
  11664. fn: function (aBlock){
  11665. var self=this,$self=this;
  11666. return $core.withContext(function($ctx1) {
  11667. $recv($self._lines())._do_(aBlock);
  11668. return self;
  11669. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  11670. },
  11671. args: ["aBlock"],
  11672. 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",
  11673. referencedClasses: [],
  11674. messageSends: ["do:", "lines"]
  11675. }),
  11676. $globals.String);
  11677. $core.addMethod(
  11678. $core.method({
  11679. selector: "match:",
  11680. protocol: "regular expressions",
  11681. fn: function (aRegexp){
  11682. var self=this,$self=this;
  11683. return $core.withContext(function($ctx1) {
  11684. return self.search(aRegexp) != -1;
  11685. return self;
  11686. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  11687. },
  11688. args: ["aRegexp"],
  11689. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  11690. referencedClasses: [],
  11691. messageSends: []
  11692. }),
  11693. $globals.String);
  11694. $core.addMethod(
  11695. $core.method({
  11696. selector: "matchesOf:",
  11697. protocol: "regular expressions",
  11698. fn: function (aRegularExpression){
  11699. var self=this,$self=this;
  11700. return $core.withContext(function($ctx1) {
  11701. return self.match(aRegularExpression);
  11702. return self;
  11703. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  11704. },
  11705. args: ["aRegularExpression"],
  11706. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  11707. referencedClasses: [],
  11708. messageSends: []
  11709. }),
  11710. $globals.String);
  11711. $core.addMethod(
  11712. $core.method({
  11713. selector: "printNl",
  11714. protocol: "printing",
  11715. fn: function (){
  11716. var self=this,$self=this;
  11717. return $core.withContext(function($ctx1) {
  11718. console.log(self);
  11719. return self;
  11720. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  11721. },
  11722. args: [],
  11723. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  11724. referencedClasses: [],
  11725. messageSends: []
  11726. }),
  11727. $globals.String);
  11728. $core.addMethod(
  11729. $core.method({
  11730. selector: "printOn:",
  11731. protocol: "printing",
  11732. fn: function (aStream){
  11733. var self=this,$self=this;
  11734. return $core.withContext(function($ctx1) {
  11735. $recv(aStream)._nextPutAll_("'");
  11736. $ctx1.sendIdx["nextPutAll:"]=1;
  11737. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  11738. $ctx1.sendIdx["nextPutAll:"]=2;
  11739. $recv(aStream)._nextPutAll_("'");
  11740. return self;
  11741. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  11742. },
  11743. args: ["aStream"],
  11744. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  11745. referencedClasses: [],
  11746. messageSends: ["nextPutAll:", "replace:with:"]
  11747. }),
  11748. $globals.String);
  11749. $core.addMethod(
  11750. $core.method({
  11751. selector: "putOn:",
  11752. protocol: "streaming",
  11753. fn: function (aStream){
  11754. var self=this,$self=this;
  11755. return $core.withContext(function($ctx1) {
  11756. $recv(aStream)._nextPutString_(self);
  11757. return self;
  11758. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.String)});
  11759. },
  11760. args: ["aStream"],
  11761. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  11762. referencedClasses: [],
  11763. messageSends: ["nextPutString:"]
  11764. }),
  11765. $globals.String);
  11766. $core.addMethod(
  11767. $core.method({
  11768. selector: "remove:",
  11769. protocol: "adding/removing",
  11770. fn: function (anObject){
  11771. var self=this,$self=this;
  11772. return $core.withContext(function($ctx1) {
  11773. $self._errorReadOnly();
  11774. return self;
  11775. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.String)});
  11776. },
  11777. args: ["anObject"],
  11778. source: "remove: anObject\x0a\x09self errorReadOnly",
  11779. referencedClasses: [],
  11780. messageSends: ["errorReadOnly"]
  11781. }),
  11782. $globals.String);
  11783. $core.addMethod(
  11784. $core.method({
  11785. selector: "remove:ifAbsent:",
  11786. protocol: "adding/removing",
  11787. fn: function (anObject,aBlock){
  11788. var self=this,$self=this;
  11789. return $core.withContext(function($ctx1) {
  11790. $self._errorReadOnly();
  11791. return self;
  11792. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.String)});
  11793. },
  11794. args: ["anObject", "aBlock"],
  11795. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  11796. referencedClasses: [],
  11797. messageSends: ["errorReadOnly"]
  11798. }),
  11799. $globals.String);
  11800. $core.addMethod(
  11801. $core.method({
  11802. selector: "replace:with:",
  11803. protocol: "regular expressions",
  11804. fn: function (aString,anotherString){
  11805. var self=this,$self=this;
  11806. return $core.withContext(function($ctx1) {
  11807. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  11808. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  11809. },
  11810. args: ["aString", "anotherString"],
  11811. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  11812. referencedClasses: ["RegularExpression"],
  11813. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  11814. }),
  11815. $globals.String);
  11816. $core.addMethod(
  11817. $core.method({
  11818. selector: "replaceRegexp:with:",
  11819. protocol: "regular expressions",
  11820. fn: function (aRegexp,aString){
  11821. var self=this,$self=this;
  11822. return $core.withContext(function($ctx1) {
  11823. return self.replace(aRegexp, aString);
  11824. return self;
  11825. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  11826. },
  11827. args: ["aRegexp", "aString"],
  11828. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  11829. referencedClasses: [],
  11830. messageSends: []
  11831. }),
  11832. $globals.String);
  11833. $core.addMethod(
  11834. $core.method({
  11835. selector: "reversed",
  11836. protocol: "converting",
  11837. fn: function (){
  11838. var self=this,$self=this;
  11839. return $core.withContext(function($ctx1) {
  11840. return self.split("").reverse().join("");
  11841. return self;
  11842. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  11843. },
  11844. args: [],
  11845. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  11846. referencedClasses: [],
  11847. messageSends: []
  11848. }),
  11849. $globals.String);
  11850. $core.addMethod(
  11851. $core.method({
  11852. selector: "shallowCopy",
  11853. protocol: "copying",
  11854. fn: function (){
  11855. var self=this,$self=this;
  11856. return self;
  11857. },
  11858. args: [],
  11859. source: "shallowCopy\x0a\x09^ self",
  11860. referencedClasses: [],
  11861. messageSends: []
  11862. }),
  11863. $globals.String);
  11864. $core.addMethod(
  11865. $core.method({
  11866. selector: "subStrings:",
  11867. protocol: "split join",
  11868. fn: function (aString){
  11869. var self=this,$self=this;
  11870. return $core.withContext(function($ctx1) {
  11871. return $self._tokenize_(aString);
  11872. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  11873. },
  11874. args: ["aString"],
  11875. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  11876. referencedClasses: [],
  11877. messageSends: ["tokenize:"]
  11878. }),
  11879. $globals.String);
  11880. $core.addMethod(
  11881. $core.method({
  11882. selector: "symbolPrintString",
  11883. protocol: "printing",
  11884. fn: function (){
  11885. var self=this,$self=this;
  11886. return $core.withContext(function($ctx1) {
  11887. return $recv($globals.String)._streamContents_((function(str){
  11888. return $core.withContext(function($ctx2) {
  11889. return $self._asSymbolPrintOn_(str);
  11890. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  11891. }));
  11892. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.String)});
  11893. },
  11894. args: [],
  11895. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  11896. referencedClasses: ["String"],
  11897. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  11898. }),
  11899. $globals.String);
  11900. $core.addMethod(
  11901. $core.method({
  11902. selector: "tokenize:",
  11903. protocol: "split join",
  11904. fn: function (aString){
  11905. var self=this,$self=this;
  11906. return $core.withContext(function($ctx1) {
  11907. return self.split(aString);
  11908. return self;
  11909. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  11910. },
  11911. args: ["aString"],
  11912. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  11913. referencedClasses: [],
  11914. messageSends: []
  11915. }),
  11916. $globals.String);
  11917. $core.addMethod(
  11918. $core.method({
  11919. selector: "trimBoth",
  11920. protocol: "regular expressions",
  11921. fn: function (){
  11922. var self=this,$self=this;
  11923. return $core.withContext(function($ctx1) {
  11924. return $self._trimBoth_("\x5cs");
  11925. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  11926. },
  11927. args: [],
  11928. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  11929. referencedClasses: [],
  11930. messageSends: ["trimBoth:"]
  11931. }),
  11932. $globals.String);
  11933. $core.addMethod(
  11934. $core.method({
  11935. selector: "trimBoth:",
  11936. protocol: "regular expressions",
  11937. fn: function (separators){
  11938. var self=this,$self=this;
  11939. return $core.withContext(function($ctx1) {
  11940. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  11941. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  11942. },
  11943. args: ["separators"],
  11944. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  11945. referencedClasses: [],
  11946. messageSends: ["trimRight:", "trimLeft:"]
  11947. }),
  11948. $globals.String);
  11949. $core.addMethod(
  11950. $core.method({
  11951. selector: "trimLeft",
  11952. protocol: "regular expressions",
  11953. fn: function (){
  11954. var self=this,$self=this;
  11955. return $core.withContext(function($ctx1) {
  11956. return $self._trimLeft_("\x5cs");
  11957. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  11958. },
  11959. args: [],
  11960. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  11961. referencedClasses: [],
  11962. messageSends: ["trimLeft:"]
  11963. }),
  11964. $globals.String);
  11965. $core.addMethod(
  11966. $core.method({
  11967. selector: "trimLeft:",
  11968. protocol: "regular expressions",
  11969. fn: function (separators){
  11970. var self=this,$self=this;
  11971. return $core.withContext(function($ctx1) {
  11972. var $2,$1;
  11973. $2=$recv("^[".__comma(separators)).__comma("]+");
  11974. $ctx1.sendIdx[","]=1;
  11975. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  11976. return $self._replaceRegexp_with_($1,"");
  11977. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  11978. },
  11979. args: ["separators"],
  11980. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  11981. referencedClasses: ["RegularExpression"],
  11982. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  11983. }),
  11984. $globals.String);
  11985. $core.addMethod(
  11986. $core.method({
  11987. selector: "trimRight",
  11988. protocol: "regular expressions",
  11989. fn: function (){
  11990. var self=this,$self=this;
  11991. return $core.withContext(function($ctx1) {
  11992. return $self._trimRight_("\x5cs");
  11993. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  11994. },
  11995. args: [],
  11996. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  11997. referencedClasses: [],
  11998. messageSends: ["trimRight:"]
  11999. }),
  12000. $globals.String);
  12001. $core.addMethod(
  12002. $core.method({
  12003. selector: "trimRight:",
  12004. protocol: "regular expressions",
  12005. fn: function (separators){
  12006. var self=this,$self=this;
  12007. return $core.withContext(function($ctx1) {
  12008. var $2,$1;
  12009. $2=$recv("[".__comma(separators)).__comma("]+$");
  12010. $ctx1.sendIdx[","]=1;
  12011. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12012. return $self._replaceRegexp_with_($1,"");
  12013. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  12014. },
  12015. args: ["separators"],
  12016. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  12017. referencedClasses: ["RegularExpression"],
  12018. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12019. }),
  12020. $globals.String);
  12021. $core.addMethod(
  12022. $core.method({
  12023. selector: "unescaped",
  12024. protocol: "converting",
  12025. fn: function (){
  12026. var self=this,$self=this;
  12027. return $core.withContext(function($ctx1) {
  12028. return unescape(self);
  12029. return self;
  12030. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  12031. },
  12032. args: [],
  12033. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  12034. referencedClasses: [],
  12035. messageSends: []
  12036. }),
  12037. $globals.String);
  12038. $core.addMethod(
  12039. $core.method({
  12040. selector: "uriComponentDecoded",
  12041. protocol: "converting",
  12042. fn: function (){
  12043. var self=this,$self=this;
  12044. return $core.withContext(function($ctx1) {
  12045. return decodeURIComponent(self);
  12046. return self;
  12047. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  12048. },
  12049. args: [],
  12050. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  12051. referencedClasses: [],
  12052. messageSends: []
  12053. }),
  12054. $globals.String);
  12055. $core.addMethod(
  12056. $core.method({
  12057. selector: "uriComponentEncoded",
  12058. protocol: "converting",
  12059. fn: function (){
  12060. var self=this,$self=this;
  12061. return $core.withContext(function($ctx1) {
  12062. return encodeURIComponent(self);
  12063. return self;
  12064. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  12065. },
  12066. args: [],
  12067. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  12068. referencedClasses: [],
  12069. messageSends: []
  12070. }),
  12071. $globals.String);
  12072. $core.addMethod(
  12073. $core.method({
  12074. selector: "uriDecoded",
  12075. protocol: "converting",
  12076. fn: function (){
  12077. var self=this,$self=this;
  12078. return $core.withContext(function($ctx1) {
  12079. return decodeURI(self);
  12080. return self;
  12081. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  12082. },
  12083. args: [],
  12084. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  12085. referencedClasses: [],
  12086. messageSends: []
  12087. }),
  12088. $globals.String);
  12089. $core.addMethod(
  12090. $core.method({
  12091. selector: "uriEncoded",
  12092. protocol: "converting",
  12093. fn: function (){
  12094. var self=this,$self=this;
  12095. return $core.withContext(function($ctx1) {
  12096. return encodeURI(self);
  12097. return self;
  12098. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  12099. },
  12100. args: [],
  12101. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  12102. referencedClasses: [],
  12103. messageSends: []
  12104. }),
  12105. $globals.String);
  12106. $core.addMethod(
  12107. $core.method({
  12108. selector: "value:",
  12109. protocol: "evaluating",
  12110. fn: function (anObject){
  12111. var self=this,$self=this;
  12112. return $core.withContext(function($ctx1) {
  12113. return $recv(anObject)._perform_(self);
  12114. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  12115. },
  12116. args: ["anObject"],
  12117. source: "value: anObject \x0a\x09^ anObject perform: self",
  12118. referencedClasses: [],
  12119. messageSends: ["perform:"]
  12120. }),
  12121. $globals.String);
  12122. $core.addMethod(
  12123. $core.method({
  12124. selector: "cr",
  12125. protocol: "accessing",
  12126. fn: function (){
  12127. var self=this,$self=this;
  12128. return $core.withContext(function($ctx1) {
  12129. return "\r";
  12130. return self;
  12131. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  12132. },
  12133. args: [],
  12134. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  12135. referencedClasses: [],
  12136. messageSends: []
  12137. }),
  12138. $globals.String.a$cls);
  12139. $core.addMethod(
  12140. $core.method({
  12141. selector: "crlf",
  12142. protocol: "accessing",
  12143. fn: function (){
  12144. var self=this,$self=this;
  12145. return $core.withContext(function($ctx1) {
  12146. return "\r\n";
  12147. return self;
  12148. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  12149. },
  12150. args: [],
  12151. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  12152. referencedClasses: [],
  12153. messageSends: []
  12154. }),
  12155. $globals.String.a$cls);
  12156. $core.addMethod(
  12157. $core.method({
  12158. selector: "esc",
  12159. protocol: "accessing",
  12160. fn: function (){
  12161. var self=this,$self=this;
  12162. return $core.withContext(function($ctx1) {
  12163. return $self._fromCharCode_((27));
  12164. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  12165. },
  12166. args: [],
  12167. source: "esc\x0a\x09^ self fromCharCode: 27",
  12168. referencedClasses: [],
  12169. messageSends: ["fromCharCode:"]
  12170. }),
  12171. $globals.String.a$cls);
  12172. $core.addMethod(
  12173. $core.method({
  12174. selector: "fromCharCode:",
  12175. protocol: "instance creation",
  12176. fn: function (anInteger){
  12177. var self=this,$self=this;
  12178. return $core.withContext(function($ctx1) {
  12179. return String.fromCharCode(anInteger);
  12180. return self;
  12181. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  12182. },
  12183. args: ["anInteger"],
  12184. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  12185. referencedClasses: [],
  12186. messageSends: []
  12187. }),
  12188. $globals.String.a$cls);
  12189. $core.addMethod(
  12190. $core.method({
  12191. selector: "fromString:",
  12192. protocol: "instance creation",
  12193. fn: function (aString){
  12194. var self=this,$self=this;
  12195. return $core.withContext(function($ctx1) {
  12196. return String(aString);
  12197. return self;
  12198. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  12199. },
  12200. args: ["aString"],
  12201. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  12202. referencedClasses: [],
  12203. messageSends: []
  12204. }),
  12205. $globals.String.a$cls);
  12206. $core.addMethod(
  12207. $core.method({
  12208. selector: "lf",
  12209. protocol: "accessing",
  12210. fn: function (){
  12211. var self=this,$self=this;
  12212. return $core.withContext(function($ctx1) {
  12213. return "\n";
  12214. return self;
  12215. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  12216. },
  12217. args: [],
  12218. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  12219. referencedClasses: [],
  12220. messageSends: []
  12221. }),
  12222. $globals.String.a$cls);
  12223. $core.addMethod(
  12224. $core.method({
  12225. selector: "random",
  12226. protocol: "random",
  12227. fn: function (){
  12228. var self=this,$self=this;
  12229. return $core.withContext(function($ctx1) {
  12230. return ((10+22*Math.random())/32).toString(32).slice(2);;
  12231. return self;
  12232. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  12233. },
  12234. args: [],
  12235. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return ((10+22*Math.random())/32).toString(32).slice(2);'>",
  12236. referencedClasses: [],
  12237. messageSends: []
  12238. }),
  12239. $globals.String.a$cls);
  12240. $core.addMethod(
  12241. $core.method({
  12242. selector: "randomNotIn:",
  12243. protocol: "random",
  12244. fn: function (aString){
  12245. var self=this,$self=this;
  12246. var result;
  12247. return $core.withContext(function($ctx1) {
  12248. $recv((function(){
  12249. return $core.withContext(function($ctx2) {
  12250. result=$self._random();
  12251. return $recv(aString)._includesSubString_(result);
  12252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12253. }))._whileTrue();
  12254. return result;
  12255. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  12256. },
  12257. args: ["aString"],
  12258. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  12259. referencedClasses: [],
  12260. messageSends: ["whileTrue", "random", "includesSubString:"]
  12261. }),
  12262. $globals.String.a$cls);
  12263. $core.addMethod(
  12264. $core.method({
  12265. selector: "space",
  12266. protocol: "accessing",
  12267. fn: function (){
  12268. var self=this,$self=this;
  12269. return $core.withContext(function($ctx1) {
  12270. return " ";
  12271. return self;
  12272. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  12273. },
  12274. args: [],
  12275. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  12276. referencedClasses: [],
  12277. messageSends: []
  12278. }),
  12279. $globals.String.a$cls);
  12280. $core.addMethod(
  12281. $core.method({
  12282. selector: "streamClass",
  12283. protocol: "accessing",
  12284. fn: function (){
  12285. var self=this,$self=this;
  12286. return $globals.StringStream;
  12287. },
  12288. args: [],
  12289. source: "streamClass\x0a\x09\x09^ StringStream",
  12290. referencedClasses: ["StringStream"],
  12291. messageSends: []
  12292. }),
  12293. $globals.String.a$cls);
  12294. $core.addMethod(
  12295. $core.method({
  12296. selector: "tab",
  12297. protocol: "accessing",
  12298. fn: function (){
  12299. var self=this,$self=this;
  12300. return $core.withContext(function($ctx1) {
  12301. return "\t";
  12302. return self;
  12303. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  12304. },
  12305. args: [],
  12306. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  12307. referencedClasses: [],
  12308. messageSends: []
  12309. }),
  12310. $globals.String.a$cls);
  12311. $core.addMethod(
  12312. $core.method({
  12313. selector: "value:",
  12314. protocol: "instance creation",
  12315. fn: function (aUTFCharCode){
  12316. var self=this,$self=this;
  12317. return $core.withContext(function($ctx1) {
  12318. return String.fromCharCode(aUTFCharCode);;
  12319. return self;
  12320. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  12321. },
  12322. args: ["aUTFCharCode"],
  12323. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  12324. referencedClasses: [],
  12325. messageSends: []
  12326. }),
  12327. $globals.String.a$cls);
  12328. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  12329. $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`.";
  12330. $core.addMethod(
  12331. $core.method({
  12332. selector: "=",
  12333. protocol: "comparing",
  12334. fn: function (aCollection){
  12335. var self=this,$self=this;
  12336. return $core.withContext(function($ctx1) {
  12337. var $2,$1,$4,$3,$5;
  12338. var $early={};
  12339. try {
  12340. $2=$self._class();
  12341. $ctx1.sendIdx["class"]=1;
  12342. $1=$recv($2).__eq($recv(aCollection)._class());
  12343. $ctx1.sendIdx["="]=1;
  12344. if(!$core.assert($1)){
  12345. return false;
  12346. }
  12347. $4=$self._size();
  12348. $ctx1.sendIdx["size"]=1;
  12349. $3=$recv($4).__eq($recv(aCollection)._size());
  12350. if(!$core.assert($3)){
  12351. return false;
  12352. }
  12353. $self._do_((function(each){
  12354. return $core.withContext(function($ctx2) {
  12355. $5=$recv(aCollection)._includes_(each);
  12356. if(!$core.assert($5)){
  12357. throw $early=[false];
  12358. }
  12359. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  12360. }));
  12361. return true;
  12362. }
  12363. catch(e) {if(e===$early)return e[0]; throw e}
  12364. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  12365. },
  12366. args: ["aCollection"],
  12367. 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",
  12368. referencedClasses: [],
  12369. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  12370. }),
  12371. $globals.Set);
  12372. $core.addMethod(
  12373. $core.method({
  12374. selector: "add:",
  12375. protocol: "adding/removing",
  12376. fn: function (anObject){
  12377. var self=this,$self=this;
  12378. var bucket;
  12379. return $core.withContext(function($ctx1) {
  12380. var $1,$receiver;
  12381. bucket=$self._bucketsOfElement_(anObject);
  12382. $1=$recv(bucket)._second();
  12383. if(($receiver = $1) == null || $receiver.a$nil){
  12384. var object,slowBucket;
  12385. object=$recv(bucket)._first();
  12386. $ctx1.sendIdx["first"]=1;
  12387. slowBucket=$recv(bucket)._third();
  12388. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  12389. return $core.withContext(function($ctx2) {
  12390. $recv(slowBucket)._add_(object);
  12391. $self.size=$recv($self.size).__plus((1));
  12392. return $self.size;
  12393. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12394. }));
  12395. return object;
  12396. } else {
  12397. var primitiveBucket;
  12398. primitiveBucket=$receiver;
  12399. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  12400. }
  12401. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12402. },
  12403. args: ["anObject"],
  12404. 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 ]",
  12405. referencedClasses: [],
  12406. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  12407. }),
  12408. $globals.Set);
  12409. $core.addMethod(
  12410. $core.method({
  12411. selector: "add:in:",
  12412. protocol: "private",
  12413. fn: function (anObject,anotherObject){
  12414. var self=this,$self=this;
  12415. return $core.withContext(function($ctx1) {
  12416. if (anObject in anotherObject.store) { return anObject; }
  12417. $self.size++;
  12418. anotherObject.store[anObject] = true;
  12419. return anObject;
  12420. ;
  12421. return self;
  12422. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12423. },
  12424. args: ["anObject", "anotherObject"],
  12425. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return anObject; }\x0a\x09\x09$self.size++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  12426. referencedClasses: [],
  12427. messageSends: []
  12428. }),
  12429. $globals.Set);
  12430. $core.addMethod(
  12431. $core.method({
  12432. selector: "bucketsOfElement:",
  12433. protocol: "private",
  12434. fn: function (anObject){
  12435. var self=this,$self=this;
  12436. return $core.withContext(function($ctx1) {
  12437. // include nil to well-known objects under "boolean" fastBucket
  12438. if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];
  12439. var prim = anObject.valueOf();
  12440. if (typeof prim === "object" || typeof prim === "function" || !$self.fastBuckets[typeof prim]) {
  12441. var bucket = null;
  12442. $self.slowBucketStores.some(function (store) {
  12443. return bucket = store._bucketOfElement_(anObject);
  12444. });
  12445. return [ anObject, null, bucket || $self.defaultBucket ];
  12446. }
  12447. return [ prim, $self.fastBuckets[typeof prim] ];
  12448. ;
  12449. return self;
  12450. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  12451. },
  12452. args: ["anObject"],
  12453. 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'>",
  12454. referencedClasses: [],
  12455. messageSends: []
  12456. }),
  12457. $globals.Set);
  12458. $core.addMethod(
  12459. $core.method({
  12460. selector: "classNameOf:",
  12461. protocol: "private",
  12462. fn: function (anObject){
  12463. var self=this,$self=this;
  12464. return $core.withContext(function($ctx1) {
  12465. return anObject.a$cls != null && anObject.a$cls.name;
  12466. return self;
  12467. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  12468. },
  12469. args: ["anObject"],
  12470. 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'>",
  12471. referencedClasses: [],
  12472. messageSends: []
  12473. }),
  12474. $globals.Set);
  12475. $core.addMethod(
  12476. $core.method({
  12477. selector: "collect:",
  12478. protocol: "enumerating",
  12479. fn: function (aBlock){
  12480. var self=this,$self=this;
  12481. var collection;
  12482. return $core.withContext(function($ctx1) {
  12483. collection=$recv($self._class())._new();
  12484. $self._do_((function(each){
  12485. return $core.withContext(function($ctx2) {
  12486. return $recv(collection)._add_($recv(aBlock)._value_(each));
  12487. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12488. }));
  12489. return collection;
  12490. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12491. },
  12492. args: ["aBlock"],
  12493. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  12494. referencedClasses: [],
  12495. messageSends: ["new", "class", "do:", "add:", "value:"]
  12496. }),
  12497. $globals.Set);
  12498. $core.addMethod(
  12499. $core.method({
  12500. selector: "do:",
  12501. protocol: "enumerating",
  12502. fn: function (aBlock){
  12503. var self=this,$self=this;
  12504. return $core.withContext(function($ctx1) {
  12505. var el, keys, i;
  12506. el = $self.fastBuckets;
  12507. keys = Object.keys(el);
  12508. for (i = 0; i < keys.length; ++i) {
  12509. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  12510. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  12511. else { store._do_(aBlock); }
  12512. }
  12513. el = $self.slowBucketStores;
  12514. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  12515. $self.defaultBucket._do_(aBlock);
  12516. ;
  12517. return self;
  12518. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  12519. },
  12520. args: ["aBlock"],
  12521. 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'>",
  12522. referencedClasses: [],
  12523. messageSends: []
  12524. }),
  12525. $globals.Set);
  12526. $core.addMethod(
  12527. $core.method({
  12528. selector: "includes:",
  12529. protocol: "testing",
  12530. fn: function (anObject){
  12531. var self=this,$self=this;
  12532. var bucket;
  12533. return $core.withContext(function($ctx1) {
  12534. var $1,$2,$3,$receiver;
  12535. bucket=$self._bucketsOfElement_(anObject);
  12536. $1=$recv(bucket)._second();
  12537. if(($receiver = $1) == null || $receiver.a$nil){
  12538. $2=$recv(bucket)._third();
  12539. $3=$recv(bucket)._first();
  12540. $ctx1.sendIdx["first"]=1;
  12541. return $recv($2)._includes_($3);
  12542. } else {
  12543. var primitiveBucket;
  12544. primitiveBucket=$receiver;
  12545. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  12546. }
  12547. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12548. },
  12549. args: ["anObject"],
  12550. 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 ]",
  12551. referencedClasses: [],
  12552. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  12553. }),
  12554. $globals.Set);
  12555. $core.addMethod(
  12556. $core.method({
  12557. selector: "includes:in:",
  12558. protocol: "private",
  12559. fn: function (anObject,anotherObject){
  12560. var self=this,$self=this;
  12561. return $core.withContext(function($ctx1) {
  12562. return anObject in anotherObject.store;
  12563. return self;
  12564. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12565. },
  12566. args: ["anObject", "anotherObject"],
  12567. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  12568. referencedClasses: [],
  12569. messageSends: []
  12570. }),
  12571. $globals.Set);
  12572. $core.addMethod(
  12573. $core.method({
  12574. selector: "initialize",
  12575. protocol: "initialization",
  12576. fn: function (){
  12577. var self=this,$self=this;
  12578. return $core.withContext(function($ctx1) {
  12579. (
  12580. $ctx1.supercall = true,
  12581. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  12582. $ctx1.supercall = false;
  12583. $self.defaultBucket=[];
  12584. $self._initializeSlowBucketStores();
  12585. $self._removeAll();
  12586. return self;
  12587. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  12588. },
  12589. args: [],
  12590. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  12591. referencedClasses: [],
  12592. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  12593. }),
  12594. $globals.Set);
  12595. $core.addMethod(
  12596. $core.method({
  12597. selector: "initializeSlowBucketStores",
  12598. protocol: "initialization",
  12599. fn: function (){
  12600. var self=this,$self=this;
  12601. return $core.withContext(function($ctx1) {
  12602. var $1;
  12603. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  12604. return $core.withContext(function($ctx2) {
  12605. return $self._classNameOf_(x);
  12606. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  12607. }));
  12608. $ctx1.sendIdx["hashBlock:"]=1;
  12609. $self.slowBucketStores=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  12610. return $core.withContext(function($ctx2) {
  12611. return $self._jsConstructorNameOf_(x);
  12612. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  12613. }))];
  12614. return self;
  12615. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  12616. },
  12617. args: [],
  12618. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  12619. referencedClasses: ["ArrayBucketStore"],
  12620. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  12621. }),
  12622. $globals.Set);
  12623. $core.addMethod(
  12624. $core.method({
  12625. selector: "jsConstructorNameOf:",
  12626. protocol: "private",
  12627. fn: function (anObject){
  12628. var self=this,$self=this;
  12629. return $core.withContext(function($ctx1) {
  12630. return anObject.constructor && anObject.constructor.name;
  12631. return self;
  12632. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  12633. },
  12634. args: ["anObject"],
  12635. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  12636. referencedClasses: [],
  12637. messageSends: []
  12638. }),
  12639. $globals.Set);
  12640. $core.addMethod(
  12641. $core.method({
  12642. selector: "printOn:",
  12643. protocol: "printing",
  12644. fn: function (aStream){
  12645. var self=this,$self=this;
  12646. return $core.withContext(function($ctx1) {
  12647. (
  12648. $ctx1.supercall = true,
  12649. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  12650. $ctx1.supercall = false;
  12651. $ctx1.sendIdx["printOn:"]=1;
  12652. $recv(aStream)._nextPutAll_(" (");
  12653. $ctx1.sendIdx["nextPutAll:"]=1;
  12654. $self._do_separatedBy_((function(each){
  12655. return $core.withContext(function($ctx2) {
  12656. return $recv(each)._printOn_(aStream);
  12657. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12658. }),(function(){
  12659. return $core.withContext(function($ctx2) {
  12660. return $recv(aStream)._nextPutAll_(" ");
  12661. $ctx2.sendIdx["nextPutAll:"]=2;
  12662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12663. }));
  12664. $recv(aStream)._nextPutAll_(")");
  12665. return self;
  12666. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  12667. },
  12668. args: ["aStream"],
  12669. 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: ')'",
  12670. referencedClasses: [],
  12671. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  12672. }),
  12673. $globals.Set);
  12674. $core.addMethod(
  12675. $core.method({
  12676. selector: "remove:ifAbsent:",
  12677. protocol: "adding/removing",
  12678. fn: function (anObject,aBlock){
  12679. var self=this,$self=this;
  12680. var bucket;
  12681. return $core.withContext(function($ctx1) {
  12682. var $1,$2,$3,$receiver;
  12683. var $early={};
  12684. try {
  12685. bucket=$self._bucketsOfElement_(anObject);
  12686. $1=$recv(bucket)._second();
  12687. if(($receiver = $1) == null || $receiver.a$nil){
  12688. $2=$recv(bucket)._third();
  12689. $3=$recv(bucket)._first();
  12690. $ctx1.sendIdx["first"]=1;
  12691. $recv($2)._remove_ifAbsent_($3,(function(){
  12692. return $core.withContext(function($ctx2) {
  12693. throw $early=[$recv(aBlock)._value()];
  12694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12695. }));
  12696. $self.size=$recv($self.size).__minus((1));
  12697. return $self.size;
  12698. } else {
  12699. var primitiveBucket;
  12700. primitiveBucket=$receiver;
  12701. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  12702. }
  12703. }
  12704. catch(e) {if(e===$early)return e[0]; throw e}
  12705. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  12706. },
  12707. args: ["anObject", "aBlock"],
  12708. 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 ifAbsent: aBlock ]",
  12709. referencedClasses: [],
  12710. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:ifAbsent:"]
  12711. }),
  12712. $globals.Set);
  12713. $core.addMethod(
  12714. $core.method({
  12715. selector: "remove:in:ifAbsent:",
  12716. protocol: "private",
  12717. fn: function (anObject,anotherObject,aBlock){
  12718. var self=this,$self=this;
  12719. return $core.withContext(function($ctx1) {
  12720. if (anObject in anotherObject.store) {
  12721. delete anotherObject.store[anObject];
  12722. $self.size--;
  12723. return anObject;
  12724. } else {
  12725. return aBlock._value();
  12726. };
  12727. return self;
  12728. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock},$globals.Set)});
  12729. },
  12730. args: ["anObject", "anotherObject", "aBlock"],
  12731. source: "remove: anObject in: anotherObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) {\x0a\x09\x09\x09delete anotherObject.store[anObject];\x0a\x09\x09\x09$self.size--;\x0a\x09\x09\x09return anObject;\x0a\x09\x09} else {\x0a\x09\x09\x09return aBlock._value();\x0a\x09\x09}'>",
  12732. referencedClasses: [],
  12733. messageSends: []
  12734. }),
  12735. $globals.Set);
  12736. $core.addMethod(
  12737. $core.method({
  12738. selector: "removeAll",
  12739. protocol: "adding/removing",
  12740. fn: function (){
  12741. var self=this,$self=this;
  12742. return $core.withContext(function($ctx1) {
  12743. $self.fastBuckets = {
  12744. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  12745. "number": { store: Object.create(null), fn: Number },
  12746. "string": { store: Object.create(null) }
  12747. };
  12748. $self.slowBucketStores.forEach(function (x) { x._removeAll(); });
  12749. $self.defaultBucket._removeAll();
  12750. $self.size = 0;
  12751. ;
  12752. return self;
  12753. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  12754. },
  12755. args: [],
  12756. 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'>",
  12757. referencedClasses: [],
  12758. messageSends: []
  12759. }),
  12760. $globals.Set);
  12761. $core.addMethod(
  12762. $core.method({
  12763. selector: "select:",
  12764. protocol: "enumerating",
  12765. fn: function (aBlock){
  12766. var self=this,$self=this;
  12767. var collection;
  12768. return $core.withContext(function($ctx1) {
  12769. var $1;
  12770. collection=$recv($self._class())._new();
  12771. $self._do_((function(each){
  12772. return $core.withContext(function($ctx2) {
  12773. $1=$recv(aBlock)._value_(each);
  12774. if($core.assert($1)){
  12775. return $recv(collection)._add_(each);
  12776. }
  12777. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12778. }));
  12779. return collection;
  12780. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12781. },
  12782. args: ["aBlock"],
  12783. 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",
  12784. referencedClasses: [],
  12785. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12786. }),
  12787. $globals.Set);
  12788. $core.addMethod(
  12789. $core.method({
  12790. selector: "select:thenCollect:",
  12791. protocol: "enumerating",
  12792. fn: function (selectBlock,collectBlock){
  12793. var self=this,$self=this;
  12794. var collection;
  12795. return $core.withContext(function($ctx1) {
  12796. var $1;
  12797. collection=$recv($self._class())._new();
  12798. $self._do_((function(each){
  12799. return $core.withContext(function($ctx2) {
  12800. $1=$recv(selectBlock)._value_(each);
  12801. $ctx2.sendIdx["value:"]=1;
  12802. if($core.assert($1)){
  12803. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  12804. }
  12805. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12806. }));
  12807. return collection;
  12808. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  12809. },
  12810. args: ["selectBlock", "collectBlock"],
  12811. 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",
  12812. referencedClasses: [],
  12813. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12814. }),
  12815. $globals.Set);
  12816. $core.addMethod(
  12817. $core.method({
  12818. selector: "size",
  12819. protocol: "accessing",
  12820. fn: function (){
  12821. var self=this,$self=this;
  12822. return $self.size;
  12823. },
  12824. args: [],
  12825. source: "size\x0a\x09^ size",
  12826. referencedClasses: [],
  12827. messageSends: []
  12828. }),
  12829. $globals.Set);
  12830. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  12831. $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.";
  12832. $core.addMethod(
  12833. $core.method({
  12834. selector: "<<",
  12835. protocol: "writing",
  12836. fn: function (anObject){
  12837. var self=this,$self=this;
  12838. return $core.withContext(function($ctx1) {
  12839. $self._write_(anObject);
  12840. return self;
  12841. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  12842. },
  12843. args: ["anObject"],
  12844. source: "<< anObject\x0a\x09self write: anObject",
  12845. referencedClasses: [],
  12846. messageSends: ["write:"]
  12847. }),
  12848. $globals.ProtoStream);
  12849. $core.addMethod(
  12850. $core.method({
  12851. selector: "atEnd",
  12852. protocol: "testing",
  12853. fn: function (){
  12854. var self=this,$self=this;
  12855. return $core.withContext(function($ctx1) {
  12856. $self._subclassResponsibility();
  12857. return self;
  12858. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  12859. },
  12860. args: [],
  12861. source: "atEnd\x0a\x09self subclassResponsibility",
  12862. referencedClasses: [],
  12863. messageSends: ["subclassResponsibility"]
  12864. }),
  12865. $globals.ProtoStream);
  12866. $core.addMethod(
  12867. $core.method({
  12868. selector: "atStart",
  12869. protocol: "testing",
  12870. fn: function (){
  12871. var self=this,$self=this;
  12872. return $core.withContext(function($ctx1) {
  12873. $self._subclassResponsibility();
  12874. return self;
  12875. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  12876. },
  12877. args: [],
  12878. source: "atStart\x0a\x09self subclassResponsibility",
  12879. referencedClasses: [],
  12880. messageSends: ["subclassResponsibility"]
  12881. }),
  12882. $globals.ProtoStream);
  12883. $core.addMethod(
  12884. $core.method({
  12885. selector: "contents",
  12886. protocol: "accessing",
  12887. fn: function (){
  12888. var self=this,$self=this;
  12889. return $core.withContext(function($ctx1) {
  12890. $self._subclassResponsibility();
  12891. return self;
  12892. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  12893. },
  12894. args: [],
  12895. source: "contents\x0a\x09self subclassResponsibility",
  12896. referencedClasses: [],
  12897. messageSends: ["subclassResponsibility"]
  12898. }),
  12899. $globals.ProtoStream);
  12900. $core.addMethod(
  12901. $core.method({
  12902. selector: "do:",
  12903. protocol: "enumerating",
  12904. fn: function (aBlock){
  12905. var self=this,$self=this;
  12906. return $core.withContext(function($ctx1) {
  12907. $recv((function(){
  12908. return $core.withContext(function($ctx2) {
  12909. return $self._atEnd();
  12910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12911. }))._whileFalse_((function(){
  12912. return $core.withContext(function($ctx2) {
  12913. return $recv(aBlock)._value_($self._next());
  12914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12915. }));
  12916. return self;
  12917. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  12918. },
  12919. args: ["aBlock"],
  12920. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  12921. referencedClasses: [],
  12922. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  12923. }),
  12924. $globals.ProtoStream);
  12925. $core.addMethod(
  12926. $core.method({
  12927. selector: "isEmpty",
  12928. protocol: "testing",
  12929. fn: function (){
  12930. var self=this,$self=this;
  12931. return $core.withContext(function($ctx1) {
  12932. return $recv($self._atStart())._and_((function(){
  12933. return $core.withContext(function($ctx2) {
  12934. return $self._atEnd();
  12935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12936. }));
  12937. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  12938. },
  12939. args: [],
  12940. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  12941. referencedClasses: [],
  12942. messageSends: ["and:", "atStart", "atEnd"]
  12943. }),
  12944. $globals.ProtoStream);
  12945. $core.addMethod(
  12946. $core.method({
  12947. selector: "next",
  12948. protocol: "reading",
  12949. fn: function (){
  12950. var self=this,$self=this;
  12951. return $core.withContext(function($ctx1) {
  12952. var $1;
  12953. $1=$self._atEnd();
  12954. if($core.assert($1)){
  12955. return nil;
  12956. } else {
  12957. return $self._subclassResponsibility();
  12958. }
  12959. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  12960. },
  12961. args: [],
  12962. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  12963. referencedClasses: [],
  12964. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  12965. }),
  12966. $globals.ProtoStream);
  12967. $core.addMethod(
  12968. $core.method({
  12969. selector: "nextPut:",
  12970. protocol: "writing",
  12971. fn: function (anObject){
  12972. var self=this,$self=this;
  12973. return $core.withContext(function($ctx1) {
  12974. $self._subclassResponsibility();
  12975. return self;
  12976. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  12977. },
  12978. args: ["anObject"],
  12979. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  12980. referencedClasses: [],
  12981. messageSends: ["subclassResponsibility"]
  12982. }),
  12983. $globals.ProtoStream);
  12984. $core.addMethod(
  12985. $core.method({
  12986. selector: "nextPutAll:",
  12987. protocol: "writing",
  12988. fn: function (aCollection){
  12989. var self=this,$self=this;
  12990. return $core.withContext(function($ctx1) {
  12991. $recv(aCollection)._do_((function(each){
  12992. return $core.withContext(function($ctx2) {
  12993. return $self._nextPut_(each);
  12994. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12995. }));
  12996. return self;
  12997. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  12998. },
  12999. args: ["aCollection"],
  13000. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  13001. referencedClasses: [],
  13002. messageSends: ["do:", "nextPut:"]
  13003. }),
  13004. $globals.ProtoStream);
  13005. $core.addMethod(
  13006. $core.method({
  13007. selector: "nextPutString:",
  13008. protocol: "writing",
  13009. fn: function (aString){
  13010. var self=this,$self=this;
  13011. return $core.withContext(function($ctx1) {
  13012. $self._nextPut_(aString);
  13013. return self;
  13014. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  13015. },
  13016. args: ["aString"],
  13017. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  13018. referencedClasses: [],
  13019. messageSends: ["nextPut:"]
  13020. }),
  13021. $globals.ProtoStream);
  13022. $core.addMethod(
  13023. $core.method({
  13024. selector: "peek",
  13025. protocol: "reading",
  13026. fn: function (){
  13027. var self=this,$self=this;
  13028. return $core.withContext(function($ctx1) {
  13029. var $1;
  13030. $1=$self._atEnd();
  13031. if($core.assert($1)){
  13032. return nil;
  13033. } else {
  13034. return $self._subclassResponsibility();
  13035. }
  13036. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  13037. },
  13038. args: [],
  13039. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13040. referencedClasses: [],
  13041. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13042. }),
  13043. $globals.ProtoStream);
  13044. $core.addMethod(
  13045. $core.method({
  13046. selector: "reset",
  13047. protocol: "actions",
  13048. fn: function (){
  13049. var self=this,$self=this;
  13050. return $core.withContext(function($ctx1) {
  13051. $self._subclassResponsibility();
  13052. return self;
  13053. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  13054. },
  13055. args: [],
  13056. source: "reset\x0a\x09self subclassResponsibility",
  13057. referencedClasses: [],
  13058. messageSends: ["subclassResponsibility"]
  13059. }),
  13060. $globals.ProtoStream);
  13061. $core.addMethod(
  13062. $core.method({
  13063. selector: "resetContents",
  13064. protocol: "actions",
  13065. fn: function (){
  13066. var self=this,$self=this;
  13067. return $core.withContext(function($ctx1) {
  13068. $self._subclassResponsibility();
  13069. return self;
  13070. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  13071. },
  13072. args: [],
  13073. source: "resetContents\x0a\x09self subclassResponsibility",
  13074. referencedClasses: [],
  13075. messageSends: ["subclassResponsibility"]
  13076. }),
  13077. $globals.ProtoStream);
  13078. $core.addMethod(
  13079. $core.method({
  13080. selector: "setToEnd",
  13081. protocol: "positioning",
  13082. fn: function (){
  13083. var self=this,$self=this;
  13084. return $core.withContext(function($ctx1) {
  13085. $self._subclassResponsibility();
  13086. return self;
  13087. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  13088. },
  13089. args: [],
  13090. source: "setToEnd\x0a\x09self subclassResponsibility",
  13091. referencedClasses: [],
  13092. messageSends: ["subclassResponsibility"]
  13093. }),
  13094. $globals.ProtoStream);
  13095. $core.addMethod(
  13096. $core.method({
  13097. selector: "setToStart",
  13098. protocol: "positioning",
  13099. fn: function (){
  13100. var self=this,$self=this;
  13101. return $core.withContext(function($ctx1) {
  13102. $self._reset();
  13103. return self;
  13104. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  13105. },
  13106. args: [],
  13107. source: "setToStart\x0a\x09self reset",
  13108. referencedClasses: [],
  13109. messageSends: ["reset"]
  13110. }),
  13111. $globals.ProtoStream);
  13112. $core.addMethod(
  13113. $core.method({
  13114. selector: "write:",
  13115. protocol: "writing",
  13116. fn: function (anObject){
  13117. var self=this,$self=this;
  13118. return $core.withContext(function($ctx1) {
  13119. $recv(anObject)._putOn_(self);
  13120. return self;
  13121. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  13122. },
  13123. args: ["anObject"],
  13124. source: "write: anObject\x0a\x09anObject putOn: self",
  13125. referencedClasses: [],
  13126. messageSends: ["putOn:"]
  13127. }),
  13128. $globals.ProtoStream);
  13129. $core.addMethod(
  13130. $core.method({
  13131. selector: "on:",
  13132. protocol: "instance creation",
  13133. fn: function (aCollection){
  13134. var self=this,$self=this;
  13135. return $core.withContext(function($ctx1) {
  13136. var $1;
  13137. $1=$self._new();
  13138. $recv($1)._setCollection_(aCollection);
  13139. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13140. return $recv($1)._yourself();
  13141. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  13142. },
  13143. args: ["aCollection"],
  13144. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13145. referencedClasses: [],
  13146. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13147. }),
  13148. $globals.ProtoStream.a$cls);
  13149. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  13150. $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.";
  13151. $core.addMethod(
  13152. $core.method({
  13153. selector: "atEnd",
  13154. protocol: "testing",
  13155. fn: function (){
  13156. var self=this,$self=this;
  13157. return $core.withContext(function($ctx1) {
  13158. return $recv($self._position()).__eq($self._size());
  13159. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  13160. },
  13161. args: [],
  13162. source: "atEnd\x0a\x09^ self position = self size",
  13163. referencedClasses: [],
  13164. messageSends: ["=", "position", "size"]
  13165. }),
  13166. $globals.Stream);
  13167. $core.addMethod(
  13168. $core.method({
  13169. selector: "atStart",
  13170. protocol: "testing",
  13171. fn: function (){
  13172. var self=this,$self=this;
  13173. return $core.withContext(function($ctx1) {
  13174. return $recv($self._position()).__eq((0));
  13175. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  13176. },
  13177. args: [],
  13178. source: "atStart\x0a\x09^ self position = 0",
  13179. referencedClasses: [],
  13180. messageSends: ["=", "position"]
  13181. }),
  13182. $globals.Stream);
  13183. $core.addMethod(
  13184. $core.method({
  13185. selector: "close",
  13186. protocol: "actions",
  13187. fn: function (){
  13188. var self=this,$self=this;
  13189. return self;
  13190. },
  13191. args: [],
  13192. source: "close",
  13193. referencedClasses: [],
  13194. messageSends: []
  13195. }),
  13196. $globals.Stream);
  13197. $core.addMethod(
  13198. $core.method({
  13199. selector: "collection",
  13200. protocol: "accessing",
  13201. fn: function (){
  13202. var self=this,$self=this;
  13203. return $self.collection;
  13204. },
  13205. args: [],
  13206. source: "collection\x0a\x09^ collection",
  13207. referencedClasses: [],
  13208. messageSends: []
  13209. }),
  13210. $globals.Stream);
  13211. $core.addMethod(
  13212. $core.method({
  13213. selector: "contents",
  13214. protocol: "accessing",
  13215. fn: function (){
  13216. var self=this,$self=this;
  13217. return $core.withContext(function($ctx1) {
  13218. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  13219. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  13220. },
  13221. args: [],
  13222. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13223. referencedClasses: [],
  13224. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  13225. }),
  13226. $globals.Stream);
  13227. $core.addMethod(
  13228. $core.method({
  13229. selector: "flush",
  13230. protocol: "actions",
  13231. fn: function (){
  13232. var self=this,$self=this;
  13233. return self;
  13234. },
  13235. args: [],
  13236. source: "flush",
  13237. referencedClasses: [],
  13238. messageSends: []
  13239. }),
  13240. $globals.Stream);
  13241. $core.addMethod(
  13242. $core.method({
  13243. selector: "isEmpty",
  13244. protocol: "testing",
  13245. fn: function (){
  13246. var self=this,$self=this;
  13247. return $core.withContext(function($ctx1) {
  13248. return $recv($self._size()).__eq((0));
  13249. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  13250. },
  13251. args: [],
  13252. source: "isEmpty\x0a\x09^ self size = 0",
  13253. referencedClasses: [],
  13254. messageSends: ["=", "size"]
  13255. }),
  13256. $globals.Stream);
  13257. $core.addMethod(
  13258. $core.method({
  13259. selector: "next",
  13260. protocol: "reading",
  13261. fn: function (){
  13262. var self=this,$self=this;
  13263. return $core.withContext(function($ctx1) {
  13264. var $1,$3,$2;
  13265. $1=$self._atEnd();
  13266. if($core.assert($1)){
  13267. return nil;
  13268. } else {
  13269. $3=$self._position();
  13270. $ctx1.sendIdx["position"]=1;
  13271. $2=$recv($3).__plus((1));
  13272. $self._position_($2);
  13273. return $recv($self.collection)._at_($self._position());
  13274. }
  13275. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  13276. },
  13277. args: [],
  13278. 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 ]",
  13279. referencedClasses: [],
  13280. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  13281. }),
  13282. $globals.Stream);
  13283. $core.addMethod(
  13284. $core.method({
  13285. selector: "next:",
  13286. protocol: "reading",
  13287. fn: function (anInteger){
  13288. var self=this,$self=this;
  13289. var tempCollection;
  13290. return $core.withContext(function($ctx1) {
  13291. var $1;
  13292. tempCollection=$recv($recv($self._collection())._class())._new();
  13293. $recv(anInteger)._timesRepeat_((function(){
  13294. return $core.withContext(function($ctx2) {
  13295. $1=$self._atEnd();
  13296. if(!$core.assert($1)){
  13297. return $recv(tempCollection)._add_($self._next());
  13298. }
  13299. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13300. }));
  13301. return tempCollection;
  13302. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  13303. },
  13304. args: ["anInteger"],
  13305. 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",
  13306. referencedClasses: [],
  13307. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  13308. }),
  13309. $globals.Stream);
  13310. $core.addMethod(
  13311. $core.method({
  13312. selector: "nextPut:",
  13313. protocol: "writing",
  13314. fn: function (anObject){
  13315. var self=this,$self=this;
  13316. return $core.withContext(function($ctx1) {
  13317. var $2,$1,$3,$4;
  13318. $2=$self._position();
  13319. $ctx1.sendIdx["position"]=1;
  13320. $1=$recv($2).__plus((1));
  13321. $self._position_($1);
  13322. $3=$self._collection();
  13323. $4=$self._position();
  13324. $ctx1.sendIdx["position"]=2;
  13325. $recv($3)._at_put_($4,anObject);
  13326. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13327. return self;
  13328. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  13329. },
  13330. args: ["anObject"],
  13331. 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)",
  13332. referencedClasses: [],
  13333. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  13334. }),
  13335. $globals.Stream);
  13336. $core.addMethod(
  13337. $core.method({
  13338. selector: "peek",
  13339. protocol: "reading",
  13340. fn: function (){
  13341. var self=this,$self=this;
  13342. return $core.withContext(function($ctx1) {
  13343. var $1;
  13344. $1=$self._atEnd();
  13345. if(!$core.assert($1)){
  13346. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  13347. }
  13348. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  13349. },
  13350. args: [],
  13351. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  13352. referencedClasses: [],
  13353. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  13354. }),
  13355. $globals.Stream);
  13356. $core.addMethod(
  13357. $core.method({
  13358. selector: "position",
  13359. protocol: "accessing",
  13360. fn: function (){
  13361. var self=this,$self=this;
  13362. return $core.withContext(function($ctx1) {
  13363. var $1,$receiver;
  13364. $1=$self.position;
  13365. if(($receiver = $1) == null || $receiver.a$nil){
  13366. $self.position=(0);
  13367. return $self.position;
  13368. } else {
  13369. return $1;
  13370. }
  13371. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  13372. },
  13373. args: [],
  13374. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  13375. referencedClasses: [],
  13376. messageSends: ["ifNil:"]
  13377. }),
  13378. $globals.Stream);
  13379. $core.addMethod(
  13380. $core.method({
  13381. selector: "position:",
  13382. protocol: "accessing",
  13383. fn: function (anInteger){
  13384. var self=this,$self=this;
  13385. $self.position=anInteger;
  13386. return self;
  13387. },
  13388. args: ["anInteger"],
  13389. source: "position: anInteger\x0a\x09position := anInteger",
  13390. referencedClasses: [],
  13391. messageSends: []
  13392. }),
  13393. $globals.Stream);
  13394. $core.addMethod(
  13395. $core.method({
  13396. selector: "reset",
  13397. protocol: "actions",
  13398. fn: function (){
  13399. var self=this,$self=this;
  13400. return $core.withContext(function($ctx1) {
  13401. $self._position_((0));
  13402. return self;
  13403. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  13404. },
  13405. args: [],
  13406. source: "reset\x0a\x09self position: 0",
  13407. referencedClasses: [],
  13408. messageSends: ["position:"]
  13409. }),
  13410. $globals.Stream);
  13411. $core.addMethod(
  13412. $core.method({
  13413. selector: "resetContents",
  13414. protocol: "actions",
  13415. fn: function (){
  13416. var self=this,$self=this;
  13417. return $core.withContext(function($ctx1) {
  13418. $self._reset();
  13419. $self._setStreamSize_((0));
  13420. return self;
  13421. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  13422. },
  13423. args: [],
  13424. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13425. referencedClasses: [],
  13426. messageSends: ["reset", "setStreamSize:"]
  13427. }),
  13428. $globals.Stream);
  13429. $core.addMethod(
  13430. $core.method({
  13431. selector: "setCollection:",
  13432. protocol: "accessing",
  13433. fn: function (aCollection){
  13434. var self=this,$self=this;
  13435. $self.collection=aCollection;
  13436. return self;
  13437. },
  13438. args: ["aCollection"],
  13439. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13440. referencedClasses: [],
  13441. messageSends: []
  13442. }),
  13443. $globals.Stream);
  13444. $core.addMethod(
  13445. $core.method({
  13446. selector: "setStreamSize:",
  13447. protocol: "accessing",
  13448. fn: function (anInteger){
  13449. var self=this,$self=this;
  13450. $self.streamSize=anInteger;
  13451. return self;
  13452. },
  13453. args: ["anInteger"],
  13454. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  13455. referencedClasses: [],
  13456. messageSends: []
  13457. }),
  13458. $globals.Stream);
  13459. $core.addMethod(
  13460. $core.method({
  13461. selector: "setToEnd",
  13462. protocol: "positioning",
  13463. fn: function (){
  13464. var self=this,$self=this;
  13465. return $core.withContext(function($ctx1) {
  13466. $self._position_($self._size());
  13467. return self;
  13468. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  13469. },
  13470. args: [],
  13471. source: "setToEnd\x0a\x09self position: self size",
  13472. referencedClasses: [],
  13473. messageSends: ["position:", "size"]
  13474. }),
  13475. $globals.Stream);
  13476. $core.addMethod(
  13477. $core.method({
  13478. selector: "size",
  13479. protocol: "accessing",
  13480. fn: function (){
  13481. var self=this,$self=this;
  13482. return $core.withContext(function($ctx1) {
  13483. return $self._streamSize();
  13484. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  13485. },
  13486. args: [],
  13487. source: "size\x0a\x09^ self streamSize",
  13488. referencedClasses: [],
  13489. messageSends: ["streamSize"]
  13490. }),
  13491. $globals.Stream);
  13492. $core.addMethod(
  13493. $core.method({
  13494. selector: "skip:",
  13495. protocol: "positioning",
  13496. fn: function (anInteger){
  13497. var self=this,$self=this;
  13498. return $core.withContext(function($ctx1) {
  13499. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  13500. return self;
  13501. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  13502. },
  13503. args: ["anInteger"],
  13504. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  13505. referencedClasses: [],
  13506. messageSends: ["position:", "min:max:", "+", "position", "size"]
  13507. }),
  13508. $globals.Stream);
  13509. $core.addMethod(
  13510. $core.method({
  13511. selector: "streamSize",
  13512. protocol: "accessing",
  13513. fn: function (){
  13514. var self=this,$self=this;
  13515. return $self.streamSize;
  13516. },
  13517. args: [],
  13518. source: "streamSize\x0a\x09^ streamSize",
  13519. referencedClasses: [],
  13520. messageSends: []
  13521. }),
  13522. $globals.Stream);
  13523. $core.addMethod(
  13524. $core.method({
  13525. selector: "on:",
  13526. protocol: "instance creation",
  13527. fn: function (aCollection){
  13528. var self=this,$self=this;
  13529. return $core.withContext(function($ctx1) {
  13530. var $1;
  13531. $1=$self._new();
  13532. $recv($1)._setCollection_(aCollection);
  13533. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13534. return $recv($1)._yourself();
  13535. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  13536. },
  13537. args: ["aCollection"],
  13538. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13539. referencedClasses: [],
  13540. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13541. }),
  13542. $globals.Stream.a$cls);
  13543. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  13544. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  13545. $core.addMethod(
  13546. $core.method({
  13547. selector: "cr",
  13548. protocol: "writing",
  13549. fn: function (){
  13550. var self=this,$self=this;
  13551. return $core.withContext(function($ctx1) {
  13552. return $self._nextPutAll_($recv($globals.String)._cr());
  13553. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  13554. },
  13555. args: [],
  13556. source: "cr\x0a\x09^ self nextPutAll: String cr",
  13557. referencedClasses: ["String"],
  13558. messageSends: ["nextPutAll:", "cr"]
  13559. }),
  13560. $globals.StringStream);
  13561. $core.addMethod(
  13562. $core.method({
  13563. selector: "crlf",
  13564. protocol: "writing",
  13565. fn: function (){
  13566. var self=this,$self=this;
  13567. return $core.withContext(function($ctx1) {
  13568. return $self._nextPutAll_($recv($globals.String)._crlf());
  13569. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  13570. },
  13571. args: [],
  13572. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  13573. referencedClasses: ["String"],
  13574. messageSends: ["nextPutAll:", "crlf"]
  13575. }),
  13576. $globals.StringStream);
  13577. $core.addMethod(
  13578. $core.method({
  13579. selector: "lf",
  13580. protocol: "writing",
  13581. fn: function (){
  13582. var self=this,$self=this;
  13583. return $core.withContext(function($ctx1) {
  13584. return $self._nextPutAll_($recv($globals.String)._lf());
  13585. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  13586. },
  13587. args: [],
  13588. source: "lf\x0a\x09^ self nextPutAll: String lf",
  13589. referencedClasses: ["String"],
  13590. messageSends: ["nextPutAll:", "lf"]
  13591. }),
  13592. $globals.StringStream);
  13593. $core.addMethod(
  13594. $core.method({
  13595. selector: "next:",
  13596. protocol: "reading",
  13597. fn: function (anInteger){
  13598. var self=this,$self=this;
  13599. var tempCollection;
  13600. return $core.withContext(function($ctx1) {
  13601. var $1;
  13602. tempCollection=$recv($recv($self._collection())._class())._new();
  13603. $recv(anInteger)._timesRepeat_((function(){
  13604. return $core.withContext(function($ctx2) {
  13605. $1=$self._atEnd();
  13606. if(!$core.assert($1)){
  13607. tempCollection=$recv(tempCollection).__comma($self._next());
  13608. return tempCollection;
  13609. }
  13610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13611. }));
  13612. return tempCollection;
  13613. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  13614. },
  13615. args: ["anInteger"],
  13616. 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",
  13617. referencedClasses: [],
  13618. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  13619. }),
  13620. $globals.StringStream);
  13621. $core.addMethod(
  13622. $core.method({
  13623. selector: "nextPut:",
  13624. protocol: "writing",
  13625. fn: function (aString){
  13626. var self=this,$self=this;
  13627. return $core.withContext(function($ctx1) {
  13628. $self._nextPutAll_(aString);
  13629. return self;
  13630. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  13631. },
  13632. args: ["aString"],
  13633. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  13634. referencedClasses: [],
  13635. messageSends: ["nextPutAll:"]
  13636. }),
  13637. $globals.StringStream);
  13638. $core.addMethod(
  13639. $core.method({
  13640. selector: "nextPutAll:",
  13641. protocol: "writing",
  13642. fn: function (aString){
  13643. var self=this,$self=this;
  13644. var pre,post;
  13645. return $core.withContext(function($ctx1) {
  13646. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  13647. $1=$self._atEnd();
  13648. if($core.assert($1)){
  13649. $3=$self._collection();
  13650. $ctx1.sendIdx["collection"]=1;
  13651. $2=$recv($3).__comma(aString);
  13652. $ctx1.sendIdx[","]=1;
  13653. $self._setCollection_($2);
  13654. $ctx1.sendIdx["setCollection:"]=1;
  13655. } else {
  13656. $4=$self._collection();
  13657. $ctx1.sendIdx["collection"]=2;
  13658. $5=$self._position();
  13659. $ctx1.sendIdx["position"]=1;
  13660. pre=$recv($4)._copyFrom_to_((1),$5);
  13661. $ctx1.sendIdx["copyFrom:to:"]=1;
  13662. $6=$self._collection();
  13663. $ctx1.sendIdx["collection"]=3;
  13664. $9=$self._position();
  13665. $ctx1.sendIdx["position"]=2;
  13666. $8=$recv($9).__plus((1));
  13667. $ctx1.sendIdx["+"]=2;
  13668. $10=$recv(aString)._size();
  13669. $ctx1.sendIdx["size"]=1;
  13670. $7=$recv($8).__plus($10);
  13671. $ctx1.sendIdx["+"]=1;
  13672. $11=$recv($self._collection())._size();
  13673. $ctx1.sendIdx["size"]=2;
  13674. post=$recv($6)._copyFrom_to_($7,$11);
  13675. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  13676. $ctx1.sendIdx[","]=2;
  13677. $self._setCollection_($12);
  13678. }
  13679. $14=$self._position();
  13680. $ctx1.sendIdx["position"]=3;
  13681. $13=$recv($14).__plus($recv(aString)._size());
  13682. $self._position_($13);
  13683. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13684. return self;
  13685. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  13686. },
  13687. args: ["aString"],
  13688. 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)",
  13689. referencedClasses: [],
  13690. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  13691. }),
  13692. $globals.StringStream);
  13693. $core.addMethod(
  13694. $core.method({
  13695. selector: "nextPutString:",
  13696. protocol: "writing",
  13697. fn: function (aString){
  13698. var self=this,$self=this;
  13699. return $core.withContext(function($ctx1) {
  13700. $self._nextPutAll_(aString);
  13701. return self;
  13702. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  13703. },
  13704. args: ["aString"],
  13705. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  13706. referencedClasses: [],
  13707. messageSends: ["nextPutAll:"]
  13708. }),
  13709. $globals.StringStream);
  13710. $core.addMethod(
  13711. $core.method({
  13712. selector: "print:",
  13713. protocol: "writing",
  13714. fn: function (anObject){
  13715. var self=this,$self=this;
  13716. return $core.withContext(function($ctx1) {
  13717. $recv(anObject)._printOn_(self);
  13718. return self;
  13719. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  13720. },
  13721. args: ["anObject"],
  13722. source: "print: anObject\x0a\x09anObject printOn: self",
  13723. referencedClasses: [],
  13724. messageSends: ["printOn:"]
  13725. }),
  13726. $globals.StringStream);
  13727. $core.addMethod(
  13728. $core.method({
  13729. selector: "printSymbol:",
  13730. protocol: "writing",
  13731. fn: function (anObject){
  13732. var self=this,$self=this;
  13733. return $core.withContext(function($ctx1) {
  13734. $recv(anObject)._asSymbolPrintOn_(self);
  13735. return self;
  13736. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  13737. },
  13738. args: ["anObject"],
  13739. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  13740. referencedClasses: [],
  13741. messageSends: ["asSymbolPrintOn:"]
  13742. }),
  13743. $globals.StringStream);
  13744. $core.addMethod(
  13745. $core.method({
  13746. selector: "space",
  13747. protocol: "writing",
  13748. fn: function (){
  13749. var self=this,$self=this;
  13750. return $core.withContext(function($ctx1) {
  13751. $self._nextPut_(" ");
  13752. return self;
  13753. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  13754. },
  13755. args: [],
  13756. source: "space\x0a\x09self nextPut: ' '",
  13757. referencedClasses: [],
  13758. messageSends: ["nextPut:"]
  13759. }),
  13760. $globals.StringStream);
  13761. $core.addMethod(
  13762. $core.method({
  13763. selector: "tab",
  13764. protocol: "writing",
  13765. fn: function (){
  13766. var self=this,$self=this;
  13767. return $core.withContext(function($ctx1) {
  13768. return $self._nextPutAll_($recv($globals.String)._tab());
  13769. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  13770. },
  13771. args: [],
  13772. source: "tab\x0a\x09^ self nextPutAll: String tab",
  13773. referencedClasses: ["String"],
  13774. messageSends: ["nextPutAll:", "tab"]
  13775. }),
  13776. $globals.StringStream);
  13777. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  13778. $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.";
  13779. $core.addMethod(
  13780. $core.method({
  13781. selector: "initialize",
  13782. protocol: "initialization",
  13783. fn: function (){
  13784. var self=this,$self=this;
  13785. return $core.withContext(function($ctx1) {
  13786. (
  13787. $ctx1.supercall = true,
  13788. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  13789. $ctx1.supercall = false;
  13790. $self.read=$recv($globals.OrderedCollection)._new();
  13791. $ctx1.sendIdx["new"]=1;
  13792. $self.write=$recv($globals.OrderedCollection)._new();
  13793. $self.readIndex=(1);
  13794. return self;
  13795. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  13796. },
  13797. args: [],
  13798. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  13799. referencedClasses: ["OrderedCollection"],
  13800. messageSends: ["initialize", "new"]
  13801. }),
  13802. $globals.Queue);
  13803. $core.addMethod(
  13804. $core.method({
  13805. selector: "next",
  13806. protocol: "accessing",
  13807. fn: function (){
  13808. var self=this,$self=this;
  13809. return $core.withContext(function($ctx1) {
  13810. return $self._nextIfAbsent_((function(){
  13811. return $core.withContext(function($ctx2) {
  13812. return $self._error_("Cannot read from empty Queue.");
  13813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13814. }));
  13815. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  13816. },
  13817. args: [],
  13818. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  13819. referencedClasses: [],
  13820. messageSends: ["nextIfAbsent:", "error:"]
  13821. }),
  13822. $globals.Queue);
  13823. $core.addMethod(
  13824. $core.method({
  13825. selector: "nextIfAbsent:",
  13826. protocol: "accessing",
  13827. fn: function (aBlock){
  13828. var self=this,$self=this;
  13829. var result;
  13830. return $core.withContext(function($ctx1) {
  13831. var $1;
  13832. var $early={};
  13833. try {
  13834. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  13835. return $core.withContext(function($ctx2) {
  13836. $recv($self.write)._ifEmpty_((function(){
  13837. return $core.withContext(function($ctx3) {
  13838. $1=$recv($self.readIndex).__gt((1));
  13839. if($core.assert($1)){
  13840. $self.read=[];
  13841. $self.readIndex=(1);
  13842. $self.readIndex;
  13843. }
  13844. throw $early=[$recv(aBlock)._value()];
  13845. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  13846. }));
  13847. $self.read=$self.write;
  13848. $self.readIndex=(1);
  13849. $self.write=$recv($globals.OrderedCollection)._new();
  13850. return $recv($self.read)._first();
  13851. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13852. }));
  13853. $recv($self.read)._at_put_($self.readIndex,nil);
  13854. $self.readIndex=$recv($self.readIndex).__plus((1));
  13855. return result;
  13856. }
  13857. catch(e) {if(e===$early)return e[0]; throw e}
  13858. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  13859. },
  13860. args: ["aBlock"],
  13861. 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",
  13862. referencedClasses: ["OrderedCollection"],
  13863. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  13864. }),
  13865. $globals.Queue);
  13866. $core.addMethod(
  13867. $core.method({
  13868. selector: "nextPut:",
  13869. protocol: "accessing",
  13870. fn: function (anObject){
  13871. var self=this,$self=this;
  13872. return $core.withContext(function($ctx1) {
  13873. $recv($self.write)._add_(anObject);
  13874. return self;
  13875. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  13876. },
  13877. args: ["anObject"],
  13878. source: "nextPut: anObject\x0a\x09write add: anObject",
  13879. referencedClasses: [],
  13880. messageSends: ["add:"]
  13881. }),
  13882. $globals.Queue);
  13883. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  13884. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  13885. $core.addMethod(
  13886. $core.method({
  13887. selector: "compile:",
  13888. protocol: "evaluating",
  13889. fn: function (aString){
  13890. var self=this,$self=this;
  13891. return $core.withContext(function($ctx1) {
  13892. return self.compile(aString);
  13893. return self;
  13894. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  13895. },
  13896. args: ["aString"],
  13897. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  13898. referencedClasses: [],
  13899. messageSends: []
  13900. }),
  13901. $globals.RegularExpression);
  13902. $core.addMethod(
  13903. $core.method({
  13904. selector: "exec:",
  13905. protocol: "evaluating",
  13906. fn: function (aString){
  13907. var self=this,$self=this;
  13908. return $core.withContext(function($ctx1) {
  13909. return self.exec(aString) || nil;
  13910. return self;
  13911. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  13912. },
  13913. args: ["aString"],
  13914. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  13915. referencedClasses: [],
  13916. messageSends: []
  13917. }),
  13918. $globals.RegularExpression);
  13919. $core.addMethod(
  13920. $core.method({
  13921. selector: "test:",
  13922. protocol: "evaluating",
  13923. fn: function (aString){
  13924. var self=this,$self=this;
  13925. return $core.withContext(function($ctx1) {
  13926. return self.test(aString);
  13927. return self;
  13928. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  13929. },
  13930. args: ["aString"],
  13931. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  13932. referencedClasses: [],
  13933. messageSends: []
  13934. }),
  13935. $globals.RegularExpression);
  13936. $core.addMethod(
  13937. $core.method({
  13938. selector: "fromString:",
  13939. protocol: "instance creation",
  13940. fn: function (aString){
  13941. var self=this,$self=this;
  13942. return $core.withContext(function($ctx1) {
  13943. return $self._fromString_flag_(aString,"");
  13944. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  13945. },
  13946. args: ["aString"],
  13947. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  13948. referencedClasses: [],
  13949. messageSends: ["fromString:flag:"]
  13950. }),
  13951. $globals.RegularExpression.a$cls);
  13952. $core.addMethod(
  13953. $core.method({
  13954. selector: "fromString:flag:",
  13955. protocol: "instance creation",
  13956. fn: function (aString,anotherString){
  13957. var self=this,$self=this;
  13958. return $core.withContext(function($ctx1) {
  13959. return new RegExp(aString, anotherString);
  13960. return self;
  13961. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  13962. },
  13963. args: ["aString", "anotherString"],
  13964. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  13965. referencedClasses: [],
  13966. messageSends: []
  13967. }),
  13968. $globals.RegularExpression.a$cls);
  13969. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  13970. $core.addMethod(
  13971. $core.method({
  13972. selector: "at:",
  13973. protocol: "accessing",
  13974. fn: function (anIndex){
  13975. var self=this,$self=this;
  13976. return $core.withContext(function($ctx1) {
  13977. return $self._at_ifAbsent_(anIndex,(function(){
  13978. return $core.withContext(function($ctx2) {
  13979. return $self._errorNotFound();
  13980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13981. }));
  13982. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.TKeyValueCollection)});
  13983. },
  13984. args: ["anIndex"],
  13985. 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 ]",
  13986. referencedClasses: [],
  13987. messageSends: ["at:ifAbsent:", "errorNotFound"]
  13988. }),
  13989. $globals.TKeyValueCollection);
  13990. $core.addMethod(
  13991. $core.method({
  13992. selector: "at:ifAbsent:",
  13993. protocol: "accessing",
  13994. fn: function (anIndex,aBlock){
  13995. var self=this,$self=this;
  13996. return $core.withContext(function($ctx1) {
  13997. $self._subclassResponsibility();
  13998. return self;
  13999. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  14000. },
  14001. args: ["anIndex", "aBlock"],
  14002. 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",
  14003. referencedClasses: [],
  14004. messageSends: ["subclassResponsibility"]
  14005. }),
  14006. $globals.TKeyValueCollection);
  14007. $core.addMethod(
  14008. $core.method({
  14009. selector: "at:ifAbsentPut:",
  14010. protocol: "accessing",
  14011. fn: function (aKey,aBlock){
  14012. var self=this,$self=this;
  14013. return $core.withContext(function($ctx1) {
  14014. return $self._at_ifAbsent_(aKey,(function(){
  14015. return $core.withContext(function($ctx2) {
  14016. return $self._at_put_(aKey,$recv(aBlock)._value());
  14017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14018. }));
  14019. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.TKeyValueCollection)});
  14020. },
  14021. args: ["aKey", "aBlock"],
  14022. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  14023. referencedClasses: [],
  14024. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  14025. }),
  14026. $globals.TKeyValueCollection);
  14027. $core.addMethod(
  14028. $core.method({
  14029. selector: "at:ifPresent:",
  14030. protocol: "accessing",
  14031. fn: function (anIndex,aBlock){
  14032. var self=this,$self=this;
  14033. return $core.withContext(function($ctx1) {
  14034. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  14035. return nil;
  14036. }));
  14037. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  14038. },
  14039. args: ["anIndex", "aBlock"],
  14040. 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 ]",
  14041. referencedClasses: [],
  14042. messageSends: ["at:ifPresent:ifAbsent:"]
  14043. }),
  14044. $globals.TKeyValueCollection);
  14045. $core.addMethod(
  14046. $core.method({
  14047. selector: "at:ifPresent:ifAbsent:",
  14048. protocol: "accessing",
  14049. fn: function (anIndex,aBlock,anotherBlock){
  14050. var self=this,$self=this;
  14051. return $core.withContext(function($ctx1) {
  14052. $self._subclassResponsibility();
  14053. return self;
  14054. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TKeyValueCollection)});
  14055. },
  14056. args: ["anIndex", "aBlock", "anotherBlock"],
  14057. 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",
  14058. referencedClasses: [],
  14059. messageSends: ["subclassResponsibility"]
  14060. }),
  14061. $globals.TKeyValueCollection);
  14062. $core.addMethod(
  14063. $core.method({
  14064. selector: "at:put:",
  14065. protocol: "accessing",
  14066. fn: function (anIndex,anObject){
  14067. var self=this,$self=this;
  14068. return $core.withContext(function($ctx1) {
  14069. $self._subclassResponsibility();
  14070. return self;
  14071. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.TKeyValueCollection)});
  14072. },
  14073. args: ["anIndex", "anObject"],
  14074. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  14075. referencedClasses: [],
  14076. messageSends: ["subclassResponsibility"]
  14077. }),
  14078. $globals.TKeyValueCollection);
  14079. $core.addMethod(
  14080. $core.method({
  14081. selector: "indexOf:",
  14082. protocol: "accessing",
  14083. fn: function (anObject){
  14084. var self=this,$self=this;
  14085. return $core.withContext(function($ctx1) {
  14086. return $self._indexOf_ifAbsent_(anObject,(function(){
  14087. return $core.withContext(function($ctx2) {
  14088. return $self._errorNotFound();
  14089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14090. }));
  14091. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.TKeyValueCollection)});
  14092. },
  14093. args: ["anObject"],
  14094. 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 ]",
  14095. referencedClasses: [],
  14096. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  14097. }),
  14098. $globals.TKeyValueCollection);
  14099. $core.addMethod(
  14100. $core.method({
  14101. selector: "indexOf:ifAbsent:",
  14102. protocol: "accessing",
  14103. fn: function (anObject,aBlock){
  14104. var self=this,$self=this;
  14105. return $core.withContext(function($ctx1) {
  14106. $self._subclassResponsibility();
  14107. return self;
  14108. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TKeyValueCollection)});
  14109. },
  14110. args: ["anObject", "aBlock"],
  14111. 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",
  14112. referencedClasses: [],
  14113. messageSends: ["subclassResponsibility"]
  14114. }),
  14115. $globals.TKeyValueCollection);
  14116. $core.addMethod(
  14117. $core.method({
  14118. selector: "with:do:",
  14119. protocol: "enumerating",
  14120. fn: function (anotherCollection,aBlock){
  14121. var self=this,$self=this;
  14122. return $core.withContext(function($ctx1) {
  14123. $self._withIndexDo_((function(each,index){
  14124. return $core.withContext(function($ctx2) {
  14125. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  14126. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  14127. }));
  14128. return self;
  14129. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TKeyValueCollection)});
  14130. },
  14131. args: ["anotherCollection", "aBlock"],
  14132. 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) ]",
  14133. referencedClasses: [],
  14134. messageSends: ["withIndexDo:", "value:value:", "at:"]
  14135. }),
  14136. $globals.TKeyValueCollection);
  14137. $core.addMethod(
  14138. $core.method({
  14139. selector: "withIndexDo:",
  14140. protocol: "enumerating",
  14141. fn: function (aBlock){
  14142. var self=this,$self=this;
  14143. return $core.withContext(function($ctx1) {
  14144. $self._subclassResponsibility();
  14145. return self;
  14146. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TKeyValueCollection)});
  14147. },
  14148. args: ["aBlock"],
  14149. 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",
  14150. referencedClasses: [],
  14151. messageSends: ["subclassResponsibility"]
  14152. }),
  14153. $globals.TKeyValueCollection);
  14154. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  14155. $core.addMethod(
  14156. $core.method({
  14157. selector: "at:ifAbsent:",
  14158. protocol: "accessing",
  14159. fn: function (anIndex,aBlock){
  14160. var self=this,$self=this;
  14161. return $core.withContext(function($ctx1) {
  14162. return anIndex >= 1 && anIndex <= self.length
  14163. ? self[anIndex - 1]
  14164. : aBlock._value()
  14165. ;
  14166. return self;
  14167. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14168. },
  14169. args: ["anIndex", "aBlock"],
  14170. 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'>",
  14171. referencedClasses: [],
  14172. messageSends: []
  14173. }),
  14174. $globals.TNativeZeroBasedCollection);
  14175. $core.addMethod(
  14176. $core.method({
  14177. selector: "at:ifPresent:ifAbsent:",
  14178. protocol: "accessing",
  14179. fn: function (anIndex,aBlock,anotherBlock){
  14180. var self=this,$self=this;
  14181. return $core.withContext(function($ctx1) {
  14182. return anIndex >= 1 && anIndex <= self.length
  14183. ? aBlock._value_(self[anIndex - 1])
  14184. : anotherBlock._value()
  14185. ;
  14186. return self;
  14187. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  14188. },
  14189. args: ["anIndex", "aBlock", "anotherBlock"],
  14190. 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'>",
  14191. referencedClasses: [],
  14192. messageSends: []
  14193. }),
  14194. $globals.TNativeZeroBasedCollection);
  14195. $core.addMethod(
  14196. $core.method({
  14197. selector: "detect:ifNone:",
  14198. protocol: "enumerating",
  14199. fn: function (aBlock,anotherBlock){
  14200. var self=this,$self=this;
  14201. return $core.withContext(function($ctx1) {
  14202. for(var i = 0; i < self.length; i++)
  14203. if(aBlock._value_(self[i]))
  14204. return self[i];
  14205. return anotherBlock._value();
  14206. ;
  14207. return self;
  14208. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  14209. },
  14210. args: ["aBlock", "anotherBlock"],
  14211. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09'>",
  14212. referencedClasses: [],
  14213. messageSends: []
  14214. }),
  14215. $globals.TNativeZeroBasedCollection);
  14216. $core.addMethod(
  14217. $core.method({
  14218. selector: "do:",
  14219. protocol: "enumerating",
  14220. fn: function (aBlock){
  14221. var self=this,$self=this;
  14222. return $core.withContext(function($ctx1) {
  14223. for(var i=0; i < self.length; i++) {
  14224. aBlock._value_(self[i]);
  14225. }
  14226. ;
  14227. return self;
  14228. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14229. },
  14230. args: ["aBlock"],
  14231. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09'>",
  14232. referencedClasses: [],
  14233. messageSends: []
  14234. }),
  14235. $globals.TNativeZeroBasedCollection);
  14236. $core.addMethod(
  14237. $core.method({
  14238. selector: "indexOf:ifAbsent:",
  14239. protocol: "accessing",
  14240. fn: function (anObject,aBlock){
  14241. var self=this,$self=this;
  14242. return $core.withContext(function($ctx1) {
  14243. for(var i=0; i < self.length; i++) {
  14244. if($recv(self[i]).__eq(anObject)) {return i+1}
  14245. };
  14246. return aBlock._value();
  14247. ;
  14248. return self;
  14249. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14250. },
  14251. args: ["anObject", "aBlock"],
  14252. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  14253. referencedClasses: [],
  14254. messageSends: []
  14255. }),
  14256. $globals.TNativeZeroBasedCollection);
  14257. $core.addMethod(
  14258. $core.method({
  14259. selector: "indexOf:startingAt:ifAbsent:",
  14260. protocol: "accessing",
  14261. fn: function (anObject,start,aBlock){
  14262. var self=this,$self=this;
  14263. return $core.withContext(function($ctx1) {
  14264. for(var i=start - 1; i < self.length; i++){
  14265. if($recv(self[i]).__eq(anObject)) {return i+1}
  14266. }
  14267. return aBlock._value();
  14268. ;
  14269. return self;
  14270. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14271. },
  14272. args: ["anObject", "start", "aBlock"],
  14273. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  14274. referencedClasses: [],
  14275. messageSends: []
  14276. }),
  14277. $globals.TNativeZeroBasedCollection);
  14278. $core.addMethod(
  14279. $core.method({
  14280. selector: "single",
  14281. protocol: "accessing",
  14282. fn: function (){
  14283. var self=this,$self=this;
  14284. return $core.withContext(function($ctx1) {
  14285. if (self.length == 0) throw new Error("Collection is empty");
  14286. if (self.length > 1) throw new Error("Collection holds more than one element.");
  14287. return self[0];;
  14288. return self;
  14289. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.TNativeZeroBasedCollection)});
  14290. },
  14291. args: [],
  14292. source: "single\x0a<inlineJS: '\x0a\x09if (self.length == 0) throw new Error(\x22Collection is empty\x22);\x0a\x09if (self.length > 1) throw new Error(\x22Collection holds more than one element.\x22);\x0a\x09return self[0];\x0a'>",
  14293. referencedClasses: [],
  14294. messageSends: []
  14295. }),
  14296. $globals.TNativeZeroBasedCollection);
  14297. $core.addMethod(
  14298. $core.method({
  14299. selector: "size",
  14300. protocol: "accessing",
  14301. fn: function (){
  14302. var self=this,$self=this;
  14303. return $core.withContext(function($ctx1) {
  14304. return self.length;
  14305. return self;
  14306. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.TNativeZeroBasedCollection)});
  14307. },
  14308. args: [],
  14309. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  14310. referencedClasses: [],
  14311. messageSends: []
  14312. }),
  14313. $globals.TNativeZeroBasedCollection);
  14314. $core.addMethod(
  14315. $core.method({
  14316. selector: "with:do:",
  14317. protocol: "enumerating",
  14318. fn: function (anotherCollection,aBlock){
  14319. var self=this,$self=this;
  14320. return $core.withContext(function($ctx1) {
  14321. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  14322. for(var i=0; i<self.length; i++) {
  14323. aBlock._value_value_(self[i], anotherCollection[i]);
  14324. }
  14325. ;
  14326. return self;
  14327. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14328. },
  14329. args: ["anotherCollection", "aBlock"],
  14330. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09 $recv(anotherCollection)._first_(0); // #guardSequenceableCollection\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09'>",
  14331. referencedClasses: [],
  14332. messageSends: []
  14333. }),
  14334. $globals.TNativeZeroBasedCollection);
  14335. $core.addMethod(
  14336. $core.method({
  14337. selector: "withIndexDo:",
  14338. protocol: "enumerating",
  14339. fn: function (aBlock){
  14340. var self=this,$self=this;
  14341. return $core.withContext(function($ctx1) {
  14342. for(var i=0; i < self.length; i++) {
  14343. aBlock._value_value_(self[i], i+1);
  14344. }
  14345. ;
  14346. return self;
  14347. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14348. },
  14349. args: ["aBlock"],
  14350. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09'>",
  14351. referencedClasses: [],
  14352. messageSends: []
  14353. }),
  14354. $globals.TNativeZeroBasedCollection);
  14355. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  14356. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  14357. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  14358. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  14359. });
  14360. define('amber/core/Kernel-Classes',["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Helpers", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  14361. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  14362. var $pkg = $core.addPackage("Kernel-Classes");
  14363. $pkg.innerEval = function (expr) { return eval(expr); };
  14364. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  14365. $core.addClass("Behavior", $globals.Object, ["organization", "slots", "fn", "superclass"], "Kernel-Classes");
  14366. $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.";
  14367. $core.addMethod(
  14368. $core.method({
  14369. selector: "allInstanceVariableNames",
  14370. protocol: "accessing",
  14371. fn: function (){
  14372. var self=this,$self=this;
  14373. var result;
  14374. return $core.withContext(function($ctx1) {
  14375. var $1,$receiver;
  14376. result=$recv($self._instanceVariableNames())._copy();
  14377. $1=$self._superclass();
  14378. $ctx1.sendIdx["superclass"]=1;
  14379. if(($receiver = $1) == null || $receiver.a$nil){
  14380. $1;
  14381. } else {
  14382. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  14383. }
  14384. return result;
  14385. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  14386. },
  14387. args: [],
  14388. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14389. referencedClasses: [],
  14390. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14391. }),
  14392. $globals.Behavior);
  14393. $core.addMethod(
  14394. $core.method({
  14395. selector: "allSelectors",
  14396. protocol: "accessing",
  14397. fn: function (){
  14398. var self=this,$self=this;
  14399. return $core.withContext(function($ctx1) {
  14400. var $1,$2;
  14401. $1=$self._allSuperclasses();
  14402. $2=$self._selectors();
  14403. $ctx1.sendIdx["selectors"]=1;
  14404. return $recv($1)._inject_into_($2,(function(acc,each){
  14405. return $core.withContext(function($ctx2) {
  14406. $recv(acc)._addAll_($recv(each)._selectors());
  14407. return $recv(acc)._yourself();
  14408. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  14409. }));
  14410. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  14411. },
  14412. args: [],
  14413. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  14414. referencedClasses: [],
  14415. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  14416. }),
  14417. $globals.Behavior);
  14418. $core.addMethod(
  14419. $core.method({
  14420. selector: "allSubclasses",
  14421. protocol: "accessing",
  14422. fn: function (){
  14423. var self=this,$self=this;
  14424. return $core.withContext(function($ctx1) {
  14425. return $recv($globals.Array)._streamContents_((function(str){
  14426. return $core.withContext(function($ctx2) {
  14427. return $self._allSubclassesDo_((function(each){
  14428. return $core.withContext(function($ctx3) {
  14429. return $recv(str)._nextPut_(each);
  14430. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14431. }));
  14432. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  14433. }));
  14434. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  14435. },
  14436. args: [],
  14437. 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 ] ]",
  14438. referencedClasses: ["Array"],
  14439. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  14440. }),
  14441. $globals.Behavior);
  14442. $core.addMethod(
  14443. $core.method({
  14444. selector: "allSubclassesDo:",
  14445. protocol: "enumerating",
  14446. fn: function (aBlock){
  14447. var self=this,$self=this;
  14448. return $core.withContext(function($ctx1) {
  14449. $core.traverseClassTree(self, function(subclass) {
  14450. if (subclass !== self) aBlock._value_(subclass);
  14451. });
  14452. return self;
  14453. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  14454. },
  14455. args: ["aBlock"],
  14456. 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})'>",
  14457. referencedClasses: [],
  14458. messageSends: []
  14459. }),
  14460. $globals.Behavior);
  14461. $core.addMethod(
  14462. $core.method({
  14463. selector: "allSuperclasses",
  14464. protocol: "accessing",
  14465. fn: function (){
  14466. var self=this,$self=this;
  14467. return $core.withContext(function($ctx1) {
  14468. var $1,$3,$2,$receiver;
  14469. $1=$self._superclass();
  14470. $ctx1.sendIdx["superclass"]=1;
  14471. if(($receiver = $1) == null || $receiver.a$nil){
  14472. return [];
  14473. } else {
  14474. $1;
  14475. }
  14476. $3=$self._superclass();
  14477. $ctx1.sendIdx["superclass"]=2;
  14478. $2=$recv($globals.OrderedCollection)._with_($3);
  14479. $recv($2)._addAll_($recv($self._superclass())._allSuperclasses());
  14480. return $recv($2)._yourself();
  14481. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  14482. },
  14483. args: [],
  14484. 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",
  14485. referencedClasses: ["OrderedCollection"],
  14486. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  14487. }),
  14488. $globals.Behavior);
  14489. $core.addMethod(
  14490. $core.method({
  14491. selector: "basicNew",
  14492. protocol: "instance creation",
  14493. fn: function (){
  14494. var self=this,$self=this;
  14495. return $core.withContext(function($ctx1) {
  14496. return new self.fn();
  14497. return self;
  14498. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  14499. },
  14500. args: [],
  14501. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  14502. referencedClasses: [],
  14503. messageSends: []
  14504. }),
  14505. $globals.Behavior);
  14506. $core.addMethod(
  14507. $core.method({
  14508. selector: "basicOrganization",
  14509. protocol: "accessing",
  14510. fn: function (){
  14511. var self=this,$self=this;
  14512. return $self.organization;
  14513. },
  14514. args: [],
  14515. source: "basicOrganization\x0a\x09^ organization",
  14516. referencedClasses: [],
  14517. messageSends: []
  14518. }),
  14519. $globals.Behavior);
  14520. $core.addMethod(
  14521. $core.method({
  14522. selector: "basicOrganization:",
  14523. protocol: "accessing",
  14524. fn: function (aClassOrganizer){
  14525. var self=this,$self=this;
  14526. $self.organization=aClassOrganizer;
  14527. return self;
  14528. },
  14529. args: ["aClassOrganizer"],
  14530. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  14531. referencedClasses: [],
  14532. messageSends: []
  14533. }),
  14534. $globals.Behavior);
  14535. $core.addMethod(
  14536. $core.method({
  14537. selector: "canUnderstand:",
  14538. protocol: "testing",
  14539. fn: function (aSelector){
  14540. var self=this,$self=this;
  14541. return $core.withContext(function($ctx1) {
  14542. var $2,$1;
  14543. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  14544. return $core.withContext(function($ctx2) {
  14545. $2=$self._superclass();
  14546. $ctx2.sendIdx["superclass"]=1;
  14547. $1=$recv($2)._notNil();
  14548. return $recv($1)._and_((function(){
  14549. return $core.withContext(function($ctx3) {
  14550. return $recv($self._superclass())._canUnderstand_(aSelector);
  14551. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14552. }));
  14553. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14554. }));
  14555. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  14556. },
  14557. args: ["aSelector"],
  14558. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  14559. referencedClasses: [],
  14560. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  14561. }),
  14562. $globals.Behavior);
  14563. $core.addMethod(
  14564. $core.method({
  14565. selector: "includesBehavior:",
  14566. protocol: "testing",
  14567. fn: function (aClass){
  14568. var self=this,$self=this;
  14569. return $core.withContext(function($ctx1) {
  14570. return $recv($self.__eq_eq(aClass))._or_((function(){
  14571. return $core.withContext(function($ctx2) {
  14572. return $self._inheritsFrom_(aClass);
  14573. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14574. }));
  14575. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  14576. },
  14577. args: ["aClass"],
  14578. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  14579. referencedClasses: [],
  14580. messageSends: ["or:", "==", "inheritsFrom:"]
  14581. }),
  14582. $globals.Behavior);
  14583. $core.addMethod(
  14584. $core.method({
  14585. selector: "inheritsFrom:",
  14586. protocol: "testing",
  14587. fn: function (aClass){
  14588. var self=this,$self=this;
  14589. return $core.withContext(function($ctx1) {
  14590. var $1,$3,$2,$receiver;
  14591. $1=$self._superclass();
  14592. $ctx1.sendIdx["superclass"]=1;
  14593. if(($receiver = $1) == null || $receiver.a$nil){
  14594. return false;
  14595. } else {
  14596. $1;
  14597. }
  14598. $3=$self._superclass();
  14599. $ctx1.sendIdx["superclass"]=2;
  14600. $2=$recv(aClass).__eq_eq($3);
  14601. return $recv($2)._or_((function(){
  14602. return $core.withContext(function($ctx2) {
  14603. return $recv($self._superclass())._inheritsFrom_(aClass);
  14604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14605. }));
  14606. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  14607. },
  14608. args: ["aClass"],
  14609. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  14610. referencedClasses: [],
  14611. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  14612. }),
  14613. $globals.Behavior);
  14614. $core.addMethod(
  14615. $core.method({
  14616. selector: "instanceVariableNames",
  14617. protocol: "accessing",
  14618. fn: function (){
  14619. var self=this,$self=this;
  14620. return $self.slots;
  14621. },
  14622. args: [],
  14623. source: "instanceVariableNames\x0a\x09^ slots",
  14624. referencedClasses: [],
  14625. messageSends: []
  14626. }),
  14627. $globals.Behavior);
  14628. $core.addMethod(
  14629. $core.method({
  14630. selector: "isBehavior",
  14631. protocol: "testing",
  14632. fn: function (){
  14633. var self=this,$self=this;
  14634. return true;
  14635. },
  14636. args: [],
  14637. source: "isBehavior\x0a\x09^ true",
  14638. referencedClasses: [],
  14639. messageSends: []
  14640. }),
  14641. $globals.Behavior);
  14642. $core.addMethod(
  14643. $core.method({
  14644. selector: "javascriptConstructor",
  14645. protocol: "accessing",
  14646. fn: function (){
  14647. var self=this,$self=this;
  14648. return $self.fn;
  14649. },
  14650. args: [],
  14651. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See kernel-language.js\x22\x0a\x09\x0a\x09^ fn",
  14652. referencedClasses: [],
  14653. messageSends: []
  14654. }),
  14655. $globals.Behavior);
  14656. $core.addMethod(
  14657. $core.method({
  14658. selector: "javascriptConstructor:",
  14659. protocol: "accessing",
  14660. fn: function (aJavaScriptFunction){
  14661. var self=this,$self=this;
  14662. return $core.withContext(function($ctx1) {
  14663. $recv($recv($globals.Smalltalk)._core())._setClassConstructor_to_(self,aJavaScriptFunction);
  14664. return self;
  14665. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  14666. },
  14667. args: ["aJavaScriptFunction"],
  14668. 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\x09Smalltalk core setClassConstructor: self to: aJavaScriptFunction",
  14669. referencedClasses: ["Smalltalk"],
  14670. messageSends: ["setClassConstructor:to:", "core"]
  14671. }),
  14672. $globals.Behavior);
  14673. $core.addMethod(
  14674. $core.method({
  14675. selector: "lookupSelector:",
  14676. protocol: "accessing",
  14677. fn: function (selector){
  14678. var self=this,$self=this;
  14679. var lookupClass;
  14680. return $core.withContext(function($ctx1) {
  14681. var $1;
  14682. var $early={};
  14683. try {
  14684. lookupClass=self;
  14685. $recv((function(){
  14686. return $core.withContext(function($ctx2) {
  14687. return $recv(lookupClass).__eq(nil);
  14688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14689. }))._whileFalse_((function(){
  14690. return $core.withContext(function($ctx2) {
  14691. $1=$recv(lookupClass)._includesSelector_(selector);
  14692. if($core.assert($1)){
  14693. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  14694. }
  14695. lookupClass=$recv(lookupClass)._superclass();
  14696. return lookupClass;
  14697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14698. }));
  14699. return nil;
  14700. }
  14701. catch(e) {if(e===$early)return e[0]; throw e}
  14702. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  14703. },
  14704. args: ["selector"],
  14705. 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",
  14706. referencedClasses: [],
  14707. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  14708. }),
  14709. $globals.Behavior);
  14710. $core.addMethod(
  14711. $core.method({
  14712. selector: "new",
  14713. protocol: "instance creation",
  14714. fn: function (){
  14715. var self=this,$self=this;
  14716. return $core.withContext(function($ctx1) {
  14717. return $recv($self._basicNew())._initialize();
  14718. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  14719. },
  14720. args: [],
  14721. source: "new\x0a\x09^ self basicNew initialize",
  14722. referencedClasses: [],
  14723. messageSends: ["initialize", "basicNew"]
  14724. }),
  14725. $globals.Behavior);
  14726. $core.addMethod(
  14727. $core.method({
  14728. selector: "prototype",
  14729. protocol: "accessing",
  14730. fn: function (){
  14731. var self=this,$self=this;
  14732. return $core.withContext(function($ctx1) {
  14733. return $recv($self._javascriptConstructor())._prototype();
  14734. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  14735. },
  14736. args: [],
  14737. source: "prototype\x0a\x09^ self javascriptConstructor prototype",
  14738. referencedClasses: [],
  14739. messageSends: ["prototype", "javascriptConstructor"]
  14740. }),
  14741. $globals.Behavior);
  14742. $core.addMethod(
  14743. $core.method({
  14744. selector: "subclasses",
  14745. protocol: "accessing",
  14746. fn: function (){
  14747. var self=this,$self=this;
  14748. return $core.withContext(function($ctx1) {
  14749. $self._subclassResponsibility();
  14750. return self;
  14751. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  14752. },
  14753. args: [],
  14754. source: "subclasses\x0a\x09self subclassResponsibility",
  14755. referencedClasses: [],
  14756. messageSends: ["subclassResponsibility"]
  14757. }),
  14758. $globals.Behavior);
  14759. $core.addMethod(
  14760. $core.method({
  14761. selector: "superclass",
  14762. protocol: "accessing",
  14763. fn: function (){
  14764. var self=this,$self=this;
  14765. return $self.superclass;
  14766. },
  14767. args: [],
  14768. source: "superclass\x0a\x09^ superclass",
  14769. referencedClasses: [],
  14770. messageSends: []
  14771. }),
  14772. $globals.Behavior);
  14773. $core.addMethod(
  14774. $core.method({
  14775. selector: "theMetaClass",
  14776. protocol: "accessing",
  14777. fn: function (){
  14778. var self=this,$self=this;
  14779. return $core.withContext(function($ctx1) {
  14780. $self._subclassResponsibility();
  14781. return self;
  14782. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  14783. },
  14784. args: [],
  14785. source: "theMetaClass\x0a\x09self subclassResponsibility",
  14786. referencedClasses: [],
  14787. messageSends: ["subclassResponsibility"]
  14788. }),
  14789. $globals.Behavior);
  14790. $core.addMethod(
  14791. $core.method({
  14792. selector: "theNonMetaClass",
  14793. protocol: "accessing",
  14794. fn: function (){
  14795. var self=this,$self=this;
  14796. return $core.withContext(function($ctx1) {
  14797. $self._subclassResponsibility();
  14798. return self;
  14799. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  14800. },
  14801. args: [],
  14802. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  14803. referencedClasses: [],
  14804. messageSends: ["subclassResponsibility"]
  14805. }),
  14806. $globals.Behavior);
  14807. $core.addMethod(
  14808. $core.method({
  14809. selector: "withAllSubclasses",
  14810. protocol: "accessing",
  14811. fn: function (){
  14812. var self=this,$self=this;
  14813. return $core.withContext(function($ctx1) {
  14814. var $1;
  14815. $1=$recv($globals.Array)._with_(self);
  14816. $recv($1)._addAll_($self._allSubclasses());
  14817. return $recv($1)._yourself();
  14818. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  14819. },
  14820. args: [],
  14821. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  14822. referencedClasses: ["Array"],
  14823. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  14824. }),
  14825. $globals.Behavior);
  14826. $core.addClass("Class", $globals.Behavior, ["package", "subclasses"], "Kernel-Classes");
  14827. $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.";
  14828. $core.addMethod(
  14829. $core.method({
  14830. selector: "basicPackage:",
  14831. protocol: "accessing",
  14832. fn: function (aPackage){
  14833. var self=this,$self=this;
  14834. $self.package=aPackage;
  14835. return self;
  14836. },
  14837. args: ["aPackage"],
  14838. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  14839. referencedClasses: [],
  14840. messageSends: []
  14841. }),
  14842. $globals.Class);
  14843. $core.addMethod(
  14844. $core.method({
  14845. selector: "classTag",
  14846. protocol: "accessing",
  14847. fn: function (){
  14848. var self=this,$self=this;
  14849. return "class";
  14850. },
  14851. args: [],
  14852. 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'",
  14853. referencedClasses: [],
  14854. messageSends: []
  14855. }),
  14856. $globals.Class);
  14857. $core.addMethod(
  14858. $core.method({
  14859. selector: "definition",
  14860. protocol: "accessing",
  14861. fn: function (){
  14862. var self=this,$self=this;
  14863. return $core.withContext(function($ctx1) {
  14864. var $1,$2;
  14865. return $recv($globals.String)._streamContents_((function(stream){
  14866. return $core.withContext(function($ctx2) {
  14867. $recv(stream)._print_($self._superclass());
  14868. $ctx2.sendIdx["print:"]=1;
  14869. $recv(stream)._write_(" subclass: ");
  14870. $ctx2.sendIdx["write:"]=1;
  14871. $recv(stream)._printSymbol_($self._name());
  14872. $recv(stream)._lf();
  14873. $ctx2.sendIdx["lf"]=1;
  14874. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  14875. return $core.withContext(function($ctx3) {
  14876. $1=$recv($globals.String)._tab();
  14877. $ctx3.sendIdx["tab"]=1;
  14878. $2=$recv($globals.String)._lf();
  14879. $ctx3.sendIdx["lf"]=2;
  14880. return [$1,"uses: ",tcd,$2];
  14881. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  14882. })));
  14883. $ctx2.sendIdx["write:"]=2;
  14884. $recv(stream)._tab();
  14885. $ctx2.sendIdx["tab"]=2;
  14886. $recv(stream)._write_(["slots: {",". "._join_($recv($self._instanceVariableNames())._collect_("symbolPrintString")),"}"]);
  14887. $ctx2.sendIdx["write:"]=3;
  14888. $recv(stream)._lf();
  14889. $recv(stream)._tab();
  14890. $recv(stream)._write_("package: ");
  14891. return $recv(stream)._print_($self._category());
  14892. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14893. }));
  14894. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  14895. },
  14896. args: [],
  14897. 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: {'slots: {'. ('. ' join: (self instanceVariableNames collect: #symbolPrintString)). '}'}; lf;\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  14898. referencedClasses: ["String"],
  14899. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "collect:", "instanceVariableNames", "category"]
  14900. }),
  14901. $globals.Class);
  14902. $core.addMethod(
  14903. $core.method({
  14904. selector: "isClass",
  14905. protocol: "testing",
  14906. fn: function (){
  14907. var self=this,$self=this;
  14908. return true;
  14909. },
  14910. args: [],
  14911. source: "isClass\x0a\x09^ true",
  14912. referencedClasses: [],
  14913. messageSends: []
  14914. }),
  14915. $globals.Class);
  14916. $core.addMethod(
  14917. $core.method({
  14918. selector: "package",
  14919. protocol: "accessing",
  14920. fn: function (){
  14921. var self=this,$self=this;
  14922. return $self.package;
  14923. },
  14924. args: [],
  14925. source: "package\x0a\x09^ package",
  14926. referencedClasses: [],
  14927. messageSends: []
  14928. }),
  14929. $globals.Class);
  14930. $core.addMethod(
  14931. $core.method({
  14932. selector: "provided",
  14933. protocol: "converting",
  14934. fn: function (){
  14935. var self=this,$self=this;
  14936. return $core.withContext(function($ctx1) {
  14937. return $recv($self._javascriptConstructor())._provided();
  14938. }, function($ctx1) {$ctx1.fill(self,"provided",{},$globals.Class)});
  14939. },
  14940. args: [],
  14941. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 Number provided EPSILON\x0a\x09that forwards to (wrapped JS) constructor function.\x22\x0a\x09\x0a\x09^ self javascriptConstructor provided",
  14942. referencedClasses: [],
  14943. messageSends: ["provided", "javascriptConstructor"]
  14944. }),
  14945. $globals.Class);
  14946. $core.addMethod(
  14947. $core.method({
  14948. selector: "rename:",
  14949. protocol: "accessing",
  14950. fn: function (aString){
  14951. var self=this,$self=this;
  14952. return $core.withContext(function($ctx1) {
  14953. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  14954. return self;
  14955. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  14956. },
  14957. args: ["aString"],
  14958. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  14959. referencedClasses: ["ClassBuilder"],
  14960. messageSends: ["renameClass:to:", "new"]
  14961. }),
  14962. $globals.Class);
  14963. $core.addMethod(
  14964. $core.method({
  14965. selector: "subclasses",
  14966. protocol: "accessing",
  14967. fn: function (){
  14968. var self=this,$self=this;
  14969. return $core.withContext(function($ctx1) {
  14970. return $recv($self.subclasses)._copy();
  14971. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  14972. },
  14973. args: [],
  14974. source: "subclasses\x0a\x09^ subclasses copy",
  14975. referencedClasses: [],
  14976. messageSends: ["copy"]
  14977. }),
  14978. $globals.Class);
  14979. $core.addMethod(
  14980. $core.method({
  14981. selector: "theMetaClass",
  14982. protocol: "accessing",
  14983. fn: function (){
  14984. var self=this,$self=this;
  14985. return $core.withContext(function($ctx1) {
  14986. return $self._class();
  14987. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  14988. },
  14989. args: [],
  14990. source: "theMetaClass\x0a\x09^ self class",
  14991. referencedClasses: [],
  14992. messageSends: ["class"]
  14993. }),
  14994. $globals.Class);
  14995. $core.addClass("Metaclass", $globals.Behavior, ["instanceClass"], "Kernel-Classes");
  14996. $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.";
  14997. $core.addMethod(
  14998. $core.method({
  14999. selector: "asJavaScriptSource",
  15000. protocol: "converting",
  15001. fn: function (){
  15002. var self=this,$self=this;
  15003. return $core.withContext(function($ctx1) {
  15004. var $1;
  15005. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  15006. $ctx1.sendIdx[","]=1;
  15007. return $1;
  15008. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  15009. },
  15010. args: [],
  15011. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  15012. referencedClasses: [],
  15013. messageSends: [",", "name", "instanceClass"]
  15014. }),
  15015. $globals.Metaclass);
  15016. $core.addMethod(
  15017. $core.method({
  15018. selector: "definition",
  15019. protocol: "accessing",
  15020. fn: function (){
  15021. var self=this,$self=this;
  15022. return $core.withContext(function($ctx1) {
  15023. var $1,$2;
  15024. return $recv($globals.String)._streamContents_((function(stream){
  15025. return $core.withContext(function($ctx2) {
  15026. $recv(stream)._print_(self);
  15027. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  15028. return " ";
  15029. }),(function(tcd){
  15030. return $core.withContext(function($ctx3) {
  15031. $1=$recv($globals.String)._lf();
  15032. $ctx3.sendIdx["lf"]=1;
  15033. $2=$recv($globals.String)._tab();
  15034. $ctx3.sendIdx["tab"]=1;
  15035. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  15036. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  15037. })));
  15038. $ctx2.sendIdx["write:"]=1;
  15039. return $recv(stream)._write_(["slots: {",". "._join_($recv($self._instanceVariableNames())._collect_("symbolPrintString")),"}"]);
  15040. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15041. }));
  15042. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  15043. },
  15044. args: [],
  15045. 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: {'slots: {'. ('. ' join: (self instanceVariableNames collect: #symbolPrintString)). '}'} ]",
  15046. referencedClasses: ["String"],
  15047. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "collect:", "instanceVariableNames"]
  15048. }),
  15049. $globals.Metaclass);
  15050. $core.addMethod(
  15051. $core.method({
  15052. selector: "instanceClass",
  15053. protocol: "accessing",
  15054. fn: function (){
  15055. var self=this,$self=this;
  15056. return $self.instanceClass;
  15057. },
  15058. args: [],
  15059. source: "instanceClass\x0a\x09^ instanceClass",
  15060. referencedClasses: [],
  15061. messageSends: []
  15062. }),
  15063. $globals.Metaclass);
  15064. $core.addMethod(
  15065. $core.method({
  15066. selector: "instanceVariableNames:",
  15067. protocol: "accessing",
  15068. fn: function (aString){
  15069. var self=this,$self=this;
  15070. return $core.withContext(function($ctx1) {
  15071. return $self._slots_($recv(aString)._instanceVariablesStringAsSlotList());
  15072. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aString:aString},$globals.Metaclass)});
  15073. },
  15074. args: ["aString"],
  15075. source: "instanceVariableNames: aString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self slots: aString instanceVariablesStringAsSlotList",
  15076. referencedClasses: [],
  15077. messageSends: ["slots:", "instanceVariablesStringAsSlotList"]
  15078. }),
  15079. $globals.Metaclass);
  15080. $core.addMethod(
  15081. $core.method({
  15082. selector: "isMetaclass",
  15083. protocol: "testing",
  15084. fn: function (){
  15085. var self=this,$self=this;
  15086. return true;
  15087. },
  15088. args: [],
  15089. source: "isMetaclass\x0a\x09^ true",
  15090. referencedClasses: [],
  15091. messageSends: []
  15092. }),
  15093. $globals.Metaclass);
  15094. $core.addMethod(
  15095. $core.method({
  15096. selector: "name",
  15097. protocol: "accessing",
  15098. fn: function (){
  15099. var self=this,$self=this;
  15100. return $core.withContext(function($ctx1) {
  15101. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  15102. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  15103. },
  15104. args: [],
  15105. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15106. referencedClasses: [],
  15107. messageSends: [",", "name", "instanceClass"]
  15108. }),
  15109. $globals.Metaclass);
  15110. $core.addMethod(
  15111. $core.method({
  15112. selector: "package",
  15113. protocol: "accessing",
  15114. fn: function (){
  15115. var self=this,$self=this;
  15116. return $core.withContext(function($ctx1) {
  15117. return $recv($self._instanceClass())._package();
  15118. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  15119. },
  15120. args: [],
  15121. source: "package\x0a\x09^ self instanceClass package",
  15122. referencedClasses: [],
  15123. messageSends: ["package", "instanceClass"]
  15124. }),
  15125. $globals.Metaclass);
  15126. $core.addMethod(
  15127. $core.method({
  15128. selector: "slots:",
  15129. protocol: "accessing",
  15130. fn: function (aCollection){
  15131. var self=this,$self=this;
  15132. return $core.withContext(function($ctx1) {
  15133. $recv($recv($globals.ClassBuilder)._new())._class_slots_(self,aCollection);
  15134. return self;
  15135. }, function($ctx1) {$ctx1.fill(self,"slots:",{aCollection:aCollection},$globals.Metaclass)});
  15136. },
  15137. args: ["aCollection"],
  15138. source: "slots: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self slots: aCollection.\x0a\x09^ self",
  15139. referencedClasses: ["ClassBuilder"],
  15140. messageSends: ["class:slots:", "new"]
  15141. }),
  15142. $globals.Metaclass);
  15143. $core.addMethod(
  15144. $core.method({
  15145. selector: "subclasses",
  15146. protocol: "accessing",
  15147. fn: function (){
  15148. var self=this,$self=this;
  15149. return $core.withContext(function($ctx1) {
  15150. return $recv($recv($globals.Smalltalk)._core())._metaSubclasses_(self);
  15151. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  15152. },
  15153. args: [],
  15154. source: "subclasses\x0a\x09^ Smalltalk core metaSubclasses: self",
  15155. referencedClasses: ["Smalltalk"],
  15156. messageSends: ["metaSubclasses:", "core"]
  15157. }),
  15158. $globals.Metaclass);
  15159. $core.addMethod(
  15160. $core.method({
  15161. selector: "theMetaClass",
  15162. protocol: "accessing",
  15163. fn: function (){
  15164. var self=this,$self=this;
  15165. return self;
  15166. },
  15167. args: [],
  15168. source: "theMetaClass\x0a\x09^ self",
  15169. referencedClasses: [],
  15170. messageSends: []
  15171. }),
  15172. $globals.Metaclass);
  15173. $core.addMethod(
  15174. $core.method({
  15175. selector: "theNonMetaClass",
  15176. protocol: "accessing",
  15177. fn: function (){
  15178. var self=this,$self=this;
  15179. return $core.withContext(function($ctx1) {
  15180. return $self._instanceClass();
  15181. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  15182. },
  15183. args: [],
  15184. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15185. referencedClasses: [],
  15186. messageSends: ["instanceClass"]
  15187. }),
  15188. $globals.Metaclass);
  15189. $core.addMethod(
  15190. $core.method({
  15191. selector: "uses:instanceVariableNames:",
  15192. protocol: "accessing",
  15193. fn: function (aTraitCompositionDescription,aString){
  15194. var self=this,$self=this;
  15195. return $core.withContext(function($ctx1) {
  15196. return $self._uses_slots_(aTraitCompositionDescription,$recv(aString)._instanceVariablesStringAsSlotList());
  15197. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aString:aString},$globals.Metaclass)});
  15198. },
  15199. args: ["aTraitCompositionDescription", "aString"],
  15200. source: "uses: aTraitCompositionDescription instanceVariableNames: aString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self uses: aTraitCompositionDescription slots: aString instanceVariablesStringAsSlotList",
  15201. referencedClasses: [],
  15202. messageSends: ["uses:slots:", "instanceVariablesStringAsSlotList"]
  15203. }),
  15204. $globals.Metaclass);
  15205. $core.addMethod(
  15206. $core.method({
  15207. selector: "uses:slots:",
  15208. protocol: "accessing",
  15209. fn: function (aTraitCompositionDescription,aCollection){
  15210. var self=this,$self=this;
  15211. return $core.withContext(function($ctx1) {
  15212. $self._slots_(aCollection);
  15213. $self._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15214. return self;
  15215. }, function($ctx1) {$ctx1.fill(self,"uses:slots:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection},$globals.Metaclass)});
  15216. },
  15217. args: ["aTraitCompositionDescription", "aCollection"],
  15218. source: "uses: aTraitCompositionDescription slots: aCollection\x0a\x09self\x0a\x09\x09slots: aCollection;\x0a\x09\x09setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ self",
  15219. referencedClasses: [],
  15220. messageSends: ["slots:", "setTraitComposition:", "asTraitComposition"]
  15221. }),
  15222. $globals.Metaclass);
  15223. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15224. $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:`.";
  15225. $core.addMethod(
  15226. $core.method({
  15227. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15228. protocol: "class definition",
  15229. fn: function (aClass,className,aCollection,packageName){
  15230. var self=this,$self=this;
  15231. var theClass,thePackage;
  15232. return $core.withContext(function($ctx1) {
  15233. var $1,$2,$3,$receiver;
  15234. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15235. thePackage=$recv($globals.Package)._named_(packageName);
  15236. $1=theClass;
  15237. if(($receiver = $1) == null || $receiver.a$nil){
  15238. $1;
  15239. } else {
  15240. $recv(theClass)._package_(thePackage);
  15241. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15242. if(!$core.assert($2)){
  15243. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15244. }
  15245. }
  15246. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15247. $recv($3)._recompile();
  15248. return $recv($3)._yourself();
  15249. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  15250. },
  15251. args: ["aClass", "className", "aCollection", "packageName"],
  15252. 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",
  15253. referencedClasses: ["Smalltalk", "Package"],
  15254. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15255. }),
  15256. $globals.ClassBuilder);
  15257. $core.addMethod(
  15258. $core.method({
  15259. selector: "addTraitNamed:package:",
  15260. protocol: "class definition",
  15261. fn: function (traitName,packageName){
  15262. var self=this,$self=this;
  15263. var theTrait,thePackage;
  15264. return $core.withContext(function($ctx1) {
  15265. var $1,$2,$receiver;
  15266. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15267. thePackage=$recv($globals.Package)._named_(packageName);
  15268. $1=theTrait;
  15269. if(($receiver = $1) == null || $receiver.a$nil){
  15270. $1;
  15271. } else {
  15272. $2=theTrait;
  15273. $recv($2)._package_(thePackage);
  15274. $recv($2)._recompile();
  15275. return $recv($2)._yourself();
  15276. }
  15277. return $self._basicAddTraitNamed_package_(traitName,packageName);
  15278. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  15279. },
  15280. args: ["traitName", "packageName"],
  15281. 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",
  15282. referencedClasses: ["Smalltalk", "Package"],
  15283. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15284. }),
  15285. $globals.ClassBuilder);
  15286. $core.addMethod(
  15287. $core.method({
  15288. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15289. protocol: "private",
  15290. fn: function (aClass,aString,aCollection,packageName){
  15291. var self=this,$self=this;
  15292. return $core.withContext(function($ctx1) {
  15293. return $core.addClass(aString, aClass, aCollection, packageName);
  15294. ;
  15295. return self;
  15296. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  15297. },
  15298. args: ["aClass", "aString", "aCollection", "packageName"],
  15299. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15300. referencedClasses: [],
  15301. messageSends: []
  15302. }),
  15303. $globals.ClassBuilder);
  15304. $core.addMethod(
  15305. $core.method({
  15306. selector: "basicAddTraitNamed:package:",
  15307. protocol: "private",
  15308. fn: function (aString,anotherString){
  15309. var self=this,$self=this;
  15310. return $core.withContext(function($ctx1) {
  15311. return $core.addTrait(aString, anotherString);
  15312. return self;
  15313. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  15314. },
  15315. args: ["aString", "anotherString"],
  15316. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15317. referencedClasses: [],
  15318. messageSends: []
  15319. }),
  15320. $globals.ClassBuilder);
  15321. $core.addMethod(
  15322. $core.method({
  15323. selector: "basicClass:instanceVariables:",
  15324. protocol: "private",
  15325. fn: function (aClass,aCollection){
  15326. var self=this,$self=this;
  15327. return $core.withContext(function($ctx1) {
  15328. var $1;
  15329. $1=$recv(aClass)._isMetaclass();
  15330. if(!$core.assert($1)){
  15331. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  15332. }
  15333. $recv($recv($globals.Smalltalk)._core())._setSlots_to_(aClass,aCollection);
  15334. return self;
  15335. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15336. },
  15337. args: ["aClass", "aCollection"],
  15338. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09Smalltalk core setSlots: aClass to: aCollection",
  15339. referencedClasses: ["Smalltalk"],
  15340. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "setSlots:to:", "core"]
  15341. }),
  15342. $globals.ClassBuilder);
  15343. $core.addMethod(
  15344. $core.method({
  15345. selector: "basicRemoveClass:",
  15346. protocol: "private",
  15347. fn: function (aClass){
  15348. var self=this,$self=this;
  15349. return $core.withContext(function($ctx1) {
  15350. $core.removeClass(aClass);
  15351. return self;
  15352. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  15353. },
  15354. args: ["aClass"],
  15355. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  15356. referencedClasses: [],
  15357. messageSends: []
  15358. }),
  15359. $globals.ClassBuilder);
  15360. $core.addMethod(
  15361. $core.method({
  15362. selector: "basicRenameClass:to:",
  15363. protocol: "private",
  15364. fn: function (aClass,aString){
  15365. var self=this,$self=this;
  15366. return $core.withContext(function($ctx1) {
  15367. $globals[aString] = aClass;
  15368. delete $globals[aClass.name];
  15369. aClass.name = aString;
  15370. ;
  15371. return self;
  15372. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15373. },
  15374. args: ["aClass", "aString"],
  15375. 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'>",
  15376. referencedClasses: [],
  15377. messageSends: []
  15378. }),
  15379. $globals.ClassBuilder);
  15380. $core.addMethod(
  15381. $core.method({
  15382. selector: "basicSwapClassNames:with:",
  15383. protocol: "private",
  15384. fn: function (aClass,anotherClass){
  15385. var self=this,$self=this;
  15386. return $core.withContext(function($ctx1) {
  15387. var tmp = aClass.name;
  15388. aClass.name = anotherClass.name;
  15389. anotherClass.name = tmp;
  15390. ;
  15391. return self;
  15392. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15393. },
  15394. args: ["aClass", "anotherClass"],
  15395. 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'>",
  15396. referencedClasses: [],
  15397. messageSends: []
  15398. }),
  15399. $globals.ClassBuilder);
  15400. $core.addMethod(
  15401. $core.method({
  15402. selector: "class:slots:",
  15403. protocol: "class definition",
  15404. fn: function (aClass,aCollection){
  15405. var self=this,$self=this;
  15406. return $core.withContext(function($ctx1) {
  15407. var $1,$3,$2;
  15408. $self._basicClass_instanceVariables_(aClass,aCollection);
  15409. $1=$recv($globals.SystemAnnouncer)._current();
  15410. $3=$recv($globals.ClassDefinitionChanged)._new();
  15411. $recv($3)._theClass_(aClass);
  15412. $2=$recv($3)._yourself();
  15413. $recv($1)._announce_($2);
  15414. return self;
  15415. }, function($ctx1) {$ctx1.fill(self,"class:slots:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15416. },
  15417. args: ["aClass", "aCollection"],
  15418. source: "class: aClass slots: aCollection\x0a\x09self basicClass: aClass instanceVariables: aCollection.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  15419. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  15420. messageSends: ["basicClass:instanceVariables:", "announce:", "current", "theClass:", "new", "yourself"]
  15421. }),
  15422. $globals.ClassBuilder);
  15423. $core.addMethod(
  15424. $core.method({
  15425. selector: "copyClass:named:",
  15426. protocol: "copying",
  15427. fn: function (aClass,className){
  15428. var self=this,$self=this;
  15429. var newClass;
  15430. return $core.withContext(function($ctx1) {
  15431. var $1,$3,$2;
  15432. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15433. $self._copyClass_to_(aClass,newClass);
  15434. $1=$recv($globals.SystemAnnouncer)._current();
  15435. $3=$recv($globals.ClassAdded)._new();
  15436. $recv($3)._theClass_(newClass);
  15437. $2=$recv($3)._yourself();
  15438. $recv($1)._announce_($2);
  15439. return newClass;
  15440. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  15441. },
  15442. args: ["aClass", "className"],
  15443. 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",
  15444. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15445. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  15446. }),
  15447. $globals.ClassBuilder);
  15448. $core.addMethod(
  15449. $core.method({
  15450. selector: "copyClass:to:",
  15451. protocol: "copying",
  15452. fn: function (aClass,anotherClass){
  15453. var self=this,$self=this;
  15454. return $core.withContext(function($ctx1) {
  15455. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  15456. $recv(anotherClass)._comment_($recv(aClass)._comment());
  15457. $1=$recv(aClass)._methodDictionary();
  15458. $ctx1.sendIdx["methodDictionary"]=1;
  15459. $recv($1)._valuesDo_((function(each){
  15460. return $core.withContext(function($ctx2) {
  15461. $3=$recv(each)._methodClass();
  15462. $ctx2.sendIdx["methodClass"]=1;
  15463. $2=$recv($3).__eq(aClass);
  15464. $ctx2.sendIdx["="]=1;
  15465. if($core.assert($2)){
  15466. $4=$recv($globals.Compiler)._new();
  15467. $ctx2.sendIdx["new"]=1;
  15468. $5=$recv(each)._source();
  15469. $ctx2.sendIdx["source"]=1;
  15470. $6=$recv(each)._protocol();
  15471. $ctx2.sendIdx["protocol"]=1;
  15472. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  15473. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  15474. }
  15475. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15476. }));
  15477. $ctx1.sendIdx["valuesDo:"]=1;
  15478. $7=$recv(aClass)._traitComposition();
  15479. $ctx1.sendIdx["traitComposition"]=1;
  15480. $recv(anotherClass)._setTraitComposition_($7);
  15481. $ctx1.sendIdx["setTraitComposition:"]=1;
  15482. $8=$recv(anotherClass)._class();
  15483. $ctx1.sendIdx["class"]=1;
  15484. $10=$recv(aClass)._class();
  15485. $ctx1.sendIdx["class"]=2;
  15486. $9=$recv($10)._instanceVariableNames();
  15487. $self._basicClass_instanceVariables_($8,$9);
  15488. $12=$recv(aClass)._class();
  15489. $ctx1.sendIdx["class"]=3;
  15490. $11=$recv($12)._methodDictionary();
  15491. $recv($11)._valuesDo_((function(each){
  15492. return $core.withContext(function($ctx2) {
  15493. $14=$recv(each)._methodClass();
  15494. $15=$recv(aClass)._class();
  15495. $ctx2.sendIdx["class"]=4;
  15496. $13=$recv($14).__eq($15);
  15497. if($core.assert($13)){
  15498. $16=$recv($globals.Compiler)._new();
  15499. $17=$recv(each)._source();
  15500. $18=$recv(anotherClass)._class();
  15501. $ctx2.sendIdx["class"]=5;
  15502. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  15503. }
  15504. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15505. }));
  15506. $19=$recv(anotherClass)._class();
  15507. $ctx1.sendIdx["class"]=6;
  15508. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  15509. return self;
  15510. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15511. },
  15512. args: ["aClass", "anotherClass"],
  15513. 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",
  15514. referencedClasses: ["Compiler"],
  15515. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  15516. }),
  15517. $globals.ClassBuilder);
  15518. $core.addMethod(
  15519. $core.method({
  15520. selector: "installMethod:forClass:protocol:",
  15521. protocol: "method definition",
  15522. fn: function (aCompiledMethod,aBehavior,aString){
  15523. var self=this,$self=this;
  15524. return $core.withContext(function($ctx1) {
  15525. $recv(aCompiledMethod)._protocol_(aString);
  15526. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  15527. return aCompiledMethod;
  15528. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  15529. },
  15530. args: ["aCompiledMethod", "aBehavior", "aString"],
  15531. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  15532. referencedClasses: [],
  15533. messageSends: ["protocol:", "addCompiledMethod:"]
  15534. }),
  15535. $globals.ClassBuilder);
  15536. $core.addMethod(
  15537. $core.method({
  15538. selector: "migrateClass:superclass:",
  15539. protocol: "class migration",
  15540. fn: function (aClass,anotherClass){
  15541. var self=this,$self=this;
  15542. return $core.withContext(function($ctx1) {
  15543. var $1;
  15544. $1=$recv(aClass)._name();
  15545. $ctx1.sendIdx["name"]=1;
  15546. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15547. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15548. },
  15549. args: ["aClass", "anotherClass"],
  15550. 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",
  15551. referencedClasses: [],
  15552. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  15553. }),
  15554. $globals.ClassBuilder);
  15555. $core.addMethod(
  15556. $core.method({
  15557. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  15558. protocol: "class migration",
  15559. fn: function (className,aClass,aCollection,packageName){
  15560. var self=this,$self=this;
  15561. var oldClass,newClass,tmp;
  15562. return $core.withContext(function($ctx1) {
  15563. var $1,$2,$4,$3;
  15564. tmp="new*".__comma(className);
  15565. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15566. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  15567. $self._basicSwapClassNames_with_(oldClass,newClass);
  15568. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  15569. $recv((function(){
  15570. return $core.withContext(function($ctx2) {
  15571. return $self._copyClass_to_(oldClass,newClass);
  15572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15573. }))._on_do_($globals.Error,(function(exception){
  15574. return $core.withContext(function($ctx2) {
  15575. $self._basicSwapClassNames_with_(oldClass,newClass);
  15576. $1=$self._basicRemoveClass_(newClass);
  15577. $ctx2.sendIdx["basicRemoveClass:"]=1;
  15578. return $recv(exception)._pass();
  15579. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  15580. }));
  15581. $self._rawRenameClass_to_(oldClass,tmp);
  15582. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  15583. $self._rawRenameClass_to_(newClass,className);
  15584. $recv($recv(oldClass)._subclasses())._do_((function(each){
  15585. return $core.withContext(function($ctx2) {
  15586. return $self._migrateClass_superclass_(each,newClass);
  15587. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15588. }));
  15589. $self._basicRemoveClass_(oldClass);
  15590. $2=$recv($globals.SystemAnnouncer)._current();
  15591. $4=$recv($globals.ClassMigrated)._new();
  15592. $recv($4)._theClass_(newClass);
  15593. $recv($4)._oldClass_(oldClass);
  15594. $3=$recv($4)._yourself();
  15595. $recv($2)._announce_($3);
  15596. return newClass;
  15597. }, 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)});
  15598. },
  15599. args: ["className", "aClass", "aCollection", "packageName"],
  15600. 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 pass ].\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",
  15601. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  15602. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "pass", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  15603. }),
  15604. $globals.ClassBuilder);
  15605. $core.addMethod(
  15606. $core.method({
  15607. selector: "rawRenameClass:to:",
  15608. protocol: "private",
  15609. fn: function (aClass,aString){
  15610. var self=this,$self=this;
  15611. return $core.withContext(function($ctx1) {
  15612. $globals[aString] = aClass;
  15613. ;
  15614. return self;
  15615. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15616. },
  15617. args: ["aClass", "aString"],
  15618. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  15619. referencedClasses: [],
  15620. messageSends: []
  15621. }),
  15622. $globals.ClassBuilder);
  15623. $core.addMethod(
  15624. $core.method({
  15625. selector: "renameClass:to:",
  15626. protocol: "class migration",
  15627. fn: function (aClass,className){
  15628. var self=this,$self=this;
  15629. return $core.withContext(function($ctx1) {
  15630. var $1,$3,$2;
  15631. $self._basicRenameClass_to_(aClass,className);
  15632. $recv(aClass)._recompile();
  15633. $1=$recv($globals.SystemAnnouncer)._current();
  15634. $3=$recv($globals.ClassRenamed)._new();
  15635. $recv($3)._theClass_(aClass);
  15636. $2=$recv($3)._yourself();
  15637. $recv($1)._announce_($2);
  15638. return self;
  15639. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15640. },
  15641. args: ["aClass", "className"],
  15642. 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)",
  15643. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  15644. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  15645. }),
  15646. $globals.ClassBuilder);
  15647. $core.addMethod(
  15648. $core.method({
  15649. selector: "superclass:subclass:",
  15650. protocol: "class definition",
  15651. fn: function (aClass,className){
  15652. var self=this,$self=this;
  15653. return $core.withContext(function($ctx1) {
  15654. return $self._superclass_subclass_slots_package_(aClass,className,[],nil);
  15655. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15656. },
  15657. args: ["aClass", "className"],
  15658. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className slots: #() package: nil",
  15659. referencedClasses: [],
  15660. messageSends: ["superclass:subclass:slots:package:"]
  15661. }),
  15662. $globals.ClassBuilder);
  15663. $core.addMethod(
  15664. $core.method({
  15665. selector: "superclass:subclass:slots:package:",
  15666. protocol: "class definition",
  15667. fn: function (aClass,className,aCollection,packageName){
  15668. var self=this,$self=this;
  15669. var newClass;
  15670. return $core.withContext(function($ctx1) {
  15671. var $1,$2,$4,$3,$receiver;
  15672. if(($receiver = packageName) == null || $receiver.a$nil){
  15673. $1="unclassified";
  15674. } else {
  15675. $1=packageName;
  15676. }
  15677. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,$1);
  15678. $2=$recv($globals.SystemAnnouncer)._current();
  15679. $4=$recv($globals.ClassAdded)._new();
  15680. $recv($4)._theClass_(newClass);
  15681. $3=$recv($4)._yourself();
  15682. $recv($2)._announce_($3);
  15683. return newClass;
  15684. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:slots:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  15685. },
  15686. args: ["aClass", "className", "aCollection", "packageName"],
  15687. source: "superclass: aClass subclass: className slots: aCollection package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: aCollection\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",
  15688. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15689. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  15690. }),
  15691. $globals.ClassBuilder);
  15692. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  15693. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  15694. $core.addMethod(
  15695. $core.method({
  15696. selector: "getNodesFrom:",
  15697. protocol: "accessing",
  15698. fn: function (aCollection){
  15699. var self=this,$self=this;
  15700. var children,others;
  15701. return $core.withContext(function($ctx1) {
  15702. var $1;
  15703. children=[];
  15704. others=[];
  15705. $recv(aCollection)._do_((function(each){
  15706. return $core.withContext(function($ctx2) {
  15707. $1=$recv($recv(each)._superclass()).__eq($self._theClass());
  15708. if($core.assert($1)){
  15709. return $recv(children)._add_(each);
  15710. $ctx2.sendIdx["add:"]=1;
  15711. } else {
  15712. return $recv(others)._add_(each);
  15713. }
  15714. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15715. }));
  15716. $self.nodes=$recv(children)._collect_((function(each){
  15717. return $core.withContext(function($ctx2) {
  15718. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv($self._level()).__plus((1)));
  15719. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  15720. }));
  15721. return self;
  15722. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  15723. },
  15724. args: ["aCollection"],
  15725. 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 ]",
  15726. referencedClasses: ["ClassSorterNode"],
  15727. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  15728. }),
  15729. $globals.ClassSorterNode);
  15730. $core.addMethod(
  15731. $core.method({
  15732. selector: "level",
  15733. protocol: "accessing",
  15734. fn: function (){
  15735. var self=this,$self=this;
  15736. return $self.level;
  15737. },
  15738. args: [],
  15739. source: "level\x0a\x09^ level",
  15740. referencedClasses: [],
  15741. messageSends: []
  15742. }),
  15743. $globals.ClassSorterNode);
  15744. $core.addMethod(
  15745. $core.method({
  15746. selector: "level:",
  15747. protocol: "accessing",
  15748. fn: function (anInteger){
  15749. var self=this,$self=this;
  15750. $self.level=anInteger;
  15751. return self;
  15752. },
  15753. args: ["anInteger"],
  15754. source: "level: anInteger\x0a\x09level := anInteger",
  15755. referencedClasses: [],
  15756. messageSends: []
  15757. }),
  15758. $globals.ClassSorterNode);
  15759. $core.addMethod(
  15760. $core.method({
  15761. selector: "nodes",
  15762. protocol: "accessing",
  15763. fn: function (){
  15764. var self=this,$self=this;
  15765. return $self.nodes;
  15766. },
  15767. args: [],
  15768. source: "nodes\x0a\x09^ nodes",
  15769. referencedClasses: [],
  15770. messageSends: []
  15771. }),
  15772. $globals.ClassSorterNode);
  15773. $core.addMethod(
  15774. $core.method({
  15775. selector: "theClass",
  15776. protocol: "accessing",
  15777. fn: function (){
  15778. var self=this,$self=this;
  15779. return $self.theClass;
  15780. },
  15781. args: [],
  15782. source: "theClass\x0a\x09^ theClass",
  15783. referencedClasses: [],
  15784. messageSends: []
  15785. }),
  15786. $globals.ClassSorterNode);
  15787. $core.addMethod(
  15788. $core.method({
  15789. selector: "theClass:",
  15790. protocol: "accessing",
  15791. fn: function (aClass){
  15792. var self=this,$self=this;
  15793. $self.theClass=aClass;
  15794. return self;
  15795. },
  15796. args: ["aClass"],
  15797. source: "theClass: aClass\x0a\x09theClass := aClass",
  15798. referencedClasses: [],
  15799. messageSends: []
  15800. }),
  15801. $globals.ClassSorterNode);
  15802. $core.addMethod(
  15803. $core.method({
  15804. selector: "traverseClassesWith:",
  15805. protocol: "visiting",
  15806. fn: function (aCollection){
  15807. var self=this,$self=this;
  15808. return $core.withContext(function($ctx1) {
  15809. var $1,$3,$2;
  15810. $1=$self._theClass();
  15811. $ctx1.sendIdx["theClass"]=1;
  15812. $recv(aCollection)._add_($1);
  15813. $recv($recv($self._nodes())._sorted_((function(a,b){
  15814. return $core.withContext(function($ctx2) {
  15815. $3=$recv(a)._theClass();
  15816. $ctx2.sendIdx["theClass"]=2;
  15817. $2=$recv($3)._name();
  15818. $ctx2.sendIdx["name"]=1;
  15819. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  15820. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  15821. })))._do_((function(aNode){
  15822. return $core.withContext(function($ctx2) {
  15823. return $recv(aNode)._traverseClassesWith_(aCollection);
  15824. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  15825. }));
  15826. return self;
  15827. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  15828. },
  15829. args: ["aCollection"],
  15830. 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 ].",
  15831. referencedClasses: [],
  15832. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  15833. }),
  15834. $globals.ClassSorterNode);
  15835. $core.addMethod(
  15836. $core.method({
  15837. selector: "on:classes:level:",
  15838. protocol: "instance creation",
  15839. fn: function (aClass,aCollection,anInteger){
  15840. var self=this,$self=this;
  15841. return $core.withContext(function($ctx1) {
  15842. var $1;
  15843. $1=$self._new();
  15844. $recv($1)._theClass_(aClass);
  15845. $recv($1)._level_(anInteger);
  15846. $recv($1)._getNodesFrom_(aCollection);
  15847. return $recv($1)._yourself();
  15848. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.a$cls)});
  15849. },
  15850. args: ["aClass", "aCollection", "anInteger"],
  15851. 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",
  15852. referencedClasses: [],
  15853. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  15854. }),
  15855. $globals.ClassSorterNode.a$cls);
  15856. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  15857. $core.addMethod(
  15858. $core.method({
  15859. selector: "allInstanceVariableNames",
  15860. protocol: "accessing",
  15861. fn: function (){
  15862. var self=this,$self=this;
  15863. return [];
  15864. },
  15865. args: [],
  15866. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  15867. referencedClasses: [],
  15868. messageSends: []
  15869. }),
  15870. $globals.TBehaviorDefaults);
  15871. $core.addMethod(
  15872. $core.method({
  15873. selector: "allSubclassesDo:",
  15874. protocol: "enumerating",
  15875. fn: function (aBlock){
  15876. var self=this,$self=this;
  15877. return self;
  15878. },
  15879. args: ["aBlock"],
  15880. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  15881. referencedClasses: [],
  15882. messageSends: []
  15883. }),
  15884. $globals.TBehaviorDefaults);
  15885. $core.addMethod(
  15886. $core.method({
  15887. selector: "name",
  15888. protocol: "accessing",
  15889. fn: function (){
  15890. var self=this,$self=this;
  15891. return nil;
  15892. },
  15893. args: [],
  15894. source: "name\x0a\x09^ nil",
  15895. referencedClasses: [],
  15896. messageSends: []
  15897. }),
  15898. $globals.TBehaviorDefaults);
  15899. $core.addMethod(
  15900. $core.method({
  15901. selector: "printOn:",
  15902. protocol: "printing",
  15903. fn: function (aStream){
  15904. var self=this,$self=this;
  15905. return $core.withContext(function($ctx1) {
  15906. var $1,$receiver;
  15907. $1=$self._name();
  15908. if(($receiver = $1) == null || $receiver.a$nil){
  15909. (
  15910. $ctx1.supercall = true,
  15911. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  15912. $ctx1.supercall = false;
  15913. } else {
  15914. var name;
  15915. name=$receiver;
  15916. $recv(aStream)._nextPutAll_(name);
  15917. }
  15918. return self;
  15919. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.TBehaviorDefaults)});
  15920. },
  15921. args: ["aStream"],
  15922. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  15923. referencedClasses: [],
  15924. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  15925. }),
  15926. $globals.TBehaviorDefaults);
  15927. $core.addMethod(
  15928. $core.method({
  15929. selector: "superclass",
  15930. protocol: "accessing",
  15931. fn: function (){
  15932. var self=this,$self=this;
  15933. return nil;
  15934. },
  15935. args: [],
  15936. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  15937. referencedClasses: [],
  15938. messageSends: []
  15939. }),
  15940. $globals.TBehaviorDefaults);
  15941. $core.addMethod(
  15942. $core.method({
  15943. selector: "traitUsers",
  15944. protocol: "accessing",
  15945. fn: function (){
  15946. var self=this,$self=this;
  15947. return [];
  15948. },
  15949. args: [],
  15950. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  15951. referencedClasses: [],
  15952. messageSends: []
  15953. }),
  15954. $globals.TBehaviorDefaults);
  15955. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  15956. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  15957. $core.addMethod(
  15958. $core.method({
  15959. selector: ">>",
  15960. protocol: "accessing",
  15961. fn: function (aString){
  15962. var self=this,$self=this;
  15963. return $core.withContext(function($ctx1) {
  15964. return $self._methodAt_(aString);
  15965. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.TBehaviorProvider)});
  15966. },
  15967. args: ["aString"],
  15968. source: ">> aString\x0a\x09^ self methodAt: aString",
  15969. referencedClasses: [],
  15970. messageSends: ["methodAt:"]
  15971. }),
  15972. $globals.TBehaviorProvider);
  15973. $core.addMethod(
  15974. $core.method({
  15975. selector: "addCompiledMethod:",
  15976. protocol: "compiling",
  15977. fn: function (aMethod){
  15978. var self=this,$self=this;
  15979. var oldMethod,announcement;
  15980. return $core.withContext(function($ctx1) {
  15981. var $1,$2,$3,$4,$receiver;
  15982. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  15983. return nil;
  15984. }));
  15985. $self._basicAddCompiledMethod_(aMethod);
  15986. $1=oldMethod;
  15987. if(($receiver = $1) == null || $receiver.a$nil){
  15988. $2=$recv($globals.MethodAdded)._new();
  15989. $ctx1.sendIdx["new"]=1;
  15990. $recv($2)._method_(aMethod);
  15991. $ctx1.sendIdx["method:"]=1;
  15992. $3=$recv($2)._yourself();
  15993. $ctx1.sendIdx["yourself"]=1;
  15994. announcement=$3;
  15995. } else {
  15996. $4=$recv($globals.MethodModified)._new();
  15997. $recv($4)._oldMethod_(oldMethod);
  15998. $recv($4)._method_(aMethod);
  15999. announcement=$recv($4)._yourself();
  16000. }
  16001. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  16002. return self;
  16003. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.TBehaviorProvider)});
  16004. },
  16005. args: ["aMethod"],
  16006. 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",
  16007. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  16008. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  16009. }),
  16010. $globals.TBehaviorProvider);
  16011. $core.addMethod(
  16012. $core.method({
  16013. selector: "basicAddCompiledMethod:",
  16014. protocol: "private",
  16015. fn: function (aMethod){
  16016. var self=this,$self=this;
  16017. return $core.withContext(function($ctx1) {
  16018. $core.addMethod(aMethod, self);
  16019. return self;
  16020. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16021. },
  16022. args: ["aMethod"],
  16023. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  16024. referencedClasses: [],
  16025. messageSends: []
  16026. }),
  16027. $globals.TBehaviorProvider);
  16028. $core.addMethod(
  16029. $core.method({
  16030. selector: "basicRemoveCompiledMethod:",
  16031. protocol: "private",
  16032. fn: function (aMethod){
  16033. var self=this,$self=this;
  16034. return $core.withContext(function($ctx1) {
  16035. $core.removeMethod(aMethod,self);
  16036. return self;
  16037. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16038. },
  16039. args: ["aMethod"],
  16040. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  16041. referencedClasses: [],
  16042. messageSends: []
  16043. }),
  16044. $globals.TBehaviorProvider);
  16045. $core.addMethod(
  16046. $core.method({
  16047. selector: "compile:protocol:",
  16048. protocol: "compiling",
  16049. fn: function (aString,anotherString){
  16050. var self=this,$self=this;
  16051. return $core.withContext(function($ctx1) {
  16052. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  16053. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.TBehaviorProvider)});
  16054. },
  16055. args: ["aString", "anotherString"],
  16056. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  16057. referencedClasses: ["Compiler"],
  16058. messageSends: ["install:forClass:protocol:", "new"]
  16059. }),
  16060. $globals.TBehaviorProvider);
  16061. $core.addMethod(
  16062. $core.method({
  16063. selector: "includesSelector:",
  16064. protocol: "testing",
  16065. fn: function (aString){
  16066. var self=this,$self=this;
  16067. return $core.withContext(function($ctx1) {
  16068. return $recv($self._methodDictionary())._includesKey_(aString);
  16069. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.TBehaviorProvider)});
  16070. },
  16071. args: ["aString"],
  16072. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  16073. referencedClasses: [],
  16074. messageSends: ["includesKey:", "methodDictionary"]
  16075. }),
  16076. $globals.TBehaviorProvider);
  16077. $core.addMethod(
  16078. $core.method({
  16079. selector: "methodAt:",
  16080. protocol: "accessing",
  16081. fn: function (aString){
  16082. var self=this,$self=this;
  16083. return $core.withContext(function($ctx1) {
  16084. return $recv($self._methodDictionary())._at_(aString);
  16085. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.TBehaviorProvider)});
  16086. },
  16087. args: ["aString"],
  16088. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  16089. referencedClasses: [],
  16090. messageSends: ["at:", "methodDictionary"]
  16091. }),
  16092. $globals.TBehaviorProvider);
  16093. $core.addMethod(
  16094. $core.method({
  16095. selector: "methodDictionary",
  16096. protocol: "accessing",
  16097. fn: function (){
  16098. var self=this,$self=this;
  16099. return $core.withContext(function($ctx1) {
  16100. var dict = $globals.HashedCollection._new();
  16101. var methods = self.methods;
  16102. Object.keys(methods).forEach(function(i) {
  16103. if(methods[i].selector) {
  16104. dict._at_put_(methods[i].selector, methods[i]);
  16105. }
  16106. });
  16107. return dict;
  16108. return self;
  16109. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.TBehaviorProvider)});
  16110. },
  16111. args: [],
  16112. 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'>",
  16113. referencedClasses: [],
  16114. messageSends: []
  16115. }),
  16116. $globals.TBehaviorProvider);
  16117. $core.addMethod(
  16118. $core.method({
  16119. selector: "methodOrganizationEnter:andLeave:",
  16120. protocol: "accessing",
  16121. fn: function (aMethod,oldMethod){
  16122. var self=this,$self=this;
  16123. return $core.withContext(function($ctx1) {
  16124. var $1,$2,$receiver;
  16125. if(($receiver = aMethod) == null || $receiver.a$nil){
  16126. aMethod;
  16127. } else {
  16128. $1=$self._organization();
  16129. $2=$recv(aMethod)._protocol();
  16130. $ctx1.sendIdx["protocol"]=1;
  16131. $recv($1)._addElement_($2);
  16132. }
  16133. if(($receiver = oldMethod) == null || $receiver.a$nil){
  16134. oldMethod;
  16135. } else {
  16136. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  16137. }
  16138. return self;
  16139. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod},$globals.TBehaviorProvider)});
  16140. },
  16141. args: ["aMethod", "oldMethod"],
  16142. 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 ]",
  16143. referencedClasses: [],
  16144. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  16145. }),
  16146. $globals.TBehaviorProvider);
  16147. $core.addMethod(
  16148. $core.method({
  16149. selector: "methodTemplate",
  16150. protocol: "accessing",
  16151. fn: function (){
  16152. var self=this,$self=this;
  16153. return $core.withContext(function($ctx1) {
  16154. return $recv($globals.String)._streamContents_((function(stream){
  16155. return $core.withContext(function($ctx2) {
  16156. $recv(stream)._write_("messageSelectorAndArgumentNames");
  16157. $ctx2.sendIdx["write:"]=1;
  16158. $recv(stream)._lf();
  16159. $ctx2.sendIdx["lf"]=1;
  16160. $recv(stream)._tab();
  16161. $ctx2.sendIdx["tab"]=1;
  16162. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  16163. $ctx2.sendIdx["write:"]=2;
  16164. $recv(stream)._lf();
  16165. $ctx2.sendIdx["lf"]=2;
  16166. $recv(stream)._lf();
  16167. $ctx2.sendIdx["lf"]=3;
  16168. $recv(stream)._tab();
  16169. $ctx2.sendIdx["tab"]=2;
  16170. $recv(stream)._write_("| temporary variable names |");
  16171. $ctx2.sendIdx["write:"]=3;
  16172. $recv(stream)._lf();
  16173. $recv(stream)._tab();
  16174. return $recv(stream)._write_("statements");
  16175. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16176. }));
  16177. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.TBehaviorProvider)});
  16178. },
  16179. args: [],
  16180. 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' ]",
  16181. referencedClasses: ["String"],
  16182. messageSends: ["streamContents:", "write:", "lf", "tab"]
  16183. }),
  16184. $globals.TBehaviorProvider);
  16185. $core.addMethod(
  16186. $core.method({
  16187. selector: "methods",
  16188. protocol: "accessing",
  16189. fn: function (){
  16190. var self=this,$self=this;
  16191. return $core.withContext(function($ctx1) {
  16192. return $recv($self._methodDictionary())._values();
  16193. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.TBehaviorProvider)});
  16194. },
  16195. args: [],
  16196. source: "methods\x0a\x09^ self methodDictionary values",
  16197. referencedClasses: [],
  16198. messageSends: ["values", "methodDictionary"]
  16199. }),
  16200. $globals.TBehaviorProvider);
  16201. $core.addMethod(
  16202. $core.method({
  16203. selector: "methodsInProtocol:",
  16204. protocol: "accessing",
  16205. fn: function (aString){
  16206. var self=this,$self=this;
  16207. return $core.withContext(function($ctx1) {
  16208. return $recv($self._methods())._select_((function(each){
  16209. return $core.withContext(function($ctx2) {
  16210. return $recv($recv(each)._protocol()).__eq(aString);
  16211. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16212. }));
  16213. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16214. },
  16215. args: ["aString"],
  16216. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  16217. referencedClasses: [],
  16218. messageSends: ["select:", "methods", "=", "protocol"]
  16219. }),
  16220. $globals.TBehaviorProvider);
  16221. $core.addMethod(
  16222. $core.method({
  16223. selector: "organization",
  16224. protocol: "accessing",
  16225. fn: function (){
  16226. var self=this,$self=this;
  16227. return $core.withContext(function($ctx1) {
  16228. var $1,$receiver;
  16229. $1=$self._basicOrganization();
  16230. $ctx1.sendIdx["basicOrganization"]=1;
  16231. if(($receiver = $1) == null || $receiver.a$nil){
  16232. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  16233. return $self._basicOrganization();
  16234. } else {
  16235. return $1;
  16236. }
  16237. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.TBehaviorProvider)});
  16238. },
  16239. args: [],
  16240. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  16241. referencedClasses: ["ClassOrganizer"],
  16242. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  16243. }),
  16244. $globals.TBehaviorProvider);
  16245. $core.addMethod(
  16246. $core.method({
  16247. selector: "ownMethods",
  16248. protocol: "accessing",
  16249. fn: function (){
  16250. var self=this,$self=this;
  16251. return $core.withContext(function($ctx1) {
  16252. var $1;
  16253. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  16254. return $core.withContext(function($ctx2) {
  16255. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  16256. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  16257. })))._sorted_((function(a,b){
  16258. return $core.withContext(function($ctx2) {
  16259. $1=$recv(a)._selector();
  16260. $ctx2.sendIdx["selector"]=1;
  16261. return $recv($1).__lt_eq($recv(b)._selector());
  16262. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16263. }));
  16264. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.TBehaviorProvider)});
  16265. },
  16266. args: [],
  16267. 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 ]",
  16268. referencedClasses: ["OrderedCollection"],
  16269. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  16270. }),
  16271. $globals.TBehaviorProvider);
  16272. $core.addMethod(
  16273. $core.method({
  16274. selector: "ownMethodsInProtocol:",
  16275. protocol: "accessing",
  16276. fn: function (aString){
  16277. var self=this,$self=this;
  16278. return $core.withContext(function($ctx1) {
  16279. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  16280. return $core.withContext(function($ctx2) {
  16281. return $recv($recv(each)._methodClass()).__eq(self);
  16282. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16283. }));
  16284. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16285. },
  16286. args: ["aString"],
  16287. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  16288. referencedClasses: [],
  16289. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  16290. }),
  16291. $globals.TBehaviorProvider);
  16292. $core.addMethod(
  16293. $core.method({
  16294. selector: "ownProtocols",
  16295. protocol: "accessing",
  16296. fn: function (){
  16297. var self=this,$self=this;
  16298. return $core.withContext(function($ctx1) {
  16299. return $recv($self._protocols())._reject_((function(each){
  16300. return $core.withContext(function($ctx2) {
  16301. return $recv(each)._match_("^\x5c*");
  16302. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16303. }));
  16304. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.TBehaviorProvider)});
  16305. },
  16306. args: [],
  16307. 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*' ]",
  16308. referencedClasses: [],
  16309. messageSends: ["reject:", "protocols", "match:"]
  16310. }),
  16311. $globals.TBehaviorProvider);
  16312. $core.addMethod(
  16313. $core.method({
  16314. selector: "packageOfProtocol:",
  16315. protocol: "accessing",
  16316. fn: function (aString){
  16317. var self=this,$self=this;
  16318. return $core.withContext(function($ctx1) {
  16319. var $1;
  16320. $1=$recv(aString)._beginsWith_("*");
  16321. if(!$core.assert($1)){
  16322. return $self._package();
  16323. }
  16324. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  16325. return nil;
  16326. }));
  16327. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16328. },
  16329. args: ["aString"],
  16330. 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 ]",
  16331. referencedClasses: ["Package"],
  16332. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  16333. }),
  16334. $globals.TBehaviorProvider);
  16335. $core.addMethod(
  16336. $core.method({
  16337. selector: "protocols",
  16338. protocol: "accessing",
  16339. fn: function (){
  16340. var self=this,$self=this;
  16341. return $core.withContext(function($ctx1) {
  16342. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  16343. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.TBehaviorProvider)});
  16344. },
  16345. args: [],
  16346. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  16347. referencedClasses: [],
  16348. messageSends: ["sorted", "asArray", "elements", "organization"]
  16349. }),
  16350. $globals.TBehaviorProvider);
  16351. $core.addMethod(
  16352. $core.method({
  16353. selector: "protocolsDo:",
  16354. protocol: "enumerating",
  16355. fn: function (aBlock){
  16356. var self=this,$self=this;
  16357. var methodsByProtocol;
  16358. return $core.withContext(function($ctx1) {
  16359. methodsByProtocol=$recv($globals.HashedCollection)._new();
  16360. $ctx1.sendIdx["new"]=1;
  16361. $recv($self._methodDictionary())._valuesDo_((function(m){
  16362. return $core.withContext(function($ctx2) {
  16363. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  16364. return $core.withContext(function($ctx3) {
  16365. return $recv($globals.Array)._new();
  16366. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16367. })))._add_(m);
  16368. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  16369. }));
  16370. $recv($self._protocols())._do_((function(protocol){
  16371. return $core.withContext(function($ctx2) {
  16372. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  16373. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  16374. }));
  16375. return self;
  16376. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.TBehaviorProvider)});
  16377. },
  16378. args: ["aBlock"],
  16379. 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) ]",
  16380. referencedClasses: ["HashedCollection", "Array"],
  16381. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  16382. }),
  16383. $globals.TBehaviorProvider);
  16384. $core.addMethod(
  16385. $core.method({
  16386. selector: "recompile",
  16387. protocol: "compiling",
  16388. fn: function (){
  16389. var self=this,$self=this;
  16390. return $core.withContext(function($ctx1) {
  16391. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  16392. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.TBehaviorProvider)});
  16393. },
  16394. args: [],
  16395. source: "recompile\x0a\x09^ Compiler new recompile: self",
  16396. referencedClasses: ["Compiler"],
  16397. messageSends: ["recompile:", "new"]
  16398. }),
  16399. $globals.TBehaviorProvider);
  16400. $core.addMethod(
  16401. $core.method({
  16402. selector: "removeCompiledMethod:",
  16403. protocol: "compiling",
  16404. fn: function (aMethod){
  16405. var self=this,$self=this;
  16406. return $core.withContext(function($ctx1) {
  16407. var $1,$3,$2;
  16408. $self._basicRemoveCompiledMethod_(aMethod);
  16409. $1=$recv($globals.SystemAnnouncer)._current();
  16410. $3=$recv($globals.MethodRemoved)._new();
  16411. $recv($3)._method_(aMethod);
  16412. $2=$recv($3)._yourself();
  16413. $recv($1)._announce_($2);
  16414. return self;
  16415. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16416. },
  16417. args: ["aMethod"],
  16418. 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)",
  16419. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  16420. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  16421. }),
  16422. $globals.TBehaviorProvider);
  16423. $core.addMethod(
  16424. $core.method({
  16425. selector: "removeProtocolIfEmpty:",
  16426. protocol: "accessing",
  16427. fn: function (aString){
  16428. var self=this,$self=this;
  16429. return $core.withContext(function($ctx1) {
  16430. $recv($self._methods())._detect_ifNone_((function(each){
  16431. return $core.withContext(function($ctx2) {
  16432. return $recv($recv(each)._protocol()).__eq(aString);
  16433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16434. }),(function(){
  16435. return $core.withContext(function($ctx2) {
  16436. return $recv($self._organization())._removeElement_(aString);
  16437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16438. }));
  16439. return self;
  16440. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.TBehaviorProvider)});
  16441. },
  16442. args: ["aString"],
  16443. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  16444. referencedClasses: [],
  16445. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  16446. }),
  16447. $globals.TBehaviorProvider);
  16448. $core.addMethod(
  16449. $core.method({
  16450. selector: "selectors",
  16451. protocol: "accessing",
  16452. fn: function (){
  16453. var self=this,$self=this;
  16454. return $core.withContext(function($ctx1) {
  16455. return $recv($self._methodDictionary())._keys();
  16456. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.TBehaviorProvider)});
  16457. },
  16458. args: [],
  16459. source: "selectors\x0a\x09^ self methodDictionary keys",
  16460. referencedClasses: [],
  16461. messageSends: ["keys", "methodDictionary"]
  16462. }),
  16463. $globals.TBehaviorProvider);
  16464. $core.addMethod(
  16465. $core.method({
  16466. selector: "setTraitComposition:",
  16467. protocol: "compiling",
  16468. fn: function (aTraitComposition){
  16469. var self=this,$self=this;
  16470. return $core.withContext(function($ctx1) {
  16471. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  16472. return self;
  16473. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.TBehaviorProvider)});
  16474. },
  16475. args: ["aTraitComposition"],
  16476. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  16477. referencedClasses: [],
  16478. messageSends: []
  16479. }),
  16480. $globals.TBehaviorProvider);
  16481. $core.addMethod(
  16482. $core.method({
  16483. selector: "traitComposition",
  16484. protocol: "accessing",
  16485. fn: function (){
  16486. var self=this,$self=this;
  16487. return $core.withContext(function($ctx1) {
  16488. var $1,$receiver;
  16489. $1=$self._basicAt_("traitComposition");
  16490. if(($receiver = $1) == null || $receiver.a$nil){
  16491. return [];
  16492. } else {
  16493. var aCollection;
  16494. aCollection=$receiver;
  16495. return $recv(aCollection)._collect_((function(each){
  16496. return $core.withContext(function($ctx2) {
  16497. return $recv($globals.TraitTransformation)._fromJSON_(each);
  16498. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16499. }));
  16500. }
  16501. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.TBehaviorProvider)});
  16502. },
  16503. args: [],
  16504. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  16505. referencedClasses: ["TraitTransformation"],
  16506. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  16507. }),
  16508. $globals.TBehaviorProvider);
  16509. $core.addMethod(
  16510. $core.method({
  16511. selector: "traitCompositionDefinition",
  16512. protocol: "accessing",
  16513. fn: function (){
  16514. var self=this,$self=this;
  16515. return $core.withContext(function($ctx1) {
  16516. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  16517. return $core.withContext(function($ctx2) {
  16518. return $recv($globals.String)._streamContents_((function(str){
  16519. return $core.withContext(function($ctx3) {
  16520. $recv(str)._write_("{");
  16521. $ctx3.sendIdx["write:"]=1;
  16522. $recv(traitComposition)._do_separatedBy_((function(each){
  16523. return $core.withContext(function($ctx4) {
  16524. return $recv(str)._write_($recv(each)._definition());
  16525. $ctx4.sendIdx["write:"]=2;
  16526. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16527. }),(function(){
  16528. return $core.withContext(function($ctx4) {
  16529. return $recv(str)._write_(". ");
  16530. $ctx4.sendIdx["write:"]=3;
  16531. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16532. }));
  16533. return $recv(str)._write_("}");
  16534. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  16535. }));
  16536. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  16537. }));
  16538. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.TBehaviorProvider)});
  16539. },
  16540. args: [],
  16541. 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: '}' ] ]",
  16542. referencedClasses: ["String"],
  16543. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  16544. }),
  16545. $globals.TBehaviorProvider);
  16546. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  16547. $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.";
  16548. $core.addMethod(
  16549. $core.method({
  16550. selector: "asJavaScriptSource",
  16551. protocol: "converting",
  16552. fn: function (){
  16553. var self=this,$self=this;
  16554. return $core.withContext(function($ctx1) {
  16555. return "$globals.".__comma($self._name());
  16556. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TMasterBehavior)});
  16557. },
  16558. args: [],
  16559. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  16560. referencedClasses: [],
  16561. messageSends: [",", "name"]
  16562. }),
  16563. $globals.TMasterBehavior);
  16564. $core.addMethod(
  16565. $core.method({
  16566. selector: "browse",
  16567. protocol: "browsing",
  16568. fn: function (){
  16569. var self=this,$self=this;
  16570. return $core.withContext(function($ctx1) {
  16571. $recv($globals.Finder)._findClass_(self);
  16572. return self;
  16573. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.TMasterBehavior)});
  16574. },
  16575. args: [],
  16576. source: "browse\x0a\x09Finder findClass: self",
  16577. referencedClasses: ["Finder"],
  16578. messageSends: ["findClass:"]
  16579. }),
  16580. $globals.TMasterBehavior);
  16581. $core.addMethod(
  16582. $core.method({
  16583. selector: "category",
  16584. protocol: "accessing",
  16585. fn: function (){
  16586. var self=this,$self=this;
  16587. return $core.withContext(function($ctx1) {
  16588. var $1,$receiver;
  16589. $1=$self._package();
  16590. $ctx1.sendIdx["package"]=1;
  16591. if(($receiver = $1) == null || $receiver.a$nil){
  16592. return "Unclassified";
  16593. } else {
  16594. return $recv($self._package())._name();
  16595. }
  16596. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.TMasterBehavior)});
  16597. },
  16598. args: [],
  16599. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  16600. referencedClasses: [],
  16601. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  16602. }),
  16603. $globals.TMasterBehavior);
  16604. $core.addMethod(
  16605. $core.method({
  16606. selector: "classTag",
  16607. protocol: "accessing",
  16608. fn: function (){
  16609. var self=this,$self=this;
  16610. return $core.withContext(function($ctx1) {
  16611. return $self._subclassResponsibility();
  16612. }, function($ctx1) {$ctx1.fill(self,"classTag",{},$globals.TMasterBehavior)});
  16613. },
  16614. args: [],
  16615. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  16616. referencedClasses: [],
  16617. messageSends: ["subclassResponsibility"]
  16618. }),
  16619. $globals.TMasterBehavior);
  16620. $core.addMethod(
  16621. $core.method({
  16622. selector: "comment",
  16623. protocol: "accessing",
  16624. fn: function (){
  16625. var self=this,$self=this;
  16626. return $core.withContext(function($ctx1) {
  16627. var $1,$receiver;
  16628. $1=$self._basicAt_("comment");
  16629. if(($receiver = $1) == null || $receiver.a$nil){
  16630. return "";
  16631. } else {
  16632. return $1;
  16633. }
  16634. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.TMasterBehavior)});
  16635. },
  16636. args: [],
  16637. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  16638. referencedClasses: [],
  16639. messageSends: ["ifNil:", "basicAt:"]
  16640. }),
  16641. $globals.TMasterBehavior);
  16642. $core.addMethod(
  16643. $core.method({
  16644. selector: "comment:",
  16645. protocol: "accessing",
  16646. fn: function (aString){
  16647. var self=this,$self=this;
  16648. return $core.withContext(function($ctx1) {
  16649. var $1,$3,$2;
  16650. $self._basicAt_put_("comment",aString);
  16651. $1=$recv($globals.SystemAnnouncer)._current();
  16652. $3=$recv($globals.ClassCommentChanged)._new();
  16653. $recv($3)._theClass_(self);
  16654. $2=$recv($3)._yourself();
  16655. $recv($1)._announce_($2);
  16656. return self;
  16657. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.TMasterBehavior)});
  16658. },
  16659. args: ["aString"],
  16660. 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)",
  16661. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  16662. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  16663. }),
  16664. $globals.TMasterBehavior);
  16665. $core.addMethod(
  16666. $core.method({
  16667. selector: "definedMethods",
  16668. protocol: "accessing",
  16669. fn: function (){
  16670. var self=this,$self=this;
  16671. var methods;
  16672. return $core.withContext(function($ctx1) {
  16673. var $1,$receiver;
  16674. methods=$self._methods();
  16675. $ctx1.sendIdx["methods"]=1;
  16676. $1=$self._theMetaClass();
  16677. if(($receiver = $1) == null || $receiver.a$nil){
  16678. return methods;
  16679. } else {
  16680. var meta;
  16681. meta=$receiver;
  16682. return $recv(methods).__comma($recv(meta)._methods());
  16683. }
  16684. return self;
  16685. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods},$globals.TMasterBehavior)});
  16686. },
  16687. args: [],
  16688. 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 ]",
  16689. referencedClasses: [],
  16690. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  16691. }),
  16692. $globals.TMasterBehavior);
  16693. $core.addMethod(
  16694. $core.method({
  16695. selector: "enterOrganization",
  16696. protocol: "accessing",
  16697. fn: function (){
  16698. var self=this,$self=this;
  16699. return $core.withContext(function($ctx1) {
  16700. var $1,$receiver;
  16701. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16702. $globals.Smalltalk;
  16703. } else {
  16704. $1=$self._basicAt_("category");
  16705. if(($receiver = $1) == null || $receiver.a$nil){
  16706. $self._basicPackage_(nil);
  16707. $ctx1.sendIdx["basicPackage:"]=1;
  16708. } else {
  16709. var category;
  16710. category=$receiver;
  16711. $self._basicPackage_($recv($globals.Package)._named_(category));
  16712. $recv($recv($self._package())._organization())._addElement_(self);
  16713. }
  16714. }
  16715. return self;
  16716. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{},$globals.TMasterBehavior)});
  16717. },
  16718. args: [],
  16719. 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 ] ]",
  16720. referencedClasses: ["Smalltalk", "Package"],
  16721. messageSends: ["ifNotNil:", "ifNil:ifNotNil:", "basicAt:", "basicPackage:", "named:", "addElement:", "organization", "package"]
  16722. }),
  16723. $globals.TMasterBehavior);
  16724. $core.addMethod(
  16725. $core.method({
  16726. selector: "leaveOrganization",
  16727. protocol: "accessing",
  16728. fn: function (){
  16729. var self=this,$self=this;
  16730. return $core.withContext(function($ctx1) {
  16731. var $receiver;
  16732. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16733. $globals.Smalltalk;
  16734. } else {
  16735. $recv($recv($self._package())._organization())._removeElement_(self);
  16736. }
  16737. return self;
  16738. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{},$globals.TMasterBehavior)});
  16739. },
  16740. args: [],
  16741. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  16742. referencedClasses: ["Smalltalk"],
  16743. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  16744. }),
  16745. $globals.TMasterBehavior);
  16746. $core.addMethod(
  16747. $core.method({
  16748. selector: "name",
  16749. protocol: "accessing",
  16750. fn: function (){
  16751. var self=this,$self=this;
  16752. return $core.withContext(function($ctx1) {
  16753. return self.name;
  16754. return self;
  16755. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.TMasterBehavior)});
  16756. },
  16757. args: [],
  16758. source: "name\x0a\x09<inlineJS: 'return self.name'>",
  16759. referencedClasses: [],
  16760. messageSends: []
  16761. }),
  16762. $globals.TMasterBehavior);
  16763. $core.addMethod(
  16764. $core.method({
  16765. selector: "package:",
  16766. protocol: "accessing",
  16767. fn: function (aPackage){
  16768. var self=this,$self=this;
  16769. var oldPackage;
  16770. return $core.withContext(function($ctx1) {
  16771. var $2,$1,$3,$5,$4;
  16772. $2=$self._package();
  16773. $ctx1.sendIdx["package"]=1;
  16774. $1=$recv($2).__eq(aPackage);
  16775. if($core.assert($1)){
  16776. return self;
  16777. }
  16778. oldPackage=$self._package();
  16779. $self._leaveOrganization();
  16780. $self._basicAt_put_("category",$recv(aPackage)._name());
  16781. $self._enterOrganization();
  16782. $3=$recv($globals.SystemAnnouncer)._current();
  16783. $5=$recv($globals.ClassMoved)._new();
  16784. $recv($5)._theClass_(self);
  16785. $recv($5)._oldPackage_(oldPackage);
  16786. $4=$recv($5)._yourself();
  16787. $recv($3)._announce_($4);
  16788. return self;
  16789. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.TMasterBehavior)});
  16790. },
  16791. args: ["aPackage"],
  16792. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self\x0a\x09\x09leaveOrganization;\x0a\x09\x09basicAt: 'category' put: aPackage name;\x0a\x09\x09enterOrganization.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  16793. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  16794. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "name", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  16795. }),
  16796. $globals.TMasterBehavior);
  16797. $core.addMethod(
  16798. $core.method({
  16799. selector: "theNonMetaClass",
  16800. protocol: "accessing",
  16801. fn: function (){
  16802. var self=this,$self=this;
  16803. return self;
  16804. },
  16805. args: [],
  16806. source: "theNonMetaClass\x0a\x09^ self",
  16807. referencedClasses: [],
  16808. messageSends: []
  16809. }),
  16810. $globals.TMasterBehavior);
  16811. $core.addClass("Trait", $globals.Object, ["organization", "package", "traitUsers"], "Kernel-Classes");
  16812. $core.addMethod(
  16813. $core.method({
  16814. selector: "-",
  16815. protocol: "composition",
  16816. fn: function (anArray){
  16817. var self=this,$self=this;
  16818. return $core.withContext(function($ctx1) {
  16819. return $recv($self._asTraitTransformation()).__minus(anArray);
  16820. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  16821. },
  16822. args: ["anArray"],
  16823. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  16824. referencedClasses: [],
  16825. messageSends: ["-", "asTraitTransformation"]
  16826. }),
  16827. $globals.Trait);
  16828. $core.addMethod(
  16829. $core.method({
  16830. selector: "@",
  16831. protocol: "composition",
  16832. fn: function (anArrayOfAssociations){
  16833. var self=this,$self=this;
  16834. return $core.withContext(function($ctx1) {
  16835. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  16836. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  16837. },
  16838. args: ["anArrayOfAssociations"],
  16839. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  16840. referencedClasses: [],
  16841. messageSends: ["@", "asTraitTransformation"]
  16842. }),
  16843. $globals.Trait);
  16844. $core.addMethod(
  16845. $core.method({
  16846. selector: "asTraitComposition",
  16847. protocol: "converting",
  16848. fn: function (){
  16849. var self=this,$self=this;
  16850. return $core.withContext(function($ctx1) {
  16851. return $recv($self._asTraitTransformation())._asTraitComposition();
  16852. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  16853. },
  16854. args: [],
  16855. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  16856. referencedClasses: [],
  16857. messageSends: ["asTraitComposition", "asTraitTransformation"]
  16858. }),
  16859. $globals.Trait);
  16860. $core.addMethod(
  16861. $core.method({
  16862. selector: "asTraitTransformation",
  16863. protocol: "converting",
  16864. fn: function (){
  16865. var self=this,$self=this;
  16866. return $core.withContext(function($ctx1) {
  16867. return $recv($globals.TraitTransformation)._on_(self);
  16868. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  16869. },
  16870. args: [],
  16871. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  16872. referencedClasses: ["TraitTransformation"],
  16873. messageSends: ["on:"]
  16874. }),
  16875. $globals.Trait);
  16876. $core.addMethod(
  16877. $core.method({
  16878. selector: "basicOrganization",
  16879. protocol: "accessing",
  16880. fn: function (){
  16881. var self=this,$self=this;
  16882. return $self.organization;
  16883. },
  16884. args: [],
  16885. source: "basicOrganization\x0a\x09^ organization",
  16886. referencedClasses: [],
  16887. messageSends: []
  16888. }),
  16889. $globals.Trait);
  16890. $core.addMethod(
  16891. $core.method({
  16892. selector: "basicOrganization:",
  16893. protocol: "accessing",
  16894. fn: function (aClassOrganizer){
  16895. var self=this,$self=this;
  16896. $self.organization=aClassOrganizer;
  16897. return self;
  16898. },
  16899. args: ["aClassOrganizer"],
  16900. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  16901. referencedClasses: [],
  16902. messageSends: []
  16903. }),
  16904. $globals.Trait);
  16905. $core.addMethod(
  16906. $core.method({
  16907. selector: "basicPackage:",
  16908. protocol: "accessing",
  16909. fn: function (aPackage){
  16910. var self=this,$self=this;
  16911. $self.package=aPackage;
  16912. return self;
  16913. },
  16914. args: ["aPackage"],
  16915. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  16916. referencedClasses: [],
  16917. messageSends: []
  16918. }),
  16919. $globals.Trait);
  16920. $core.addMethod(
  16921. $core.method({
  16922. selector: "classTag",
  16923. protocol: "accessing",
  16924. fn: function (){
  16925. var self=this,$self=this;
  16926. return "trait";
  16927. },
  16928. args: [],
  16929. source: "classTag\x0a\x09^ 'trait'",
  16930. referencedClasses: [],
  16931. messageSends: []
  16932. }),
  16933. $globals.Trait);
  16934. $core.addMethod(
  16935. $core.method({
  16936. selector: "definition",
  16937. protocol: "accessing",
  16938. fn: function (){
  16939. var self=this,$self=this;
  16940. return $core.withContext(function($ctx1) {
  16941. var $1;
  16942. return $recv($globals.String)._streamContents_((function(stream){
  16943. return $core.withContext(function($ctx2) {
  16944. $recv(stream)._write_("Trait named: ");
  16945. $ctx2.sendIdx["write:"]=1;
  16946. $recv(stream)._printSymbol_($self._name());
  16947. $recv(stream)._lf();
  16948. $ctx2.sendIdx["lf"]=1;
  16949. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  16950. return $core.withContext(function($ctx3) {
  16951. $1=$recv($globals.String)._tab();
  16952. $ctx3.sendIdx["tab"]=1;
  16953. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  16954. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  16955. })));
  16956. $ctx2.sendIdx["write:"]=2;
  16957. $recv(stream)._tab();
  16958. $recv(stream)._write_("package: ");
  16959. return $recv(stream)._print_($self._category());
  16960. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16961. }));
  16962. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  16963. },
  16964. args: [],
  16965. 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 ]",
  16966. referencedClasses: ["String"],
  16967. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  16968. }),
  16969. $globals.Trait);
  16970. $core.addMethod(
  16971. $core.method({
  16972. selector: "package",
  16973. protocol: "accessing",
  16974. fn: function (){
  16975. var self=this,$self=this;
  16976. return $self.package;
  16977. },
  16978. args: [],
  16979. source: "package\x0a\x09^ package",
  16980. referencedClasses: [],
  16981. messageSends: []
  16982. }),
  16983. $globals.Trait);
  16984. $core.addMethod(
  16985. $core.method({
  16986. selector: "theMetaClass",
  16987. protocol: "accessing",
  16988. fn: function (){
  16989. var self=this,$self=this;
  16990. return nil;
  16991. },
  16992. args: [],
  16993. source: "theMetaClass\x0a\x09^ nil",
  16994. referencedClasses: [],
  16995. messageSends: []
  16996. }),
  16997. $globals.Trait);
  16998. $core.addMethod(
  16999. $core.method({
  17000. selector: "traitUsers",
  17001. protocol: "accessing",
  17002. fn: function (){
  17003. var self=this,$self=this;
  17004. return $core.withContext(function($ctx1) {
  17005. return $recv($self.traitUsers)._copy();
  17006. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  17007. },
  17008. args: [],
  17009. source: "traitUsers\x0a\x09^ traitUsers copy",
  17010. referencedClasses: [],
  17011. messageSends: ["copy"]
  17012. }),
  17013. $globals.Trait);
  17014. $core.addMethod(
  17015. $core.method({
  17016. selector: "named:package:",
  17017. protocol: "instance creation",
  17018. fn: function (aString,anotherString){
  17019. var self=this,$self=this;
  17020. return $core.withContext(function($ctx1) {
  17021. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  17022. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.a$cls)});
  17023. },
  17024. args: ["aString", "anotherString"],
  17025. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  17026. referencedClasses: ["ClassBuilder"],
  17027. messageSends: ["addTraitNamed:package:", "new"]
  17028. }),
  17029. $globals.Trait.a$cls);
  17030. $core.addMethod(
  17031. $core.method({
  17032. selector: "named:uses:package:",
  17033. protocol: "instance creation",
  17034. fn: function (aString,aTraitCompositionDescription,anotherString){
  17035. var self=this,$self=this;
  17036. var trait;
  17037. return $core.withContext(function($ctx1) {
  17038. trait=$self._named_package_(aString,anotherString);
  17039. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  17040. return trait;
  17041. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.a$cls)});
  17042. },
  17043. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  17044. 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",
  17045. referencedClasses: [],
  17046. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  17047. }),
  17048. $globals.Trait.a$cls);
  17049. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  17050. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  17051. $core.addMethod(
  17052. $core.method({
  17053. selector: "-",
  17054. protocol: "composition",
  17055. fn: function (anArray){
  17056. var self=this,$self=this;
  17057. return $core.withContext(function($ctx1) {
  17058. var $1;
  17059. $1=$self._copy();
  17060. $recv($1)._addExclusions_(anArray);
  17061. return $recv($1)._yourself();
  17062. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  17063. },
  17064. args: ["anArray"],
  17065. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  17066. referencedClasses: [],
  17067. messageSends: ["addExclusions:", "copy", "yourself"]
  17068. }),
  17069. $globals.TraitTransformation);
  17070. $core.addMethod(
  17071. $core.method({
  17072. selector: "@",
  17073. protocol: "composition",
  17074. fn: function (anArrayOfAssociations){
  17075. var self=this,$self=this;
  17076. return $core.withContext(function($ctx1) {
  17077. var $1;
  17078. $1=$self._copy();
  17079. $recv($1)._addAliases_(anArrayOfAssociations);
  17080. return $recv($1)._yourself();
  17081. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17082. },
  17083. args: ["anArrayOfAssociations"],
  17084. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  17085. referencedClasses: [],
  17086. messageSends: ["addAliases:", "copy", "yourself"]
  17087. }),
  17088. $globals.TraitTransformation);
  17089. $core.addMethod(
  17090. $core.method({
  17091. selector: "addAliases:",
  17092. protocol: "accessing",
  17093. fn: function (anArrayOfAssociations){
  17094. var self=this,$self=this;
  17095. return $core.withContext(function($ctx1) {
  17096. $recv(anArrayOfAssociations)._do_((function(each){
  17097. var key;
  17098. return $core.withContext(function($ctx2) {
  17099. key=$recv(each)._key();
  17100. return $recv($self.aliases)._at_ifPresent_ifAbsent_(key,(function(){
  17101. return $core.withContext(function($ctx3) {
  17102. return $self._error_("Cannot use same alias name twice.");
  17103. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17104. }),(function(){
  17105. return $core.withContext(function($ctx3) {
  17106. return $recv($self.aliases)._at_put_(key,$recv(each)._value());
  17107. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  17108. }));
  17109. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  17110. }));
  17111. return anArrayOfAssociations;
  17112. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17113. },
  17114. args: ["anArrayOfAssociations"],
  17115. 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",
  17116. referencedClasses: [],
  17117. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  17118. }),
  17119. $globals.TraitTransformation);
  17120. $core.addMethod(
  17121. $core.method({
  17122. selector: "addExclusions:",
  17123. protocol: "accessing",
  17124. fn: function (anArray){
  17125. var self=this,$self=this;
  17126. return $core.withContext(function($ctx1) {
  17127. $recv($self.exclusions)._addAll_(anArray);
  17128. return anArray;
  17129. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  17130. },
  17131. args: ["anArray"],
  17132. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  17133. referencedClasses: [],
  17134. messageSends: ["addAll:"]
  17135. }),
  17136. $globals.TraitTransformation);
  17137. $core.addMethod(
  17138. $core.method({
  17139. selector: "aliases",
  17140. protocol: "accessing",
  17141. fn: function (){
  17142. var self=this,$self=this;
  17143. return $self.aliases;
  17144. },
  17145. args: [],
  17146. source: "aliases\x0a\x09^ aliases",
  17147. referencedClasses: [],
  17148. messageSends: []
  17149. }),
  17150. $globals.TraitTransformation);
  17151. $core.addMethod(
  17152. $core.method({
  17153. selector: "asJavaScriptObject",
  17154. protocol: "converting",
  17155. fn: function (){
  17156. var self=this,$self=this;
  17157. return $core.withContext(function($ctx1) {
  17158. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  17159. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  17160. },
  17161. args: [],
  17162. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  17163. referencedClasses: [],
  17164. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  17165. }),
  17166. $globals.TraitTransformation);
  17167. $core.addMethod(
  17168. $core.method({
  17169. selector: "asJavaScriptSource",
  17170. protocol: "converting",
  17171. fn: function (){
  17172. var self=this,$self=this;
  17173. return $core.withContext(function($ctx1) {
  17174. var $2,$3,$1;
  17175. return $recv($globals.String)._streamContents_((function(str){
  17176. return $core.withContext(function($ctx2) {
  17177. $2=$recv($self._trait())._asJavaScriptSource();
  17178. $ctx2.sendIdx["asJavaScriptSource"]=1;
  17179. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  17180. return $core.withContext(function($ctx3) {
  17181. return [", aliases: ",$recv(al)._asJSONString()];
  17182. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17183. }));
  17184. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17185. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  17186. return $core.withContext(function($ctx3) {
  17187. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  17188. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  17189. })),"}"];
  17190. return $recv(str)._write_($1);
  17191. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17192. }));
  17193. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  17194. },
  17195. args: [],
  17196. 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'}' } ]",
  17197. referencedClasses: ["String"],
  17198. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  17199. }),
  17200. $globals.TraitTransformation);
  17201. $core.addMethod(
  17202. $core.method({
  17203. selector: "asTraitComposition",
  17204. protocol: "converting",
  17205. fn: function (){
  17206. var self=this,$self=this;
  17207. return [self];
  17208. },
  17209. args: [],
  17210. source: "asTraitComposition\x0a\x09^ { self }",
  17211. referencedClasses: [],
  17212. messageSends: []
  17213. }),
  17214. $globals.TraitTransformation);
  17215. $core.addMethod(
  17216. $core.method({
  17217. selector: "asTraitTransformation",
  17218. protocol: "converting",
  17219. fn: function (){
  17220. var self=this,$self=this;
  17221. return self;
  17222. },
  17223. args: [],
  17224. source: "asTraitTransformation\x0a\x09^ self",
  17225. referencedClasses: [],
  17226. messageSends: []
  17227. }),
  17228. $globals.TraitTransformation);
  17229. $core.addMethod(
  17230. $core.method({
  17231. selector: "definition",
  17232. protocol: "accessing",
  17233. fn: function (){
  17234. var self=this,$self=this;
  17235. return $core.withContext(function($ctx1) {
  17236. return $recv($globals.String)._streamContents_((function(str){
  17237. return $core.withContext(function($ctx2) {
  17238. $recv(str)._print_($self._trait());
  17239. $recv($self._aliases())._ifNotEmpty_((function(al){
  17240. return $core.withContext(function($ctx3) {
  17241. $recv(str)._write_(" @ {");
  17242. $ctx3.sendIdx["write:"]=1;
  17243. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  17244. return $core.withContext(function($ctx4) {
  17245. $recv(str)._printSymbol_($recv(each)._key());
  17246. $ctx4.sendIdx["printSymbol:"]=1;
  17247. $recv(str)._write_(" -> ");
  17248. $ctx4.sendIdx["write:"]=2;
  17249. return $recv(str)._printSymbol_($recv(each)._value());
  17250. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17251. }),(function(){
  17252. return $core.withContext(function($ctx4) {
  17253. return $recv(str)._write_(". ");
  17254. $ctx4.sendIdx["write:"]=3;
  17255. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17256. }));
  17257. $ctx3.sendIdx["do:separatedBy:"]=1;
  17258. return $recv(str)._write_("}");
  17259. $ctx3.sendIdx["write:"]=4;
  17260. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17261. }));
  17262. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17263. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  17264. return $core.withContext(function($ctx3) {
  17265. $recv(str)._write_(" - #(");
  17266. $ctx3.sendIdx["write:"]=5;
  17267. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  17268. return $core.withContext(function($ctx4) {
  17269. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  17270. $ctx4.sendIdx["write:"]=6;
  17271. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  17272. }),(function(){
  17273. return $core.withContext(function($ctx4) {
  17274. return $recv(str)._space();
  17275. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  17276. }));
  17277. return $recv(str)._write_(")");
  17278. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  17279. }));
  17280. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17281. }));
  17282. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  17283. },
  17284. args: [],
  17285. 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: ')' ] ]",
  17286. referencedClasses: ["String"],
  17287. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  17288. }),
  17289. $globals.TraitTransformation);
  17290. $core.addMethod(
  17291. $core.method({
  17292. selector: "exclusions",
  17293. protocol: "accessing",
  17294. fn: function (){
  17295. var self=this,$self=this;
  17296. return $self.exclusions;
  17297. },
  17298. args: [],
  17299. source: "exclusions\x0a\x09^ exclusions",
  17300. referencedClasses: [],
  17301. messageSends: []
  17302. }),
  17303. $globals.TraitTransformation);
  17304. $core.addMethod(
  17305. $core.method({
  17306. selector: "initialize",
  17307. protocol: "initialization",
  17308. fn: function (){
  17309. var self=this,$self=this;
  17310. return $core.withContext(function($ctx1) {
  17311. (
  17312. $ctx1.supercall = true,
  17313. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17314. $ctx1.supercall = false;
  17315. $self.aliases=$globals.HashedCollection._newFromPairs_([]);
  17316. $self.exclusions=$recv($globals.Set)._new();
  17317. $self.trait=nil;
  17318. return self;
  17319. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  17320. },
  17321. args: [],
  17322. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  17323. referencedClasses: ["Set"],
  17324. messageSends: ["initialize", "new"]
  17325. }),
  17326. $globals.TraitTransformation);
  17327. $core.addMethod(
  17328. $core.method({
  17329. selector: "postCopy",
  17330. protocol: "copying",
  17331. fn: function (){
  17332. var self=this,$self=this;
  17333. return $core.withContext(function($ctx1) {
  17334. $self.aliases=$recv($self.aliases)._copy();
  17335. $ctx1.sendIdx["copy"]=1;
  17336. $self.exclusions=$recv($self.exclusions)._copy();
  17337. return self;
  17338. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  17339. },
  17340. args: [],
  17341. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  17342. referencedClasses: [],
  17343. messageSends: ["copy"]
  17344. }),
  17345. $globals.TraitTransformation);
  17346. $core.addMethod(
  17347. $core.method({
  17348. selector: "trait",
  17349. protocol: "accessing",
  17350. fn: function (){
  17351. var self=this,$self=this;
  17352. return $self.trait;
  17353. },
  17354. args: [],
  17355. source: "trait\x0a\x09^ trait",
  17356. referencedClasses: [],
  17357. messageSends: []
  17358. }),
  17359. $globals.TraitTransformation);
  17360. $core.addMethod(
  17361. $core.method({
  17362. selector: "trait:",
  17363. protocol: "accessing",
  17364. fn: function (anObject){
  17365. var self=this,$self=this;
  17366. $self.trait=anObject;
  17367. return self;
  17368. },
  17369. args: ["anObject"],
  17370. source: "trait: anObject\x0a\x09trait := anObject",
  17371. referencedClasses: [],
  17372. messageSends: []
  17373. }),
  17374. $globals.TraitTransformation);
  17375. $core.addMethod(
  17376. $core.method({
  17377. selector: "fromJSON:",
  17378. protocol: "instance creation",
  17379. fn: function (aJSObject){
  17380. var self=this,$self=this;
  17381. return $core.withContext(function($ctx1) {
  17382. var $1,$4,$3,$2;
  17383. $1=(
  17384. $ctx1.supercall = true,
  17385. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17386. $ctx1.supercall = false;
  17387. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  17388. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  17389. return $globals.HashedCollection._newFromPairs_([]);
  17390. }));
  17391. $ctx1.sendIdx["at:ifAbsent:"]=1;
  17392. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  17393. $2=$recv($3)._associations();
  17394. $recv($1)._addAliases_($2);
  17395. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  17396. return [];
  17397. })));
  17398. return $recv($1)._yourself();
  17399. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.a$cls)});
  17400. },
  17401. args: ["aJSObject"],
  17402. 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",
  17403. referencedClasses: ["Smalltalk"],
  17404. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  17405. }),
  17406. $globals.TraitTransformation.a$cls);
  17407. $core.addMethod(
  17408. $core.method({
  17409. selector: "on:",
  17410. protocol: "instance creation",
  17411. fn: function (aTrait){
  17412. var self=this,$self=this;
  17413. return $core.withContext(function($ctx1) {
  17414. var $1;
  17415. $1=(
  17416. $ctx1.supercall = true,
  17417. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17418. $ctx1.supercall = false;
  17419. $recv($1)._trait_(aTrait);
  17420. return $recv($1)._yourself();
  17421. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.a$cls)});
  17422. },
  17423. args: ["aTrait"],
  17424. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  17425. referencedClasses: [],
  17426. messageSends: ["trait:", "new", "yourself"]
  17427. }),
  17428. $globals.TraitTransformation.a$cls);
  17429. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  17430. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  17431. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  17432. $core.addMethod(
  17433. $core.method({
  17434. selector: "asTraitComposition",
  17435. protocol: "*Kernel-Classes",
  17436. fn: function (){
  17437. var self=this,$self=this;
  17438. return $core.withContext(function($ctx1) {
  17439. return $self._collect_((function(each){
  17440. return $core.withContext(function($ctx2) {
  17441. return $recv(each)._asTraitTransformation();
  17442. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17443. }));
  17444. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  17445. },
  17446. args: [],
  17447. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  17448. referencedClasses: [],
  17449. messageSends: ["collect:", "asTraitTransformation"]
  17450. }),
  17451. $globals.Array);
  17452. $core.addMethod(
  17453. $core.method({
  17454. selector: "instanceVariablesStringAsSlotList",
  17455. protocol: "*Kernel-Classes",
  17456. fn: function (){
  17457. var self=this,$self=this;
  17458. return $core.withContext(function($ctx1) {
  17459. return $recv($self._tokenize_(" "))._reject_((function(each){
  17460. return $core.withContext(function($ctx2) {
  17461. return $recv(each)._isEmpty();
  17462. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17463. }));
  17464. }, function($ctx1) {$ctx1.fill(self,"instanceVariablesStringAsSlotList",{},$globals.String)});
  17465. },
  17466. args: [],
  17467. source: "instanceVariablesStringAsSlotList\x0a\x09^ (self tokenize: ' ') reject: [ :each | each isEmpty ]",
  17468. referencedClasses: [],
  17469. messageSends: ["reject:", "tokenize:", "isEmpty"]
  17470. }),
  17471. $globals.String);
  17472. });
  17473. define('amber/core/Kernel-Methods',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  17474. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17475. var $pkg = $core.addPackage("Kernel-Methods");
  17476. $pkg.innerEval = function (expr) { return eval(expr); };
  17477. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  17478. $core.addClass("BlockClosure", $globals.Object, ["prototype", "length"], "Kernel-Methods");
  17479. $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 | ... ] `";
  17480. $core.addMethod(
  17481. $core.method({
  17482. selector: "applyTo:arguments:",
  17483. protocol: "evaluating",
  17484. fn: function (anObject,aCollection){
  17485. var self=this,$self=this;
  17486. return $core.withContext(function($ctx1) {
  17487. return self.apply(anObject, aCollection);
  17488. return self;
  17489. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  17490. },
  17491. args: ["anObject", "aCollection"],
  17492. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  17493. referencedClasses: [],
  17494. messageSends: []
  17495. }),
  17496. $globals.BlockClosure);
  17497. $core.addMethod(
  17498. $core.method({
  17499. selector: "asCompiledMethod:",
  17500. protocol: "converting",
  17501. fn: function (aString){
  17502. var self=this,$self=this;
  17503. return $core.withContext(function($ctx1) {
  17504. return $core.method({selector:aString, fn:self});;
  17505. return self;
  17506. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  17507. },
  17508. args: ["aString"],
  17509. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  17510. referencedClasses: [],
  17511. messageSends: []
  17512. }),
  17513. $globals.BlockClosure);
  17514. $core.addMethod(
  17515. $core.method({
  17516. selector: "compiledSource",
  17517. protocol: "accessing",
  17518. fn: function (){
  17519. var self=this,$self=this;
  17520. return $core.withContext(function($ctx1) {
  17521. return self.toString();
  17522. return self;
  17523. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  17524. },
  17525. args: [],
  17526. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  17527. referencedClasses: [],
  17528. messageSends: []
  17529. }),
  17530. $globals.BlockClosure);
  17531. $core.addMethod(
  17532. $core.method({
  17533. selector: "currySelf",
  17534. protocol: "converting",
  17535. fn: function (){
  17536. var self=this,$self=this;
  17537. return $core.withContext(function($ctx1) {
  17538. return function () {
  17539. var args = [ this ];
  17540. args.push.apply(args, arguments);
  17541. return self.apply(null, args);
  17542. }
  17543. ;
  17544. return self;
  17545. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  17546. },
  17547. args: [],
  17548. 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'>",
  17549. referencedClasses: [],
  17550. messageSends: []
  17551. }),
  17552. $globals.BlockClosure);
  17553. $core.addMethod(
  17554. $core.method({
  17555. selector: "ensure:",
  17556. protocol: "evaluating",
  17557. fn: function (aBlock){
  17558. var self=this,$self=this;
  17559. return $core.withContext(function($ctx1) {
  17560. try{return $self._value()}finally{aBlock._value()};
  17561. return self;
  17562. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  17563. },
  17564. args: ["aBlock"],
  17565. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  17566. referencedClasses: [],
  17567. messageSends: []
  17568. }),
  17569. $globals.BlockClosure);
  17570. $core.addMethod(
  17571. $core.method({
  17572. selector: "fork",
  17573. protocol: "timeout/interval",
  17574. fn: function (){
  17575. var self=this,$self=this;
  17576. return $core.withContext(function($ctx1) {
  17577. $recv($recv($globals.ForkPool)._default())._fork_(self);
  17578. return self;
  17579. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  17580. },
  17581. args: [],
  17582. source: "fork\x0a\x09ForkPool default fork: self",
  17583. referencedClasses: ["ForkPool"],
  17584. messageSends: ["fork:", "default"]
  17585. }),
  17586. $globals.BlockClosure);
  17587. $core.addMethod(
  17588. $core.method({
  17589. selector: "new",
  17590. protocol: "evaluating",
  17591. fn: function (){
  17592. var self=this,$self=this;
  17593. return $core.withContext(function($ctx1) {
  17594. return new self();
  17595. return self;
  17596. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  17597. },
  17598. args: [],
  17599. 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()'>",
  17600. referencedClasses: [],
  17601. messageSends: []
  17602. }),
  17603. $globals.BlockClosure);
  17604. $core.addMethod(
  17605. $core.method({
  17606. selector: "newValue:",
  17607. protocol: "evaluating",
  17608. fn: function (anObject){
  17609. var self=this,$self=this;
  17610. return $core.withContext(function($ctx1) {
  17611. return $self._newWithValues_([anObject]);
  17612. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  17613. },
  17614. args: ["anObject"],
  17615. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  17616. referencedClasses: [],
  17617. messageSends: ["newWithValues:"]
  17618. }),
  17619. $globals.BlockClosure);
  17620. $core.addMethod(
  17621. $core.method({
  17622. selector: "newValue:value:",
  17623. protocol: "evaluating",
  17624. fn: function (anObject,anObject2){
  17625. var self=this,$self=this;
  17626. return $core.withContext(function($ctx1) {
  17627. return $self._newWithValues_([anObject,anObject2]);
  17628. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  17629. },
  17630. args: ["anObject", "anObject2"],
  17631. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  17632. referencedClasses: [],
  17633. messageSends: ["newWithValues:"]
  17634. }),
  17635. $globals.BlockClosure);
  17636. $core.addMethod(
  17637. $core.method({
  17638. selector: "newValue:value:value:",
  17639. protocol: "evaluating",
  17640. fn: function (anObject,anObject2,anObject3){
  17641. var self=this,$self=this;
  17642. return $core.withContext(function($ctx1) {
  17643. return $self._newWithValues_([anObject,anObject2,anObject3]);
  17644. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  17645. },
  17646. args: ["anObject", "anObject2", "anObject3"],
  17647. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  17648. referencedClasses: [],
  17649. messageSends: ["newWithValues:"]
  17650. }),
  17651. $globals.BlockClosure);
  17652. $core.addMethod(
  17653. $core.method({
  17654. selector: "newWithValues:",
  17655. protocol: "evaluating",
  17656. fn: function (aCollection){
  17657. var self=this,$self=this;
  17658. return $core.withContext(function($ctx1) {
  17659. var object = Object.create(self.prototype);
  17660. var result = self.apply(object, aCollection);
  17661. return typeof result === "object" ? result : object;
  17662. ;
  17663. return self;
  17664. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  17665. },
  17666. args: ["aCollection"],
  17667. 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'>",
  17668. referencedClasses: [],
  17669. messageSends: []
  17670. }),
  17671. $globals.BlockClosure);
  17672. $core.addMethod(
  17673. $core.method({
  17674. selector: "numArgs",
  17675. protocol: "accessing",
  17676. fn: function (){
  17677. var self=this,$self=this;
  17678. return $self.length;
  17679. },
  17680. args: [],
  17681. source: "numArgs\x0a\x09^ length",
  17682. referencedClasses: [],
  17683. messageSends: []
  17684. }),
  17685. $globals.BlockClosure);
  17686. $core.addMethod(
  17687. $core.method({
  17688. selector: "on:do:",
  17689. protocol: "error handling",
  17690. fn: function (anErrorClass,aBlock){
  17691. var self=this,$self=this;
  17692. return $core.withContext(function($ctx1) {
  17693. var $1;
  17694. return $self._tryCatch_((function(error){
  17695. var smalltalkError;
  17696. return $core.withContext(function($ctx2) {
  17697. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  17698. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  17699. if($core.assert($1)){
  17700. return $recv(aBlock)._value_(smalltalkError);
  17701. } else {
  17702. return $recv(smalltalkError)._pass();
  17703. }
  17704. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  17705. }));
  17706. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  17707. },
  17708. args: ["anErrorClass", "aBlock"],
  17709. 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 pass ] ]",
  17710. referencedClasses: ["Smalltalk"],
  17711. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "pass"]
  17712. }),
  17713. $globals.BlockClosure);
  17714. $core.addMethod(
  17715. $core.method({
  17716. selector: "prototype",
  17717. protocol: "accessing",
  17718. fn: function (){
  17719. var self=this,$self=this;
  17720. return $self.prototype;
  17721. },
  17722. args: [],
  17723. source: "prototype\x0a\x09^ prototype",
  17724. referencedClasses: [],
  17725. messageSends: []
  17726. }),
  17727. $globals.BlockClosure);
  17728. $core.addMethod(
  17729. $core.method({
  17730. selector: "provided",
  17731. protocol: "converting",
  17732. fn: function (){
  17733. var self=this,$self=this;
  17734. return $core.withContext(function($ctx1) {
  17735. return $recv($globals.JSObjectProxy)._on_(self);
  17736. }, function($ctx1) {$ctx1.fill(self,"provided",{},$globals.BlockClosure)});
  17737. },
  17738. args: [],
  17739. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 require provided resolve: ...\x0a\x09or\x0a\x09 XMLHttpRequest provided DONE\x22\x0a\x09\x0a\x09^ JSObjectProxy on: self",
  17740. referencedClasses: ["JSObjectProxy"],
  17741. messageSends: ["on:"]
  17742. }),
  17743. $globals.BlockClosure);
  17744. $core.addMethod(
  17745. $core.method({
  17746. selector: "receiver",
  17747. protocol: "accessing",
  17748. fn: function (){
  17749. var self=this,$self=this;
  17750. return nil;
  17751. },
  17752. args: [],
  17753. source: "receiver\x0a\x09^ nil",
  17754. referencedClasses: [],
  17755. messageSends: []
  17756. }),
  17757. $globals.BlockClosure);
  17758. $core.addMethod(
  17759. $core.method({
  17760. selector: "timeToRun",
  17761. protocol: "evaluating",
  17762. fn: function (){
  17763. var self=this,$self=this;
  17764. return $core.withContext(function($ctx1) {
  17765. return $recv($globals.Date)._millisecondsToRun_(self);
  17766. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  17767. },
  17768. args: [],
  17769. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  17770. referencedClasses: ["Date"],
  17771. messageSends: ["millisecondsToRun:"]
  17772. }),
  17773. $globals.BlockClosure);
  17774. $core.addMethod(
  17775. $core.method({
  17776. selector: "tryCatch:",
  17777. protocol: "error handling",
  17778. fn: function (aBlock){
  17779. var self=this,$self=this;
  17780. return $core.withContext(function($ctx1) {
  17781. try {
  17782. return $self._value();
  17783. } catch(error) {
  17784. // pass non-local returns undetected
  17785. if (Array.isArray(error) && error.length === 1) throw error;
  17786. return aBlock._value_(error);
  17787. }
  17788. ;
  17789. return self;
  17790. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  17791. },
  17792. args: ["aBlock"],
  17793. 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'>",
  17794. referencedClasses: [],
  17795. messageSends: []
  17796. }),
  17797. $globals.BlockClosure);
  17798. $core.addMethod(
  17799. $core.method({
  17800. selector: "value",
  17801. protocol: "evaluating",
  17802. fn: function (){
  17803. var self=this,$self=this;
  17804. return $core.withContext(function($ctx1) {
  17805. return self();;
  17806. return self;
  17807. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  17808. },
  17809. args: [],
  17810. source: "value\x0a\x09<inlineJS: 'return self();'>",
  17811. referencedClasses: [],
  17812. messageSends: []
  17813. }),
  17814. $globals.BlockClosure);
  17815. $core.addMethod(
  17816. $core.method({
  17817. selector: "value:",
  17818. protocol: "evaluating",
  17819. fn: function (anArg){
  17820. var self=this,$self=this;
  17821. return $core.withContext(function($ctx1) {
  17822. return self(anArg);;
  17823. return self;
  17824. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  17825. },
  17826. args: ["anArg"],
  17827. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  17828. referencedClasses: [],
  17829. messageSends: []
  17830. }),
  17831. $globals.BlockClosure);
  17832. $core.addMethod(
  17833. $core.method({
  17834. selector: "value:value:",
  17835. protocol: "evaluating",
  17836. fn: function (firstArg,secondArg){
  17837. var self=this,$self=this;
  17838. return $core.withContext(function($ctx1) {
  17839. return self(firstArg, secondArg);;
  17840. return self;
  17841. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  17842. },
  17843. args: ["firstArg", "secondArg"],
  17844. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  17845. referencedClasses: [],
  17846. messageSends: []
  17847. }),
  17848. $globals.BlockClosure);
  17849. $core.addMethod(
  17850. $core.method({
  17851. selector: "value:value:value:",
  17852. protocol: "evaluating",
  17853. fn: function (firstArg,secondArg,thirdArg){
  17854. var self=this,$self=this;
  17855. return $core.withContext(function($ctx1) {
  17856. return self(firstArg, secondArg, thirdArg);;
  17857. return self;
  17858. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  17859. },
  17860. args: ["firstArg", "secondArg", "thirdArg"],
  17861. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  17862. referencedClasses: [],
  17863. messageSends: []
  17864. }),
  17865. $globals.BlockClosure);
  17866. $core.addMethod(
  17867. $core.method({
  17868. selector: "valueWithInterval:",
  17869. protocol: "timeout/interval",
  17870. fn: function (aNumber){
  17871. var self=this,$self=this;
  17872. return $core.withContext(function($ctx1) {
  17873. var interval = setInterval(self, aNumber);
  17874. return $globals.Timeout._on_(interval);
  17875. ;
  17876. return self;
  17877. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  17878. },
  17879. args: ["aNumber"],
  17880. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  17881. referencedClasses: [],
  17882. messageSends: []
  17883. }),
  17884. $globals.BlockClosure);
  17885. $core.addMethod(
  17886. $core.method({
  17887. selector: "valueWithPossibleArguments:",
  17888. protocol: "evaluating",
  17889. fn: function (aCollection){
  17890. var self=this,$self=this;
  17891. return $core.withContext(function($ctx1) {
  17892. return self.apply(null, aCollection);;
  17893. return self;
  17894. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  17895. },
  17896. args: ["aCollection"],
  17897. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  17898. referencedClasses: [],
  17899. messageSends: []
  17900. }),
  17901. $globals.BlockClosure);
  17902. $core.addMethod(
  17903. $core.method({
  17904. selector: "valueWithTimeout:",
  17905. protocol: "timeout/interval",
  17906. fn: function (aNumber){
  17907. var self=this,$self=this;
  17908. return $core.withContext(function($ctx1) {
  17909. var timeout = setTimeout(self, aNumber);
  17910. return $globals.Timeout._on_(timeout);
  17911. ;
  17912. return self;
  17913. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  17914. },
  17915. args: ["aNumber"],
  17916. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  17917. referencedClasses: [],
  17918. messageSends: []
  17919. }),
  17920. $globals.BlockClosure);
  17921. $core.addMethod(
  17922. $core.method({
  17923. selector: "whileFalse",
  17924. protocol: "controlling",
  17925. fn: function (){
  17926. var self=this,$self=this;
  17927. return $core.withContext(function($ctx1) {
  17928. $self._whileFalse_((function(){
  17929. }));
  17930. return self;
  17931. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  17932. },
  17933. args: [],
  17934. source: "whileFalse\x0a\x09self whileFalse: []",
  17935. referencedClasses: [],
  17936. messageSends: ["whileFalse:"]
  17937. }),
  17938. $globals.BlockClosure);
  17939. $core.addMethod(
  17940. $core.method({
  17941. selector: "whileFalse:",
  17942. protocol: "controlling",
  17943. fn: function (aBlock){
  17944. var self=this,$self=this;
  17945. return $core.withContext(function($ctx1) {
  17946. while(!$core.assert($self._value())) {aBlock._value()};
  17947. return self;
  17948. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  17949. },
  17950. args: ["aBlock"],
  17951. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  17952. referencedClasses: [],
  17953. messageSends: []
  17954. }),
  17955. $globals.BlockClosure);
  17956. $core.addMethod(
  17957. $core.method({
  17958. selector: "whileTrue",
  17959. protocol: "controlling",
  17960. fn: function (){
  17961. var self=this,$self=this;
  17962. return $core.withContext(function($ctx1) {
  17963. $self._whileTrue_((function(){
  17964. }));
  17965. return self;
  17966. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  17967. },
  17968. args: [],
  17969. source: "whileTrue\x0a\x09self whileTrue: []",
  17970. referencedClasses: [],
  17971. messageSends: ["whileTrue:"]
  17972. }),
  17973. $globals.BlockClosure);
  17974. $core.addMethod(
  17975. $core.method({
  17976. selector: "whileTrue:",
  17977. protocol: "controlling",
  17978. fn: function (aBlock){
  17979. var self=this,$self=this;
  17980. return $core.withContext(function($ctx1) {
  17981. while($core.assert($self._value())) {aBlock._value()};
  17982. return self;
  17983. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  17984. },
  17985. args: ["aBlock"],
  17986. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  17987. referencedClasses: [],
  17988. messageSends: []
  17989. }),
  17990. $globals.BlockClosure);
  17991. $core.addClass("CompiledMethod", $globals.Object, ["args", "fn", "messageSends", "owner", "protocol", "referencedClasses", "selector", "source"], "Kernel-Methods");
  17992. $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";
  17993. $core.addMethod(
  17994. $core.method({
  17995. selector: "arguments",
  17996. protocol: "accessing",
  17997. fn: function (){
  17998. var self=this,$self=this;
  17999. return $core.withContext(function($ctx1) {
  18000. var $1,$receiver;
  18001. $1=$self.args;
  18002. if(($receiver = $1) == null || $receiver.a$nil){
  18003. return [];
  18004. } else {
  18005. return $1;
  18006. }
  18007. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  18008. },
  18009. args: [],
  18010. source: "arguments\x0a\x09^ args ifNil: [ #() ]",
  18011. referencedClasses: [],
  18012. messageSends: ["ifNil:"]
  18013. }),
  18014. $globals.CompiledMethod);
  18015. $core.addMethod(
  18016. $core.method({
  18017. selector: "browse",
  18018. protocol: "browsing",
  18019. fn: function (){
  18020. var self=this,$self=this;
  18021. return $core.withContext(function($ctx1) {
  18022. $recv($globals.Finder)._findMethod_(self);
  18023. return self;
  18024. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  18025. },
  18026. args: [],
  18027. source: "browse\x0a\x09Finder findMethod: self",
  18028. referencedClasses: ["Finder"],
  18029. messageSends: ["findMethod:"]
  18030. }),
  18031. $globals.CompiledMethod);
  18032. $core.addMethod(
  18033. $core.method({
  18034. selector: "category",
  18035. protocol: "accessing",
  18036. fn: function (){
  18037. var self=this,$self=this;
  18038. return $core.withContext(function($ctx1) {
  18039. return $self._protocol();
  18040. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  18041. },
  18042. args: [],
  18043. source: "category\x0a\x09^ self protocol",
  18044. referencedClasses: [],
  18045. messageSends: ["protocol"]
  18046. }),
  18047. $globals.CompiledMethod);
  18048. $core.addMethod(
  18049. $core.method({
  18050. selector: "defaultProtocol",
  18051. protocol: "defaults",
  18052. fn: function (){
  18053. var self=this,$self=this;
  18054. return "as yet unclassified";
  18055. },
  18056. args: [],
  18057. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  18058. referencedClasses: [],
  18059. messageSends: []
  18060. }),
  18061. $globals.CompiledMethod);
  18062. $core.addMethod(
  18063. $core.method({
  18064. selector: "fn",
  18065. protocol: "accessing",
  18066. fn: function (){
  18067. var self=this,$self=this;
  18068. return $self.fn;
  18069. },
  18070. args: [],
  18071. source: "fn\x0a\x09^ fn",
  18072. referencedClasses: [],
  18073. messageSends: []
  18074. }),
  18075. $globals.CompiledMethod);
  18076. $core.addMethod(
  18077. $core.method({
  18078. selector: "fn:",
  18079. protocol: "accessing",
  18080. fn: function (aBlock){
  18081. var self=this,$self=this;
  18082. $self.fn=aBlock;
  18083. return self;
  18084. },
  18085. args: ["aBlock"],
  18086. source: "fn: aBlock\x0a\x09fn := aBlock",
  18087. referencedClasses: [],
  18088. messageSends: []
  18089. }),
  18090. $globals.CompiledMethod);
  18091. $core.addMethod(
  18092. $core.method({
  18093. selector: "isCompiledMethod",
  18094. protocol: "testing",
  18095. fn: function (){
  18096. var self=this,$self=this;
  18097. return true;
  18098. },
  18099. args: [],
  18100. source: "isCompiledMethod\x0a\x09^ true",
  18101. referencedClasses: [],
  18102. messageSends: []
  18103. }),
  18104. $globals.CompiledMethod);
  18105. $core.addMethod(
  18106. $core.method({
  18107. selector: "isOverridden",
  18108. protocol: "testing",
  18109. fn: function (){
  18110. var self=this,$self=this;
  18111. return $core.withContext(function($ctx1) {
  18112. var $1;
  18113. var $early={};
  18114. try {
  18115. $recv($self._methodClass())._allSubclassesDo_((function(each){
  18116. return $core.withContext(function($ctx2) {
  18117. $1=$recv(each)._includesSelector_($self.selector);
  18118. if($core.assert($1)){
  18119. throw $early=[true];
  18120. }
  18121. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18122. }));
  18123. return false;
  18124. }
  18125. catch(e) {if(e===$early)return e[0]; throw e}
  18126. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{},$globals.CompiledMethod)});
  18127. },
  18128. args: [],
  18129. source: "isOverridden\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
  18130. referencedClasses: [],
  18131. messageSends: ["allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  18132. }),
  18133. $globals.CompiledMethod);
  18134. $core.addMethod(
  18135. $core.method({
  18136. selector: "isOverride",
  18137. protocol: "testing",
  18138. fn: function (){
  18139. var self=this,$self=this;
  18140. var superclass;
  18141. return $core.withContext(function($ctx1) {
  18142. var $1,$2,$receiver;
  18143. $1=$self._methodClass();
  18144. $ctx1.sendIdx["methodClass"]=1;
  18145. superclass=$recv($1)._superclass();
  18146. $ctx1.sendIdx["superclass"]=1;
  18147. $2=superclass;
  18148. if(($receiver = $2) == null || $receiver.a$nil){
  18149. return false;
  18150. } else {
  18151. $2;
  18152. }
  18153. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  18154. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  18155. },
  18156. args: [],
  18157. 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",
  18158. referencedClasses: [],
  18159. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  18160. }),
  18161. $globals.CompiledMethod);
  18162. $core.addMethod(
  18163. $core.method({
  18164. selector: "messageSends",
  18165. protocol: "accessing",
  18166. fn: function (){
  18167. var self=this,$self=this;
  18168. return $self.messageSends;
  18169. },
  18170. args: [],
  18171. source: "messageSends\x0a\x09^ messageSends",
  18172. referencedClasses: [],
  18173. messageSends: []
  18174. }),
  18175. $globals.CompiledMethod);
  18176. $core.addMethod(
  18177. $core.method({
  18178. selector: "methodClass",
  18179. protocol: "accessing",
  18180. fn: function (){
  18181. var self=this,$self=this;
  18182. return $self.owner;
  18183. },
  18184. args: [],
  18185. source: "methodClass\x0a\x09^ owner",
  18186. referencedClasses: [],
  18187. messageSends: []
  18188. }),
  18189. $globals.CompiledMethod);
  18190. $core.addMethod(
  18191. $core.method({
  18192. selector: "package",
  18193. protocol: "accessing",
  18194. fn: function (){
  18195. var self=this,$self=this;
  18196. return $core.withContext(function($ctx1) {
  18197. var $1,$receiver;
  18198. $1=$self._methodClass();
  18199. if(($receiver = $1) == null || $receiver.a$nil){
  18200. return $1;
  18201. } else {
  18202. var class_;
  18203. class_=$receiver;
  18204. return $recv(class_)._packageOfProtocol_($self._protocol());
  18205. }
  18206. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  18207. },
  18208. args: [],
  18209. 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 ]",
  18210. referencedClasses: [],
  18211. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  18212. }),
  18213. $globals.CompiledMethod);
  18214. $core.addMethod(
  18215. $core.method({
  18216. selector: "protocol",
  18217. protocol: "accessing",
  18218. fn: function (){
  18219. var self=this,$self=this;
  18220. return $core.withContext(function($ctx1) {
  18221. var $1,$receiver;
  18222. $1=$self.protocol;
  18223. if(($receiver = $1) == null || $receiver.a$nil){
  18224. return $self._defaultProtocol();
  18225. } else {
  18226. return $1;
  18227. }
  18228. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  18229. },
  18230. args: [],
  18231. source: "protocol\x0a\x09^ protocol ifNil: [ self defaultProtocol ]",
  18232. referencedClasses: [],
  18233. messageSends: ["ifNil:", "defaultProtocol"]
  18234. }),
  18235. $globals.CompiledMethod);
  18236. $core.addMethod(
  18237. $core.method({
  18238. selector: "protocol:",
  18239. protocol: "accessing",
  18240. fn: function (aString){
  18241. var self=this,$self=this;
  18242. var oldProtocol;
  18243. return $core.withContext(function($ctx1) {
  18244. var $1,$3,$2,$4,$receiver;
  18245. oldProtocol=$self._protocol();
  18246. $self.protocol=aString;
  18247. $1=$recv($globals.SystemAnnouncer)._current();
  18248. $3=$recv($globals.MethodMoved)._new();
  18249. $recv($3)._method_(self);
  18250. $recv($3)._oldProtocol_(oldProtocol);
  18251. $2=$recv($3)._yourself();
  18252. $recv($1)._announce_($2);
  18253. $4=$self._methodClass();
  18254. if(($receiver = $4) == null || $receiver.a$nil){
  18255. $4;
  18256. } else {
  18257. var methodClass;
  18258. methodClass=$receiver;
  18259. $recv($recv(methodClass)._organization())._addElement_(aString);
  18260. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  18261. }
  18262. return self;
  18263. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  18264. },
  18265. args: ["aString"],
  18266. source: "protocol: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09protocol := 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 ]",
  18267. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  18268. messageSends: ["protocol", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  18269. }),
  18270. $globals.CompiledMethod);
  18271. $core.addMethod(
  18272. $core.method({
  18273. selector: "referencedClasses",
  18274. protocol: "accessing",
  18275. fn: function (){
  18276. var self=this,$self=this;
  18277. return $self.referencedClasses;
  18278. },
  18279. args: [],
  18280. source: "referencedClasses\x0a\x09^ referencedClasses",
  18281. referencedClasses: [],
  18282. messageSends: []
  18283. }),
  18284. $globals.CompiledMethod);
  18285. $core.addMethod(
  18286. $core.method({
  18287. selector: "selector",
  18288. protocol: "accessing",
  18289. fn: function (){
  18290. var self=this,$self=this;
  18291. return $self.selector;
  18292. },
  18293. args: [],
  18294. source: "selector\x0a\x09^ selector",
  18295. referencedClasses: [],
  18296. messageSends: []
  18297. }),
  18298. $globals.CompiledMethod);
  18299. $core.addMethod(
  18300. $core.method({
  18301. selector: "selector:",
  18302. protocol: "accessing",
  18303. fn: function (aString){
  18304. var self=this,$self=this;
  18305. $self.selector=aString;
  18306. return self;
  18307. },
  18308. args: ["aString"],
  18309. source: "selector: aString\x0a\x09selector := aString",
  18310. referencedClasses: [],
  18311. messageSends: []
  18312. }),
  18313. $globals.CompiledMethod);
  18314. $core.addMethod(
  18315. $core.method({
  18316. selector: "sendTo:arguments:",
  18317. protocol: "evaluating",
  18318. fn: function (anObject,aCollection){
  18319. var self=this,$self=this;
  18320. return $core.withContext(function($ctx1) {
  18321. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  18322. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  18323. },
  18324. args: ["anObject", "aCollection"],
  18325. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  18326. referencedClasses: [],
  18327. messageSends: ["applyTo:arguments:", "fn"]
  18328. }),
  18329. $globals.CompiledMethod);
  18330. $core.addMethod(
  18331. $core.method({
  18332. selector: "source",
  18333. protocol: "accessing",
  18334. fn: function (){
  18335. var self=this,$self=this;
  18336. return $core.withContext(function($ctx1) {
  18337. var $1,$receiver;
  18338. $1=$self.source;
  18339. if(($receiver = $1) == null || $receiver.a$nil){
  18340. return "";
  18341. } else {
  18342. return $1;
  18343. }
  18344. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  18345. },
  18346. args: [],
  18347. source: "source\x0a\x09^ source ifNil: [ '' ]",
  18348. referencedClasses: [],
  18349. messageSends: ["ifNil:"]
  18350. }),
  18351. $globals.CompiledMethod);
  18352. $core.addMethod(
  18353. $core.method({
  18354. selector: "source:",
  18355. protocol: "accessing",
  18356. fn: function (aString){
  18357. var self=this,$self=this;
  18358. $self.source=aString;
  18359. return self;
  18360. },
  18361. args: ["aString"],
  18362. source: "source: aString\x0a\x09source := aString",
  18363. referencedClasses: [],
  18364. messageSends: []
  18365. }),
  18366. $globals.CompiledMethod);
  18367. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  18368. $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`";
  18369. $core.addMethod(
  18370. $core.method({
  18371. selector: "addWorker",
  18372. protocol: "private",
  18373. fn: function (){
  18374. var self=this,$self=this;
  18375. return $core.withContext(function($ctx1) {
  18376. $recv($self.worker)._valueWithTimeout_((0));
  18377. $self.poolSize=$recv($self.poolSize).__plus((1));
  18378. return self;
  18379. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  18380. },
  18381. args: [],
  18382. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  18383. referencedClasses: [],
  18384. messageSends: ["valueWithTimeout:", "+"]
  18385. }),
  18386. $globals.ForkPool);
  18387. $core.addMethod(
  18388. $core.method({
  18389. selector: "defaultMaxPoolSize",
  18390. protocol: "defaults",
  18391. fn: function (){
  18392. var self=this,$self=this;
  18393. return $core.withContext(function($ctx1) {
  18394. return $recv($self._class())._defaultMaxPoolSize();
  18395. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  18396. },
  18397. args: [],
  18398. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  18399. referencedClasses: [],
  18400. messageSends: ["defaultMaxPoolSize", "class"]
  18401. }),
  18402. $globals.ForkPool);
  18403. $core.addMethod(
  18404. $core.method({
  18405. selector: "fork:",
  18406. protocol: "actions",
  18407. fn: function (aBlock){
  18408. var self=this,$self=this;
  18409. return $core.withContext(function($ctx1) {
  18410. var $1;
  18411. $1=$recv($self.poolSize).__lt($self._maxPoolSize());
  18412. if($core.assert($1)){
  18413. $self._addWorker();
  18414. }
  18415. $recv($self.queue)._nextPut_(aBlock);
  18416. return self;
  18417. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  18418. },
  18419. args: ["aBlock"],
  18420. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  18421. referencedClasses: [],
  18422. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  18423. }),
  18424. $globals.ForkPool);
  18425. $core.addMethod(
  18426. $core.method({
  18427. selector: "initialize",
  18428. protocol: "initialization",
  18429. fn: function (){
  18430. var self=this,$self=this;
  18431. return $core.withContext(function($ctx1) {
  18432. (
  18433. $ctx1.supercall = true,
  18434. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18435. $ctx1.supercall = false;
  18436. $self.poolSize=(0);
  18437. $self.queue=$recv($globals.Queue)._new();
  18438. $self.worker=$self._makeWorker();
  18439. return self;
  18440. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  18441. },
  18442. args: [],
  18443. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  18444. referencedClasses: ["Queue"],
  18445. messageSends: ["initialize", "new", "makeWorker"]
  18446. }),
  18447. $globals.ForkPool);
  18448. $core.addMethod(
  18449. $core.method({
  18450. selector: "makeWorker",
  18451. protocol: "initialization",
  18452. fn: function (){
  18453. var self=this,$self=this;
  18454. var sentinel;
  18455. return $core.withContext(function($ctx1) {
  18456. var $1;
  18457. sentinel=$recv($globals.Object)._new();
  18458. return (function(){
  18459. var block;
  18460. return $core.withContext(function($ctx2) {
  18461. $self.poolSize=$recv($self.poolSize).__minus((1));
  18462. block=$recv($self.queue)._nextIfAbsent_((function(){
  18463. return sentinel;
  18464. }));
  18465. $1=$recv(block).__eq_eq(sentinel);
  18466. if(!$core.assert($1)){
  18467. return $recv((function(){
  18468. return $core.withContext(function($ctx3) {
  18469. return $recv(block)._value();
  18470. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  18471. }))._ensure_((function(){
  18472. return $core.withContext(function($ctx3) {
  18473. return $self._addWorker();
  18474. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  18475. }));
  18476. }
  18477. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  18478. });
  18479. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  18480. },
  18481. args: [],
  18482. 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 ] ]]",
  18483. referencedClasses: ["Object"],
  18484. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  18485. }),
  18486. $globals.ForkPool);
  18487. $core.addMethod(
  18488. $core.method({
  18489. selector: "maxPoolSize",
  18490. protocol: "accessing",
  18491. fn: function (){
  18492. var self=this,$self=this;
  18493. return $core.withContext(function($ctx1) {
  18494. var $1,$receiver;
  18495. $1=$self.maxPoolSize;
  18496. if(($receiver = $1) == null || $receiver.a$nil){
  18497. return $self._defaultMaxPoolSize();
  18498. } else {
  18499. return $1;
  18500. }
  18501. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  18502. },
  18503. args: [],
  18504. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  18505. referencedClasses: [],
  18506. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  18507. }),
  18508. $globals.ForkPool);
  18509. $core.addMethod(
  18510. $core.method({
  18511. selector: "maxPoolSize:",
  18512. protocol: "accessing",
  18513. fn: function (anInteger){
  18514. var self=this,$self=this;
  18515. $self.maxPoolSize=anInteger;
  18516. return self;
  18517. },
  18518. args: ["anInteger"],
  18519. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  18520. referencedClasses: [],
  18521. messageSends: []
  18522. }),
  18523. $globals.ForkPool);
  18524. $core.setSlots($globals.ForkPool.a$cls, ["default"]);
  18525. $core.addMethod(
  18526. $core.method({
  18527. selector: "default",
  18528. protocol: "accessing",
  18529. fn: function (){
  18530. var self=this,$self=this;
  18531. return $core.withContext(function($ctx1) {
  18532. var $1,$receiver;
  18533. $1=$self.default;
  18534. if(($receiver = $1) == null || $receiver.a$nil){
  18535. $self.default=$self._new();
  18536. return $self.default;
  18537. } else {
  18538. return $1;
  18539. }
  18540. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.a$cls)});
  18541. },
  18542. args: [],
  18543. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  18544. referencedClasses: [],
  18545. messageSends: ["ifNil:", "new"]
  18546. }),
  18547. $globals.ForkPool.a$cls);
  18548. $core.addMethod(
  18549. $core.method({
  18550. selector: "defaultMaxPoolSize",
  18551. protocol: "accessing",
  18552. fn: function (){
  18553. var self=this,$self=this;
  18554. return (100);
  18555. },
  18556. args: [],
  18557. source: "defaultMaxPoolSize\x0a\x09^ 100",
  18558. referencedClasses: [],
  18559. messageSends: []
  18560. }),
  18561. $globals.ForkPool.a$cls);
  18562. $core.addMethod(
  18563. $core.method({
  18564. selector: "resetDefault",
  18565. protocol: "accessing",
  18566. fn: function (){
  18567. var self=this,$self=this;
  18568. $self.default=nil;
  18569. return self;
  18570. },
  18571. args: [],
  18572. source: "resetDefault\x0a\x09default := nil",
  18573. referencedClasses: [],
  18574. messageSends: []
  18575. }),
  18576. $globals.ForkPool.a$cls);
  18577. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  18578. $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.";
  18579. $core.addMethod(
  18580. $core.method({
  18581. selector: "arguments",
  18582. protocol: "accessing",
  18583. fn: function (){
  18584. var self=this,$self=this;
  18585. return $self.arguments;
  18586. },
  18587. args: [],
  18588. source: "arguments\x0a\x09^ arguments",
  18589. referencedClasses: [],
  18590. messageSends: []
  18591. }),
  18592. $globals.Message);
  18593. $core.addMethod(
  18594. $core.method({
  18595. selector: "arguments:",
  18596. protocol: "accessing",
  18597. fn: function (anArray){
  18598. var self=this,$self=this;
  18599. $self.arguments=anArray;
  18600. return self;
  18601. },
  18602. args: ["anArray"],
  18603. source: "arguments: anArray\x0a\x09arguments := anArray",
  18604. referencedClasses: [],
  18605. messageSends: []
  18606. }),
  18607. $globals.Message);
  18608. $core.addMethod(
  18609. $core.method({
  18610. selector: "printOn:",
  18611. protocol: "printing",
  18612. fn: function (aStream){
  18613. var self=this,$self=this;
  18614. return $core.withContext(function($ctx1) {
  18615. (
  18616. $ctx1.supercall = true,
  18617. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18618. $ctx1.supercall = false;
  18619. $recv(aStream)._nextPutAll_("(");
  18620. $ctx1.sendIdx["nextPutAll:"]=1;
  18621. $recv(aStream)._nextPutAll_($self._selector());
  18622. $ctx1.sendIdx["nextPutAll:"]=2;
  18623. $recv(aStream)._nextPutAll_(")");
  18624. return self;
  18625. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  18626. },
  18627. args: ["aStream"],
  18628. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18629. referencedClasses: [],
  18630. messageSends: ["printOn:", "nextPutAll:", "selector"]
  18631. }),
  18632. $globals.Message);
  18633. $core.addMethod(
  18634. $core.method({
  18635. selector: "selector",
  18636. protocol: "accessing",
  18637. fn: function (){
  18638. var self=this,$self=this;
  18639. return $self.selector;
  18640. },
  18641. args: [],
  18642. source: "selector\x0a\x09^ selector",
  18643. referencedClasses: [],
  18644. messageSends: []
  18645. }),
  18646. $globals.Message);
  18647. $core.addMethod(
  18648. $core.method({
  18649. selector: "selector:",
  18650. protocol: "accessing",
  18651. fn: function (aString){
  18652. var self=this,$self=this;
  18653. $self.selector=aString;
  18654. return self;
  18655. },
  18656. args: ["aString"],
  18657. source: "selector: aString\x0a\x09selector := aString",
  18658. referencedClasses: [],
  18659. messageSends: []
  18660. }),
  18661. $globals.Message);
  18662. $core.addMethod(
  18663. $core.method({
  18664. selector: "sendTo:",
  18665. protocol: "actions",
  18666. fn: function (anObject){
  18667. var self=this,$self=this;
  18668. return $core.withContext(function($ctx1) {
  18669. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  18670. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  18671. },
  18672. args: ["anObject"],
  18673. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  18674. referencedClasses: [],
  18675. messageSends: ["perform:withArguments:", "selector", "arguments"]
  18676. }),
  18677. $globals.Message);
  18678. $core.addMethod(
  18679. $core.method({
  18680. selector: "selector:arguments:",
  18681. protocol: "instance creation",
  18682. fn: function (aString,anArray){
  18683. var self=this,$self=this;
  18684. return $core.withContext(function($ctx1) {
  18685. var $1;
  18686. $1=$self._new();
  18687. $recv($1)._selector_(aString);
  18688. $recv($1)._arguments_(anArray);
  18689. return $recv($1)._yourself();
  18690. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.a$cls)});
  18691. },
  18692. args: ["aString", "anArray"],
  18693. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  18694. referencedClasses: [],
  18695. messageSends: ["selector:", "new", "arguments:", "yourself"]
  18696. }),
  18697. $globals.Message.a$cls);
  18698. $core.addMethod(
  18699. $core.method({
  18700. selector: "selector:arguments:notUnderstoodBy:",
  18701. protocol: "dnu handling",
  18702. fn: function (aString,anArray,anObject){
  18703. var self=this,$self=this;
  18704. return $core.withContext(function($ctx1) {
  18705. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  18706. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject},$globals.Message.a$cls)});
  18707. },
  18708. args: ["aString", "anArray", "anObject"],
  18709. 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)",
  18710. referencedClasses: [],
  18711. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  18712. }),
  18713. $globals.Message.a$cls);
  18714. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  18715. $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.";
  18716. $core.addMethod(
  18717. $core.method({
  18718. selector: "arguments",
  18719. protocol: "accessing",
  18720. fn: function (){
  18721. var self=this,$self=this;
  18722. return $core.withContext(function($ctx1) {
  18723. return $recv($self.message)._arguments();
  18724. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  18725. },
  18726. args: [],
  18727. source: "arguments\x0a\x09^ message arguments",
  18728. referencedClasses: [],
  18729. messageSends: ["arguments"]
  18730. }),
  18731. $globals.MessageSend);
  18732. $core.addMethod(
  18733. $core.method({
  18734. selector: "arguments:",
  18735. protocol: "accessing",
  18736. fn: function (aCollection){
  18737. var self=this,$self=this;
  18738. return $core.withContext(function($ctx1) {
  18739. $recv($self.message)._arguments_(aCollection);
  18740. return self;
  18741. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  18742. },
  18743. args: ["aCollection"],
  18744. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  18745. referencedClasses: [],
  18746. messageSends: ["arguments:"]
  18747. }),
  18748. $globals.MessageSend);
  18749. $core.addMethod(
  18750. $core.method({
  18751. selector: "initialize",
  18752. protocol: "initialization",
  18753. fn: function (){
  18754. var self=this,$self=this;
  18755. return $core.withContext(function($ctx1) {
  18756. (
  18757. $ctx1.supercall = true,
  18758. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18759. $ctx1.supercall = false;
  18760. $self.message=$recv($globals.Message)._new();
  18761. return self;
  18762. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  18763. },
  18764. args: [],
  18765. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  18766. referencedClasses: ["Message"],
  18767. messageSends: ["initialize", "new"]
  18768. }),
  18769. $globals.MessageSend);
  18770. $core.addMethod(
  18771. $core.method({
  18772. selector: "printOn:",
  18773. protocol: "printing",
  18774. fn: function (aStream){
  18775. var self=this,$self=this;
  18776. return $core.withContext(function($ctx1) {
  18777. (
  18778. $ctx1.supercall = true,
  18779. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18780. $ctx1.supercall = false;
  18781. $recv(aStream)._nextPutAll_("(");
  18782. $ctx1.sendIdx["nextPutAll:"]=1;
  18783. $recv(aStream)._nextPutAll_($self._receiver());
  18784. $ctx1.sendIdx["nextPutAll:"]=2;
  18785. $recv(aStream)._nextPutAll_(" >> ");
  18786. $ctx1.sendIdx["nextPutAll:"]=3;
  18787. $recv(aStream)._nextPutAll_($self._selector());
  18788. $ctx1.sendIdx["nextPutAll:"]=4;
  18789. $recv(aStream)._nextPutAll_(")");
  18790. return self;
  18791. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  18792. },
  18793. args: ["aStream"],
  18794. 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: ')'",
  18795. referencedClasses: [],
  18796. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  18797. }),
  18798. $globals.MessageSend);
  18799. $core.addMethod(
  18800. $core.method({
  18801. selector: "receiver",
  18802. protocol: "accessing",
  18803. fn: function (){
  18804. var self=this,$self=this;
  18805. return $self.receiver;
  18806. },
  18807. args: [],
  18808. source: "receiver\x0a\x09^ receiver",
  18809. referencedClasses: [],
  18810. messageSends: []
  18811. }),
  18812. $globals.MessageSend);
  18813. $core.addMethod(
  18814. $core.method({
  18815. selector: "receiver:",
  18816. protocol: "accessing",
  18817. fn: function (anObject){
  18818. var self=this,$self=this;
  18819. $self.receiver=anObject;
  18820. return self;
  18821. },
  18822. args: ["anObject"],
  18823. source: "receiver: anObject\x0a\x09receiver := anObject",
  18824. referencedClasses: [],
  18825. messageSends: []
  18826. }),
  18827. $globals.MessageSend);
  18828. $core.addMethod(
  18829. $core.method({
  18830. selector: "selector",
  18831. protocol: "accessing",
  18832. fn: function (){
  18833. var self=this,$self=this;
  18834. return $core.withContext(function($ctx1) {
  18835. return $recv($self.message)._selector();
  18836. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  18837. },
  18838. args: [],
  18839. source: "selector\x0a\x09^ message selector",
  18840. referencedClasses: [],
  18841. messageSends: ["selector"]
  18842. }),
  18843. $globals.MessageSend);
  18844. $core.addMethod(
  18845. $core.method({
  18846. selector: "selector:",
  18847. protocol: "accessing",
  18848. fn: function (aString){
  18849. var self=this,$self=this;
  18850. return $core.withContext(function($ctx1) {
  18851. $recv($self.message)._selector_(aString);
  18852. return self;
  18853. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  18854. },
  18855. args: ["aString"],
  18856. source: "selector: aString\x0a\x09message selector: aString",
  18857. referencedClasses: [],
  18858. messageSends: ["selector:"]
  18859. }),
  18860. $globals.MessageSend);
  18861. $core.addMethod(
  18862. $core.method({
  18863. selector: "value",
  18864. protocol: "evaluating",
  18865. fn: function (){
  18866. var self=this,$self=this;
  18867. return $core.withContext(function($ctx1) {
  18868. return $recv($self.message)._sendTo_($self._receiver());
  18869. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  18870. },
  18871. args: [],
  18872. source: "value\x0a\x09^ message sendTo: self receiver",
  18873. referencedClasses: [],
  18874. messageSends: ["sendTo:", "receiver"]
  18875. }),
  18876. $globals.MessageSend);
  18877. $core.addMethod(
  18878. $core.method({
  18879. selector: "value:",
  18880. protocol: "evaluating",
  18881. fn: function (anObject){
  18882. var self=this,$self=this;
  18883. return $core.withContext(function($ctx1) {
  18884. var $1;
  18885. $1=$self.message;
  18886. $recv($1)._arguments_([anObject]);
  18887. return $recv($1)._sendTo_($self._receiver());
  18888. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  18889. },
  18890. args: ["anObject"],
  18891. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  18892. referencedClasses: [],
  18893. messageSends: ["arguments:", "sendTo:", "receiver"]
  18894. }),
  18895. $globals.MessageSend);
  18896. $core.addMethod(
  18897. $core.method({
  18898. selector: "value:value:",
  18899. protocol: "evaluating",
  18900. fn: function (firstArgument,secondArgument){
  18901. var self=this,$self=this;
  18902. return $core.withContext(function($ctx1) {
  18903. var $1;
  18904. $1=$self.message;
  18905. $recv($1)._arguments_([firstArgument,secondArgument]);
  18906. return $recv($1)._sendTo_($self._receiver());
  18907. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  18908. },
  18909. args: ["firstArgument", "secondArgument"],
  18910. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  18911. referencedClasses: [],
  18912. messageSends: ["arguments:", "sendTo:", "receiver"]
  18913. }),
  18914. $globals.MessageSend);
  18915. $core.addMethod(
  18916. $core.method({
  18917. selector: "value:value:value:",
  18918. protocol: "evaluating",
  18919. fn: function (firstArgument,secondArgument,thirdArgument){
  18920. var self=this,$self=this;
  18921. return $core.withContext(function($ctx1) {
  18922. var $1;
  18923. $1=$self.message;
  18924. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  18925. return $recv($1)._sendTo_($self._receiver());
  18926. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  18927. },
  18928. args: ["firstArgument", "secondArgument", "thirdArgument"],
  18929. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  18930. referencedClasses: [],
  18931. messageSends: ["arguments:", "sendTo:", "receiver"]
  18932. }),
  18933. $globals.MessageSend);
  18934. $core.addMethod(
  18935. $core.method({
  18936. selector: "valueWithPossibleArguments:",
  18937. protocol: "evaluating",
  18938. fn: function (aCollection){
  18939. var self=this,$self=this;
  18940. return $core.withContext(function($ctx1) {
  18941. $self._arguments_(aCollection);
  18942. return $self._value();
  18943. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  18944. },
  18945. args: ["aCollection"],
  18946. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  18947. referencedClasses: [],
  18948. messageSends: ["arguments:", "value"]
  18949. }),
  18950. $globals.MessageSend);
  18951. $core.addClass("MethodContext", $globals.Object, ["receiver", "evaluatedSelector", "homeContext", "index", "locals", "outerContext", "selector", "sendIdx", "supercall"], "Kernel-Methods");
  18952. $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`.";
  18953. $core.addMethod(
  18954. $core.method({
  18955. selector: "basicReceiver",
  18956. protocol: "accessing",
  18957. fn: function (){
  18958. var self=this,$self=this;
  18959. return $self.receiver;
  18960. },
  18961. args: [],
  18962. source: "basicReceiver\x0a\x09^ receiver",
  18963. referencedClasses: [],
  18964. messageSends: []
  18965. }),
  18966. $globals.MethodContext);
  18967. $core.addMethod(
  18968. $core.method({
  18969. selector: "evaluatedSelector",
  18970. protocol: "accessing",
  18971. fn: function (){
  18972. var self=this,$self=this;
  18973. return $self.evaluatedSelector;
  18974. },
  18975. args: [],
  18976. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  18977. referencedClasses: [],
  18978. messageSends: []
  18979. }),
  18980. $globals.MethodContext);
  18981. $core.addMethod(
  18982. $core.method({
  18983. selector: "home",
  18984. protocol: "accessing",
  18985. fn: function (){
  18986. var self=this,$self=this;
  18987. return $self.homeContext;
  18988. },
  18989. args: [],
  18990. source: "home\x0a\x09^ homeContext",
  18991. referencedClasses: [],
  18992. messageSends: []
  18993. }),
  18994. $globals.MethodContext);
  18995. $core.addMethod(
  18996. $core.method({
  18997. selector: "index",
  18998. protocol: "accessing",
  18999. fn: function (){
  19000. var self=this,$self=this;
  19001. return $core.withContext(function($ctx1) {
  19002. var $1,$receiver;
  19003. $1=$self.index;
  19004. if(($receiver = $1) == null || $receiver.a$nil){
  19005. return (0);
  19006. } else {
  19007. return $1;
  19008. }
  19009. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  19010. },
  19011. args: [],
  19012. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  19013. referencedClasses: [],
  19014. messageSends: ["ifNil:"]
  19015. }),
  19016. $globals.MethodContext);
  19017. $core.addMethod(
  19018. $core.method({
  19019. selector: "locals",
  19020. protocol: "accessing",
  19021. fn: function (){
  19022. var self=this,$self=this;
  19023. return $self.locals;
  19024. },
  19025. args: [],
  19026. source: "locals\x0a\x09^ locals",
  19027. referencedClasses: [],
  19028. messageSends: []
  19029. }),
  19030. $globals.MethodContext);
  19031. $core.addMethod(
  19032. $core.method({
  19033. selector: "outerContext",
  19034. protocol: "accessing",
  19035. fn: function (){
  19036. var self=this,$self=this;
  19037. return $core.withContext(function($ctx1) {
  19038. var $1,$receiver;
  19039. $1=$self.outerContext;
  19040. if(($receiver = $1) == null || $receiver.a$nil){
  19041. return $self._home();
  19042. } else {
  19043. return $1;
  19044. }
  19045. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  19046. },
  19047. args: [],
  19048. source: "outerContext\x0a\x09^ outerContext ifNil: [ self home ]",
  19049. referencedClasses: [],
  19050. messageSends: ["ifNil:", "home"]
  19051. }),
  19052. $globals.MethodContext);
  19053. $core.addMethod(
  19054. $core.method({
  19055. selector: "selector",
  19056. protocol: "accessing",
  19057. fn: function (){
  19058. var self=this,$self=this;
  19059. return $core.withContext(function($ctx1) {
  19060. var $1,$receiver;
  19061. $1=$self.selector;
  19062. if(($receiver = $1) == null || $receiver.a$nil){
  19063. return $1;
  19064. } else {
  19065. return $recv($recv($globals.Smalltalk)._core())._js2st_($self.selector);
  19066. }
  19067. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  19068. },
  19069. args: [],
  19070. source: "selector\x0a\x09^ selector ifNotNil: [ Smalltalk core js2st: selector ]",
  19071. referencedClasses: ["Smalltalk"],
  19072. messageSends: ["ifNotNil:", "js2st:", "core"]
  19073. }),
  19074. $globals.MethodContext);
  19075. $core.addMethod(
  19076. $core.method({
  19077. selector: "sendIndexes",
  19078. protocol: "accessing",
  19079. fn: function (){
  19080. var self=this,$self=this;
  19081. return $self.sendIdx;
  19082. },
  19083. args: [],
  19084. source: "sendIndexes\x0a\x09^ sendIdx",
  19085. referencedClasses: [],
  19086. messageSends: []
  19087. }),
  19088. $globals.MethodContext);
  19089. $core.addMethod(
  19090. $core.method({
  19091. selector: "stubHere",
  19092. protocol: "accessing",
  19093. fn: function (){
  19094. var self=this,$self=this;
  19095. return $core.withContext(function($ctx1) {
  19096. $self.homeContext=$recv($globals.JSObjectProxy)._undefined();
  19097. return self;
  19098. }, function($ctx1) {$ctx1.fill(self,"stubHere",{},$globals.MethodContext)});
  19099. },
  19100. args: [],
  19101. source: "stubHere\x0a\x09homeContext := JSObjectProxy undefined",
  19102. referencedClasses: ["JSObjectProxy"],
  19103. messageSends: ["undefined"]
  19104. }),
  19105. $globals.MethodContext);
  19106. $core.addMethod(
  19107. $core.method({
  19108. selector: "stubToAtMost:",
  19109. protocol: "error handling",
  19110. fn: function (anInteger){
  19111. var self=this,$self=this;
  19112. var context;
  19113. return $core.withContext(function($ctx1) {
  19114. var $1,$2,$receiver;
  19115. context=self;
  19116. $recv(anInteger)._timesRepeat_((function(){
  19117. return $core.withContext(function($ctx2) {
  19118. $1=context;
  19119. if(($receiver = $1) == null || $receiver.a$nil){
  19120. context=$1;
  19121. } else {
  19122. context=$recv(context)._home();
  19123. }
  19124. return context;
  19125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19126. }));
  19127. $2=context;
  19128. if(($receiver = $2) == null || $receiver.a$nil){
  19129. $2;
  19130. } else {
  19131. $recv(context)._stubHere();
  19132. }
  19133. return self;
  19134. }, function($ctx1) {$ctx1.fill(self,"stubToAtMost:",{anInteger:anInteger,context:context},$globals.MethodContext)});
  19135. },
  19136. args: ["anInteger"],
  19137. source: "stubToAtMost: anInteger\x0a\x09| context |\x0a\x09context := self.\x0a\x09anInteger timesRepeat: [ context := context ifNotNil: [ context home ] ].\x0a\x09context ifNotNil: [ context stubHere ]",
  19138. referencedClasses: [],
  19139. messageSends: ["timesRepeat:", "ifNotNil:", "home", "stubHere"]
  19140. }),
  19141. $globals.MethodContext);
  19142. $core.addMethod(
  19143. $core.method({
  19144. selector: "supercall",
  19145. protocol: "accessing",
  19146. fn: function (){
  19147. var self=this,$self=this;
  19148. return $core.withContext(function($ctx1) {
  19149. return $recv($self.supercall).__eq(true);
  19150. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  19151. },
  19152. args: [],
  19153. source: "supercall\x0a\x09^ supercall = true",
  19154. referencedClasses: [],
  19155. messageSends: ["="]
  19156. }),
  19157. $globals.MethodContext);
  19158. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  19159. $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' ]";
  19160. $core.addMethod(
  19161. $core.method({
  19162. selector: "constructorNamed:",
  19163. protocol: "instance creation",
  19164. fn: function (aString){
  19165. var self=this,$self=this;
  19166. return $core.withContext(function($ctx1) {
  19167. var nativeFunc=$globals.Platform._globals()[aString];
  19168. return new nativeFunc();
  19169. ;
  19170. return self;
  19171. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19172. },
  19173. args: ["aString"],
  19174. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19175. referencedClasses: [],
  19176. messageSends: []
  19177. }),
  19178. $globals.NativeFunction.a$cls);
  19179. $core.addMethod(
  19180. $core.method({
  19181. selector: "constructorNamed:value:",
  19182. protocol: "instance creation",
  19183. fn: function (aString,anObject){
  19184. var self=this,$self=this;
  19185. return $core.withContext(function($ctx1) {
  19186. var nativeFunc=$globals.Platform._globals()[aString];
  19187. return new nativeFunc(anObject);
  19188. ;
  19189. return self;
  19190. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19191. },
  19192. args: ["aString", "anObject"],
  19193. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19194. referencedClasses: [],
  19195. messageSends: []
  19196. }),
  19197. $globals.NativeFunction.a$cls);
  19198. $core.addMethod(
  19199. $core.method({
  19200. selector: "constructorNamed:value:value:",
  19201. protocol: "instance creation",
  19202. fn: function (aString,anObject,anObject2){
  19203. var self=this,$self=this;
  19204. return $core.withContext(function($ctx1) {
  19205. var nativeFunc=$globals.Platform._globals[aString];
  19206. return new nativeFunc(anObject,anObject2);
  19207. ;
  19208. return self;
  19209. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19210. },
  19211. args: ["aString", "anObject", "anObject2"],
  19212. 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'>",
  19213. referencedClasses: [],
  19214. messageSends: []
  19215. }),
  19216. $globals.NativeFunction.a$cls);
  19217. $core.addMethod(
  19218. $core.method({
  19219. selector: "constructorNamed:value:value:value:",
  19220. protocol: "instance creation",
  19221. fn: function (aString,anObject,anObject2,anObject3){
  19222. var self=this,$self=this;
  19223. return $core.withContext(function($ctx1) {
  19224. var nativeFunc=$globals.Platform._globals[aString];
  19225. return new nativeFunc(anObject,anObject2, anObject3);
  19226. ;
  19227. return self;
  19228. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19229. },
  19230. args: ["aString", "anObject", "anObject2", "anObject3"],
  19231. 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'>",
  19232. referencedClasses: [],
  19233. messageSends: []
  19234. }),
  19235. $globals.NativeFunction.a$cls);
  19236. $core.addMethod(
  19237. $core.method({
  19238. selector: "constructorOf:",
  19239. protocol: "instance creation",
  19240. fn: function (nativeFunc){
  19241. var self=this,$self=this;
  19242. return $core.withContext(function($ctx1) {
  19243. return new nativeFunc();
  19244. ;
  19245. return self;
  19246. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19247. },
  19248. args: ["nativeFunc"],
  19249. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19250. referencedClasses: [],
  19251. messageSends: []
  19252. }),
  19253. $globals.NativeFunction.a$cls);
  19254. $core.addMethod(
  19255. $core.method({
  19256. selector: "constructorOf:value:",
  19257. protocol: "instance creation",
  19258. fn: function (nativeFunc,anObject){
  19259. var self=this,$self=this;
  19260. return $core.withContext(function($ctx1) {
  19261. return new nativeFunc(anObject);
  19262. ;
  19263. return self;
  19264. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19265. },
  19266. args: ["nativeFunc", "anObject"],
  19267. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19268. referencedClasses: [],
  19269. messageSends: []
  19270. }),
  19271. $globals.NativeFunction.a$cls);
  19272. $core.addMethod(
  19273. $core.method({
  19274. selector: "constructorOf:value:value:",
  19275. protocol: "instance creation",
  19276. fn: function (nativeFunc,anObject,anObject2){
  19277. var self=this,$self=this;
  19278. return $core.withContext(function($ctx1) {
  19279. return new nativeFunc(anObject,anObject2);
  19280. ;
  19281. return self;
  19282. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19283. },
  19284. args: ["nativeFunc", "anObject", "anObject2"],
  19285. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19286. referencedClasses: [],
  19287. messageSends: []
  19288. }),
  19289. $globals.NativeFunction.a$cls);
  19290. $core.addMethod(
  19291. $core.method({
  19292. selector: "constructorOf:value:value:value:",
  19293. protocol: "instance creation",
  19294. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19295. var self=this,$self=this;
  19296. return $core.withContext(function($ctx1) {
  19297. return new nativeFunc(anObject,anObject2, anObject3);
  19298. ;
  19299. return self;
  19300. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19301. },
  19302. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19303. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19304. referencedClasses: [],
  19305. messageSends: []
  19306. }),
  19307. $globals.NativeFunction.a$cls);
  19308. $core.addMethod(
  19309. $core.method({
  19310. selector: "exists:",
  19311. protocol: "testing",
  19312. fn: function (aString){
  19313. var self=this,$self=this;
  19314. return $core.withContext(function($ctx1) {
  19315. return $recv($globals.Platform)._includesGlobal_(aString);
  19316. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.a$cls)});
  19317. },
  19318. args: ["aString"],
  19319. source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
  19320. referencedClasses: ["Platform"],
  19321. messageSends: ["includesGlobal:"]
  19322. }),
  19323. $globals.NativeFunction.a$cls);
  19324. $core.addMethod(
  19325. $core.method({
  19326. selector: "functionNamed:",
  19327. protocol: "function calling",
  19328. fn: function (aString){
  19329. var self=this,$self=this;
  19330. return $core.withContext(function($ctx1) {
  19331. var nativeFunc=$globals.Platform._globals[aString];
  19332. return nativeFunc();
  19333. ;
  19334. return self;
  19335. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19336. },
  19337. args: ["aString"],
  19338. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19339. referencedClasses: [],
  19340. messageSends: []
  19341. }),
  19342. $globals.NativeFunction.a$cls);
  19343. $core.addMethod(
  19344. $core.method({
  19345. selector: "functionNamed:value:",
  19346. protocol: "function calling",
  19347. fn: function (aString,anObject){
  19348. var self=this,$self=this;
  19349. return $core.withContext(function($ctx1) {
  19350. var nativeFunc=$globals.Platform._globals()[aString];
  19351. return nativeFunc(anObject);
  19352. ;
  19353. return self;
  19354. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19355. },
  19356. args: ["aString", "anObject"],
  19357. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19358. referencedClasses: [],
  19359. messageSends: []
  19360. }),
  19361. $globals.NativeFunction.a$cls);
  19362. $core.addMethod(
  19363. $core.method({
  19364. selector: "functionNamed:value:value:",
  19365. protocol: "function calling",
  19366. fn: function (aString,anObject,anObject2){
  19367. var self=this,$self=this;
  19368. return $core.withContext(function($ctx1) {
  19369. var nativeFunc=$globals.Platform._globals()[aString];
  19370. return nativeFunc(anObject,anObject2);
  19371. ;
  19372. return self;
  19373. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19374. },
  19375. args: ["aString", "anObject", "anObject2"],
  19376. 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'>",
  19377. referencedClasses: [],
  19378. messageSends: []
  19379. }),
  19380. $globals.NativeFunction.a$cls);
  19381. $core.addMethod(
  19382. $core.method({
  19383. selector: "functionNamed:value:value:value:",
  19384. protocol: "function calling",
  19385. fn: function (aString,anObject,anObject2,anObject3){
  19386. var self=this,$self=this;
  19387. return $core.withContext(function($ctx1) {
  19388. var nativeFunc=$globals.Platform._globals()[aString];
  19389. return nativeFunc(anObject,anObject2, anObject3);
  19390. ;
  19391. return self;
  19392. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19393. },
  19394. args: ["aString", "anObject", "anObject2", "anObject3"],
  19395. 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'>",
  19396. referencedClasses: [],
  19397. messageSends: []
  19398. }),
  19399. $globals.NativeFunction.a$cls);
  19400. $core.addMethod(
  19401. $core.method({
  19402. selector: "functionNamed:valueWithArgs:",
  19403. protocol: "function calling",
  19404. fn: function (aString,args){
  19405. var self=this,$self=this;
  19406. return $core.withContext(function($ctx1) {
  19407. var nativeFunc=$globals.Platform._globals()[aString];
  19408. return Function.prototype.apply.call(nativeFunc, null, args);
  19409. ;
  19410. return self;
  19411. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.a$cls)});
  19412. },
  19413. args: ["aString", "args"],
  19414. 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'>",
  19415. referencedClasses: [],
  19416. messageSends: []
  19417. }),
  19418. $globals.NativeFunction.a$cls);
  19419. $core.addMethod(
  19420. $core.method({
  19421. selector: "functionOf:",
  19422. protocol: "function calling",
  19423. fn: function (nativeFunc){
  19424. var self=this,$self=this;
  19425. return $core.withContext(function($ctx1) {
  19426. return nativeFunc();
  19427. ;
  19428. return self;
  19429. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19430. },
  19431. args: ["nativeFunc"],
  19432. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19433. referencedClasses: [],
  19434. messageSends: []
  19435. }),
  19436. $globals.NativeFunction.a$cls);
  19437. $core.addMethod(
  19438. $core.method({
  19439. selector: "functionOf:value:",
  19440. protocol: "function calling",
  19441. fn: function (nativeFunc,anObject){
  19442. var self=this,$self=this;
  19443. return $core.withContext(function($ctx1) {
  19444. return nativeFunc(anObject);
  19445. ;
  19446. return self;
  19447. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19448. },
  19449. args: ["nativeFunc", "anObject"],
  19450. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19451. referencedClasses: [],
  19452. messageSends: []
  19453. }),
  19454. $globals.NativeFunction.a$cls);
  19455. $core.addMethod(
  19456. $core.method({
  19457. selector: "functionOf:value:value:",
  19458. protocol: "function calling",
  19459. fn: function (nativeFunc,anObject,anObject2){
  19460. var self=this,$self=this;
  19461. return $core.withContext(function($ctx1) {
  19462. return nativeFunc(anObject,anObject2);
  19463. ;
  19464. return self;
  19465. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19466. },
  19467. args: ["nativeFunc", "anObject", "anObject2"],
  19468. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19469. referencedClasses: [],
  19470. messageSends: []
  19471. }),
  19472. $globals.NativeFunction.a$cls);
  19473. $core.addMethod(
  19474. $core.method({
  19475. selector: "functionOf:value:value:value:",
  19476. protocol: "function calling",
  19477. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19478. var self=this,$self=this;
  19479. return $core.withContext(function($ctx1) {
  19480. return nativeFunc(anObject,anObject2, anObject3);
  19481. ;
  19482. return self;
  19483. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19484. },
  19485. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19486. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19487. referencedClasses: [],
  19488. messageSends: []
  19489. }),
  19490. $globals.NativeFunction.a$cls);
  19491. $core.addMethod(
  19492. $core.method({
  19493. selector: "functionOf:valueWithArgs:",
  19494. protocol: "function calling",
  19495. fn: function (nativeFunc,args){
  19496. var self=this,$self=this;
  19497. return $core.withContext(function($ctx1) {
  19498. return Function.prototype.apply.call(nativeFunc, null, args);
  19499. ;
  19500. return self;
  19501. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.a$cls)});
  19502. },
  19503. args: ["nativeFunc", "args"],
  19504. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19505. referencedClasses: [],
  19506. messageSends: []
  19507. }),
  19508. $globals.NativeFunction.a$cls);
  19509. $core.addMethod(
  19510. $core.method({
  19511. selector: "isNativeFunction:",
  19512. protocol: "testing",
  19513. fn: function (anObject){
  19514. var self=this,$self=this;
  19515. return $core.withContext(function($ctx1) {
  19516. return typeof anObject === "function";
  19517. return self;
  19518. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject},$globals.NativeFunction.a$cls)});
  19519. },
  19520. args: ["anObject"],
  19521. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  19522. referencedClasses: [],
  19523. messageSends: []
  19524. }),
  19525. $globals.NativeFunction.a$cls);
  19526. $core.addMethod(
  19527. $core.method({
  19528. selector: "methodOf:this:",
  19529. protocol: "method calling",
  19530. fn: function (nativeFunc,thisObject){
  19531. var self=this,$self=this;
  19532. return $core.withContext(function($ctx1) {
  19533. return Function.prototype.call.call(nativeFunc, thisObject);
  19534. ;
  19535. return self;
  19536. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.a$cls)});
  19537. },
  19538. args: ["nativeFunc", "thisObject"],
  19539. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  19540. referencedClasses: [],
  19541. messageSends: []
  19542. }),
  19543. $globals.NativeFunction.a$cls);
  19544. $core.addMethod(
  19545. $core.method({
  19546. selector: "methodOf:this:value:",
  19547. protocol: "method calling",
  19548. fn: function (nativeFunc,thisObject,anObject){
  19549. var self=this,$self=this;
  19550. return $core.withContext(function($ctx1) {
  19551. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  19552. ;
  19553. return self;
  19554. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.a$cls)});
  19555. },
  19556. args: ["nativeFunc", "thisObject", "anObject"],
  19557. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  19558. referencedClasses: [],
  19559. messageSends: []
  19560. }),
  19561. $globals.NativeFunction.a$cls);
  19562. $core.addMethod(
  19563. $core.method({
  19564. selector: "methodOf:this:value:value:",
  19565. protocol: "method calling",
  19566. fn: function (nativeFunc,thisObject,anObject,anObject2){
  19567. var self=this,$self=this;
  19568. return $core.withContext(function($ctx1) {
  19569. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  19570. ;
  19571. return self;
  19572. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19573. },
  19574. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  19575. 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'>",
  19576. referencedClasses: [],
  19577. messageSends: []
  19578. }),
  19579. $globals.NativeFunction.a$cls);
  19580. $core.addMethod(
  19581. $core.method({
  19582. selector: "methodOf:this:value:value:value:",
  19583. protocol: "method calling",
  19584. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  19585. var self=this,$self=this;
  19586. return $core.withContext(function($ctx1) {
  19587. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  19588. ;
  19589. return self;
  19590. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19591. },
  19592. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  19593. 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'>",
  19594. referencedClasses: [],
  19595. messageSends: []
  19596. }),
  19597. $globals.NativeFunction.a$cls);
  19598. $core.addMethod(
  19599. $core.method({
  19600. selector: "methodOf:this:valueWithArgs:",
  19601. protocol: "method calling",
  19602. fn: function (nativeFunc,thisObject,args){
  19603. var self=this,$self=this;
  19604. return $core.withContext(function($ctx1) {
  19605. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  19606. ;
  19607. return self;
  19608. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.a$cls)});
  19609. },
  19610. args: ["nativeFunc", "thisObject", "args"],
  19611. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  19612. referencedClasses: [],
  19613. messageSends: []
  19614. }),
  19615. $globals.NativeFunction.a$cls);
  19616. $core.addTrait("TMethodContext", "Kernel-Methods");
  19617. $core.addMethod(
  19618. $core.method({
  19619. selector: "asString",
  19620. protocol: "converting",
  19621. fn: function (){
  19622. var self=this,$self=this;
  19623. return $core.withContext(function($ctx1) {
  19624. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  19625. $2=$self._isBlockContext();
  19626. if($core.assert($2)){
  19627. $3="a block (in ".__comma($recv($self._methodContext())._asString());
  19628. $ctx1.sendIdx[","]=2;
  19629. $1=$recv($3).__comma(")");
  19630. $ctx1.sendIdx[","]=1;
  19631. } else {
  19632. var methodClass;
  19633. methodClass=$recv($self._method())._methodClass();
  19634. $5=methodClass;
  19635. $7=$self._receiver();
  19636. $ctx1.sendIdx["receiver"]=1;
  19637. $6=$recv($7)._class();
  19638. $ctx1.sendIdx["class"]=1;
  19639. $4=$recv($5).__eq($6);
  19640. if($core.assert($4)){
  19641. $11=$self._receiver();
  19642. $ctx1.sendIdx["receiver"]=2;
  19643. $10=$recv($11)._class();
  19644. $ctx1.sendIdx["class"]=2;
  19645. $9=$recv($10)._name();
  19646. $ctx1.sendIdx["name"]=1;
  19647. $8=$recv($9).__comma(" >> ");
  19648. $ctx1.sendIdx[","]=4;
  19649. $12=$self._selector();
  19650. $ctx1.sendIdx["selector"]=1;
  19651. $1=$recv($8).__comma($12);
  19652. $ctx1.sendIdx[","]=3;
  19653. } else {
  19654. $16=$recv($recv($self._receiver())._class())._name();
  19655. $ctx1.sendIdx["name"]=2;
  19656. $15=$recv($16).__comma("(");
  19657. $14=$recv($15).__comma($recv(methodClass)._name());
  19658. $ctx1.sendIdx[","]=7;
  19659. $13=$recv($14).__comma(") >> ");
  19660. $ctx1.sendIdx[","]=6;
  19661. $1=$recv($13).__comma($self._selector());
  19662. $ctx1.sendIdx[","]=5;
  19663. }
  19664. }
  19665. return $1;
  19666. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.TMethodContext)});
  19667. },
  19668. args: [],
  19669. 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 ] ]",
  19670. referencedClasses: [],
  19671. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  19672. }),
  19673. $globals.TMethodContext);
  19674. $core.addMethod(
  19675. $core.method({
  19676. selector: "basicReceiver",
  19677. protocol: "accessing",
  19678. fn: function (){
  19679. var self=this,$self=this;
  19680. return $core.withContext(function($ctx1) {
  19681. $self._subclassResponsibility();
  19682. return self;
  19683. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.TMethodContext)});
  19684. },
  19685. args: [],
  19686. source: "basicReceiver\x0a\x09self subclassResponsibility",
  19687. referencedClasses: [],
  19688. messageSends: ["subclassResponsibility"]
  19689. }),
  19690. $globals.TMethodContext);
  19691. $core.addMethod(
  19692. $core.method({
  19693. selector: "findContextSuchThat:",
  19694. protocol: "accessing",
  19695. fn: function (testBlock){
  19696. var self=this,$self=this;
  19697. var context;
  19698. return $core.withContext(function($ctx1) {
  19699. var $1;
  19700. var $early={};
  19701. try {
  19702. context=self;
  19703. $recv((function(){
  19704. return $core.withContext(function($ctx2) {
  19705. return $recv(context)._isNil();
  19706. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19707. }))._whileFalse_((function(){
  19708. return $core.withContext(function($ctx2) {
  19709. $1=$recv(testBlock)._value_(context);
  19710. if($core.assert($1)){
  19711. throw $early=[context];
  19712. }
  19713. context=$recv(context)._outerContext();
  19714. return context;
  19715. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  19716. }));
  19717. return nil;
  19718. }
  19719. catch(e) {if(e===$early)return e[0]; throw e}
  19720. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.TMethodContext)});
  19721. },
  19722. args: ["testBlock"],
  19723. 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",
  19724. referencedClasses: [],
  19725. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  19726. }),
  19727. $globals.TMethodContext);
  19728. $core.addMethod(
  19729. $core.method({
  19730. selector: "home",
  19731. protocol: "accessing",
  19732. fn: function (){
  19733. var self=this,$self=this;
  19734. return $core.withContext(function($ctx1) {
  19735. $self._subclassResponsibility();
  19736. return self;
  19737. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.TMethodContext)});
  19738. },
  19739. args: [],
  19740. source: "home\x0a\x09self subclassResponsibility",
  19741. referencedClasses: [],
  19742. messageSends: ["subclassResponsibility"]
  19743. }),
  19744. $globals.TMethodContext);
  19745. $core.addMethod(
  19746. $core.method({
  19747. selector: "index",
  19748. protocol: "accessing",
  19749. fn: function (){
  19750. var self=this,$self=this;
  19751. return $core.withContext(function($ctx1) {
  19752. $self._subclassResponsibility();
  19753. return self;
  19754. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.TMethodContext)});
  19755. },
  19756. args: [],
  19757. source: "index\x0a\x09self subclassResponsibility",
  19758. referencedClasses: [],
  19759. messageSends: ["subclassResponsibility"]
  19760. }),
  19761. $globals.TMethodContext);
  19762. $core.addMethod(
  19763. $core.method({
  19764. selector: "isBlockContext",
  19765. protocol: "testing",
  19766. fn: function (){
  19767. var self=this,$self=this;
  19768. return $core.withContext(function($ctx1) {
  19769. return $recv($self._selector())._isNil();
  19770. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.TMethodContext)});
  19771. },
  19772. args: [],
  19773. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  19774. referencedClasses: [],
  19775. messageSends: ["isNil", "selector"]
  19776. }),
  19777. $globals.TMethodContext);
  19778. $core.addMethod(
  19779. $core.method({
  19780. selector: "locals",
  19781. protocol: "accessing",
  19782. fn: function (){
  19783. var self=this,$self=this;
  19784. return $core.withContext(function($ctx1) {
  19785. $self._subclassResponsibility();
  19786. return self;
  19787. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.TMethodContext)});
  19788. },
  19789. args: [],
  19790. source: "locals\x0a\x09self subclassResponsibility",
  19791. referencedClasses: [],
  19792. messageSends: ["subclassResponsibility"]
  19793. }),
  19794. $globals.TMethodContext);
  19795. $core.addMethod(
  19796. $core.method({
  19797. selector: "method",
  19798. protocol: "accessing",
  19799. fn: function (){
  19800. var self=this,$self=this;
  19801. var method,lookupClass,receiverClass,supercall;
  19802. return $core.withContext(function($ctx1) {
  19803. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  19804. $1=$self._methodContext();
  19805. $ctx1.sendIdx["methodContext"]=1;
  19806. if(($receiver = $1) == null || $receiver.a$nil){
  19807. return nil;
  19808. } else {
  19809. $1;
  19810. }
  19811. $3=$self._methodContext();
  19812. $ctx1.sendIdx["methodContext"]=2;
  19813. $2=$recv($3)._receiver();
  19814. receiverClass=$recv($2)._class();
  19815. $4=receiverClass;
  19816. $6=$self._methodContext();
  19817. $ctx1.sendIdx["methodContext"]=3;
  19818. $5=$recv($6)._selector();
  19819. $ctx1.sendIdx["selector"]=1;
  19820. method=$recv($4)._lookupSelector_($5);
  19821. $ctx1.sendIdx["lookupSelector:"]=1;
  19822. $7=$self._outerContext();
  19823. if(($receiver = $7) == null || $receiver.a$nil){
  19824. supercall=false;
  19825. } else {
  19826. var outer;
  19827. outer=$receiver;
  19828. supercall=$recv(outer)._supercall();
  19829. }
  19830. $8=supercall;
  19831. if($core.assert($8)){
  19832. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  19833. } else {
  19834. return method;
  19835. }
  19836. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.TMethodContext)});
  19837. },
  19838. args: [],
  19839. 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 ]",
  19840. referencedClasses: [],
  19841. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  19842. }),
  19843. $globals.TMethodContext);
  19844. $core.addMethod(
  19845. $core.method({
  19846. selector: "methodContext",
  19847. protocol: "accessing",
  19848. fn: function (){
  19849. var self=this,$self=this;
  19850. return $core.withContext(function($ctx1) {
  19851. var $1,$2,$receiver;
  19852. $1=$self._isBlockContext();
  19853. if(!$core.assert($1)){
  19854. return self;
  19855. }
  19856. $2=$self._outerContext();
  19857. if(($receiver = $2) == null || $receiver.a$nil){
  19858. return $2;
  19859. } else {
  19860. var outer;
  19861. outer=$receiver;
  19862. return $recv(outer)._methodContext();
  19863. }
  19864. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.TMethodContext)});
  19865. },
  19866. args: [],
  19867. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  19868. referencedClasses: [],
  19869. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  19870. }),
  19871. $globals.TMethodContext);
  19872. $core.addMethod(
  19873. $core.method({
  19874. selector: "outerContext",
  19875. protocol: "accessing",
  19876. fn: function (){
  19877. var self=this,$self=this;
  19878. return $core.withContext(function($ctx1) {
  19879. $self._subclassResponsibility();
  19880. return self;
  19881. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.TMethodContext)});
  19882. },
  19883. args: [],
  19884. source: "outerContext\x0a\x09self subclassResponsibility",
  19885. referencedClasses: [],
  19886. messageSends: ["subclassResponsibility"]
  19887. }),
  19888. $globals.TMethodContext);
  19889. $core.addMethod(
  19890. $core.method({
  19891. selector: "printOn:",
  19892. protocol: "printing",
  19893. fn: function (aStream){
  19894. var self=this,$self=this;
  19895. return $core.withContext(function($ctx1) {
  19896. (
  19897. $ctx1.supercall = true,
  19898. ($globals.TMethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19899. $ctx1.supercall = false;
  19900. $recv(aStream)._nextPutAll_("(");
  19901. $ctx1.sendIdx["nextPutAll:"]=1;
  19902. $recv(aStream)._nextPutAll_($self._asString());
  19903. $ctx1.sendIdx["nextPutAll:"]=2;
  19904. $recv(aStream)._nextPutAll_(")");
  19905. return self;
  19906. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.TMethodContext)});
  19907. },
  19908. args: ["aStream"],
  19909. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  19910. referencedClasses: [],
  19911. messageSends: ["printOn:", "nextPutAll:", "asString"]
  19912. }),
  19913. $globals.TMethodContext);
  19914. $core.addMethod(
  19915. $core.method({
  19916. selector: "receiver",
  19917. protocol: "accessing",
  19918. fn: function (){
  19919. var self=this,$self=this;
  19920. return $core.withContext(function($ctx1) {
  19921. var $2,$1;
  19922. $1=$recv($self._isBlockContext())._and_((function(){
  19923. return $core.withContext(function($ctx2) {
  19924. $2=$self._outerContext();
  19925. $ctx2.sendIdx["outerContext"]=1;
  19926. return $recv($2)._notNil();
  19927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19928. }));
  19929. if($core.assert($1)){
  19930. return $recv($self._outerContext())._receiver();
  19931. } else {
  19932. return $self._basicReceiver();
  19933. }
  19934. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.TMethodContext)});
  19935. },
  19936. args: [],
  19937. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  19938. referencedClasses: [],
  19939. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  19940. }),
  19941. $globals.TMethodContext);
  19942. $core.addMethod(
  19943. $core.method({
  19944. selector: "selector",
  19945. protocol: "accessing",
  19946. fn: function (){
  19947. var self=this,$self=this;
  19948. return $core.withContext(function($ctx1) {
  19949. $self._subclassResponsibility();
  19950. return self;
  19951. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.TMethodContext)});
  19952. },
  19953. args: [],
  19954. source: "selector\x0a\x09self subclassResponsibility",
  19955. referencedClasses: [],
  19956. messageSends: ["subclassResponsibility"]
  19957. }),
  19958. $globals.TMethodContext);
  19959. $core.addMethod(
  19960. $core.method({
  19961. selector: "sendIndexes",
  19962. protocol: "accessing",
  19963. fn: function (){
  19964. var self=this,$self=this;
  19965. return $core.withContext(function($ctx1) {
  19966. $self._subclassResponsibility();
  19967. return self;
  19968. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.TMethodContext)});
  19969. },
  19970. args: [],
  19971. source: "sendIndexes\x0a\x09self subclassResponsibility",
  19972. referencedClasses: [],
  19973. messageSends: ["subclassResponsibility"]
  19974. }),
  19975. $globals.TMethodContext);
  19976. $core.addMethod(
  19977. $core.method({
  19978. selector: "supercall",
  19979. protocol: "accessing",
  19980. fn: function (){
  19981. var self=this,$self=this;
  19982. return $core.withContext(function($ctx1) {
  19983. $self._subclassResponsibility();
  19984. return self;
  19985. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.TMethodContext)});
  19986. },
  19987. args: [],
  19988. source: "supercall\x0a\x09self subclassResponsibility",
  19989. referencedClasses: [],
  19990. messageSends: ["subclassResponsibility"]
  19991. }),
  19992. $globals.TMethodContext);
  19993. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  19994. $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.";
  19995. $core.addMethod(
  19996. $core.method({
  19997. selector: "clearInterval",
  19998. protocol: "timeout/interval",
  19999. fn: function (){
  20000. var self=this,$self=this;
  20001. return $core.withContext(function($ctx1) {
  20002. var interval = $self.rawTimeout;
  20003. clearInterval(interval);
  20004. ;
  20005. return self;
  20006. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  20007. },
  20008. args: [],
  20009. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self.rawTimeout;\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  20010. referencedClasses: [],
  20011. messageSends: []
  20012. }),
  20013. $globals.Timeout);
  20014. $core.addMethod(
  20015. $core.method({
  20016. selector: "clearTimeout",
  20017. protocol: "timeout/interval",
  20018. fn: function (){
  20019. var self=this,$self=this;
  20020. return $core.withContext(function($ctx1) {
  20021. var timeout = $self.rawTimeout;
  20022. clearTimeout(timeout);
  20023. ;
  20024. return self;
  20025. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  20026. },
  20027. args: [],
  20028. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self.rawTimeout;\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  20029. referencedClasses: [],
  20030. messageSends: []
  20031. }),
  20032. $globals.Timeout);
  20033. $core.addMethod(
  20034. $core.method({
  20035. selector: "rawTimeout:",
  20036. protocol: "accessing",
  20037. fn: function (anObject){
  20038. var self=this,$self=this;
  20039. $self.rawTimeout=anObject;
  20040. return self;
  20041. },
  20042. args: ["anObject"],
  20043. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  20044. referencedClasses: [],
  20045. messageSends: []
  20046. }),
  20047. $globals.Timeout);
  20048. $core.addMethod(
  20049. $core.method({
  20050. selector: "on:",
  20051. protocol: "instance creation",
  20052. fn: function (anObject){
  20053. var self=this,$self=this;
  20054. return $core.withContext(function($ctx1) {
  20055. var $1;
  20056. $1=$self._new();
  20057. $recv($1)._rawTimeout_(anObject);
  20058. return $recv($1)._yourself();
  20059. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.a$cls)});
  20060. },
  20061. args: ["anObject"],
  20062. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  20063. referencedClasses: [],
  20064. messageSends: ["rawTimeout:", "new", "yourself"]
  20065. }),
  20066. $globals.Timeout.a$cls);
  20067. $core.setTraitComposition([{trait: $globals.TMethodContext}], $globals.MethodContext);
  20068. });
  20069. define('amber/core/Kernel-Dag',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  20070. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20071. var $pkg = $core.addPackage("Kernel-Dag");
  20072. $pkg.innerEval = function (expr) { return eval(expr); };
  20073. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  20074. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  20075. $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:`.";
  20076. $core.addMethod(
  20077. $core.method({
  20078. selector: "value:",
  20079. protocol: "evaluating",
  20080. fn: function (anObject){
  20081. var self=this,$self=this;
  20082. return $core.withContext(function($ctx1) {
  20083. return $self._visit_(anObject);
  20084. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  20085. },
  20086. args: ["anObject"],
  20087. source: "value: anObject\x0a\x09^ self visit: anObject",
  20088. referencedClasses: [],
  20089. messageSends: ["visit:"]
  20090. }),
  20091. $globals.AbstractDagVisitor);
  20092. $core.addMethod(
  20093. $core.method({
  20094. selector: "visit:",
  20095. protocol: "visiting",
  20096. fn: function (aNode){
  20097. var self=this,$self=this;
  20098. return $core.withContext(function($ctx1) {
  20099. return $recv(aNode)._acceptDagVisitor_(self);
  20100. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20101. },
  20102. args: ["aNode"],
  20103. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  20104. referencedClasses: [],
  20105. messageSends: ["acceptDagVisitor:"]
  20106. }),
  20107. $globals.AbstractDagVisitor);
  20108. $core.addMethod(
  20109. $core.method({
  20110. selector: "visitAll:",
  20111. protocol: "visiting",
  20112. fn: function (aCollection){
  20113. var self=this,$self=this;
  20114. return $core.withContext(function($ctx1) {
  20115. return $recv(aCollection)._collect_((function(each){
  20116. return $core.withContext(function($ctx2) {
  20117. return $self._visit_(each);
  20118. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20119. }));
  20120. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  20121. },
  20122. args: ["aCollection"],
  20123. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  20124. referencedClasses: [],
  20125. messageSends: ["collect:", "visit:"]
  20126. }),
  20127. $globals.AbstractDagVisitor);
  20128. $core.addMethod(
  20129. $core.method({
  20130. selector: "visitAllChildren:",
  20131. protocol: "visiting",
  20132. fn: function (aDagNode){
  20133. var self=this,$self=this;
  20134. return $core.withContext(function($ctx1) {
  20135. return $self._visitAll_($recv(aDagNode)._dagChildren());
  20136. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  20137. },
  20138. args: ["aDagNode"],
  20139. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  20140. referencedClasses: [],
  20141. messageSends: ["visitAll:", "dagChildren"]
  20142. }),
  20143. $globals.AbstractDagVisitor);
  20144. $core.addMethod(
  20145. $core.method({
  20146. selector: "visitDagNode:",
  20147. protocol: "visiting",
  20148. fn: function (aNode){
  20149. var self=this,$self=this;
  20150. return $core.withContext(function($ctx1) {
  20151. $self._subclassResponsibility();
  20152. return self;
  20153. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20154. },
  20155. args: ["aNode"],
  20156. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  20157. referencedClasses: [],
  20158. messageSends: ["subclassResponsibility"]
  20159. }),
  20160. $globals.AbstractDagVisitor);
  20161. $core.addMethod(
  20162. $core.method({
  20163. selector: "visitDagNodeVariantRedux:",
  20164. protocol: "visiting",
  20165. fn: function (aNode){
  20166. var self=this,$self=this;
  20167. var newChildren,oldChildren;
  20168. return $core.withContext(function($ctx1) {
  20169. var $2,$3,$1,$4,$5;
  20170. var $early={};
  20171. try {
  20172. oldChildren=$recv(aNode)._dagChildren();
  20173. newChildren=$self._visitAllChildren_(aNode);
  20174. $2=$recv(oldChildren)._size();
  20175. $ctx1.sendIdx["size"]=1;
  20176. $3=$recv(newChildren)._size();
  20177. $ctx1.sendIdx["size"]=2;
  20178. $1=$recv($2).__eq($3);
  20179. if($core.assert($1)){
  20180. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  20181. return $core.withContext(function($ctx2) {
  20182. $4=$recv(oldChildren)._at_(i);
  20183. $ctx2.sendIdx["at:"]=1;
  20184. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  20185. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  20186. }),(function(){
  20187. throw $early=[aNode];
  20188. }));
  20189. }
  20190. $5=$recv(aNode)._copy();
  20191. $recv($5)._dagChildren_(newChildren);
  20192. return $recv($5)._yourself();
  20193. }
  20194. catch(e) {if(e===$early)return e[0]; throw e}
  20195. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  20196. },
  20197. args: ["aNode"],
  20198. 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",
  20199. referencedClasses: [],
  20200. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  20201. }),
  20202. $globals.AbstractDagVisitor);
  20203. $core.addMethod(
  20204. $core.method({
  20205. selector: "visitDagNodeVariantSimple:",
  20206. protocol: "visiting",
  20207. fn: function (aNode){
  20208. var self=this,$self=this;
  20209. return $core.withContext(function($ctx1) {
  20210. $self._visitAllChildren_(aNode);
  20211. return aNode;
  20212. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20213. },
  20214. args: ["aNode"],
  20215. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  20216. referencedClasses: [],
  20217. messageSends: ["visitAllChildren:"]
  20218. }),
  20219. $globals.AbstractDagVisitor);
  20220. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  20221. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  20222. $core.addMethod(
  20223. $core.method({
  20224. selector: "initialize",
  20225. protocol: "initialization",
  20226. fn: function (){
  20227. var self=this,$self=this;
  20228. return $core.withContext(function($ctx1) {
  20229. (
  20230. $ctx1.supercall = true,
  20231. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  20232. $ctx1.supercall = false;
  20233. $self.path=[];
  20234. return self;
  20235. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  20236. },
  20237. args: [],
  20238. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  20239. referencedClasses: [],
  20240. messageSends: ["initialize"]
  20241. }),
  20242. $globals.PathDagVisitor);
  20243. $core.addMethod(
  20244. $core.method({
  20245. selector: "path",
  20246. protocol: "accessing",
  20247. fn: function (){
  20248. var self=this,$self=this;
  20249. return $self.path;
  20250. },
  20251. args: [],
  20252. source: "path\x0a\x09^ path",
  20253. referencedClasses: [],
  20254. messageSends: []
  20255. }),
  20256. $globals.PathDagVisitor);
  20257. $core.addMethod(
  20258. $core.method({
  20259. selector: "visit:",
  20260. protocol: "visiting",
  20261. fn: function (aNode){
  20262. var self=this,$self=this;
  20263. var oldPath,result;
  20264. return $core.withContext(function($ctx1) {
  20265. result=aNode;
  20266. oldPath=$self.path;
  20267. $recv((function(){
  20268. return $core.withContext(function($ctx2) {
  20269. $self.path=$recv($self.path).__comma([aNode]);
  20270. result=(
  20271. $ctx2.supercall = true,
  20272. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  20273. $ctx2.supercall = false;
  20274. return result;
  20275. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20276. }))._ensure_((function(){
  20277. $self.path=oldPath;
  20278. return $self.path;
  20279. }));
  20280. return result;
  20281. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  20282. },
  20283. args: ["aNode"],
  20284. 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",
  20285. referencedClasses: [],
  20286. messageSends: ["ensure:", ",", "visit:"]
  20287. }),
  20288. $globals.PathDagVisitor);
  20289. $core.addMethod(
  20290. $core.method({
  20291. selector: "visitDagNodeVariantRedux:",
  20292. protocol: "visiting",
  20293. fn: function (aNode){
  20294. var self=this,$self=this;
  20295. var newNode;
  20296. return $core.withContext(function($ctx1) {
  20297. var $1;
  20298. newNode=(
  20299. $ctx1.supercall = true,
  20300. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($self, [aNode]));
  20301. $ctx1.supercall = false;
  20302. $1=$recv(aNode).__eq_eq(newNode);
  20303. if(!$core.assert($1)){
  20304. $recv($self.path)._at_put_($recv($self.path)._size(),newNode);
  20305. }
  20306. return newNode;
  20307. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  20308. },
  20309. args: ["aNode"],
  20310. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  20311. referencedClasses: [],
  20312. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  20313. }),
  20314. $globals.PathDagVisitor);
  20315. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  20316. $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).";
  20317. $core.addMethod(
  20318. $core.method({
  20319. selector: "acceptDagVisitor:",
  20320. protocol: "visiting",
  20321. fn: function (aVisitor){
  20322. var self=this,$self=this;
  20323. return $core.withContext(function($ctx1) {
  20324. return $recv(aVisitor)._visitDagNode_(self);
  20325. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  20326. },
  20327. args: ["aVisitor"],
  20328. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  20329. referencedClasses: [],
  20330. messageSends: ["visitDagNode:"]
  20331. }),
  20332. $globals.DagNode);
  20333. $core.addMethod(
  20334. $core.method({
  20335. selector: "allDagChildren",
  20336. protocol: "accessing",
  20337. fn: function (){
  20338. var self=this,$self=this;
  20339. var allNodes;
  20340. return $core.withContext(function($ctx1) {
  20341. var $1;
  20342. $1=$self._dagChildren();
  20343. $ctx1.sendIdx["dagChildren"]=1;
  20344. allNodes=$recv($1)._asSet();
  20345. $recv($self._dagChildren())._do_((function(each){
  20346. return $core.withContext(function($ctx2) {
  20347. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  20348. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20349. }));
  20350. return allNodes;
  20351. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  20352. },
  20353. args: [],
  20354. 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",
  20355. referencedClasses: [],
  20356. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  20357. }),
  20358. $globals.DagNode);
  20359. $core.addMethod(
  20360. $core.method({
  20361. selector: "dagChildren",
  20362. protocol: "accessing",
  20363. fn: function (){
  20364. var self=this,$self=this;
  20365. return $core.withContext(function($ctx1) {
  20366. $self._subclassResponsibility();
  20367. return self;
  20368. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  20369. },
  20370. args: [],
  20371. source: "dagChildren\x0a\x09self subclassResponsibility",
  20372. referencedClasses: [],
  20373. messageSends: ["subclassResponsibility"]
  20374. }),
  20375. $globals.DagNode);
  20376. $core.addMethod(
  20377. $core.method({
  20378. selector: "dagChildren:",
  20379. protocol: "accessing",
  20380. fn: function (aCollection){
  20381. var self=this,$self=this;
  20382. return $core.withContext(function($ctx1) {
  20383. $self._subclassResponsibility();
  20384. return self;
  20385. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  20386. },
  20387. args: ["aCollection"],
  20388. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  20389. referencedClasses: [],
  20390. messageSends: ["subclassResponsibility"]
  20391. }),
  20392. $globals.DagNode);
  20393. $core.addMethod(
  20394. $core.method({
  20395. selector: "isDagNode",
  20396. protocol: "testing",
  20397. fn: function (){
  20398. var self=this,$self=this;
  20399. return true;
  20400. },
  20401. args: [],
  20402. source: "isDagNode\x0a\x09^ true",
  20403. referencedClasses: [],
  20404. messageSends: []
  20405. }),
  20406. $globals.DagNode);
  20407. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20408. $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.";
  20409. $core.addMethod(
  20410. $core.method({
  20411. selector: "addDagChild:",
  20412. protocol: "accessing",
  20413. fn: function (aDagNode){
  20414. var self=this,$self=this;
  20415. return $core.withContext(function($ctx1) {
  20416. $recv($self._dagChildren())._add_(aDagNode);
  20417. return self;
  20418. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  20419. },
  20420. args: ["aDagNode"],
  20421. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  20422. referencedClasses: [],
  20423. messageSends: ["add:", "dagChildren"]
  20424. }),
  20425. $globals.DagParentNode);
  20426. $core.addMethod(
  20427. $core.method({
  20428. selector: "dagChildren",
  20429. protocol: "accessing",
  20430. fn: function (){
  20431. var self=this,$self=this;
  20432. return $core.withContext(function($ctx1) {
  20433. var $1,$receiver;
  20434. $1=$self.nodes;
  20435. if(($receiver = $1) == null || $receiver.a$nil){
  20436. $self.nodes=$recv($globals.Array)._new();
  20437. return $self.nodes;
  20438. } else {
  20439. return $1;
  20440. }
  20441. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  20442. },
  20443. args: [],
  20444. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  20445. referencedClasses: ["Array"],
  20446. messageSends: ["ifNil:", "new"]
  20447. }),
  20448. $globals.DagParentNode);
  20449. $core.addMethod(
  20450. $core.method({
  20451. selector: "dagChildren:",
  20452. protocol: "accessing",
  20453. fn: function (aCollection){
  20454. var self=this,$self=this;
  20455. $self.nodes=aCollection;
  20456. return self;
  20457. },
  20458. args: ["aCollection"],
  20459. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  20460. referencedClasses: [],
  20461. messageSends: []
  20462. }),
  20463. $globals.DagParentNode);
  20464. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20465. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  20466. $core.addMethod(
  20467. $core.method({
  20468. selector: "dagChildren",
  20469. protocol: "accessing",
  20470. fn: function (){
  20471. var self=this,$self=this;
  20472. return [];
  20473. },
  20474. args: [],
  20475. source: "dagChildren\x0a\x09^ #()",
  20476. referencedClasses: [],
  20477. messageSends: []
  20478. }),
  20479. $globals.DagSink);
  20480. $core.addMethod(
  20481. $core.method({
  20482. selector: "dagChildren:",
  20483. protocol: "accessing",
  20484. fn: function (aCollection){
  20485. var self=this,$self=this;
  20486. return $core.withContext(function($ctx1) {
  20487. $recv(aCollection)._ifNotEmpty_((function(){
  20488. return $core.withContext(function($ctx2) {
  20489. return $self._error_("A DagSink cannot have children.");
  20490. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20491. }));
  20492. return self;
  20493. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  20494. },
  20495. args: ["aCollection"],
  20496. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  20497. referencedClasses: [],
  20498. messageSends: ["ifNotEmpty:", "error:"]
  20499. }),
  20500. $globals.DagSink);
  20501. $core.addMethod(
  20502. $core.method({
  20503. selector: "isDagNode",
  20504. protocol: "*Kernel-Dag",
  20505. fn: function (){
  20506. var self=this,$self=this;
  20507. return false;
  20508. },
  20509. args: [],
  20510. source: "isDagNode\x0a\x09^ false",
  20511. referencedClasses: [],
  20512. messageSends: []
  20513. }),
  20514. $globals.Object);
  20515. });
  20516. define('amber/core/Kernel-Exceptions',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  20517. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20518. var $pkg = $core.addPackage("Kernel-Exceptions");
  20519. $pkg.innerEval = function (expr) { return eval(expr); };
  20520. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  20521. $core.addClass("Error", $globals.Object, ["message", "stack", "amberHandled", "context", "smalltalkError"], "Kernel-Exceptions");
  20522. $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.";
  20523. $core.addMethod(
  20524. $core.method({
  20525. selector: "basicSignal",
  20526. protocol: "private",
  20527. fn: function (){
  20528. var self=this,$self=this;
  20529. return $core.withContext(function($ctx1) {
  20530. throw self;;
  20531. return self;
  20532. }, function($ctx1) {$ctx1.fill(self,"basicSignal",{},$globals.Error)});
  20533. },
  20534. args: [],
  20535. source: "basicSignal\x0a\x09<inlineJS: 'throw self;'>",
  20536. referencedClasses: [],
  20537. messageSends: []
  20538. }),
  20539. $globals.Error);
  20540. $core.addMethod(
  20541. $core.method({
  20542. selector: "beHandled",
  20543. protocol: "accessing",
  20544. fn: function (){
  20545. var self=this,$self=this;
  20546. $self.amberHandled=true;
  20547. return self;
  20548. },
  20549. args: [],
  20550. source: "beHandled\x0a\x09amberHandled := true",
  20551. referencedClasses: [],
  20552. messageSends: []
  20553. }),
  20554. $globals.Error);
  20555. $core.addMethod(
  20556. $core.method({
  20557. selector: "beSmalltalkError",
  20558. protocol: "accessing",
  20559. fn: function (){
  20560. var self=this,$self=this;
  20561. $self.smalltalkError=true;
  20562. return self;
  20563. },
  20564. args: [],
  20565. source: "beSmalltalkError\x0a\x09smalltalkError := true",
  20566. referencedClasses: [],
  20567. messageSends: []
  20568. }),
  20569. $globals.Error);
  20570. $core.addMethod(
  20571. $core.method({
  20572. selector: "beUnhandled",
  20573. protocol: "accessing",
  20574. fn: function (){
  20575. var self=this,$self=this;
  20576. $self.amberHandled=false;
  20577. return self;
  20578. },
  20579. args: [],
  20580. source: "beUnhandled\x0a\x09amberHandled := false",
  20581. referencedClasses: [],
  20582. messageSends: []
  20583. }),
  20584. $globals.Error);
  20585. $core.addMethod(
  20586. $core.method({
  20587. selector: "context",
  20588. protocol: "accessing",
  20589. fn: function (){
  20590. var self=this,$self=this;
  20591. return $self.context;
  20592. },
  20593. args: [],
  20594. source: "context\x0a\x09^ context",
  20595. referencedClasses: [],
  20596. messageSends: []
  20597. }),
  20598. $globals.Error);
  20599. $core.addMethod(
  20600. $core.method({
  20601. selector: "context:",
  20602. protocol: "accessing",
  20603. fn: function (aMethodContext){
  20604. var self=this,$self=this;
  20605. $self.context=aMethodContext;
  20606. return self;
  20607. },
  20608. args: ["aMethodContext"],
  20609. source: "context: aMethodContext\x0a\x09context := aMethodContext",
  20610. referencedClasses: [],
  20611. messageSends: []
  20612. }),
  20613. $globals.Error);
  20614. $core.addMethod(
  20615. $core.method({
  20616. selector: "initialize",
  20617. protocol: "initialization",
  20618. fn: function (){
  20619. var self=this,$self=this;
  20620. return $core.withContext(function($ctx1) {
  20621. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  20622. return self;
  20623. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20624. },
  20625. args: [],
  20626. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20627. referencedClasses: [],
  20628. messageSends: ["messageText:", ",", "name", "class"]
  20629. }),
  20630. $globals.Error);
  20631. $core.addMethod(
  20632. $core.method({
  20633. selector: "isSmalltalkError",
  20634. protocol: "testing",
  20635. fn: function (){
  20636. var self=this,$self=this;
  20637. return $core.withContext(function($ctx1) {
  20638. return $recv($self.smalltalkError).__eq_eq(true);
  20639. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20640. },
  20641. args: [],
  20642. source: "isSmalltalkError\x0a\x09^ smalltalkError == true",
  20643. referencedClasses: [],
  20644. messageSends: ["=="]
  20645. }),
  20646. $globals.Error);
  20647. $core.addMethod(
  20648. $core.method({
  20649. selector: "jsStack",
  20650. protocol: "accessing",
  20651. fn: function (){
  20652. var self=this,$self=this;
  20653. return $self.stack;
  20654. },
  20655. args: [],
  20656. source: "jsStack\x0a\x09^ stack",
  20657. referencedClasses: [],
  20658. messageSends: []
  20659. }),
  20660. $globals.Error);
  20661. $core.addMethod(
  20662. $core.method({
  20663. selector: "messageText",
  20664. protocol: "accessing",
  20665. fn: function (){
  20666. var self=this,$self=this;
  20667. return $self.message;
  20668. },
  20669. args: [],
  20670. source: "messageText\x0a\x09^ message",
  20671. referencedClasses: [],
  20672. messageSends: []
  20673. }),
  20674. $globals.Error);
  20675. $core.addMethod(
  20676. $core.method({
  20677. selector: "messageText:",
  20678. protocol: "accessing",
  20679. fn: function (aString){
  20680. var self=this,$self=this;
  20681. $self.message=aString;
  20682. return self;
  20683. },
  20684. args: ["aString"],
  20685. source: "messageText: aString\x0a\x09message := aString",
  20686. referencedClasses: [],
  20687. messageSends: []
  20688. }),
  20689. $globals.Error);
  20690. $core.addMethod(
  20691. $core.method({
  20692. selector: "outer",
  20693. protocol: "signaling",
  20694. fn: function (){
  20695. var self=this,$self=this;
  20696. return $core.withContext(function($ctx1) {
  20697. return $self._pass();
  20698. }, function($ctx1) {$ctx1.fill(self,"outer",{},$globals.Error)});
  20699. },
  20700. args: [],
  20701. source: "outer\x0a\x09\x22Pharo compatibility. Just sends #pass.\x22\x0a\x09\x0a\x09^ self pass",
  20702. referencedClasses: [],
  20703. messageSends: ["pass"]
  20704. }),
  20705. $globals.Error);
  20706. $core.addMethod(
  20707. $core.method({
  20708. selector: "pass",
  20709. protocol: "signaling",
  20710. fn: function (){
  20711. var self=this,$self=this;
  20712. return $core.withContext(function($ctx1) {
  20713. $self._beUnhandled();
  20714. $self._basicSignal();
  20715. return self;
  20716. }, function($ctx1) {$ctx1.fill(self,"pass",{},$globals.Error)});
  20717. },
  20718. args: [],
  20719. source: "pass\x0a\x09\x22Let outer handler take care of this.\x22\x0a\x0a\x09self beUnhandled; basicSignal",
  20720. referencedClasses: [],
  20721. messageSends: ["beUnhandled", "basicSignal"]
  20722. }),
  20723. $globals.Error);
  20724. $core.addMethod(
  20725. $core.method({
  20726. selector: "resignal",
  20727. protocol: "signaling",
  20728. fn: function (){
  20729. var self=this,$self=this;
  20730. return $core.withContext(function($ctx1) {
  20731. $self._deprecatedAPI_("Use #pass.");
  20732. return $self._pass();
  20733. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20734. },
  20735. args: [],
  20736. source: "resignal\x0a\x09self deprecatedAPI: 'Use #pass.'.\x0a\x09^ self pass",
  20737. referencedClasses: [],
  20738. messageSends: ["deprecatedAPI:", "pass"]
  20739. }),
  20740. $globals.Error);
  20741. $core.addMethod(
  20742. $core.method({
  20743. selector: "signal",
  20744. protocol: "signaling",
  20745. fn: function (){
  20746. var self=this,$self=this;
  20747. return $core.withContext(function($ctx1) {
  20748. $self._beUnhandled();
  20749. $self._context_($core.getThisContext());
  20750. $self._beSmalltalkError();
  20751. $self._basicSignal();
  20752. return self;
  20753. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20754. },
  20755. args: [],
  20756. source: "signal\x0a\x09self beUnhandled; context: thisContext; beSmalltalkError; basicSignal",
  20757. referencedClasses: [],
  20758. messageSends: ["beUnhandled", "context:", "beSmalltalkError", "basicSignal"]
  20759. }),
  20760. $globals.Error);
  20761. $core.addMethod(
  20762. $core.method({
  20763. selector: "signal:",
  20764. protocol: "signaling",
  20765. fn: function (aString){
  20766. var self=this,$self=this;
  20767. return $core.withContext(function($ctx1) {
  20768. $self._messageText_(aString);
  20769. $self._signal();
  20770. return self;
  20771. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20772. },
  20773. args: ["aString"],
  20774. source: "signal: aString\x0a\x09self messageText: aString; signal",
  20775. referencedClasses: [],
  20776. messageSends: ["messageText:", "signal"]
  20777. }),
  20778. $globals.Error);
  20779. $core.addMethod(
  20780. $core.method({
  20781. selector: "signalerContext",
  20782. protocol: "accessing",
  20783. fn: function (){
  20784. var self=this,$self=this;
  20785. return $core.withContext(function($ctx1) {
  20786. return $self._signalerContextFrom_($self._context());
  20787. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20788. },
  20789. args: [],
  20790. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20791. referencedClasses: [],
  20792. messageSends: ["signalerContextFrom:", "context"]
  20793. }),
  20794. $globals.Error);
  20795. $core.addMethod(
  20796. $core.method({
  20797. selector: "signalerContextFrom:",
  20798. protocol: "accessing",
  20799. fn: function (aContext){
  20800. var self=this,$self=this;
  20801. return $core.withContext(function($ctx1) {
  20802. var $3,$2,$1;
  20803. return $recv(aContext)._findContextSuchThat_((function(one){
  20804. return $core.withContext(function($ctx2) {
  20805. $3=$recv(one)._receiver();
  20806. $ctx2.sendIdx["receiver"]=1;
  20807. $2=$recv($3).__eq_eq(self);
  20808. $ctx2.sendIdx["=="]=1;
  20809. $1=$recv($2)._or_((function(){
  20810. return $core.withContext(function($ctx3) {
  20811. return $recv($recv(one)._receiver()).__eq_eq($self._class());
  20812. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20813. }));
  20814. return $recv($1)._not();
  20815. }, function($ctx2) {$ctx2.fillBlock({one:one},$ctx1,1)});
  20816. }));
  20817. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20818. },
  20819. args: ["aContext"],
  20820. 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: [ :one |\x0a\x09\x09(one receiver == self \x0a\x09\x09or: [ one receiver == self class ]) not ]",
  20821. referencedClasses: [],
  20822. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20823. }),
  20824. $globals.Error);
  20825. $core.addMethod(
  20826. $core.method({
  20827. selector: "wasHandled",
  20828. protocol: "testing",
  20829. fn: function (){
  20830. var self=this,$self=this;
  20831. return $core.withContext(function($ctx1) {
  20832. return $recv($self.amberHandled).__eq_eq(true);
  20833. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20834. },
  20835. args: [],
  20836. source: "wasHandled\x0a\x09^ amberHandled == true",
  20837. referencedClasses: [],
  20838. messageSends: ["=="]
  20839. }),
  20840. $globals.Error);
  20841. $core.addMethod(
  20842. $core.method({
  20843. selector: "classTag",
  20844. protocol: "accessing",
  20845. fn: function (){
  20846. var self=this,$self=this;
  20847. return "exception";
  20848. },
  20849. args: [],
  20850. 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'",
  20851. referencedClasses: [],
  20852. messageSends: []
  20853. }),
  20854. $globals.Error.a$cls);
  20855. $core.addMethod(
  20856. $core.method({
  20857. selector: "signal",
  20858. protocol: "instance creation",
  20859. fn: function (){
  20860. var self=this,$self=this;
  20861. return $core.withContext(function($ctx1) {
  20862. return $recv($self._new())._signal();
  20863. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.a$cls)});
  20864. },
  20865. args: [],
  20866. source: "signal\x0a\x09^ self new signal",
  20867. referencedClasses: [],
  20868. messageSends: ["signal", "new"]
  20869. }),
  20870. $globals.Error.a$cls);
  20871. $core.addMethod(
  20872. $core.method({
  20873. selector: "signal:",
  20874. protocol: "instance creation",
  20875. fn: function (aString){
  20876. var self=this,$self=this;
  20877. return $core.withContext(function($ctx1) {
  20878. return $recv($self._new())._signal_(aString);
  20879. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.a$cls)});
  20880. },
  20881. args: ["aString"],
  20882. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20883. referencedClasses: [],
  20884. messageSends: ["signal:", "new"]
  20885. }),
  20886. $globals.Error.a$cls);
  20887. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  20888. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20889. $core.addMethod(
  20890. $core.method({
  20891. selector: "messageText",
  20892. protocol: "accessing",
  20893. fn: function (){
  20894. var self=this,$self=this;
  20895. return "Halt encountered";
  20896. },
  20897. args: [],
  20898. source: "messageText\x0a\x09^ 'Halt encountered'",
  20899. referencedClasses: [],
  20900. messageSends: []
  20901. }),
  20902. $globals.Halt);
  20903. $core.addMethod(
  20904. $core.method({
  20905. selector: "signalerContextFrom:",
  20906. protocol: "accessing",
  20907. fn: function (aContext){
  20908. var self=this,$self=this;
  20909. return $core.withContext(function($ctx1) {
  20910. var $3,$2,$1;
  20911. return $recv(aContext)._findContextSuchThat_((function(one){
  20912. return $core.withContext(function($ctx2) {
  20913. $3=$recv(one)._receiver();
  20914. $ctx2.sendIdx["receiver"]=1;
  20915. $2=$recv($3).__eq_eq(self);
  20916. $ctx2.sendIdx["=="]=1;
  20917. $1=$recv($2)._or_((function(){
  20918. return $core.withContext(function($ctx3) {
  20919. return $recv($recv($recv(one)._receiver()).__eq_eq($self._class()))._or_((function(){
  20920. return $core.withContext(function($ctx4) {
  20921. return $recv($recv($recv(one)._method())._selector()).__eq("halt");
  20922. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20923. }));
  20924. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20925. }));
  20926. $ctx2.sendIdx["or:"]=1;
  20927. return $recv($1)._not();
  20928. }, function($ctx2) {$ctx2.fillBlock({one:one},$ctx1,1)});
  20929. }));
  20930. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20931. },
  20932. args: ["aContext"],
  20933. 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: [ :one |\x0a\x09\x09(one receiver == self \x0a\x09\x09or: [ (one receiver == self class) \x0a\x09\x09or: [ one method selector = #halt ]]) not ]",
  20934. referencedClasses: [],
  20935. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20936. }),
  20937. $globals.Halt);
  20938. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  20939. $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:`";
  20940. $core.addMethod(
  20941. $core.method({
  20942. selector: "exception",
  20943. protocol: "accessing",
  20944. fn: function (){
  20945. var self=this,$self=this;
  20946. return $self.exception;
  20947. },
  20948. args: [],
  20949. source: "exception\x0a\x09^ exception",
  20950. referencedClasses: [],
  20951. messageSends: []
  20952. }),
  20953. $globals.JavaScriptException);
  20954. $core.addMethod(
  20955. $core.method({
  20956. selector: "exception:",
  20957. protocol: "accessing",
  20958. fn: function (anException){
  20959. var self=this,$self=this;
  20960. $self.exception=anException;
  20961. return self;
  20962. },
  20963. args: ["anException"],
  20964. source: "exception: anException\x0a\x09exception := anException",
  20965. referencedClasses: [],
  20966. messageSends: []
  20967. }),
  20968. $globals.JavaScriptException);
  20969. $core.addMethod(
  20970. $core.method({
  20971. selector: "messageText",
  20972. protocol: "accessing",
  20973. fn: function (){
  20974. var self=this,$self=this;
  20975. return $core.withContext(function($ctx1) {
  20976. return "JavaScript exception: " + $self.exception.toString();
  20977. return self;
  20978. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20979. },
  20980. args: [],
  20981. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self.exception.toString()'>",
  20982. referencedClasses: [],
  20983. messageSends: []
  20984. }),
  20985. $globals.JavaScriptException);
  20986. $core.addMethod(
  20987. $core.method({
  20988. selector: "shouldBeStubbed",
  20989. protocol: "testing",
  20990. fn: function (){
  20991. var self=this,$self=this;
  20992. return $core.withContext(function($ctx1) {
  20993. return $self.exception instanceof RangeError;
  20994. return self;
  20995. }, function($ctx1) {$ctx1.fill(self,"shouldBeStubbed",{},$globals.JavaScriptException)});
  20996. },
  20997. args: [],
  20998. source: "shouldBeStubbed\x0a\x09<inlineJS: 'return $self.exception instanceof RangeError'>",
  20999. referencedClasses: [],
  21000. messageSends: []
  21001. }),
  21002. $globals.JavaScriptException);
  21003. $core.addMethod(
  21004. $core.method({
  21005. selector: "wrap",
  21006. protocol: "error handling",
  21007. fn: function (){
  21008. var self=this,$self=this;
  21009. return $core.withContext(function($ctx1) {
  21010. var $1;
  21011. $recv((function(){
  21012. return $core.withContext(function($ctx2) {
  21013. return $self._signal();
  21014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21015. }))._tryCatch_((function(){
  21016. return $core.withContext(function($ctx2) {
  21017. $1=$self._shouldBeStubbed();
  21018. if($core.assert($1)){
  21019. return $recv($self._context())._stubToAtMost_((100));
  21020. }
  21021. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  21022. }));
  21023. return self;
  21024. }, function($ctx1) {$ctx1.fill(self,"wrap",{},$globals.JavaScriptException)});
  21025. },
  21026. args: [],
  21027. source: "wrap\x0a\x09[ self signal ] tryCatch:\x0a\x09\x09[ self shouldBeStubbed ifTrue: [ self context stubToAtMost: 100 ] ]",
  21028. referencedClasses: [],
  21029. messageSends: ["tryCatch:", "signal", "ifTrue:", "shouldBeStubbed", "stubToAtMost:", "context"]
  21030. }),
  21031. $globals.JavaScriptException);
  21032. $core.addMethod(
  21033. $core.method({
  21034. selector: "on:",
  21035. protocol: "instance creation",
  21036. fn: function (anException){
  21037. var self=this,$self=this;
  21038. return $core.withContext(function($ctx1) {
  21039. var $1;
  21040. $1=$self._new();
  21041. $recv($1)._exception_(anException);
  21042. return $recv($1)._yourself();
  21043. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.a$cls)});
  21044. },
  21045. args: ["anException"],
  21046. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  21047. referencedClasses: [],
  21048. messageSends: ["exception:", "new", "yourself"]
  21049. }),
  21050. $globals.JavaScriptException.a$cls);
  21051. $core.addMethod(
  21052. $core.method({
  21053. selector: "on:context:",
  21054. protocol: "instance creation",
  21055. fn: function (anException,aMethodContext){
  21056. var self=this,$self=this;
  21057. return $core.withContext(function($ctx1) {
  21058. var $1;
  21059. $1=$self._new();
  21060. $recv($1)._exception_(anException);
  21061. $recv($1)._context_(aMethodContext);
  21062. return $recv($1)._yourself();
  21063. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.a$cls)});
  21064. },
  21065. args: ["anException", "aMethodContext"],
  21066. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  21067. referencedClasses: [],
  21068. messageSends: ["exception:", "new", "context:", "yourself"]
  21069. }),
  21070. $globals.JavaScriptException.a$cls);
  21071. $core.addClass("MessageNotUnderstood", $globals.Error, ["smalltalkMessage", "receiver"], "Kernel-Exceptions");
  21072. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  21073. $core.addMethod(
  21074. $core.method({
  21075. selector: "message",
  21076. protocol: "accessing",
  21077. fn: function (){
  21078. var self=this,$self=this;
  21079. return $self.smalltalkMessage;
  21080. },
  21081. args: [],
  21082. source: "message\x0a\x09^ smalltalkMessage",
  21083. referencedClasses: [],
  21084. messageSends: []
  21085. }),
  21086. $globals.MessageNotUnderstood);
  21087. $core.addMethod(
  21088. $core.method({
  21089. selector: "message:",
  21090. protocol: "accessing",
  21091. fn: function (aMessage){
  21092. var self=this,$self=this;
  21093. $self.smalltalkMessage=aMessage;
  21094. return self;
  21095. },
  21096. args: ["aMessage"],
  21097. source: "message: aMessage\x0a\x09smalltalkMessage := aMessage",
  21098. referencedClasses: [],
  21099. messageSends: []
  21100. }),
  21101. $globals.MessageNotUnderstood);
  21102. $core.addMethod(
  21103. $core.method({
  21104. selector: "messageText",
  21105. protocol: "accessing",
  21106. fn: function (){
  21107. var self=this,$self=this;
  21108. return $core.withContext(function($ctx1) {
  21109. var $1;
  21110. $1=$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector());
  21111. $ctx1.sendIdx[","]=1;
  21112. return $1;
  21113. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  21114. },
  21115. args: [],
  21116. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  21117. referencedClasses: [],
  21118. messageSends: [",", "asString", "receiver", "selector", "message"]
  21119. }),
  21120. $globals.MessageNotUnderstood);
  21121. $core.addMethod(
  21122. $core.method({
  21123. selector: "receiver",
  21124. protocol: "accessing",
  21125. fn: function (){
  21126. var self=this,$self=this;
  21127. return $self.receiver;
  21128. },
  21129. args: [],
  21130. source: "receiver\x0a\x09^ receiver",
  21131. referencedClasses: [],
  21132. messageSends: []
  21133. }),
  21134. $globals.MessageNotUnderstood);
  21135. $core.addMethod(
  21136. $core.method({
  21137. selector: "receiver:",
  21138. protocol: "accessing",
  21139. fn: function (anObject){
  21140. var self=this,$self=this;
  21141. $self.receiver=anObject;
  21142. return self;
  21143. },
  21144. args: ["anObject"],
  21145. source: "receiver: anObject\x0a\x09receiver := anObject",
  21146. referencedClasses: [],
  21147. messageSends: []
  21148. }),
  21149. $globals.MessageNotUnderstood);
  21150. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  21151. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  21152. $core.addMethod(
  21153. $core.method({
  21154. selector: "object",
  21155. protocol: "accessing",
  21156. fn: function (){
  21157. var self=this,$self=this;
  21158. return $self.object;
  21159. },
  21160. args: [],
  21161. source: "object\x0a\x09^ object",
  21162. referencedClasses: [],
  21163. messageSends: []
  21164. }),
  21165. $globals.NonBooleanReceiver);
  21166. $core.addMethod(
  21167. $core.method({
  21168. selector: "object:",
  21169. protocol: "accessing",
  21170. fn: function (anObject){
  21171. var self=this,$self=this;
  21172. $self.object=anObject;
  21173. return self;
  21174. },
  21175. args: ["anObject"],
  21176. source: "object: anObject\x0a\x09object := anObject",
  21177. referencedClasses: [],
  21178. messageSends: []
  21179. }),
  21180. $globals.NonBooleanReceiver);
  21181. $core.addMethod(
  21182. $core.method({
  21183. selector: "signalOn:",
  21184. protocol: "instance creation",
  21185. fn: function (anObject){
  21186. var self=this,$self=this;
  21187. return $core.withContext(function($ctx1) {
  21188. var $1;
  21189. $1=$self._new();
  21190. $recv($1)._object_(anObject);
  21191. return $recv($1)._signal();
  21192. }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject},$globals.NonBooleanReceiver.a$cls)});
  21193. },
  21194. args: ["anObject"],
  21195. source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
  21196. referencedClasses: [],
  21197. messageSends: ["object:", "new", "signal"]
  21198. }),
  21199. $globals.NonBooleanReceiver.a$cls);
  21200. });
  21201. define('amber/core/Kernel-Promises',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  21202. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21203. var $pkg = $core.addPackage("Kernel-Promises");
  21204. $pkg.innerEval = function (expr) { return eval(expr); };
  21205. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  21206. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  21207. $core.addMethod(
  21208. $core.method({
  21209. selector: "all:",
  21210. protocol: "composites",
  21211. fn: function (aCollection){
  21212. var self=this,$self=this;
  21213. return $core.withContext(function($ctx1) {
  21214. return Promise.all($recv(aCollection)._asArray());
  21215. return self;
  21216. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21217. },
  21218. args: ["aCollection"],
  21219. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  21220. referencedClasses: [],
  21221. messageSends: []
  21222. }),
  21223. $globals.Promise.a$cls);
  21224. $core.addMethod(
  21225. $core.method({
  21226. selector: "any:",
  21227. protocol: "composites",
  21228. fn: function (aCollection){
  21229. var self=this,$self=this;
  21230. return $core.withContext(function($ctx1) {
  21231. return Promise.race($recv(aCollection)._asArray());
  21232. return self;
  21233. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21234. },
  21235. args: ["aCollection"],
  21236. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  21237. referencedClasses: [],
  21238. messageSends: []
  21239. }),
  21240. $globals.Promise.a$cls);
  21241. $core.addMethod(
  21242. $core.method({
  21243. selector: "forBlock:",
  21244. protocol: "instance creation",
  21245. fn: function (aBlock){
  21246. var self=this,$self=this;
  21247. return $core.withContext(function($ctx1) {
  21248. return $recv($self._new())._then_(aBlock);
  21249. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21250. },
  21251. args: ["aBlock"],
  21252. 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",
  21253. referencedClasses: [],
  21254. messageSends: ["then:", "new"]
  21255. }),
  21256. $globals.Promise.a$cls);
  21257. $core.addMethod(
  21258. $core.method({
  21259. selector: "new",
  21260. protocol: "instance creation",
  21261. fn: function (){
  21262. var self=this,$self=this;
  21263. return $core.withContext(function($ctx1) {
  21264. return Promise.resolve();
  21265. return self;
  21266. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.a$cls)});
  21267. },
  21268. args: [],
  21269. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  21270. referencedClasses: [],
  21271. messageSends: []
  21272. }),
  21273. $globals.Promise.a$cls);
  21274. $core.addMethod(
  21275. $core.method({
  21276. selector: "new:",
  21277. protocol: "instance creation",
  21278. fn: function (aBlock){
  21279. var self=this,$self=this;
  21280. return $core.withContext(function($ctx1) {
  21281. return new Promise(function (resolve, reject) {
  21282. var model = {value: resolve, signal: reject};
  21283. aBlock._value_(model);
  21284. });
  21285. return self;
  21286. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21287. },
  21288. args: ["aBlock"],
  21289. 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})'>",
  21290. referencedClasses: [],
  21291. messageSends: []
  21292. }),
  21293. $globals.Promise.a$cls);
  21294. $core.addMethod(
  21295. $core.method({
  21296. selector: "signal:",
  21297. protocol: "instance creation",
  21298. fn: function (anObject){
  21299. var self=this,$self=this;
  21300. return $core.withContext(function($ctx1) {
  21301. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  21302. return self;
  21303. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.a$cls)});
  21304. },
  21305. args: ["anObject"],
  21306. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  21307. referencedClasses: [],
  21308. messageSends: []
  21309. }),
  21310. $globals.Promise.a$cls);
  21311. $core.addMethod(
  21312. $core.method({
  21313. selector: "value:",
  21314. protocol: "instance creation",
  21315. fn: function (anObject){
  21316. var self=this,$self=this;
  21317. return $core.withContext(function($ctx1) {
  21318. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  21319. return self;
  21320. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.a$cls)});
  21321. },
  21322. args: ["anObject"],
  21323. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  21324. referencedClasses: [],
  21325. messageSends: []
  21326. }),
  21327. $globals.Promise.a$cls);
  21328. $core.addTrait("TThenable", "Kernel-Promises");
  21329. $core.addMethod(
  21330. $core.method({
  21331. selector: "catch:",
  21332. protocol: "promises",
  21333. fn: function (aBlock){
  21334. var self=this,$self=this;
  21335. return $core.withContext(function($ctx1) {
  21336. return self.then(null, function (err) {return $core.seamless(function () {
  21337. return aBlock._value_(err);
  21338. })});
  21339. return self;
  21340. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.TThenable)});
  21341. },
  21342. args: ["aBlock"],
  21343. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  21344. referencedClasses: [],
  21345. messageSends: []
  21346. }),
  21347. $globals.TThenable);
  21348. $core.addMethod(
  21349. $core.method({
  21350. selector: "on:do:",
  21351. protocol: "promises",
  21352. fn: function (aClass,aBlock){
  21353. var self=this,$self=this;
  21354. return $core.withContext(function($ctx1) {
  21355. return self.then(null, function (err) {return $core.seamless(function () {
  21356. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  21357. else throw err;
  21358. })});
  21359. return self;
  21360. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21361. },
  21362. args: ["aClass", "aBlock"],
  21363. 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})})'>",
  21364. referencedClasses: [],
  21365. messageSends: []
  21366. }),
  21367. $globals.TThenable);
  21368. $core.addMethod(
  21369. $core.method({
  21370. selector: "on:do:catch:",
  21371. protocol: "promises",
  21372. fn: function (aClass,aBlock,anotherBlock){
  21373. var self=this,$self=this;
  21374. return $core.withContext(function($ctx1) {
  21375. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21376. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21377. },
  21378. args: ["aClass", "aBlock", "anotherBlock"],
  21379. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  21380. referencedClasses: [],
  21381. messageSends: ["catch:", "on:do:"]
  21382. }),
  21383. $globals.TThenable);
  21384. $core.addMethod(
  21385. $core.method({
  21386. selector: "then:",
  21387. protocol: "promises",
  21388. fn: function (aBlockOrArray){
  21389. var self=this,$self=this;
  21390. return $core.withContext(function($ctx1) {
  21391. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  21392. return array.reduce(function (soFar, aBlock) {
  21393. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  21394. function (result) {return $core.seamless(function () {
  21395. if (Array.isArray(result)) {
  21396. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  21397. } else {
  21398. return aBlock._value_(result);
  21399. }
  21400. })} :
  21401. function (result) {return $core.seamless(function () {
  21402. return aBlock._value_(result);
  21403. })}
  21404. );
  21405. }, self);
  21406. return self;
  21407. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.TThenable)});
  21408. },
  21409. args: ["aBlockOrArray"],
  21410. 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)'>",
  21411. referencedClasses: [],
  21412. messageSends: []
  21413. }),
  21414. $globals.TThenable);
  21415. $core.addMethod(
  21416. $core.method({
  21417. selector: "then:catch:",
  21418. protocol: "promises",
  21419. fn: function (aBlockOrArray,anotherBlock){
  21420. var self=this,$self=this;
  21421. return $core.withContext(function($ctx1) {
  21422. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  21423. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.TThenable)});
  21424. },
  21425. args: ["aBlockOrArray", "anotherBlock"],
  21426. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  21427. referencedClasses: [],
  21428. messageSends: ["catch:", "then:"]
  21429. }),
  21430. $globals.TThenable);
  21431. $core.addMethod(
  21432. $core.method({
  21433. selector: "then:on:do:",
  21434. protocol: "promises",
  21435. fn: function (aBlockOrArray,aClass,aBlock){
  21436. var self=this,$self=this;
  21437. return $core.withContext(function($ctx1) {
  21438. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  21439. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21440. },
  21441. args: ["aBlockOrArray", "aClass", "aBlock"],
  21442. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  21443. referencedClasses: [],
  21444. messageSends: ["on:do:", "then:"]
  21445. }),
  21446. $globals.TThenable);
  21447. $core.addMethod(
  21448. $core.method({
  21449. selector: "then:on:do:catch:",
  21450. protocol: "promises",
  21451. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21452. var self=this,$self=this;
  21453. return $core.withContext(function($ctx1) {
  21454. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21455. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21456. },
  21457. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21458. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  21459. referencedClasses: [],
  21460. messageSends: ["catch:", "on:do:", "then:"]
  21461. }),
  21462. $globals.TThenable);
  21463. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  21464. });
  21465. define('amber/core/Kernel-Infrastructure',["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Objects", "amber/core/Kernel-Promises"], function($boot,requirejs){"use strict";
  21466. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21467. var $pkg = $core.addPackage("Kernel-Infrastructure");
  21468. $pkg.innerEval = function (expr) { return eval(expr); };
  21469. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  21470. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  21471. $core.addMethod(
  21472. $core.method({
  21473. selector: "organizeClasses",
  21474. protocol: "organization",
  21475. fn: function (){
  21476. var self=this,$self=this;
  21477. return $core.withContext(function($ctx1) {
  21478. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21479. return $core.withContext(function($ctx2) {
  21480. return $recv(each)._enterOrganization();
  21481. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21482. }));
  21483. return self;
  21484. }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21485. },
  21486. args: [],
  21487. source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]",
  21488. referencedClasses: ["Smalltalk"],
  21489. messageSends: ["do:", "classes", "enterOrganization"]
  21490. }),
  21491. $globals.AmberBootstrapInitialization.a$cls);
  21492. $core.addMethod(
  21493. $core.method({
  21494. selector: "organizeMethods",
  21495. protocol: "organization",
  21496. fn: function (){
  21497. var self=this,$self=this;
  21498. return $core.withContext(function($ctx1) {
  21499. $recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){
  21500. return $core.withContext(function($ctx2) {
  21501. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  21502. return $core.withContext(function($ctx3) {
  21503. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  21504. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  21505. }));
  21506. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  21507. }));
  21508. $ctx1.sendIdx["do:"]=1;
  21509. return self;
  21510. }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{},$globals.AmberBootstrapInitialization.a$cls)});
  21511. },
  21512. args: [],
  21513. source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  21514. referencedClasses: ["Smalltalk"],
  21515. messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  21516. }),
  21517. $globals.AmberBootstrapInitialization.a$cls);
  21518. $core.addMethod(
  21519. $core.method({
  21520. selector: "run",
  21521. protocol: "public api",
  21522. fn: function (){
  21523. var self=this,$self=this;
  21524. return $core.withContext(function($ctx1) {
  21525. $recv($globals.SmalltalkImage)._initialize();
  21526. $self._organizeClasses();
  21527. $self._organizeMethods();
  21528. return $recv($globals.Smalltalk)._postLoad();
  21529. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.AmberBootstrapInitialization.a$cls)});
  21530. },
  21531. args: [],
  21532. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods.\x0a\x09^ Smalltalk postLoad",
  21533. referencedClasses: ["SmalltalkImage", "Smalltalk"],
  21534. messageSends: ["initialize", "organizeClasses", "organizeMethods", "postLoad"]
  21535. }),
  21536. $globals.AmberBootstrapInitialization.a$cls);
  21537. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  21538. $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`.";
  21539. $core.addMethod(
  21540. $core.method({
  21541. selector: "=",
  21542. protocol: "comparing",
  21543. fn: function (anObject){
  21544. var self=this,$self=this;
  21545. return $core.withContext(function($ctx1) {
  21546. var $2,$1;
  21547. $2=$recv(anObject)._class();
  21548. $ctx1.sendIdx["class"]=1;
  21549. $1=$recv($2).__eq_eq($self._class());
  21550. if(!$core.assert($1)){
  21551. return false;
  21552. }
  21553. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  21554. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  21555. },
  21556. args: ["anObject"],
  21557. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  21558. referencedClasses: ["JSObjectProxy"],
  21559. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  21560. }),
  21561. $globals.JSObjectProxy);
  21562. $core.addMethod(
  21563. $core.method({
  21564. selector: "asJavaScriptObject",
  21565. protocol: "converting",
  21566. fn: function (){
  21567. var self=this,$self=this;
  21568. return $self.jsObject;
  21569. },
  21570. args: [],
  21571. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  21572. referencedClasses: [],
  21573. messageSends: []
  21574. }),
  21575. $globals.JSObjectProxy);
  21576. $core.addMethod(
  21577. $core.method({
  21578. selector: "at:",
  21579. protocol: "accessing",
  21580. fn: function (aString){
  21581. var self=this,$self=this;
  21582. return $core.withContext(function($ctx1) {
  21583. return $self.jsObject[aString];
  21584. return self;
  21585. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  21586. },
  21587. args: ["aString"],
  21588. source: "at: aString\x0a\x09<inlineJS: 'return $self.jsObject[aString]'>",
  21589. referencedClasses: [],
  21590. messageSends: []
  21591. }),
  21592. $globals.JSObjectProxy);
  21593. $core.addMethod(
  21594. $core.method({
  21595. selector: "at:ifAbsent:",
  21596. protocol: "accessing",
  21597. fn: function (aString,aBlock){
  21598. var self=this,$self=this;
  21599. return $core.withContext(function($ctx1) {
  21600. var obj = $self.jsObject;
  21601. return aString in obj ? obj[aString] : aBlock._value();
  21602. ;
  21603. return self;
  21604. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21605. },
  21606. args: ["aString", "aBlock"],
  21607. 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'>",
  21608. referencedClasses: [],
  21609. messageSends: []
  21610. }),
  21611. $globals.JSObjectProxy);
  21612. $core.addMethod(
  21613. $core.method({
  21614. selector: "at:ifPresent:",
  21615. protocol: "accessing",
  21616. fn: function (aString,aBlock){
  21617. var self=this,$self=this;
  21618. return $core.withContext(function($ctx1) {
  21619. var obj = $self.jsObject;
  21620. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  21621. ;
  21622. return self;
  21623. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21624. },
  21625. args: ["aString", "aBlock"],
  21626. 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'>",
  21627. referencedClasses: [],
  21628. messageSends: []
  21629. }),
  21630. $globals.JSObjectProxy);
  21631. $core.addMethod(
  21632. $core.method({
  21633. selector: "at:ifPresent:ifAbsent:",
  21634. protocol: "accessing",
  21635. fn: function (aString,aBlock,anotherBlock){
  21636. var self=this,$self=this;
  21637. return $core.withContext(function($ctx1) {
  21638. var obj = $self.jsObject;
  21639. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  21640. ;
  21641. return self;
  21642. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21643. },
  21644. args: ["aString", "aBlock", "anotherBlock"],
  21645. 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'>",
  21646. referencedClasses: [],
  21647. messageSends: []
  21648. }),
  21649. $globals.JSObjectProxy);
  21650. $core.addMethod(
  21651. $core.method({
  21652. selector: "at:put:",
  21653. protocol: "accessing",
  21654. fn: function (aString,anObject){
  21655. var self=this,$self=this;
  21656. return $core.withContext(function($ctx1) {
  21657. return $self.jsObject[aString] = anObject;
  21658. return self;
  21659. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  21660. },
  21661. args: ["aString", "anObject"],
  21662. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self.jsObject[aString] = anObject'>",
  21663. referencedClasses: [],
  21664. messageSends: []
  21665. }),
  21666. $globals.JSObjectProxy);
  21667. $core.addMethod(
  21668. $core.method({
  21669. selector: "catch:",
  21670. protocol: "promises",
  21671. fn: function (aBlock){
  21672. var self=this,$self=this;
  21673. return $core.withContext(function($ctx1) {
  21674. var $1,$2;
  21675. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21676. if($core.assert($1)){
  21677. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self.jsObject,[aBlock]);
  21678. } else {
  21679. $2=(
  21680. $ctx1.supercall = true,
  21681. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  21682. $ctx1.supercall = false;
  21683. return $2;
  21684. }
  21685. return self;
  21686. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21687. },
  21688. args: ["aBlock"],
  21689. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  21690. referencedClasses: ["NativeFunction", "TThenable"],
  21691. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  21692. }),
  21693. $globals.JSObjectProxy);
  21694. $core.addMethod(
  21695. $core.method({
  21696. selector: "doesNotUnderstand:",
  21697. protocol: "proxy",
  21698. fn: function (aMessage){
  21699. var self=this,$self=this;
  21700. return $core.withContext(function($ctx1) {
  21701. var $1,$receiver;
  21702. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  21703. if(($receiver = $1) == null || $receiver.a$nil){
  21704. return (
  21705. $ctx1.supercall = true,
  21706. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  21707. $ctx1.supercall = false;
  21708. } else {
  21709. var jsSelector;
  21710. jsSelector=$receiver;
  21711. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  21712. }
  21713. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  21714. },
  21715. args: ["aMessage"],
  21716. 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 ]",
  21717. referencedClasses: ["JSObjectProxy"],
  21718. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  21719. }),
  21720. $globals.JSObjectProxy);
  21721. $core.addMethod(
  21722. $core.method({
  21723. selector: "in:",
  21724. protocol: "accessing",
  21725. fn: function (aValuable){
  21726. var self=this,$self=this;
  21727. return $core.withContext(function($ctx1) {
  21728. return $recv(aValuable)._value_($self.jsObject);
  21729. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  21730. },
  21731. args: ["aValuable"],
  21732. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  21733. referencedClasses: [],
  21734. messageSends: ["value:"]
  21735. }),
  21736. $globals.JSObjectProxy);
  21737. $core.addMethod(
  21738. $core.method({
  21739. selector: "jsObject",
  21740. protocol: "accessing",
  21741. fn: function (){
  21742. var self=this,$self=this;
  21743. return $self.jsObject;
  21744. },
  21745. args: [],
  21746. source: "jsObject\x0a\x09^ jsObject",
  21747. referencedClasses: [],
  21748. messageSends: []
  21749. }),
  21750. $globals.JSObjectProxy);
  21751. $core.addMethod(
  21752. $core.method({
  21753. selector: "keysAndValuesDo:",
  21754. protocol: "enumerating",
  21755. fn: function (aBlock){
  21756. var self=this,$self=this;
  21757. return $core.withContext(function($ctx1) {
  21758. var o = $self.jsObject;
  21759. for(var i in o) {
  21760. aBlock._value_value_(i, o[i]);
  21761. }
  21762. ;
  21763. return self;
  21764. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21765. },
  21766. args: ["aBlock"],
  21767. 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'>",
  21768. referencedClasses: [],
  21769. messageSends: []
  21770. }),
  21771. $globals.JSObjectProxy);
  21772. $core.addMethod(
  21773. $core.method({
  21774. selector: "on:do:",
  21775. protocol: "promises",
  21776. fn: function (aClass,aBlock){
  21777. var self=this,$self=this;
  21778. return $core.withContext(function($ctx1) {
  21779. var $1,$2;
  21780. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21781. if($core.assert($1)){
  21782. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self.jsObject,[aClass,aBlock]);
  21783. } else {
  21784. $2=(
  21785. $ctx1.supercall = true,
  21786. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  21787. $ctx1.supercall = false;
  21788. return $2;
  21789. }
  21790. return self;
  21791. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21792. },
  21793. args: ["aClass", "aBlock"],
  21794. 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 ]",
  21795. referencedClasses: ["NativeFunction", "TThenable"],
  21796. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  21797. }),
  21798. $globals.JSObjectProxy);
  21799. $core.addMethod(
  21800. $core.method({
  21801. selector: "printOn:",
  21802. protocol: "printing",
  21803. fn: function (aStream){
  21804. var self=this,$self=this;
  21805. return $core.withContext(function($ctx1) {
  21806. $recv(aStream)._nextPutAll_($self._printString());
  21807. return self;
  21808. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21809. },
  21810. args: ["aStream"],
  21811. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  21812. referencedClasses: [],
  21813. messageSends: ["nextPutAll:", "printString"]
  21814. }),
  21815. $globals.JSObjectProxy);
  21816. $core.addMethod(
  21817. $core.method({
  21818. selector: "printString",
  21819. protocol: "printing",
  21820. fn: function (){
  21821. var self=this,$self=this;
  21822. return $core.withContext(function($ctx1) {
  21823. var js = $self.jsObject;
  21824. return js.toString
  21825. ? js.toString()
  21826. : Object.prototype.toString.call(js)
  21827. ;
  21828. return self;
  21829. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  21830. },
  21831. args: [],
  21832. 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'>",
  21833. referencedClasses: [],
  21834. messageSends: []
  21835. }),
  21836. $globals.JSObjectProxy);
  21837. $core.addMethod(
  21838. $core.method({
  21839. selector: "putOn:",
  21840. protocol: "streaming",
  21841. fn: function (aStream){
  21842. var self=this,$self=this;
  21843. return $core.withContext(function($ctx1) {
  21844. $recv(aStream)._nextPutJSObject_($self.jsObject);
  21845. return self;
  21846. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21847. },
  21848. args: ["aStream"],
  21849. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  21850. referencedClasses: [],
  21851. messageSends: ["nextPutJSObject:"]
  21852. }),
  21853. $globals.JSObjectProxy);
  21854. $core.addMethod(
  21855. $core.method({
  21856. selector: "removeKey:",
  21857. protocol: "accessing",
  21858. fn: function (aString){
  21859. var self=this,$self=this;
  21860. return $core.withContext(function($ctx1) {
  21861. delete $self.jsObject[aString]; return aString;
  21862. return self;
  21863. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aString:aString},$globals.JSObjectProxy)});
  21864. },
  21865. args: ["aString"],
  21866. source: "removeKey: aString\x0a\x09<inlineJS: 'delete $self.jsObject[aString]; return aString'>",
  21867. referencedClasses: [],
  21868. messageSends: []
  21869. }),
  21870. $globals.JSObjectProxy);
  21871. $core.addMethod(
  21872. $core.method({
  21873. selector: "then:",
  21874. protocol: "promises",
  21875. fn: function (aBlockOrArray){
  21876. var self=this,$self=this;
  21877. return $core.withContext(function($ctx1) {
  21878. var $1,$2;
  21879. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21880. if($core.assert($1)){
  21881. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self.jsObject,[aBlockOrArray]);
  21882. } else {
  21883. $2=(
  21884. $ctx1.supercall = true,
  21885. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  21886. $ctx1.supercall = false;
  21887. return $2;
  21888. }
  21889. return self;
  21890. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  21891. },
  21892. args: ["aBlockOrArray"],
  21893. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  21894. referencedClasses: ["NativeFunction", "TThenable"],
  21895. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  21896. }),
  21897. $globals.JSObjectProxy);
  21898. $core.addMethod(
  21899. $core.method({
  21900. selector: "addObjectVariablesTo:ofProxy:",
  21901. protocol: "proxy",
  21902. fn: function (aDictionary,aProxy){
  21903. var self=this,$self=this;
  21904. return $core.withContext(function($ctx1) {
  21905. var jsObject = aProxy.jsObject;
  21906. for(var i in jsObject) {
  21907. aDictionary._at_put_(i, jsObject[i]);
  21908. }
  21909. ;
  21910. return self;
  21911. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21912. },
  21913. args: ["aDictionary", "aProxy"],
  21914. 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'>",
  21915. referencedClasses: [],
  21916. messageSends: []
  21917. }),
  21918. $globals.JSObjectProxy.a$cls);
  21919. $core.addMethod(
  21920. $core.method({
  21921. selector: "compareJSObjectOfProxy:withProxy:",
  21922. protocol: "proxy",
  21923. fn: function (aProxy,anotherProxy){
  21924. var self=this,$self=this;
  21925. return $core.withContext(function($ctx1) {
  21926. var anotherJSObject = anotherProxy.a$cls ? anotherProxy.jsObject : anotherProxy;
  21927. return aProxy.jsObject === anotherJSObject;
  21928. return self;
  21929. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.a$cls)});
  21930. },
  21931. args: ["aProxy", "anotherProxy"],
  21932. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<inlineJS: '\x0a\x09var anotherJSObject = anotherProxy.a$cls ? anotherProxy.jsObject : anotherProxy;\x0a\x09return aProxy.jsObject === anotherJSObject\x0a'>",
  21933. referencedClasses: [],
  21934. messageSends: []
  21935. }),
  21936. $globals.JSObjectProxy.a$cls);
  21937. $core.addMethod(
  21938. $core.method({
  21939. selector: "forwardMessage:withArguments:ofProxy:",
  21940. protocol: "proxy",
  21941. fn: function (aString,anArray,aProxy){
  21942. var self=this,$self=this;
  21943. return $core.withContext(function($ctx1) {
  21944. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  21945. ;
  21946. return self;
  21947. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21948. },
  21949. args: ["aString", "anArray", "aProxy"],
  21950. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  21951. referencedClasses: [],
  21952. messageSends: []
  21953. }),
  21954. $globals.JSObjectProxy.a$cls);
  21955. $core.addMethod(
  21956. $core.method({
  21957. selector: "jsObject:ofProxy:",
  21958. protocol: "proxy",
  21959. fn: function (aJSObject,aProxy){
  21960. var self=this,$self=this;
  21961. return $core.withContext(function($ctx1) {
  21962. aProxy.jsObject = aJSObject;
  21963. return self;
  21964. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21965. },
  21966. args: ["aJSObject", "aProxy"],
  21967. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy.jsObject = aJSObject'>",
  21968. referencedClasses: [],
  21969. messageSends: []
  21970. }),
  21971. $globals.JSObjectProxy.a$cls);
  21972. $core.addMethod(
  21973. $core.method({
  21974. selector: "lookupProperty:ofProxy:",
  21975. protocol: "proxy",
  21976. fn: function (aString,aProxy){
  21977. var self=this,$self=this;
  21978. return $core.withContext(function($ctx1) {
  21979. return aString in aProxy._jsObject() ? aString : nil;
  21980. return self;
  21981. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21982. },
  21983. args: ["aString", "aProxy"],
  21984. 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'>",
  21985. referencedClasses: [],
  21986. messageSends: []
  21987. }),
  21988. $globals.JSObjectProxy.a$cls);
  21989. $core.addMethod(
  21990. $core.method({
  21991. selector: "null",
  21992. protocol: "accessing",
  21993. fn: function (){
  21994. var self=this,$self=this;
  21995. return $core.withContext(function($ctx1) {
  21996. return null;
  21997. return self;
  21998. }, function($ctx1) {$ctx1.fill(self,"null",{},$globals.JSObjectProxy.a$cls)});
  21999. },
  22000. args: [],
  22001. source: "null\x0a\x09<inlineJS: 'return null'>",
  22002. referencedClasses: [],
  22003. messageSends: []
  22004. }),
  22005. $globals.JSObjectProxy.a$cls);
  22006. $core.addMethod(
  22007. $core.method({
  22008. selector: "on:",
  22009. protocol: "instance creation",
  22010. fn: function (aJSObject){
  22011. var self=this,$self=this;
  22012. var instance;
  22013. return $core.withContext(function($ctx1) {
  22014. instance=$self._new();
  22015. $self._jsObject_ofProxy_(aJSObject,instance);
  22016. return instance;
  22017. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.a$cls)});
  22018. },
  22019. args: ["aJSObject"],
  22020. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  22021. referencedClasses: [],
  22022. messageSends: ["new", "jsObject:ofProxy:"]
  22023. }),
  22024. $globals.JSObjectProxy.a$cls);
  22025. $core.addMethod(
  22026. $core.method({
  22027. selector: "undefined",
  22028. protocol: "accessing",
  22029. fn: function (){
  22030. var self=this,$self=this;
  22031. return $core.withContext(function($ctx1) {
  22032. return undefined;
  22033. return self;
  22034. }, function($ctx1) {$ctx1.fill(self,"undefined",{},$globals.JSObjectProxy.a$cls)});
  22035. },
  22036. args: [],
  22037. source: "undefined\x0a\x09<inlineJS: 'return undefined'>",
  22038. referencedClasses: [],
  22039. messageSends: []
  22040. }),
  22041. $globals.JSObjectProxy.a$cls);
  22042. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  22043. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  22044. $core.addMethod(
  22045. $core.method({
  22046. selector: "addElement:",
  22047. protocol: "accessing",
  22048. fn: function (anObject){
  22049. var self=this,$self=this;
  22050. return $core.withContext(function($ctx1) {
  22051. $recv($self._elements())._add_(anObject);
  22052. return self;
  22053. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  22054. },
  22055. args: ["anObject"],
  22056. source: "addElement: anObject\x0a\x09self elements add: anObject",
  22057. referencedClasses: [],
  22058. messageSends: ["add:", "elements"]
  22059. }),
  22060. $globals.Organizer);
  22061. $core.addMethod(
  22062. $core.method({
  22063. selector: "elements",
  22064. protocol: "accessing",
  22065. fn: function (){
  22066. var self=this,$self=this;
  22067. return $self.elements;
  22068. },
  22069. args: [],
  22070. source: "elements\x0a\x09^ elements",
  22071. referencedClasses: [],
  22072. messageSends: []
  22073. }),
  22074. $globals.Organizer);
  22075. $core.addMethod(
  22076. $core.method({
  22077. selector: "initialize",
  22078. protocol: "initialization",
  22079. fn: function (){
  22080. var self=this,$self=this;
  22081. return $core.withContext(function($ctx1) {
  22082. (
  22083. $ctx1.supercall = true,
  22084. ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22085. $ctx1.supercall = false;
  22086. $self.elements=$recv($globals.Set)._new();
  22087. return self;
  22088. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Organizer)});
  22089. },
  22090. args: [],
  22091. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  22092. referencedClasses: ["Set"],
  22093. messageSends: ["initialize", "new"]
  22094. }),
  22095. $globals.Organizer);
  22096. $core.addMethod(
  22097. $core.method({
  22098. selector: "removeElement:",
  22099. protocol: "accessing",
  22100. fn: function (anObject){
  22101. var self=this,$self=this;
  22102. return $core.withContext(function($ctx1) {
  22103. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  22104. }));
  22105. return self;
  22106. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  22107. },
  22108. args: ["anObject"],
  22109. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  22110. referencedClasses: [],
  22111. messageSends: ["remove:ifAbsent:", "elements"]
  22112. }),
  22113. $globals.Organizer);
  22114. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  22115. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  22116. $core.addMethod(
  22117. $core.method({
  22118. selector: "addElement:",
  22119. protocol: "accessing",
  22120. fn: function (aString){
  22121. var self=this,$self=this;
  22122. return $core.withContext(function($ctx1) {
  22123. var $1,$3,$2;
  22124. (
  22125. $ctx1.supercall = true,
  22126. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  22127. $ctx1.supercall = false;
  22128. $1=$recv($globals.SystemAnnouncer)._current();
  22129. $3=$recv($globals.ProtocolAdded)._new();
  22130. $recv($3)._protocol_(aString);
  22131. $recv($3)._theClass_($self._theClass());
  22132. $2=$recv($3)._yourself();
  22133. $recv($1)._announce_($2);
  22134. return self;
  22135. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  22136. },
  22137. args: ["aString"],
  22138. 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)",
  22139. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  22140. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  22141. }),
  22142. $globals.ClassOrganizer);
  22143. $core.addMethod(
  22144. $core.method({
  22145. selector: "removeElement:",
  22146. protocol: "accessing",
  22147. fn: function (aString){
  22148. var self=this,$self=this;
  22149. return $core.withContext(function($ctx1) {
  22150. var $1,$3,$2;
  22151. (
  22152. $ctx1.supercall = true,
  22153. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  22154. $ctx1.supercall = false;
  22155. $1=$recv($globals.SystemAnnouncer)._current();
  22156. $3=$recv($globals.ProtocolRemoved)._new();
  22157. $recv($3)._protocol_(aString);
  22158. $recv($3)._theClass_($self._theClass());
  22159. $2=$recv($3)._yourself();
  22160. $recv($1)._announce_($2);
  22161. return self;
  22162. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  22163. },
  22164. args: ["aString"],
  22165. 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)",
  22166. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  22167. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  22168. }),
  22169. $globals.ClassOrganizer);
  22170. $core.addMethod(
  22171. $core.method({
  22172. selector: "theClass",
  22173. protocol: "accessing",
  22174. fn: function (){
  22175. var self=this,$self=this;
  22176. return $self.traitOrBehavior;
  22177. },
  22178. args: [],
  22179. source: "theClass\x0a\x09^ traitOrBehavior",
  22180. referencedClasses: [],
  22181. messageSends: []
  22182. }),
  22183. $globals.ClassOrganizer);
  22184. $core.addMethod(
  22185. $core.method({
  22186. selector: "theClass:",
  22187. protocol: "accessing",
  22188. fn: function (aClass){
  22189. var self=this,$self=this;
  22190. $self.traitOrBehavior=aClass;
  22191. return self;
  22192. },
  22193. args: ["aClass"],
  22194. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  22195. referencedClasses: [],
  22196. messageSends: []
  22197. }),
  22198. $globals.ClassOrganizer);
  22199. $core.addMethod(
  22200. $core.method({
  22201. selector: "on:",
  22202. protocol: "instance creation",
  22203. fn: function (aClass){
  22204. var self=this,$self=this;
  22205. return $core.withContext(function($ctx1) {
  22206. var $1;
  22207. $1=$self._new();
  22208. $recv($1)._theClass_(aClass);
  22209. return $recv($1)._yourself();
  22210. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.ClassOrganizer.a$cls)});
  22211. },
  22212. args: ["aClass"],
  22213. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  22214. referencedClasses: [],
  22215. messageSends: ["theClass:", "new", "yourself"]
  22216. }),
  22217. $globals.ClassOrganizer.a$cls);
  22218. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  22219. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  22220. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization", "isReady"], "Kernel-Infrastructure");
  22221. $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'";
  22222. $core.addMethod(
  22223. $core.method({
  22224. selector: "basicTransport",
  22225. protocol: "private",
  22226. fn: function (){
  22227. var self=this,$self=this;
  22228. return $self.basicTransport;
  22229. },
  22230. args: [],
  22231. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  22232. referencedClasses: [],
  22233. messageSends: []
  22234. }),
  22235. $globals.Package);
  22236. $core.addMethod(
  22237. $core.method({
  22238. selector: "beClean",
  22239. protocol: "accessing",
  22240. fn: function (){
  22241. var self=this,$self=this;
  22242. return $core.withContext(function($ctx1) {
  22243. var $1,$3,$2;
  22244. $self.dirty=false;
  22245. $1=$recv($globals.SystemAnnouncer)._current();
  22246. $3=$recv($globals.PackageClean)._new();
  22247. $recv($3)._package_(self);
  22248. $2=$recv($3)._yourself();
  22249. $recv($1)._announce_($2);
  22250. return self;
  22251. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  22252. },
  22253. args: [],
  22254. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22255. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  22256. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22257. }),
  22258. $globals.Package);
  22259. $core.addMethod(
  22260. $core.method({
  22261. selector: "beDirty",
  22262. protocol: "accessing",
  22263. fn: function (){
  22264. var self=this,$self=this;
  22265. return $core.withContext(function($ctx1) {
  22266. var $1,$3,$2;
  22267. $self.dirty=true;
  22268. $1=$recv($globals.SystemAnnouncer)._current();
  22269. $3=$recv($globals.PackageDirty)._new();
  22270. $recv($3)._package_(self);
  22271. $2=$recv($3)._yourself();
  22272. $recv($1)._announce_($2);
  22273. return self;
  22274. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  22275. },
  22276. args: [],
  22277. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22278. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  22279. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22280. }),
  22281. $globals.Package);
  22282. $core.addMethod(
  22283. $core.method({
  22284. selector: "classTemplate",
  22285. protocol: "accessing",
  22286. fn: function (){
  22287. var self=this,$self=this;
  22288. return $core.withContext(function($ctx1) {
  22289. return $recv($globals.String)._streamContents_((function(stream){
  22290. return $core.withContext(function($ctx2) {
  22291. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  22292. $ctx2.sendIdx["write:"]=1;
  22293. $recv(stream)._lf();
  22294. $ctx2.sendIdx["lf"]=1;
  22295. $recv(stream)._tab();
  22296. $ctx2.sendIdx["tab"]=1;
  22297. $recv(stream)._write_("instanceVariableNames: ''");
  22298. $ctx2.sendIdx["write:"]=2;
  22299. $recv(stream)._lf();
  22300. $recv(stream)._tab();
  22301. $recv(stream)._write_("package: ");
  22302. return $recv(stream)._print_($self._name());
  22303. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22304. }));
  22305. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  22306. },
  22307. args: [],
  22308. 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 ]",
  22309. referencedClasses: ["String"],
  22310. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  22311. }),
  22312. $globals.Package);
  22313. $core.addMethod(
  22314. $core.method({
  22315. selector: "classes",
  22316. protocol: "classes",
  22317. fn: function (){
  22318. var self=this,$self=this;
  22319. return $core.withContext(function($ctx1) {
  22320. return $recv($recv($self._organization())._elements())._copy();
  22321. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  22322. },
  22323. args: [],
  22324. source: "classes\x0a\x09^ self organization elements copy",
  22325. referencedClasses: [],
  22326. messageSends: ["copy", "elements", "organization"]
  22327. }),
  22328. $globals.Package);
  22329. $core.addMethod(
  22330. $core.method({
  22331. selector: "definition",
  22332. protocol: "accessing",
  22333. fn: function (){
  22334. var self=this,$self=this;
  22335. return $core.withContext(function($ctx1) {
  22336. var $1;
  22337. return $recv($globals.String)._streamContents_((function(stream){
  22338. return $core.withContext(function($ctx2) {
  22339. $1=$recv($self._class())._name();
  22340. $ctx2.sendIdx["name"]=1;
  22341. $recv(stream)._write_($1);
  22342. $ctx2.sendIdx["write:"]=1;
  22343. $recv(stream)._lf();
  22344. $ctx2.sendIdx["lf"]=1;
  22345. $recv(stream)._tab();
  22346. $ctx2.sendIdx["tab"]=1;
  22347. $recv(stream)._write_("named: ");
  22348. $ctx2.sendIdx["write:"]=2;
  22349. $recv(stream)._print_($self._name());
  22350. $recv(stream)._lf();
  22351. $ctx2.sendIdx["lf"]=2;
  22352. $recv(stream)._tab();
  22353. $ctx2.sendIdx["tab"]=2;
  22354. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  22355. $ctx2.sendIdx["write:"]=3;
  22356. $recv(stream)._lf();
  22357. $recv(stream)._tab();
  22358. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  22359. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22360. }));
  22361. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  22362. },
  22363. args: [],
  22364. 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. ')' } ]",
  22365. referencedClasses: ["String"],
  22366. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  22367. }),
  22368. $globals.Package);
  22369. $core.addMethod(
  22370. $core.method({
  22371. selector: "eval:",
  22372. protocol: "evaluating",
  22373. fn: function (aString){
  22374. var self=this,$self=this;
  22375. return $core.withContext(function($ctx1) {
  22376. var $1,$receiver;
  22377. $1=$self.evalBlock;
  22378. if(($receiver = $1) == null || $receiver.a$nil){
  22379. return $recv($globals.Compiler)._eval_(aString);
  22380. } else {
  22381. return $recv($self.evalBlock)._value_(aString);
  22382. }
  22383. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Package)});
  22384. },
  22385. args: ["aString"],
  22386. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  22387. referencedClasses: ["Compiler"],
  22388. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  22389. }),
  22390. $globals.Package);
  22391. $core.addMethod(
  22392. $core.method({
  22393. selector: "evalBlock",
  22394. protocol: "accessing",
  22395. fn: function (){
  22396. var self=this,$self=this;
  22397. return $self.evalBlock;
  22398. },
  22399. args: [],
  22400. source: "evalBlock\x0a\x09^ evalBlock",
  22401. referencedClasses: [],
  22402. messageSends: []
  22403. }),
  22404. $globals.Package);
  22405. $core.addMethod(
  22406. $core.method({
  22407. selector: "evalBlock:",
  22408. protocol: "accessing",
  22409. fn: function (aBlock){
  22410. var self=this,$self=this;
  22411. $self.evalBlock=aBlock;
  22412. return self;
  22413. },
  22414. args: ["aBlock"],
  22415. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  22416. referencedClasses: [],
  22417. messageSends: []
  22418. }),
  22419. $globals.Package);
  22420. $core.addMethod(
  22421. $core.method({
  22422. selector: "imports",
  22423. protocol: "accessing",
  22424. fn: function (){
  22425. var self=this,$self=this;
  22426. return $core.withContext(function($ctx1) {
  22427. var $1,$receiver;
  22428. $1=$self.imports;
  22429. if(($receiver = $1) == null || $receiver.a$nil){
  22430. $self._imports_([]);
  22431. return $self.imports;
  22432. } else {
  22433. return $1;
  22434. }
  22435. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  22436. },
  22437. args: [],
  22438. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  22439. referencedClasses: [],
  22440. messageSends: ["ifNil:", "imports:"]
  22441. }),
  22442. $globals.Package);
  22443. $core.addMethod(
  22444. $core.method({
  22445. selector: "imports:",
  22446. protocol: "accessing",
  22447. fn: function (anArray){
  22448. var self=this,$self=this;
  22449. return $core.withContext(function($ctx1) {
  22450. $self._validateImports_(anArray);
  22451. $self.imports=$recv(anArray)._asSet();
  22452. return self;
  22453. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  22454. },
  22455. args: ["anArray"],
  22456. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  22457. referencedClasses: [],
  22458. messageSends: ["validateImports:", "asSet"]
  22459. }),
  22460. $globals.Package);
  22461. $core.addMethod(
  22462. $core.method({
  22463. selector: "importsAsJson",
  22464. protocol: "converting",
  22465. fn: function (){
  22466. var self=this,$self=this;
  22467. return $core.withContext(function($ctx1) {
  22468. var $1;
  22469. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  22470. return $core.withContext(function($ctx2) {
  22471. $1=$recv(each)._isString();
  22472. if($core.assert($1)){
  22473. return each;
  22474. } else {
  22475. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  22476. $ctx2.sendIdx[","]=1;
  22477. }
  22478. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22479. }));
  22480. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  22481. },
  22482. args: [],
  22483. 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 ]]",
  22484. referencedClasses: [],
  22485. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  22486. }),
  22487. $globals.Package);
  22488. $core.addMethod(
  22489. $core.method({
  22490. selector: "importsDefinition",
  22491. protocol: "accessing",
  22492. fn: function (){
  22493. var self=this,$self=this;
  22494. return $core.withContext(function($ctx1) {
  22495. return $recv($globals.String)._streamContents_((function(stream){
  22496. return $core.withContext(function($ctx2) {
  22497. $recv(stream)._write_("{");
  22498. $ctx2.sendIdx["write:"]=1;
  22499. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  22500. return $core.withContext(function($ctx3) {
  22501. return $recv(stream)._print_(each);
  22502. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  22503. }),(function(){
  22504. return $core.withContext(function($ctx3) {
  22505. return $recv(stream)._write_(". ");
  22506. $ctx3.sendIdx["write:"]=2;
  22507. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  22508. }));
  22509. return $recv(stream)._write_("}");
  22510. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22511. }));
  22512. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  22513. },
  22514. args: [],
  22515. 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: '}' ]",
  22516. referencedClasses: ["String"],
  22517. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  22518. }),
  22519. $globals.Package);
  22520. $core.addMethod(
  22521. $core.method({
  22522. selector: "importsFromJson:",
  22523. protocol: "converting",
  22524. fn: function (anArray){
  22525. var self=this,$self=this;
  22526. return $core.withContext(function($ctx1) {
  22527. var $1;
  22528. return $recv(anArray)._collect_((function(each){
  22529. var split;
  22530. return $core.withContext(function($ctx2) {
  22531. split=$recv(each)._tokenize_("=");
  22532. $1=$recv($recv(split)._size()).__eq((1));
  22533. if($core.assert($1)){
  22534. return $recv(split)._first();
  22535. $ctx2.sendIdx["first"]=1;
  22536. } else {
  22537. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  22538. }
  22539. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  22540. }));
  22541. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  22542. },
  22543. args: ["anArray"],
  22544. 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 ]]",
  22545. referencedClasses: [],
  22546. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  22547. }),
  22548. $globals.Package);
  22549. $core.addMethod(
  22550. $core.method({
  22551. selector: "initialize",
  22552. protocol: "initialization",
  22553. fn: function (){
  22554. var self=this,$self=this;
  22555. return $core.withContext(function($ctx1) {
  22556. (
  22557. $ctx1.supercall = true,
  22558. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22559. $ctx1.supercall = false;
  22560. $self.organization=$recv($globals.PackageOrganizer)._new();
  22561. $ctx1.sendIdx["new"]=1;
  22562. $self.evalBlock=nil;
  22563. $self.dirty=nil;
  22564. $self.imports=nil;
  22565. $self.isReady=$recv($globals.Promise)._new();
  22566. $self.transport=nil;
  22567. return self;
  22568. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Package)});
  22569. },
  22570. args: [],
  22571. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09organization := PackageOrganizer new.\x0a\x09evalBlock := nil.\x0a\x09dirty := nil.\x0a\x09imports := nil.\x0a\x09isReady := Promise new.\x0a\x09transport := nil",
  22572. referencedClasses: ["PackageOrganizer", "Promise"],
  22573. messageSends: ["initialize", "new"]
  22574. }),
  22575. $globals.Package);
  22576. $core.addMethod(
  22577. $core.method({
  22578. selector: "isDirty",
  22579. protocol: "testing",
  22580. fn: function (){
  22581. var self=this,$self=this;
  22582. return $core.withContext(function($ctx1) {
  22583. var $1,$receiver;
  22584. $1=$self.dirty;
  22585. if(($receiver = $1) == null || $receiver.a$nil){
  22586. return false;
  22587. } else {
  22588. return $1;
  22589. }
  22590. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  22591. },
  22592. args: [],
  22593. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  22594. referencedClasses: [],
  22595. messageSends: ["ifNil:"]
  22596. }),
  22597. $globals.Package);
  22598. $core.addMethod(
  22599. $core.method({
  22600. selector: "isPackage",
  22601. protocol: "testing",
  22602. fn: function (){
  22603. var self=this,$self=this;
  22604. return true;
  22605. },
  22606. args: [],
  22607. source: "isPackage\x0a\x09^ true",
  22608. referencedClasses: [],
  22609. messageSends: []
  22610. }),
  22611. $globals.Package);
  22612. $core.addMethod(
  22613. $core.method({
  22614. selector: "isReady",
  22615. protocol: "accessing",
  22616. fn: function (){
  22617. var self=this,$self=this;
  22618. return $self.isReady;
  22619. },
  22620. args: [],
  22621. source: "isReady\x0a\x09^ isReady",
  22622. referencedClasses: [],
  22623. messageSends: []
  22624. }),
  22625. $globals.Package);
  22626. $core.addMethod(
  22627. $core.method({
  22628. selector: "isReady:",
  22629. protocol: "accessing",
  22630. fn: function (aPromise){
  22631. var self=this,$self=this;
  22632. $self.isReady=aPromise;
  22633. return self;
  22634. },
  22635. args: ["aPromise"],
  22636. source: "isReady: aPromise\x0a\x09isReady := aPromise",
  22637. referencedClasses: [],
  22638. messageSends: []
  22639. }),
  22640. $globals.Package);
  22641. $core.addMethod(
  22642. $core.method({
  22643. selector: "javaScriptDescriptor:",
  22644. protocol: "accessing",
  22645. fn: function (anObject){
  22646. var self=this,$self=this;
  22647. var basicEval,basicImports;
  22648. return $core.withContext(function($ctx1) {
  22649. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  22650. return $core.withContext(function($ctx2) {
  22651. return nil._asJavaScriptObject();
  22652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22653. }));
  22654. $ctx1.sendIdx["at:ifAbsent:"]=1;
  22655. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  22656. return [];
  22657. }));
  22658. $ctx1.sendIdx["at:ifAbsent:"]=2;
  22659. $self.basicTransport=$recv(anObject)._at_ifAbsent_("transport",(function(){
  22660. }));
  22661. $recv(anObject)._at_ifPresent_("isReady",(function(aPromise){
  22662. return $core.withContext(function($ctx2) {
  22663. return $self._isReady_(aPromise);
  22664. }, function($ctx2) {$ctx2.fillBlock({aPromise:aPromise},$ctx1,4)});
  22665. }));
  22666. $self._evalBlock_(basicEval);
  22667. $self._imports_($self._importsFromJson_(basicImports));
  22668. return self;
  22669. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports},$globals.Package)});
  22670. },
  22671. args: ["anObject"],
  22672. 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\x09anObject at: 'isReady' ifPresent: [ :aPromise | self isReady: aPromise ].\x0a\x0a\x09self\x0a\x09\x09evalBlock: basicEval;\x0a\x09\x09imports: (self importsFromJson: basicImports)",
  22673. referencedClasses: [],
  22674. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "at:ifPresent:", "isReady:", "evalBlock:", "imports:", "importsFromJson:"]
  22675. }),
  22676. $globals.Package);
  22677. $core.addMethod(
  22678. $core.method({
  22679. selector: "loadDependencies",
  22680. protocol: "dependencies",
  22681. fn: function (){
  22682. var self=this,$self=this;
  22683. var classes,packages;
  22684. return $core.withContext(function($ctx1) {
  22685. var $1;
  22686. classes=$self._loadDependencyClasses();
  22687. $1=$recv($recv(classes)._collect_((function(each){
  22688. return $core.withContext(function($ctx2) {
  22689. return $recv(each)._package();
  22690. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22691. })))._asSet();
  22692. $recv($1)._remove_ifAbsent_(self,(function(){
  22693. }));
  22694. return $recv($1)._yourself();
  22695. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  22696. },
  22697. args: [],
  22698. 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",
  22699. referencedClasses: [],
  22700. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  22701. }),
  22702. $globals.Package);
  22703. $core.addMethod(
  22704. $core.method({
  22705. selector: "loadDependencyClasses",
  22706. protocol: "dependencies",
  22707. fn: function (){
  22708. var self=this,$self=this;
  22709. var starCategoryName;
  22710. return $core.withContext(function($ctx1) {
  22711. var $3,$2,$1;
  22712. starCategoryName="*".__comma($self._name());
  22713. $3=$self._classes();
  22714. $ctx1.sendIdx["classes"]=1;
  22715. $2=$recv($3)._collect_((function(each){
  22716. return $core.withContext(function($ctx2) {
  22717. return $recv(each)._superclass();
  22718. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22719. }));
  22720. $ctx1.sendIdx["collect:"]=1;
  22721. $1=$recv($2)._asSet();
  22722. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  22723. return $core.withContext(function($ctx2) {
  22724. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._anySatisfy_((function(any){
  22725. return $core.withContext(function($ctx3) {
  22726. return $recv($recv($recv(any)._protocols())._includes_(starCategoryName))._and_((function(){
  22727. return $core.withContext(function($ctx4) {
  22728. return $recv($recv(any)._ownMethodsInProtocol_(starCategoryName))._notEmpty();
  22729. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  22730. }));
  22731. }, function($ctx3) {$ctx3.fillBlock({any:any},$ctx2,3)});
  22732. }));
  22733. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22734. })));
  22735. $ctx1.sendIdx["addAll:"]=1;
  22736. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  22737. return $core.withContext(function($ctx2) {
  22738. return $recv($self._traitCompositions())._valuesDo_((function(each){
  22739. return $core.withContext(function($ctx3) {
  22740. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  22741. return $core.withContext(function($ctx4) {
  22742. return $recv(eachTT)._trait();
  22743. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  22744. })));
  22745. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  22746. }));
  22747. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  22748. })));
  22749. $recv($1)._remove_ifAbsent_(nil,(function(){
  22750. }));
  22751. return $recv($1)._yourself();
  22752. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  22753. },
  22754. args: [],
  22755. 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\x09({each. each theMetaClass} copyWithout: nil) anySatisfy: [ :any |\x0a\x09\x09\x09\x09(any protocols includes: starCategoryName) and: [\x0a\x09\x09\x09\x09\x09(any ownMethodsInProtocol: starCategoryName) notEmpty ]]]);\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",
  22756. referencedClasses: ["Smalltalk", "Array"],
  22757. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "anySatisfy:", "copyWithout:", "theMetaClass", "and:", "includes:", "protocols", "notEmpty", "ownMethodsInProtocol:", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  22758. }),
  22759. $globals.Package);
  22760. $core.addMethod(
  22761. $core.method({
  22762. selector: "name",
  22763. protocol: "accessing",
  22764. fn: function (){
  22765. var self=this,$self=this;
  22766. return $self.name;
  22767. },
  22768. args: [],
  22769. source: "name\x0a\x09^ name",
  22770. referencedClasses: [],
  22771. messageSends: []
  22772. }),
  22773. $globals.Package);
  22774. $core.addMethod(
  22775. $core.method({
  22776. selector: "name:",
  22777. protocol: "accessing",
  22778. fn: function (aString){
  22779. var self=this,$self=this;
  22780. $self.name=aString;
  22781. return self;
  22782. },
  22783. args: ["aString"],
  22784. source: "name: aString\x0a\x09name := aString",
  22785. referencedClasses: [],
  22786. messageSends: []
  22787. }),
  22788. $globals.Package);
  22789. $core.addMethod(
  22790. $core.method({
  22791. selector: "organization",
  22792. protocol: "accessing",
  22793. fn: function (){
  22794. var self=this,$self=this;
  22795. return $self.organization;
  22796. },
  22797. args: [],
  22798. source: "organization\x0a\x09^ organization",
  22799. referencedClasses: [],
  22800. messageSends: []
  22801. }),
  22802. $globals.Package);
  22803. $core.addMethod(
  22804. $core.method({
  22805. selector: "printOn:",
  22806. protocol: "printing",
  22807. fn: function (aStream){
  22808. var self=this,$self=this;
  22809. return $core.withContext(function($ctx1) {
  22810. (
  22811. $ctx1.supercall = true,
  22812. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  22813. $ctx1.supercall = false;
  22814. $recv(aStream)._nextPutAll_(" (");
  22815. $ctx1.sendIdx["nextPutAll:"]=1;
  22816. $recv(aStream)._nextPutAll_($self._name());
  22817. $ctx1.sendIdx["nextPutAll:"]=2;
  22818. $recv(aStream)._nextPutAll_(")");
  22819. return self;
  22820. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  22821. },
  22822. args: ["aStream"],
  22823. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  22824. referencedClasses: [],
  22825. messageSends: ["printOn:", "nextPutAll:", "name"]
  22826. }),
  22827. $globals.Package);
  22828. $core.addMethod(
  22829. $core.method({
  22830. selector: "setupClasses",
  22831. protocol: "classes",
  22832. fn: function (){
  22833. var self=this,$self=this;
  22834. return $core.withContext(function($ctx1) {
  22835. $recv($self._classes())._do_((function(each){
  22836. return $core.withContext(function($ctx2) {
  22837. return $recv(each)._initialize();
  22838. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22839. }));
  22840. return self;
  22841. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  22842. },
  22843. args: [],
  22844. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  22845. referencedClasses: [],
  22846. messageSends: ["do:", "classes", "initialize"]
  22847. }),
  22848. $globals.Package);
  22849. $core.addMethod(
  22850. $core.method({
  22851. selector: "sortedClasses",
  22852. protocol: "classes",
  22853. fn: function (){
  22854. var self=this,$self=this;
  22855. return $core.withContext(function($ctx1) {
  22856. return $recv($self._class())._sortedClasses_($self._classes());
  22857. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  22858. },
  22859. args: [],
  22860. 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",
  22861. referencedClasses: [],
  22862. messageSends: ["sortedClasses:", "class", "classes"]
  22863. }),
  22864. $globals.Package);
  22865. $core.addMethod(
  22866. $core.method({
  22867. selector: "sortedImportsAsArray",
  22868. protocol: "private",
  22869. fn: function (){
  22870. var self=this,$self=this;
  22871. return $core.withContext(function($ctx1) {
  22872. var $3,$2,$4,$1,$6,$5,$7;
  22873. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  22874. return $core.withContext(function($ctx2) {
  22875. $3=$recv(a)._isString();
  22876. $ctx2.sendIdx["isString"]=1;
  22877. $2=$recv($3)._not();
  22878. $4=$recv(b)._isString();
  22879. $ctx2.sendIdx["isString"]=2;
  22880. $1=$recv($2).__and($4);
  22881. return $recv($1)._or_((function(){
  22882. return $core.withContext(function($ctx3) {
  22883. $6=$recv(a)._isString();
  22884. $ctx3.sendIdx["isString"]=3;
  22885. $5=$recv($6).__eq($recv(b)._isString());
  22886. return $recv($5)._and_((function(){
  22887. return $core.withContext(function($ctx4) {
  22888. $7=$recv(a)._value();
  22889. $ctx4.sendIdx["value"]=1;
  22890. return $recv($7).__lt_eq($recv(b)._value());
  22891. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  22892. }));
  22893. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  22894. }));
  22895. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  22896. }));
  22897. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  22898. },
  22899. args: [],
  22900. 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 ]]]",
  22901. referencedClasses: [],
  22902. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  22903. }),
  22904. $globals.Package);
  22905. $core.addMethod(
  22906. $core.method({
  22907. selector: "traitCompositions",
  22908. protocol: "dependencies",
  22909. fn: function (){
  22910. var self=this,$self=this;
  22911. var traitCompositions;
  22912. return $core.withContext(function($ctx1) {
  22913. var $1,$2,$3,$receiver;
  22914. traitCompositions=$recv($globals.Dictionary)._new();
  22915. $recv($self._classes())._do_((function(each){
  22916. return $core.withContext(function($ctx2) {
  22917. $1=traitCompositions;
  22918. $2=$recv(each)._traitComposition();
  22919. $ctx2.sendIdx["traitComposition"]=1;
  22920. $recv($1)._at_put_(each,$2);
  22921. $ctx2.sendIdx["at:put:"]=1;
  22922. $3=$recv(each)._theMetaClass();
  22923. if(($receiver = $3) == null || $receiver.a$nil){
  22924. return $3;
  22925. } else {
  22926. var meta;
  22927. meta=$receiver;
  22928. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  22929. }
  22930. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22931. }));
  22932. return $recv(traitCompositions)._reject_((function(each){
  22933. return $core.withContext(function($ctx2) {
  22934. return $recv(each)._isEmpty();
  22935. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  22936. }));
  22937. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  22938. },
  22939. args: [],
  22940. 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 ]",
  22941. referencedClasses: ["Dictionary"],
  22942. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  22943. }),
  22944. $globals.Package);
  22945. $core.addMethod(
  22946. $core.method({
  22947. selector: "transport",
  22948. protocol: "accessing",
  22949. fn: function (){
  22950. var self=this,$self=this;
  22951. return $core.withContext(function($ctx1) {
  22952. var $1,$receiver;
  22953. $1=$self.transport;
  22954. if(($receiver = $1) == null || $receiver.a$nil){
  22955. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  22956. return $self.transport;
  22957. } else {
  22958. return $1;
  22959. }
  22960. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  22961. },
  22962. args: [],
  22963. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  22964. referencedClasses: ["PackageTransport"],
  22965. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  22966. }),
  22967. $globals.Package);
  22968. $core.addMethod(
  22969. $core.method({
  22970. selector: "transport:",
  22971. protocol: "accessing",
  22972. fn: function (aPackageTransport){
  22973. var self=this,$self=this;
  22974. return $core.withContext(function($ctx1) {
  22975. $self.transport=aPackageTransport;
  22976. $recv(aPackageTransport)._package_(self);
  22977. return self;
  22978. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  22979. },
  22980. args: ["aPackageTransport"],
  22981. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  22982. referencedClasses: [],
  22983. messageSends: ["package:"]
  22984. }),
  22985. $globals.Package);
  22986. $core.addMethod(
  22987. $core.method({
  22988. selector: "validateImports:",
  22989. protocol: "validation",
  22990. fn: function (aCollection){
  22991. var self=this,$self=this;
  22992. return $core.withContext(function($ctx1) {
  22993. var $1,$2,$5,$4,$3,$6;
  22994. $recv(aCollection)._do_((function(import_){
  22995. return $core.withContext(function($ctx2) {
  22996. $1=$recv(import_)._isString();
  22997. $ctx2.sendIdx["isString"]=1;
  22998. if(!$core.assert($1)){
  22999. $2=$recv(import_)._respondsTo_("key");
  23000. if(!$core.assert($2)){
  23001. $self._error_("Imports must be Strings or Associations");
  23002. $ctx2.sendIdx["error:"]=1;
  23003. }
  23004. $5=$recv(import_)._key();
  23005. $ctx2.sendIdx["key"]=1;
  23006. $4=$recv($5)._isString();
  23007. $ctx2.sendIdx["isString"]=2;
  23008. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  23009. if(!$core.assert($3)){
  23010. $self._error_("Key and value must be Strings");
  23011. $ctx2.sendIdx["error:"]=2;
  23012. }
  23013. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  23014. if(!$core.assert($6)){
  23015. return $self._error_("Keys must be identifiers");
  23016. }
  23017. }
  23018. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  23019. }));
  23020. return self;
  23021. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  23022. },
  23023. args: ["aCollection"],
  23024. 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' ]]]",
  23025. referencedClasses: [],
  23026. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  23027. }),
  23028. $globals.Package);
  23029. $core.setSlots($globals.Package.a$cls, ["defaultCommitPathJs", "defaultCommitPathSt"]);
  23030. $core.addMethod(
  23031. $core.method({
  23032. selector: "named:",
  23033. protocol: "accessing",
  23034. fn: function (aPackageName){
  23035. var self=this,$self=this;
  23036. return $core.withContext(function($ctx1) {
  23037. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  23038. return $core.withContext(function($ctx2) {
  23039. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  23040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23041. }));
  23042. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  23043. },
  23044. args: ["aPackageName"],
  23045. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  23046. referencedClasses: ["Smalltalk"],
  23047. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  23048. }),
  23049. $globals.Package.a$cls);
  23050. $core.addMethod(
  23051. $core.method({
  23052. selector: "named:ifAbsent:",
  23053. protocol: "accessing",
  23054. fn: function (aPackageName,aBlock){
  23055. var self=this,$self=this;
  23056. return $core.withContext(function($ctx1) {
  23057. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  23058. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  23059. },
  23060. args: ["aPackageName", "aBlock"],
  23061. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  23062. referencedClasses: ["Smalltalk"],
  23063. messageSends: ["packageAt:ifAbsent:"]
  23064. }),
  23065. $globals.Package.a$cls);
  23066. $core.addMethod(
  23067. $core.method({
  23068. selector: "named:imports:transport:",
  23069. protocol: "accessing",
  23070. fn: function (aPackageName,anArray,aTransport){
  23071. var self=this,$self=this;
  23072. var pkg;
  23073. return $core.withContext(function($ctx1) {
  23074. pkg=$self._named_(aPackageName);
  23075. $recv(pkg)._imports_(anArray);
  23076. $recv(pkg)._transport_(aTransport);
  23077. return pkg;
  23078. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  23079. },
  23080. args: ["aPackageName", "anArray", "aTransport"],
  23081. 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",
  23082. referencedClasses: [],
  23083. messageSends: ["named:", "imports:", "transport:"]
  23084. }),
  23085. $globals.Package.a$cls);
  23086. $core.addMethod(
  23087. $core.method({
  23088. selector: "named:javaScriptDescriptor:",
  23089. protocol: "instance creation",
  23090. fn: function (aString,anObject){
  23091. var self=this,$self=this;
  23092. var pkg;
  23093. return $core.withContext(function($ctx1) {
  23094. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  23095. $recv(pkg)._javaScriptDescriptor_(anObject);
  23096. return pkg;
  23097. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg},$globals.Package.a$cls)});
  23098. },
  23099. args: ["aString", "anObject"],
  23100. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  23101. referencedClasses: ["Smalltalk"],
  23102. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  23103. }),
  23104. $globals.Package.a$cls);
  23105. $core.addMethod(
  23106. $core.method({
  23107. selector: "named:transport:",
  23108. protocol: "accessing",
  23109. fn: function (aPackageName,aTransport){
  23110. var self=this,$self=this;
  23111. var pkg;
  23112. return $core.withContext(function($ctx1) {
  23113. pkg=$self._named_(aPackageName);
  23114. $recv(pkg)._transport_(aTransport);
  23115. return pkg;
  23116. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  23117. },
  23118. args: ["aPackageName", "aTransport"],
  23119. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  23120. referencedClasses: [],
  23121. messageSends: ["named:", "transport:"]
  23122. }),
  23123. $globals.Package.a$cls);
  23124. $core.addMethod(
  23125. $core.method({
  23126. selector: "new:",
  23127. protocol: "instance creation",
  23128. fn: function (aString){
  23129. var self=this,$self=this;
  23130. return $core.withContext(function($ctx1) {
  23131. var $1;
  23132. $1=$recv($globals.Package)._new();
  23133. $recv($1)._name_(aString);
  23134. return $recv($1)._yourself();
  23135. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.Package.a$cls)});
  23136. },
  23137. args: ["aString"],
  23138. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  23139. referencedClasses: ["Package"],
  23140. messageSends: ["name:", "new", "yourself"]
  23141. }),
  23142. $globals.Package.a$cls);
  23143. $core.addMethod(
  23144. $core.method({
  23145. selector: "sortedClasses:",
  23146. protocol: "sorting",
  23147. fn: function (classes){
  23148. var self=this,$self=this;
  23149. var children,others,nodes,expandedClasses;
  23150. return $core.withContext(function($ctx1) {
  23151. var $1,$3,$2;
  23152. children=[];
  23153. others=[];
  23154. $recv(classes)._do_((function(each){
  23155. return $core.withContext(function($ctx2) {
  23156. $1=$recv(classes)._includes_($recv(each)._superclass());
  23157. if($core.assert($1)){
  23158. return $recv(others)._add_(each);
  23159. } else {
  23160. return $recv(children)._add_(each);
  23161. $ctx2.sendIdx["add:"]=1;
  23162. }
  23163. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23164. }));
  23165. $ctx1.sendIdx["do:"]=1;
  23166. nodes=$recv(children)._collect_((function(each){
  23167. return $core.withContext(function($ctx2) {
  23168. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  23169. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  23170. }));
  23171. nodes=$recv(nodes)._sorted_((function(a,b){
  23172. return $core.withContext(function($ctx2) {
  23173. $3=$recv(a)._theClass();
  23174. $ctx2.sendIdx["theClass"]=1;
  23175. $2=$recv($3)._name();
  23176. $ctx2.sendIdx["name"]=1;
  23177. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  23178. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  23179. }));
  23180. expandedClasses=$recv($globals.Array)._new();
  23181. $recv(nodes)._do_((function(aNode){
  23182. return $core.withContext(function($ctx2) {
  23183. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  23184. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  23185. }));
  23186. return expandedClasses;
  23187. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  23188. },
  23189. args: ["classes"],
  23190. 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",
  23191. referencedClasses: ["ClassSorterNode", "Array"],
  23192. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  23193. }),
  23194. $globals.Package.a$cls);
  23195. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  23196. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  23197. $core.addMethod(
  23198. $core.method({
  23199. selector: "announcer",
  23200. protocol: "accessing",
  23201. fn: function (){
  23202. var self=this,$self=this;
  23203. return $core.withContext(function($ctx1) {
  23204. return $recv($globals.SystemAnnouncer)._current();
  23205. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  23206. },
  23207. args: [],
  23208. source: "announcer\x0a\x09^ SystemAnnouncer current",
  23209. referencedClasses: ["SystemAnnouncer"],
  23210. messageSends: ["current"]
  23211. }),
  23212. $globals.PackageStateObserver);
  23213. $core.addMethod(
  23214. $core.method({
  23215. selector: "observeSystem",
  23216. protocol: "actions",
  23217. fn: function (){
  23218. var self=this,$self=this;
  23219. return $core.withContext(function($ctx1) {
  23220. var $1;
  23221. $1=$self._announcer();
  23222. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  23223. $ctx1.sendIdx["on:send:to:"]=1;
  23224. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  23225. $ctx1.sendIdx["on:send:to:"]=2;
  23226. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  23227. $ctx1.sendIdx["on:send:to:"]=3;
  23228. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  23229. return self;
  23230. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  23231. },
  23232. args: [],
  23233. 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",
  23234. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  23235. messageSends: ["on:send:to:", "announcer"]
  23236. }),
  23237. $globals.PackageStateObserver);
  23238. $core.addMethod(
  23239. $core.method({
  23240. selector: "onClassModification:",
  23241. protocol: "reactions",
  23242. fn: function (anAnnouncement){
  23243. var self=this,$self=this;
  23244. return $core.withContext(function($ctx1) {
  23245. var $1,$receiver;
  23246. $1=$recv(anAnnouncement)._theClass();
  23247. if(($receiver = $1) == null || $receiver.a$nil){
  23248. $1;
  23249. } else {
  23250. var theClass;
  23251. theClass=$receiver;
  23252. $recv($recv(theClass)._package())._beDirty();
  23253. }
  23254. return self;
  23255. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23256. },
  23257. args: ["anAnnouncement"],
  23258. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  23259. referencedClasses: [],
  23260. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  23261. }),
  23262. $globals.PackageStateObserver);
  23263. $core.addMethod(
  23264. $core.method({
  23265. selector: "onMethodModification:",
  23266. protocol: "reactions",
  23267. fn: function (anAnnouncement){
  23268. var self=this,$self=this;
  23269. return $core.withContext(function($ctx1) {
  23270. var $1,$receiver;
  23271. $1=$recv($recv(anAnnouncement)._method())._package();
  23272. if(($receiver = $1) == null || $receiver.a$nil){
  23273. $1;
  23274. } else {
  23275. var package_;
  23276. package_=$receiver;
  23277. $recv(package_)._beDirty();
  23278. }
  23279. return self;
  23280. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23281. },
  23282. args: ["anAnnouncement"],
  23283. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  23284. referencedClasses: [],
  23285. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  23286. }),
  23287. $globals.PackageStateObserver);
  23288. $core.addMethod(
  23289. $core.method({
  23290. selector: "onPackageAdded:",
  23291. protocol: "reactions",
  23292. fn: function (anAnnouncement){
  23293. var self=this,$self=this;
  23294. return $core.withContext(function($ctx1) {
  23295. $recv($recv(anAnnouncement)._package())._beDirty();
  23296. return self;
  23297. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23298. },
  23299. args: ["anAnnouncement"],
  23300. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  23301. referencedClasses: [],
  23302. messageSends: ["beDirty", "package"]
  23303. }),
  23304. $globals.PackageStateObserver);
  23305. $core.addMethod(
  23306. $core.method({
  23307. selector: "onProtocolModification:",
  23308. protocol: "reactions",
  23309. fn: function (anAnnouncement){
  23310. var self=this,$self=this;
  23311. return $core.withContext(function($ctx1) {
  23312. var $1,$receiver;
  23313. $1=$recv(anAnnouncement)._package();
  23314. if(($receiver = $1) == null || $receiver.a$nil){
  23315. $1;
  23316. } else {
  23317. var package_;
  23318. package_=$receiver;
  23319. $recv(package_)._beDirty();
  23320. }
  23321. return self;
  23322. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23323. },
  23324. args: ["anAnnouncement"],
  23325. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  23326. referencedClasses: [],
  23327. messageSends: ["ifNotNil:", "package", "beDirty"]
  23328. }),
  23329. $globals.PackageStateObserver);
  23330. $core.setSlots($globals.PackageStateObserver.a$cls, ["current"]);
  23331. $core.addMethod(
  23332. $core.method({
  23333. selector: "current",
  23334. protocol: "accessing",
  23335. fn: function (){
  23336. var self=this,$self=this;
  23337. return $core.withContext(function($ctx1) {
  23338. var $1,$receiver;
  23339. $1=$self.current;
  23340. if(($receiver = $1) == null || $receiver.a$nil){
  23341. $self.current=$self._new();
  23342. return $self.current;
  23343. } else {
  23344. return $1;
  23345. }
  23346. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  23347. },
  23348. args: [],
  23349. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  23350. referencedClasses: [],
  23351. messageSends: ["ifNil:", "new"]
  23352. }),
  23353. $globals.PackageStateObserver.a$cls);
  23354. $core.addMethod(
  23355. $core.method({
  23356. selector: "initialize",
  23357. protocol: "initialization",
  23358. fn: function (){
  23359. var self=this,$self=this;
  23360. return $core.withContext(function($ctx1) {
  23361. $recv($self._current())._observeSystem();
  23362. return self;
  23363. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  23364. },
  23365. args: [],
  23366. source: "initialize\x0a\x09self current observeSystem",
  23367. referencedClasses: [],
  23368. messageSends: ["observeSystem", "current"]
  23369. }),
  23370. $globals.PackageStateObserver.a$cls);
  23371. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  23372. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  23373. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  23374. $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`";
  23375. $core.addMethod(
  23376. $core.method({
  23377. selector: "defaultValue",
  23378. protocol: "accessing",
  23379. fn: function (){
  23380. var self=this,$self=this;
  23381. return $self.defaultValue;
  23382. },
  23383. args: [],
  23384. source: "defaultValue\x0a\x09^ defaultValue",
  23385. referencedClasses: [],
  23386. messageSends: []
  23387. }),
  23388. $globals.Setting);
  23389. $core.addMethod(
  23390. $core.method({
  23391. selector: "defaultValue:",
  23392. protocol: "accessing",
  23393. fn: function (aStringifiableObject){
  23394. var self=this,$self=this;
  23395. $self.defaultValue=aStringifiableObject;
  23396. return self;
  23397. },
  23398. args: ["aStringifiableObject"],
  23399. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  23400. referencedClasses: [],
  23401. messageSends: []
  23402. }),
  23403. $globals.Setting);
  23404. $core.addMethod(
  23405. $core.method({
  23406. selector: "key",
  23407. protocol: "accessing",
  23408. fn: function (){
  23409. var self=this,$self=this;
  23410. return $self.key;
  23411. },
  23412. args: [],
  23413. source: "key\x0a\x09^ key",
  23414. referencedClasses: [],
  23415. messageSends: []
  23416. }),
  23417. $globals.Setting);
  23418. $core.addMethod(
  23419. $core.method({
  23420. selector: "key:",
  23421. protocol: "accessing",
  23422. fn: function (aString){
  23423. var self=this,$self=this;
  23424. $self.key=aString;
  23425. return self;
  23426. },
  23427. args: ["aString"],
  23428. source: "key: aString\x0a\x09key := aString",
  23429. referencedClasses: [],
  23430. messageSends: []
  23431. }),
  23432. $globals.Setting);
  23433. $core.addMethod(
  23434. $core.method({
  23435. selector: "value",
  23436. protocol: "accessing",
  23437. fn: function (){
  23438. var self=this,$self=this;
  23439. return $core.withContext(function($ctx1) {
  23440. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  23441. return $core.withContext(function($ctx2) {
  23442. return $self._defaultValue();
  23443. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23444. }));
  23445. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  23446. },
  23447. args: [],
  23448. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  23449. referencedClasses: ["Smalltalk"],
  23450. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  23451. }),
  23452. $globals.Setting);
  23453. $core.addMethod(
  23454. $core.method({
  23455. selector: "value:",
  23456. protocol: "accessing",
  23457. fn: function (aStringifiableObject){
  23458. var self=this,$self=this;
  23459. return $core.withContext(function($ctx1) {
  23460. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  23461. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  23462. },
  23463. args: ["aStringifiableObject"],
  23464. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  23465. referencedClasses: ["Smalltalk"],
  23466. messageSends: ["at:put:", "settings", "key"]
  23467. }),
  23468. $globals.Setting);
  23469. $core.addMethod(
  23470. $core.method({
  23471. selector: "at:ifAbsent:",
  23472. protocol: "instance creation",
  23473. fn: function (aString,aDefaultValue){
  23474. var self=this,$self=this;
  23475. return $core.withContext(function($ctx1) {
  23476. var $1;
  23477. $1=(
  23478. $ctx1.supercall = true,
  23479. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  23480. $ctx1.supercall = false;
  23481. $recv($1)._key_(aString);
  23482. $recv($1)._defaultValue_(aDefaultValue);
  23483. return $recv($1)._yourself();
  23484. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  23485. },
  23486. args: ["aString", "aDefaultValue"],
  23487. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  23488. referencedClasses: [],
  23489. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  23490. }),
  23491. $globals.Setting.a$cls);
  23492. $core.addMethod(
  23493. $core.method({
  23494. selector: "new",
  23495. protocol: "instance creation",
  23496. fn: function (){
  23497. var self=this,$self=this;
  23498. return $core.withContext(function($ctx1) {
  23499. $self._shouldNotImplement();
  23500. return self;
  23501. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  23502. },
  23503. args: [],
  23504. source: "new\x0a\x09self shouldNotImplement",
  23505. referencedClasses: [],
  23506. messageSends: ["shouldNotImplement"]
  23507. }),
  23508. $globals.Setting.a$cls);
  23509. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  23510. $globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `$core` declared in `base/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 `base/parser.js` parser file in order to work.";
  23511. $core.addMethod(
  23512. $core.method({
  23513. selector: "addGlobalJsVariable:",
  23514. protocol: "globals",
  23515. fn: function (aString){
  23516. var self=this,$self=this;
  23517. return $core.withContext(function($ctx1) {
  23518. $recv($self._globalJsVariables())._add_(aString);
  23519. return self;
  23520. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23521. },
  23522. args: ["aString"],
  23523. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  23524. referencedClasses: [],
  23525. messageSends: ["add:", "globalJsVariables"]
  23526. }),
  23527. $globals.SmalltalkImage);
  23528. $core.addMethod(
  23529. $core.method({
  23530. selector: "adoptPackageDescriptors",
  23531. protocol: "private",
  23532. fn: function (){
  23533. var self=this,$self=this;
  23534. return $core.withContext(function($ctx1) {
  23535. return $self._tryAdoptPackageDescriptorsBeyond_($recv($globals.Set)._new());
  23536. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDescriptors",{},$globals.SmalltalkImage)});
  23537. },
  23538. args: [],
  23539. source: "adoptPackageDescriptors\x0a\x09^ self tryAdoptPackageDescriptorsBeyond: Set new",
  23540. referencedClasses: ["Set"],
  23541. messageSends: ["tryAdoptPackageDescriptorsBeyond:", "new"]
  23542. }),
  23543. $globals.SmalltalkImage);
  23544. $core.addMethod(
  23545. $core.method({
  23546. selector: "amdRequire",
  23547. protocol: "accessing amd",
  23548. fn: function (){
  23549. var self=this,$self=this;
  23550. return $core.withContext(function($ctx1) {
  23551. return $recv($self._core())._at_("amdRequire");
  23552. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  23553. },
  23554. args: [],
  23555. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  23556. referencedClasses: [],
  23557. messageSends: ["at:", "core"]
  23558. }),
  23559. $globals.SmalltalkImage);
  23560. $core.addMethod(
  23561. $core.method({
  23562. selector: "asSmalltalkException:",
  23563. protocol: "error handling",
  23564. fn: function (anObject){
  23565. var self=this,$self=this;
  23566. return $core.withContext(function($ctx1) {
  23567. var $1;
  23568. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  23569. return $core.withContext(function($ctx2) {
  23570. return $recv(anObject)._isKindOf_($globals.Error);
  23571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23572. }));
  23573. if($core.assert($1)){
  23574. return anObject;
  23575. } else {
  23576. return $recv($globals.JavaScriptException)._on_(anObject);
  23577. }
  23578. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  23579. },
  23580. args: ["anObject"],
  23581. 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 ]",
  23582. referencedClasses: ["Error", "JavaScriptException"],
  23583. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  23584. }),
  23585. $globals.SmalltalkImage);
  23586. $core.addMethod(
  23587. $core.method({
  23588. selector: "basicCreatePackage:",
  23589. protocol: "private",
  23590. fn: function (packageName){
  23591. var self=this,$self=this;
  23592. return $core.withContext(function($ctx1) {
  23593. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  23594. return $core.withContext(function($ctx2) {
  23595. return $recv($globals.Package)._new_(packageName);
  23596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23597. }));
  23598. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  23599. },
  23600. args: ["packageName"],
  23601. 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 ]",
  23602. referencedClasses: ["Package"],
  23603. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  23604. }),
  23605. $globals.SmalltalkImage);
  23606. $core.addMethod(
  23607. $core.method({
  23608. selector: "basicParse:",
  23609. protocol: "private",
  23610. fn: function (aString){
  23611. var self=this,$self=this;
  23612. return $core.withContext(function($ctx1) {
  23613. return $recv($globals.SmalltalkParser)._parse_(aString);
  23614. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  23615. },
  23616. args: ["aString"],
  23617. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  23618. referencedClasses: ["SmalltalkParser"],
  23619. messageSends: ["parse:"]
  23620. }),
  23621. $globals.SmalltalkImage);
  23622. $core.addMethod(
  23623. $core.method({
  23624. selector: "beClean",
  23625. protocol: "packages",
  23626. fn: function (){
  23627. var self=this,$self=this;
  23628. return $core.withContext(function($ctx1) {
  23629. $recv($self._packages())._do_("beClean");
  23630. return self;
  23631. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.SmalltalkImage)});
  23632. },
  23633. args: [],
  23634. source: "beClean\x0a\x09\x22Marks all packages clean.\x22\x0a\x0a\x09self packages do: #beClean",
  23635. referencedClasses: [],
  23636. messageSends: ["do:", "packages"]
  23637. }),
  23638. $globals.SmalltalkImage);
  23639. $core.addMethod(
  23640. $core.method({
  23641. selector: "cancelOptOut:",
  23642. protocol: "accessing",
  23643. fn: function (anObject){
  23644. var self=this,$self=this;
  23645. return $core.withContext(function($ctx1) {
  23646. delete anObject.a$cls;;
  23647. return self;
  23648. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23649. },
  23650. args: ["anObject"],
  23651. 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.a$cls;'>",
  23652. referencedClasses: [],
  23653. messageSends: []
  23654. }),
  23655. $globals.SmalltalkImage);
  23656. $core.addMethod(
  23657. $core.method({
  23658. selector: "classes",
  23659. protocol: "classes",
  23660. fn: function (){
  23661. var self=this,$self=this;
  23662. return $core.withContext(function($ctx1) {
  23663. return $recv($recv($self._core())._traitsOrClasses())._copy();
  23664. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  23665. },
  23666. args: [],
  23667. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  23668. referencedClasses: [],
  23669. messageSends: ["copy", "traitsOrClasses", "core"]
  23670. }),
  23671. $globals.SmalltalkImage);
  23672. $core.addMethod(
  23673. $core.method({
  23674. selector: "core",
  23675. protocol: "accessing",
  23676. fn: function (){
  23677. var self=this,$self=this;
  23678. return $core.withContext(function($ctx1) {
  23679. return $core;
  23680. return self;
  23681. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  23682. },
  23683. args: [],
  23684. source: "core\x0a\x09<inlineJS: 'return $core'>",
  23685. referencedClasses: [],
  23686. messageSends: []
  23687. }),
  23688. $globals.SmalltalkImage);
  23689. $core.addMethod(
  23690. $core.method({
  23691. selector: "createPackage:",
  23692. protocol: "packages",
  23693. fn: function (packageName){
  23694. var self=this,$self=this;
  23695. var package_,announcement;
  23696. return $core.withContext(function($ctx1) {
  23697. var $1;
  23698. package_=$self._basicCreatePackage_(packageName);
  23699. $1=$recv($globals.PackageAdded)._new();
  23700. $recv($1)._package_(package_);
  23701. announcement=$recv($1)._yourself();
  23702. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  23703. return package_;
  23704. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  23705. },
  23706. args: ["packageName"],
  23707. 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",
  23708. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  23709. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  23710. }),
  23711. $globals.SmalltalkImage);
  23712. $core.addMethod(
  23713. $core.method({
  23714. selector: "defaultAmdNamespace",
  23715. protocol: "accessing amd",
  23716. fn: function (){
  23717. var self=this,$self=this;
  23718. return $core.withContext(function($ctx1) {
  23719. return "transport.defaultAmdNamespace"._settingValue();
  23720. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  23721. },
  23722. args: [],
  23723. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  23724. referencedClasses: [],
  23725. messageSends: ["settingValue"]
  23726. }),
  23727. $globals.SmalltalkImage);
  23728. $core.addMethod(
  23729. $core.method({
  23730. selector: "defaultAmdNamespace:",
  23731. protocol: "accessing amd",
  23732. fn: function (aString){
  23733. var self=this,$self=this;
  23734. return $core.withContext(function($ctx1) {
  23735. "transport.defaultAmdNamespace"._settingValue_(aString);
  23736. return self;
  23737. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  23738. },
  23739. args: ["aString"],
  23740. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  23741. referencedClasses: [],
  23742. messageSends: ["settingValue:"]
  23743. }),
  23744. $globals.SmalltalkImage);
  23745. $core.addMethod(
  23746. $core.method({
  23747. selector: "deleteClass:",
  23748. protocol: "private",
  23749. fn: function (aClass){
  23750. var self=this,$self=this;
  23751. return $core.withContext(function($ctx1) {
  23752. $core.removeClass(aClass);
  23753. return self;
  23754. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23755. },
  23756. args: ["aClass"],
  23757. 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)'>",
  23758. referencedClasses: [],
  23759. messageSends: []
  23760. }),
  23761. $globals.SmalltalkImage);
  23762. $core.addMethod(
  23763. $core.method({
  23764. selector: "deleteGlobalJsVariable:",
  23765. protocol: "globals",
  23766. fn: function (aString){
  23767. var self=this,$self=this;
  23768. return $core.withContext(function($ctx1) {
  23769. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  23770. }));
  23771. return self;
  23772. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23773. },
  23774. args: ["aString"],
  23775. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  23776. referencedClasses: [],
  23777. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  23778. }),
  23779. $globals.SmalltalkImage);
  23780. $core.addMethod(
  23781. $core.method({
  23782. selector: "existsJsGlobal:",
  23783. protocol: "testing",
  23784. fn: function (aString){
  23785. var self=this,$self=this;
  23786. return $core.withContext(function($ctx1) {
  23787. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  23788. return $recv($globals.Platform)._includesGlobal_(aString);
  23789. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  23790. },
  23791. args: ["aString"],
  23792. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  23793. referencedClasses: ["Platform"],
  23794. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  23795. }),
  23796. $globals.SmalltalkImage);
  23797. $core.addMethod(
  23798. $core.method({
  23799. selector: "globalJsVariables",
  23800. protocol: "globals",
  23801. fn: function (){
  23802. var self=this,$self=this;
  23803. return $core.withContext(function($ctx1) {
  23804. var $1,$receiver;
  23805. $1=$self.globalJsVariables;
  23806. if(($receiver = $1) == null || $receiver.a$nil){
  23807. $self.globalJsVariables=["window", "document", "process", "global"];
  23808. return $self.globalJsVariables;
  23809. } else {
  23810. return $1;
  23811. }
  23812. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  23813. },
  23814. args: [],
  23815. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  23816. referencedClasses: [],
  23817. messageSends: ["ifNil:"]
  23818. }),
  23819. $globals.SmalltalkImage);
  23820. $core.addMethod(
  23821. $core.method({
  23822. selector: "globals",
  23823. protocol: "accessing",
  23824. fn: function (){
  23825. var self=this,$self=this;
  23826. return $core.withContext(function($ctx1) {
  23827. return $globals;
  23828. return self;
  23829. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  23830. },
  23831. args: [],
  23832. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  23833. referencedClasses: [],
  23834. messageSends: []
  23835. }),
  23836. $globals.SmalltalkImage);
  23837. $core.addMethod(
  23838. $core.method({
  23839. selector: "includesKey:",
  23840. protocol: "accessing",
  23841. fn: function (aKey){
  23842. var self=this,$self=this;
  23843. return $core.withContext(function($ctx1) {
  23844. return $core.hasOwnProperty(aKey);
  23845. return self;
  23846. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  23847. },
  23848. args: ["aKey"],
  23849. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  23850. referencedClasses: [],
  23851. messageSends: []
  23852. }),
  23853. $globals.SmalltalkImage);
  23854. $core.addMethod(
  23855. $core.method({
  23856. selector: "isSmalltalkObject:",
  23857. protocol: "testing",
  23858. fn: function (anObject){
  23859. var self=this,$self=this;
  23860. return $core.withContext(function($ctx1) {
  23861. return anObject.a$cls != null;
  23862. return self;
  23863. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23864. },
  23865. args: ["anObject"],
  23866. 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'>",
  23867. referencedClasses: [],
  23868. messageSends: []
  23869. }),
  23870. $globals.SmalltalkImage);
  23871. $core.addMethod(
  23872. $core.method({
  23873. selector: "optOut:",
  23874. protocol: "accessing",
  23875. fn: function (anObject){
  23876. var self=this,$self=this;
  23877. return $core.withContext(function($ctx1) {
  23878. anObject.a$cls = null;
  23879. return self;
  23880. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23881. },
  23882. args: ["anObject"],
  23883. 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.a$cls = null'>",
  23884. referencedClasses: [],
  23885. messageSends: []
  23886. }),
  23887. $globals.SmalltalkImage);
  23888. $core.addMethod(
  23889. $core.method({
  23890. selector: "packageAt:ifAbsent:",
  23891. protocol: "packages",
  23892. fn: function (packageName,aBlock){
  23893. var self=this,$self=this;
  23894. return $core.withContext(function($ctx1) {
  23895. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  23896. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23897. },
  23898. args: ["packageName", "aBlock"],
  23899. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  23900. referencedClasses: [],
  23901. messageSends: ["at:ifAbsent:", "packageDictionary"]
  23902. }),
  23903. $globals.SmalltalkImage);
  23904. $core.addMethod(
  23905. $core.method({
  23906. selector: "packageAt:ifPresent:",
  23907. protocol: "packages",
  23908. fn: function (packageName,aBlock){
  23909. var self=this,$self=this;
  23910. return $core.withContext(function($ctx1) {
  23911. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  23912. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23913. },
  23914. args: ["packageName", "aBlock"],
  23915. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  23916. referencedClasses: [],
  23917. messageSends: ["at:ifPresent:", "packageDictionary"]
  23918. }),
  23919. $globals.SmalltalkImage);
  23920. $core.addMethod(
  23921. $core.method({
  23922. selector: "packageDictionary",
  23923. protocol: "packages",
  23924. fn: function (){
  23925. var self=this,$self=this;
  23926. return $core.withContext(function($ctx1) {
  23927. var $1,$receiver;
  23928. $1=$self.packageDictionary;
  23929. if(($receiver = $1) == null || $receiver.a$nil){
  23930. $self.packageDictionary=$recv($globals.Dictionary)._new();
  23931. return $self.packageDictionary;
  23932. } else {
  23933. return $1;
  23934. }
  23935. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  23936. },
  23937. args: [],
  23938. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  23939. referencedClasses: ["Dictionary"],
  23940. messageSends: ["ifNil:", "new"]
  23941. }),
  23942. $globals.SmalltalkImage);
  23943. $core.addMethod(
  23944. $core.method({
  23945. selector: "packages",
  23946. protocol: "packages",
  23947. fn: function (){
  23948. var self=this,$self=this;
  23949. return $core.withContext(function($ctx1) {
  23950. return $recv($recv($self._packageDictionary())._values())._copy();
  23951. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  23952. },
  23953. args: [],
  23954. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  23955. referencedClasses: [],
  23956. messageSends: ["copy", "values", "packageDictionary"]
  23957. }),
  23958. $globals.SmalltalkImage);
  23959. $core.addMethod(
  23960. $core.method({
  23961. selector: "parse:",
  23962. protocol: "accessing",
  23963. fn: function (aString){
  23964. var self=this,$self=this;
  23965. var result;
  23966. return $core.withContext(function($ctx1) {
  23967. var $1;
  23968. $recv((function(){
  23969. return $core.withContext(function($ctx2) {
  23970. result=$self._basicParse_(aString);
  23971. return result;
  23972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23973. }))._tryCatch_((function(ex){
  23974. return $core.withContext(function($ctx2) {
  23975. return $recv($self._parseError_parsing_(ex,aString))._signal();
  23976. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  23977. }));
  23978. $1=result;
  23979. $recv($1)._source_(aString);
  23980. return $recv($1)._yourself();
  23981. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  23982. },
  23983. args: ["aString"],
  23984. 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",
  23985. referencedClasses: [],
  23986. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  23987. }),
  23988. $globals.SmalltalkImage);
  23989. $core.addMethod(
  23990. $core.method({
  23991. selector: "parseError:parsing:",
  23992. protocol: "error handling",
  23993. fn: function (anException,aString){
  23994. var self=this,$self=this;
  23995. return $core.withContext(function($ctx1) {
  23996. var $1,$2,$9,$8,$7,$6,$5,$4,$3,$receiver;
  23997. $1=$recv(anException)._basicAt_("location");
  23998. $ctx1.sendIdx["basicAt:"]=1;
  23999. if(($receiver = $1) == null || $receiver.a$nil){
  24000. return $recv(anException)._pass();
  24001. } else {
  24002. var loc;
  24003. loc=$receiver;
  24004. $2=$recv($globals.ParseError)._new();
  24005. $9=$recv(loc)._start();
  24006. $ctx1.sendIdx["start"]=1;
  24007. $8=$recv($9)._line();
  24008. $7="Parse error on line ".__comma($8);
  24009. $6=$recv($7).__comma(" column ");
  24010. $ctx1.sendIdx[","]=4;
  24011. $5=$recv($6).__comma($recv($recv(loc)._start())._column());
  24012. $ctx1.sendIdx[","]=3;
  24013. $4=$recv($5).__comma(" : Unexpected character ");
  24014. $ctx1.sendIdx[","]=2;
  24015. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  24016. $ctx1.sendIdx[","]=1;
  24017. $recv($2)._messageText_($3);
  24018. return $recv($2)._yourself();
  24019. }
  24020. return self;
  24021. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  24022. },
  24023. args: ["anException", "aString"],
  24024. source: "parseError: anException parsing: aString\x0a\x09(anException basicAt: 'location')\x0a\x09\x09ifNil: [ ^ anException pass ]\x0a\x09\x09ifNotNil: [ :loc |\x0a\x09\x09\x09^ ParseError new \x0a\x09\x09\x09\x09messageText: \x0a\x09\x09\x09\x09\x09'Parse error on line ', loc start line ,\x0a\x09\x09\x09\x09\x09' column ' , loc start column ,\x0a\x09\x09\x09\x09\x09' : Unexpected character ', (anException basicAt: 'found');\x0a\x09\x09\x09\x09yourself ]",
  24025. referencedClasses: ["ParseError"],
  24026. messageSends: ["ifNil:ifNotNil:", "basicAt:", "pass", "messageText:", "new", ",", "line", "start", "column", "yourself"]
  24027. }),
  24028. $globals.SmalltalkImage);
  24029. $core.addMethod(
  24030. $core.method({
  24031. selector: "postLoad",
  24032. protocol: "image",
  24033. fn: function (){
  24034. var self=this,$self=this;
  24035. return $core.withContext(function($ctx1) {
  24036. var $1;
  24037. return $recv($self._adoptPackageDescriptors())._then_((function(pkgs){
  24038. var classes;
  24039. return $core.withContext(function($ctx2) {
  24040. $recv(pkgs)._do_("beClean");
  24041. $ctx2.sendIdx["do:"]=1;
  24042. classes=$recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  24043. return $core.withContext(function($ctx3) {
  24044. return $recv(pkgs)._includes_($recv(each)._package());
  24045. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  24046. }));
  24047. $recv(classes)._do_((function(each){
  24048. return $core.withContext(function($ctx3) {
  24049. $1=$recv(each).__eq($self._class());
  24050. if(!$core.assert($1)){
  24051. return $recv(each)._initialize();
  24052. }
  24053. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  24054. }));
  24055. return $self._sweepPackageDescriptors_(pkgs);
  24056. }, function($ctx2) {$ctx2.fillBlock({pkgs:pkgs,classes:classes},$ctx1,1)});
  24057. }));
  24058. }, function($ctx1) {$ctx1.fill(self,"postLoad",{},$globals.SmalltalkImage)});
  24059. },
  24060. args: [],
  24061. source: "postLoad\x0a\x09^ self adoptPackageDescriptors then: [ :pkgs |\x0a\x09\x09| classes |\x0a\x09\x09pkgs do: #beClean.\x0a\x09\x09classes := Smalltalk classes select:\x0a\x09\x09\x09[ :each | pkgs includes: each package ].\x0a\x09\x09classes do: [ :each |\x0a\x09\x09\x09each = self class ifFalse: [ each initialize ] ].\x0a\x09\x09self sweepPackageDescriptors: pkgs ]",
  24062. referencedClasses: ["Smalltalk"],
  24063. messageSends: ["then:", "adoptPackageDescriptors", "do:", "select:", "classes", "includes:", "package", "ifFalse:", "=", "class", "initialize", "sweepPackageDescriptors:"]
  24064. }),
  24065. $globals.SmalltalkImage);
  24066. $core.addMethod(
  24067. $core.method({
  24068. selector: "pseudoVariableNames",
  24069. protocol: "accessing",
  24070. fn: function (){
  24071. var self=this,$self=this;
  24072. return ["self", "super", "nil", "true", "false", "thisContext"];
  24073. },
  24074. args: [],
  24075. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  24076. referencedClasses: [],
  24077. messageSends: []
  24078. }),
  24079. $globals.SmalltalkImage);
  24080. $core.addMethod(
  24081. $core.method({
  24082. selector: "readJSObject:",
  24083. protocol: "accessing",
  24084. fn: function (anObject){
  24085. var self=this,$self=this;
  24086. return $core.withContext(function($ctx1) {
  24087. return $core.readJSObject(anObject);
  24088. return self;
  24089. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  24090. },
  24091. args: ["anObject"],
  24092. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  24093. referencedClasses: [],
  24094. messageSends: []
  24095. }),
  24096. $globals.SmalltalkImage);
  24097. $core.addMethod(
  24098. $core.method({
  24099. selector: "removeClass:",
  24100. protocol: "classes",
  24101. fn: function (aClass){
  24102. var self=this,$self=this;
  24103. return $core.withContext(function($ctx1) {
  24104. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  24105. $1=$recv(aClass)._isMetaclass();
  24106. if($core.assert($1)){
  24107. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  24108. $ctx1.sendIdx[","]=1;
  24109. $self._error_($2);
  24110. $ctx1.sendIdx["error:"]=1;
  24111. }
  24112. $recv(aClass)._allSubclassesDo_((function(subclass){
  24113. return $core.withContext(function($ctx2) {
  24114. $5=$recv(aClass)._name();
  24115. $ctx2.sendIdx["name"]=1;
  24116. $4=$recv($5).__comma(" has a subclass: ");
  24117. $ctx2.sendIdx[","]=3;
  24118. $6=$recv(subclass)._name();
  24119. $ctx2.sendIdx["name"]=2;
  24120. $3=$recv($4).__comma($6);
  24121. $ctx2.sendIdx[","]=2;
  24122. return $self._error_($3);
  24123. $ctx2.sendIdx["error:"]=2;
  24124. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  24125. }));
  24126. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  24127. return $core.withContext(function($ctx2) {
  24128. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  24129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  24130. }));
  24131. $self._deleteClass_(aClass);
  24132. $recv(aClass)._setTraitComposition_([]);
  24133. $ctx1.sendIdx["setTraitComposition:"]=1;
  24134. $7=$recv(aClass)._theMetaClass();
  24135. if(($receiver = $7) == null || $receiver.a$nil){
  24136. $7;
  24137. } else {
  24138. var meta;
  24139. meta=$receiver;
  24140. $recv(meta)._setTraitComposition_([]);
  24141. }
  24142. $8=$recv($globals.SystemAnnouncer)._current();
  24143. $10=$recv($globals.ClassRemoved)._new();
  24144. $recv($10)._theClass_(aClass);
  24145. $9=$recv($10)._yourself();
  24146. $recv($8)._announce_($9);
  24147. return self;
  24148. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  24149. },
  24150. args: ["aClass"],
  24151. 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)",
  24152. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  24153. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  24154. }),
  24155. $globals.SmalltalkImage);
  24156. $core.addMethod(
  24157. $core.method({
  24158. selector: "removePackage:",
  24159. protocol: "packages",
  24160. fn: function (packageName){
  24161. var self=this,$self=this;
  24162. var pkg;
  24163. return $core.withContext(function($ctx1) {
  24164. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  24165. return $core.withContext(function($ctx2) {
  24166. return $self._error_("Missing package: ".__comma(packageName));
  24167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  24168. }));
  24169. $recv($recv(pkg)._classes())._do_((function(each){
  24170. return $core.withContext(function($ctx2) {
  24171. return $self._removeClass_(each);
  24172. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  24173. }));
  24174. $recv($self._packageDictionary())._removeKey_(packageName);
  24175. return self;
  24176. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  24177. },
  24178. args: ["packageName"],
  24179. 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",
  24180. referencedClasses: [],
  24181. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  24182. }),
  24183. $globals.SmalltalkImage);
  24184. $core.addMethod(
  24185. $core.method({
  24186. selector: "renamePackage:to:",
  24187. protocol: "packages",
  24188. fn: function (packageName,newName){
  24189. var self=this,$self=this;
  24190. var pkg;
  24191. return $core.withContext(function($ctx1) {
  24192. var $1,$2,$3;
  24193. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  24194. return $core.withContext(function($ctx2) {
  24195. $1="Missing package: ".__comma(packageName);
  24196. $ctx2.sendIdx[","]=1;
  24197. return $self._error_($1);
  24198. $ctx2.sendIdx["error:"]=1;
  24199. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  24200. }));
  24201. $self._packageAt_ifPresent_(newName,(function(){
  24202. return $core.withContext(function($ctx2) {
  24203. return $self._error_("Already exists a package called: ".__comma(newName));
  24204. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  24205. }));
  24206. $2=pkg;
  24207. $recv($2)._name_(newName);
  24208. $recv($2)._beDirty();
  24209. $3=$self._packageDictionary();
  24210. $recv($3)._at_put_(newName,pkg);
  24211. $recv($3)._removeKey_(packageName);
  24212. return self;
  24213. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  24214. },
  24215. args: ["packageName", "newName"],
  24216. 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",
  24217. referencedClasses: [],
  24218. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  24219. }),
  24220. $globals.SmalltalkImage);
  24221. $core.addMethod(
  24222. $core.method({
  24223. selector: "reservedWords",
  24224. protocol: "accessing",
  24225. fn: function (){
  24226. var self=this,$self=this;
  24227. 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"];
  24228. },
  24229. args: [],
  24230. 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)",
  24231. referencedClasses: [],
  24232. messageSends: []
  24233. }),
  24234. $globals.SmalltalkImage);
  24235. $core.addMethod(
  24236. $core.method({
  24237. selector: "settings",
  24238. protocol: "accessing",
  24239. fn: function (){
  24240. var self=this,$self=this;
  24241. return $globals.SmalltalkSettings;
  24242. },
  24243. args: [],
  24244. source: "settings\x0a\x09^ SmalltalkSettings",
  24245. referencedClasses: ["SmalltalkSettings"],
  24246. messageSends: []
  24247. }),
  24248. $globals.SmalltalkImage);
  24249. $core.addMethod(
  24250. $core.method({
  24251. selector: "sweepPackageDescriptors:",
  24252. protocol: "private",
  24253. fn: function (pkgs){
  24254. var self=this,$self=this;
  24255. var pd;
  24256. return $core.withContext(function($ctx1) {
  24257. pd=$recv($self._core())._packageDescriptors();
  24258. $recv(pkgs)._do_((function(each){
  24259. return $core.withContext(function($ctx2) {
  24260. return $recv(pd)._removeKey_($recv(each)._name());
  24261. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24262. }));
  24263. return self;
  24264. }, function($ctx1) {$ctx1.fill(self,"sweepPackageDescriptors:",{pkgs:pkgs,pd:pd},$globals.SmalltalkImage)});
  24265. },
  24266. args: ["pkgs"],
  24267. source: "sweepPackageDescriptors: pkgs\x0a\x09| pd |\x09\x0a\x09pd := self core packageDescriptors.\x0a\x09pkgs do: [ :each | pd removeKey: each name ]",
  24268. referencedClasses: [],
  24269. messageSends: ["packageDescriptors", "core", "do:", "removeKey:", "name"]
  24270. }),
  24271. $globals.SmalltalkImage);
  24272. $core.addMethod(
  24273. $core.method({
  24274. selector: "tryAdoptPackageDescriptorsBeyond:",
  24275. protocol: "private",
  24276. fn: function (aSet){
  24277. var self=this,$self=this;
  24278. var original;
  24279. return $core.withContext(function($ctx1) {
  24280. var $1;
  24281. original=$recv(aSet)._copy();
  24282. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  24283. return $core.withContext(function($ctx2) {
  24284. return $recv(aSet)._add_($recv($globals.Package)._named_javaScriptDescriptor_(key,value));
  24285. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  24286. }));
  24287. $1=$recv(aSet)._allSatisfy_((function(each){
  24288. return $core.withContext(function($ctx2) {
  24289. return $recv(original)._includes_(each);
  24290. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  24291. }));
  24292. if($core.assert($1)){
  24293. return $recv($globals.Promise)._value_(aSet);
  24294. } else {
  24295. return $recv($recv($globals.Promise)._all_($recv(aSet)._collect_("isReady")))._then_((function(){
  24296. return $core.withContext(function($ctx2) {
  24297. return $self._tryAdoptPackageDescriptorsBeyond_(aSet);
  24298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  24299. }));
  24300. }
  24301. }, function($ctx1) {$ctx1.fill(self,"tryAdoptPackageDescriptorsBeyond:",{aSet:aSet,original:original},$globals.SmalltalkImage)});
  24302. },
  24303. args: ["aSet"],
  24304. source: "tryAdoptPackageDescriptorsBeyond: aSet\x0a\x09| original |\x0a\x09original := aSet copy.\x0a\x09self core packageDescriptors keysAndValuesDo: [ :key :value |\x0a\x09\x09aSet add: (Package named: key javaScriptDescriptor: value) ].\x0a\x09^ (aSet allSatisfy: [ :each | original includes: each ])\x0a\x09\x09ifFalse: [ (Promise all: (aSet collect: #isReady)) then: [ self tryAdoptPackageDescriptorsBeyond: aSet ] ]\x0a\x09\x09ifTrue: [ Promise value: aSet ]",
  24305. referencedClasses: ["Package", "Promise"],
  24306. messageSends: ["copy", "keysAndValuesDo:", "packageDescriptors", "core", "add:", "named:javaScriptDescriptor:", "ifFalse:ifTrue:", "allSatisfy:", "includes:", "then:", "all:", "collect:", "tryAdoptPackageDescriptorsBeyond:", "value:"]
  24307. }),
  24308. $globals.SmalltalkImage);
  24309. $core.addMethod(
  24310. $core.method({
  24311. selector: "version",
  24312. protocol: "accessing",
  24313. fn: function (){
  24314. var self=this,$self=this;
  24315. return "0.23.0";
  24316. },
  24317. args: [],
  24318. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.23.0'",
  24319. referencedClasses: [],
  24320. messageSends: []
  24321. }),
  24322. $globals.SmalltalkImage);
  24323. $core.setSlots($globals.SmalltalkImage.a$cls, ["current"]);
  24324. $core.addMethod(
  24325. $core.method({
  24326. selector: "current",
  24327. protocol: "instance creation",
  24328. fn: function (){
  24329. var self=this,$self=this;
  24330. return $core.withContext(function($ctx1) {
  24331. var $1,$receiver;
  24332. $1=$self.current;
  24333. if(($receiver = $1) == null || $receiver.a$nil){
  24334. $self.current=(
  24335. $ctx1.supercall = true,
  24336. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24337. $ctx1.supercall = false;
  24338. return $self.current;
  24339. } else {
  24340. $self._deprecatedAPI();
  24341. return $self.current;
  24342. }
  24343. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  24344. },
  24345. args: [],
  24346. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  24347. referencedClasses: [],
  24348. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  24349. }),
  24350. $globals.SmalltalkImage.a$cls);
  24351. $core.addMethod(
  24352. $core.method({
  24353. selector: "initialize",
  24354. protocol: "initialization",
  24355. fn: function (){
  24356. var self=this,$self=this;
  24357. var st;
  24358. return $core.withContext(function($ctx1) {
  24359. st=$self._current();
  24360. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  24361. return self;
  24362. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  24363. },
  24364. args: [],
  24365. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  24366. referencedClasses: [],
  24367. messageSends: ["current", "at:put:", "globals"]
  24368. }),
  24369. $globals.SmalltalkImage.a$cls);
  24370. $core.addMethod(
  24371. $core.method({
  24372. selector: "new",
  24373. protocol: "instance creation",
  24374. fn: function (){
  24375. var self=this,$self=this;
  24376. return $core.withContext(function($ctx1) {
  24377. $self._shouldNotImplement();
  24378. return self;
  24379. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  24380. },
  24381. args: [],
  24382. source: "new\x0a\x09self shouldNotImplement",
  24383. referencedClasses: [],
  24384. messageSends: ["shouldNotImplement"]
  24385. }),
  24386. $globals.SmalltalkImage.a$cls);
  24387. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  24388. $core.addMethod(
  24389. $core.method({
  24390. selector: "nextPutJSObject:",
  24391. protocol: "*Kernel-Infrastructure",
  24392. fn: function (aJSObject){
  24393. var self=this,$self=this;
  24394. return $core.withContext(function($ctx1) {
  24395. $self._nextPut_(aJSObject);
  24396. return self;
  24397. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  24398. },
  24399. args: ["aJSObject"],
  24400. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  24401. referencedClasses: [],
  24402. messageSends: ["nextPut:"]
  24403. }),
  24404. $globals.ProtoStream);
  24405. $core.addMethod(
  24406. $core.method({
  24407. selector: "asJavaScriptPropertyName",
  24408. protocol: "*Kernel-Infrastructure",
  24409. fn: function (){
  24410. var self=this,$self=this;
  24411. return $core.withContext(function($ctx1) {
  24412. return $core.st2prop(self);
  24413. return self;
  24414. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  24415. },
  24416. args: [],
  24417. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  24418. referencedClasses: [],
  24419. messageSends: []
  24420. }),
  24421. $globals.String);
  24422. $core.addMethod(
  24423. $core.method({
  24424. selector: "asSetting",
  24425. protocol: "*Kernel-Infrastructure",
  24426. fn: function (){
  24427. var self=this,$self=this;
  24428. return $core.withContext(function($ctx1) {
  24429. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  24430. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  24431. },
  24432. args: [],
  24433. 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",
  24434. referencedClasses: ["Setting"],
  24435. messageSends: ["at:ifAbsent:"]
  24436. }),
  24437. $globals.String);
  24438. $core.addMethod(
  24439. $core.method({
  24440. selector: "asSettingIfAbsent:",
  24441. protocol: "*Kernel-Infrastructure",
  24442. fn: function (aDefaultValue){
  24443. var self=this,$self=this;
  24444. return $core.withContext(function($ctx1) {
  24445. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  24446. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24447. },
  24448. args: ["aDefaultValue"],
  24449. 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",
  24450. referencedClasses: ["Setting"],
  24451. messageSends: ["at:ifAbsent:"]
  24452. }),
  24453. $globals.String);
  24454. $core.addMethod(
  24455. $core.method({
  24456. selector: "settingValue",
  24457. protocol: "*Kernel-Infrastructure",
  24458. fn: function (){
  24459. var self=this,$self=this;
  24460. return $core.withContext(function($ctx1) {
  24461. return $recv($self._asSetting())._value();
  24462. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  24463. },
  24464. args: [],
  24465. source: "settingValue\x0a\x09^ self asSetting value",
  24466. referencedClasses: [],
  24467. messageSends: ["value", "asSetting"]
  24468. }),
  24469. $globals.String);
  24470. $core.addMethod(
  24471. $core.method({
  24472. selector: "settingValue:",
  24473. protocol: "*Kernel-Infrastructure",
  24474. fn: function (aValue){
  24475. var self=this,$self=this;
  24476. return $core.withContext(function($ctx1) {
  24477. return $recv($self._asSetting())._value_(aValue);
  24478. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  24479. },
  24480. args: ["aValue"],
  24481. 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",
  24482. referencedClasses: [],
  24483. messageSends: ["value:", "asSetting"]
  24484. }),
  24485. $globals.String);
  24486. $core.addMethod(
  24487. $core.method({
  24488. selector: "settingValueIfAbsent:",
  24489. protocol: "*Kernel-Infrastructure",
  24490. fn: function (aDefaultValue){
  24491. var self=this,$self=this;
  24492. return $core.withContext(function($ctx1) {
  24493. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  24494. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24495. },
  24496. args: ["aDefaultValue"],
  24497. 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",
  24498. referencedClasses: [],
  24499. messageSends: ["value", "asSettingIfAbsent:"]
  24500. }),
  24501. $globals.String);
  24502. });
  24503. define('amber/core/Kernel-Announcements',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  24504. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24505. var $pkg = $core.addPackage("Kernel-Announcements");
  24506. $pkg.innerEval = function (expr) { return eval(expr); };
  24507. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  24508. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  24509. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  24510. $core.addMethod(
  24511. $core.method({
  24512. selector: "announcementClass",
  24513. protocol: "accessing",
  24514. fn: function (){
  24515. var self=this,$self=this;
  24516. return $self.announcementClass;
  24517. },
  24518. args: [],
  24519. source: "announcementClass\x0a\x09^ announcementClass",
  24520. referencedClasses: [],
  24521. messageSends: []
  24522. }),
  24523. $globals.AnnouncementSubscription);
  24524. $core.addMethod(
  24525. $core.method({
  24526. selector: "announcementClass:",
  24527. protocol: "accessing",
  24528. fn: function (aClass){
  24529. var self=this,$self=this;
  24530. return $core.withContext(function($ctx1) {
  24531. $self.announcementClass=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aClass)._name());
  24532. return self;
  24533. }, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass},$globals.AnnouncementSubscription)});
  24534. },
  24535. args: ["aClass"],
  24536. source: "announcementClass: aClass\x0a\x09announcementClass := Smalltalk globals at: aClass name",
  24537. referencedClasses: ["Smalltalk"],
  24538. messageSends: ["at:", "globals", "name"]
  24539. }),
  24540. $globals.AnnouncementSubscription);
  24541. $core.addMethod(
  24542. $core.method({
  24543. selector: "deliver:",
  24544. protocol: "announcing",
  24545. fn: function (anAnnouncement){
  24546. var self=this,$self=this;
  24547. return $core.withContext(function($ctx1) {
  24548. var $1;
  24549. $1=$self._handlesAnnouncement_(anAnnouncement);
  24550. if($core.assert($1)){
  24551. $recv($self._valuable())._value_(anAnnouncement);
  24552. }
  24553. return self;
  24554. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24555. },
  24556. args: ["anAnnouncement"],
  24557. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  24558. referencedClasses: [],
  24559. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  24560. }),
  24561. $globals.AnnouncementSubscription);
  24562. $core.addMethod(
  24563. $core.method({
  24564. selector: "handlesAnnouncement:",
  24565. protocol: "announcing",
  24566. fn: function (anAnnouncement){
  24567. var self=this,$self=this;
  24568. return $core.withContext(function($ctx1) {
  24569. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(anAnnouncement)._class())._name()))._includesBehavior_($self._announcementClass());
  24570. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24571. },
  24572. args: ["anAnnouncement"],
  24573. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: anAnnouncement class name) includesBehavior: self announcementClass",
  24574. referencedClasses: ["Smalltalk"],
  24575. messageSends: ["includesBehavior:", "at:", "globals", "name", "class", "announcementClass"]
  24576. }),
  24577. $globals.AnnouncementSubscription);
  24578. $core.addMethod(
  24579. $core.method({
  24580. selector: "receiver",
  24581. protocol: "accessing",
  24582. fn: function (){
  24583. var self=this,$self=this;
  24584. return $core.withContext(function($ctx1) {
  24585. return $recv($self._valuable())._receiver();
  24586. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  24587. },
  24588. args: [],
  24589. source: "receiver\x0a\x09^ self valuable receiver",
  24590. referencedClasses: [],
  24591. messageSends: ["receiver", "valuable"]
  24592. }),
  24593. $globals.AnnouncementSubscription);
  24594. $core.addMethod(
  24595. $core.method({
  24596. selector: "valuable",
  24597. protocol: "accessing",
  24598. fn: function (){
  24599. var self=this,$self=this;
  24600. return $self.valuable;
  24601. },
  24602. args: [],
  24603. source: "valuable\x0a\x09^ valuable",
  24604. referencedClasses: [],
  24605. messageSends: []
  24606. }),
  24607. $globals.AnnouncementSubscription);
  24608. $core.addMethod(
  24609. $core.method({
  24610. selector: "valuable:",
  24611. protocol: "accessing",
  24612. fn: function (aValuable){
  24613. var self=this,$self=this;
  24614. $self.valuable=aValuable;
  24615. return self;
  24616. },
  24617. args: ["aValuable"],
  24618. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  24619. referencedClasses: [],
  24620. messageSends: []
  24621. }),
  24622. $globals.AnnouncementSubscription);
  24623. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  24624. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  24625. $core.addMethod(
  24626. $core.method({
  24627. selector: "receiver",
  24628. protocol: "accessing",
  24629. fn: function (){
  24630. var self=this,$self=this;
  24631. return $self.receiver;
  24632. },
  24633. args: [],
  24634. source: "receiver\x0a\x09^ receiver",
  24635. referencedClasses: [],
  24636. messageSends: []
  24637. }),
  24638. $globals.AnnouncementValuable);
  24639. $core.addMethod(
  24640. $core.method({
  24641. selector: "receiver:",
  24642. protocol: "accessing",
  24643. fn: function (anObject){
  24644. var self=this,$self=this;
  24645. $self.receiver=anObject;
  24646. return self;
  24647. },
  24648. args: ["anObject"],
  24649. source: "receiver: anObject\x0a\x09receiver := anObject",
  24650. referencedClasses: [],
  24651. messageSends: []
  24652. }),
  24653. $globals.AnnouncementValuable);
  24654. $core.addMethod(
  24655. $core.method({
  24656. selector: "valuable",
  24657. protocol: "accessing",
  24658. fn: function (){
  24659. var self=this,$self=this;
  24660. return $self.valuable;
  24661. },
  24662. args: [],
  24663. source: "valuable\x0a\x09^ valuable",
  24664. referencedClasses: [],
  24665. messageSends: []
  24666. }),
  24667. $globals.AnnouncementValuable);
  24668. $core.addMethod(
  24669. $core.method({
  24670. selector: "valuable:",
  24671. protocol: "accessing",
  24672. fn: function (anObject){
  24673. var self=this,$self=this;
  24674. $self.valuable=anObject;
  24675. return self;
  24676. },
  24677. args: ["anObject"],
  24678. source: "valuable: anObject\x0a\x09valuable := anObject",
  24679. referencedClasses: [],
  24680. messageSends: []
  24681. }),
  24682. $globals.AnnouncementValuable);
  24683. $core.addMethod(
  24684. $core.method({
  24685. selector: "value",
  24686. protocol: "evaluating",
  24687. fn: function (){
  24688. var self=this,$self=this;
  24689. return $core.withContext(function($ctx1) {
  24690. return $recv($self._valuable())._value();
  24691. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  24692. },
  24693. args: [],
  24694. source: "value\x0a\x09^ self valuable value",
  24695. referencedClasses: [],
  24696. messageSends: ["value", "valuable"]
  24697. }),
  24698. $globals.AnnouncementValuable);
  24699. $core.addMethod(
  24700. $core.method({
  24701. selector: "value:",
  24702. protocol: "evaluating",
  24703. fn: function (anObject){
  24704. var self=this,$self=this;
  24705. return $core.withContext(function($ctx1) {
  24706. return $recv($self._valuable())._value_(anObject);
  24707. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  24708. },
  24709. args: ["anObject"],
  24710. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  24711. referencedClasses: [],
  24712. messageSends: ["value:", "valuable"]
  24713. }),
  24714. $globals.AnnouncementValuable);
  24715. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  24716. $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' ].";
  24717. $core.addMethod(
  24718. $core.method({
  24719. selector: "announce:",
  24720. protocol: "announcing",
  24721. fn: function (anAnnouncement){
  24722. var self=this,$self=this;
  24723. return $core.withContext(function($ctx1) {
  24724. $recv($self.subscriptions)._do_((function(each){
  24725. return $core.withContext(function($ctx2) {
  24726. return $recv(each)._deliver_(anAnnouncement);
  24727. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24728. }));
  24729. return self;
  24730. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  24731. },
  24732. args: ["anAnnouncement"],
  24733. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  24734. referencedClasses: [],
  24735. messageSends: ["do:", "deliver:"]
  24736. }),
  24737. $globals.Announcer);
  24738. $core.addMethod(
  24739. $core.method({
  24740. selector: "initialize",
  24741. protocol: "initialization",
  24742. fn: function (){
  24743. var self=this,$self=this;
  24744. return $core.withContext(function($ctx1) {
  24745. (
  24746. $ctx1.supercall = true,
  24747. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  24748. $ctx1.supercall = false;
  24749. $self.subscriptions=$recv($globals.OrderedCollection)._new();
  24750. return self;
  24751. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  24752. },
  24753. args: [],
  24754. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  24755. referencedClasses: ["OrderedCollection"],
  24756. messageSends: ["initialize", "new"]
  24757. }),
  24758. $globals.Announcer);
  24759. $core.addMethod(
  24760. $core.method({
  24761. selector: "on:do:",
  24762. protocol: "subscribing",
  24763. fn: function (aClass,aBlock){
  24764. var self=this,$self=this;
  24765. return $core.withContext(function($ctx1) {
  24766. $self._on_do_for_(aClass,aBlock,nil);
  24767. return self;
  24768. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  24769. },
  24770. args: ["aClass", "aBlock"],
  24771. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  24772. referencedClasses: [],
  24773. messageSends: ["on:do:for:"]
  24774. }),
  24775. $globals.Announcer);
  24776. $core.addMethod(
  24777. $core.method({
  24778. selector: "on:do:for:",
  24779. protocol: "subscribing",
  24780. fn: function (aClass,aBlock,aReceiver){
  24781. var self=this,$self=this;
  24782. return $core.withContext(function($ctx1) {
  24783. var $1,$3,$5,$6,$4,$2;
  24784. $1=$self.subscriptions;
  24785. $3=$recv($globals.AnnouncementSubscription)._new();
  24786. $ctx1.sendIdx["new"]=1;
  24787. $5=$recv($globals.AnnouncementValuable)._new();
  24788. $recv($5)._valuable_(aBlock);
  24789. $recv($5)._receiver_(aReceiver);
  24790. $6=$recv($5)._yourself();
  24791. $ctx1.sendIdx["yourself"]=1;
  24792. $4=$6;
  24793. $recv($3)._valuable_($4);
  24794. $ctx1.sendIdx["valuable:"]=1;
  24795. $recv($3)._announcementClass_(aClass);
  24796. $2=$recv($3)._yourself();
  24797. $recv($1)._add_($2);
  24798. return self;
  24799. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  24800. },
  24801. args: ["aClass", "aBlock", "aReceiver"],
  24802. 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)",
  24803. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  24804. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  24805. }),
  24806. $globals.Announcer);
  24807. $core.addMethod(
  24808. $core.method({
  24809. selector: "on:doOnce:",
  24810. protocol: "subscribing",
  24811. fn: function (aClass,aBlock){
  24812. var self=this,$self=this;
  24813. var subscription;
  24814. return $core.withContext(function($ctx1) {
  24815. var $1;
  24816. $1=$recv($globals.AnnouncementSubscription)._new();
  24817. $recv($1)._announcementClass_(aClass);
  24818. subscription=$recv($1)._yourself();
  24819. $recv(subscription)._valuable_((function(ann){
  24820. return $core.withContext(function($ctx2) {
  24821. $recv($self.subscriptions)._remove_(subscription);
  24822. return $recv(aBlock)._value_(ann);
  24823. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  24824. }));
  24825. $recv($self.subscriptions)._add_(subscription);
  24826. return self;
  24827. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  24828. },
  24829. args: ["aClass", "aBlock"],
  24830. 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",
  24831. referencedClasses: ["AnnouncementSubscription"],
  24832. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  24833. }),
  24834. $globals.Announcer);
  24835. $core.addMethod(
  24836. $core.method({
  24837. selector: "on:send:to:",
  24838. protocol: "subscribing",
  24839. fn: function (aClass,aSelector,anObject){
  24840. var self=this,$self=this;
  24841. return $core.withContext(function($ctx1) {
  24842. var $1,$3,$5,$6,$4,$2;
  24843. $1=$self.subscriptions;
  24844. $3=$recv($globals.AnnouncementSubscription)._new();
  24845. $ctx1.sendIdx["new"]=1;
  24846. $5=$recv($globals.MessageSend)._new();
  24847. $recv($5)._receiver_(anObject);
  24848. $recv($5)._selector_(aSelector);
  24849. $6=$recv($5)._yourself();
  24850. $ctx1.sendIdx["yourself"]=1;
  24851. $4=$6;
  24852. $recv($3)._valuable_($4);
  24853. $recv($3)._announcementClass_(aClass);
  24854. $2=$recv($3)._yourself();
  24855. $recv($1)._add_($2);
  24856. return self;
  24857. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  24858. },
  24859. args: ["aClass", "aSelector", "anObject"],
  24860. 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)",
  24861. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  24862. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  24863. }),
  24864. $globals.Announcer);
  24865. $core.addMethod(
  24866. $core.method({
  24867. selector: "unsubscribe:",
  24868. protocol: "subscribing",
  24869. fn: function (anObject){
  24870. var self=this,$self=this;
  24871. return $core.withContext(function($ctx1) {
  24872. $self.subscriptions=$recv($self.subscriptions)._reject_((function(each){
  24873. return $core.withContext(function($ctx2) {
  24874. return $recv($recv(each)._receiver()).__eq(anObject);
  24875. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24876. }));
  24877. return self;
  24878. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  24879. },
  24880. args: ["anObject"],
  24881. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  24882. referencedClasses: [],
  24883. messageSends: ["reject:", "=", "receiver"]
  24884. }),
  24885. $globals.Announcer);
  24886. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  24887. $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`";
  24888. $core.setSlots($globals.SystemAnnouncer.a$cls, ["current"]);
  24889. $core.addMethod(
  24890. $core.method({
  24891. selector: "current",
  24892. protocol: "accessing",
  24893. fn: function (){
  24894. var self=this,$self=this;
  24895. return $core.withContext(function($ctx1) {
  24896. var $1,$receiver;
  24897. $1=$self.current;
  24898. if(($receiver = $1) == null || $receiver.a$nil){
  24899. $self.current=(
  24900. $ctx1.supercall = true,
  24901. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24902. $ctx1.supercall = false;
  24903. return $self.current;
  24904. } else {
  24905. return $1;
  24906. }
  24907. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.a$cls)});
  24908. },
  24909. args: [],
  24910. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  24911. referencedClasses: [],
  24912. messageSends: ["ifNil:", "new"]
  24913. }),
  24914. $globals.SystemAnnouncer.a$cls);
  24915. $core.addMethod(
  24916. $core.method({
  24917. selector: "new",
  24918. protocol: "instance creation",
  24919. fn: function (){
  24920. var self=this,$self=this;
  24921. return $core.withContext(function($ctx1) {
  24922. $self._shouldNotImplement();
  24923. return self;
  24924. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.a$cls)});
  24925. },
  24926. args: [],
  24927. source: "new\x0a\x09self shouldNotImplement",
  24928. referencedClasses: [],
  24929. messageSends: ["shouldNotImplement"]
  24930. }),
  24931. $globals.SystemAnnouncer.a$cls);
  24932. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  24933. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  24934. $core.addMethod(
  24935. $core.method({
  24936. selector: "classTag",
  24937. protocol: "accessing",
  24938. fn: function (){
  24939. var self=this,$self=this;
  24940. return "announcement";
  24941. },
  24942. args: [],
  24943. 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'",
  24944. referencedClasses: [],
  24945. messageSends: []
  24946. }),
  24947. $globals.SystemAnnouncement.a$cls);
  24948. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  24949. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  24950. $core.addMethod(
  24951. $core.method({
  24952. selector: "theClass",
  24953. protocol: "accessing",
  24954. fn: function (){
  24955. var self=this,$self=this;
  24956. return $self.theClass;
  24957. },
  24958. args: [],
  24959. source: "theClass\x0a\x09^ theClass",
  24960. referencedClasses: [],
  24961. messageSends: []
  24962. }),
  24963. $globals.ClassAnnouncement);
  24964. $core.addMethod(
  24965. $core.method({
  24966. selector: "theClass:",
  24967. protocol: "accessing",
  24968. fn: function (aClass){
  24969. var self=this,$self=this;
  24970. $self.theClass=aClass;
  24971. return self;
  24972. },
  24973. args: ["aClass"],
  24974. source: "theClass: aClass\x0a\x09theClass := aClass",
  24975. referencedClasses: [],
  24976. messageSends: []
  24977. }),
  24978. $globals.ClassAnnouncement);
  24979. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24980. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  24981. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24982. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  24983. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24984. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  24985. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  24986. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  24987. $core.addMethod(
  24988. $core.method({
  24989. selector: "oldClass",
  24990. protocol: "accessing",
  24991. fn: function (){
  24992. var self=this,$self=this;
  24993. return $self.oldClass;
  24994. },
  24995. args: [],
  24996. source: "oldClass\x0a\x09^ oldClass",
  24997. referencedClasses: [],
  24998. messageSends: []
  24999. }),
  25000. $globals.ClassMigrated);
  25001. $core.addMethod(
  25002. $core.method({
  25003. selector: "oldClass:",
  25004. protocol: "accessing",
  25005. fn: function (aClass){
  25006. var self=this,$self=this;
  25007. $self.oldClass=aClass;
  25008. return self;
  25009. },
  25010. args: ["aClass"],
  25011. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  25012. referencedClasses: [],
  25013. messageSends: []
  25014. }),
  25015. $globals.ClassMigrated);
  25016. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  25017. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  25018. $core.addMethod(
  25019. $core.method({
  25020. selector: "oldPackage",
  25021. protocol: "accessing",
  25022. fn: function (){
  25023. var self=this,$self=this;
  25024. return $self.oldPackage;
  25025. },
  25026. args: [],
  25027. source: "oldPackage\x0a\x09^ oldPackage",
  25028. referencedClasses: [],
  25029. messageSends: []
  25030. }),
  25031. $globals.ClassMoved);
  25032. $core.addMethod(
  25033. $core.method({
  25034. selector: "oldPackage:",
  25035. protocol: "accessing",
  25036. fn: function (aPackage){
  25037. var self=this,$self=this;
  25038. $self.oldPackage=aPackage;
  25039. return self;
  25040. },
  25041. args: ["aPackage"],
  25042. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  25043. referencedClasses: [],
  25044. messageSends: []
  25045. }),
  25046. $globals.ClassMoved);
  25047. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  25048. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  25049. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  25050. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  25051. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  25052. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  25053. $core.addMethod(
  25054. $core.method({
  25055. selector: "method",
  25056. protocol: "accessing",
  25057. fn: function (){
  25058. var self=this,$self=this;
  25059. return $self.method;
  25060. },
  25061. args: [],
  25062. source: "method\x0a\x09^ method",
  25063. referencedClasses: [],
  25064. messageSends: []
  25065. }),
  25066. $globals.MethodAnnouncement);
  25067. $core.addMethod(
  25068. $core.method({
  25069. selector: "method:",
  25070. protocol: "accessing",
  25071. fn: function (aCompiledMethod){
  25072. var self=this,$self=this;
  25073. $self.method=aCompiledMethod;
  25074. return self;
  25075. },
  25076. args: ["aCompiledMethod"],
  25077. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  25078. referencedClasses: [],
  25079. messageSends: []
  25080. }),
  25081. $globals.MethodAnnouncement);
  25082. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  25083. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  25084. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  25085. $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.";
  25086. $core.addMethod(
  25087. $core.method({
  25088. selector: "oldMethod",
  25089. protocol: "accessing",
  25090. fn: function (){
  25091. var self=this,$self=this;
  25092. return $self.oldMethod;
  25093. },
  25094. args: [],
  25095. source: "oldMethod\x0a\x09^ oldMethod",
  25096. referencedClasses: [],
  25097. messageSends: []
  25098. }),
  25099. $globals.MethodModified);
  25100. $core.addMethod(
  25101. $core.method({
  25102. selector: "oldMethod:",
  25103. protocol: "accessing",
  25104. fn: function (aMethod){
  25105. var self=this,$self=this;
  25106. $self.oldMethod=aMethod;
  25107. return self;
  25108. },
  25109. args: ["aMethod"],
  25110. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  25111. referencedClasses: [],
  25112. messageSends: []
  25113. }),
  25114. $globals.MethodModified);
  25115. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  25116. $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.";
  25117. $core.addMethod(
  25118. $core.method({
  25119. selector: "oldProtocol",
  25120. protocol: "accessing",
  25121. fn: function (){
  25122. var self=this,$self=this;
  25123. return $self.oldProtocol;
  25124. },
  25125. args: [],
  25126. source: "oldProtocol\x0a\x09^ oldProtocol",
  25127. referencedClasses: [],
  25128. messageSends: []
  25129. }),
  25130. $globals.MethodMoved);
  25131. $core.addMethod(
  25132. $core.method({
  25133. selector: "oldProtocol:",
  25134. protocol: "accessing",
  25135. fn: function (aString){
  25136. var self=this,$self=this;
  25137. $self.oldProtocol=aString;
  25138. return self;
  25139. },
  25140. args: ["aString"],
  25141. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  25142. referencedClasses: [],
  25143. messageSends: []
  25144. }),
  25145. $globals.MethodMoved);
  25146. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  25147. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  25148. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  25149. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  25150. $core.addMethod(
  25151. $core.method({
  25152. selector: "package",
  25153. protocol: "accessing",
  25154. fn: function (){
  25155. var self=this,$self=this;
  25156. return $self.package;
  25157. },
  25158. args: [],
  25159. source: "package\x0a\x09^ package",
  25160. referencedClasses: [],
  25161. messageSends: []
  25162. }),
  25163. $globals.PackageAnnouncement);
  25164. $core.addMethod(
  25165. $core.method({
  25166. selector: "package:",
  25167. protocol: "accessing",
  25168. fn: function (aPackage){
  25169. var self=this,$self=this;
  25170. $self.package=aPackage;
  25171. return self;
  25172. },
  25173. args: ["aPackage"],
  25174. source: "package: aPackage\x0a\x09package := aPackage",
  25175. referencedClasses: [],
  25176. messageSends: []
  25177. }),
  25178. $globals.PackageAnnouncement);
  25179. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25180. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  25181. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25182. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  25183. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25184. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  25185. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25186. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  25187. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  25188. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  25189. $core.addMethod(
  25190. $core.method({
  25191. selector: "package",
  25192. protocol: "accessing",
  25193. fn: function (){
  25194. var self=this,$self=this;
  25195. return $core.withContext(function($ctx1) {
  25196. var $1,$receiver;
  25197. $1=$self._theClass();
  25198. if(($receiver = $1) == null || $receiver.a$nil){
  25199. return $1;
  25200. } else {
  25201. var class_;
  25202. class_=$receiver;
  25203. return $recv(class_)._packageOfProtocol_($self._protocol());
  25204. }
  25205. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  25206. },
  25207. args: [],
  25208. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  25209. referencedClasses: [],
  25210. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  25211. }),
  25212. $globals.ProtocolAnnouncement);
  25213. $core.addMethod(
  25214. $core.method({
  25215. selector: "protocol",
  25216. protocol: "accessing",
  25217. fn: function (){
  25218. var self=this,$self=this;
  25219. return $self.protocol;
  25220. },
  25221. args: [],
  25222. source: "protocol\x0a\x09^ protocol",
  25223. referencedClasses: [],
  25224. messageSends: []
  25225. }),
  25226. $globals.ProtocolAnnouncement);
  25227. $core.addMethod(
  25228. $core.method({
  25229. selector: "protocol:",
  25230. protocol: "accessing",
  25231. fn: function (aString){
  25232. var self=this,$self=this;
  25233. $self.protocol=aString;
  25234. return self;
  25235. },
  25236. args: ["aString"],
  25237. source: "protocol: aString\x0a\x09protocol := aString",
  25238. referencedClasses: [],
  25239. messageSends: []
  25240. }),
  25241. $globals.ProtocolAnnouncement);
  25242. $core.addMethod(
  25243. $core.method({
  25244. selector: "theClass",
  25245. protocol: "accessing",
  25246. fn: function (){
  25247. var self=this,$self=this;
  25248. return $self.theClass;
  25249. },
  25250. args: [],
  25251. source: "theClass\x0a\x09^ theClass",
  25252. referencedClasses: [],
  25253. messageSends: []
  25254. }),
  25255. $globals.ProtocolAnnouncement);
  25256. $core.addMethod(
  25257. $core.method({
  25258. selector: "theClass:",
  25259. protocol: "accessing",
  25260. fn: function (aClass){
  25261. var self=this,$self=this;
  25262. $self.theClass=aClass;
  25263. return self;
  25264. },
  25265. args: ["aClass"],
  25266. source: "theClass: aClass\x0a\x09theClass := aClass",
  25267. referencedClasses: [],
  25268. messageSends: []
  25269. }),
  25270. $globals.ProtocolAnnouncement);
  25271. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25272. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  25273. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25274. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  25275. });
  25276. define('amber/core/Platform-Services',["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Infrastructure", "amber/core/Kernel-Methods", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  25277. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  25278. var $pkg = $core.addPackage("Platform-Services");
  25279. $pkg.innerEval = function (expr) { return eval(expr); };
  25280. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  25281. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  25282. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  25283. $core.addMethod(
  25284. $core.method({
  25285. selector: "handleError:",
  25286. protocol: "error handling",
  25287. fn: function (anError){
  25288. var self=this,$self=this;
  25289. return $core.withContext(function($ctx1) {
  25290. var $1,$receiver;
  25291. $1=$recv(anError)._context();
  25292. $ctx1.sendIdx["context"]=1;
  25293. if(($receiver = $1) == null || $receiver.a$nil){
  25294. $1;
  25295. } else {
  25296. $self._logErrorContext_($recv(anError)._context());
  25297. }
  25298. $self._logError_(anError);
  25299. return self;
  25300. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25301. },
  25302. args: ["anError"],
  25303. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  25304. referencedClasses: [],
  25305. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  25306. }),
  25307. $globals.ConsoleErrorHandler);
  25308. $core.addMethod(
  25309. $core.method({
  25310. selector: "log:",
  25311. protocol: "private",
  25312. fn: function (aString){
  25313. var self=this,$self=this;
  25314. return $core.withContext(function($ctx1) {
  25315. $recv(console)._log_(aString);
  25316. return self;
  25317. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  25318. },
  25319. args: ["aString"],
  25320. source: "log: aString\x0a\x09console log: aString",
  25321. referencedClasses: [],
  25322. messageSends: ["log:"]
  25323. }),
  25324. $globals.ConsoleErrorHandler);
  25325. $core.addMethod(
  25326. $core.method({
  25327. selector: "logContext:",
  25328. protocol: "private",
  25329. fn: function (aContext){
  25330. var self=this,$self=this;
  25331. return $core.withContext(function($ctx1) {
  25332. var $1,$receiver;
  25333. $1=$recv(aContext)._home();
  25334. $ctx1.sendIdx["home"]=1;
  25335. if(($receiver = $1) == null || $receiver.a$nil){
  25336. $1;
  25337. } else {
  25338. $self._logContext_($recv(aContext)._home());
  25339. }
  25340. $self._log_($recv(aContext)._asString());
  25341. return self;
  25342. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25343. },
  25344. args: ["aContext"],
  25345. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  25346. referencedClasses: [],
  25347. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  25348. }),
  25349. $globals.ConsoleErrorHandler);
  25350. $core.addMethod(
  25351. $core.method({
  25352. selector: "logError:",
  25353. protocol: "private",
  25354. fn: function (anError){
  25355. var self=this,$self=this;
  25356. return $core.withContext(function($ctx1) {
  25357. $self._log_($recv(anError)._messageText());
  25358. return self;
  25359. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25360. },
  25361. args: ["anError"],
  25362. source: "logError: anError\x0a\x09self log: anError messageText",
  25363. referencedClasses: [],
  25364. messageSends: ["log:", "messageText"]
  25365. }),
  25366. $globals.ConsoleErrorHandler);
  25367. $core.addMethod(
  25368. $core.method({
  25369. selector: "logErrorContext:",
  25370. protocol: "private",
  25371. fn: function (aContext){
  25372. var self=this,$self=this;
  25373. return $core.withContext(function($ctx1) {
  25374. var $1,$receiver;
  25375. if(($receiver = aContext) == null || $receiver.a$nil){
  25376. aContext;
  25377. } else {
  25378. $1=$recv(aContext)._home();
  25379. $ctx1.sendIdx["home"]=1;
  25380. if(($receiver = $1) == null || $receiver.a$nil){
  25381. $1;
  25382. } else {
  25383. $self._logContext_($recv(aContext)._home());
  25384. }
  25385. }
  25386. return self;
  25387. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25388. },
  25389. args: ["aContext"],
  25390. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  25391. referencedClasses: [],
  25392. messageSends: ["ifNotNil:", "home", "logContext:"]
  25393. }),
  25394. $globals.ConsoleErrorHandler);
  25395. $core.setSlots($globals.ConsoleErrorHandler.a$cls, ["current"]);
  25396. $core.addMethod(
  25397. $core.method({
  25398. selector: "initialize",
  25399. protocol: "initialization",
  25400. fn: function (){
  25401. var self=this,$self=this;
  25402. return $core.withContext(function($ctx1) {
  25403. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  25404. return self;
  25405. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.a$cls)});
  25406. },
  25407. args: [],
  25408. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  25409. referencedClasses: ["ErrorHandler"],
  25410. messageSends: ["registerIfNone:", "new"]
  25411. }),
  25412. $globals.ConsoleErrorHandler.a$cls);
  25413. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  25414. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  25415. $core.addMethod(
  25416. $core.method({
  25417. selector: "clear",
  25418. protocol: "printing",
  25419. fn: function (){
  25420. var self=this,$self=this;
  25421. return self;
  25422. },
  25423. args: [],
  25424. source: "clear\x0a\x09\x22no op\x22",
  25425. referencedClasses: [],
  25426. messageSends: []
  25427. }),
  25428. $globals.ConsoleTranscript);
  25429. $core.addMethod(
  25430. $core.method({
  25431. selector: "cr",
  25432. protocol: "printing",
  25433. fn: function (){
  25434. var self=this,$self=this;
  25435. return self;
  25436. },
  25437. args: [],
  25438. source: "cr\x0a\x09\x22no op\x22",
  25439. referencedClasses: [],
  25440. messageSends: []
  25441. }),
  25442. $globals.ConsoleTranscript);
  25443. $core.addMethod(
  25444. $core.method({
  25445. selector: "open",
  25446. protocol: "actions",
  25447. fn: function (){
  25448. var self=this,$self=this;
  25449. return self;
  25450. },
  25451. args: [],
  25452. source: "open",
  25453. referencedClasses: [],
  25454. messageSends: []
  25455. }),
  25456. $globals.ConsoleTranscript);
  25457. $core.addMethod(
  25458. $core.method({
  25459. selector: "show:",
  25460. protocol: "printing",
  25461. fn: function (anObject){
  25462. var self=this,$self=this;
  25463. return $core.withContext(function($ctx1) {
  25464. console.log(String($recv(anObject)._asString()));
  25465. return self;
  25466. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  25467. },
  25468. args: ["anObject"],
  25469. 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()))'>",
  25470. referencedClasses: [],
  25471. messageSends: []
  25472. }),
  25473. $globals.ConsoleTranscript);
  25474. $core.addMethod(
  25475. $core.method({
  25476. selector: "initialize",
  25477. protocol: "initialization",
  25478. fn: function (){
  25479. var self=this,$self=this;
  25480. return $core.withContext(function($ctx1) {
  25481. $recv($globals.Transcript)._registerIfNone_($self._new());
  25482. return self;
  25483. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.a$cls)});
  25484. },
  25485. args: [],
  25486. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  25487. referencedClasses: ["Transcript"],
  25488. messageSends: ["registerIfNone:", "new"]
  25489. }),
  25490. $globals.ConsoleTranscript.a$cls);
  25491. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  25492. $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.";
  25493. $core.addMethod(
  25494. $core.method({
  25495. selector: "addInstVarNamed:to:",
  25496. protocol: "compiling",
  25497. fn: function (aString,aClass){
  25498. var self=this,$self=this;
  25499. var newInstVars;
  25500. return $core.withContext(function($ctx1) {
  25501. var $1,$2,$3,$4,$5;
  25502. newInstVars=$recv($recv(aClass)._instanceVariableNames())._copyWith_(aString);
  25503. $1=$recv(aClass)._isMetaclass();
  25504. if($core.assert($1)){
  25505. $2=$self._classBuilder();
  25506. $ctx1.sendIdx["classBuilder"]=1;
  25507. $recv($2)._class_slots_(aClass,newInstVars);
  25508. } else {
  25509. $3=$self._classBuilder();
  25510. $4=$recv(aClass)._superclass();
  25511. $5=$recv(aClass)._name();
  25512. $ctx1.sendIdx["name"]=1;
  25513. $recv($3)._addSubclassOf_named_instanceVariableNames_package_($4,$5,newInstVars,$recv($recv(aClass)._package())._name());
  25514. }
  25515. return self;
  25516. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass,newInstVars:newInstVars},$globals.Environment)});
  25517. },
  25518. args: ["aString", "aClass"],
  25519. source: "addInstVarNamed: aString to: aClass\x0a\x09| newInstVars |\x0a\x09newInstVars := aClass instanceVariableNames copyWith: aString.\x0a\x0a\x09aClass isMetaclass\x0a\x09\x09ifTrue: [ self classBuilder\x0a\x09\x09\x09class: aClass slots: newInstVars ]\x0a\x09\x09ifFalse: [ self classBuilder\x0a\x09\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09\x09named: aClass name \x0a\x09\x09\x09instanceVariableNames: newInstVars\x0a\x09\x09\x09package: aClass package name ]",
  25520. referencedClasses: [],
  25521. messageSends: ["copyWith:", "instanceVariableNames", "ifTrue:ifFalse:", "isMetaclass", "class:slots:", "classBuilder", "addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "package"]
  25522. }),
  25523. $globals.Environment);
  25524. $core.addMethod(
  25525. $core.method({
  25526. selector: "allSelectors",
  25527. protocol: "accessing",
  25528. fn: function (){
  25529. var self=this,$self=this;
  25530. return $core.withContext(function($ctx1) {
  25531. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  25532. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  25533. },
  25534. args: [],
  25535. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  25536. referencedClasses: ["Smalltalk"],
  25537. messageSends: ["allSelectors", "core"]
  25538. }),
  25539. $globals.Environment);
  25540. $core.addMethod(
  25541. $core.method({
  25542. selector: "availableClassNames",
  25543. protocol: "accessing",
  25544. fn: function (){
  25545. var self=this,$self=this;
  25546. return $core.withContext(function($ctx1) {
  25547. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  25548. return $core.withContext(function($ctx2) {
  25549. return $recv(each)._name();
  25550. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25551. }));
  25552. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  25553. },
  25554. args: [],
  25555. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  25556. referencedClasses: ["Smalltalk"],
  25557. messageSends: ["collect:", "classes", "name"]
  25558. }),
  25559. $globals.Environment);
  25560. $core.addMethod(
  25561. $core.method({
  25562. selector: "availablePackageNames",
  25563. protocol: "accessing",
  25564. fn: function (){
  25565. var self=this,$self=this;
  25566. return $core.withContext(function($ctx1) {
  25567. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  25568. return $core.withContext(function($ctx2) {
  25569. return $recv(each)._name();
  25570. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25571. }));
  25572. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  25573. },
  25574. args: [],
  25575. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  25576. referencedClasses: ["Smalltalk"],
  25577. messageSends: ["collect:", "packages", "name"]
  25578. }),
  25579. $globals.Environment);
  25580. $core.addMethod(
  25581. $core.method({
  25582. selector: "availableProtocolsFor:",
  25583. protocol: "accessing",
  25584. fn: function (aClass){
  25585. var self=this,$self=this;
  25586. var protocols;
  25587. return $core.withContext(function($ctx1) {
  25588. var $1,$receiver;
  25589. protocols=$recv(aClass)._protocols();
  25590. $1=$recv(aClass)._superclass();
  25591. $ctx1.sendIdx["superclass"]=1;
  25592. if(($receiver = $1) == null || $receiver.a$nil){
  25593. $1;
  25594. } else {
  25595. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  25596. }
  25597. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  25598. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  25599. },
  25600. args: ["aClass"],
  25601. 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",
  25602. referencedClasses: [],
  25603. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  25604. }),
  25605. $globals.Environment);
  25606. $core.addMethod(
  25607. $core.method({
  25608. selector: "classBuilder",
  25609. protocol: "accessing",
  25610. fn: function (){
  25611. var self=this,$self=this;
  25612. return $core.withContext(function($ctx1) {
  25613. return $recv($globals.ClassBuilder)._new();
  25614. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  25615. },
  25616. args: [],
  25617. source: "classBuilder\x0a\x09^ ClassBuilder new",
  25618. referencedClasses: ["ClassBuilder"],
  25619. messageSends: ["new"]
  25620. }),
  25621. $globals.Environment);
  25622. $core.addMethod(
  25623. $core.method({
  25624. selector: "classNamed:",
  25625. protocol: "accessing",
  25626. fn: function (aString){
  25627. var self=this,$self=this;
  25628. return $core.withContext(function($ctx1) {
  25629. var $1,$receiver;
  25630. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  25631. if(($receiver = $1) == null || $receiver.a$nil){
  25632. return $self._error_("Invalid class name");
  25633. } else {
  25634. return $1;
  25635. }
  25636. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  25637. },
  25638. args: ["aString"],
  25639. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  25640. referencedClasses: ["Smalltalk"],
  25641. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  25642. }),
  25643. $globals.Environment);
  25644. $core.addMethod(
  25645. $core.method({
  25646. selector: "classes",
  25647. protocol: "accessing",
  25648. fn: function (){
  25649. var self=this,$self=this;
  25650. return $core.withContext(function($ctx1) {
  25651. return $recv($globals.Smalltalk)._classes();
  25652. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  25653. },
  25654. args: [],
  25655. source: "classes\x0a\x09^ Smalltalk classes",
  25656. referencedClasses: ["Smalltalk"],
  25657. messageSends: ["classes"]
  25658. }),
  25659. $globals.Environment);
  25660. $core.addMethod(
  25661. $core.method({
  25662. selector: "commitPackage:onSuccess:onError:",
  25663. protocol: "actions",
  25664. fn: function (aPackage,aBlock,anotherBlock){
  25665. var self=this,$self=this;
  25666. return $core.withContext(function($ctx1) {
  25667. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  25668. return self;
  25669. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  25670. },
  25671. args: ["aPackage", "aBlock", "anotherBlock"],
  25672. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  25673. referencedClasses: [],
  25674. messageSends: ["commitOnSuccess:onError:", "transport"]
  25675. }),
  25676. $globals.Environment);
  25677. $core.addMethod(
  25678. $core.method({
  25679. selector: "compileClassComment:for:",
  25680. protocol: "compiling",
  25681. fn: function (aString,aClass){
  25682. var self=this,$self=this;
  25683. return $core.withContext(function($ctx1) {
  25684. $recv(aClass)._comment_(aString);
  25685. return self;
  25686. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  25687. },
  25688. args: ["aString", "aClass"],
  25689. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  25690. referencedClasses: [],
  25691. messageSends: ["comment:"]
  25692. }),
  25693. $globals.Environment);
  25694. $core.addMethod(
  25695. $core.method({
  25696. selector: "compileClassDefinition:",
  25697. protocol: "compiling",
  25698. fn: function (aString){
  25699. var self=this,$self=this;
  25700. return $core.withContext(function($ctx1) {
  25701. $recv((function(){
  25702. return $core.withContext(function($ctx2) {
  25703. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  25704. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25705. }))._on_do_($globals.Error,(function(error){
  25706. return $core.withContext(function($ctx2) {
  25707. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  25708. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  25709. }));
  25710. return self;
  25711. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  25712. },
  25713. args: ["aString"],
  25714. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  25715. referencedClasses: ["DoIt", "Error", "Terminal"],
  25716. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  25717. }),
  25718. $globals.Environment);
  25719. $core.addMethod(
  25720. $core.method({
  25721. selector: "compileMethod:for:protocol:",
  25722. protocol: "compiling",
  25723. fn: function (sourceCode,class_,protocol){
  25724. var self=this,$self=this;
  25725. return $core.withContext(function($ctx1) {
  25726. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  25727. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  25728. },
  25729. args: ["sourceCode", "class", "protocol"],
  25730. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  25731. referencedClasses: [],
  25732. messageSends: ["compile:protocol:"]
  25733. }),
  25734. $globals.Environment);
  25735. $core.addMethod(
  25736. $core.method({
  25737. selector: "copyClass:to:",
  25738. protocol: "actions",
  25739. fn: function (aClass,aClassName){
  25740. var self=this,$self=this;
  25741. return $core.withContext(function($ctx1) {
  25742. var $1,$2,$receiver;
  25743. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25744. if(($receiver = $1) == null || $receiver.a$nil){
  25745. $1;
  25746. } else {
  25747. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25748. $ctx1.sendIdx[","]=1;
  25749. $self._error_($2);
  25750. }
  25751. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  25752. return self;
  25753. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25754. },
  25755. args: ["aClass", "aClassName"],
  25756. 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",
  25757. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25758. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  25759. }),
  25760. $globals.Environment);
  25761. $core.addMethod(
  25762. $core.method({
  25763. selector: "doItReceiver",
  25764. protocol: "accessing",
  25765. fn: function (){
  25766. var self=this,$self=this;
  25767. return $core.withContext(function($ctx1) {
  25768. return $recv($globals.DoIt)._new();
  25769. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  25770. },
  25771. args: [],
  25772. source: "doItReceiver\x0a\x09^ DoIt new",
  25773. referencedClasses: ["DoIt"],
  25774. messageSends: ["new"]
  25775. }),
  25776. $globals.Environment);
  25777. $core.addMethod(
  25778. $core.method({
  25779. selector: "evaluate:for:",
  25780. protocol: "evaluating",
  25781. fn: function (aString,anObject){
  25782. var self=this,$self=this;
  25783. return $core.withContext(function($ctx1) {
  25784. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  25785. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  25786. },
  25787. args: ["aString", "anObject"],
  25788. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  25789. referencedClasses: ["Evaluator"],
  25790. messageSends: ["evaluate:for:"]
  25791. }),
  25792. $globals.Environment);
  25793. $core.addMethod(
  25794. $core.method({
  25795. selector: "evaluate:on:do:",
  25796. protocol: "error handling",
  25797. fn: function (aBlock,anErrorClass,exceptionBlock){
  25798. var self=this,$self=this;
  25799. return $core.withContext(function($ctx1) {
  25800. var $1;
  25801. $recv(aBlock)._tryCatch_((function(exception){
  25802. return $core.withContext(function($ctx2) {
  25803. $1=$recv(exception)._isKindOf_($self._classNamed_($recv(anErrorClass)._name()));
  25804. if($core.assert($1)){
  25805. return $recv(exceptionBlock)._value_(exception);
  25806. } else {
  25807. return $recv(exception)._pass();
  25808. }
  25809. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  25810. }));
  25811. return self;
  25812. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  25813. },
  25814. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  25815. 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 pass ] ]",
  25816. referencedClasses: [],
  25817. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "pass"]
  25818. }),
  25819. $globals.Environment);
  25820. $core.addMethod(
  25821. $core.method({
  25822. selector: "inspect:",
  25823. protocol: "actions",
  25824. fn: function (anObject){
  25825. var self=this,$self=this;
  25826. return $core.withContext(function($ctx1) {
  25827. $recv($globals.Inspector)._inspect_(anObject);
  25828. return self;
  25829. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  25830. },
  25831. args: ["anObject"],
  25832. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  25833. referencedClasses: ["Inspector"],
  25834. messageSends: ["inspect:"]
  25835. }),
  25836. $globals.Environment);
  25837. $core.addMethod(
  25838. $core.method({
  25839. selector: "moveClass:toPackage:",
  25840. protocol: "actions",
  25841. fn: function (aClass,aPackageName){
  25842. var self=this,$self=this;
  25843. var package_;
  25844. return $core.withContext(function($ctx1) {
  25845. var $1,$2,$receiver;
  25846. package_=$recv($globals.Package)._named_(aPackageName);
  25847. $1=package_;
  25848. if(($receiver = $1) == null || $receiver.a$nil){
  25849. $self._error_("Invalid package name");
  25850. } else {
  25851. $1;
  25852. }
  25853. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  25854. if($core.assert($2)){
  25855. return self;
  25856. }
  25857. $recv(aClass)._package_(package_);
  25858. $recv(aClass)._recompile();
  25859. return self;
  25860. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  25861. },
  25862. args: ["aClass", "aPackageName"],
  25863. 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",
  25864. referencedClasses: ["Package"],
  25865. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  25866. }),
  25867. $globals.Environment);
  25868. $core.addMethod(
  25869. $core.method({
  25870. selector: "moveMethod:toClass:",
  25871. protocol: "actions",
  25872. fn: function (aMethod,aClassName){
  25873. var self=this,$self=this;
  25874. var destinationClass;
  25875. return $core.withContext(function($ctx1) {
  25876. var $2,$3,$1,$5,$4;
  25877. destinationClass=$self._classNamed_(aClassName);
  25878. $2=destinationClass;
  25879. $3=$recv(aMethod)._methodClass();
  25880. $ctx1.sendIdx["methodClass"]=1;
  25881. $1=$recv($2).__eq_eq($3);
  25882. if($core.assert($1)){
  25883. return self;
  25884. }
  25885. $5=$recv(aMethod)._methodClass();
  25886. $ctx1.sendIdx["methodClass"]=2;
  25887. $4=$recv($5)._isMetaclass();
  25888. if($core.assert($4)){
  25889. destinationClass=$recv(destinationClass)._theMetaClass();
  25890. destinationClass;
  25891. }
  25892. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25893. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25894. return self;
  25895. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  25896. },
  25897. args: ["aMethod", "aClassName"],
  25898. 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",
  25899. referencedClasses: [],
  25900. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  25901. }),
  25902. $globals.Environment);
  25903. $core.addMethod(
  25904. $core.method({
  25905. selector: "moveMethod:toProtocol:",
  25906. protocol: "actions",
  25907. fn: function (aMethod,aProtocol){
  25908. var self=this,$self=this;
  25909. return $core.withContext(function($ctx1) {
  25910. $recv(aMethod)._protocol_(aProtocol);
  25911. $recv($recv(aMethod)._methodClass())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25912. return self;
  25913. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  25914. },
  25915. args: ["aMethod", "aProtocol"],
  25916. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod methodClass\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  25917. referencedClasses: [],
  25918. messageSends: ["protocol:", "compile:protocol:", "methodClass", "source", "protocol"]
  25919. }),
  25920. $globals.Environment);
  25921. $core.addMethod(
  25922. $core.method({
  25923. selector: "packages",
  25924. protocol: "accessing",
  25925. fn: function (){
  25926. var self=this,$self=this;
  25927. return $core.withContext(function($ctx1) {
  25928. return $recv($globals.Smalltalk)._packages();
  25929. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  25930. },
  25931. args: [],
  25932. source: "packages\x0a\x09^ Smalltalk packages",
  25933. referencedClasses: ["Smalltalk"],
  25934. messageSends: ["packages"]
  25935. }),
  25936. $globals.Environment);
  25937. $core.addMethod(
  25938. $core.method({
  25939. selector: "registerErrorHandler:",
  25940. protocol: "services",
  25941. fn: function (anErrorHandler){
  25942. var self=this,$self=this;
  25943. return $core.withContext(function($ctx1) {
  25944. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  25945. return self;
  25946. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  25947. },
  25948. args: ["anErrorHandler"],
  25949. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  25950. referencedClasses: ["ErrorHandler"],
  25951. messageSends: ["register:"]
  25952. }),
  25953. $globals.Environment);
  25954. $core.addMethod(
  25955. $core.method({
  25956. selector: "registerFinder:",
  25957. protocol: "services",
  25958. fn: function (aFinder){
  25959. var self=this,$self=this;
  25960. return $core.withContext(function($ctx1) {
  25961. $recv($globals.Finder)._register_(aFinder);
  25962. return self;
  25963. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  25964. },
  25965. args: ["aFinder"],
  25966. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  25967. referencedClasses: ["Finder"],
  25968. messageSends: ["register:"]
  25969. }),
  25970. $globals.Environment);
  25971. $core.addMethod(
  25972. $core.method({
  25973. selector: "registerInspector:",
  25974. protocol: "services",
  25975. fn: function (anInspector){
  25976. var self=this,$self=this;
  25977. return $core.withContext(function($ctx1) {
  25978. $recv($globals.Inspector)._register_(anInspector);
  25979. return self;
  25980. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  25981. },
  25982. args: ["anInspector"],
  25983. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  25984. referencedClasses: ["Inspector"],
  25985. messageSends: ["register:"]
  25986. }),
  25987. $globals.Environment);
  25988. $core.addMethod(
  25989. $core.method({
  25990. selector: "registerProgressHandler:",
  25991. protocol: "services",
  25992. fn: function (aProgressHandler){
  25993. var self=this,$self=this;
  25994. return $core.withContext(function($ctx1) {
  25995. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  25996. return self;
  25997. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  25998. },
  25999. args: ["aProgressHandler"],
  26000. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  26001. referencedClasses: ["ProgressHandler"],
  26002. messageSends: ["register:"]
  26003. }),
  26004. $globals.Environment);
  26005. $core.addMethod(
  26006. $core.method({
  26007. selector: "registerTranscript:",
  26008. protocol: "services",
  26009. fn: function (aTranscript){
  26010. var self=this,$self=this;
  26011. return $core.withContext(function($ctx1) {
  26012. $recv($globals.Transcript)._register_(aTranscript);
  26013. return self;
  26014. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  26015. },
  26016. args: ["aTranscript"],
  26017. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  26018. referencedClasses: ["Transcript"],
  26019. messageSends: ["register:"]
  26020. }),
  26021. $globals.Environment);
  26022. $core.addMethod(
  26023. $core.method({
  26024. selector: "removeClass:",
  26025. protocol: "actions",
  26026. fn: function (aClass){
  26027. var self=this,$self=this;
  26028. return $core.withContext(function($ctx1) {
  26029. $recv($globals.Smalltalk)._removeClass_(aClass);
  26030. return self;
  26031. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  26032. },
  26033. args: ["aClass"],
  26034. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  26035. referencedClasses: ["Smalltalk"],
  26036. messageSends: ["removeClass:"]
  26037. }),
  26038. $globals.Environment);
  26039. $core.addMethod(
  26040. $core.method({
  26041. selector: "removeMethod:",
  26042. protocol: "actions",
  26043. fn: function (aMethod){
  26044. var self=this,$self=this;
  26045. return $core.withContext(function($ctx1) {
  26046. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  26047. return self;
  26048. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  26049. },
  26050. args: ["aMethod"],
  26051. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  26052. referencedClasses: [],
  26053. messageSends: ["removeCompiledMethod:", "methodClass"]
  26054. }),
  26055. $globals.Environment);
  26056. $core.addMethod(
  26057. $core.method({
  26058. selector: "removeProtocol:from:",
  26059. protocol: "actions",
  26060. fn: function (aString,aClass){
  26061. var self=this,$self=this;
  26062. return $core.withContext(function($ctx1) {
  26063. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  26064. return $core.withContext(function($ctx2) {
  26065. return $recv(aClass)._removeCompiledMethod_(each);
  26066. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26067. }));
  26068. return self;
  26069. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  26070. },
  26071. args: ["aString", "aClass"],
  26072. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  26073. referencedClasses: [],
  26074. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  26075. }),
  26076. $globals.Environment);
  26077. $core.addMethod(
  26078. $core.method({
  26079. selector: "renameClass:to:",
  26080. protocol: "actions",
  26081. fn: function (aClass,aClassName){
  26082. var self=this,$self=this;
  26083. return $core.withContext(function($ctx1) {
  26084. var $1,$2,$receiver;
  26085. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  26086. if(($receiver = $1) == null || $receiver.a$nil){
  26087. $1;
  26088. } else {
  26089. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  26090. $ctx1.sendIdx[","]=1;
  26091. $self._error_($2);
  26092. }
  26093. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  26094. return self;
  26095. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  26096. },
  26097. args: ["aClass", "aClassName"],
  26098. 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",
  26099. referencedClasses: ["Smalltalk", "ClassBuilder"],
  26100. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  26101. }),
  26102. $globals.Environment);
  26103. $core.addMethod(
  26104. $core.method({
  26105. selector: "renamePackage:to:",
  26106. protocol: "actions",
  26107. fn: function (aPackageName,aNewPackageName){
  26108. var self=this,$self=this;
  26109. return $core.withContext(function($ctx1) {
  26110. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  26111. return self;
  26112. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  26113. },
  26114. args: ["aPackageName", "aNewPackageName"],
  26115. source: "renamePackage: aPackageName to: aNewPackageName\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  26116. referencedClasses: ["Smalltalk"],
  26117. messageSends: ["renamePackage:to:"]
  26118. }),
  26119. $globals.Environment);
  26120. $core.addMethod(
  26121. $core.method({
  26122. selector: "renameProtocol:to:in:",
  26123. protocol: "actions",
  26124. fn: function (aString,anotherString,aClass){
  26125. var self=this,$self=this;
  26126. return $core.withContext(function($ctx1) {
  26127. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  26128. return $core.withContext(function($ctx2) {
  26129. return $recv(each)._protocol_(anotherString);
  26130. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26131. }));
  26132. return self;
  26133. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  26134. },
  26135. args: ["aString", "anotherString", "aClass"],
  26136. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  26137. referencedClasses: [],
  26138. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  26139. }),
  26140. $globals.Environment);
  26141. $core.addMethod(
  26142. $core.method({
  26143. selector: "setClassCommentOf:to:",
  26144. protocol: "actions",
  26145. fn: function (aClass,aString){
  26146. var self=this,$self=this;
  26147. return $core.withContext(function($ctx1) {
  26148. $recv(aClass)._comment_(aString);
  26149. return self;
  26150. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  26151. },
  26152. args: ["aClass", "aString"],
  26153. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  26154. referencedClasses: [],
  26155. messageSends: ["comment:"]
  26156. }),
  26157. $globals.Environment);
  26158. $core.addMethod(
  26159. $core.method({
  26160. selector: "systemAnnouncer",
  26161. protocol: "accessing",
  26162. fn: function (){
  26163. var self=this,$self=this;
  26164. return $core.withContext(function($ctx1) {
  26165. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  26166. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  26167. },
  26168. args: [],
  26169. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  26170. referencedClasses: ["Smalltalk"],
  26171. messageSends: ["current", "at:", "globals"]
  26172. }),
  26173. $globals.Environment);
  26174. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  26175. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  26176. $core.addMethod(
  26177. $core.method({
  26178. selector: "do:on:displaying:",
  26179. protocol: "progress handling",
  26180. fn: function (aBlock,aCollection,aString){
  26181. var self=this,$self=this;
  26182. return $core.withContext(function($ctx1) {
  26183. $recv(aCollection)._do_(aBlock);
  26184. return self;
  26185. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  26186. },
  26187. args: ["aBlock", "aCollection", "aString"],
  26188. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  26189. referencedClasses: [],
  26190. messageSends: ["do:"]
  26191. }),
  26192. $globals.NullProgressHandler);
  26193. $core.setSlots($globals.NullProgressHandler.a$cls, ["current"]);
  26194. $core.addMethod(
  26195. $core.method({
  26196. selector: "initialize",
  26197. protocol: "initialization",
  26198. fn: function (){
  26199. var self=this,$self=this;
  26200. return $core.withContext(function($ctx1) {
  26201. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  26202. return self;
  26203. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.a$cls)});
  26204. },
  26205. args: [],
  26206. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  26207. referencedClasses: ["ProgressHandler"],
  26208. messageSends: ["registerIfNone:", "new"]
  26209. }),
  26210. $globals.NullProgressHandler.a$cls);
  26211. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  26212. $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.";
  26213. $core.setSlots($globals.Service.a$cls, ["current"]);
  26214. $core.addMethod(
  26215. $core.method({
  26216. selector: "current",
  26217. protocol: "accessing",
  26218. fn: function (){
  26219. var self=this,$self=this;
  26220. return $self.current;
  26221. },
  26222. args: [],
  26223. source: "current\x0a\x09^ current",
  26224. referencedClasses: [],
  26225. messageSends: []
  26226. }),
  26227. $globals.Service.a$cls);
  26228. $core.addMethod(
  26229. $core.method({
  26230. selector: "new",
  26231. protocol: "instance creation",
  26232. fn: function (){
  26233. var self=this,$self=this;
  26234. return $core.withContext(function($ctx1) {
  26235. $self._shouldNotImplement();
  26236. return self;
  26237. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.a$cls)});
  26238. },
  26239. args: [],
  26240. source: "new\x0a\x09self shouldNotImplement",
  26241. referencedClasses: [],
  26242. messageSends: ["shouldNotImplement"]
  26243. }),
  26244. $globals.Service.a$cls);
  26245. $core.addMethod(
  26246. $core.method({
  26247. selector: "register:",
  26248. protocol: "registration",
  26249. fn: function (anObject){
  26250. var self=this,$self=this;
  26251. $self.current=anObject;
  26252. return self;
  26253. },
  26254. args: ["anObject"],
  26255. source: "register: anObject\x0a\x09current := anObject",
  26256. referencedClasses: [],
  26257. messageSends: []
  26258. }),
  26259. $globals.Service.a$cls);
  26260. $core.addMethod(
  26261. $core.method({
  26262. selector: "registerIfNone:",
  26263. protocol: "registration",
  26264. fn: function (anObject){
  26265. var self=this,$self=this;
  26266. return $core.withContext(function($ctx1) {
  26267. var $1,$receiver;
  26268. $1=$self._current();
  26269. if(($receiver = $1) == null || $receiver.a$nil){
  26270. $self._register_(anObject);
  26271. } else {
  26272. $1;
  26273. }
  26274. return self;
  26275. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.a$cls)});
  26276. },
  26277. args: ["anObject"],
  26278. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  26279. referencedClasses: [],
  26280. messageSends: ["ifNil:", "current", "register:"]
  26281. }),
  26282. $globals.Service.a$cls);
  26283. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  26284. $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.";
  26285. $core.addMethod(
  26286. $core.method({
  26287. selector: "handleError:",
  26288. protocol: "error handling",
  26289. fn: function (anError){
  26290. var self=this,$self=this;
  26291. return $core.withContext(function($ctx1) {
  26292. var $1;
  26293. $1=$recv((function(){
  26294. return $core.withContext(function($ctx2) {
  26295. return $recv(anError)._isSmalltalkError();
  26296. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26297. }))._tryCatch_((function(){
  26298. return false;
  26299. }));
  26300. if($core.assert($1)){
  26301. $self._handleUnhandledError_(anError);
  26302. $ctx1.sendIdx["handleUnhandledError:"]=1;
  26303. } else {
  26304. var smalltalkError;
  26305. smalltalkError=$recv($globals.JavaScriptException)._on_(anError);
  26306. $recv(smalltalkError)._wrap();
  26307. $self._handleUnhandledError_(smalltalkError);
  26308. }
  26309. return self;
  26310. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26311. },
  26312. args: ["anError"],
  26313. 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 ]",
  26314. referencedClasses: ["JavaScriptException"],
  26315. messageSends: ["ifTrue:ifFalse:", "tryCatch:", "isSmalltalkError", "handleUnhandledError:", "on:", "wrap"]
  26316. }),
  26317. $globals.ErrorHandler.a$cls);
  26318. $core.addMethod(
  26319. $core.method({
  26320. selector: "handleUnhandledError:",
  26321. protocol: "error handling",
  26322. fn: function (anError){
  26323. var self=this,$self=this;
  26324. return $core.withContext(function($ctx1) {
  26325. var $1;
  26326. $1=$recv(anError)._wasHandled();
  26327. if(!$core.assert($1)){
  26328. $recv($self._current())._handleError_(anError);
  26329. $recv(anError)._beHandled();
  26330. }
  26331. return self;
  26332. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26333. },
  26334. args: ["anError"],
  26335. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifFalse: [\x0a\x09\x09self current handleError: anError.\x0a\x09\x09anError beHandled ]",
  26336. referencedClasses: [],
  26337. messageSends: ["ifFalse:", "wasHandled", "handleError:", "current", "beHandled"]
  26338. }),
  26339. $globals.ErrorHandler.a$cls);
  26340. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  26341. $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.";
  26342. $core.addMethod(
  26343. $core.method({
  26344. selector: "findClass:",
  26345. protocol: "finding",
  26346. fn: function (aClass){
  26347. var self=this,$self=this;
  26348. return $core.withContext(function($ctx1) {
  26349. return $recv($self._current())._findClass_(aClass);
  26350. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.a$cls)});
  26351. },
  26352. args: ["aClass"],
  26353. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  26354. referencedClasses: [],
  26355. messageSends: ["findClass:", "current"]
  26356. }),
  26357. $globals.Finder.a$cls);
  26358. $core.addMethod(
  26359. $core.method({
  26360. selector: "findMethod:",
  26361. protocol: "finding",
  26362. fn: function (aCompiledMethod){
  26363. var self=this,$self=this;
  26364. return $core.withContext(function($ctx1) {
  26365. return $recv($self._current())._findMethod_(aCompiledMethod);
  26366. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.a$cls)});
  26367. },
  26368. args: ["aCompiledMethod"],
  26369. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  26370. referencedClasses: [],
  26371. messageSends: ["findMethod:", "current"]
  26372. }),
  26373. $globals.Finder.a$cls);
  26374. $core.addMethod(
  26375. $core.method({
  26376. selector: "findString:",
  26377. protocol: "finding",
  26378. fn: function (aString){
  26379. var self=this,$self=this;
  26380. return $core.withContext(function($ctx1) {
  26381. return $recv($self._current())._findString_(aString);
  26382. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.a$cls)});
  26383. },
  26384. args: ["aString"],
  26385. source: "findString: aString\x0a\x09^ self current findString: aString",
  26386. referencedClasses: [],
  26387. messageSends: ["findString:", "current"]
  26388. }),
  26389. $globals.Finder.a$cls);
  26390. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  26391. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  26392. $core.addMethod(
  26393. $core.method({
  26394. selector: "inspect:",
  26395. protocol: "inspecting",
  26396. fn: function (anObject){
  26397. var self=this,$self=this;
  26398. return $core.withContext(function($ctx1) {
  26399. return $recv($self._current())._inspect_(anObject);
  26400. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.a$cls)});
  26401. },
  26402. args: ["anObject"],
  26403. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  26404. referencedClasses: [],
  26405. messageSends: ["inspect:", "current"]
  26406. }),
  26407. $globals.Inspector.a$cls);
  26408. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  26409. $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";
  26410. $core.addMethod(
  26411. $core.method({
  26412. selector: "globals",
  26413. protocol: "accessing",
  26414. fn: function (){
  26415. var self=this,$self=this;
  26416. return $core.withContext(function($ctx1) {
  26417. return $recv($self._current())._globals();
  26418. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.a$cls)});
  26419. },
  26420. args: [],
  26421. source: "globals\x0a\x09^ self current globals",
  26422. referencedClasses: [],
  26423. messageSends: ["globals", "current"]
  26424. }),
  26425. $globals.Platform.a$cls);
  26426. $core.addMethod(
  26427. $core.method({
  26428. selector: "includesGlobal:",
  26429. protocol: "testing",
  26430. fn: function (aString){
  26431. var self=this,$self=this;
  26432. return $core.withContext(function($ctx1) {
  26433. return $recv($self._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  26434. return true;
  26435. }),(function(){
  26436. return false;
  26437. }));
  26438. }, function($ctx1) {$ctx1.fill(self,"includesGlobal:",{aString:aString},$globals.Platform.a$cls)});
  26439. },
  26440. args: ["aString"],
  26441. source: "includesGlobal: aString\x0a\x09^ self globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  26442. referencedClasses: [],
  26443. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  26444. }),
  26445. $globals.Platform.a$cls);
  26446. $core.addMethod(
  26447. $core.method({
  26448. selector: "newXhr",
  26449. protocol: "accessing",
  26450. fn: function (){
  26451. var self=this,$self=this;
  26452. return $core.withContext(function($ctx1) {
  26453. return $recv($self._current())._newXhr();
  26454. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.a$cls)});
  26455. },
  26456. args: [],
  26457. source: "newXhr\x0a\x09^ self current newXhr",
  26458. referencedClasses: [],
  26459. messageSends: ["newXhr", "current"]
  26460. }),
  26461. $globals.Platform.a$cls);
  26462. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  26463. $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`.";
  26464. $core.addMethod(
  26465. $core.method({
  26466. selector: "do:on:displaying:",
  26467. protocol: "progress handling",
  26468. fn: function (aBlock,aCollection,aString){
  26469. var self=this,$self=this;
  26470. return $core.withContext(function($ctx1) {
  26471. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  26472. return self;
  26473. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.a$cls)});
  26474. },
  26475. args: ["aBlock", "aCollection", "aString"],
  26476. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  26477. referencedClasses: [],
  26478. messageSends: ["do:on:displaying:", "current"]
  26479. }),
  26480. $globals.ProgressHandler.a$cls);
  26481. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  26482. $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:'.";
  26483. $core.addMethod(
  26484. $core.method({
  26485. selector: "alert:",
  26486. protocol: "dialogs",
  26487. fn: function (aString){
  26488. var self=this,$self=this;
  26489. return $core.withContext(function($ctx1) {
  26490. return $recv($self._current())._alert_(aString);
  26491. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.a$cls)});
  26492. },
  26493. args: ["aString"],
  26494. source: "alert: aString\x0a\x09^ self current alert: aString",
  26495. referencedClasses: [],
  26496. messageSends: ["alert:", "current"]
  26497. }),
  26498. $globals.Terminal.a$cls);
  26499. $core.addMethod(
  26500. $core.method({
  26501. selector: "confirm:",
  26502. protocol: "dialogs",
  26503. fn: function (aString){
  26504. var self=this,$self=this;
  26505. return $core.withContext(function($ctx1) {
  26506. return $recv($self._current())._confirm_(aString);
  26507. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.a$cls)});
  26508. },
  26509. args: ["aString"],
  26510. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  26511. referencedClasses: [],
  26512. messageSends: ["confirm:", "current"]
  26513. }),
  26514. $globals.Terminal.a$cls);
  26515. $core.addMethod(
  26516. $core.method({
  26517. selector: "prompt:",
  26518. protocol: "dialogs",
  26519. fn: function (aString){
  26520. var self=this,$self=this;
  26521. return $core.withContext(function($ctx1) {
  26522. return $recv($self._current())._prompt_(aString);
  26523. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.a$cls)});
  26524. },
  26525. args: ["aString"],
  26526. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  26527. referencedClasses: [],
  26528. messageSends: ["prompt:", "current"]
  26529. }),
  26530. $globals.Terminal.a$cls);
  26531. $core.addMethod(
  26532. $core.method({
  26533. selector: "prompt:default:",
  26534. protocol: "dialogs",
  26535. fn: function (aString,defaultString){
  26536. var self=this,$self=this;
  26537. return $core.withContext(function($ctx1) {
  26538. return $recv($self._current())._prompt_default_(aString,defaultString);
  26539. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.a$cls)});
  26540. },
  26541. args: ["aString", "defaultString"],
  26542. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  26543. referencedClasses: [],
  26544. messageSends: ["prompt:default:", "current"]
  26545. }),
  26546. $globals.Terminal.a$cls);
  26547. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  26548. $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.";
  26549. $core.addMethod(
  26550. $core.method({
  26551. selector: "clear",
  26552. protocol: "printing",
  26553. fn: function (){
  26554. var self=this,$self=this;
  26555. return $core.withContext(function($ctx1) {
  26556. $recv($self._current())._clear();
  26557. return self;
  26558. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.a$cls)});
  26559. },
  26560. args: [],
  26561. source: "clear\x0a\x09self current clear",
  26562. referencedClasses: [],
  26563. messageSends: ["clear", "current"]
  26564. }),
  26565. $globals.Transcript.a$cls);
  26566. $core.addMethod(
  26567. $core.method({
  26568. selector: "cr",
  26569. protocol: "printing",
  26570. fn: function (){
  26571. var self=this,$self=this;
  26572. return $core.withContext(function($ctx1) {
  26573. $recv($self._current())._show_($recv($globals.String)._cr());
  26574. return self;
  26575. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.a$cls)});
  26576. },
  26577. args: [],
  26578. source: "cr\x0a\x09self current show: String cr",
  26579. referencedClasses: ["String"],
  26580. messageSends: ["show:", "current", "cr"]
  26581. }),
  26582. $globals.Transcript.a$cls);
  26583. $core.addMethod(
  26584. $core.method({
  26585. selector: "inspect:",
  26586. protocol: "printing",
  26587. fn: function (anObject){
  26588. var self=this,$self=this;
  26589. return $core.withContext(function($ctx1) {
  26590. $self._show_(anObject);
  26591. return self;
  26592. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.a$cls)});
  26593. },
  26594. args: ["anObject"],
  26595. source: "inspect: anObject\x0a\x09self show: anObject",
  26596. referencedClasses: [],
  26597. messageSends: ["show:"]
  26598. }),
  26599. $globals.Transcript.a$cls);
  26600. $core.addMethod(
  26601. $core.method({
  26602. selector: "open",
  26603. protocol: "instance creation",
  26604. fn: function (){
  26605. var self=this,$self=this;
  26606. return $core.withContext(function($ctx1) {
  26607. $recv($self._current())._open();
  26608. return self;
  26609. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.a$cls)});
  26610. },
  26611. args: [],
  26612. source: "open\x0a\x09self current open",
  26613. referencedClasses: [],
  26614. messageSends: ["open", "current"]
  26615. }),
  26616. $globals.Transcript.a$cls);
  26617. $core.addMethod(
  26618. $core.method({
  26619. selector: "show:",
  26620. protocol: "printing",
  26621. fn: function (anObject){
  26622. var self=this,$self=this;
  26623. return $core.withContext(function($ctx1) {
  26624. $recv($self._current())._show_(anObject);
  26625. return self;
  26626. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.a$cls)});
  26627. },
  26628. args: ["anObject"],
  26629. source: "show: anObject\x0a\x09self current show: anObject",
  26630. referencedClasses: [],
  26631. messageSends: ["show:", "current"]
  26632. }),
  26633. $globals.Transcript.a$cls);
  26634. $core.addMethod(
  26635. $core.method({
  26636. selector: "inspectOn:",
  26637. protocol: "*Platform-Services",
  26638. fn: function (anInspector){
  26639. var self=this,$self=this;
  26640. var variables;
  26641. return $core.withContext(function($ctx1) {
  26642. variables=$recv($globals.Dictionary)._new();
  26643. $recv(variables)._at_put_("#self",self);
  26644. $ctx1.sendIdx["at:put:"]=1;
  26645. $recv(variables)._at_put_("#keys",$self._keys());
  26646. $ctx1.sendIdx["at:put:"]=2;
  26647. $self._keysAndValuesDo_((function(key,value){
  26648. return $core.withContext(function($ctx2) {
  26649. return $recv(variables)._at_put_(key,value);
  26650. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  26651. }));
  26652. $recv(anInspector)._setLabel_($self._printString());
  26653. $recv(anInspector)._setVariables_(variables);
  26654. return self;
  26655. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  26656. },
  26657. args: ["anInspector"],
  26658. 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",
  26659. referencedClasses: ["Dictionary"],
  26660. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  26661. }),
  26662. $globals.AssociativeCollection);
  26663. $core.addMethod(
  26664. $core.method({
  26665. selector: "inspectOn:",
  26666. protocol: "*Platform-Services",
  26667. fn: function (anInspector){
  26668. var self=this,$self=this;
  26669. var variables;
  26670. return $core.withContext(function($ctx1) {
  26671. variables=$recv($globals.Dictionary)._new();
  26672. $recv(variables)._at_put_("#self",self);
  26673. $ctx1.sendIdx["at:put:"]=1;
  26674. $self._withIndexDo_((function(each,i){
  26675. return $core.withContext(function($ctx2) {
  26676. return $recv(variables)._at_put_(i,each);
  26677. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  26678. }));
  26679. $recv(anInspector)._setLabel_($self._printString());
  26680. $recv(anInspector)._setVariables_(variables);
  26681. return self;
  26682. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  26683. },
  26684. args: ["anInspector"],
  26685. 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",
  26686. referencedClasses: ["Dictionary"],
  26687. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  26688. }),
  26689. $globals.Collection);
  26690. $core.addMethod(
  26691. $core.method({
  26692. selector: "inspectOn:",
  26693. protocol: "*Platform-Services",
  26694. fn: function (anInspector){
  26695. var self=this,$self=this;
  26696. var variables;
  26697. return $core.withContext(function($ctx1) {
  26698. variables=$recv($globals.Dictionary)._new();
  26699. $recv(variables)._at_put_("#self",self);
  26700. $ctx1.sendIdx["at:put:"]=1;
  26701. $recv(variables)._at_put_("#year",$self._year());
  26702. $ctx1.sendIdx["at:put:"]=2;
  26703. $recv(variables)._at_put_("#month",$self._month());
  26704. $ctx1.sendIdx["at:put:"]=3;
  26705. $recv(variables)._at_put_("#day",$self._day());
  26706. $ctx1.sendIdx["at:put:"]=4;
  26707. $recv(variables)._at_put_("#hours",$self._hours());
  26708. $ctx1.sendIdx["at:put:"]=5;
  26709. $recv(variables)._at_put_("#minutes",$self._minutes());
  26710. $ctx1.sendIdx["at:put:"]=6;
  26711. $recv(variables)._at_put_("#seconds",$self._seconds());
  26712. $ctx1.sendIdx["at:put:"]=7;
  26713. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  26714. $recv(anInspector)._setLabel_($self._printString());
  26715. $recv(anInspector)._setVariables_(variables);
  26716. return self;
  26717. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  26718. },
  26719. args: ["anInspector"],
  26720. 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",
  26721. referencedClasses: ["Dictionary"],
  26722. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  26723. }),
  26724. $globals.Date);
  26725. $core.addMethod(
  26726. $core.method({
  26727. selector: "inspectOn:",
  26728. protocol: "*Platform-Services",
  26729. fn: function (anInspector){
  26730. var self=this,$self=this;
  26731. var variables;
  26732. return $core.withContext(function($ctx1) {
  26733. variables=$recv($globals.Dictionary)._new();
  26734. $recv(variables)._at_put_("#self",$self._jsObject());
  26735. $recv(anInspector)._setLabel_($self._printString());
  26736. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  26737. $recv(anInspector)._setVariables_(variables);
  26738. return self;
  26739. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  26740. },
  26741. args: ["anInspector"],
  26742. 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",
  26743. referencedClasses: ["Dictionary", "JSObjectProxy"],
  26744. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  26745. }),
  26746. $globals.JSObjectProxy);
  26747. $core.addMethod(
  26748. $core.method({
  26749. selector: "inspectOn:",
  26750. protocol: "*Platform-Services",
  26751. fn: function (anInspector){
  26752. var self=this,$self=this;
  26753. var variables;
  26754. return $core.withContext(function($ctx1) {
  26755. variables=$recv($globals.Dictionary)._new();
  26756. $recv(variables)._at_put_("#self",self);
  26757. $ctx1.sendIdx["at:put:"]=1;
  26758. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  26759. return $core.withContext(function($ctx2) {
  26760. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26761. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26762. }));
  26763. $recv(anInspector)._setLabel_($self._printString());
  26764. $recv(anInspector)._setVariables_(variables);
  26765. return self;
  26766. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  26767. },
  26768. args: ["anInspector"],
  26769. 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",
  26770. referencedClasses: ["Dictionary"],
  26771. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26772. }),
  26773. $globals.Object);
  26774. $core.addMethod(
  26775. $core.method({
  26776. selector: "do:displayingProgress:",
  26777. protocol: "*Platform-Services",
  26778. fn: function (aBlock,aString){
  26779. var self=this,$self=this;
  26780. return $core.withContext(function($ctx1) {
  26781. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  26782. return self;
  26783. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  26784. },
  26785. args: ["aBlock", "aString"],
  26786. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  26787. referencedClasses: ["ProgressHandler"],
  26788. messageSends: ["do:on:displaying:"]
  26789. }),
  26790. $globals.SequenceableCollection);
  26791. $core.addMethod(
  26792. $core.method({
  26793. selector: "inspectOn:",
  26794. protocol: "*Platform-Services",
  26795. fn: function (anInspector){
  26796. var self=this,$self=this;
  26797. var variables,i;
  26798. return $core.withContext(function($ctx1) {
  26799. variables=$recv($globals.Dictionary)._new();
  26800. $recv(variables)._at_put_("#self",self);
  26801. $ctx1.sendIdx["at:put:"]=1;
  26802. i=(1);
  26803. $self._do_((function(each){
  26804. return $core.withContext(function($ctx2) {
  26805. $recv(variables)._at_put_(i,each);
  26806. i=$recv(i).__plus((1));
  26807. return i;
  26808. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26809. }));
  26810. $recv(anInspector)._setLabel_($self._printString());
  26811. $recv(anInspector)._setVariables_(variables);
  26812. return self;
  26813. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  26814. },
  26815. args: ["anInspector"],
  26816. 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",
  26817. referencedClasses: ["Dictionary"],
  26818. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  26819. }),
  26820. $globals.Set);
  26821. $core.addMethod(
  26822. $core.method({
  26823. selector: "inspectOn:",
  26824. protocol: "*Platform-Services",
  26825. fn: function (anInspector){
  26826. var self=this,$self=this;
  26827. var label;
  26828. return $core.withContext(function($ctx1) {
  26829. var $3,$2,$1,$5,$4;
  26830. (
  26831. $ctx1.supercall = true,
  26832. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($self, [anInspector]));
  26833. $ctx1.supercall = false;
  26834. $3=$self._printString();
  26835. $ctx1.sendIdx["printString"]=1;
  26836. $2=$recv($3)._size();
  26837. $1=$recv($2).__gt((30));
  26838. if($core.assert($1)){
  26839. $5=$self._printString();
  26840. $ctx1.sendIdx["printString"]=2;
  26841. $4=$recv($5)._copyFrom_to_((1),(30));
  26842. label=$recv($4).__comma("...'");
  26843. label;
  26844. } else {
  26845. label=$self._printString();
  26846. label;
  26847. }
  26848. $recv(anInspector)._setLabel_(label);
  26849. return self;
  26850. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  26851. },
  26852. args: ["anInspector"],
  26853. 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",
  26854. referencedClasses: [],
  26855. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  26856. }),
  26857. $globals.String);
  26858. $core.addMethod(
  26859. $core.method({
  26860. selector: "inspectOn:",
  26861. protocol: "*Platform-Services",
  26862. fn: function (anInspector){
  26863. var self=this,$self=this;
  26864. var variables;
  26865. return $core.withContext(function($ctx1) {
  26866. variables=$recv($globals.Dictionary)._new();
  26867. $recv(variables)._at_put_("#self",self);
  26868. $ctx1.sendIdx["at:put:"]=1;
  26869. $recv(variables)._at_put_("#home",$self._home());
  26870. $ctx1.sendIdx["at:put:"]=2;
  26871. $recv(variables)._at_put_("#receiver",$self._receiver());
  26872. $ctx1.sendIdx["at:put:"]=3;
  26873. $recv(variables)._at_put_("#selector",$self._selector());
  26874. $ctx1.sendIdx["at:put:"]=4;
  26875. $recv(variables)._at_put_("#locals",$self._locals());
  26876. $ctx1.sendIdx["at:put:"]=5;
  26877. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  26878. return $core.withContext(function($ctx2) {
  26879. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26880. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26881. }));
  26882. $recv(anInspector)._setLabel_($self._printString());
  26883. $recv(anInspector)._setVariables_(variables);
  26884. return self;
  26885. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.TMethodContext)});
  26886. },
  26887. args: ["anInspector"],
  26888. 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",
  26889. referencedClasses: ["Dictionary"],
  26890. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26891. }),
  26892. $globals.TMethodContext);
  26893. });
  26894. define('amber/deploy',[
  26895. './helpers',
  26896. './boot', // pre-fetch, dep of ./helpers
  26897. // --- packages of the core Amber begin here ---
  26898. 'amber/core/Kernel-Helpers',
  26899. 'amber/core/Kernel-Objects',
  26900. 'amber/core/Kernel-Classes',
  26901. 'amber/core/Kernel-Methods',
  26902. 'amber/core/Kernel-Collections',
  26903. 'amber/core/Kernel-Dag',
  26904. 'amber/core/Kernel-Infrastructure',
  26905. 'amber/core/Kernel-Promises',
  26906. 'amber/core/Kernel-Exceptions',
  26907. 'amber/core/Kernel-Announcements',
  26908. 'amber/core/Platform-Services',
  26909. // --- packages of the core Amber end here ---
  26910. ], function (amber) {
  26911. return amber;
  26912. });
  26913. // jshint ignore:start
  26914. define('amber/parser',['./boot'], function($boot) {
  26915. var $globals = $boot.globals;
  26916. $globals.SmalltalkParser = (function() {
  26917. "use strict";
  26918. /*
  26919. * Generated by PEG.js 0.9.0.
  26920. *
  26921. * http://pegjs.org/
  26922. */
  26923. function peg$subclass(child, parent) {
  26924. function ctor() { this.constructor = child; }
  26925. ctor.prototype = parent.prototype;
  26926. child.prototype = new ctor();
  26927. }
  26928. function peg$SyntaxError(message, expected, found, location) {
  26929. this.message = message;
  26930. this.expected = expected;
  26931. this.found = found;
  26932. this.location = location;
  26933. this.name = "SyntaxError";
  26934. if (typeof Error.captureStackTrace === "function") {
  26935. Error.captureStackTrace(this, peg$SyntaxError);
  26936. }
  26937. }
  26938. peg$subclass(peg$SyntaxError, Error);
  26939. function peg$parse(input) {
  26940. var options = arguments.length > 1 ? arguments[1] : {},
  26941. parser = this,
  26942. peg$FAILED = {},
  26943. peg$startRuleFunctions = { start: peg$parsestart },
  26944. peg$startRuleFunction = peg$parsestart,
  26945. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  26946. 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]" },
  26947. peg$c2 = "\"",
  26948. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  26949. peg$c4 = /^[^"]/,
  26950. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  26951. peg$c6 = ".",
  26952. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  26953. peg$c8 = /^[a-zA-Z]/,
  26954. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  26955. peg$c10 = /^[a-zA-Z0-9]/,
  26956. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  26957. peg$c12 = ":",
  26958. peg$c13 = { type: "literal", value: ":", description: "\":\"" },
  26959. peg$c14 = /^[A-Z]/,
  26960. peg$c15 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  26961. peg$c16 = function(val) {
  26962. return $globals.ValueNode._new()
  26963. ._location_(location())
  26964. ._source_(text())
  26965. ._value_(val);
  26966. },
  26967. peg$c17 = "'",
  26968. peg$c18 = { type: "literal", value: "'", description: "\"'\"" },
  26969. peg$c19 = "''",
  26970. peg$c20 = { type: "literal", value: "''", description: "\"''\"" },
  26971. peg$c21 = function() {return '\'';},
  26972. peg$c22 = /^[^']/,
  26973. peg$c23 = { type: "class", value: "[^']", description: "[^']" },
  26974. peg$c24 = function(val) {return val.join('');},
  26975. peg$c25 = "$",
  26976. peg$c26 = { type: "literal", value: "$", description: "\"$\"" },
  26977. peg$c27 = { type: "any", description: "any character" },
  26978. peg$c28 = function(char) {
  26979. return $globals.ValueNode._new()
  26980. ._location_(location())
  26981. ._source_(text())
  26982. ._value_(char);
  26983. },
  26984. peg$c29 = "#",
  26985. peg$c30 = { type: "literal", value: "#", description: "\"#\"" },
  26986. peg$c31 = function(rest) {return rest;},
  26987. peg$c32 = "e",
  26988. peg$c33 = { type: "literal", value: "e", description: "\"e\"" },
  26989. peg$c34 = function(n) {return parseFloat(n);},
  26990. peg$c35 = "-",
  26991. peg$c36 = { type: "literal", value: "-", description: "\"-\"" },
  26992. peg$c37 = "16r",
  26993. peg$c38 = { type: "literal", value: "16r", description: "\"16r\"" },
  26994. peg$c39 = /^[0-9a-fA-F]/,
  26995. peg$c40 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  26996. peg$c41 = function(neg, num) {
  26997. return parseInt(((neg || '') + num), 16);
  26998. },
  26999. peg$c42 = /^[0-9]/,
  27000. peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
  27001. peg$c44 = function(n) {return parseFloat(n, 10);},
  27002. peg$c45 = function(n) {return parseInt(n, 10);},
  27003. peg$c46 = "#(",
  27004. peg$c47 = { type: "literal", value: "#(", description: "\"#(\"" },
  27005. peg$c48 = ")",
  27006. peg$c49 = { type: "literal", value: ")", description: "\")\"" },
  27007. peg$c50 = function(rest) {
  27008. return rest
  27009. ._location_(location())
  27010. ._source_(text());
  27011. },
  27012. peg$c51 = "(",
  27013. peg$c52 = { type: "literal", value: "(", description: "\"(\"" },
  27014. peg$c53 = function(lit) {return lit._value();},
  27015. peg$c54 = function(lits) {
  27016. return $globals.ValueNode._new()
  27017. ._value_(lits);
  27018. },
  27019. peg$c55 = "{",
  27020. peg$c56 = { type: "literal", value: "{", description: "\"{\"" },
  27021. peg$c57 = "}",
  27022. peg$c58 = { type: "literal", value: "}", description: "\"}\"" },
  27023. peg$c59 = function(expressions) {
  27024. return $globals.DynamicArrayNode._new()
  27025. ._location_(location())
  27026. ._source_(text())
  27027. ._dagChildren_(expressions || []);
  27028. },
  27029. peg$c60 = "#{",
  27030. peg$c61 = { type: "literal", value: "#{", description: "\"#{\"" },
  27031. peg$c62 = function(expressions) {
  27032. return $globals.DynamicDictionaryNode._new()
  27033. ._location_(location())
  27034. ._source_(text())
  27035. ._dagChildren_(expressions || []);
  27036. },
  27037. peg$c63 = "true",
  27038. peg$c64 = { type: "literal", value: "true", description: "\"true\"" },
  27039. peg$c65 = function() {return true;},
  27040. peg$c66 = "false",
  27041. peg$c67 = { type: "literal", value: "false", description: "\"false\"" },
  27042. peg$c68 = function() {return false;},
  27043. peg$c69 = "nil",
  27044. peg$c70 = { type: "literal", value: "nil", description: "\"nil\"" },
  27045. peg$c71 = function() {return null;},
  27046. peg$c72 = function(identifier) {
  27047. return $globals.VariableNode._new()
  27048. ._location_(location())
  27049. ._source_(text())
  27050. ._value_(identifier);
  27051. },
  27052. peg$c73 = /^[\\+*\/=><,@%~|&\-]/,
  27053. peg$c74 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  27054. peg$c75 = function(key, arg) {return {key:key, arg:arg};},
  27055. peg$c76 = function(pairs) {
  27056. var selector = '';
  27057. var params = [];
  27058. for(var i = 0; i < pairs.length; i++) {
  27059. selector += pairs[i].key;
  27060. params.push(pairs[i].arg);
  27061. }
  27062. return [selector, params];
  27063. },
  27064. peg$c77 = function(selector, arg) {
  27065. return [selector, [arg]];
  27066. },
  27067. peg$c78 = function(selector) {return [selector, []];},
  27068. peg$c79 = function(expression) {
  27069. return expression;
  27070. },
  27071. peg$c80 = function(first, others) {
  27072. return [first].concat(others);
  27073. },
  27074. peg$c81 = function(selector) {
  27075. return $globals.Message._selector_arguments_(selector, []);
  27076. },
  27077. peg$c82 = function(pairs) {
  27078. var selector = '';
  27079. var args = [];
  27080. for(var i = 0; i < pairs.length; i++) {
  27081. selector += pairs[i].key;
  27082. args.push(pairs[i].arg._value());
  27083. }
  27084. return $globals.Message._selector_arguments_(selector, args)
  27085. },
  27086. peg$c83 = "<",
  27087. peg$c84 = { type: "literal", value: "<", description: "\"<\"" },
  27088. peg$c85 = ">",
  27089. peg$c86 = { type: "literal", value: ">", description: "\">\"" },
  27090. peg$c87 = function(message) {return message;},
  27091. peg$c88 = ":=",
  27092. peg$c89 = { type: "literal", value: ":=", description: "\":=\"" },
  27093. peg$c90 = function(variable, expression) {
  27094. return $globals.AssignmentNode._new()
  27095. ._location_(location())
  27096. ._source_(text())
  27097. ._left_(variable)
  27098. ._right_(expression);
  27099. },
  27100. peg$c91 = "^",
  27101. peg$c92 = { type: "literal", value: "^", description: "\"^\"" },
  27102. peg$c93 = function(expression) {
  27103. return $globals.ReturnNode._new()
  27104. ._location_(location())
  27105. ._source_(text())
  27106. ._dagChildren_([expression]);
  27107. },
  27108. peg$c94 = "|",
  27109. peg$c95 = { type: "literal", value: "|", description: "\"|\"" },
  27110. peg$c96 = function(variable) {return variable;},
  27111. peg$c97 = function(vars) {
  27112. return vars;
  27113. },
  27114. peg$c98 = function(param) {return param;},
  27115. peg$c99 = function(params) {
  27116. return params;
  27117. },
  27118. peg$c100 = function(ret) {return [ret];},
  27119. peg$c101 = function(exps, ret) {
  27120. var expressions = exps;
  27121. expressions.push(ret);
  27122. return expressions;
  27123. },
  27124. peg$c102 = function(expressions) {return expressions || [];},
  27125. peg$c103 = function(aPragmas, temps, zPragmas, statements) {
  27126. return $globals.SequenceNode._new()
  27127. ._location_(location())
  27128. ._source_(text())
  27129. ._temps_(temps || [])
  27130. ._pragmas_((aPragmas || []).concat(zPragmas || []))
  27131. ._dagChildren_(statements || []);
  27132. },
  27133. peg$c104 = "[",
  27134. peg$c105 = { type: "literal", value: "[", description: "\"[\"" },
  27135. peg$c106 = "]",
  27136. peg$c107 = { type: "literal", value: "]", description: "\"]\"" },
  27137. peg$c108 = function(params, sequence) {
  27138. return $globals.BlockNode._new()
  27139. ._location_(location())
  27140. ._source_(text())
  27141. ._parameters_(params || [])
  27142. ._dagChildren_([sequence._asBlockSequenceNode()]);
  27143. },
  27144. peg$c109 = function(selector) {
  27145. return $globals.SendNode._new()
  27146. ._location_(location())
  27147. ._source_(text())
  27148. ._selector_(selector);
  27149. },
  27150. peg$c110 = function(receiver, tail) {
  27151. return receiver._withTail_(tail);
  27152. },
  27153. peg$c111 = function(selector, arg) {
  27154. return $globals.SendNode._new()
  27155. ._location_(location())
  27156. ._source_(text())
  27157. ._selector_(selector)
  27158. ._arguments_([arg]);
  27159. },
  27160. peg$c112 = function(unarys, binarys) { return unarys.concat(binarys); },
  27161. peg$c113 = function(pairs) {
  27162. var selector = '';
  27163. var args = [];
  27164. for(var i = 0; i < pairs.length; i++) {
  27165. selector += pairs[i].key;
  27166. args.push(pairs[i].arg);
  27167. }
  27168. return $globals.SendNode._new()
  27169. ._location_(location())
  27170. ._source_(text())
  27171. ._selector_(selector)
  27172. ._arguments_(args);
  27173. },
  27174. peg$c114 = function(binarys, final) {
  27175. if (final) binarys.push(final);
  27176. return binarys;
  27177. },
  27178. peg$c115 = function(receiver, tail) {return tail.length > 0;},
  27179. peg$c116 = ";",
  27180. peg$c117 = { type: "literal", value: ";", description: "\";\"" },
  27181. peg$c118 = function(receiver, tail, mess) {return mess;},
  27182. peg$c119 = function(receiver, tail, messages) {
  27183. messages.unshift(receiver._withTail_(tail));
  27184. return $globals.CascadeNode._new()
  27185. ._location_(location())
  27186. ._source_(text())
  27187. ._dagChildren_(messages);
  27188. },
  27189. peg$c120 = function(pattern, sequence) {
  27190. return $globals.MethodNode._new()
  27191. ._location_(location())
  27192. ._source_(text())
  27193. ._selector_(pattern[0])
  27194. ._arguments_(pattern[1])
  27195. ._dagChildren_([sequence]);
  27196. },
  27197. peg$c121 = function(receiver, tail) { return tail.length > 0 && tail[tail.length-1]._selector() === '->' },
  27198. peg$c122 = function(receiver, tail) {
  27199. var last = tail.pop();
  27200. return [receiver._withTail_(tail), last._arguments()[0]];
  27201. },
  27202. peg$c123 = function(first, others) {
  27203. return first.concat.apply(first, others);
  27204. },
  27205. peg$currPos = 0,
  27206. peg$savedPos = 0,
  27207. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  27208. peg$maxFailPos = 0,
  27209. peg$maxFailExpected = [],
  27210. peg$silentFails = 0,
  27211. peg$resultsCache = {},
  27212. peg$result;
  27213. if ("startRule" in options) {
  27214. if (!(options.startRule in peg$startRuleFunctions)) {
  27215. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  27216. }
  27217. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  27218. }
  27219. function text() {
  27220. return input.substring(peg$savedPos, peg$currPos);
  27221. }
  27222. function location() {
  27223. return peg$computeLocation(peg$savedPos, peg$currPos);
  27224. }
  27225. function expected(description) {
  27226. throw peg$buildException(
  27227. null,
  27228. [{ type: "other", description: description }],
  27229. input.substring(peg$savedPos, peg$currPos),
  27230. peg$computeLocation(peg$savedPos, peg$currPos)
  27231. );
  27232. }
  27233. function error(message) {
  27234. throw peg$buildException(
  27235. message,
  27236. null,
  27237. input.substring(peg$savedPos, peg$currPos),
  27238. peg$computeLocation(peg$savedPos, peg$currPos)
  27239. );
  27240. }
  27241. function peg$computePosDetails(pos) {
  27242. var details = peg$posDetailsCache[pos],
  27243. p, ch;
  27244. if (details) {
  27245. return details;
  27246. } else {
  27247. p = pos - 1;
  27248. while (!peg$posDetailsCache[p]) {
  27249. p--;
  27250. }
  27251. details = peg$posDetailsCache[p];
  27252. details = {
  27253. line: details.line,
  27254. column: details.column,
  27255. seenCR: details.seenCR
  27256. };
  27257. while (p < pos) {
  27258. ch = input.charAt(p);
  27259. if (ch === "\n") {
  27260. if (!details.seenCR) { details.line++; }
  27261. details.column = 1;
  27262. details.seenCR = false;
  27263. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  27264. details.line++;
  27265. details.column = 1;
  27266. details.seenCR = true;
  27267. } else {
  27268. details.column++;
  27269. details.seenCR = false;
  27270. }
  27271. p++;
  27272. }
  27273. peg$posDetailsCache[pos] = details;
  27274. return details;
  27275. }
  27276. }
  27277. function peg$computeLocation(startPos, endPos) {
  27278. var startPosDetails = peg$computePosDetails(startPos),
  27279. endPosDetails = peg$computePosDetails(endPos);
  27280. return {
  27281. start: {
  27282. offset: startPos,
  27283. line: startPosDetails.line,
  27284. column: startPosDetails.column
  27285. },
  27286. end: {
  27287. offset: endPos,
  27288. line: endPosDetails.line,
  27289. column: endPosDetails.column
  27290. }
  27291. };
  27292. }
  27293. function peg$fail(expected) {
  27294. if (peg$currPos < peg$maxFailPos) { return; }
  27295. if (peg$currPos > peg$maxFailPos) {
  27296. peg$maxFailPos = peg$currPos;
  27297. peg$maxFailExpected = [];
  27298. }
  27299. peg$maxFailExpected.push(expected);
  27300. }
  27301. function peg$buildException(message, expected, found, location) {
  27302. function cleanupExpected(expected) {
  27303. var i = 1;
  27304. expected.sort(function(a, b) {
  27305. if (a.description < b.description) {
  27306. return -1;
  27307. } else if (a.description > b.description) {
  27308. return 1;
  27309. } else {
  27310. return 0;
  27311. }
  27312. });
  27313. while (i < expected.length) {
  27314. if (expected[i - 1] === expected[i]) {
  27315. expected.splice(i, 1);
  27316. } else {
  27317. i++;
  27318. }
  27319. }
  27320. }
  27321. function buildMessage(expected, found) {
  27322. function stringEscape(s) {
  27323. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  27324. return s
  27325. .replace(/\\/g, '\\\\')
  27326. .replace(/"/g, '\\"')
  27327. .replace(/\x08/g, '\\b')
  27328. .replace(/\t/g, '\\t')
  27329. .replace(/\n/g, '\\n')
  27330. .replace(/\f/g, '\\f')
  27331. .replace(/\r/g, '\\r')
  27332. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  27333. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  27334. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  27335. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  27336. }
  27337. var expectedDescs = new Array(expected.length),
  27338. expectedDesc, foundDesc, i;
  27339. for (i = 0; i < expected.length; i++) {
  27340. expectedDescs[i] = expected[i].description;
  27341. }
  27342. expectedDesc = expected.length > 1
  27343. ? expectedDescs.slice(0, -1).join(", ")
  27344. + " or "
  27345. + expectedDescs[expected.length - 1]
  27346. : expectedDescs[0];
  27347. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  27348. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  27349. }
  27350. if (expected !== null) {
  27351. cleanupExpected(expected);
  27352. }
  27353. return new peg$SyntaxError(
  27354. message !== null ? message : buildMessage(expected, found),
  27355. expected,
  27356. found,
  27357. location
  27358. );
  27359. }
  27360. function peg$parsestart() {
  27361. var s0;
  27362. var key = peg$currPos * 66 + 0,
  27363. cached = peg$resultsCache[key];
  27364. if (cached) {
  27365. peg$currPos = cached.nextPos;
  27366. return cached.result;
  27367. }
  27368. s0 = peg$parsemethod();
  27369. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27370. return s0;
  27371. }
  27372. function peg$parseseparator() {
  27373. var s0, s1;
  27374. var key = peg$currPos * 66 + 1,
  27375. cached = peg$resultsCache[key];
  27376. if (cached) {
  27377. peg$currPos = cached.nextPos;
  27378. return cached.result;
  27379. }
  27380. s0 = [];
  27381. if (peg$c0.test(input.charAt(peg$currPos))) {
  27382. s1 = input.charAt(peg$currPos);
  27383. peg$currPos++;
  27384. } else {
  27385. s1 = peg$FAILED;
  27386. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27387. }
  27388. if (s1 !== peg$FAILED) {
  27389. while (s1 !== peg$FAILED) {
  27390. s0.push(s1);
  27391. if (peg$c0.test(input.charAt(peg$currPos))) {
  27392. s1 = input.charAt(peg$currPos);
  27393. peg$currPos++;
  27394. } else {
  27395. s1 = peg$FAILED;
  27396. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27397. }
  27398. }
  27399. } else {
  27400. s0 = peg$FAILED;
  27401. }
  27402. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27403. return s0;
  27404. }
  27405. function peg$parsecomments() {
  27406. var s0, s1, s2, s3, s4;
  27407. var key = peg$currPos * 66 + 2,
  27408. cached = peg$resultsCache[key];
  27409. if (cached) {
  27410. peg$currPos = cached.nextPos;
  27411. return cached.result;
  27412. }
  27413. s0 = [];
  27414. s1 = peg$currPos;
  27415. if (input.charCodeAt(peg$currPos) === 34) {
  27416. s2 = peg$c2;
  27417. peg$currPos++;
  27418. } else {
  27419. s2 = peg$FAILED;
  27420. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27421. }
  27422. if (s2 !== peg$FAILED) {
  27423. s3 = [];
  27424. if (peg$c4.test(input.charAt(peg$currPos))) {
  27425. s4 = input.charAt(peg$currPos);
  27426. peg$currPos++;
  27427. } else {
  27428. s4 = peg$FAILED;
  27429. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27430. }
  27431. while (s4 !== peg$FAILED) {
  27432. s3.push(s4);
  27433. if (peg$c4.test(input.charAt(peg$currPos))) {
  27434. s4 = input.charAt(peg$currPos);
  27435. peg$currPos++;
  27436. } else {
  27437. s4 = peg$FAILED;
  27438. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27439. }
  27440. }
  27441. if (s3 !== peg$FAILED) {
  27442. if (input.charCodeAt(peg$currPos) === 34) {
  27443. s4 = peg$c2;
  27444. peg$currPos++;
  27445. } else {
  27446. s4 = peg$FAILED;
  27447. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27448. }
  27449. if (s4 !== peg$FAILED) {
  27450. s2 = [s2, s3, s4];
  27451. s1 = s2;
  27452. } else {
  27453. peg$currPos = s1;
  27454. s1 = peg$FAILED;
  27455. }
  27456. } else {
  27457. peg$currPos = s1;
  27458. s1 = peg$FAILED;
  27459. }
  27460. } else {
  27461. peg$currPos = s1;
  27462. s1 = peg$FAILED;
  27463. }
  27464. if (s1 !== peg$FAILED) {
  27465. while (s1 !== peg$FAILED) {
  27466. s0.push(s1);
  27467. s1 = peg$currPos;
  27468. if (input.charCodeAt(peg$currPos) === 34) {
  27469. s2 = peg$c2;
  27470. peg$currPos++;
  27471. } else {
  27472. s2 = peg$FAILED;
  27473. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27474. }
  27475. if (s2 !== peg$FAILED) {
  27476. s3 = [];
  27477. if (peg$c4.test(input.charAt(peg$currPos))) {
  27478. s4 = input.charAt(peg$currPos);
  27479. peg$currPos++;
  27480. } else {
  27481. s4 = peg$FAILED;
  27482. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27483. }
  27484. while (s4 !== peg$FAILED) {
  27485. s3.push(s4);
  27486. if (peg$c4.test(input.charAt(peg$currPos))) {
  27487. s4 = input.charAt(peg$currPos);
  27488. peg$currPos++;
  27489. } else {
  27490. s4 = peg$FAILED;
  27491. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27492. }
  27493. }
  27494. if (s3 !== peg$FAILED) {
  27495. if (input.charCodeAt(peg$currPos) === 34) {
  27496. s4 = peg$c2;
  27497. peg$currPos++;
  27498. } else {
  27499. s4 = peg$FAILED;
  27500. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27501. }
  27502. if (s4 !== peg$FAILED) {
  27503. s2 = [s2, s3, s4];
  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. } else {
  27514. peg$currPos = s1;
  27515. s1 = peg$FAILED;
  27516. }
  27517. }
  27518. } else {
  27519. s0 = peg$FAILED;
  27520. }
  27521. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27522. return s0;
  27523. }
  27524. function peg$parsews() {
  27525. var s0, s1;
  27526. var key = peg$currPos * 66 + 3,
  27527. cached = peg$resultsCache[key];
  27528. if (cached) {
  27529. peg$currPos = cached.nextPos;
  27530. return cached.result;
  27531. }
  27532. s0 = [];
  27533. s1 = peg$parseseparator();
  27534. if (s1 === peg$FAILED) {
  27535. s1 = peg$parsecomments();
  27536. }
  27537. while (s1 !== peg$FAILED) {
  27538. s0.push(s1);
  27539. s1 = peg$parseseparator();
  27540. if (s1 === peg$FAILED) {
  27541. s1 = peg$parsecomments();
  27542. }
  27543. }
  27544. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27545. return s0;
  27546. }
  27547. function peg$parsemaybeDotsWs() {
  27548. var s0, s1;
  27549. var key = peg$currPos * 66 + 4,
  27550. cached = peg$resultsCache[key];
  27551. if (cached) {
  27552. peg$currPos = cached.nextPos;
  27553. return cached.result;
  27554. }
  27555. s0 = [];
  27556. if (input.charCodeAt(peg$currPos) === 46) {
  27557. s1 = peg$c6;
  27558. peg$currPos++;
  27559. } else {
  27560. s1 = peg$FAILED;
  27561. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27562. }
  27563. if (s1 === peg$FAILED) {
  27564. s1 = peg$parseseparator();
  27565. if (s1 === peg$FAILED) {
  27566. s1 = peg$parsecomments();
  27567. }
  27568. }
  27569. while (s1 !== peg$FAILED) {
  27570. s0.push(s1);
  27571. if (input.charCodeAt(peg$currPos) === 46) {
  27572. s1 = peg$c6;
  27573. peg$currPos++;
  27574. } else {
  27575. s1 = peg$FAILED;
  27576. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27577. }
  27578. if (s1 === peg$FAILED) {
  27579. s1 = peg$parseseparator();
  27580. if (s1 === peg$FAILED) {
  27581. s1 = peg$parsecomments();
  27582. }
  27583. }
  27584. }
  27585. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27586. return s0;
  27587. }
  27588. function peg$parsesomeDotsWs() {
  27589. var s0, s1, s2, s3;
  27590. var key = peg$currPos * 66 + 5,
  27591. cached = peg$resultsCache[key];
  27592. if (cached) {
  27593. peg$currPos = cached.nextPos;
  27594. return cached.result;
  27595. }
  27596. s0 = peg$currPos;
  27597. s1 = peg$parsews();
  27598. if (s1 !== peg$FAILED) {
  27599. if (input.charCodeAt(peg$currPos) === 46) {
  27600. s2 = peg$c6;
  27601. peg$currPos++;
  27602. } else {
  27603. s2 = peg$FAILED;
  27604. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27605. }
  27606. if (s2 !== peg$FAILED) {
  27607. s3 = peg$parsemaybeDotsWs();
  27608. if (s3 !== peg$FAILED) {
  27609. s1 = [s1, s2, s3];
  27610. s0 = s1;
  27611. } else {
  27612. peg$currPos = s0;
  27613. s0 = peg$FAILED;
  27614. }
  27615. } else {
  27616. peg$currPos = s0;
  27617. s0 = peg$FAILED;
  27618. }
  27619. } else {
  27620. peg$currPos = s0;
  27621. s0 = peg$FAILED;
  27622. }
  27623. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27624. return s0;
  27625. }
  27626. function peg$parseidentifier() {
  27627. var s0, s1, s2, s3, s4;
  27628. var key = peg$currPos * 66 + 6,
  27629. cached = peg$resultsCache[key];
  27630. if (cached) {
  27631. peg$currPos = cached.nextPos;
  27632. return cached.result;
  27633. }
  27634. s0 = peg$currPos;
  27635. s1 = peg$currPos;
  27636. if (peg$c8.test(input.charAt(peg$currPos))) {
  27637. s2 = input.charAt(peg$currPos);
  27638. peg$currPos++;
  27639. } else {
  27640. s2 = peg$FAILED;
  27641. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  27642. }
  27643. if (s2 !== peg$FAILED) {
  27644. s3 = [];
  27645. if (peg$c10.test(input.charAt(peg$currPos))) {
  27646. s4 = input.charAt(peg$currPos);
  27647. peg$currPos++;
  27648. } else {
  27649. s4 = peg$FAILED;
  27650. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27651. }
  27652. while (s4 !== peg$FAILED) {
  27653. s3.push(s4);
  27654. if (peg$c10.test(input.charAt(peg$currPos))) {
  27655. s4 = input.charAt(peg$currPos);
  27656. peg$currPos++;
  27657. } else {
  27658. s4 = peg$FAILED;
  27659. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27660. }
  27661. }
  27662. if (s3 !== peg$FAILED) {
  27663. s2 = [s2, s3];
  27664. s1 = s2;
  27665. } else {
  27666. peg$currPos = s1;
  27667. s1 = peg$FAILED;
  27668. }
  27669. } else {
  27670. peg$currPos = s1;
  27671. s1 = peg$FAILED;
  27672. }
  27673. if (s1 !== peg$FAILED) {
  27674. s0 = input.substring(s0, peg$currPos);
  27675. } else {
  27676. s0 = s1;
  27677. }
  27678. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27679. return s0;
  27680. }
  27681. function peg$parsekeyword() {
  27682. var s0, s1, s2, s3;
  27683. var key = peg$currPos * 66 + 7,
  27684. cached = peg$resultsCache[key];
  27685. if (cached) {
  27686. peg$currPos = cached.nextPos;
  27687. return cached.result;
  27688. }
  27689. s0 = peg$currPos;
  27690. s1 = peg$currPos;
  27691. s2 = peg$parseidentifier();
  27692. if (s2 !== peg$FAILED) {
  27693. if (input.charCodeAt(peg$currPos) === 58) {
  27694. s3 = peg$c12;
  27695. peg$currPos++;
  27696. } else {
  27697. s3 = peg$FAILED;
  27698. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27699. }
  27700. if (s3 !== peg$FAILED) {
  27701. s2 = [s2, s3];
  27702. s1 = s2;
  27703. } else {
  27704. peg$currPos = s1;
  27705. s1 = peg$FAILED;
  27706. }
  27707. } else {
  27708. peg$currPos = s1;
  27709. s1 = peg$FAILED;
  27710. }
  27711. if (s1 !== peg$FAILED) {
  27712. s0 = input.substring(s0, peg$currPos);
  27713. } else {
  27714. s0 = s1;
  27715. }
  27716. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27717. return s0;
  27718. }
  27719. function peg$parseclassName() {
  27720. var s0, s1, s2, s3, s4;
  27721. var key = peg$currPos * 66 + 8,
  27722. cached = peg$resultsCache[key];
  27723. if (cached) {
  27724. peg$currPos = cached.nextPos;
  27725. return cached.result;
  27726. }
  27727. s0 = peg$currPos;
  27728. s1 = peg$currPos;
  27729. if (peg$c14.test(input.charAt(peg$currPos))) {
  27730. s2 = input.charAt(peg$currPos);
  27731. peg$currPos++;
  27732. } else {
  27733. s2 = peg$FAILED;
  27734. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  27735. }
  27736. if (s2 !== peg$FAILED) {
  27737. s3 = [];
  27738. if (peg$c10.test(input.charAt(peg$currPos))) {
  27739. s4 = input.charAt(peg$currPos);
  27740. peg$currPos++;
  27741. } else {
  27742. s4 = peg$FAILED;
  27743. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27744. }
  27745. while (s4 !== peg$FAILED) {
  27746. s3.push(s4);
  27747. if (peg$c10.test(input.charAt(peg$currPos))) {
  27748. s4 = input.charAt(peg$currPos);
  27749. peg$currPos++;
  27750. } else {
  27751. s4 = peg$FAILED;
  27752. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27753. }
  27754. }
  27755. if (s3 !== peg$FAILED) {
  27756. s2 = [s2, s3];
  27757. s1 = s2;
  27758. } else {
  27759. peg$currPos = s1;
  27760. s1 = peg$FAILED;
  27761. }
  27762. } else {
  27763. peg$currPos = s1;
  27764. s1 = peg$FAILED;
  27765. }
  27766. if (s1 !== peg$FAILED) {
  27767. s0 = input.substring(s0, peg$currPos);
  27768. } else {
  27769. s0 = s1;
  27770. }
  27771. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27772. return s0;
  27773. }
  27774. function peg$parsestring() {
  27775. var s0, s1;
  27776. var key = peg$currPos * 66 + 9,
  27777. cached = peg$resultsCache[key];
  27778. if (cached) {
  27779. peg$currPos = cached.nextPos;
  27780. return cached.result;
  27781. }
  27782. s0 = peg$currPos;
  27783. s1 = peg$parserawString();
  27784. if (s1 !== peg$FAILED) {
  27785. peg$savedPos = s0;
  27786. s1 = peg$c16(s1);
  27787. }
  27788. s0 = s1;
  27789. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27790. return s0;
  27791. }
  27792. function peg$parserawString() {
  27793. var s0, s1, s2, s3, s4;
  27794. var key = peg$currPos * 66 + 10,
  27795. cached = peg$resultsCache[key];
  27796. if (cached) {
  27797. peg$currPos = cached.nextPos;
  27798. return cached.result;
  27799. }
  27800. s0 = peg$currPos;
  27801. if (input.charCodeAt(peg$currPos) === 39) {
  27802. s1 = peg$c17;
  27803. peg$currPos++;
  27804. } else {
  27805. s1 = peg$FAILED;
  27806. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27807. }
  27808. if (s1 !== peg$FAILED) {
  27809. s2 = [];
  27810. s3 = peg$currPos;
  27811. if (input.substr(peg$currPos, 2) === peg$c19) {
  27812. s4 = peg$c19;
  27813. peg$currPos += 2;
  27814. } else {
  27815. s4 = peg$FAILED;
  27816. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27817. }
  27818. if (s4 !== peg$FAILED) {
  27819. peg$savedPos = s3;
  27820. s4 = peg$c21();
  27821. }
  27822. s3 = s4;
  27823. if (s3 === peg$FAILED) {
  27824. if (peg$c22.test(input.charAt(peg$currPos))) {
  27825. s3 = input.charAt(peg$currPos);
  27826. peg$currPos++;
  27827. } else {
  27828. s3 = peg$FAILED;
  27829. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27830. }
  27831. }
  27832. while (s3 !== peg$FAILED) {
  27833. s2.push(s3);
  27834. s3 = peg$currPos;
  27835. if (input.substr(peg$currPos, 2) === peg$c19) {
  27836. s4 = peg$c19;
  27837. peg$currPos += 2;
  27838. } else {
  27839. s4 = peg$FAILED;
  27840. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27841. }
  27842. if (s4 !== peg$FAILED) {
  27843. peg$savedPos = s3;
  27844. s4 = peg$c21();
  27845. }
  27846. s3 = s4;
  27847. if (s3 === peg$FAILED) {
  27848. if (peg$c22.test(input.charAt(peg$currPos))) {
  27849. s3 = input.charAt(peg$currPos);
  27850. peg$currPos++;
  27851. } else {
  27852. s3 = peg$FAILED;
  27853. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27854. }
  27855. }
  27856. }
  27857. if (s2 !== peg$FAILED) {
  27858. if (input.charCodeAt(peg$currPos) === 39) {
  27859. s3 = peg$c17;
  27860. peg$currPos++;
  27861. } else {
  27862. s3 = peg$FAILED;
  27863. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27864. }
  27865. if (s3 !== peg$FAILED) {
  27866. peg$savedPos = s0;
  27867. s1 = peg$c24(s2);
  27868. s0 = s1;
  27869. } else {
  27870. peg$currPos = s0;
  27871. s0 = peg$FAILED;
  27872. }
  27873. } else {
  27874. peg$currPos = s0;
  27875. s0 = peg$FAILED;
  27876. }
  27877. } else {
  27878. peg$currPos = s0;
  27879. s0 = peg$FAILED;
  27880. }
  27881. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27882. return s0;
  27883. }
  27884. function peg$parsecharacter() {
  27885. var s0, s1, s2;
  27886. var key = peg$currPos * 66 + 11,
  27887. cached = peg$resultsCache[key];
  27888. if (cached) {
  27889. peg$currPos = cached.nextPos;
  27890. return cached.result;
  27891. }
  27892. s0 = peg$currPos;
  27893. if (input.charCodeAt(peg$currPos) === 36) {
  27894. s1 = peg$c25;
  27895. peg$currPos++;
  27896. } else {
  27897. s1 = peg$FAILED;
  27898. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  27899. }
  27900. if (s1 !== peg$FAILED) {
  27901. if (input.length > peg$currPos) {
  27902. s2 = input.charAt(peg$currPos);
  27903. peg$currPos++;
  27904. } else {
  27905. s2 = peg$FAILED;
  27906. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  27907. }
  27908. if (s2 !== peg$FAILED) {
  27909. peg$savedPos = s0;
  27910. s1 = peg$c28(s2);
  27911. s0 = s1;
  27912. } else {
  27913. peg$currPos = s0;
  27914. s0 = peg$FAILED;
  27915. }
  27916. } else {
  27917. peg$currPos = s0;
  27918. s0 = peg$FAILED;
  27919. }
  27920. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27921. return s0;
  27922. }
  27923. function peg$parsesymbol() {
  27924. var s0, s1, s2;
  27925. var key = peg$currPos * 66 + 12,
  27926. cached = peg$resultsCache[key];
  27927. if (cached) {
  27928. peg$currPos = cached.nextPos;
  27929. return cached.result;
  27930. }
  27931. s0 = peg$currPos;
  27932. if (input.charCodeAt(peg$currPos) === 35) {
  27933. s1 = peg$c29;
  27934. peg$currPos++;
  27935. } else {
  27936. s1 = peg$FAILED;
  27937. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  27938. }
  27939. if (s1 !== peg$FAILED) {
  27940. s2 = peg$parsebareSymbol();
  27941. if (s2 !== peg$FAILED) {
  27942. peg$savedPos = s0;
  27943. s1 = peg$c31(s2);
  27944. s0 = s1;
  27945. } else {
  27946. peg$currPos = s0;
  27947. s0 = peg$FAILED;
  27948. }
  27949. } else {
  27950. peg$currPos = s0;
  27951. s0 = peg$FAILED;
  27952. }
  27953. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27954. return s0;
  27955. }
  27956. function peg$parsebareSymbol() {
  27957. var s0, s1, s2, s3;
  27958. var key = peg$currPos * 66 + 13,
  27959. cached = peg$resultsCache[key];
  27960. if (cached) {
  27961. peg$currPos = cached.nextPos;
  27962. return cached.result;
  27963. }
  27964. s0 = peg$currPos;
  27965. s1 = peg$currPos;
  27966. s2 = [];
  27967. s3 = peg$parsekeyword();
  27968. if (s3 !== peg$FAILED) {
  27969. while (s3 !== peg$FAILED) {
  27970. s2.push(s3);
  27971. s3 = peg$parsekeyword();
  27972. }
  27973. } else {
  27974. s2 = peg$FAILED;
  27975. }
  27976. if (s2 !== peg$FAILED) {
  27977. s1 = input.substring(s1, peg$currPos);
  27978. } else {
  27979. s1 = s2;
  27980. }
  27981. if (s1 === peg$FAILED) {
  27982. s1 = peg$parsebinarySelector();
  27983. if (s1 === peg$FAILED) {
  27984. s1 = peg$parseidentifier();
  27985. if (s1 === peg$FAILED) {
  27986. s1 = peg$parserawString();
  27987. }
  27988. }
  27989. }
  27990. if (s1 !== peg$FAILED) {
  27991. peg$savedPos = s0;
  27992. s1 = peg$c16(s1);
  27993. }
  27994. s0 = s1;
  27995. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27996. return s0;
  27997. }
  27998. function peg$parsenumber() {
  27999. var s0, s1;
  28000. var key = peg$currPos * 66 + 14,
  28001. cached = peg$resultsCache[key];
  28002. if (cached) {
  28003. peg$currPos = cached.nextPos;
  28004. return cached.result;
  28005. }
  28006. s0 = peg$currPos;
  28007. s1 = peg$parserawNumber();
  28008. if (s1 !== peg$FAILED) {
  28009. peg$savedPos = s0;
  28010. s1 = peg$c16(s1);
  28011. }
  28012. s0 = s1;
  28013. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28014. return s0;
  28015. }
  28016. function peg$parserawNumber() {
  28017. var s0;
  28018. var key = peg$currPos * 66 + 15,
  28019. cached = peg$resultsCache[key];
  28020. if (cached) {
  28021. peg$currPos = cached.nextPos;
  28022. return cached.result;
  28023. }
  28024. s0 = peg$parsenumberExp();
  28025. if (s0 === peg$FAILED) {
  28026. s0 = peg$parsehex();
  28027. if (s0 === peg$FAILED) {
  28028. s0 = peg$parsefloat();
  28029. if (s0 === peg$FAILED) {
  28030. s0 = peg$parseinteger();
  28031. }
  28032. }
  28033. }
  28034. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28035. return s0;
  28036. }
  28037. function peg$parsenumberExp() {
  28038. var s0, s1, s2, s3, s4, s5;
  28039. var key = peg$currPos * 66 + 16,
  28040. cached = peg$resultsCache[key];
  28041. if (cached) {
  28042. peg$currPos = cached.nextPos;
  28043. return cached.result;
  28044. }
  28045. s0 = peg$currPos;
  28046. s1 = peg$currPos;
  28047. s2 = peg$currPos;
  28048. s3 = peg$parsefloat();
  28049. if (s3 === peg$FAILED) {
  28050. s3 = peg$parseinteger();
  28051. }
  28052. if (s3 !== peg$FAILED) {
  28053. if (input.charCodeAt(peg$currPos) === 101) {
  28054. s4 = peg$c32;
  28055. peg$currPos++;
  28056. } else {
  28057. s4 = peg$FAILED;
  28058. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  28059. }
  28060. if (s4 !== peg$FAILED) {
  28061. s5 = peg$parseinteger();
  28062. if (s5 !== peg$FAILED) {
  28063. s3 = [s3, s4, s5];
  28064. s2 = s3;
  28065. } else {
  28066. peg$currPos = s2;
  28067. s2 = peg$FAILED;
  28068. }
  28069. } else {
  28070. peg$currPos = s2;
  28071. s2 = peg$FAILED;
  28072. }
  28073. } else {
  28074. peg$currPos = s2;
  28075. s2 = peg$FAILED;
  28076. }
  28077. if (s2 !== peg$FAILED) {
  28078. s1 = input.substring(s1, peg$currPos);
  28079. } else {
  28080. s1 = s2;
  28081. }
  28082. if (s1 !== peg$FAILED) {
  28083. peg$savedPos = s0;
  28084. s1 = peg$c34(s1);
  28085. }
  28086. s0 = s1;
  28087. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28088. return s0;
  28089. }
  28090. function peg$parsehex() {
  28091. var s0, s1, s2, s3, s4, s5;
  28092. var key = peg$currPos * 66 + 17,
  28093. cached = peg$resultsCache[key];
  28094. if (cached) {
  28095. peg$currPos = cached.nextPos;
  28096. return cached.result;
  28097. }
  28098. s0 = peg$currPos;
  28099. if (input.charCodeAt(peg$currPos) === 45) {
  28100. s1 = peg$c35;
  28101. peg$currPos++;
  28102. } else {
  28103. s1 = peg$FAILED;
  28104. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28105. }
  28106. if (s1 === peg$FAILED) {
  28107. s1 = null;
  28108. }
  28109. if (s1 !== peg$FAILED) {
  28110. if (input.substr(peg$currPos, 3) === peg$c37) {
  28111. s2 = peg$c37;
  28112. peg$currPos += 3;
  28113. } else {
  28114. s2 = peg$FAILED;
  28115. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  28116. }
  28117. if (s2 !== peg$FAILED) {
  28118. s3 = peg$currPos;
  28119. s4 = [];
  28120. if (peg$c39.test(input.charAt(peg$currPos))) {
  28121. s5 = input.charAt(peg$currPos);
  28122. peg$currPos++;
  28123. } else {
  28124. s5 = peg$FAILED;
  28125. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  28126. }
  28127. if (s5 !== peg$FAILED) {
  28128. while (s5 !== peg$FAILED) {
  28129. s4.push(s5);
  28130. if (peg$c39.test(input.charAt(peg$currPos))) {
  28131. s5 = input.charAt(peg$currPos);
  28132. peg$currPos++;
  28133. } else {
  28134. s5 = peg$FAILED;
  28135. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  28136. }
  28137. }
  28138. } else {
  28139. s4 = peg$FAILED;
  28140. }
  28141. if (s4 !== peg$FAILED) {
  28142. s3 = input.substring(s3, peg$currPos);
  28143. } else {
  28144. s3 = s4;
  28145. }
  28146. if (s3 !== peg$FAILED) {
  28147. peg$savedPos = s0;
  28148. s1 = peg$c41(s1, s3);
  28149. s0 = s1;
  28150. } else {
  28151. peg$currPos = s0;
  28152. s0 = peg$FAILED;
  28153. }
  28154. } else {
  28155. peg$currPos = s0;
  28156. s0 = peg$FAILED;
  28157. }
  28158. } else {
  28159. peg$currPos = s0;
  28160. s0 = peg$FAILED;
  28161. }
  28162. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28163. return s0;
  28164. }
  28165. function peg$parsefloat() {
  28166. var s0, s1, s2, s3, s4, s5, s6, s7;
  28167. var key = peg$currPos * 66 + 18,
  28168. cached = peg$resultsCache[key];
  28169. if (cached) {
  28170. peg$currPos = cached.nextPos;
  28171. return cached.result;
  28172. }
  28173. s0 = peg$currPos;
  28174. s1 = peg$currPos;
  28175. s2 = peg$currPos;
  28176. if (input.charCodeAt(peg$currPos) === 45) {
  28177. s3 = peg$c35;
  28178. peg$currPos++;
  28179. } else {
  28180. s3 = peg$FAILED;
  28181. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28182. }
  28183. if (s3 === peg$FAILED) {
  28184. s3 = null;
  28185. }
  28186. if (s3 !== peg$FAILED) {
  28187. s4 = [];
  28188. if (peg$c42.test(input.charAt(peg$currPos))) {
  28189. s5 = input.charAt(peg$currPos);
  28190. peg$currPos++;
  28191. } else {
  28192. s5 = peg$FAILED;
  28193. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28194. }
  28195. if (s5 !== peg$FAILED) {
  28196. while (s5 !== peg$FAILED) {
  28197. s4.push(s5);
  28198. if (peg$c42.test(input.charAt(peg$currPos))) {
  28199. s5 = input.charAt(peg$currPos);
  28200. peg$currPos++;
  28201. } else {
  28202. s5 = peg$FAILED;
  28203. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28204. }
  28205. }
  28206. } else {
  28207. s4 = peg$FAILED;
  28208. }
  28209. if (s4 !== peg$FAILED) {
  28210. if (input.charCodeAt(peg$currPos) === 46) {
  28211. s5 = peg$c6;
  28212. peg$currPos++;
  28213. } else {
  28214. s5 = peg$FAILED;
  28215. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  28216. }
  28217. if (s5 !== peg$FAILED) {
  28218. s6 = [];
  28219. if (peg$c42.test(input.charAt(peg$currPos))) {
  28220. s7 = input.charAt(peg$currPos);
  28221. peg$currPos++;
  28222. } else {
  28223. s7 = peg$FAILED;
  28224. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28225. }
  28226. if (s7 !== peg$FAILED) {
  28227. while (s7 !== peg$FAILED) {
  28228. s6.push(s7);
  28229. if (peg$c42.test(input.charAt(peg$currPos))) {
  28230. s7 = input.charAt(peg$currPos);
  28231. peg$currPos++;
  28232. } else {
  28233. s7 = peg$FAILED;
  28234. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28235. }
  28236. }
  28237. } else {
  28238. s6 = peg$FAILED;
  28239. }
  28240. if (s6 !== peg$FAILED) {
  28241. s3 = [s3, s4, s5, s6];
  28242. s2 = s3;
  28243. } else {
  28244. peg$currPos = s2;
  28245. s2 = peg$FAILED;
  28246. }
  28247. } else {
  28248. peg$currPos = s2;
  28249. s2 = peg$FAILED;
  28250. }
  28251. } else {
  28252. peg$currPos = s2;
  28253. s2 = peg$FAILED;
  28254. }
  28255. } else {
  28256. peg$currPos = s2;
  28257. s2 = peg$FAILED;
  28258. }
  28259. if (s2 !== peg$FAILED) {
  28260. s1 = input.substring(s1, peg$currPos);
  28261. } else {
  28262. s1 = s2;
  28263. }
  28264. if (s1 !== peg$FAILED) {
  28265. peg$savedPos = s0;
  28266. s1 = peg$c44(s1);
  28267. }
  28268. s0 = s1;
  28269. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28270. return s0;
  28271. }
  28272. function peg$parseinteger() {
  28273. var s0, s1, s2, s3, s4, s5;
  28274. var key = peg$currPos * 66 + 19,
  28275. cached = peg$resultsCache[key];
  28276. if (cached) {
  28277. peg$currPos = cached.nextPos;
  28278. return cached.result;
  28279. }
  28280. s0 = peg$currPos;
  28281. s1 = peg$currPos;
  28282. s2 = peg$currPos;
  28283. if (input.charCodeAt(peg$currPos) === 45) {
  28284. s3 = peg$c35;
  28285. peg$currPos++;
  28286. } else {
  28287. s3 = peg$FAILED;
  28288. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28289. }
  28290. if (s3 === peg$FAILED) {
  28291. s3 = null;
  28292. }
  28293. if (s3 !== peg$FAILED) {
  28294. s4 = [];
  28295. if (peg$c42.test(input.charAt(peg$currPos))) {
  28296. s5 = input.charAt(peg$currPos);
  28297. peg$currPos++;
  28298. } else {
  28299. s5 = peg$FAILED;
  28300. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28301. }
  28302. if (s5 !== peg$FAILED) {
  28303. while (s5 !== peg$FAILED) {
  28304. s4.push(s5);
  28305. if (peg$c42.test(input.charAt(peg$currPos))) {
  28306. s5 = input.charAt(peg$currPos);
  28307. peg$currPos++;
  28308. } else {
  28309. s5 = peg$FAILED;
  28310. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28311. }
  28312. }
  28313. } else {
  28314. s4 = peg$FAILED;
  28315. }
  28316. if (s4 !== peg$FAILED) {
  28317. s3 = [s3, s4];
  28318. s2 = s3;
  28319. } else {
  28320. peg$currPos = s2;
  28321. s2 = peg$FAILED;
  28322. }
  28323. } else {
  28324. peg$currPos = s2;
  28325. s2 = peg$FAILED;
  28326. }
  28327. if (s2 !== peg$FAILED) {
  28328. s1 = input.substring(s1, peg$currPos);
  28329. } else {
  28330. s1 = s2;
  28331. }
  28332. if (s1 !== peg$FAILED) {
  28333. peg$savedPos = s0;
  28334. s1 = peg$c45(s1);
  28335. }
  28336. s0 = s1;
  28337. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28338. return s0;
  28339. }
  28340. function peg$parseliteralArray() {
  28341. var s0, s1, s2, s3, s4;
  28342. var key = peg$currPos * 66 + 20,
  28343. cached = peg$resultsCache[key];
  28344. if (cached) {
  28345. peg$currPos = cached.nextPos;
  28346. return cached.result;
  28347. }
  28348. s0 = peg$currPos;
  28349. if (input.substr(peg$currPos, 2) === peg$c46) {
  28350. s1 = peg$c46;
  28351. peg$currPos += 2;
  28352. } else {
  28353. s1 = peg$FAILED;
  28354. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  28355. }
  28356. if (s1 !== peg$FAILED) {
  28357. s2 = peg$parsewsLiteralArrayContents();
  28358. if (s2 !== peg$FAILED) {
  28359. s3 = peg$parsews();
  28360. if (s3 !== peg$FAILED) {
  28361. if (input.charCodeAt(peg$currPos) === 41) {
  28362. s4 = peg$c48;
  28363. peg$currPos++;
  28364. } else {
  28365. s4 = peg$FAILED;
  28366. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28367. }
  28368. if (s4 !== peg$FAILED) {
  28369. peg$savedPos = s0;
  28370. s1 = peg$c50(s2);
  28371. s0 = s1;
  28372. } else {
  28373. peg$currPos = s0;
  28374. s0 = peg$FAILED;
  28375. }
  28376. } else {
  28377. peg$currPos = s0;
  28378. s0 = peg$FAILED;
  28379. }
  28380. } else {
  28381. peg$currPos = s0;
  28382. s0 = peg$FAILED;
  28383. }
  28384. } else {
  28385. peg$currPos = s0;
  28386. s0 = peg$FAILED;
  28387. }
  28388. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28389. return s0;
  28390. }
  28391. function peg$parsebareLiteralArray() {
  28392. var s0, s1, s2, s3, s4;
  28393. var key = peg$currPos * 66 + 21,
  28394. cached = peg$resultsCache[key];
  28395. if (cached) {
  28396. peg$currPos = cached.nextPos;
  28397. return cached.result;
  28398. }
  28399. s0 = peg$currPos;
  28400. if (input.charCodeAt(peg$currPos) === 40) {
  28401. s1 = peg$c51;
  28402. peg$currPos++;
  28403. } else {
  28404. s1 = peg$FAILED;
  28405. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  28406. }
  28407. if (s1 !== peg$FAILED) {
  28408. s2 = peg$parsewsLiteralArrayContents();
  28409. if (s2 !== peg$FAILED) {
  28410. s3 = peg$parsews();
  28411. if (s3 !== peg$FAILED) {
  28412. if (input.charCodeAt(peg$currPos) === 41) {
  28413. s4 = peg$c48;
  28414. peg$currPos++;
  28415. } else {
  28416. s4 = peg$FAILED;
  28417. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28418. }
  28419. if (s4 !== peg$FAILED) {
  28420. peg$savedPos = s0;
  28421. s1 = peg$c50(s2);
  28422. s0 = s1;
  28423. } else {
  28424. peg$currPos = s0;
  28425. s0 = peg$FAILED;
  28426. }
  28427. } else {
  28428. peg$currPos = s0;
  28429. s0 = peg$FAILED;
  28430. }
  28431. } else {
  28432. peg$currPos = s0;
  28433. s0 = peg$FAILED;
  28434. }
  28435. } else {
  28436. peg$currPos = s0;
  28437. s0 = peg$FAILED;
  28438. }
  28439. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28440. return s0;
  28441. }
  28442. function peg$parseliteralArrayElement() {
  28443. var s0;
  28444. var key = peg$currPos * 66 + 22,
  28445. cached = peg$resultsCache[key];
  28446. if (cached) {
  28447. peg$currPos = cached.nextPos;
  28448. return cached.result;
  28449. }
  28450. s0 = peg$parseparseTimeLiteral();
  28451. if (s0 === peg$FAILED) {
  28452. s0 = peg$parsebareLiteralArray();
  28453. if (s0 === peg$FAILED) {
  28454. s0 = peg$parsebareSymbol();
  28455. }
  28456. }
  28457. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28458. return s0;
  28459. }
  28460. function peg$parsewsLiteralArrayContents() {
  28461. var s0, s1, s2, s3, s4;
  28462. var key = peg$currPos * 66 + 23,
  28463. cached = peg$resultsCache[key];
  28464. if (cached) {
  28465. peg$currPos = cached.nextPos;
  28466. return cached.result;
  28467. }
  28468. s0 = peg$currPos;
  28469. s1 = [];
  28470. s2 = peg$currPos;
  28471. s3 = peg$parsews();
  28472. if (s3 !== peg$FAILED) {
  28473. s4 = peg$parseliteralArrayElement();
  28474. if (s4 !== peg$FAILED) {
  28475. peg$savedPos = s2;
  28476. s3 = peg$c53(s4);
  28477. s2 = s3;
  28478. } else {
  28479. peg$currPos = s2;
  28480. s2 = peg$FAILED;
  28481. }
  28482. } else {
  28483. peg$currPos = s2;
  28484. s2 = peg$FAILED;
  28485. }
  28486. while (s2 !== peg$FAILED) {
  28487. s1.push(s2);
  28488. s2 = peg$currPos;
  28489. s3 = peg$parsews();
  28490. if (s3 !== peg$FAILED) {
  28491. s4 = peg$parseliteralArrayElement();
  28492. if (s4 !== peg$FAILED) {
  28493. peg$savedPos = s2;
  28494. s3 = peg$c53(s4);
  28495. s2 = s3;
  28496. } else {
  28497. peg$currPos = s2;
  28498. s2 = peg$FAILED;
  28499. }
  28500. } else {
  28501. peg$currPos = s2;
  28502. s2 = peg$FAILED;
  28503. }
  28504. }
  28505. if (s1 !== peg$FAILED) {
  28506. peg$savedPos = s0;
  28507. s1 = peg$c54(s1);
  28508. }
  28509. s0 = s1;
  28510. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28511. return s0;
  28512. }
  28513. function peg$parsedynamicArray() {
  28514. var s0, s1, s2, s3, s4;
  28515. var key = peg$currPos * 66 + 24,
  28516. cached = peg$resultsCache[key];
  28517. if (cached) {
  28518. peg$currPos = cached.nextPos;
  28519. return cached.result;
  28520. }
  28521. s0 = peg$currPos;
  28522. if (input.charCodeAt(peg$currPos) === 123) {
  28523. s1 = peg$c55;
  28524. peg$currPos++;
  28525. } else {
  28526. s1 = peg$FAILED;
  28527. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  28528. }
  28529. if (s1 !== peg$FAILED) {
  28530. s2 = peg$parsewsExpressions();
  28531. if (s2 === peg$FAILED) {
  28532. s2 = null;
  28533. }
  28534. if (s2 !== peg$FAILED) {
  28535. s3 = peg$parsemaybeDotsWs();
  28536. if (s3 !== peg$FAILED) {
  28537. if (input.charCodeAt(peg$currPos) === 125) {
  28538. s4 = peg$c57;
  28539. peg$currPos++;
  28540. } else {
  28541. s4 = peg$FAILED;
  28542. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28543. }
  28544. if (s4 !== peg$FAILED) {
  28545. peg$savedPos = s0;
  28546. s1 = peg$c59(s2);
  28547. s0 = s1;
  28548. } else {
  28549. peg$currPos = s0;
  28550. s0 = peg$FAILED;
  28551. }
  28552. } else {
  28553. peg$currPos = s0;
  28554. s0 = peg$FAILED;
  28555. }
  28556. } else {
  28557. peg$currPos = s0;
  28558. s0 = peg$FAILED;
  28559. }
  28560. } else {
  28561. peg$currPos = s0;
  28562. s0 = peg$FAILED;
  28563. }
  28564. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28565. return s0;
  28566. }
  28567. function peg$parsedynamicDictionary() {
  28568. var s0, s1, s2, s3, s4;
  28569. var key = peg$currPos * 66 + 25,
  28570. cached = peg$resultsCache[key];
  28571. if (cached) {
  28572. peg$currPos = cached.nextPos;
  28573. return cached.result;
  28574. }
  28575. s0 = peg$currPos;
  28576. if (input.substr(peg$currPos, 2) === peg$c60) {
  28577. s1 = peg$c60;
  28578. peg$currPos += 2;
  28579. } else {
  28580. s1 = peg$FAILED;
  28581. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  28582. }
  28583. if (s1 !== peg$FAILED) {
  28584. s2 = peg$parsewsAssociations();
  28585. if (s2 === peg$FAILED) {
  28586. s2 = null;
  28587. }
  28588. if (s2 !== peg$FAILED) {
  28589. s3 = peg$parsemaybeDotsWs();
  28590. if (s3 !== peg$FAILED) {
  28591. if (input.charCodeAt(peg$currPos) === 125) {
  28592. s4 = peg$c57;
  28593. peg$currPos++;
  28594. } else {
  28595. s4 = peg$FAILED;
  28596. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28597. }
  28598. if (s4 !== peg$FAILED) {
  28599. peg$savedPos = s0;
  28600. s1 = peg$c62(s2);
  28601. s0 = s1;
  28602. } else {
  28603. peg$currPos = s0;
  28604. s0 = peg$FAILED;
  28605. }
  28606. } else {
  28607. peg$currPos = s0;
  28608. s0 = peg$FAILED;
  28609. }
  28610. } else {
  28611. peg$currPos = s0;
  28612. s0 = peg$FAILED;
  28613. }
  28614. } else {
  28615. peg$currPos = s0;
  28616. s0 = peg$FAILED;
  28617. }
  28618. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28619. return s0;
  28620. }
  28621. function peg$parsepseudoVariable() {
  28622. var s0, s1, s2;
  28623. var key = peg$currPos * 66 + 26,
  28624. cached = peg$resultsCache[key];
  28625. if (cached) {
  28626. peg$currPos = cached.nextPos;
  28627. return cached.result;
  28628. }
  28629. s0 = peg$currPos;
  28630. s1 = peg$currPos;
  28631. if (input.substr(peg$currPos, 4) === peg$c63) {
  28632. s2 = peg$c63;
  28633. peg$currPos += 4;
  28634. } else {
  28635. s2 = peg$FAILED;
  28636. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  28637. }
  28638. if (s2 !== peg$FAILED) {
  28639. peg$savedPos = s1;
  28640. s2 = peg$c65();
  28641. }
  28642. s1 = s2;
  28643. if (s1 === peg$FAILED) {
  28644. s1 = peg$currPos;
  28645. if (input.substr(peg$currPos, 5) === peg$c66) {
  28646. s2 = peg$c66;
  28647. peg$currPos += 5;
  28648. } else {
  28649. s2 = peg$FAILED;
  28650. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  28651. }
  28652. if (s2 !== peg$FAILED) {
  28653. peg$savedPos = s1;
  28654. s2 = peg$c68();
  28655. }
  28656. s1 = s2;
  28657. if (s1 === peg$FAILED) {
  28658. s1 = peg$currPos;
  28659. if (input.substr(peg$currPos, 3) === peg$c69) {
  28660. s2 = peg$c69;
  28661. peg$currPos += 3;
  28662. } else {
  28663. s2 = peg$FAILED;
  28664. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  28665. }
  28666. if (s2 !== peg$FAILED) {
  28667. peg$savedPos = s1;
  28668. s2 = peg$c71();
  28669. }
  28670. s1 = s2;
  28671. }
  28672. }
  28673. if (s1 !== peg$FAILED) {
  28674. peg$savedPos = s0;
  28675. s1 = peg$c16(s1);
  28676. }
  28677. s0 = s1;
  28678. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28679. return s0;
  28680. }
  28681. function peg$parseparseTimeLiteral() {
  28682. var s0;
  28683. var key = peg$currPos * 66 + 27,
  28684. cached = peg$resultsCache[key];
  28685. if (cached) {
  28686. peg$currPos = cached.nextPos;
  28687. return cached.result;
  28688. }
  28689. s0 = peg$parsepseudoVariable();
  28690. if (s0 === peg$FAILED) {
  28691. s0 = peg$parsenumber();
  28692. if (s0 === peg$FAILED) {
  28693. s0 = peg$parseliteralArray();
  28694. if (s0 === peg$FAILED) {
  28695. s0 = peg$parsestring();
  28696. if (s0 === peg$FAILED) {
  28697. s0 = peg$parsesymbol();
  28698. if (s0 === peg$FAILED) {
  28699. s0 = peg$parsecharacter();
  28700. }
  28701. }
  28702. }
  28703. }
  28704. }
  28705. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28706. return s0;
  28707. }
  28708. function peg$parseruntimeLiteral() {
  28709. var s0;
  28710. var key = peg$currPos * 66 + 28,
  28711. cached = peg$resultsCache[key];
  28712. if (cached) {
  28713. peg$currPos = cached.nextPos;
  28714. return cached.result;
  28715. }
  28716. s0 = peg$parsedynamicDictionary();
  28717. if (s0 === peg$FAILED) {
  28718. s0 = peg$parsedynamicArray();
  28719. if (s0 === peg$FAILED) {
  28720. s0 = peg$parseblock();
  28721. }
  28722. }
  28723. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28724. return s0;
  28725. }
  28726. function peg$parseliteral() {
  28727. var s0;
  28728. var key = peg$currPos * 66 + 29,
  28729. cached = peg$resultsCache[key];
  28730. if (cached) {
  28731. peg$currPos = cached.nextPos;
  28732. return cached.result;
  28733. }
  28734. s0 = peg$parseruntimeLiteral();
  28735. if (s0 === peg$FAILED) {
  28736. s0 = peg$parseparseTimeLiteral();
  28737. }
  28738. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28739. return s0;
  28740. }
  28741. function peg$parsevariable() {
  28742. var s0, s1;
  28743. var key = peg$currPos * 66 + 30,
  28744. cached = peg$resultsCache[key];
  28745. if (cached) {
  28746. peg$currPos = cached.nextPos;
  28747. return cached.result;
  28748. }
  28749. s0 = peg$currPos;
  28750. s1 = peg$parseidentifier();
  28751. if (s1 !== peg$FAILED) {
  28752. peg$savedPos = s0;
  28753. s1 = peg$c72(s1);
  28754. }
  28755. s0 = s1;
  28756. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28757. return s0;
  28758. }
  28759. function peg$parsebinarySelector() {
  28760. var s0, s1, s2;
  28761. var key = peg$currPos * 66 + 31,
  28762. cached = peg$resultsCache[key];
  28763. if (cached) {
  28764. peg$currPos = cached.nextPos;
  28765. return cached.result;
  28766. }
  28767. s0 = peg$currPos;
  28768. s1 = [];
  28769. if (peg$c73.test(input.charAt(peg$currPos))) {
  28770. s2 = input.charAt(peg$currPos);
  28771. peg$currPos++;
  28772. } else {
  28773. s2 = peg$FAILED;
  28774. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28775. }
  28776. if (s2 !== peg$FAILED) {
  28777. while (s2 !== peg$FAILED) {
  28778. s1.push(s2);
  28779. if (peg$c73.test(input.charAt(peg$currPos))) {
  28780. s2 = input.charAt(peg$currPos);
  28781. peg$currPos++;
  28782. } else {
  28783. s2 = peg$FAILED;
  28784. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28785. }
  28786. }
  28787. } else {
  28788. s1 = peg$FAILED;
  28789. }
  28790. if (s1 !== peg$FAILED) {
  28791. s0 = input.substring(s0, peg$currPos);
  28792. } else {
  28793. s0 = s1;
  28794. }
  28795. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28796. return s0;
  28797. }
  28798. function peg$parsewsKeywordPattern() {
  28799. var s0, s1, s2, s3, s4, s5, s6;
  28800. var key = peg$currPos * 66 + 32,
  28801. cached = peg$resultsCache[key];
  28802. if (cached) {
  28803. peg$currPos = cached.nextPos;
  28804. return cached.result;
  28805. }
  28806. s0 = peg$currPos;
  28807. s1 = [];
  28808. s2 = peg$currPos;
  28809. s3 = peg$parsews();
  28810. if (s3 !== peg$FAILED) {
  28811. s4 = peg$parsekeyword();
  28812. if (s4 !== peg$FAILED) {
  28813. s5 = peg$parsews();
  28814. if (s5 !== peg$FAILED) {
  28815. s6 = peg$parseidentifier();
  28816. if (s6 !== peg$FAILED) {
  28817. peg$savedPos = s2;
  28818. s3 = peg$c75(s4, s6);
  28819. s2 = s3;
  28820. } else {
  28821. peg$currPos = s2;
  28822. s2 = peg$FAILED;
  28823. }
  28824. } else {
  28825. peg$currPos = s2;
  28826. s2 = peg$FAILED;
  28827. }
  28828. } else {
  28829. peg$currPos = s2;
  28830. s2 = peg$FAILED;
  28831. }
  28832. } else {
  28833. peg$currPos = s2;
  28834. s2 = peg$FAILED;
  28835. }
  28836. if (s2 !== peg$FAILED) {
  28837. while (s2 !== peg$FAILED) {
  28838. s1.push(s2);
  28839. s2 = peg$currPos;
  28840. s3 = peg$parsews();
  28841. if (s3 !== peg$FAILED) {
  28842. s4 = peg$parsekeyword();
  28843. if (s4 !== peg$FAILED) {
  28844. s5 = peg$parsews();
  28845. if (s5 !== peg$FAILED) {
  28846. s6 = peg$parseidentifier();
  28847. if (s6 !== peg$FAILED) {
  28848. peg$savedPos = s2;
  28849. s3 = peg$c75(s4, s6);
  28850. s2 = s3;
  28851. } else {
  28852. peg$currPos = s2;
  28853. s2 = peg$FAILED;
  28854. }
  28855. } else {
  28856. peg$currPos = s2;
  28857. s2 = peg$FAILED;
  28858. }
  28859. } else {
  28860. peg$currPos = s2;
  28861. s2 = peg$FAILED;
  28862. }
  28863. } else {
  28864. peg$currPos = s2;
  28865. s2 = peg$FAILED;
  28866. }
  28867. }
  28868. } else {
  28869. s1 = peg$FAILED;
  28870. }
  28871. if (s1 !== peg$FAILED) {
  28872. peg$savedPos = s0;
  28873. s1 = peg$c76(s1);
  28874. }
  28875. s0 = s1;
  28876. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28877. return s0;
  28878. }
  28879. function peg$parsewsBinaryPattern() {
  28880. var s0, s1, s2, s3, s4;
  28881. var key = peg$currPos * 66 + 33,
  28882. cached = peg$resultsCache[key];
  28883. if (cached) {
  28884. peg$currPos = cached.nextPos;
  28885. return cached.result;
  28886. }
  28887. s0 = peg$currPos;
  28888. s1 = peg$parsews();
  28889. if (s1 !== peg$FAILED) {
  28890. s2 = peg$parsebinarySelector();
  28891. if (s2 !== peg$FAILED) {
  28892. s3 = peg$parsews();
  28893. if (s3 !== peg$FAILED) {
  28894. s4 = peg$parseidentifier();
  28895. if (s4 !== peg$FAILED) {
  28896. peg$savedPos = s0;
  28897. s1 = peg$c77(s2, s4);
  28898. s0 = s1;
  28899. } else {
  28900. peg$currPos = s0;
  28901. s0 = peg$FAILED;
  28902. }
  28903. } else {
  28904. peg$currPos = s0;
  28905. s0 = peg$FAILED;
  28906. }
  28907. } else {
  28908. peg$currPos = s0;
  28909. s0 = peg$FAILED;
  28910. }
  28911. } else {
  28912. peg$currPos = s0;
  28913. s0 = peg$FAILED;
  28914. }
  28915. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28916. return s0;
  28917. }
  28918. function peg$parsewsUnaryPattern() {
  28919. var s0, s1, s2;
  28920. var key = peg$currPos * 66 + 34,
  28921. cached = peg$resultsCache[key];
  28922. if (cached) {
  28923. peg$currPos = cached.nextPos;
  28924. return cached.result;
  28925. }
  28926. s0 = peg$currPos;
  28927. s1 = peg$parsews();
  28928. if (s1 !== peg$FAILED) {
  28929. s2 = peg$parseidentifier();
  28930. if (s2 !== peg$FAILED) {
  28931. peg$savedPos = s0;
  28932. s1 = peg$c78(s2);
  28933. s0 = s1;
  28934. } else {
  28935. peg$currPos = s0;
  28936. s0 = peg$FAILED;
  28937. }
  28938. } else {
  28939. peg$currPos = s0;
  28940. s0 = peg$FAILED;
  28941. }
  28942. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28943. return s0;
  28944. }
  28945. function peg$parseexpression() {
  28946. var s0;
  28947. var key = peg$currPos * 66 + 35,
  28948. cached = peg$resultsCache[key];
  28949. if (cached) {
  28950. peg$currPos = cached.nextPos;
  28951. return cached.result;
  28952. }
  28953. s0 = peg$parseassignment();
  28954. if (s0 === peg$FAILED) {
  28955. s0 = peg$parsecascade();
  28956. if (s0 === peg$FAILED) {
  28957. s0 = peg$parsekeywordSend();
  28958. }
  28959. }
  28960. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28961. return s0;
  28962. }
  28963. function peg$parsewsExpressionsRest() {
  28964. var s0, s1, s2;
  28965. var key = peg$currPos * 66 + 36,
  28966. cached = peg$resultsCache[key];
  28967. if (cached) {
  28968. peg$currPos = cached.nextPos;
  28969. return cached.result;
  28970. }
  28971. s0 = peg$currPos;
  28972. s1 = peg$parsesomeDotsWs();
  28973. if (s1 !== peg$FAILED) {
  28974. s2 = peg$parseexpression();
  28975. if (s2 !== peg$FAILED) {
  28976. peg$savedPos = s0;
  28977. s1 = peg$c79(s2);
  28978. s0 = s1;
  28979. } else {
  28980. peg$currPos = s0;
  28981. s0 = peg$FAILED;
  28982. }
  28983. } else {
  28984. peg$currPos = s0;
  28985. s0 = peg$FAILED;
  28986. }
  28987. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28988. return s0;
  28989. }
  28990. function peg$parsewsExpressions() {
  28991. var s0, s1, s2, s3, s4;
  28992. var key = peg$currPos * 66 + 37,
  28993. cached = peg$resultsCache[key];
  28994. if (cached) {
  28995. peg$currPos = cached.nextPos;
  28996. return cached.result;
  28997. }
  28998. s0 = peg$currPos;
  28999. s1 = peg$parsemaybeDotsWs();
  29000. if (s1 !== peg$FAILED) {
  29001. s2 = peg$parseexpression();
  29002. if (s2 !== peg$FAILED) {
  29003. s3 = [];
  29004. s4 = peg$parsewsExpressionsRest();
  29005. while (s4 !== peg$FAILED) {
  29006. s3.push(s4);
  29007. s4 = peg$parsewsExpressionsRest();
  29008. }
  29009. if (s3 !== peg$FAILED) {
  29010. peg$savedPos = s0;
  29011. s1 = peg$c80(s2, s3);
  29012. s0 = s1;
  29013. } else {
  29014. peg$currPos = s0;
  29015. s0 = peg$FAILED;
  29016. }
  29017. } else {
  29018. peg$currPos = s0;
  29019. s0 = peg$FAILED;
  29020. }
  29021. } else {
  29022. peg$currPos = s0;
  29023. s0 = peg$FAILED;
  29024. }
  29025. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29026. return s0;
  29027. }
  29028. function peg$parsewsUnaryPragmaMessage() {
  29029. var s0, s1, s2, s3, s4;
  29030. var key = peg$currPos * 66 + 38,
  29031. cached = peg$resultsCache[key];
  29032. if (cached) {
  29033. peg$currPos = cached.nextPos;
  29034. return cached.result;
  29035. }
  29036. s0 = peg$currPos;
  29037. s1 = peg$parsews();
  29038. if (s1 !== peg$FAILED) {
  29039. s2 = peg$parseidentifier();
  29040. if (s2 !== peg$FAILED) {
  29041. s3 = peg$currPos;
  29042. peg$silentFails++;
  29043. if (input.charCodeAt(peg$currPos) === 58) {
  29044. s4 = peg$c12;
  29045. peg$currPos++;
  29046. } else {
  29047. s4 = peg$FAILED;
  29048. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29049. }
  29050. peg$silentFails--;
  29051. if (s4 === peg$FAILED) {
  29052. s3 = void 0;
  29053. } else {
  29054. peg$currPos = s3;
  29055. s3 = peg$FAILED;
  29056. }
  29057. if (s3 !== peg$FAILED) {
  29058. peg$savedPos = s0;
  29059. s1 = peg$c81(s2);
  29060. s0 = s1;
  29061. } else {
  29062. peg$currPos = s0;
  29063. s0 = peg$FAILED;
  29064. }
  29065. } else {
  29066. peg$currPos = s0;
  29067. s0 = peg$FAILED;
  29068. }
  29069. } else {
  29070. peg$currPos = s0;
  29071. s0 = peg$FAILED;
  29072. }
  29073. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29074. return s0;
  29075. }
  29076. function peg$parsewsKeywordPragmaMessage() {
  29077. var s0, s1, s2, s3, s4, s5, s6;
  29078. var key = peg$currPos * 66 + 39,
  29079. cached = peg$resultsCache[key];
  29080. if (cached) {
  29081. peg$currPos = cached.nextPos;
  29082. return cached.result;
  29083. }
  29084. s0 = peg$currPos;
  29085. s1 = [];
  29086. s2 = peg$currPos;
  29087. s3 = peg$parsews();
  29088. if (s3 !== peg$FAILED) {
  29089. s4 = peg$parsekeyword();
  29090. if (s4 !== peg$FAILED) {
  29091. s5 = peg$parsews();
  29092. if (s5 !== peg$FAILED) {
  29093. s6 = peg$parseparseTimeLiteral();
  29094. if (s6 !== peg$FAILED) {
  29095. peg$savedPos = s2;
  29096. s3 = peg$c75(s4, s6);
  29097. s2 = s3;
  29098. } else {
  29099. peg$currPos = s2;
  29100. s2 = peg$FAILED;
  29101. }
  29102. } else {
  29103. peg$currPos = s2;
  29104. s2 = peg$FAILED;
  29105. }
  29106. } else {
  29107. peg$currPos = s2;
  29108. s2 = peg$FAILED;
  29109. }
  29110. } else {
  29111. peg$currPos = s2;
  29112. s2 = peg$FAILED;
  29113. }
  29114. if (s2 !== peg$FAILED) {
  29115. while (s2 !== peg$FAILED) {
  29116. s1.push(s2);
  29117. s2 = peg$currPos;
  29118. s3 = peg$parsews();
  29119. if (s3 !== peg$FAILED) {
  29120. s4 = peg$parsekeyword();
  29121. if (s4 !== peg$FAILED) {
  29122. s5 = peg$parsews();
  29123. if (s5 !== peg$FAILED) {
  29124. s6 = peg$parseparseTimeLiteral();
  29125. if (s6 !== peg$FAILED) {
  29126. peg$savedPos = s2;
  29127. s3 = peg$c75(s4, s6);
  29128. s2 = s3;
  29129. } else {
  29130. peg$currPos = s2;
  29131. s2 = peg$FAILED;
  29132. }
  29133. } else {
  29134. peg$currPos = s2;
  29135. s2 = peg$FAILED;
  29136. }
  29137. } else {
  29138. peg$currPos = s2;
  29139. s2 = peg$FAILED;
  29140. }
  29141. } else {
  29142. peg$currPos = s2;
  29143. s2 = peg$FAILED;
  29144. }
  29145. }
  29146. } else {
  29147. s1 = peg$FAILED;
  29148. }
  29149. if (s1 !== peg$FAILED) {
  29150. peg$savedPos = s0;
  29151. s1 = peg$c82(s1);
  29152. }
  29153. s0 = s1;
  29154. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29155. return s0;
  29156. }
  29157. function peg$parsewsPragmaMessage() {
  29158. var s0;
  29159. var key = peg$currPos * 66 + 40,
  29160. cached = peg$resultsCache[key];
  29161. if (cached) {
  29162. peg$currPos = cached.nextPos;
  29163. return cached.result;
  29164. }
  29165. s0 = peg$parsewsUnaryPragmaMessage();
  29166. if (s0 === peg$FAILED) {
  29167. s0 = peg$parsewsKeywordPragmaMessage();
  29168. }
  29169. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29170. return s0;
  29171. }
  29172. function peg$parsewsPragmas() {
  29173. var s0, s1, s2, s3, s4, s5, s6;
  29174. var key = peg$currPos * 66 + 41,
  29175. cached = peg$resultsCache[key];
  29176. if (cached) {
  29177. peg$currPos = cached.nextPos;
  29178. return cached.result;
  29179. }
  29180. s0 = [];
  29181. s1 = peg$currPos;
  29182. s2 = peg$parsews();
  29183. if (s2 !== peg$FAILED) {
  29184. if (input.charCodeAt(peg$currPos) === 60) {
  29185. s3 = peg$c83;
  29186. peg$currPos++;
  29187. } else {
  29188. s3 = peg$FAILED;
  29189. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  29190. }
  29191. if (s3 !== peg$FAILED) {
  29192. s4 = peg$parsewsPragmaMessage();
  29193. if (s4 !== peg$FAILED) {
  29194. s5 = peg$parsews();
  29195. if (s5 !== peg$FAILED) {
  29196. if (input.charCodeAt(peg$currPos) === 62) {
  29197. s6 = peg$c85;
  29198. peg$currPos++;
  29199. } else {
  29200. s6 = peg$FAILED;
  29201. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  29202. }
  29203. if (s6 !== peg$FAILED) {
  29204. peg$savedPos = s1;
  29205. s2 = peg$c87(s4);
  29206. s1 = s2;
  29207. } else {
  29208. peg$currPos = s1;
  29209. s1 = peg$FAILED;
  29210. }
  29211. } else {
  29212. peg$currPos = s1;
  29213. s1 = peg$FAILED;
  29214. }
  29215. } else {
  29216. peg$currPos = s1;
  29217. s1 = peg$FAILED;
  29218. }
  29219. } else {
  29220. peg$currPos = s1;
  29221. s1 = peg$FAILED;
  29222. }
  29223. } else {
  29224. peg$currPos = s1;
  29225. s1 = peg$FAILED;
  29226. }
  29227. while (s1 !== peg$FAILED) {
  29228. s0.push(s1);
  29229. s1 = peg$currPos;
  29230. s2 = peg$parsews();
  29231. if (s2 !== peg$FAILED) {
  29232. if (input.charCodeAt(peg$currPos) === 60) {
  29233. s3 = peg$c83;
  29234. peg$currPos++;
  29235. } else {
  29236. s3 = peg$FAILED;
  29237. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  29238. }
  29239. if (s3 !== peg$FAILED) {
  29240. s4 = peg$parsewsPragmaMessage();
  29241. if (s4 !== peg$FAILED) {
  29242. s5 = peg$parsews();
  29243. if (s5 !== peg$FAILED) {
  29244. if (input.charCodeAt(peg$currPos) === 62) {
  29245. s6 = peg$c85;
  29246. peg$currPos++;
  29247. } else {
  29248. s6 = peg$FAILED;
  29249. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  29250. }
  29251. if (s6 !== peg$FAILED) {
  29252. peg$savedPos = s1;
  29253. s2 = peg$c87(s4);
  29254. s1 = s2;
  29255. } else {
  29256. peg$currPos = s1;
  29257. s1 = peg$FAILED;
  29258. }
  29259. } else {
  29260. peg$currPos = s1;
  29261. s1 = peg$FAILED;
  29262. }
  29263. } else {
  29264. peg$currPos = s1;
  29265. s1 = peg$FAILED;
  29266. }
  29267. } else {
  29268. peg$currPos = s1;
  29269. s1 = peg$FAILED;
  29270. }
  29271. } else {
  29272. peg$currPos = s1;
  29273. s1 = peg$FAILED;
  29274. }
  29275. }
  29276. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29277. return s0;
  29278. }
  29279. function peg$parseassignment() {
  29280. var s0, s1, s2, s3, s4, s5;
  29281. var key = peg$currPos * 66 + 42,
  29282. cached = peg$resultsCache[key];
  29283. if (cached) {
  29284. peg$currPos = cached.nextPos;
  29285. return cached.result;
  29286. }
  29287. s0 = peg$currPos;
  29288. s1 = peg$parsevariable();
  29289. if (s1 !== peg$FAILED) {
  29290. s2 = peg$parsews();
  29291. if (s2 !== peg$FAILED) {
  29292. if (input.substr(peg$currPos, 2) === peg$c88) {
  29293. s3 = peg$c88;
  29294. peg$currPos += 2;
  29295. } else {
  29296. s3 = peg$FAILED;
  29297. if (peg$silentFails === 0) { peg$fail(peg$c89); }
  29298. }
  29299. if (s3 !== peg$FAILED) {
  29300. s4 = peg$parsews();
  29301. if (s4 !== peg$FAILED) {
  29302. s5 = peg$parseexpression();
  29303. if (s5 !== peg$FAILED) {
  29304. peg$savedPos = s0;
  29305. s1 = peg$c90(s1, s5);
  29306. s0 = s1;
  29307. } else {
  29308. peg$currPos = s0;
  29309. s0 = peg$FAILED;
  29310. }
  29311. } else {
  29312. peg$currPos = s0;
  29313. s0 = peg$FAILED;
  29314. }
  29315. } else {
  29316. peg$currPos = s0;
  29317. s0 = peg$FAILED;
  29318. }
  29319. } else {
  29320. peg$currPos = s0;
  29321. s0 = peg$FAILED;
  29322. }
  29323. } else {
  29324. peg$currPos = s0;
  29325. s0 = peg$FAILED;
  29326. }
  29327. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29328. return s0;
  29329. }
  29330. function peg$parseret() {
  29331. var s0, s1, s2, s3;
  29332. var key = peg$currPos * 66 + 43,
  29333. cached = peg$resultsCache[key];
  29334. if (cached) {
  29335. peg$currPos = cached.nextPos;
  29336. return cached.result;
  29337. }
  29338. s0 = peg$currPos;
  29339. if (input.charCodeAt(peg$currPos) === 94) {
  29340. s1 = peg$c91;
  29341. peg$currPos++;
  29342. } else {
  29343. s1 = peg$FAILED;
  29344. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  29345. }
  29346. if (s1 !== peg$FAILED) {
  29347. s2 = peg$parsews();
  29348. if (s2 !== peg$FAILED) {
  29349. s3 = peg$parseexpression();
  29350. if (s3 !== peg$FAILED) {
  29351. peg$savedPos = s0;
  29352. s1 = peg$c93(s3);
  29353. s0 = s1;
  29354. } else {
  29355. peg$currPos = s0;
  29356. s0 = peg$FAILED;
  29357. }
  29358. } else {
  29359. peg$currPos = s0;
  29360. s0 = peg$FAILED;
  29361. }
  29362. } else {
  29363. peg$currPos = s0;
  29364. s0 = peg$FAILED;
  29365. }
  29366. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29367. return s0;
  29368. }
  29369. function peg$parsetemps() {
  29370. var s0, s1, s2, s3, s4, s5;
  29371. var key = peg$currPos * 66 + 44,
  29372. cached = peg$resultsCache[key];
  29373. if (cached) {
  29374. peg$currPos = cached.nextPos;
  29375. return cached.result;
  29376. }
  29377. s0 = peg$currPos;
  29378. if (input.charCodeAt(peg$currPos) === 124) {
  29379. s1 = peg$c94;
  29380. peg$currPos++;
  29381. } else {
  29382. s1 = peg$FAILED;
  29383. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29384. }
  29385. if (s1 !== peg$FAILED) {
  29386. s2 = [];
  29387. s3 = peg$currPos;
  29388. s4 = peg$parsews();
  29389. if (s4 !== peg$FAILED) {
  29390. s5 = peg$parseidentifier();
  29391. if (s5 !== peg$FAILED) {
  29392. peg$savedPos = s3;
  29393. s4 = peg$c96(s5);
  29394. s3 = s4;
  29395. } else {
  29396. peg$currPos = s3;
  29397. s3 = peg$FAILED;
  29398. }
  29399. } else {
  29400. peg$currPos = s3;
  29401. s3 = peg$FAILED;
  29402. }
  29403. while (s3 !== peg$FAILED) {
  29404. s2.push(s3);
  29405. s3 = peg$currPos;
  29406. s4 = peg$parsews();
  29407. if (s4 !== peg$FAILED) {
  29408. s5 = peg$parseidentifier();
  29409. if (s5 !== peg$FAILED) {
  29410. peg$savedPos = s3;
  29411. s4 = peg$c96(s5);
  29412. s3 = s4;
  29413. } else {
  29414. peg$currPos = s3;
  29415. s3 = peg$FAILED;
  29416. }
  29417. } else {
  29418. peg$currPos = s3;
  29419. s3 = peg$FAILED;
  29420. }
  29421. }
  29422. if (s2 !== peg$FAILED) {
  29423. s3 = peg$parsews();
  29424. if (s3 !== peg$FAILED) {
  29425. if (input.charCodeAt(peg$currPos) === 124) {
  29426. s4 = peg$c94;
  29427. peg$currPos++;
  29428. } else {
  29429. s4 = peg$FAILED;
  29430. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29431. }
  29432. if (s4 !== peg$FAILED) {
  29433. peg$savedPos = s0;
  29434. s1 = peg$c97(s2);
  29435. s0 = s1;
  29436. } else {
  29437. peg$currPos = s0;
  29438. s0 = peg$FAILED;
  29439. }
  29440. } else {
  29441. peg$currPos = s0;
  29442. s0 = peg$FAILED;
  29443. }
  29444. } else {
  29445. peg$currPos = s0;
  29446. s0 = peg$FAILED;
  29447. }
  29448. } else {
  29449. peg$currPos = s0;
  29450. s0 = peg$FAILED;
  29451. }
  29452. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29453. return s0;
  29454. }
  29455. function peg$parsewsBlockParamList() {
  29456. var s0, s1, s2, s3, s4, s5, s6;
  29457. var key = peg$currPos * 66 + 45,
  29458. cached = peg$resultsCache[key];
  29459. if (cached) {
  29460. peg$currPos = cached.nextPos;
  29461. return cached.result;
  29462. }
  29463. s0 = peg$currPos;
  29464. s1 = [];
  29465. s2 = peg$currPos;
  29466. s3 = peg$parsews();
  29467. if (s3 !== peg$FAILED) {
  29468. if (input.charCodeAt(peg$currPos) === 58) {
  29469. s4 = peg$c12;
  29470. peg$currPos++;
  29471. } else {
  29472. s4 = peg$FAILED;
  29473. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29474. }
  29475. if (s4 !== peg$FAILED) {
  29476. s5 = peg$parsews();
  29477. if (s5 !== peg$FAILED) {
  29478. s6 = peg$parseidentifier();
  29479. if (s6 !== peg$FAILED) {
  29480. peg$savedPos = s2;
  29481. s3 = peg$c98(s6);
  29482. s2 = s3;
  29483. } else {
  29484. peg$currPos = s2;
  29485. s2 = peg$FAILED;
  29486. }
  29487. } else {
  29488. peg$currPos = s2;
  29489. s2 = peg$FAILED;
  29490. }
  29491. } else {
  29492. peg$currPos = s2;
  29493. s2 = peg$FAILED;
  29494. }
  29495. } else {
  29496. peg$currPos = s2;
  29497. s2 = peg$FAILED;
  29498. }
  29499. if (s2 !== peg$FAILED) {
  29500. while (s2 !== peg$FAILED) {
  29501. s1.push(s2);
  29502. s2 = peg$currPos;
  29503. s3 = peg$parsews();
  29504. if (s3 !== peg$FAILED) {
  29505. if (input.charCodeAt(peg$currPos) === 58) {
  29506. s4 = peg$c12;
  29507. peg$currPos++;
  29508. } else {
  29509. s4 = peg$FAILED;
  29510. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29511. }
  29512. if (s4 !== peg$FAILED) {
  29513. s5 = peg$parsews();
  29514. if (s5 !== peg$FAILED) {
  29515. s6 = peg$parseidentifier();
  29516. if (s6 !== peg$FAILED) {
  29517. peg$savedPos = s2;
  29518. s3 = peg$c98(s6);
  29519. s2 = s3;
  29520. } else {
  29521. peg$currPos = s2;
  29522. s2 = peg$FAILED;
  29523. }
  29524. } else {
  29525. peg$currPos = s2;
  29526. s2 = peg$FAILED;
  29527. }
  29528. } else {
  29529. peg$currPos = s2;
  29530. s2 = peg$FAILED;
  29531. }
  29532. } else {
  29533. peg$currPos = s2;
  29534. s2 = peg$FAILED;
  29535. }
  29536. }
  29537. } else {
  29538. s1 = peg$FAILED;
  29539. }
  29540. if (s1 !== peg$FAILED) {
  29541. s2 = peg$parsews();
  29542. if (s2 !== peg$FAILED) {
  29543. if (input.charCodeAt(peg$currPos) === 124) {
  29544. s3 = peg$c94;
  29545. peg$currPos++;
  29546. } else {
  29547. s3 = peg$FAILED;
  29548. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29549. }
  29550. if (s3 !== peg$FAILED) {
  29551. peg$savedPos = s0;
  29552. s1 = peg$c99(s1);
  29553. s0 = s1;
  29554. } else {
  29555. peg$currPos = s0;
  29556. s0 = peg$FAILED;
  29557. }
  29558. } else {
  29559. peg$currPos = s0;
  29560. s0 = peg$FAILED;
  29561. }
  29562. } else {
  29563. peg$currPos = s0;
  29564. s0 = peg$FAILED;
  29565. }
  29566. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29567. return s0;
  29568. }
  29569. function peg$parsesubexpression() {
  29570. var s0, s1, s2, s3, s4, s5;
  29571. var key = peg$currPos * 66 + 46,
  29572. cached = peg$resultsCache[key];
  29573. if (cached) {
  29574. peg$currPos = cached.nextPos;
  29575. return cached.result;
  29576. }
  29577. s0 = peg$currPos;
  29578. if (input.charCodeAt(peg$currPos) === 40) {
  29579. s1 = peg$c51;
  29580. peg$currPos++;
  29581. } else {
  29582. s1 = peg$FAILED;
  29583. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  29584. }
  29585. if (s1 !== peg$FAILED) {
  29586. s2 = peg$parsews();
  29587. if (s2 !== peg$FAILED) {
  29588. s3 = peg$parseexpression();
  29589. if (s3 !== peg$FAILED) {
  29590. s4 = peg$parsews();
  29591. if (s4 !== peg$FAILED) {
  29592. if (input.charCodeAt(peg$currPos) === 41) {
  29593. s5 = peg$c48;
  29594. peg$currPos++;
  29595. } else {
  29596. s5 = peg$FAILED;
  29597. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  29598. }
  29599. if (s5 !== peg$FAILED) {
  29600. peg$savedPos = s0;
  29601. s1 = peg$c79(s3);
  29602. s0 = s1;
  29603. } else {
  29604. peg$currPos = s0;
  29605. s0 = peg$FAILED;
  29606. }
  29607. } else {
  29608. peg$currPos = s0;
  29609. s0 = peg$FAILED;
  29610. }
  29611. } else {
  29612. peg$currPos = s0;
  29613. s0 = peg$FAILED;
  29614. }
  29615. } else {
  29616. peg$currPos = s0;
  29617. s0 = peg$FAILED;
  29618. }
  29619. } else {
  29620. peg$currPos = s0;
  29621. s0 = peg$FAILED;
  29622. }
  29623. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29624. return s0;
  29625. }
  29626. function peg$parsewsStatements() {
  29627. var s0, s1, s2, s3;
  29628. var key = peg$currPos * 66 + 47,
  29629. cached = peg$resultsCache[key];
  29630. if (cached) {
  29631. peg$currPos = cached.nextPos;
  29632. return cached.result;
  29633. }
  29634. s0 = peg$currPos;
  29635. s1 = peg$parsemaybeDotsWs();
  29636. if (s1 !== peg$FAILED) {
  29637. s2 = peg$parseret();
  29638. if (s2 !== peg$FAILED) {
  29639. peg$savedPos = s0;
  29640. s1 = peg$c100(s2);
  29641. s0 = s1;
  29642. } else {
  29643. peg$currPos = s0;
  29644. s0 = peg$FAILED;
  29645. }
  29646. } else {
  29647. peg$currPos = s0;
  29648. s0 = peg$FAILED;
  29649. }
  29650. if (s0 === peg$FAILED) {
  29651. s0 = peg$currPos;
  29652. s1 = peg$parsewsExpressions();
  29653. if (s1 !== peg$FAILED) {
  29654. s2 = peg$parsesomeDotsWs();
  29655. if (s2 !== peg$FAILED) {
  29656. s3 = peg$parseret();
  29657. if (s3 !== peg$FAILED) {
  29658. peg$savedPos = s0;
  29659. s1 = peg$c101(s1, s3);
  29660. s0 = s1;
  29661. } else {
  29662. peg$currPos = s0;
  29663. s0 = peg$FAILED;
  29664. }
  29665. } else {
  29666. peg$currPos = s0;
  29667. s0 = peg$FAILED;
  29668. }
  29669. } else {
  29670. peg$currPos = s0;
  29671. s0 = peg$FAILED;
  29672. }
  29673. if (s0 === peg$FAILED) {
  29674. s0 = peg$currPos;
  29675. s1 = peg$parsewsExpressions();
  29676. if (s1 === peg$FAILED) {
  29677. s1 = null;
  29678. }
  29679. if (s1 !== peg$FAILED) {
  29680. peg$savedPos = s0;
  29681. s1 = peg$c102(s1);
  29682. }
  29683. s0 = s1;
  29684. }
  29685. }
  29686. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29687. return s0;
  29688. }
  29689. function peg$parsewsSequenceWs() {
  29690. var s0, s1, s2, s3, s4, s5, s6;
  29691. var key = peg$currPos * 66 + 48,
  29692. cached = peg$resultsCache[key];
  29693. if (cached) {
  29694. peg$currPos = cached.nextPos;
  29695. return cached.result;
  29696. }
  29697. s0 = peg$currPos;
  29698. s1 = peg$parsewsPragmas();
  29699. if (s1 === peg$FAILED) {
  29700. s1 = null;
  29701. }
  29702. if (s1 !== peg$FAILED) {
  29703. s2 = peg$parsews();
  29704. if (s2 !== peg$FAILED) {
  29705. s3 = peg$parsetemps();
  29706. if (s3 === peg$FAILED) {
  29707. s3 = null;
  29708. }
  29709. if (s3 !== peg$FAILED) {
  29710. s4 = peg$parsewsPragmas();
  29711. if (s4 === peg$FAILED) {
  29712. s4 = null;
  29713. }
  29714. if (s4 !== peg$FAILED) {
  29715. s5 = peg$parsewsStatements();
  29716. if (s5 === peg$FAILED) {
  29717. s5 = null;
  29718. }
  29719. if (s5 !== peg$FAILED) {
  29720. s6 = peg$parsemaybeDotsWs();
  29721. if (s6 !== peg$FAILED) {
  29722. peg$savedPos = s0;
  29723. s1 = peg$c103(s1, s3, s4, s5);
  29724. s0 = s1;
  29725. } else {
  29726. peg$currPos = s0;
  29727. s0 = peg$FAILED;
  29728. }
  29729. } else {
  29730. peg$currPos = s0;
  29731. s0 = peg$FAILED;
  29732. }
  29733. } else {
  29734. peg$currPos = s0;
  29735. s0 = peg$FAILED;
  29736. }
  29737. } else {
  29738. peg$currPos = s0;
  29739. s0 = peg$FAILED;
  29740. }
  29741. } else {
  29742. peg$currPos = s0;
  29743. s0 = peg$FAILED;
  29744. }
  29745. } else {
  29746. peg$currPos = s0;
  29747. s0 = peg$FAILED;
  29748. }
  29749. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29750. return s0;
  29751. }
  29752. function peg$parseblock() {
  29753. var s0, s1, s2, s3, s4;
  29754. var key = peg$currPos * 66 + 49,
  29755. cached = peg$resultsCache[key];
  29756. if (cached) {
  29757. peg$currPos = cached.nextPos;
  29758. return cached.result;
  29759. }
  29760. s0 = peg$currPos;
  29761. if (input.charCodeAt(peg$currPos) === 91) {
  29762. s1 = peg$c104;
  29763. peg$currPos++;
  29764. } else {
  29765. s1 = peg$FAILED;
  29766. if (peg$silentFails === 0) { peg$fail(peg$c105); }
  29767. }
  29768. if (s1 !== peg$FAILED) {
  29769. s2 = peg$parsewsBlockParamList();
  29770. if (s2 === peg$FAILED) {
  29771. s2 = null;
  29772. }
  29773. if (s2 !== peg$FAILED) {
  29774. s3 = peg$parsewsSequenceWs();
  29775. if (s3 !== peg$FAILED) {
  29776. if (input.charCodeAt(peg$currPos) === 93) {
  29777. s4 = peg$c106;
  29778. peg$currPos++;
  29779. } else {
  29780. s4 = peg$FAILED;
  29781. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  29782. }
  29783. if (s4 !== peg$FAILED) {
  29784. peg$savedPos = s0;
  29785. s1 = peg$c108(s2, s3);
  29786. s0 = s1;
  29787. } else {
  29788. peg$currPos = s0;
  29789. s0 = peg$FAILED;
  29790. }
  29791. } else {
  29792. peg$currPos = s0;
  29793. s0 = peg$FAILED;
  29794. }
  29795. } else {
  29796. peg$currPos = s0;
  29797. s0 = peg$FAILED;
  29798. }
  29799. } else {
  29800. peg$currPos = s0;
  29801. s0 = peg$FAILED;
  29802. }
  29803. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29804. return s0;
  29805. }
  29806. function peg$parseoperand() {
  29807. var s0;
  29808. var key = peg$currPos * 66 + 50,
  29809. cached = peg$resultsCache[key];
  29810. if (cached) {
  29811. peg$currPos = cached.nextPos;
  29812. return cached.result;
  29813. }
  29814. s0 = peg$parseliteral();
  29815. if (s0 === peg$FAILED) {
  29816. s0 = peg$parsevariable();
  29817. if (s0 === peg$FAILED) {
  29818. s0 = peg$parsesubexpression();
  29819. }
  29820. }
  29821. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29822. return s0;
  29823. }
  29824. function peg$parsewsUnaryMessage() {
  29825. var s0, s1, s2, s3, s4;
  29826. var key = peg$currPos * 66 + 51,
  29827. cached = peg$resultsCache[key];
  29828. if (cached) {
  29829. peg$currPos = cached.nextPos;
  29830. return cached.result;
  29831. }
  29832. s0 = peg$currPos;
  29833. s1 = peg$parsews();
  29834. if (s1 !== peg$FAILED) {
  29835. s2 = peg$parseidentifier();
  29836. if (s2 !== peg$FAILED) {
  29837. s3 = peg$currPos;
  29838. peg$silentFails++;
  29839. if (input.charCodeAt(peg$currPos) === 58) {
  29840. s4 = peg$c12;
  29841. peg$currPos++;
  29842. } else {
  29843. s4 = peg$FAILED;
  29844. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29845. }
  29846. peg$silentFails--;
  29847. if (s4 === peg$FAILED) {
  29848. s3 = void 0;
  29849. } else {
  29850. peg$currPos = s3;
  29851. s3 = peg$FAILED;
  29852. }
  29853. if (s3 !== peg$FAILED) {
  29854. peg$savedPos = s0;
  29855. s1 = peg$c109(s2);
  29856. s0 = s1;
  29857. } else {
  29858. peg$currPos = s0;
  29859. s0 = peg$FAILED;
  29860. }
  29861. } else {
  29862. peg$currPos = s0;
  29863. s0 = peg$FAILED;
  29864. }
  29865. } else {
  29866. peg$currPos = s0;
  29867. s0 = peg$FAILED;
  29868. }
  29869. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29870. return s0;
  29871. }
  29872. function peg$parsewsUnaryTail() {
  29873. var s0, s1;
  29874. var key = peg$currPos * 66 + 52,
  29875. cached = peg$resultsCache[key];
  29876. if (cached) {
  29877. peg$currPos = cached.nextPos;
  29878. return cached.result;
  29879. }
  29880. s0 = [];
  29881. s1 = peg$parsewsUnaryMessage();
  29882. while (s1 !== peg$FAILED) {
  29883. s0.push(s1);
  29884. s1 = peg$parsewsUnaryMessage();
  29885. }
  29886. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29887. return s0;
  29888. }
  29889. function peg$parseunarySend() {
  29890. var s0, s1, s2;
  29891. var key = peg$currPos * 66 + 53,
  29892. cached = peg$resultsCache[key];
  29893. if (cached) {
  29894. peg$currPos = cached.nextPos;
  29895. return cached.result;
  29896. }
  29897. s0 = peg$currPos;
  29898. s1 = peg$parseoperand();
  29899. if (s1 !== peg$FAILED) {
  29900. s2 = peg$parsewsUnaryTail();
  29901. if (s2 !== peg$FAILED) {
  29902. peg$savedPos = s0;
  29903. s1 = peg$c110(s1, s2);
  29904. s0 = s1;
  29905. } else {
  29906. peg$currPos = s0;
  29907. s0 = peg$FAILED;
  29908. }
  29909. } else {
  29910. peg$currPos = s0;
  29911. s0 = peg$FAILED;
  29912. }
  29913. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29914. return s0;
  29915. }
  29916. function peg$parsewsBinaryMessage() {
  29917. var s0, s1, s2, s3, s4;
  29918. var key = peg$currPos * 66 + 54,
  29919. cached = peg$resultsCache[key];
  29920. if (cached) {
  29921. peg$currPos = cached.nextPos;
  29922. return cached.result;
  29923. }
  29924. s0 = peg$currPos;
  29925. s1 = peg$parsews();
  29926. if (s1 !== peg$FAILED) {
  29927. s2 = peg$parsebinarySelector();
  29928. if (s2 !== peg$FAILED) {
  29929. s3 = peg$parsews();
  29930. if (s3 !== peg$FAILED) {
  29931. s4 = peg$parseunarySend();
  29932. if (s4 !== peg$FAILED) {
  29933. peg$savedPos = s0;
  29934. s1 = peg$c111(s2, s4);
  29935. s0 = s1;
  29936. } else {
  29937. peg$currPos = s0;
  29938. s0 = peg$FAILED;
  29939. }
  29940. } else {
  29941. peg$currPos = s0;
  29942. s0 = peg$FAILED;
  29943. }
  29944. } else {
  29945. peg$currPos = s0;
  29946. s0 = peg$FAILED;
  29947. }
  29948. } else {
  29949. peg$currPos = s0;
  29950. s0 = peg$FAILED;
  29951. }
  29952. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29953. return s0;
  29954. }
  29955. function peg$parsewsBinaryTail() {
  29956. var s0, s1, s2, s3;
  29957. var key = peg$currPos * 66 + 55,
  29958. cached = peg$resultsCache[key];
  29959. if (cached) {
  29960. peg$currPos = cached.nextPos;
  29961. return cached.result;
  29962. }
  29963. s0 = peg$currPos;
  29964. s1 = peg$parsewsUnaryTail();
  29965. if (s1 !== peg$FAILED) {
  29966. s2 = [];
  29967. s3 = peg$parsewsBinaryMessage();
  29968. while (s3 !== peg$FAILED) {
  29969. s2.push(s3);
  29970. s3 = peg$parsewsBinaryMessage();
  29971. }
  29972. if (s2 !== peg$FAILED) {
  29973. peg$savedPos = s0;
  29974. s1 = peg$c112(s1, s2);
  29975. s0 = s1;
  29976. } else {
  29977. peg$currPos = s0;
  29978. s0 = peg$FAILED;
  29979. }
  29980. } else {
  29981. peg$currPos = s0;
  29982. s0 = peg$FAILED;
  29983. }
  29984. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29985. return s0;
  29986. }
  29987. function peg$parsebinarySend() {
  29988. var s0, s1, s2;
  29989. var key = peg$currPos * 66 + 56,
  29990. cached = peg$resultsCache[key];
  29991. if (cached) {
  29992. peg$currPos = cached.nextPos;
  29993. return cached.result;
  29994. }
  29995. s0 = peg$currPos;
  29996. s1 = peg$parseoperand();
  29997. if (s1 !== peg$FAILED) {
  29998. s2 = peg$parsewsBinaryTail();
  29999. if (s2 !== peg$FAILED) {
  30000. peg$savedPos = s0;
  30001. s1 = peg$c110(s1, s2);
  30002. s0 = s1;
  30003. } else {
  30004. peg$currPos = s0;
  30005. s0 = peg$FAILED;
  30006. }
  30007. } else {
  30008. peg$currPos = s0;
  30009. s0 = peg$FAILED;
  30010. }
  30011. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30012. return s0;
  30013. }
  30014. function peg$parsewsKeywordMessage() {
  30015. var s0, s1, s2, s3, s4, s5, s6;
  30016. var key = peg$currPos * 66 + 57,
  30017. cached = peg$resultsCache[key];
  30018. if (cached) {
  30019. peg$currPos = cached.nextPos;
  30020. return cached.result;
  30021. }
  30022. s0 = peg$currPos;
  30023. s1 = [];
  30024. s2 = peg$currPos;
  30025. s3 = peg$parsews();
  30026. if (s3 !== peg$FAILED) {
  30027. s4 = peg$parsekeyword();
  30028. if (s4 !== peg$FAILED) {
  30029. s5 = peg$parsews();
  30030. if (s5 !== peg$FAILED) {
  30031. s6 = peg$parsebinarySend();
  30032. if (s6 !== peg$FAILED) {
  30033. peg$savedPos = s2;
  30034. s3 = peg$c75(s4, s6);
  30035. s2 = s3;
  30036. } else {
  30037. peg$currPos = s2;
  30038. s2 = peg$FAILED;
  30039. }
  30040. } else {
  30041. peg$currPos = s2;
  30042. s2 = peg$FAILED;
  30043. }
  30044. } else {
  30045. peg$currPos = s2;
  30046. s2 = peg$FAILED;
  30047. }
  30048. } else {
  30049. peg$currPos = s2;
  30050. s2 = peg$FAILED;
  30051. }
  30052. if (s2 !== peg$FAILED) {
  30053. while (s2 !== peg$FAILED) {
  30054. s1.push(s2);
  30055. s2 = peg$currPos;
  30056. s3 = peg$parsews();
  30057. if (s3 !== peg$FAILED) {
  30058. s4 = peg$parsekeyword();
  30059. if (s4 !== peg$FAILED) {
  30060. s5 = peg$parsews();
  30061. if (s5 !== peg$FAILED) {
  30062. s6 = peg$parsebinarySend();
  30063. if (s6 !== peg$FAILED) {
  30064. peg$savedPos = s2;
  30065. s3 = peg$c75(s4, s6);
  30066. s2 = s3;
  30067. } else {
  30068. peg$currPos = s2;
  30069. s2 = peg$FAILED;
  30070. }
  30071. } else {
  30072. peg$currPos = s2;
  30073. s2 = peg$FAILED;
  30074. }
  30075. } else {
  30076. peg$currPos = s2;
  30077. s2 = peg$FAILED;
  30078. }
  30079. } else {
  30080. peg$currPos = s2;
  30081. s2 = peg$FAILED;
  30082. }
  30083. }
  30084. } else {
  30085. s1 = peg$FAILED;
  30086. }
  30087. if (s1 !== peg$FAILED) {
  30088. peg$savedPos = s0;
  30089. s1 = peg$c113(s1);
  30090. }
  30091. s0 = s1;
  30092. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30093. return s0;
  30094. }
  30095. function peg$parsewsKeywordTail() {
  30096. var s0, s1, s2;
  30097. var key = peg$currPos * 66 + 58,
  30098. cached = peg$resultsCache[key];
  30099. if (cached) {
  30100. peg$currPos = cached.nextPos;
  30101. return cached.result;
  30102. }
  30103. s0 = peg$currPos;
  30104. s1 = peg$parsewsBinaryTail();
  30105. if (s1 !== peg$FAILED) {
  30106. s2 = peg$parsewsKeywordMessage();
  30107. if (s2 === peg$FAILED) {
  30108. s2 = null;
  30109. }
  30110. if (s2 !== peg$FAILED) {
  30111. peg$savedPos = s0;
  30112. s1 = peg$c114(s1, s2);
  30113. s0 = s1;
  30114. } else {
  30115. peg$currPos = s0;
  30116. s0 = peg$FAILED;
  30117. }
  30118. } else {
  30119. peg$currPos = s0;
  30120. s0 = peg$FAILED;
  30121. }
  30122. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30123. return s0;
  30124. }
  30125. function peg$parsekeywordSend() {
  30126. var s0, s1, s2;
  30127. var key = peg$currPos * 66 + 59,
  30128. cached = peg$resultsCache[key];
  30129. if (cached) {
  30130. peg$currPos = cached.nextPos;
  30131. return cached.result;
  30132. }
  30133. s0 = peg$currPos;
  30134. s1 = peg$parseoperand();
  30135. if (s1 !== peg$FAILED) {
  30136. s2 = peg$parsewsKeywordTail();
  30137. if (s2 !== peg$FAILED) {
  30138. peg$savedPos = s0;
  30139. s1 = peg$c110(s1, s2);
  30140. s0 = s1;
  30141. } else {
  30142. peg$currPos = s0;
  30143. s0 = peg$FAILED;
  30144. }
  30145. } else {
  30146. peg$currPos = s0;
  30147. s0 = peg$FAILED;
  30148. }
  30149. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30150. return s0;
  30151. }
  30152. function peg$parsewsMessage() {
  30153. var s0;
  30154. var key = peg$currPos * 66 + 60,
  30155. cached = peg$resultsCache[key];
  30156. if (cached) {
  30157. peg$currPos = cached.nextPos;
  30158. return cached.result;
  30159. }
  30160. s0 = peg$parsewsBinaryMessage();
  30161. if (s0 === peg$FAILED) {
  30162. s0 = peg$parsewsUnaryMessage();
  30163. if (s0 === peg$FAILED) {
  30164. s0 = peg$parsewsKeywordMessage();
  30165. }
  30166. }
  30167. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30168. return s0;
  30169. }
  30170. function peg$parsecascade() {
  30171. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  30172. var key = peg$currPos * 66 + 61,
  30173. cached = peg$resultsCache[key];
  30174. if (cached) {
  30175. peg$currPos = cached.nextPos;
  30176. return cached.result;
  30177. }
  30178. s0 = peg$currPos;
  30179. s1 = peg$parseoperand();
  30180. if (s1 !== peg$FAILED) {
  30181. s2 = peg$parsewsKeywordTail();
  30182. if (s2 !== peg$FAILED) {
  30183. peg$savedPos = peg$currPos;
  30184. s3 = peg$c115(s1, s2);
  30185. if (s3) {
  30186. s3 = void 0;
  30187. } else {
  30188. s3 = peg$FAILED;
  30189. }
  30190. if (s3 !== peg$FAILED) {
  30191. s4 = [];
  30192. s5 = peg$currPos;
  30193. s6 = peg$parsews();
  30194. if (s6 !== peg$FAILED) {
  30195. if (input.charCodeAt(peg$currPos) === 59) {
  30196. s7 = peg$c116;
  30197. peg$currPos++;
  30198. } else {
  30199. s7 = peg$FAILED;
  30200. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  30201. }
  30202. if (s7 !== peg$FAILED) {
  30203. s8 = peg$parsewsMessage();
  30204. if (s8 !== peg$FAILED) {
  30205. peg$savedPos = s5;
  30206. s6 = peg$c118(s1, s2, s8);
  30207. s5 = s6;
  30208. } else {
  30209. peg$currPos = s5;
  30210. s5 = peg$FAILED;
  30211. }
  30212. } else {
  30213. peg$currPos = s5;
  30214. s5 = peg$FAILED;
  30215. }
  30216. } else {
  30217. peg$currPos = s5;
  30218. s5 = peg$FAILED;
  30219. }
  30220. if (s5 !== peg$FAILED) {
  30221. while (s5 !== peg$FAILED) {
  30222. s4.push(s5);
  30223. s5 = peg$currPos;
  30224. s6 = peg$parsews();
  30225. if (s6 !== peg$FAILED) {
  30226. if (input.charCodeAt(peg$currPos) === 59) {
  30227. s7 = peg$c116;
  30228. peg$currPos++;
  30229. } else {
  30230. s7 = peg$FAILED;
  30231. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  30232. }
  30233. if (s7 !== peg$FAILED) {
  30234. s8 = peg$parsewsMessage();
  30235. if (s8 !== peg$FAILED) {
  30236. peg$savedPos = s5;
  30237. s6 = peg$c118(s1, s2, s8);
  30238. s5 = s6;
  30239. } else {
  30240. peg$currPos = s5;
  30241. s5 = peg$FAILED;
  30242. }
  30243. } else {
  30244. peg$currPos = s5;
  30245. s5 = peg$FAILED;
  30246. }
  30247. } else {
  30248. peg$currPos = s5;
  30249. s5 = peg$FAILED;
  30250. }
  30251. }
  30252. } else {
  30253. s4 = peg$FAILED;
  30254. }
  30255. if (s4 !== peg$FAILED) {
  30256. peg$savedPos = s0;
  30257. s1 = peg$c119(s1, s2, s4);
  30258. s0 = s1;
  30259. } else {
  30260. peg$currPos = s0;
  30261. s0 = peg$FAILED;
  30262. }
  30263. } else {
  30264. peg$currPos = s0;
  30265. s0 = peg$FAILED;
  30266. }
  30267. } else {
  30268. peg$currPos = s0;
  30269. s0 = peg$FAILED;
  30270. }
  30271. } else {
  30272. peg$currPos = s0;
  30273. s0 = peg$FAILED;
  30274. }
  30275. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30276. return s0;
  30277. }
  30278. function peg$parsemethod() {
  30279. var s0, s1, s2;
  30280. var key = peg$currPos * 66 + 62,
  30281. cached = peg$resultsCache[key];
  30282. if (cached) {
  30283. peg$currPos = cached.nextPos;
  30284. return cached.result;
  30285. }
  30286. s0 = peg$currPos;
  30287. s1 = peg$parsewsKeywordPattern();
  30288. if (s1 === peg$FAILED) {
  30289. s1 = peg$parsewsBinaryPattern();
  30290. if (s1 === peg$FAILED) {
  30291. s1 = peg$parsewsUnaryPattern();
  30292. }
  30293. }
  30294. if (s1 !== peg$FAILED) {
  30295. s2 = peg$parsewsSequenceWs();
  30296. if (s2 !== peg$FAILED) {
  30297. peg$savedPos = s0;
  30298. s1 = peg$c120(s1, s2);
  30299. s0 = s1;
  30300. } else {
  30301. peg$currPos = s0;
  30302. s0 = peg$FAILED;
  30303. }
  30304. } else {
  30305. peg$currPos = s0;
  30306. s0 = peg$FAILED;
  30307. }
  30308. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30309. return s0;
  30310. }
  30311. function peg$parseassociationSend() {
  30312. var s0, s1, s2, s3;
  30313. var key = peg$currPos * 66 + 63,
  30314. cached = peg$resultsCache[key];
  30315. if (cached) {
  30316. peg$currPos = cached.nextPos;
  30317. return cached.result;
  30318. }
  30319. s0 = peg$currPos;
  30320. s1 = peg$parseoperand();
  30321. if (s1 !== peg$FAILED) {
  30322. s2 = peg$parsewsBinaryTail();
  30323. if (s2 !== peg$FAILED) {
  30324. peg$savedPos = peg$currPos;
  30325. s3 = peg$c121(s1, s2);
  30326. if (s3) {
  30327. s3 = void 0;
  30328. } else {
  30329. s3 = peg$FAILED;
  30330. }
  30331. if (s3 !== peg$FAILED) {
  30332. peg$savedPos = s0;
  30333. s1 = peg$c122(s1, s2);
  30334. s0 = s1;
  30335. } else {
  30336. peg$currPos = s0;
  30337. s0 = peg$FAILED;
  30338. }
  30339. } else {
  30340. peg$currPos = s0;
  30341. s0 = peg$FAILED;
  30342. }
  30343. } else {
  30344. peg$currPos = s0;
  30345. s0 = peg$FAILED;
  30346. }
  30347. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30348. return s0;
  30349. }
  30350. function peg$parsewsAssociationsRest() {
  30351. var s0, s1, s2;
  30352. var key = peg$currPos * 66 + 64,
  30353. cached = peg$resultsCache[key];
  30354. if (cached) {
  30355. peg$currPos = cached.nextPos;
  30356. return cached.result;
  30357. }
  30358. s0 = peg$currPos;
  30359. s1 = peg$parsesomeDotsWs();
  30360. if (s1 !== peg$FAILED) {
  30361. s2 = peg$parseassociationSend();
  30362. if (s2 !== peg$FAILED) {
  30363. peg$savedPos = s0;
  30364. s1 = peg$c79(s2);
  30365. s0 = s1;
  30366. } else {
  30367. peg$currPos = s0;
  30368. s0 = peg$FAILED;
  30369. }
  30370. } else {
  30371. peg$currPos = s0;
  30372. s0 = peg$FAILED;
  30373. }
  30374. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30375. return s0;
  30376. }
  30377. function peg$parsewsAssociations() {
  30378. var s0, s1, s2, s3, s4;
  30379. var key = peg$currPos * 66 + 65,
  30380. cached = peg$resultsCache[key];
  30381. if (cached) {
  30382. peg$currPos = cached.nextPos;
  30383. return cached.result;
  30384. }
  30385. s0 = peg$currPos;
  30386. s1 = peg$parsemaybeDotsWs();
  30387. if (s1 !== peg$FAILED) {
  30388. s2 = peg$parseassociationSend();
  30389. if (s2 !== peg$FAILED) {
  30390. s3 = [];
  30391. s4 = peg$parsewsAssociationsRest();
  30392. while (s4 !== peg$FAILED) {
  30393. s3.push(s4);
  30394. s4 = peg$parsewsAssociationsRest();
  30395. }
  30396. if (s3 !== peg$FAILED) {
  30397. peg$savedPos = s0;
  30398. s1 = peg$c123(s2, s3);
  30399. s0 = s1;
  30400. } else {
  30401. peg$currPos = s0;
  30402. s0 = peg$FAILED;
  30403. }
  30404. } else {
  30405. peg$currPos = s0;
  30406. s0 = peg$FAILED;
  30407. }
  30408. } else {
  30409. peg$currPos = s0;
  30410. s0 = peg$FAILED;
  30411. }
  30412. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30413. return s0;
  30414. }
  30415. peg$result = peg$startRuleFunction();
  30416. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  30417. return peg$result;
  30418. } else {
  30419. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  30420. peg$fail({ type: "end", description: "end of input" });
  30421. }
  30422. throw peg$buildException(
  30423. null,
  30424. peg$maxFailExpected,
  30425. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  30426. peg$maxFailPos < input.length
  30427. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  30428. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  30429. );
  30430. }
  30431. }
  30432. return {
  30433. SyntaxError: peg$SyntaxError,
  30434. parse: peg$parse
  30435. };
  30436. })();
  30437. });
  30438. define('amber/core/Platform-ImportExport',["amber/boot", "require", "amber/core/Kernel-Classes", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Infrastructure", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  30439. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30440. var $pkg = $core.addPackage("Platform-ImportExport");
  30441. $pkg.innerEval = function (expr) { return eval(expr); };
  30442. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  30443. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  30444. $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.";
  30445. $core.addMethod(
  30446. $core.method({
  30447. selector: "exportPackage:on:",
  30448. protocol: "output",
  30449. fn: function (aPackage,aStream){
  30450. var self=this,$self=this;
  30451. return $core.withContext(function($ctx1) {
  30452. $self._subclassResponsibility();
  30453. return self;
  30454. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  30455. },
  30456. args: ["aPackage", "aStream"],
  30457. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  30458. referencedClasses: [],
  30459. messageSends: ["subclassResponsibility"]
  30460. }),
  30461. $globals.AbstractExporter);
  30462. $core.addMethod(
  30463. $core.method({
  30464. selector: "extensionMethodsOfPackage:",
  30465. protocol: "accessing",
  30466. fn: function (aPackage){
  30467. var self=this,$self=this;
  30468. var result;
  30469. return $core.withContext(function($ctx1) {
  30470. result=$recv($globals.OrderedCollection)._new();
  30471. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  30472. return $core.withContext(function($ctx2) {
  30473. return $recv(result)._addAll_($recv(each)._ownMethods());
  30474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30475. }));
  30476. return result;
  30477. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  30478. },
  30479. args: ["aPackage"],
  30480. 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",
  30481. referencedClasses: ["OrderedCollection"],
  30482. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  30483. }),
  30484. $globals.AbstractExporter);
  30485. $core.addMethod(
  30486. $core.method({
  30487. selector: "extensionProtocolsOfPackage:",
  30488. protocol: "accessing",
  30489. fn: function (aPackage){
  30490. var self=this,$self=this;
  30491. var extensionName,result;
  30492. return $core.withContext(function($ctx1) {
  30493. var $1,$2,$3;
  30494. $1=$recv(aPackage)._name();
  30495. $ctx1.sendIdx["name"]=1;
  30496. extensionName="*".__comma($1);
  30497. result=$recv($globals.OrderedCollection)._new();
  30498. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  30499. return $core.withContext(function($ctx2) {
  30500. $2=$recv(a)._name();
  30501. $ctx2.sendIdx["name"]=2;
  30502. return $recv($2).__lt($recv(b)._name());
  30503. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30504. })))._do_((function(each){
  30505. return $core.withContext(function($ctx2) {
  30506. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._do_((function(behavior){
  30507. return $core.withContext(function($ctx3) {
  30508. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  30509. if($core.assert($3)){
  30510. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  30511. }
  30512. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  30513. }));
  30514. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30515. }));
  30516. $ctx1.sendIdx["do:"]=1;
  30517. return result;
  30518. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  30519. },
  30520. args: ["aPackage"],
  30521. 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",
  30522. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  30523. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "copyWithout:", "theMetaClass", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  30524. }),
  30525. $globals.AbstractExporter);
  30526. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30527. $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.";
  30528. $core.addMethod(
  30529. $core.method({
  30530. selector: "chunkEscape:",
  30531. protocol: "convenience",
  30532. fn: function (aString){
  30533. var self=this,$self=this;
  30534. return $core.withContext(function($ctx1) {
  30535. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  30536. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  30537. },
  30538. args: ["aString"],
  30539. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  30540. referencedClasses: [],
  30541. messageSends: ["trimBoth", "replace:with:"]
  30542. }),
  30543. $globals.ChunkExporter);
  30544. $core.addMethod(
  30545. $core.method({
  30546. selector: "exportBehavior:on:",
  30547. protocol: "output",
  30548. fn: function (aBehavior,aStream){
  30549. var self=this,$self=this;
  30550. return $core.withContext(function($ctx1) {
  30551. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30552. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  30553. return self;
  30554. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30555. },
  30556. args: ["aBehavior", "aStream"],
  30557. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  30558. referencedClasses: [],
  30559. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  30560. }),
  30561. $globals.ChunkExporter);
  30562. $core.addMethod(
  30563. $core.method({
  30564. selector: "exportCategoryEpilogueOf:on:",
  30565. protocol: "output",
  30566. fn: function (aCategory,aStream){
  30567. var self=this,$self=this;
  30568. return $core.withContext(function($ctx1) {
  30569. $recv(aStream)._write_(" !");
  30570. $recv(aStream)._lf();
  30571. $ctx1.sendIdx["lf"]=1;
  30572. $recv(aStream)._lf();
  30573. return self;
  30574. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30575. },
  30576. args: ["aCategory", "aStream"],
  30577. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30578. referencedClasses: [],
  30579. messageSends: ["write:", "lf"]
  30580. }),
  30581. $globals.ChunkExporter);
  30582. $core.addMethod(
  30583. $core.method({
  30584. selector: "exportCategoryPrologueOf:on:",
  30585. protocol: "output",
  30586. fn: function (aCategory,aStream){
  30587. var self=this,$self=this;
  30588. return $core.withContext(function($ctx1) {
  30589. $recv(aStream)._write_("!");
  30590. $ctx1.sendIdx["write:"]=1;
  30591. $recv(aStream)._print_($recv(aCategory)._theClass());
  30592. $ctx1.sendIdx["print:"]=1;
  30593. $recv(aStream)._write_(" methodsFor: ");
  30594. $ctx1.sendIdx["write:"]=2;
  30595. $recv(aStream)._print_(aCategory);
  30596. $recv(aStream)._write_("!");
  30597. return self;
  30598. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30599. },
  30600. args: ["aCategory", "aStream"],
  30601. 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: '!'",
  30602. referencedClasses: [],
  30603. messageSends: ["write:", "print:", "theClass"]
  30604. }),
  30605. $globals.ChunkExporter);
  30606. $core.addMethod(
  30607. $core.method({
  30608. selector: "exportDefinitionOf:on:",
  30609. protocol: "output",
  30610. fn: function (aClass,aStream){
  30611. var self=this,$self=this;
  30612. return $core.withContext(function($ctx1) {
  30613. var $1,$2,$3,$4;
  30614. $recv(aStream)._print_($recv(aClass)._superclass());
  30615. $ctx1.sendIdx["print:"]=1;
  30616. $recv(aStream)._write_(" subclass: ");
  30617. $ctx1.sendIdx["write:"]=1;
  30618. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30619. $1=$recv(aStream)._lf();
  30620. $ctx1.sendIdx["lf"]=1;
  30621. $recv(aStream)._tab();
  30622. $ctx1.sendIdx["tab"]=1;
  30623. $recv(aStream)._write_(["slots: {",". "._join_($recv($recv(aClass)._instanceVariableNames())._collect_("symbolPrintString")),"}"]);
  30624. $ctx1.sendIdx["write:"]=2;
  30625. $recv(aStream)._lf();
  30626. $ctx1.sendIdx["lf"]=2;
  30627. $recv(aStream)._tab();
  30628. $recv(aStream)._write_("package: ");
  30629. $ctx1.sendIdx["write:"]=3;
  30630. $recv(aStream)._print_($recv(aClass)._category());
  30631. $ctx1.sendIdx["print:"]=2;
  30632. $recv(aStream)._write_("!");
  30633. $ctx1.sendIdx["write:"]=4;
  30634. $2=$recv(aStream)._lf();
  30635. $ctx1.sendIdx["lf"]=3;
  30636. $3=$recv(aClass)._comment();
  30637. $ctx1.sendIdx["comment"]=1;
  30638. $recv($3)._ifNotEmpty_((function(){
  30639. return $core.withContext(function($ctx2) {
  30640. $recv(aStream)._write_("!");
  30641. $ctx2.sendIdx["write:"]=5;
  30642. $recv(aStream)._print_(aClass);
  30643. $recv(aStream)._write_(" commentStamp!");
  30644. $ctx2.sendIdx["write:"]=6;
  30645. $recv(aStream)._lf();
  30646. $ctx2.sendIdx["lf"]=4;
  30647. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30648. $4=$recv(aStream)._lf();
  30649. $ctx2.sendIdx["lf"]=5;
  30650. return $4;
  30651. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30652. }));
  30653. $recv(aStream)._lf();
  30654. return self;
  30655. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30656. },
  30657. args: ["aClass", "aStream"],
  30658. 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: {'slots: {'. ('. ' join: (aClass instanceVariableNames collect: #symbolPrintString)). '}'};\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",
  30659. referencedClasses: [],
  30660. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "collect:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30661. }),
  30662. $globals.ChunkExporter);
  30663. $core.addMethod(
  30664. $core.method({
  30665. selector: "exportMetaDefinitionOf:on:",
  30666. protocol: "output",
  30667. fn: function (aClass,aStream){
  30668. var self=this,$self=this;
  30669. var classIvars,classTraitComposition;
  30670. return $core.withContext(function($ctx1) {
  30671. var $1,$2;
  30672. $1=$recv(aClass)._class();
  30673. $ctx1.sendIdx["class"]=1;
  30674. classIvars=$recv($1)._instanceVariableNames();
  30675. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  30676. $2=$recv(classIvars)._notEmpty();
  30677. if($core.assert($2)){
  30678. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  30679. $recv(aStream)._space();
  30680. $recv(aStream)._write_(["slots: {",". "._join_($recv(classIvars)._collect_("symbolPrintString")),"}!"]);
  30681. $recv(aStream)._lf();
  30682. $ctx1.sendIdx["lf"]=1;
  30683. $recv(aStream)._lf();
  30684. }
  30685. return self;
  30686. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition},$globals.ChunkExporter)});
  30687. },
  30688. args: ["aClass", "aStream"],
  30689. 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: {'slots: {'. ('. ' join: (classIvars collect: #symbolPrintString)). '}!'}; lf; lf ]",
  30690. referencedClasses: [],
  30691. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "collect:", "lf"]
  30692. }),
  30693. $globals.ChunkExporter);
  30694. $core.addMethod(
  30695. $core.method({
  30696. selector: "exportMethod:on:",
  30697. protocol: "output",
  30698. fn: function (aMethod,aStream){
  30699. var self=this,$self=this;
  30700. return $core.withContext(function($ctx1) {
  30701. $recv(aStream)._lf();
  30702. $ctx1.sendIdx["lf"]=1;
  30703. $recv(aStream)._lf();
  30704. $ctx1.sendIdx["lf"]=2;
  30705. $recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()));
  30706. $ctx1.sendIdx["write:"]=1;
  30707. $recv(aStream)._lf();
  30708. $recv(aStream)._write_("!");
  30709. return self;
  30710. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  30711. },
  30712. args: ["aMethod", "aStream"],
  30713. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  30714. referencedClasses: [],
  30715. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  30716. }),
  30717. $globals.ChunkExporter);
  30718. $core.addMethod(
  30719. $core.method({
  30720. selector: "exportPackage:on:",
  30721. protocol: "output",
  30722. fn: function (aPackage,aStream){
  30723. var self=this,$self=this;
  30724. return $core.withContext(function($ctx1) {
  30725. var $1,$receiver;
  30726. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  30727. $self._exportPackageImportsOf_on_(aPackage,aStream);
  30728. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  30729. return $core.withContext(function($ctx2) {
  30730. $self._exportBehavior_on_(each,aStream);
  30731. $ctx2.sendIdx["exportBehavior:on:"]=1;
  30732. $1=$recv(each)._theMetaClass();
  30733. if(($receiver = $1) == null || $receiver.a$nil){
  30734. return $1;
  30735. } else {
  30736. var meta;
  30737. meta=$receiver;
  30738. return $self._exportBehavior_on_(meta,aStream);
  30739. }
  30740. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30741. }));
  30742. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  30743. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  30744. return self;
  30745. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30746. },
  30747. args: ["aPackage", "aStream"],
  30748. 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",
  30749. referencedClasses: [],
  30750. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  30751. }),
  30752. $globals.ChunkExporter);
  30753. $core.addMethod(
  30754. $core.method({
  30755. selector: "exportPackageDefinitionOf:on:",
  30756. protocol: "output",
  30757. fn: function (aPackage,aStream){
  30758. var self=this,$self=this;
  30759. return $core.withContext(function($ctx1) {
  30760. $recv(aStream)._write_("Smalltalk createPackage: ");
  30761. $ctx1.sendIdx["write:"]=1;
  30762. $recv(aStream)._print_($recv(aPackage)._name());
  30763. $recv(aStream)._write_("!");
  30764. $recv(aStream)._lf();
  30765. return self;
  30766. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30767. },
  30768. args: ["aPackage", "aStream"],
  30769. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  30770. referencedClasses: [],
  30771. messageSends: ["write:", "print:", "name", "lf"]
  30772. }),
  30773. $globals.ChunkExporter);
  30774. $core.addMethod(
  30775. $core.method({
  30776. selector: "exportPackageImportsOf:on:",
  30777. protocol: "output",
  30778. fn: function (aPackage,aStream){
  30779. var self=this,$self=this;
  30780. return $core.withContext(function($ctx1) {
  30781. var $1;
  30782. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  30783. return $core.withContext(function($ctx2) {
  30784. $recv(aStream)._write_("(Smalltalk packageAt: ");
  30785. $ctx2.sendIdx["write:"]=1;
  30786. $1=$recv(aPackage)._name();
  30787. $ctx2.sendIdx["name"]=1;
  30788. $recv(aStream)._print_($1);
  30789. $ctx2.sendIdx["print:"]=1;
  30790. $recv(aStream)._write_(" ifAbsent: [ self error: ");
  30791. $ctx2.sendIdx["write:"]=2;
  30792. $recv(aStream)._print_("Package not created: ".__comma($recv(aPackage)._name()));
  30793. $recv(aStream)._write_([" ]) imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  30794. return $recv(aStream)._lf();
  30795. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  30796. }));
  30797. return self;
  30798. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30799. },
  30800. args: ["aPackage", "aStream"],
  30801. 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 ]",
  30802. referencedClasses: [],
  30803. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", ",", "chunkEscape:", "importsDefinition", "lf"]
  30804. }),
  30805. $globals.ChunkExporter);
  30806. $core.addMethod(
  30807. $core.method({
  30808. selector: "exportPackageTraitCompositionsOf:on:",
  30809. protocol: "output",
  30810. fn: function (aPackage,aStream){
  30811. var self=this,$self=this;
  30812. return $core.withContext(function($ctx1) {
  30813. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  30814. return $core.withContext(function($ctx2) {
  30815. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  30816. return $core.withContext(function($ctx3) {
  30817. return $self._exportTraitComposition_of_on_(value,key,aStream);
  30818. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  30819. }));
  30820. $recv(aStream)._write_("! !");
  30821. $recv(aStream)._lf();
  30822. $ctx2.sendIdx["lf"]=1;
  30823. return $recv(aStream)._lf();
  30824. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  30825. }));
  30826. return self;
  30827. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30828. },
  30829. args: ["aPackage", "aStream"],
  30830. 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 ]",
  30831. referencedClasses: [],
  30832. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  30833. }),
  30834. $globals.ChunkExporter);
  30835. $core.addMethod(
  30836. $core.method({
  30837. selector: "exportProtocol:on:",
  30838. protocol: "output",
  30839. fn: function (aProtocol,aStream){
  30840. var self=this,$self=this;
  30841. return $core.withContext(function($ctx1) {
  30842. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  30843. return $core.withContext(function($ctx2) {
  30844. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  30845. $recv(methods)._do_((function(method){
  30846. return $core.withContext(function($ctx3) {
  30847. return $self._exportMethod_on_(method,aStream);
  30848. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  30849. }));
  30850. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  30851. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  30852. }));
  30853. return self;
  30854. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30855. },
  30856. args: ["aProtocol", "aStream"],
  30857. 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 ]",
  30858. referencedClasses: [],
  30859. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  30860. }),
  30861. $globals.ChunkExporter);
  30862. $core.addMethod(
  30863. $core.method({
  30864. selector: "exportProtocolEpilogueOf:on:",
  30865. protocol: "output",
  30866. fn: function (aProtocol,aStream){
  30867. var self=this,$self=this;
  30868. return $core.withContext(function($ctx1) {
  30869. $recv(aStream)._write_(" !");
  30870. $recv(aStream)._lf();
  30871. $ctx1.sendIdx["lf"]=1;
  30872. $recv(aStream)._lf();
  30873. return self;
  30874. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30875. },
  30876. args: ["aProtocol", "aStream"],
  30877. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30878. referencedClasses: [],
  30879. messageSends: ["write:", "lf"]
  30880. }),
  30881. $globals.ChunkExporter);
  30882. $core.addMethod(
  30883. $core.method({
  30884. selector: "exportProtocolPrologueOf:on:",
  30885. protocol: "output",
  30886. fn: function (aProtocol,aStream){
  30887. var self=this,$self=this;
  30888. return $core.withContext(function($ctx1) {
  30889. $recv(aStream)._write_("!");
  30890. $ctx1.sendIdx["write:"]=1;
  30891. $recv(aStream)._print_($recv(aProtocol)._theClass());
  30892. $ctx1.sendIdx["print:"]=1;
  30893. $recv(aStream)._write_(" methodsFor: ");
  30894. $ctx1.sendIdx["write:"]=2;
  30895. $recv(aStream)._print_($recv(aProtocol)._name());
  30896. $recv(aStream)._write_("!");
  30897. return self;
  30898. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30899. },
  30900. args: ["aProtocol", "aStream"],
  30901. 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: '!'",
  30902. referencedClasses: [],
  30903. messageSends: ["write:", "print:", "theClass", "name"]
  30904. }),
  30905. $globals.ChunkExporter);
  30906. $core.addMethod(
  30907. $core.method({
  30908. selector: "exportProtocols:on:",
  30909. protocol: "output",
  30910. fn: function (aCollection,aStream){
  30911. var self=this,$self=this;
  30912. return $core.withContext(function($ctx1) {
  30913. $recv(aCollection)._do_((function(each){
  30914. return $core.withContext(function($ctx2) {
  30915. return $self._exportProtocol_on_(each,aStream);
  30916. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30917. }));
  30918. return self;
  30919. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  30920. },
  30921. args: ["aCollection", "aStream"],
  30922. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  30923. referencedClasses: [],
  30924. messageSends: ["do:", "exportProtocol:on:"]
  30925. }),
  30926. $globals.ChunkExporter);
  30927. $core.addMethod(
  30928. $core.method({
  30929. selector: "exportTraitComposition:of:on:",
  30930. protocol: "output",
  30931. fn: function (aTraitComposition,aBehavior,aStream){
  30932. var self=this,$self=this;
  30933. return $core.withContext(function($ctx1) {
  30934. $recv(aStream)._print_(aBehavior);
  30935. $recv(aStream)._write_(" setTraitComposition: ");
  30936. $ctx1.sendIdx["write:"]=1;
  30937. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  30938. $ctx1.sendIdx["write:"]=2;
  30939. $recv(aStream)._write_(" asTraitComposition!");
  30940. $recv(aStream)._lf();
  30941. return self;
  30942. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30943. },
  30944. args: ["aTraitComposition", "aBehavior", "aStream"],
  30945. 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",
  30946. referencedClasses: [],
  30947. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  30948. }),
  30949. $globals.ChunkExporter);
  30950. $core.addMethod(
  30951. $core.method({
  30952. selector: "exportTraitDefinitionOf:on:",
  30953. protocol: "output",
  30954. fn: function (aClass,aStream){
  30955. var self=this,$self=this;
  30956. return $core.withContext(function($ctx1) {
  30957. var $1,$2,$3,$4;
  30958. $recv(aStream)._write_("Trait named: ");
  30959. $ctx1.sendIdx["write:"]=1;
  30960. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30961. $1=$recv(aStream)._lf();
  30962. $ctx1.sendIdx["lf"]=1;
  30963. $recv(aStream)._tab();
  30964. $recv(aStream)._write_("package: ");
  30965. $ctx1.sendIdx["write:"]=2;
  30966. $recv(aStream)._print_($recv(aClass)._category());
  30967. $ctx1.sendIdx["print:"]=1;
  30968. $recv(aStream)._write_("!");
  30969. $ctx1.sendIdx["write:"]=3;
  30970. $2=$recv(aStream)._lf();
  30971. $ctx1.sendIdx["lf"]=2;
  30972. $3=$recv(aClass)._comment();
  30973. $ctx1.sendIdx["comment"]=1;
  30974. $recv($3)._ifNotEmpty_((function(){
  30975. return $core.withContext(function($ctx2) {
  30976. $recv(aStream)._write_("!");
  30977. $ctx2.sendIdx["write:"]=4;
  30978. $recv(aStream)._print_(aClass);
  30979. $recv(aStream)._write_(" commentStamp!");
  30980. $ctx2.sendIdx["write:"]=5;
  30981. $recv(aStream)._lf();
  30982. $ctx2.sendIdx["lf"]=3;
  30983. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30984. $4=$recv(aStream)._lf();
  30985. $ctx2.sendIdx["lf"]=4;
  30986. return $4;
  30987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30988. }));
  30989. $recv(aStream)._lf();
  30990. return self;
  30991. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30992. },
  30993. args: ["aClass", "aStream"],
  30994. 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",
  30995. referencedClasses: [],
  30996. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30997. }),
  30998. $globals.ChunkExporter);
  30999. $core.addMethod(
  31000. $core.method({
  31001. selector: "extensionCategoriesOfPackage:",
  31002. protocol: "accessing",
  31003. fn: function (aPackage){
  31004. var self=this,$self=this;
  31005. var name,map,result;
  31006. return $core.withContext(function($ctx1) {
  31007. var $1;
  31008. name=$recv(aPackage)._name();
  31009. result=$recv($globals.OrderedCollection)._new();
  31010. $ctx1.sendIdx["new"]=1;
  31011. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  31012. return $core.withContext(function($ctx2) {
  31013. return $recv([each,$recv(each)._theMetaClass()])._do_((function(aClass){
  31014. return $core.withContext(function($ctx3) {
  31015. map=$recv($globals.Dictionary)._new();
  31016. $recv(aClass)._protocolsDo_((function(category,methods){
  31017. return $core.withContext(function($ctx4) {
  31018. $1=$recv(category).__eq("*".__comma(name));
  31019. if($core.assert($1)){
  31020. return $recv(map)._at_put_(category,methods);
  31021. }
  31022. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  31023. }));
  31024. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  31025. return $core.withContext(function($ctx4) {
  31026. return $recv(a).__lt_eq(b);
  31027. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  31028. })))._collect_((function(category){
  31029. return $core.withContext(function($ctx4) {
  31030. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  31031. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  31032. })));
  31033. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  31034. }));
  31035. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31036. }));
  31037. $ctx1.sendIdx["do:"]=1;
  31038. return result;
  31039. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  31040. },
  31041. args: ["aPackage"],
  31042. 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",
  31043. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  31044. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "theMetaClass", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  31045. }),
  31046. $globals.ChunkExporter);
  31047. $core.addMethod(
  31048. $core.method({
  31049. selector: "ownCategoriesOfClass:",
  31050. protocol: "accessing",
  31051. fn: function (aClass){
  31052. var self=this,$self=this;
  31053. var map;
  31054. return $core.withContext(function($ctx1) {
  31055. var $1;
  31056. map=$recv($globals.Dictionary)._new();
  31057. $recv(aClass)._protocolsDo_((function(each,methods){
  31058. return $core.withContext(function($ctx2) {
  31059. $1=$recv(each)._match_("^\x5c*");
  31060. if(!$core.assert($1)){
  31061. return $recv(map)._at_put_(each,methods);
  31062. }
  31063. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  31064. }));
  31065. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  31066. return $core.withContext(function($ctx2) {
  31067. return $recv(a).__lt_eq(b);
  31068. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  31069. })))._collect_((function(each){
  31070. return $core.withContext(function($ctx2) {
  31071. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  31072. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  31073. }));
  31074. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  31075. },
  31076. args: ["aClass"],
  31077. 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) ]",
  31078. referencedClasses: ["Dictionary", "MethodCategory"],
  31079. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  31080. }),
  31081. $globals.ChunkExporter);
  31082. $core.addMethod(
  31083. $core.method({
  31084. selector: "ownCategoriesOfMetaClass:",
  31085. protocol: "accessing",
  31086. fn: function (aClass){
  31087. var self=this,$self=this;
  31088. return $core.withContext(function($ctx1) {
  31089. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  31090. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  31091. },
  31092. args: ["aClass"],
  31093. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  31094. referencedClasses: [],
  31095. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  31096. }),
  31097. $globals.ChunkExporter);
  31098. $core.addMethod(
  31099. $core.method({
  31100. selector: "ownMethodProtocolsOfClass:",
  31101. protocol: "accessing",
  31102. fn: function (aClass){
  31103. var self=this,$self=this;
  31104. return $core.withContext(function($ctx1) {
  31105. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  31106. return $core.withContext(function($ctx2) {
  31107. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  31108. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31109. }));
  31110. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  31111. },
  31112. args: ["aClass"],
  31113. 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 ]",
  31114. referencedClasses: ["ExportMethodProtocol"],
  31115. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  31116. }),
  31117. $globals.ChunkExporter);
  31118. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  31119. $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.).";
  31120. $core.addMethod(
  31121. $core.method({
  31122. selector: "exportBehavior:on:",
  31123. protocol: "output",
  31124. fn: function (aBehavior,aStream){
  31125. var self=this,$self=this;
  31126. return $core.withContext(function($ctx1) {
  31127. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  31128. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  31129. return $core.withContext(function($ctx2) {
  31130. return $self._exportMethod_on_(method,aStream);
  31131. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  31132. }));
  31133. return self;
  31134. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  31135. },
  31136. args: ["aBehavior", "aStream"],
  31137. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  31138. referencedClasses: [],
  31139. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  31140. }),
  31141. $globals.Exporter);
  31142. $core.addMethod(
  31143. $core.method({
  31144. selector: "exportDefinitionOf:on:",
  31145. protocol: "output",
  31146. fn: function (aClass,aStream){
  31147. var self=this,$self=this;
  31148. return $core.withContext(function($ctx1) {
  31149. var $3,$5,$4,$6,$7,$2,$1,$8,$10,$9,$receiver;
  31150. $recv(aStream)._lf();
  31151. $ctx1.sendIdx["lf"]=1;
  31152. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31153. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31154. $5=$recv(aClass)._superclass();
  31155. if(($receiver = $5) == null || $receiver.a$nil){
  31156. $4="null";
  31157. } else {
  31158. var superclass;
  31159. superclass=$receiver;
  31160. $4=$recv(superclass)._asJavaScriptSource();
  31161. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31162. }
  31163. $6=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  31164. $ctx1.sendIdx["asJavaScriptSource"]=3;
  31165. $7=$recv($recv(aClass)._category())._asJavaScriptSource();
  31166. $ctx1.sendIdx["asJavaScriptSource"]=4;
  31167. $2=["$core.addClass(",$3,", ",$4,", ",$6,", ",$7,");"];
  31168. $1=$recv(aStream)._write_($2);
  31169. $ctx1.sendIdx["write:"]=1;
  31170. $8=$recv(aClass)._comment();
  31171. $ctx1.sendIdx["comment"]=1;
  31172. $recv($8)._ifNotEmpty_((function(){
  31173. return $core.withContext(function($ctx2) {
  31174. $recv(aStream)._lf();
  31175. $ctx2.sendIdx["lf"]=2;
  31176. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31177. $ctx2.sendIdx["write:"]=2;
  31178. $recv(aStream)._lf();
  31179. $ctx2.sendIdx["lf"]=3;
  31180. $10=$recv(aClass)._asJavaScriptSource();
  31181. $ctx2.sendIdx["asJavaScriptSource"]=5;
  31182. $9=[$10,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31183. $recv(aStream)._write_($9);
  31184. $ctx2.sendIdx["write:"]=3;
  31185. $recv(aStream)._lf();
  31186. $ctx2.sendIdx["lf"]=4;
  31187. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  31189. }));
  31190. $recv(aStream)._lf();
  31191. return self;
  31192. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31193. },
  31194. args: ["aClass", "aStream"],
  31195. 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",
  31196. referencedClasses: [],
  31197. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31198. }),
  31199. $globals.Exporter);
  31200. $core.addMethod(
  31201. $core.method({
  31202. selector: "exportMetaDefinitionOf:on:",
  31203. protocol: "output",
  31204. fn: function (aClass,aStream){
  31205. var self=this,$self=this;
  31206. return $core.withContext(function($ctx1) {
  31207. var $2,$1,$4,$3;
  31208. $recv(aStream)._lf();
  31209. $ctx1.sendIdx["lf"]=1;
  31210. $2=$recv(aClass)._theMetaClass();
  31211. $ctx1.sendIdx["theMetaClass"]=1;
  31212. $1=$recv($2)._instanceVariableNames();
  31213. $recv($1)._ifNotEmpty_((function(classIvars){
  31214. return $core.withContext(function($ctx2) {
  31215. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  31216. $ctx2.sendIdx["asJavaScriptSource"]=1;
  31217. $3=["$core.setSlots(",$4,", ",$recv(classIvars)._asJavaScriptSource(),");"];
  31218. $recv(aStream)._write_($3);
  31219. return $recv(aStream)._lf();
  31220. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  31221. }));
  31222. return self;
  31223. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31224. },
  31225. args: ["aClass", "aStream"],
  31226. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass theMetaClass instanceVariableNames ifNotEmpty: [ :classIvars | aStream\x0a\x09\x09write: { '$core.setSlots('. aClass theMetaClass asJavaScriptSource. ', '. classIvars asJavaScriptSource. ');' };\x0a\x09\x09lf ]",
  31227. referencedClasses: [],
  31228. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  31229. }),
  31230. $globals.Exporter);
  31231. $core.addMethod(
  31232. $core.method({
  31233. selector: "exportMethod:on:",
  31234. protocol: "output",
  31235. fn: function (aMethod,aStream){
  31236. var self=this,$self=this;
  31237. return $core.withContext(function($ctx1) {
  31238. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  31239. $recv(aStream)._write_("$core.addMethod(");
  31240. $ctx1.sendIdx["write:"]=1;
  31241. $recv(aStream)._lf();
  31242. $ctx1.sendIdx["lf"]=1;
  31243. $recv(aStream)._write_("$core.method({");
  31244. $ctx1.sendIdx["write:"]=2;
  31245. $recv(aStream)._lf();
  31246. $ctx1.sendIdx["lf"]=2;
  31247. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  31248. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31249. $1=["selector: ",$2,","];
  31250. $recv(aStream)._write_($1);
  31251. $ctx1.sendIdx["write:"]=3;
  31252. $recv(aStream)._lf();
  31253. $ctx1.sendIdx["lf"]=3;
  31254. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  31255. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31256. $3=["protocol: ",$4,","];
  31257. $recv(aStream)._write_($3);
  31258. $ctx1.sendIdx["write:"]=4;
  31259. $recv(aStream)._lf();
  31260. $ctx1.sendIdx["lf"]=4;
  31261. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  31262. $ctx1.sendIdx["write:"]=5;
  31263. $recv(aStream)._lf();
  31264. $ctx1.sendIdx["lf"]=5;
  31265. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31266. $ctx1.sendIdx["write:"]=6;
  31267. $recv(aStream)._lf();
  31268. $ctx1.sendIdx["lf"]=6;
  31269. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  31270. $ctx1.sendIdx["asJavaScriptSource"]=3;
  31271. $5=["args: ",$6,","];
  31272. $recv(aStream)._write_($5);
  31273. $ctx1.sendIdx["write:"]=7;
  31274. $recv(aStream)._lf();
  31275. $ctx1.sendIdx["lf"]=7;
  31276. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  31277. $ctx1.sendIdx["asJavaScriptSource"]=4;
  31278. $7=["source: ",$8,","];
  31279. $recv(aStream)._write_($7);
  31280. $ctx1.sendIdx["write:"]=8;
  31281. $recv(aStream)._lf();
  31282. $ctx1.sendIdx["lf"]=8;
  31283. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  31284. $ctx1.sendIdx["asJavaScriptSource"]=5;
  31285. $9=["referencedClasses: ",$10,","];
  31286. $recv(aStream)._write_($9);
  31287. $ctx1.sendIdx["write:"]=9;
  31288. $recv(aStream)._lf();
  31289. $ctx1.sendIdx["lf"]=9;
  31290. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31291. $ctx1.sendIdx["write:"]=10;
  31292. $recv(aStream)._lf();
  31293. $ctx1.sendIdx["lf"]=10;
  31294. $12=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  31295. $ctx1.sendIdx["asJavaScriptSource"]=6;
  31296. $11=["messageSends: ",$12];
  31297. $recv(aStream)._write_($11);
  31298. $ctx1.sendIdx["write:"]=11;
  31299. $recv(aStream)._lf();
  31300. $ctx1.sendIdx["lf"]=11;
  31301. $recv(aStream)._write_("}),");
  31302. $ctx1.sendIdx["write:"]=12;
  31303. $recv(aStream)._lf();
  31304. $ctx1.sendIdx["lf"]=12;
  31305. $recv(aStream)._write_([$recv($recv(aMethod)._methodClass())._asJavaScriptSource(),");"]);
  31306. $recv(aStream)._lf();
  31307. $ctx1.sendIdx["lf"]=13;
  31308. $recv(aStream)._lf();
  31309. return self;
  31310. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  31311. },
  31312. args: ["aMethod", "aStream"],
  31313. 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",
  31314. referencedClasses: [],
  31315. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "methodClass"]
  31316. }),
  31317. $globals.Exporter);
  31318. $core.addMethod(
  31319. $core.method({
  31320. selector: "exportPackage:on:",
  31321. protocol: "output",
  31322. fn: function (aPackage,aStream){
  31323. var self=this,$self=this;
  31324. return $core.withContext(function($ctx1) {
  31325. var $1,$receiver;
  31326. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  31327. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  31328. $self._exportPackageContextOf_on_(aPackage,aStream);
  31329. $self._exportPackageImportsOf_on_(aPackage,aStream);
  31330. $self._exportPackageTransportOf_on_(aPackage,aStream);
  31331. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  31332. return $core.withContext(function($ctx2) {
  31333. $self._exportBehavior_on_(each,aStream);
  31334. $ctx2.sendIdx["exportBehavior:on:"]=1;
  31335. $1=$recv(each)._theMetaClass();
  31336. if(($receiver = $1) == null || $receiver.a$nil){
  31337. return $1;
  31338. } else {
  31339. var meta;
  31340. meta=$receiver;
  31341. return $self._exportBehavior_on_(meta,aStream);
  31342. }
  31343. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31344. }));
  31345. $ctx1.sendIdx["do:"]=1;
  31346. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  31347. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  31348. return $core.withContext(function($ctx2) {
  31349. return $self._exportMethod_on_(each,aStream);
  31350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  31351. }));
  31352. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  31353. return self;
  31354. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31355. },
  31356. args: ["aPackage", "aStream"],
  31357. 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",
  31358. referencedClasses: [],
  31359. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  31360. }),
  31361. $globals.Exporter);
  31362. $core.addMethod(
  31363. $core.method({
  31364. selector: "exportPackageBodyBlockPrologueOf:on:",
  31365. protocol: "output",
  31366. fn: function (aPackage,aStream){
  31367. var self=this,$self=this;
  31368. return $core.withContext(function($ctx1) {
  31369. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  31370. $recv(aStream)._lf();
  31371. return self;
  31372. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31373. },
  31374. args: ["aPackage", "aStream"],
  31375. source: "exportPackageBodyBlockPrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;'; lf",
  31376. referencedClasses: [],
  31377. messageSends: ["write:", "lf"]
  31378. }),
  31379. $globals.Exporter);
  31380. $core.addMethod(
  31381. $core.method({
  31382. selector: "exportPackageContextOf:on:",
  31383. protocol: "output",
  31384. fn: function (aPackage,aStream){
  31385. var self=this,$self=this;
  31386. return $core.withContext(function($ctx1) {
  31387. $recv(aStream)._write_("$pkg.innerEval = function (expr) { return eval(expr); };");
  31388. $recv(aStream)._lf();
  31389. return self;
  31390. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31391. },
  31392. args: ["aPackage", "aStream"],
  31393. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '$pkg.innerEval = function (expr) { return eval(expr); };';\x0a\x09\x09lf",
  31394. referencedClasses: [],
  31395. messageSends: ["write:", "lf"]
  31396. }),
  31397. $globals.Exporter);
  31398. $core.addMethod(
  31399. $core.method({
  31400. selector: "exportPackageDefinitionOf:on:",
  31401. protocol: "output",
  31402. fn: function (aPackage,aStream){
  31403. var self=this,$self=this;
  31404. return $core.withContext(function($ctx1) {
  31405. $recv(aStream)._write_(["var $pkg = $core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  31406. $recv(aStream)._lf();
  31407. return self;
  31408. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31409. },
  31410. args: ["aPackage", "aStream"],
  31411. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { 'var $pkg = $core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  31412. referencedClasses: [],
  31413. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31414. }),
  31415. $globals.Exporter);
  31416. $core.addMethod(
  31417. $core.method({
  31418. selector: "exportPackageEpilogueOf:on:",
  31419. protocol: "output",
  31420. fn: function (aPackage,aStream){
  31421. var self=this,$self=this;
  31422. return $core.withContext(function($ctx1) {
  31423. $self._subclassResponsibility();
  31424. return self;
  31425. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31426. },
  31427. args: ["aPackage", "aStream"],
  31428. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31429. referencedClasses: [],
  31430. messageSends: ["subclassResponsibility"]
  31431. }),
  31432. $globals.Exporter);
  31433. $core.addMethod(
  31434. $core.method({
  31435. selector: "exportPackageImportsOf:on:",
  31436. protocol: "output",
  31437. fn: function (aPackage,aStream){
  31438. var self=this,$self=this;
  31439. return $core.withContext(function($ctx1) {
  31440. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  31441. return $core.withContext(function($ctx2) {
  31442. $recv(aStream)._write_(["$pkg.imports = ",$recv(imports)._asJavaScriptSource(),";"]);
  31443. return $recv(aStream)._lf();
  31444. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  31445. }));
  31446. return self;
  31447. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31448. },
  31449. args: ["aPackage", "aStream"],
  31450. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09write: { '$pkg.imports = '. imports asJavaScriptSource. ';' };\x0a\x09\x09\x09lf ]",
  31451. referencedClasses: [],
  31452. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "lf"]
  31453. }),
  31454. $globals.Exporter);
  31455. $core.addMethod(
  31456. $core.method({
  31457. selector: "exportPackagePrologueOf:on:",
  31458. protocol: "output",
  31459. fn: function (aPackage,aStream){
  31460. var self=this,$self=this;
  31461. return $core.withContext(function($ctx1) {
  31462. $self._subclassResponsibility();
  31463. return self;
  31464. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31465. },
  31466. args: ["aPackage", "aStream"],
  31467. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31468. referencedClasses: [],
  31469. messageSends: ["subclassResponsibility"]
  31470. }),
  31471. $globals.Exporter);
  31472. $core.addMethod(
  31473. $core.method({
  31474. selector: "exportPackageTraitCompositionsOf:on:",
  31475. protocol: "output",
  31476. fn: function (aPackage,aStream){
  31477. var self=this,$self=this;
  31478. return $core.withContext(function($ctx1) {
  31479. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  31480. return $core.withContext(function($ctx2) {
  31481. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  31482. return $core.withContext(function($ctx3) {
  31483. return $self._exportTraitComposition_of_on_(value,key,aStream);
  31484. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  31485. }));
  31486. return $recv(aStream)._lf();
  31487. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  31488. }));
  31489. return self;
  31490. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31491. },
  31492. args: ["aPackage", "aStream"],
  31493. 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 ]",
  31494. referencedClasses: [],
  31495. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  31496. }),
  31497. $globals.Exporter);
  31498. $core.addMethod(
  31499. $core.method({
  31500. selector: "exportPackageTransportOf:on:",
  31501. protocol: "output",
  31502. fn: function (aPackage,aStream){
  31503. var self=this,$self=this;
  31504. return $core.withContext(function($ctx1) {
  31505. $recv(aStream)._write_(["$pkg.transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  31506. $recv(aStream)._lf();
  31507. return self;
  31508. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31509. },
  31510. args: ["aPackage", "aStream"],
  31511. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$pkg.transport = '. aPackage transport asJSONString. ';' };\x0a\x09\x09lf",
  31512. referencedClasses: [],
  31513. messageSends: ["write:", "asJSONString", "transport", "lf"]
  31514. }),
  31515. $globals.Exporter);
  31516. $core.addMethod(
  31517. $core.method({
  31518. selector: "exportTraitComposition:of:on:",
  31519. protocol: "output",
  31520. fn: function (aTraitComposition,aBehavior,aStream){
  31521. var self=this,$self=this;
  31522. return $core.withContext(function($ctx1) {
  31523. var $2,$1;
  31524. $2=$recv(aTraitComposition)._asJavaScriptSource();
  31525. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31526. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  31527. $recv(aStream)._write_($1);
  31528. $recv(aStream)._lf();
  31529. return self;
  31530. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  31531. },
  31532. args: ["aTraitComposition", "aBehavior", "aStream"],
  31533. 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",
  31534. referencedClasses: [],
  31535. messageSends: ["write:", "asJavaScriptSource", "lf"]
  31536. }),
  31537. $globals.Exporter);
  31538. $core.addMethod(
  31539. $core.method({
  31540. selector: "exportTraitDefinitionOf:on:",
  31541. protocol: "output",
  31542. fn: function (aClass,aStream){
  31543. var self=this,$self=this;
  31544. return $core.withContext(function($ctx1) {
  31545. var $3,$4,$2,$1,$5,$7,$6;
  31546. $recv(aStream)._lf();
  31547. $ctx1.sendIdx["lf"]=1;
  31548. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31549. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31550. $4=$recv($recv(aClass)._category())._asJavaScriptSource();
  31551. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31552. $2=["$core.addTrait(",$3,", ",$4,");"];
  31553. $1=$recv(aStream)._write_($2);
  31554. $ctx1.sendIdx["write:"]=1;
  31555. $5=$recv(aClass)._comment();
  31556. $ctx1.sendIdx["comment"]=1;
  31557. $recv($5)._ifNotEmpty_((function(){
  31558. return $core.withContext(function($ctx2) {
  31559. $recv(aStream)._lf();
  31560. $ctx2.sendIdx["lf"]=2;
  31561. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31562. $ctx2.sendIdx["write:"]=2;
  31563. $recv(aStream)._lf();
  31564. $ctx2.sendIdx["lf"]=3;
  31565. $7=$recv(aClass)._asJavaScriptSource();
  31566. $ctx2.sendIdx["asJavaScriptSource"]=3;
  31567. $6=[$7,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31568. $recv(aStream)._write_($6);
  31569. $ctx2.sendIdx["write:"]=3;
  31570. $recv(aStream)._lf();
  31571. $ctx2.sendIdx["lf"]=4;
  31572. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31573. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31574. }));
  31575. $recv(aStream)._lf();
  31576. return self;
  31577. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31578. },
  31579. args: ["aClass", "aStream"],
  31580. 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",
  31581. referencedClasses: [],
  31582. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31583. }),
  31584. $globals.Exporter);
  31585. $core.addMethod(
  31586. $core.method({
  31587. selector: "ownMethodsOfClass:",
  31588. protocol: "accessing",
  31589. fn: function (aClass){
  31590. var self=this,$self=this;
  31591. return $core.withContext(function($ctx1) {
  31592. var $1;
  31593. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  31594. return $core.withContext(function($ctx2) {
  31595. $1=$recv(a)._selector();
  31596. $ctx2.sendIdx["selector"]=1;
  31597. return $recv($1).__lt_eq($recv(b)._selector());
  31598. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31599. })))._reject_((function(each){
  31600. return $core.withContext(function($ctx2) {
  31601. return $recv($recv(each)._protocol())._match_("^\x5c*");
  31602. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31603. }));
  31604. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  31605. },
  31606. args: ["aClass"],
  31607. 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*') ]",
  31608. referencedClasses: [],
  31609. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  31610. }),
  31611. $globals.Exporter);
  31612. $core.addMethod(
  31613. $core.method({
  31614. selector: "ownMethodsOfMetaClass:",
  31615. protocol: "accessing",
  31616. fn: function (aClass){
  31617. var self=this,$self=this;
  31618. return $core.withContext(function($ctx1) {
  31619. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  31620. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  31621. },
  31622. args: ["aClass"],
  31623. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  31624. referencedClasses: [],
  31625. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  31626. }),
  31627. $globals.Exporter);
  31628. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  31629. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  31630. $core.addMethod(
  31631. $core.method({
  31632. selector: "amdNamesOfPackages:",
  31633. protocol: "private",
  31634. fn: function (anArray){
  31635. var self=this,$self=this;
  31636. return $core.withContext(function($ctx1) {
  31637. var $1;
  31638. return $recv($recv(anArray)._select_((function(each){
  31639. return $core.withContext(function($ctx2) {
  31640. $1=$self._amdNamespaceOfPackage_(each);
  31641. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  31642. return $recv($1)._notNil();
  31643. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31644. })))._collect_((function(each){
  31645. return $core.withContext(function($ctx2) {
  31646. return $recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  31647. $ctx2.sendIdx[","]=1;
  31648. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31649. }));
  31650. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  31651. },
  31652. args: ["anArray"],
  31653. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  31654. referencedClasses: [],
  31655. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  31656. }),
  31657. $globals.AmdExporter);
  31658. $core.addMethod(
  31659. $core.method({
  31660. selector: "amdNamespaceOfPackage:",
  31661. protocol: "private",
  31662. fn: function (aPackage){
  31663. var self=this,$self=this;
  31664. return $core.withContext(function($ctx1) {
  31665. var $3,$2,$1;
  31666. $3=$recv(aPackage)._transport();
  31667. $ctx1.sendIdx["transport"]=1;
  31668. $2=$recv($3)._type();
  31669. $1=$recv($2).__eq("amd");
  31670. if($core.assert($1)){
  31671. return $recv($recv(aPackage)._transport())._namespace();
  31672. } else {
  31673. return nil;
  31674. }
  31675. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  31676. },
  31677. args: ["aPackage"],
  31678. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  31679. referencedClasses: [],
  31680. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  31681. }),
  31682. $globals.AmdExporter);
  31683. $core.addMethod(
  31684. $core.method({
  31685. selector: "exportPackageEpilogueOf:on:",
  31686. protocol: "output",
  31687. fn: function (aPackage,aStream){
  31688. var self=this,$self=this;
  31689. return $core.withContext(function($ctx1) {
  31690. $recv(aStream)._write_("});");
  31691. $recv(aStream)._lf();
  31692. return self;
  31693. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  31694. },
  31695. args: ["aPackage", "aStream"],
  31696. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  31697. referencedClasses: [],
  31698. messageSends: ["write:", "lf"]
  31699. }),
  31700. $globals.AmdExporter);
  31701. $core.addMethod(
  31702. $core.method({
  31703. selector: "exportPackageImportsOf:on:",
  31704. protocol: "output",
  31705. fn: function (aPackage,aStream){
  31706. var self=this,$self=this;
  31707. var importsForOutput,pragmaStart,pragmaEnd;
  31708. return $core.withContext(function($ctx1) {
  31709. var $1,$2,$4,$3,$5,$7,$11,$10,$12,$9,$8,$13,$6;
  31710. $1=$recv($globals.String)._lf();
  31711. $ctx1.sendIdx["lf"]=1;
  31712. pragmaStart="//>>excludeStart(\x22imports\x22, pragmas.excludeImports);".__comma($1);
  31713. $ctx1.sendIdx[","]=1;
  31714. $2=$recv($globals.String)._lf();
  31715. $ctx1.sendIdx["lf"]=2;
  31716. pragmaEnd="//>>excludeEnd(\x22imports\x22);".__comma($2);
  31717. $ctx1.sendIdx[","]=2;
  31718. (
  31719. $ctx1.supercall = true,
  31720. ($globals.AmdExporter.superclass||$boot.nilAsClass).fn.prototype._exportPackageImportsOf_on_.apply($self, [aPackage,aStream]));
  31721. $ctx1.supercall = false;
  31722. importsForOutput=$self._importsForOutput_(aPackage);
  31723. $recv($recv(importsForOutput)._value())._ifNotEmpty_((function(imports){
  31724. var vars;
  31725. return $core.withContext(function($ctx2) {
  31726. $recv(aStream)._write_(pragmaStart);
  31727. $ctx2.sendIdx["write:"]=1;
  31728. vars=$recv(importsForOutput)._key();
  31729. $recv(vars)._ifNotEmpty_((function(){
  31730. return $core.withContext(function($ctx3) {
  31731. $4=","._join_(vars);
  31732. $ctx3.sendIdx["join:"]=1;
  31733. $3=["var ",$4,";"];
  31734. $recv(aStream)._write_($3);
  31735. $ctx3.sendIdx["write:"]=2;
  31736. $5=$recv(aStream)._lf();
  31737. $ctx3.sendIdx["lf"]=3;
  31738. return $5;
  31739. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31740. }));
  31741. $7=$recv(imports)._asJavaScriptSource();
  31742. $11=$recv(vars)._size();
  31743. $ctx2.sendIdx["size"]=1;
  31744. $10=(1)._to_($11);
  31745. $ctx2.sendIdx["to:"]=1;
  31746. $9=$recv($10)._collect_((function(each){
  31747. return $core.withContext(function($ctx3) {
  31748. $12=$recv(each)._asString();
  31749. $ctx3.sendIdx["asString"]=1;
  31750. return "$".__comma($12);
  31751. $ctx3.sendIdx[","]=3;
  31752. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  31753. }));
  31754. $ctx2.sendIdx["collect:"]=1;
  31755. $8=","._join_($9);
  31756. $6=["$pkg.isReady = new Promise(function (resolve, reject) { requirejs(",$7,", function (",$8,") {",$recv((1)._to_($recv(vars)._size()))._collect_((function(each){
  31757. return $core.withContext(function($ctx3) {
  31758. $13=$recv($recv($recv(vars)._at_(each)).__comma("=$")).__comma($recv(each)._asString());
  31759. $ctx3.sendIdx[","]=5;
  31760. return $recv($13).__comma("; ");
  31761. $ctx3.sendIdx[","]=4;
  31762. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  31763. })),"resolve();}, reject); });"];
  31764. $recv(aStream)._write_($6);
  31765. $ctx2.sendIdx["write:"]=3;
  31766. $recv(aStream)._lf();
  31767. return $recv(aStream)._write_(pragmaEnd);
  31768. }, function($ctx2) {$ctx2.fillBlock({imports:imports,vars:vars},$ctx1,1)});
  31769. }));
  31770. $ctx1.sendIdx["ifNotEmpty:"]=1;
  31771. return self;
  31772. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  31773. },
  31774. args: ["aPackage", "aStream"],
  31775. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09| importsForOutput pragmaStart pragmaEnd |\x0a\x09pragmaStart := '//>>excludeStart(\x22imports\x22, pragmas.excludeImports);', String lf.\x0a\x09pragmaEnd := '//>>excludeEnd(\x22imports\x22);', String lf.\x0a\x09super exportPackageImportsOf: aPackage on: aStream.\x0a\x09importsForOutput := self importsForOutput: aPackage.\x0a\x09importsForOutput value ifNotEmpty: [ :imports |\x0a\x09\x09| vars |\x0a\x09\x09aStream write: pragmaStart.\x0a\x09\x09vars := importsForOutput key.\x0a\x09\x09vars ifNotEmpty: [ aStream write: { 'var '. ',' join: vars. ';' }; lf ]. \x0a\x09\x09aStream\x0a\x09\x09\x09write: {\x0a\x09\x09\x09\x09'$pkg.isReady = new Promise(function (resolve, reject) { requirejs('.\x0a\x09\x09\x09\x09imports asJavaScriptSource.\x0a\x09\x09\x09\x09', function ('.\x0a\x09\x09\x09\x09',' join: ((1 to: vars size) collect: [ :each | '$', each asString ]).\x0a\x09\x09\x09\x09') {'.\x0a\x09\x09\x09\x09(1 to: vars size) collect: [ :each | (vars at: each), '=$', each asString, '; ' ].\x0a\x09\x09\x09\x09'resolve();}, reject); });' };\x0a\x09\x09\x09lf;\x0a\x09\x09\x09write: pragmaEnd ]",
  31776. referencedClasses: ["String"],
  31777. messageSends: [",", "lf", "exportPackageImportsOf:on:", "importsForOutput:", "ifNotEmpty:", "value", "write:", "key", "join:", "asJavaScriptSource", "collect:", "to:", "size", "asString", "at:"]
  31778. }),
  31779. $globals.AmdExporter);
  31780. $core.addMethod(
  31781. $core.method({
  31782. selector: "exportPackagePrologueOf:on:",
  31783. protocol: "output",
  31784. fn: function (aPackage,aStream){
  31785. var self=this,$self=this;
  31786. var loadDependencies,pragmaStart,pragmaEnd;
  31787. return $core.withContext(function($ctx1) {
  31788. var $1,$2;
  31789. $1=$recv($globals.String)._lf();
  31790. $ctx1.sendIdx["lf"]=1;
  31791. pragmaStart="//>>excludeStart(\x22imports\x22, pragmas.excludeImports);".__comma($1);
  31792. $ctx1.sendIdx[","]=1;
  31793. $2=$recv($globals.String)._lf();
  31794. $ctx1.sendIdx["lf"]=2;
  31795. pragmaEnd="//>>excludeEnd(\x22imports\x22);".__comma($2);
  31796. $ctx1.sendIdx[","]=2;
  31797. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  31798. $recv(aStream)._write_(["define(",$recv(["amber/boot", "require"].__comma($recv($recv(loadDependencies)._asArray())._sorted()))._asJavaScriptSource(),", function($boot,requirejs){\x22use strict\x22;"]);
  31799. $recv(aStream)._lf();
  31800. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  31801. return self;
  31802. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  31803. },
  31804. args: ["aPackage", "aStream"],
  31805. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09| loadDependencies pragmaStart pragmaEnd |\x0a\x09pragmaStart := '//>>excludeStart(\x22imports\x22, pragmas.excludeImports);', String lf.\x0a\x09pragmaEnd := '//>>excludeEnd(\x22imports\x22);', String lf.\x0a\x09loadDependencies := self amdNamesOfPackages: aPackage loadDependencies.\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'define('.\x0a\x09\x09\x09(#('amber/boot' 'require'), loadDependencies asArray sorted) asJavaScriptSource.\x0a\x09\x09\x09', function($boot,requirejs){\x22use strict\x22;' };\x0a\x09\x09lf.\x0a\x09self exportPackageBodyBlockPrologueOf: aPackage on: aStream",
  31806. referencedClasses: ["String"],
  31807. messageSends: [",", "lf", "amdNamesOfPackages:", "loadDependencies", "write:", "asJavaScriptSource", "sorted", "asArray", "exportPackageBodyBlockPrologueOf:on:"]
  31808. }),
  31809. $globals.AmdExporter);
  31810. $core.addMethod(
  31811. $core.method({
  31812. selector: "importsForOutput:",
  31813. protocol: "private",
  31814. fn: function (aPackage){
  31815. var self=this,$self=this;
  31816. var namedImports,anonImports,importVarNames;
  31817. return $core.withContext(function($ctx1) {
  31818. var $1;
  31819. namedImports=[];
  31820. anonImports=[];
  31821. importVarNames=[];
  31822. $recv($recv(aPackage)._imports())._do_((function(each){
  31823. return $core.withContext(function($ctx2) {
  31824. $1=$recv(each)._isString();
  31825. if($core.assert($1)){
  31826. return $recv(anonImports)._add_(each);
  31827. $ctx2.sendIdx["add:"]=1;
  31828. } else {
  31829. $recv(namedImports)._add_($recv(each)._value());
  31830. $ctx2.sendIdx["add:"]=2;
  31831. return $recv(importVarNames)._add_($recv(each)._key());
  31832. }
  31833. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31834. }));
  31835. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  31836. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  31837. },
  31838. args: ["aPackage"],
  31839. 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)",
  31840. referencedClasses: [],
  31841. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  31842. }),
  31843. $globals.AmdExporter);
  31844. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  31845. $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";
  31846. $core.addMethod(
  31847. $core.method({
  31848. selector: "last",
  31849. protocol: "accessing",
  31850. fn: function (){
  31851. var self=this,$self=this;
  31852. return $self.last;
  31853. },
  31854. args: [],
  31855. source: "last\x0a\x09^ last",
  31856. referencedClasses: [],
  31857. messageSends: []
  31858. }),
  31859. $globals.ChunkParser);
  31860. $core.addMethod(
  31861. $core.method({
  31862. selector: "nextChunk",
  31863. protocol: "reading",
  31864. fn: function (){
  31865. var self=this,$self=this;
  31866. var char,result,chunk;
  31867. return $core.withContext(function($ctx1) {
  31868. var $1,$2,$3,$4;
  31869. var $early={};
  31870. try {
  31871. result=""._writeStream();
  31872. $recv((function(){
  31873. return $core.withContext(function($ctx2) {
  31874. char=$recv($self.stream)._next();
  31875. $ctx2.sendIdx["next"]=1;
  31876. return $recv(char)._notNil();
  31877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31878. }))._whileTrue_((function(){
  31879. return $core.withContext(function($ctx2) {
  31880. $1=$recv(char).__eq("!");
  31881. $ctx2.sendIdx["="]=1;
  31882. if($core.assert($1)){
  31883. $2=$recv($recv($self.stream)._peek()).__eq("!");
  31884. if($core.assert($2)){
  31885. $recv($self.stream)._next();
  31886. } else {
  31887. $self.last=$recv($recv(result)._contents())._trimBoth();
  31888. $3=$self.last;
  31889. throw $early=[$3];
  31890. }
  31891. }
  31892. return $recv(result)._nextPut_(char);
  31893. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31894. }));
  31895. $self.last=nil;
  31896. $4=$self.last;
  31897. return $4;
  31898. }
  31899. catch(e) {if(e===$early)return e[0]; throw e}
  31900. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  31901. },
  31902. args: [],
  31903. 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",
  31904. referencedClasses: [],
  31905. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  31906. }),
  31907. $globals.ChunkParser);
  31908. $core.addMethod(
  31909. $core.method({
  31910. selector: "stream:",
  31911. protocol: "accessing",
  31912. fn: function (aStream){
  31913. var self=this,$self=this;
  31914. $self.stream=aStream;
  31915. return self;
  31916. },
  31917. args: ["aStream"],
  31918. source: "stream: aStream\x0a\x09stream := aStream",
  31919. referencedClasses: [],
  31920. messageSends: []
  31921. }),
  31922. $globals.ChunkParser);
  31923. $core.addMethod(
  31924. $core.method({
  31925. selector: "on:",
  31926. protocol: "instance creation",
  31927. fn: function (aStream){
  31928. var self=this,$self=this;
  31929. return $core.withContext(function($ctx1) {
  31930. return $recv($self._new())._stream_(aStream);
  31931. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.a$cls)});
  31932. },
  31933. args: ["aStream"],
  31934. source: "on: aStream\x0a\x09^ self new stream: aStream",
  31935. referencedClasses: [],
  31936. messageSends: ["stream:", "new"]
  31937. }),
  31938. $globals.ChunkParser.a$cls);
  31939. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  31940. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  31941. $core.addMethod(
  31942. $core.method({
  31943. selector: "class:",
  31944. protocol: "accessing",
  31945. fn: function (aClass){
  31946. var self=this,$self=this;
  31947. $self.class=aClass;
  31948. return self;
  31949. },
  31950. args: ["aClass"],
  31951. source: "class: aClass\x0a\x09class := aClass",
  31952. referencedClasses: [],
  31953. messageSends: []
  31954. }),
  31955. $globals.ClassCommentReader);
  31956. $core.addMethod(
  31957. $core.method({
  31958. selector: "initialize",
  31959. protocol: "initialization",
  31960. fn: function (){
  31961. var self=this,$self=this;
  31962. return $core.withContext(function($ctx1) {
  31963. (
  31964. $ctx1.supercall = true,
  31965. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31966. $ctx1.supercall = false;
  31967. return self;
  31968. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  31969. },
  31970. args: [],
  31971. source: "initialize\x0a\x09super initialize.",
  31972. referencedClasses: [],
  31973. messageSends: ["initialize"]
  31974. }),
  31975. $globals.ClassCommentReader);
  31976. $core.addMethod(
  31977. $core.method({
  31978. selector: "scanFrom:",
  31979. protocol: "fileIn",
  31980. fn: function (aChunkParser){
  31981. var self=this,$self=this;
  31982. var chunk;
  31983. return $core.withContext(function($ctx1) {
  31984. chunk=$recv(aChunkParser)._nextChunk();
  31985. $recv(chunk)._ifNotEmpty_((function(){
  31986. return $core.withContext(function($ctx2) {
  31987. return $self._setComment_(chunk);
  31988. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31989. }));
  31990. return self;
  31991. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  31992. },
  31993. args: ["aChunkParser"],
  31994. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  31995. referencedClasses: [],
  31996. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  31997. }),
  31998. $globals.ClassCommentReader);
  31999. $core.addMethod(
  32000. $core.method({
  32001. selector: "setComment:",
  32002. protocol: "private",
  32003. fn: function (aString){
  32004. var self=this,$self=this;
  32005. return $core.withContext(function($ctx1) {
  32006. $recv($self.class)._comment_(aString);
  32007. return self;
  32008. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  32009. },
  32010. args: ["aString"],
  32011. source: "setComment: aString\x0a\x09class comment: aString",
  32012. referencedClasses: [],
  32013. messageSends: ["comment:"]
  32014. }),
  32015. $globals.ClassCommentReader);
  32016. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  32017. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  32018. $core.addMethod(
  32019. $core.method({
  32020. selector: "class:category:",
  32021. protocol: "accessing",
  32022. fn: function (aClass,aString){
  32023. var self=this,$self=this;
  32024. $self.class=aClass;
  32025. $self.category=aString;
  32026. return self;
  32027. },
  32028. args: ["aClass", "aString"],
  32029. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  32030. referencedClasses: [],
  32031. messageSends: []
  32032. }),
  32033. $globals.ClassProtocolReader);
  32034. $core.addMethod(
  32035. $core.method({
  32036. selector: "compileMethod:",
  32037. protocol: "private",
  32038. fn: function (aString){
  32039. var self=this,$self=this;
  32040. return $core.withContext(function($ctx1) {
  32041. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self.class,$self.category);
  32042. return self;
  32043. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  32044. },
  32045. args: ["aString"],
  32046. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  32047. referencedClasses: ["Compiler"],
  32048. messageSends: ["install:forClass:protocol:", "new"]
  32049. }),
  32050. $globals.ClassProtocolReader);
  32051. $core.addMethod(
  32052. $core.method({
  32053. selector: "initialize",
  32054. protocol: "initialization",
  32055. fn: function (){
  32056. var self=this,$self=this;
  32057. return $core.withContext(function($ctx1) {
  32058. (
  32059. $ctx1.supercall = true,
  32060. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  32061. $ctx1.supercall = false;
  32062. return self;
  32063. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  32064. },
  32065. args: [],
  32066. source: "initialize\x0a\x09super initialize.",
  32067. referencedClasses: [],
  32068. messageSends: ["initialize"]
  32069. }),
  32070. $globals.ClassProtocolReader);
  32071. $core.addMethod(
  32072. $core.method({
  32073. selector: "scanFrom:",
  32074. protocol: "fileIn",
  32075. fn: function (aChunkParser){
  32076. var self=this,$self=this;
  32077. var chunk;
  32078. return $core.withContext(function($ctx1) {
  32079. $recv((function(){
  32080. return $core.withContext(function($ctx2) {
  32081. chunk=$recv(aChunkParser)._nextChunk();
  32082. return $recv(chunk)._isEmpty();
  32083. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32084. }))._whileFalse_((function(){
  32085. return $core.withContext(function($ctx2) {
  32086. return $self._compileMethod_(chunk);
  32087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  32088. }));
  32089. return self;
  32090. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  32091. },
  32092. args: ["aChunkParser"],
  32093. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  32094. referencedClasses: [],
  32095. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  32096. }),
  32097. $globals.ClassProtocolReader);
  32098. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  32099. $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.";
  32100. $core.addMethod(
  32101. $core.method({
  32102. selector: "methods",
  32103. protocol: "accessing",
  32104. fn: function (){
  32105. var self=this,$self=this;
  32106. return $core.withContext(function($ctx1) {
  32107. var $1;
  32108. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  32109. return $core.withContext(function($ctx2) {
  32110. $1=$recv(a)._selector();
  32111. $ctx2.sendIdx["selector"]=1;
  32112. return $recv($1).__lt_eq($recv(b)._selector());
  32113. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  32114. }));
  32115. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  32116. },
  32117. args: [],
  32118. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  32119. referencedClasses: [],
  32120. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  32121. }),
  32122. $globals.ExportMethodProtocol);
  32123. $core.addMethod(
  32124. $core.method({
  32125. selector: "name",
  32126. protocol: "accessing",
  32127. fn: function (){
  32128. var self=this,$self=this;
  32129. return $self.name;
  32130. },
  32131. args: [],
  32132. source: "name\x0a\x09^ name",
  32133. referencedClasses: [],
  32134. messageSends: []
  32135. }),
  32136. $globals.ExportMethodProtocol);
  32137. $core.addMethod(
  32138. $core.method({
  32139. selector: "name:",
  32140. protocol: "accessing",
  32141. fn: function (aString){
  32142. var self=this,$self=this;
  32143. $self.name=aString;
  32144. return self;
  32145. },
  32146. args: ["aString"],
  32147. source: "name: aString\x0a\x09name := aString",
  32148. referencedClasses: [],
  32149. messageSends: []
  32150. }),
  32151. $globals.ExportMethodProtocol);
  32152. $core.addMethod(
  32153. $core.method({
  32154. selector: "ownMethods",
  32155. protocol: "accessing",
  32156. fn: function (){
  32157. var self=this,$self=this;
  32158. return $core.withContext(function($ctx1) {
  32159. var $1;
  32160. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  32161. return $core.withContext(function($ctx2) {
  32162. $1=$recv(a)._selector();
  32163. $ctx2.sendIdx["selector"]=1;
  32164. return $recv($1).__lt_eq($recv(b)._selector());
  32165. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  32166. }));
  32167. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.ExportMethodProtocol)});
  32168. },
  32169. args: [],
  32170. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  32171. referencedClasses: [],
  32172. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  32173. }),
  32174. $globals.ExportMethodProtocol);
  32175. $core.addMethod(
  32176. $core.method({
  32177. selector: "theClass",
  32178. protocol: "accessing",
  32179. fn: function (){
  32180. var self=this,$self=this;
  32181. return $self.theClass;
  32182. },
  32183. args: [],
  32184. source: "theClass\x0a\x09^ theClass",
  32185. referencedClasses: [],
  32186. messageSends: []
  32187. }),
  32188. $globals.ExportMethodProtocol);
  32189. $core.addMethod(
  32190. $core.method({
  32191. selector: "theClass:",
  32192. protocol: "accessing",
  32193. fn: function (aClass){
  32194. var self=this,$self=this;
  32195. $self.theClass=aClass;
  32196. return self;
  32197. },
  32198. args: ["aClass"],
  32199. source: "theClass: aClass\x0a\x09theClass := aClass",
  32200. referencedClasses: [],
  32201. messageSends: []
  32202. }),
  32203. $globals.ExportMethodProtocol);
  32204. $core.addMethod(
  32205. $core.method({
  32206. selector: "name:theClass:",
  32207. protocol: "instance creation",
  32208. fn: function (aString,aClass){
  32209. var self=this,$self=this;
  32210. return $core.withContext(function($ctx1) {
  32211. var $1;
  32212. $1=$self._new();
  32213. $recv($1)._name_(aString);
  32214. $recv($1)._theClass_(aClass);
  32215. return $recv($1)._yourself();
  32216. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.a$cls)});
  32217. },
  32218. args: ["aString", "aClass"],
  32219. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  32220. referencedClasses: [],
  32221. messageSends: ["name:", "new", "theClass:", "yourself"]
  32222. }),
  32223. $globals.ExportMethodProtocol.a$cls);
  32224. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  32225. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  32226. $core.addMethod(
  32227. $core.method({
  32228. selector: "import:",
  32229. protocol: "fileIn",
  32230. fn: function (aStream){
  32231. var self=this,$self=this;
  32232. var chunk,result,parser,lastEmpty;
  32233. return $core.withContext(function($ctx1) {
  32234. var $1;
  32235. parser=$recv($globals.ChunkParser)._on_(aStream);
  32236. lastEmpty=false;
  32237. $self.lastSection="n/a, not started";
  32238. $self.lastChunk=nil;
  32239. $recv((function(){
  32240. return $core.withContext(function($ctx2) {
  32241. $recv((function(){
  32242. return $core.withContext(function($ctx3) {
  32243. chunk=$recv(parser)._nextChunk();
  32244. return $recv(chunk)._isNil();
  32245. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32246. }))._whileFalse_((function(){
  32247. return $core.withContext(function($ctx3) {
  32248. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  32249. lastEmpty=true;
  32250. return lastEmpty;
  32251. }),(function(){
  32252. return $core.withContext(function($ctx4) {
  32253. $self.lastSection=chunk;
  32254. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  32255. $1=lastEmpty;
  32256. if($core.assert($1)){
  32257. lastEmpty=false;
  32258. return $recv(result)._scanFrom_(parser);
  32259. }
  32260. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  32261. }));
  32262. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32263. }));
  32264. $self.lastSection="n/a, finished";
  32265. return $self.lastSection;
  32266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32267. }))._on_do_($globals.Error,(function(e){
  32268. return $core.withContext(function($ctx2) {
  32269. $self.lastChunk=$recv(parser)._last();
  32270. return $recv(e)._pass();
  32271. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  32272. }));
  32273. return self;
  32274. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  32275. },
  32276. args: ["aStream"],
  32277. 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 pass ].",
  32278. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  32279. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "pass"]
  32280. }),
  32281. $globals.Importer);
  32282. $core.addMethod(
  32283. $core.method({
  32284. selector: "lastChunk",
  32285. protocol: "accessing",
  32286. fn: function (){
  32287. var self=this,$self=this;
  32288. return $self.lastChunk;
  32289. },
  32290. args: [],
  32291. source: "lastChunk\x0a\x09^ lastChunk",
  32292. referencedClasses: [],
  32293. messageSends: []
  32294. }),
  32295. $globals.Importer);
  32296. $core.addMethod(
  32297. $core.method({
  32298. selector: "lastSection",
  32299. protocol: "accessing",
  32300. fn: function (){
  32301. var self=this,$self=this;
  32302. return $self.lastSection;
  32303. },
  32304. args: [],
  32305. source: "lastSection\x0a\x09^ lastSection",
  32306. referencedClasses: [],
  32307. messageSends: []
  32308. }),
  32309. $globals.Importer);
  32310. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  32311. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  32312. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  32313. $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.";
  32314. $core.addMethod(
  32315. $core.method({
  32316. selector: "ajaxPutAt:data:onSuccess:onError:",
  32317. protocol: "private",
  32318. fn: function (aURL,aString,aBlock,anotherBlock){
  32319. var self=this,$self=this;
  32320. var xhr;
  32321. return $core.withContext(function($ctx1) {
  32322. var $1,$4,$3,$2;
  32323. xhr=$recv($globals.Platform)._newXhr();
  32324. $recv(xhr)._open_url_async_("PUT",aURL,true);
  32325. $recv(xhr)._onreadystatechange_((function(){
  32326. return $core.withContext(function($ctx2) {
  32327. $1=$recv($recv(xhr)._readyState()).__eq((4));
  32328. if($core.assert($1)){
  32329. $4=$recv(xhr)._status();
  32330. $ctx2.sendIdx["status"]=1;
  32331. $3=$recv($4).__gt_eq((200));
  32332. $2=$recv($3)._and_((function(){
  32333. return $core.withContext(function($ctx3) {
  32334. return $recv($recv(xhr)._status()).__lt((300));
  32335. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32336. }));
  32337. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  32338. }
  32339. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32340. }));
  32341. $recv(xhr)._send_(aString);
  32342. return self;
  32343. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  32344. },
  32345. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  32346. 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",
  32347. referencedClasses: ["Platform"],
  32348. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  32349. }),
  32350. $globals.PackageHandler);
  32351. $core.addMethod(
  32352. $core.method({
  32353. selector: "chunkContentsFor:",
  32354. protocol: "accessing",
  32355. fn: function (aPackage){
  32356. var self=this,$self=this;
  32357. return $core.withContext(function($ctx1) {
  32358. return $recv($globals.String)._streamContents_((function(str){
  32359. return $core.withContext(function($ctx2) {
  32360. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  32361. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32362. }));
  32363. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32364. },
  32365. args: ["aPackage"],
  32366. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  32367. referencedClasses: ["String"],
  32368. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  32369. }),
  32370. $globals.PackageHandler);
  32371. $core.addMethod(
  32372. $core.method({
  32373. selector: "chunkExporter",
  32374. protocol: "factory",
  32375. fn: function (){
  32376. var self=this,$self=this;
  32377. return $core.withContext(function($ctx1) {
  32378. return $recv($self._chunkExporterClass())._new();
  32379. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  32380. },
  32381. args: [],
  32382. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  32383. referencedClasses: [],
  32384. messageSends: ["new", "chunkExporterClass"]
  32385. }),
  32386. $globals.PackageHandler);
  32387. $core.addMethod(
  32388. $core.method({
  32389. selector: "chunkExporterClass",
  32390. protocol: "accessing",
  32391. fn: function (){
  32392. var self=this,$self=this;
  32393. return $globals.ChunkExporter;
  32394. },
  32395. args: [],
  32396. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  32397. referencedClasses: ["ChunkExporter"],
  32398. messageSends: []
  32399. }),
  32400. $globals.PackageHandler);
  32401. $core.addMethod(
  32402. $core.method({
  32403. selector: "commit:",
  32404. protocol: "committing",
  32405. fn: function (aPackage){
  32406. var self=this,$self=this;
  32407. return $core.withContext(function($ctx1) {
  32408. var $1,$2;
  32409. $self._commit_onSuccess_onError_(aPackage,(function(){
  32410. }),(function(error){
  32411. return $core.withContext(function($ctx2) {
  32412. $1=$recv($globals.PackageCommitError)._new();
  32413. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  32414. $ctx2.sendIdx[","]=1;
  32415. $recv($1)._messageText_($2);
  32416. return $recv($1)._signal();
  32417. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  32418. }));
  32419. return self;
  32420. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  32421. },
  32422. args: ["aPackage"],
  32423. 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 ]",
  32424. referencedClasses: ["PackageCommitError"],
  32425. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  32426. }),
  32427. $globals.PackageHandler);
  32428. $core.addMethod(
  32429. $core.method({
  32430. selector: "commit:onSuccess:onError:",
  32431. protocol: "committing",
  32432. fn: function (aPackage,aBlock,anotherBlock){
  32433. var self=this,$self=this;
  32434. return $core.withContext(function($ctx1) {
  32435. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  32436. return $core.withContext(function($ctx2) {
  32437. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  32438. return $core.withContext(function($ctx3) {
  32439. $recv(aPackage)._beClean();
  32440. return $recv(aBlock)._value();
  32441. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32442. }),anotherBlock);
  32443. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32444. }),anotherBlock);
  32445. return self;
  32446. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32447. },
  32448. args: ["aPackage", "aBlock", "anotherBlock"],
  32449. 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",
  32450. referencedClasses: [],
  32451. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  32452. }),
  32453. $globals.PackageHandler);
  32454. $core.addMethod(
  32455. $core.method({
  32456. selector: "commitJsFileFor:onSuccess:onError:",
  32457. protocol: "committing",
  32458. fn: function (aPackage,aBlock,anotherBlock){
  32459. var self=this,$self=this;
  32460. return $core.withContext(function($ctx1) {
  32461. var $2,$1;
  32462. $2=$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32463. $ctx1.sendIdx[","]=2;
  32464. $1=$recv($2).__comma(".js");
  32465. $ctx1.sendIdx[","]=1;
  32466. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._contentsFor_(aPackage),aBlock,anotherBlock);
  32467. return self;
  32468. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32469. },
  32470. args: ["aPackage", "aBlock", "anotherBlock"],
  32471. 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",
  32472. referencedClasses: [],
  32473. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  32474. }),
  32475. $globals.PackageHandler);
  32476. $core.addMethod(
  32477. $core.method({
  32478. selector: "commitPathJsFor:",
  32479. protocol: "accessing",
  32480. fn: function (aPackage){
  32481. var self=this,$self=this;
  32482. return $core.withContext(function($ctx1) {
  32483. $self._subclassResponsibility();
  32484. return self;
  32485. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32486. },
  32487. args: ["aPackage"],
  32488. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  32489. referencedClasses: [],
  32490. messageSends: ["subclassResponsibility"]
  32491. }),
  32492. $globals.PackageHandler);
  32493. $core.addMethod(
  32494. $core.method({
  32495. selector: "commitPathStFor:",
  32496. protocol: "accessing",
  32497. fn: function (aPackage){
  32498. var self=this,$self=this;
  32499. return $core.withContext(function($ctx1) {
  32500. $self._subclassResponsibility();
  32501. return self;
  32502. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32503. },
  32504. args: ["aPackage"],
  32505. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  32506. referencedClasses: [],
  32507. messageSends: ["subclassResponsibility"]
  32508. }),
  32509. $globals.PackageHandler);
  32510. $core.addMethod(
  32511. $core.method({
  32512. selector: "commitStFileFor:onSuccess:onError:",
  32513. protocol: "committing",
  32514. fn: function (aPackage,aBlock,anotherBlock){
  32515. var self=this,$self=this;
  32516. return $core.withContext(function($ctx1) {
  32517. var $2,$1;
  32518. $2=$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32519. $ctx1.sendIdx[","]=2;
  32520. $1=$recv($2).__comma(".st");
  32521. $ctx1.sendIdx[","]=1;
  32522. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  32523. return self;
  32524. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32525. },
  32526. args: ["aPackage", "aBlock", "anotherBlock"],
  32527. 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",
  32528. referencedClasses: [],
  32529. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  32530. }),
  32531. $globals.PackageHandler);
  32532. $core.addMethod(
  32533. $core.method({
  32534. selector: "contentsFor:",
  32535. protocol: "accessing",
  32536. fn: function (aPackage){
  32537. var self=this,$self=this;
  32538. return $core.withContext(function($ctx1) {
  32539. return $recv($globals.String)._streamContents_((function(str){
  32540. return $core.withContext(function($ctx2) {
  32541. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  32542. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32543. }));
  32544. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32545. },
  32546. args: ["aPackage"],
  32547. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  32548. referencedClasses: ["String"],
  32549. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  32550. }),
  32551. $globals.PackageHandler);
  32552. $core.addMethod(
  32553. $core.method({
  32554. selector: "exporter",
  32555. protocol: "factory",
  32556. fn: function (){
  32557. var self=this,$self=this;
  32558. return $core.withContext(function($ctx1) {
  32559. return $recv($self._exporterClass())._new();
  32560. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  32561. },
  32562. args: [],
  32563. source: "exporter\x0a\x09^ self exporterClass new",
  32564. referencedClasses: [],
  32565. messageSends: ["new", "exporterClass"]
  32566. }),
  32567. $globals.PackageHandler);
  32568. $core.addMethod(
  32569. $core.method({
  32570. selector: "exporterClass",
  32571. protocol: "accessing",
  32572. fn: function (){
  32573. var self=this,$self=this;
  32574. return $core.withContext(function($ctx1) {
  32575. $self._subclassResponsibility();
  32576. return self;
  32577. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  32578. },
  32579. args: [],
  32580. source: "exporterClass\x0a\x09self subclassResponsibility",
  32581. referencedClasses: [],
  32582. messageSends: ["subclassResponsibility"]
  32583. }),
  32584. $globals.PackageHandler);
  32585. $core.addMethod(
  32586. $core.method({
  32587. selector: "load:",
  32588. protocol: "loading",
  32589. fn: function (aPackage){
  32590. var self=this,$self=this;
  32591. return $core.withContext(function($ctx1) {
  32592. $self._subclassResponsibility();
  32593. return self;
  32594. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  32595. },
  32596. args: ["aPackage"],
  32597. source: "load: aPackage\x0a\x09\x22Should return a TThenable\x22\x0a\x09self subclassResponsibility",
  32598. referencedClasses: [],
  32599. messageSends: ["subclassResponsibility"]
  32600. }),
  32601. $globals.PackageHandler);
  32602. $core.addMethod(
  32603. $core.method({
  32604. selector: "onCommitError:",
  32605. protocol: "error handling",
  32606. fn: function (anError){
  32607. var self=this,$self=this;
  32608. return $core.withContext(function($ctx1) {
  32609. var $1,$2;
  32610. $1=$recv($globals.PackageCommitError)._new();
  32611. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  32612. $ctx1.sendIdx[","]=1;
  32613. $recv($1)._messageText_($2);
  32614. $recv($1)._signal();
  32615. return self;
  32616. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  32617. },
  32618. args: ["anError"],
  32619. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  32620. referencedClasses: ["PackageCommitError"],
  32621. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  32622. }),
  32623. $globals.PackageHandler);
  32624. $core.addMethod(
  32625. $core.method({
  32626. selector: "setPath:forPackage:",
  32627. protocol: "accessing",
  32628. fn: function (aString,aPackage){
  32629. var self=this,$self=this;
  32630. return $core.withContext(function($ctx1) {
  32631. $self._subclassResponsibility();
  32632. return self;
  32633. }, function($ctx1) {$ctx1.fill(self,"setPath:forPackage:",{aString:aString,aPackage:aPackage},$globals.PackageHandler)});
  32634. },
  32635. args: ["aString", "aPackage"],
  32636. source: "setPath: aString forPackage: aPackage\x0a\x09self subclassResponsibility",
  32637. referencedClasses: [],
  32638. messageSends: ["subclassResponsibility"]
  32639. }),
  32640. $globals.PackageHandler);
  32641. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  32642. $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.";
  32643. $core.addMethod(
  32644. $core.method({
  32645. selector: "commitPathJsFor:",
  32646. protocol: "accessing",
  32647. fn: function (aPackage){
  32648. var self=this,$self=this;
  32649. return $core.withContext(function($ctx1) {
  32650. return $self._toUrl_($self._namespaceFor_(aPackage));
  32651. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32652. },
  32653. args: ["aPackage"],
  32654. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  32655. referencedClasses: [],
  32656. messageSends: ["toUrl:", "namespaceFor:"]
  32657. }),
  32658. $globals.AmdPackageHandler);
  32659. $core.addMethod(
  32660. $core.method({
  32661. selector: "commitPathStFor:",
  32662. protocol: "accessing",
  32663. fn: function (aPackage){
  32664. var self=this,$self=this;
  32665. var path,pathWithout;
  32666. return $core.withContext(function($ctx1) {
  32667. var $1,$2;
  32668. $1=$recv($self._namespaceFor_(aPackage)).__comma("/_source");
  32669. $ctx1.sendIdx[","]=1;
  32670. path=$self._toUrl_($1);
  32671. pathWithout=$self._commitPathJsFor_(aPackage);
  32672. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  32673. if($core.assert($2)){
  32674. return pathWithout;
  32675. } else {
  32676. return path;
  32677. }
  32678. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  32679. },
  32680. args: ["aPackage"],
  32681. 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 ]",
  32682. referencedClasses: [],
  32683. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  32684. }),
  32685. $globals.AmdPackageHandler);
  32686. $core.addMethod(
  32687. $core.method({
  32688. selector: "exporterClass",
  32689. protocol: "accessing",
  32690. fn: function (){
  32691. var self=this,$self=this;
  32692. return $globals.AmdExporter;
  32693. },
  32694. args: [],
  32695. source: "exporterClass\x0a\x09^ AmdExporter",
  32696. referencedClasses: ["AmdExporter"],
  32697. messageSends: []
  32698. }),
  32699. $globals.AmdPackageHandler);
  32700. $core.addMethod(
  32701. $core.method({
  32702. selector: "load:",
  32703. protocol: "loading",
  32704. fn: function (aPackage){
  32705. var self=this,$self=this;
  32706. return $core.withContext(function($ctx1) {
  32707. var $1,$3,$2,$receiver;
  32708. return $recv($globals.Promise)._new_((function(model){
  32709. return $core.withContext(function($ctx2) {
  32710. $1=$recv($globals.Smalltalk)._amdRequire();
  32711. if(($receiver = $1) == null || $receiver.a$nil){
  32712. return $self._error_("AMD loader not present");
  32713. } else {
  32714. var require;
  32715. require=$receiver;
  32716. $3=$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32717. $ctx2.sendIdx[","]=1;
  32718. $2=[$3];
  32719. return $recv(require)._value_value_value_($2,(function(result){
  32720. return $core.withContext(function($ctx3) {
  32721. return $recv(model)._value_(result);
  32722. }, function($ctx3) {$ctx3.fillBlock({result:result},$ctx2,4)});
  32723. }),(function(error){
  32724. return $core.withContext(function($ctx3) {
  32725. return $recv(model)._signal_(error);
  32726. }, function($ctx3) {$ctx3.fillBlock({error:error},$ctx2,5)});
  32727. }));
  32728. }
  32729. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)});
  32730. }));
  32731. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32732. },
  32733. args: ["aPackage"],
  32734. source: "load: aPackage\x0a\x09^ Promise new: [ :model |\x0a\x09\x09Smalltalk amdRequire\x0a\x09\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09\x09require\x0a\x09\x09\x09\x09\x09value: { (self namespaceFor: aPackage), '/', aPackage name }\x0a\x09\x09\x09\x09\x09value: [ :result | model value: result ]\x0a\x09\x09\x09\x09\x09value: [ :error | model signal: error ] ] ]",
  32735. referencedClasses: ["Promise", "Smalltalk"],
  32736. messageSends: ["new:", "ifNil:ifNotNil:", "amdRequire", "error:", "value:value:value:", ",", "namespaceFor:", "name", "value:", "signal:"]
  32737. }),
  32738. $globals.AmdPackageHandler);
  32739. $core.addMethod(
  32740. $core.method({
  32741. selector: "namespaceFor:",
  32742. protocol: "committing",
  32743. fn: function (aPackage){
  32744. var self=this,$self=this;
  32745. return $core.withContext(function($ctx1) {
  32746. return $recv($recv(aPackage)._transport())._namespace();
  32747. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32748. },
  32749. args: ["aPackage"],
  32750. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  32751. referencedClasses: [],
  32752. messageSends: ["namespace", "transport"]
  32753. }),
  32754. $globals.AmdPackageHandler);
  32755. $core.addMethod(
  32756. $core.method({
  32757. selector: "setPath:forPackage:",
  32758. protocol: "accessing",
  32759. fn: function (aString,aPackage){
  32760. var self=this,$self=this;
  32761. return $core.withContext(function($ctx1) {
  32762. $recv($recv(require)._provided())._config_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespaceFor_(aPackage),aString])]));
  32763. return self;
  32764. }, function($ctx1) {$ctx1.fill(self,"setPath:forPackage:",{aString:aString,aPackage:aPackage},$globals.AmdPackageHandler)});
  32765. },
  32766. args: ["aString", "aPackage"],
  32767. source: "setPath: aString forPackage: aPackage\x0a\x09\x22Set the path the the package's `namespace`\x22\x0a\x09\x0a\x09\x22Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x22\x0a\x09\x09\x09require provided config: #{\x0a\x09\x09\x09\x09'paths' -> #{\x0a\x09\x09\x09\x09\x09(self namespaceFor: aPackage) -> aString\x0a\x09\x09\x09\x09}\x0a\x09\x09\x09}\x0a\x09\x09\x22]\x22",
  32768. referencedClasses: [],
  32769. messageSends: ["config:", "provided", "namespaceFor:"]
  32770. }),
  32771. $globals.AmdPackageHandler);
  32772. $core.addMethod(
  32773. $core.method({
  32774. selector: "toUrl:",
  32775. protocol: "private",
  32776. fn: function (aString){
  32777. var self=this,$self=this;
  32778. return $core.withContext(function($ctx1) {
  32779. var $1,$receiver;
  32780. $1=$recv($globals.Smalltalk)._amdRequire();
  32781. if(($receiver = $1) == null || $receiver.a$nil){
  32782. return $self._error_("AMD loader not present");
  32783. } else {
  32784. var require;
  32785. require=$receiver;
  32786. return $recv($recv(require)._provided())._toUrl_(aString);
  32787. }
  32788. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  32789. },
  32790. args: ["aString"],
  32791. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | require provided toUrl: aString ]",
  32792. referencedClasses: ["Smalltalk"],
  32793. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "toUrl:", "provided"]
  32794. }),
  32795. $globals.AmdPackageHandler);
  32796. $core.addMethod(
  32797. $core.method({
  32798. selector: "defaultNamespace",
  32799. protocol: "commit paths",
  32800. fn: function (){
  32801. var self=this,$self=this;
  32802. return $core.withContext(function($ctx1) {
  32803. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32804. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.a$cls)});
  32805. },
  32806. args: [],
  32807. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32808. referencedClasses: ["Smalltalk"],
  32809. messageSends: ["defaultAmdNamespace"]
  32810. }),
  32811. $globals.AmdPackageHandler.a$cls);
  32812. $core.addMethod(
  32813. $core.method({
  32814. selector: "defaultNamespace:",
  32815. protocol: "commit paths",
  32816. fn: function (aString){
  32817. var self=this,$self=this;
  32818. return $core.withContext(function($ctx1) {
  32819. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  32820. return self;
  32821. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.a$cls)});
  32822. },
  32823. args: ["aString"],
  32824. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  32825. referencedClasses: ["Smalltalk"],
  32826. messageSends: ["defaultAmdNamespace:"]
  32827. }),
  32828. $globals.AmdPackageHandler.a$cls);
  32829. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  32830. $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.";
  32831. $core.addMethod(
  32832. $core.method({
  32833. selector: "asJavaScriptObject",
  32834. protocol: "converting",
  32835. fn: function (){
  32836. var self=this,$self=this;
  32837. return $core.withContext(function($ctx1) {
  32838. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  32839. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.PackageTransport)});
  32840. },
  32841. args: [],
  32842. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  32843. referencedClasses: [],
  32844. messageSends: ["type"]
  32845. }),
  32846. $globals.PackageTransport);
  32847. $core.addMethod(
  32848. $core.method({
  32849. selector: "commit",
  32850. protocol: "committing",
  32851. fn: function (){
  32852. var self=this,$self=this;
  32853. return $core.withContext(function($ctx1) {
  32854. $recv($self._commitHandler())._commit_($self._package());
  32855. return self;
  32856. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  32857. },
  32858. args: [],
  32859. source: "commit\x0a\x09self commitHandler commit: self package",
  32860. referencedClasses: [],
  32861. messageSends: ["commit:", "commitHandler", "package"]
  32862. }),
  32863. $globals.PackageTransport);
  32864. $core.addMethod(
  32865. $core.method({
  32866. selector: "commitHandler",
  32867. protocol: "factory",
  32868. fn: function (){
  32869. var self=this,$self=this;
  32870. return $core.withContext(function($ctx1) {
  32871. return $recv($self._commitHandlerClass())._new();
  32872. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  32873. },
  32874. args: [],
  32875. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  32876. referencedClasses: [],
  32877. messageSends: ["new", "commitHandlerClass"]
  32878. }),
  32879. $globals.PackageTransport);
  32880. $core.addMethod(
  32881. $core.method({
  32882. selector: "commitHandlerClass",
  32883. protocol: "accessing",
  32884. fn: function (){
  32885. var self=this,$self=this;
  32886. return $core.withContext(function($ctx1) {
  32887. $self._subclassResponsibility();
  32888. return self;
  32889. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  32890. },
  32891. args: [],
  32892. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  32893. referencedClasses: [],
  32894. messageSends: ["subclassResponsibility"]
  32895. }),
  32896. $globals.PackageTransport);
  32897. $core.addMethod(
  32898. $core.method({
  32899. selector: "commitOnSuccess:onError:",
  32900. protocol: "committing",
  32901. fn: function (aBlock,anotherBlock){
  32902. var self=this,$self=this;
  32903. return $core.withContext(function($ctx1) {
  32904. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  32905. return self;
  32906. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  32907. },
  32908. args: ["aBlock", "anotherBlock"],
  32909. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  32910. referencedClasses: [],
  32911. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  32912. }),
  32913. $globals.PackageTransport);
  32914. $core.addMethod(
  32915. $core.method({
  32916. selector: "definition",
  32917. protocol: "accessing",
  32918. fn: function (){
  32919. var self=this,$self=this;
  32920. return "";
  32921. },
  32922. args: [],
  32923. source: "definition\x0a\x09^ ''",
  32924. referencedClasses: [],
  32925. messageSends: []
  32926. }),
  32927. $globals.PackageTransport);
  32928. $core.addMethod(
  32929. $core.method({
  32930. selector: "load",
  32931. protocol: "loading",
  32932. fn: function (){
  32933. var self=this,$self=this;
  32934. return $core.withContext(function($ctx1) {
  32935. return $recv($recv($self._commitHandler())._load_($self._package()))._then_((function(){
  32936. return $core.withContext(function($ctx2) {
  32937. return $recv($globals.Smalltalk)._postLoad();
  32938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32939. }));
  32940. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  32941. },
  32942. args: [],
  32943. source: "load\x0a\x09^ (self commitHandler load: self package)\x0a\x09\x09then: [ Smalltalk postLoad ]",
  32944. referencedClasses: ["Smalltalk"],
  32945. messageSends: ["then:", "load:", "commitHandler", "package", "postLoad"]
  32946. }),
  32947. $globals.PackageTransport);
  32948. $core.addMethod(
  32949. $core.method({
  32950. selector: "package",
  32951. protocol: "accessing",
  32952. fn: function (){
  32953. var self=this,$self=this;
  32954. return $self.package;
  32955. },
  32956. args: [],
  32957. source: "package\x0a\x09^ package",
  32958. referencedClasses: [],
  32959. messageSends: []
  32960. }),
  32961. $globals.PackageTransport);
  32962. $core.addMethod(
  32963. $core.method({
  32964. selector: "package:",
  32965. protocol: "accessing",
  32966. fn: function (aPackage){
  32967. var self=this,$self=this;
  32968. $self.package=aPackage;
  32969. return self;
  32970. },
  32971. args: ["aPackage"],
  32972. source: "package: aPackage\x0a\x09package := aPackage",
  32973. referencedClasses: [],
  32974. messageSends: []
  32975. }),
  32976. $globals.PackageTransport);
  32977. $core.addMethod(
  32978. $core.method({
  32979. selector: "setPath:",
  32980. protocol: "actions",
  32981. fn: function (aString){
  32982. var self=this,$self=this;
  32983. return $core.withContext(function($ctx1) {
  32984. $recv($self._commitHandler())._setPath_forPackage_(aString,$self.package);
  32985. return self;
  32986. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.PackageTransport)});
  32987. },
  32988. args: ["aString"],
  32989. source: "setPath: aString\x0a\x09\x22Set the commit path for the package\x22\x0a\x0a\x09self commitHandler setPath: aString forPackage: package",
  32990. referencedClasses: [],
  32991. messageSends: ["setPath:forPackage:", "commitHandler"]
  32992. }),
  32993. $globals.PackageTransport);
  32994. $core.addMethod(
  32995. $core.method({
  32996. selector: "setupFromJson:",
  32997. protocol: "initialization",
  32998. fn: function (anObject){
  32999. var self=this,$self=this;
  33000. return self;
  33001. },
  33002. args: ["anObject"],
  33003. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  33004. referencedClasses: [],
  33005. messageSends: []
  33006. }),
  33007. $globals.PackageTransport);
  33008. $core.addMethod(
  33009. $core.method({
  33010. selector: "type",
  33011. protocol: "accessing",
  33012. fn: function (){
  33013. var self=this,$self=this;
  33014. return $core.withContext(function($ctx1) {
  33015. return $recv($self._class())._type();
  33016. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  33017. },
  33018. args: [],
  33019. source: "type\x0a\x09^ self class type",
  33020. referencedClasses: [],
  33021. messageSends: ["type", "class"]
  33022. }),
  33023. $globals.PackageTransport);
  33024. $core.setSlots($globals.PackageTransport.a$cls, ["registry"]);
  33025. $core.addMethod(
  33026. $core.method({
  33027. selector: "classRegisteredFor:",
  33028. protocol: "accessing",
  33029. fn: function (aString){
  33030. var self=this,$self=this;
  33031. return $core.withContext(function($ctx1) {
  33032. return $recv($self.registry)._at_(aString);
  33033. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.a$cls)});
  33034. },
  33035. args: ["aString"],
  33036. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  33037. referencedClasses: [],
  33038. messageSends: ["at:"]
  33039. }),
  33040. $globals.PackageTransport.a$cls);
  33041. $core.addMethod(
  33042. $core.method({
  33043. selector: "defaultType",
  33044. protocol: "accessing",
  33045. fn: function (){
  33046. var self=this,$self=this;
  33047. return $core.withContext(function($ctx1) {
  33048. return $recv($globals.AmdPackageTransport)._type();
  33049. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.a$cls)});
  33050. },
  33051. args: [],
  33052. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  33053. referencedClasses: ["AmdPackageTransport"],
  33054. messageSends: ["type"]
  33055. }),
  33056. $globals.PackageTransport.a$cls);
  33057. $core.addMethod(
  33058. $core.method({
  33059. selector: "for:",
  33060. protocol: "instance creation",
  33061. fn: function (aString){
  33062. var self=this,$self=this;
  33063. return $core.withContext(function($ctx1) {
  33064. return $recv($self._classRegisteredFor_(aString))._new();
  33065. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.a$cls)});
  33066. },
  33067. args: ["aString"],
  33068. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  33069. referencedClasses: [],
  33070. messageSends: ["new", "classRegisteredFor:"]
  33071. }),
  33072. $globals.PackageTransport.a$cls);
  33073. $core.addMethod(
  33074. $core.method({
  33075. selector: "fromJson:",
  33076. protocol: "instance creation",
  33077. fn: function (anObject){
  33078. var self=this,$self=this;
  33079. return $core.withContext(function($ctx1) {
  33080. var $1,$2,$receiver;
  33081. if(($receiver = anObject) == null || $receiver.a$nil){
  33082. $1=$self._for_($self._defaultType());
  33083. $ctx1.sendIdx["for:"]=1;
  33084. return $1;
  33085. } else {
  33086. anObject;
  33087. }
  33088. $2=$self._for_($recv(anObject)._type());
  33089. $recv($2)._setupFromJson_(anObject);
  33090. return $recv($2)._yourself();
  33091. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.a$cls)});
  33092. },
  33093. args: ["anObject"],
  33094. 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",
  33095. referencedClasses: [],
  33096. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  33097. }),
  33098. $globals.PackageTransport.a$cls);
  33099. $core.addMethod(
  33100. $core.method({
  33101. selector: "initialize",
  33102. protocol: "initialization",
  33103. fn: function (){
  33104. var self=this,$self=this;
  33105. return $core.withContext(function($ctx1) {
  33106. var $1;
  33107. (
  33108. $ctx1.supercall = true,
  33109. ($globals.PackageTransport.a$cls.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  33110. $ctx1.supercall = false;
  33111. $1=$self.__eq_eq($globals.PackageTransport);
  33112. if($core.assert($1)){
  33113. $self.registry=$globals.HashedCollection._newFromPairs_([]);
  33114. $self.registry;
  33115. } else {
  33116. $self._register();
  33117. }
  33118. return self;
  33119. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.a$cls)});
  33120. },
  33121. args: [],
  33122. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  33123. referencedClasses: ["PackageTransport"],
  33124. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  33125. }),
  33126. $globals.PackageTransport.a$cls);
  33127. $core.addMethod(
  33128. $core.method({
  33129. selector: "register",
  33130. protocol: "registration",
  33131. fn: function (){
  33132. var self=this,$self=this;
  33133. return $core.withContext(function($ctx1) {
  33134. $recv($globals.PackageTransport)._register_(self);
  33135. return self;
  33136. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.a$cls)});
  33137. },
  33138. args: [],
  33139. source: "register\x0a\x09PackageTransport register: self",
  33140. referencedClasses: ["PackageTransport"],
  33141. messageSends: ["register:"]
  33142. }),
  33143. $globals.PackageTransport.a$cls);
  33144. $core.addMethod(
  33145. $core.method({
  33146. selector: "register:",
  33147. protocol: "registration",
  33148. fn: function (aClass){
  33149. var self=this,$self=this;
  33150. return $core.withContext(function($ctx1) {
  33151. var $1,$receiver;
  33152. $1=$recv(aClass)._type();
  33153. $ctx1.sendIdx["type"]=1;
  33154. if(($receiver = $1) == null || $receiver.a$nil){
  33155. $1;
  33156. } else {
  33157. $recv($self.registry)._at_put_($recv(aClass)._type(),aClass);
  33158. }
  33159. return self;
  33160. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.a$cls)});
  33161. },
  33162. args: ["aClass"],
  33163. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  33164. referencedClasses: [],
  33165. messageSends: ["ifNotNil:", "type", "at:put:"]
  33166. }),
  33167. $globals.PackageTransport.a$cls);
  33168. $core.addMethod(
  33169. $core.method({
  33170. selector: "type",
  33171. protocol: "accessing",
  33172. fn: function (){
  33173. var self=this,$self=this;
  33174. return nil;
  33175. },
  33176. args: [],
  33177. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  33178. referencedClasses: [],
  33179. messageSends: []
  33180. }),
  33181. $globals.PackageTransport.a$cls);
  33182. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  33183. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  33184. $core.addMethod(
  33185. $core.method({
  33186. selector: "asJavaScriptObject",
  33187. protocol: "converting",
  33188. fn: function (){
  33189. var self=this,$self=this;
  33190. return $core.withContext(function($ctx1) {
  33191. var $1;
  33192. $1=(
  33193. $ctx1.supercall = true,
  33194. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($self, []));
  33195. $ctx1.supercall = false;
  33196. $recv($1)._at_put_("amdNamespace",$self._namespace());
  33197. return $recv($1)._yourself();
  33198. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.AmdPackageTransport)});
  33199. },
  33200. args: [],
  33201. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  33202. referencedClasses: [],
  33203. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  33204. }),
  33205. $globals.AmdPackageTransport);
  33206. $core.addMethod(
  33207. $core.method({
  33208. selector: "commitHandlerClass",
  33209. protocol: "accessing",
  33210. fn: function (){
  33211. var self=this,$self=this;
  33212. return $globals.AmdPackageHandler;
  33213. },
  33214. args: [],
  33215. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  33216. referencedClasses: ["AmdPackageHandler"],
  33217. messageSends: []
  33218. }),
  33219. $globals.AmdPackageTransport);
  33220. $core.addMethod(
  33221. $core.method({
  33222. selector: "defaultNamespace",
  33223. protocol: "defaults",
  33224. fn: function (){
  33225. var self=this,$self=this;
  33226. return $core.withContext(function($ctx1) {
  33227. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  33228. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  33229. },
  33230. args: [],
  33231. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  33232. referencedClasses: ["Smalltalk"],
  33233. messageSends: ["defaultAmdNamespace"]
  33234. }),
  33235. $globals.AmdPackageTransport);
  33236. $core.addMethod(
  33237. $core.method({
  33238. selector: "definition",
  33239. protocol: "accessing",
  33240. fn: function (){
  33241. var self=this,$self=this;
  33242. return $core.withContext(function($ctx1) {
  33243. return $recv($globals.String)._streamContents_((function(stream){
  33244. return $core.withContext(function($ctx2) {
  33245. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  33246. return $recv(stream)._print_($self._namespace());
  33247. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  33248. }));
  33249. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  33250. },
  33251. args: [],
  33252. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  33253. referencedClasses: ["String"],
  33254. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  33255. }),
  33256. $globals.AmdPackageTransport);
  33257. $core.addMethod(
  33258. $core.method({
  33259. selector: "namespace",
  33260. protocol: "accessing",
  33261. fn: function (){
  33262. var self=this,$self=this;
  33263. return $core.withContext(function($ctx1) {
  33264. var $1,$receiver;
  33265. $1=$self.namespace;
  33266. if(($receiver = $1) == null || $receiver.a$nil){
  33267. return $self._defaultNamespace();
  33268. } else {
  33269. return $1;
  33270. }
  33271. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  33272. },
  33273. args: [],
  33274. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  33275. referencedClasses: [],
  33276. messageSends: ["ifNil:", "defaultNamespace"]
  33277. }),
  33278. $globals.AmdPackageTransport);
  33279. $core.addMethod(
  33280. $core.method({
  33281. selector: "namespace:",
  33282. protocol: "accessing",
  33283. fn: function (aString){
  33284. var self=this,$self=this;
  33285. $self.namespace=aString;
  33286. return self;
  33287. },
  33288. args: ["aString"],
  33289. source: "namespace: aString\x0a\x09namespace := aString",
  33290. referencedClasses: [],
  33291. messageSends: []
  33292. }),
  33293. $globals.AmdPackageTransport);
  33294. $core.addMethod(
  33295. $core.method({
  33296. selector: "printOn:",
  33297. protocol: "printing",
  33298. fn: function (aStream){
  33299. var self=this,$self=this;
  33300. return $core.withContext(function($ctx1) {
  33301. (
  33302. $ctx1.supercall = true,
  33303. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  33304. $ctx1.supercall = false;
  33305. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  33306. $ctx1.sendIdx["nextPutAll:"]=1;
  33307. $recv(aStream)._nextPutAll_($self._namespace());
  33308. $ctx1.sendIdx["nextPutAll:"]=2;
  33309. $recv(aStream)._nextPutAll_(")");
  33310. return self;
  33311. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  33312. },
  33313. args: ["aStream"],
  33314. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  33315. referencedClasses: [],
  33316. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  33317. }),
  33318. $globals.AmdPackageTransport);
  33319. $core.addMethod(
  33320. $core.method({
  33321. selector: "setupFromJson:",
  33322. protocol: "initialization",
  33323. fn: function (anObject){
  33324. var self=this,$self=this;
  33325. return $core.withContext(function($ctx1) {
  33326. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  33327. return self;
  33328. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  33329. },
  33330. args: ["anObject"],
  33331. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  33332. referencedClasses: [],
  33333. messageSends: ["namespace:", "at:"]
  33334. }),
  33335. $globals.AmdPackageTransport);
  33336. $core.addMethod(
  33337. $core.method({
  33338. selector: "namespace:",
  33339. protocol: "instance creation",
  33340. fn: function (aString){
  33341. var self=this,$self=this;
  33342. return $core.withContext(function($ctx1) {
  33343. var $1;
  33344. $1=$self._new();
  33345. $recv($1)._namespace_(aString);
  33346. return $recv($1)._yourself();
  33347. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.a$cls)});
  33348. },
  33349. args: ["aString"],
  33350. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  33351. referencedClasses: [],
  33352. messageSends: ["namespace:", "new", "yourself"]
  33353. }),
  33354. $globals.AmdPackageTransport.a$cls);
  33355. $core.addMethod(
  33356. $core.method({
  33357. selector: "type",
  33358. protocol: "accessing",
  33359. fn: function (){
  33360. var self=this,$self=this;
  33361. return "amd";
  33362. },
  33363. args: [],
  33364. source: "type\x0a\x09^ 'amd'",
  33365. referencedClasses: [],
  33366. messageSends: []
  33367. }),
  33368. $globals.AmdPackageTransport.a$cls);
  33369. $core.addMethod(
  33370. $core.method({
  33371. selector: "exportBehaviorDefinitionTo:using:",
  33372. protocol: "*Platform-ImportExport",
  33373. fn: function (aStream,anExporter){
  33374. var self=this,$self=this;
  33375. return $core.withContext(function($ctx1) {
  33376. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  33377. return self;
  33378. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Class)});
  33379. },
  33380. args: ["aStream", "anExporter"],
  33381. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  33382. referencedClasses: [],
  33383. messageSends: ["exportDefinitionOf:on:"]
  33384. }),
  33385. $globals.Class);
  33386. $core.addMethod(
  33387. $core.method({
  33388. selector: "exportBehaviorDefinitionTo:using:",
  33389. protocol: "*Platform-ImportExport",
  33390. fn: function (aStream,anExporter){
  33391. var self=this,$self=this;
  33392. return $core.withContext(function($ctx1) {
  33393. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  33394. return self;
  33395. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Metaclass)});
  33396. },
  33397. args: ["aStream", "anExporter"],
  33398. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  33399. referencedClasses: [],
  33400. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  33401. }),
  33402. $globals.Metaclass);
  33403. $core.addMethod(
  33404. $core.method({
  33405. selector: "commit",
  33406. protocol: "*Platform-ImportExport",
  33407. fn: function (){
  33408. var self=this,$self=this;
  33409. return $core.withContext(function($ctx1) {
  33410. return $recv($self._transport())._commit();
  33411. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  33412. },
  33413. args: [],
  33414. source: "commit\x0a\x09^ self transport commit",
  33415. referencedClasses: [],
  33416. messageSends: ["commit", "transport"]
  33417. }),
  33418. $globals.Package);
  33419. $core.addMethod(
  33420. $core.method({
  33421. selector: "load",
  33422. protocol: "*Platform-ImportExport",
  33423. fn: function (){
  33424. var self=this,$self=this;
  33425. return $core.withContext(function($ctx1) {
  33426. return $recv($self._transport())._load();
  33427. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  33428. },
  33429. args: [],
  33430. source: "load\x0a\x09^ self transport load",
  33431. referencedClasses: [],
  33432. messageSends: ["load", "transport"]
  33433. }),
  33434. $globals.Package);
  33435. $core.addMethod(
  33436. $core.method({
  33437. selector: "loadFromNamespace:",
  33438. protocol: "*Platform-ImportExport",
  33439. fn: function (aString){
  33440. var self=this,$self=this;
  33441. return $core.withContext(function($ctx1) {
  33442. var $1;
  33443. $1=$self._transport();
  33444. $recv($1)._namespace_(aString);
  33445. return $recv($1)._load();
  33446. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  33447. },
  33448. args: ["aString"],
  33449. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  33450. referencedClasses: [],
  33451. messageSends: ["namespace:", "transport", "load"]
  33452. }),
  33453. $globals.Package);
  33454. $core.addMethod(
  33455. $core.method({
  33456. selector: "load:",
  33457. protocol: "*Platform-ImportExport",
  33458. fn: function (aPackageName){
  33459. var self=this,$self=this;
  33460. return $core.withContext(function($ctx1) {
  33461. return $recv($self._named_(aPackageName))._load();
  33462. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  33463. },
  33464. args: ["aPackageName"],
  33465. source: "load: aPackageName\x0a\x09^ (self named: aPackageName) load",
  33466. referencedClasses: [],
  33467. messageSends: ["load", "named:"]
  33468. }),
  33469. $globals.Package.a$cls);
  33470. $core.addMethod(
  33471. $core.method({
  33472. selector: "load:fromNamespace:",
  33473. protocol: "*Platform-ImportExport",
  33474. fn: function (aPackageName,aString){
  33475. var self=this,$self=this;
  33476. return $core.withContext(function($ctx1) {
  33477. return $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  33478. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.a$cls)});
  33479. },
  33480. args: ["aPackageName", "aString"],
  33481. source: "load: aPackageName fromNamespace: aString\x0a\x09^ (self named: aPackageName) loadFromNamespace: aString",
  33482. referencedClasses: [],
  33483. messageSends: ["loadFromNamespace:", "named:"]
  33484. }),
  33485. $globals.Package.a$cls);
  33486. $core.addMethod(
  33487. $core.method({
  33488. selector: "methodsFor:",
  33489. protocol: "*Platform-ImportExport",
  33490. fn: function (aString){
  33491. var self=this,$self=this;
  33492. return $core.withContext(function($ctx1) {
  33493. var $1;
  33494. $1=$recv($globals.ClassProtocolReader)._new();
  33495. $recv($1)._class_category_(self,aString);
  33496. return $recv($1)._yourself();
  33497. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.TBehaviorProvider)});
  33498. },
  33499. args: ["aString"],
  33500. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  33501. referencedClasses: ["ClassProtocolReader"],
  33502. messageSends: ["class:category:", "new", "yourself"]
  33503. }),
  33504. $globals.TBehaviorProvider);
  33505. $core.addMethod(
  33506. $core.method({
  33507. selector: "methodsFor:stamp:",
  33508. protocol: "*Platform-ImportExport",
  33509. fn: function (aString,aStamp){
  33510. var self=this,$self=this;
  33511. return $core.withContext(function($ctx1) {
  33512. return $self._methodsFor_(aString);
  33513. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.TBehaviorProvider)});
  33514. },
  33515. args: ["aString", "aStamp"],
  33516. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  33517. referencedClasses: [],
  33518. messageSends: ["methodsFor:"]
  33519. }),
  33520. $globals.TBehaviorProvider);
  33521. $core.addMethod(
  33522. $core.method({
  33523. selector: "commentStamp",
  33524. protocol: "*Platform-ImportExport",
  33525. fn: function (){
  33526. var self=this,$self=this;
  33527. return $core.withContext(function($ctx1) {
  33528. var $1;
  33529. $1=$recv($globals.ClassCommentReader)._new();
  33530. $recv($1)._class_(self);
  33531. return $recv($1)._yourself();
  33532. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.TMasterBehavior)});
  33533. },
  33534. args: [],
  33535. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  33536. referencedClasses: ["ClassCommentReader"],
  33537. messageSends: ["class:", "new", "yourself"]
  33538. }),
  33539. $globals.TMasterBehavior);
  33540. $core.addMethod(
  33541. $core.method({
  33542. selector: "commentStamp:prior:",
  33543. protocol: "*Platform-ImportExport",
  33544. fn: function (aStamp,prior){
  33545. var self=this,$self=this;
  33546. return $core.withContext(function($ctx1) {
  33547. return $self._commentStamp();
  33548. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.TMasterBehavior)});
  33549. },
  33550. args: ["aStamp", "prior"],
  33551. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  33552. referencedClasses: [],
  33553. messageSends: ["commentStamp"]
  33554. }),
  33555. $globals.TMasterBehavior);
  33556. $core.addMethod(
  33557. $core.method({
  33558. selector: "exportBehaviorDefinitionTo:using:",
  33559. protocol: "*Platform-ImportExport",
  33560. fn: function (aStream,anExporter){
  33561. var self=this,$self=this;
  33562. return $core.withContext(function($ctx1) {
  33563. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  33564. return self;
  33565. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Trait)});
  33566. },
  33567. args: ["aStream", "anExporter"],
  33568. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  33569. referencedClasses: [],
  33570. messageSends: ["exportTraitDefinitionOf:on:"]
  33571. }),
  33572. $globals.Trait);
  33573. });
  33574. define('amber/core/Compiler-AST',["amber/boot", "require", "amber/core/Kernel-Dag", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Methods"], function($boot,requirejs){"use strict";
  33575. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33576. var $pkg = $core.addPackage("Compiler-AST");
  33577. $pkg.innerEval = function (expr) { return eval(expr); };
  33578. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  33579. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  33580. $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.";
  33581. $core.addMethod(
  33582. $core.method({
  33583. selector: "inPosition:",
  33584. protocol: "testing",
  33585. fn: function (aPoint){
  33586. var self=this,$self=this;
  33587. return $core.withContext(function($ctx1) {
  33588. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  33589. return $core.withContext(function($ctx2) {
  33590. return $recv($self._positionEnd()).__gt_eq(aPoint);
  33591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33592. }));
  33593. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  33594. },
  33595. args: ["aPoint"],
  33596. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  33597. referencedClasses: [],
  33598. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  33599. }),
  33600. $globals.ASTNode);
  33601. $core.addMethod(
  33602. $core.method({
  33603. selector: "isAssignmentNode",
  33604. protocol: "testing",
  33605. fn: function (){
  33606. var self=this,$self=this;
  33607. return false;
  33608. },
  33609. args: [],
  33610. source: "isAssignmentNode\x0a\x09^ false",
  33611. referencedClasses: [],
  33612. messageSends: []
  33613. }),
  33614. $globals.ASTNode);
  33615. $core.addMethod(
  33616. $core.method({
  33617. selector: "isBlockNode",
  33618. protocol: "testing",
  33619. fn: function (){
  33620. var self=this,$self=this;
  33621. return false;
  33622. },
  33623. args: [],
  33624. source: "isBlockNode\x0a\x09^ false",
  33625. referencedClasses: [],
  33626. messageSends: []
  33627. }),
  33628. $globals.ASTNode);
  33629. $core.addMethod(
  33630. $core.method({
  33631. selector: "isBlockSequenceNode",
  33632. protocol: "testing",
  33633. fn: function (){
  33634. var self=this,$self=this;
  33635. return false;
  33636. },
  33637. args: [],
  33638. source: "isBlockSequenceNode\x0a\x09^ false",
  33639. referencedClasses: [],
  33640. messageSends: []
  33641. }),
  33642. $globals.ASTNode);
  33643. $core.addMethod(
  33644. $core.method({
  33645. selector: "isCascadeNode",
  33646. protocol: "testing",
  33647. fn: function (){
  33648. var self=this,$self=this;
  33649. return false;
  33650. },
  33651. args: [],
  33652. source: "isCascadeNode\x0a\x09^ false",
  33653. referencedClasses: [],
  33654. messageSends: []
  33655. }),
  33656. $globals.ASTNode);
  33657. $core.addMethod(
  33658. $core.method({
  33659. selector: "isImmutable",
  33660. protocol: "testing",
  33661. fn: function (){
  33662. var self=this,$self=this;
  33663. return false;
  33664. },
  33665. args: [],
  33666. source: "isImmutable\x0a\x09^ false",
  33667. referencedClasses: [],
  33668. messageSends: []
  33669. }),
  33670. $globals.ASTNode);
  33671. $core.addMethod(
  33672. $core.method({
  33673. selector: "isJSStatementNode",
  33674. protocol: "testing",
  33675. fn: function (){
  33676. var self=this,$self=this;
  33677. return false;
  33678. },
  33679. args: [],
  33680. source: "isJSStatementNode\x0a\x09^ false",
  33681. referencedClasses: [],
  33682. messageSends: []
  33683. }),
  33684. $globals.ASTNode);
  33685. $core.addMethod(
  33686. $core.method({
  33687. selector: "isNavigationNode",
  33688. protocol: "testing",
  33689. fn: function (){
  33690. var self=this,$self=this;
  33691. return false;
  33692. },
  33693. args: [],
  33694. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  33695. referencedClasses: [],
  33696. messageSends: []
  33697. }),
  33698. $globals.ASTNode);
  33699. $core.addMethod(
  33700. $core.method({
  33701. selector: "isReturnNode",
  33702. protocol: "testing",
  33703. fn: function (){
  33704. var self=this,$self=this;
  33705. return false;
  33706. },
  33707. args: [],
  33708. source: "isReturnNode\x0a\x09^ false",
  33709. referencedClasses: [],
  33710. messageSends: []
  33711. }),
  33712. $globals.ASTNode);
  33713. $core.addMethod(
  33714. $core.method({
  33715. selector: "isSendNode",
  33716. protocol: "testing",
  33717. fn: function (){
  33718. var self=this,$self=this;
  33719. return false;
  33720. },
  33721. args: [],
  33722. source: "isSendNode\x0a\x09^ false",
  33723. referencedClasses: [],
  33724. messageSends: []
  33725. }),
  33726. $globals.ASTNode);
  33727. $core.addMethod(
  33728. $core.method({
  33729. selector: "isSequenceNode",
  33730. protocol: "testing",
  33731. fn: function (){
  33732. var self=this,$self=this;
  33733. return false;
  33734. },
  33735. args: [],
  33736. source: "isSequenceNode\x0a\x09^ false",
  33737. referencedClasses: [],
  33738. messageSends: []
  33739. }),
  33740. $globals.ASTNode);
  33741. $core.addMethod(
  33742. $core.method({
  33743. selector: "isSuperKeyword",
  33744. protocol: "testing",
  33745. fn: function (){
  33746. var self=this,$self=this;
  33747. return false;
  33748. },
  33749. args: [],
  33750. source: "isSuperKeyword\x0a\x09^ false",
  33751. referencedClasses: [],
  33752. messageSends: []
  33753. }),
  33754. $globals.ASTNode);
  33755. $core.addMethod(
  33756. $core.method({
  33757. selector: "isValueNode",
  33758. protocol: "testing",
  33759. fn: function (){
  33760. var self=this,$self=this;
  33761. return false;
  33762. },
  33763. args: [],
  33764. source: "isValueNode\x0a\x09^ false",
  33765. referencedClasses: [],
  33766. messageSends: []
  33767. }),
  33768. $globals.ASTNode);
  33769. $core.addMethod(
  33770. $core.method({
  33771. selector: "isVariableNode",
  33772. protocol: "testing",
  33773. fn: function (){
  33774. var self=this,$self=this;
  33775. return false;
  33776. },
  33777. args: [],
  33778. source: "isVariableNode\x0a\x09^ false",
  33779. referencedClasses: [],
  33780. messageSends: []
  33781. }),
  33782. $globals.ASTNode);
  33783. $core.addMethod(
  33784. $core.method({
  33785. selector: "location:",
  33786. protocol: "accessing",
  33787. fn: function (aLocation){
  33788. var self=this,$self=this;
  33789. return $core.withContext(function($ctx1) {
  33790. var $3,$2,$1;
  33791. $3=$recv(aLocation)._start();
  33792. $ctx1.sendIdx["start"]=1;
  33793. $2=$recv($3)._line();
  33794. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  33795. $self._position_($1);
  33796. return self;
  33797. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  33798. },
  33799. args: ["aLocation"],
  33800. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  33801. referencedClasses: [],
  33802. messageSends: ["position:", "@", "line", "start", "column"]
  33803. }),
  33804. $globals.ASTNode);
  33805. $core.addMethod(
  33806. $core.method({
  33807. selector: "method",
  33808. protocol: "accessing",
  33809. fn: function (){
  33810. var self=this,$self=this;
  33811. return $core.withContext(function($ctx1) {
  33812. var $1,$receiver;
  33813. $1=$self._parent();
  33814. if(($receiver = $1) == null || $receiver.a$nil){
  33815. return $1;
  33816. } else {
  33817. var node;
  33818. node=$receiver;
  33819. return $recv(node)._method();
  33820. }
  33821. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  33822. },
  33823. args: [],
  33824. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  33825. referencedClasses: [],
  33826. messageSends: ["ifNotNil:", "parent", "method"]
  33827. }),
  33828. $globals.ASTNode);
  33829. $core.addMethod(
  33830. $core.method({
  33831. selector: "navigationNodeAt:ifAbsent:",
  33832. protocol: "accessing",
  33833. fn: function (aPoint,aBlock){
  33834. var self=this,$self=this;
  33835. var children;
  33836. return $core.withContext(function($ctx1) {
  33837. var $2,$1;
  33838. var $early={};
  33839. try {
  33840. children=$recv($self._allDagChildren())._select_((function(each){
  33841. return $core.withContext(function($ctx2) {
  33842. return $recv($recv(each)._isNavigationNode())._and_((function(){
  33843. return $core.withContext(function($ctx3) {
  33844. return $recv(each)._inPosition_(aPoint);
  33845. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33846. }));
  33847. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33848. }));
  33849. $recv(children)._ifEmpty_((function(){
  33850. return $core.withContext(function($ctx2) {
  33851. throw $early=[$recv(aBlock)._value()];
  33852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  33853. }));
  33854. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  33855. return $core.withContext(function($ctx2) {
  33856. $2=$recv(a)._positionStart();
  33857. $ctx2.sendIdx["positionStart"]=1;
  33858. $1=$recv($2)._dist_(aPoint);
  33859. $ctx2.sendIdx["dist:"]=1;
  33860. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  33861. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  33862. })))._first();
  33863. }
  33864. catch(e) {if(e===$early)return e[0]; throw e}
  33865. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  33866. },
  33867. args: ["aPoint", "aBlock"],
  33868. 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",
  33869. referencedClasses: [],
  33870. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  33871. }),
  33872. $globals.ASTNode);
  33873. $core.addMethod(
  33874. $core.method({
  33875. selector: "parent",
  33876. protocol: "accessing",
  33877. fn: function (){
  33878. var self=this,$self=this;
  33879. return $self.parent;
  33880. },
  33881. args: [],
  33882. source: "parent\x0a\x09^ parent",
  33883. referencedClasses: [],
  33884. messageSends: []
  33885. }),
  33886. $globals.ASTNode);
  33887. $core.addMethod(
  33888. $core.method({
  33889. selector: "parent:",
  33890. protocol: "accessing",
  33891. fn: function (aNode){
  33892. var self=this,$self=this;
  33893. $self.parent=aNode;
  33894. return self;
  33895. },
  33896. args: ["aNode"],
  33897. source: "parent: aNode\x0a\x09parent := aNode",
  33898. referencedClasses: [],
  33899. messageSends: []
  33900. }),
  33901. $globals.ASTNode);
  33902. $core.addMethod(
  33903. $core.method({
  33904. selector: "position",
  33905. protocol: "accessing",
  33906. fn: function (){
  33907. var self=this,$self=this;
  33908. return $core.withContext(function($ctx1) {
  33909. var $1,$2,$receiver;
  33910. $1=$self.position;
  33911. if(($receiver = $1) == null || $receiver.a$nil){
  33912. $2=$self._parent();
  33913. if(($receiver = $2) == null || $receiver.a$nil){
  33914. return $2;
  33915. } else {
  33916. var node;
  33917. node=$receiver;
  33918. return $recv(node)._position();
  33919. }
  33920. } else {
  33921. return $1;
  33922. }
  33923. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  33924. },
  33925. args: [],
  33926. 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 ] ]",
  33927. referencedClasses: [],
  33928. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  33929. }),
  33930. $globals.ASTNode);
  33931. $core.addMethod(
  33932. $core.method({
  33933. selector: "position:",
  33934. protocol: "accessing",
  33935. fn: function (aPosition){
  33936. var self=this,$self=this;
  33937. $self.position=aPosition;
  33938. return self;
  33939. },
  33940. args: ["aPosition"],
  33941. source: "position: aPosition\x0a\x09position := aPosition",
  33942. referencedClasses: [],
  33943. messageSends: []
  33944. }),
  33945. $globals.ASTNode);
  33946. $core.addMethod(
  33947. $core.method({
  33948. selector: "positionEnd",
  33949. protocol: "accessing",
  33950. fn: function (){
  33951. var self=this,$self=this;
  33952. return $core.withContext(function($ctx1) {
  33953. var $1,$6,$5,$4,$3,$2;
  33954. $1=$self._positionStart();
  33955. $6=$self._source();
  33956. $ctx1.sendIdx["source"]=1;
  33957. $5=$recv($6)._lines();
  33958. $ctx1.sendIdx["lines"]=1;
  33959. $4=$recv($5)._size();
  33960. $ctx1.sendIdx["size"]=1;
  33961. $3=$recv($4).__minus((1));
  33962. $ctx1.sendIdx["-"]=1;
  33963. $2=$recv($3).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1)));
  33964. return $recv($1).__plus($2);
  33965. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  33966. },
  33967. args: [],
  33968. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  33969. referencedClasses: [],
  33970. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  33971. }),
  33972. $globals.ASTNode);
  33973. $core.addMethod(
  33974. $core.method({
  33975. selector: "positionStart",
  33976. protocol: "accessing",
  33977. fn: function (){
  33978. var self=this,$self=this;
  33979. return $core.withContext(function($ctx1) {
  33980. return $self._position();
  33981. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  33982. },
  33983. args: [],
  33984. source: "positionStart\x0a\x09^ self position",
  33985. referencedClasses: [],
  33986. messageSends: ["position"]
  33987. }),
  33988. $globals.ASTNode);
  33989. $core.addMethod(
  33990. $core.method({
  33991. selector: "requiresSmalltalkContext",
  33992. protocol: "testing",
  33993. fn: function (){
  33994. var self=this,$self=this;
  33995. return $core.withContext(function($ctx1) {
  33996. return $recv($recv($self._dagChildren())._detect_ifNone_((function(each){
  33997. return $core.withContext(function($ctx2) {
  33998. return $recv(each)._requiresSmalltalkContext();
  33999. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34000. }),(function(){
  34001. return nil;
  34002. })))._notNil();
  34003. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  34004. },
  34005. args: [],
  34006. 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",
  34007. referencedClasses: [],
  34008. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  34009. }),
  34010. $globals.ASTNode);
  34011. $core.addMethod(
  34012. $core.method({
  34013. selector: "shouldBeAliased",
  34014. protocol: "accessing",
  34015. fn: function (){
  34016. var self=this,$self=this;
  34017. return $core.withContext(function($ctx1) {
  34018. var $1,$receiver;
  34019. $1=$self.shouldBeAliased;
  34020. if(($receiver = $1) == null || $receiver.a$nil){
  34021. return false;
  34022. } else {
  34023. return $1;
  34024. }
  34025. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  34026. },
  34027. args: [],
  34028. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  34029. referencedClasses: [],
  34030. messageSends: ["ifNil:"]
  34031. }),
  34032. $globals.ASTNode);
  34033. $core.addMethod(
  34034. $core.method({
  34035. selector: "shouldBeAliased:",
  34036. protocol: "accessing",
  34037. fn: function (aBoolean){
  34038. var self=this,$self=this;
  34039. $self.shouldBeAliased=aBoolean;
  34040. return self;
  34041. },
  34042. args: ["aBoolean"],
  34043. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  34044. referencedClasses: [],
  34045. messageSends: []
  34046. }),
  34047. $globals.ASTNode);
  34048. $core.addMethod(
  34049. $core.method({
  34050. selector: "size",
  34051. protocol: "accessing",
  34052. fn: function (){
  34053. var self=this,$self=this;
  34054. return $core.withContext(function($ctx1) {
  34055. return $recv($self._source())._size();
  34056. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  34057. },
  34058. args: [],
  34059. source: "size\x0a\x09^ self source size",
  34060. referencedClasses: [],
  34061. messageSends: ["size", "source"]
  34062. }),
  34063. $globals.ASTNode);
  34064. $core.addMethod(
  34065. $core.method({
  34066. selector: "source",
  34067. protocol: "accessing",
  34068. fn: function (){
  34069. var self=this,$self=this;
  34070. return $core.withContext(function($ctx1) {
  34071. var $1,$receiver;
  34072. $1=$self.source;
  34073. if(($receiver = $1) == null || $receiver.a$nil){
  34074. return "";
  34075. } else {
  34076. return $1;
  34077. }
  34078. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  34079. },
  34080. args: [],
  34081. source: "source\x0a\x09^ source ifNil: [ '' ]",
  34082. referencedClasses: [],
  34083. messageSends: ["ifNil:"]
  34084. }),
  34085. $globals.ASTNode);
  34086. $core.addMethod(
  34087. $core.method({
  34088. selector: "source:",
  34089. protocol: "accessing",
  34090. fn: function (aString){
  34091. var self=this,$self=this;
  34092. $self.source=aString;
  34093. return self;
  34094. },
  34095. args: ["aString"],
  34096. source: "source: aString\x0a\x09source := aString",
  34097. referencedClasses: [],
  34098. messageSends: []
  34099. }),
  34100. $globals.ASTNode);
  34101. $core.addMethod(
  34102. $core.method({
  34103. selector: "withTail:",
  34104. protocol: "building",
  34105. fn: function (aCollection){
  34106. var self=this,$self=this;
  34107. return $core.withContext(function($ctx1) {
  34108. var $1;
  34109. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  34110. return $core.withContext(function($ctx2) {
  34111. $1=$recv($globals.SendNode)._new();
  34112. $recv($1)._position_($recv(send)._position());
  34113. $recv($1)._source_($recv(send)._source());
  34114. $recv($1)._receiver_(receiver);
  34115. $recv($1)._selector_($recv(send)._selector());
  34116. $recv($1)._arguments_($recv(send)._arguments());
  34117. return $recv($1)._yourself();
  34118. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  34119. }));
  34120. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  34121. },
  34122. args: ["aCollection"],
  34123. 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 ]",
  34124. referencedClasses: ["SendNode"],
  34125. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  34126. }),
  34127. $globals.ASTNode);
  34128. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  34129. $globals.AssignmentNode.comment="I represent an assignment node.";
  34130. $core.addMethod(
  34131. $core.method({
  34132. selector: "acceptDagVisitor:",
  34133. protocol: "visiting",
  34134. fn: function (aVisitor){
  34135. var self=this,$self=this;
  34136. return $core.withContext(function($ctx1) {
  34137. return $recv(aVisitor)._visitAssignmentNode_(self);
  34138. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  34139. },
  34140. args: ["aVisitor"],
  34141. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  34142. referencedClasses: [],
  34143. messageSends: ["visitAssignmentNode:"]
  34144. }),
  34145. $globals.AssignmentNode);
  34146. $core.addMethod(
  34147. $core.method({
  34148. selector: "dagChildren",
  34149. protocol: "accessing",
  34150. fn: function (){
  34151. var self=this,$self=this;
  34152. return $core.withContext(function($ctx1) {
  34153. return $recv($globals.Array)._with_with_($self._left(),$self._right());
  34154. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  34155. },
  34156. args: [],
  34157. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  34158. referencedClasses: ["Array"],
  34159. messageSends: ["with:with:", "left", "right"]
  34160. }),
  34161. $globals.AssignmentNode);
  34162. $core.addMethod(
  34163. $core.method({
  34164. selector: "isAssignmentNode",
  34165. protocol: "testing",
  34166. fn: function (){
  34167. var self=this,$self=this;
  34168. return true;
  34169. },
  34170. args: [],
  34171. source: "isAssignmentNode\x0a\x09^ true",
  34172. referencedClasses: [],
  34173. messageSends: []
  34174. }),
  34175. $globals.AssignmentNode);
  34176. $core.addMethod(
  34177. $core.method({
  34178. selector: "left",
  34179. protocol: "accessing",
  34180. fn: function (){
  34181. var self=this,$self=this;
  34182. return $self.left;
  34183. },
  34184. args: [],
  34185. source: "left\x0a\x09^ left",
  34186. referencedClasses: [],
  34187. messageSends: []
  34188. }),
  34189. $globals.AssignmentNode);
  34190. $core.addMethod(
  34191. $core.method({
  34192. selector: "left:",
  34193. protocol: "accessing",
  34194. fn: function (aNode){
  34195. var self=this,$self=this;
  34196. $self.left=aNode;
  34197. return self;
  34198. },
  34199. args: ["aNode"],
  34200. source: "left: aNode\x0a\x09left := aNode",
  34201. referencedClasses: [],
  34202. messageSends: []
  34203. }),
  34204. $globals.AssignmentNode);
  34205. $core.addMethod(
  34206. $core.method({
  34207. selector: "right",
  34208. protocol: "accessing",
  34209. fn: function (){
  34210. var self=this,$self=this;
  34211. return $self.right;
  34212. },
  34213. args: [],
  34214. source: "right\x0a\x09^ right",
  34215. referencedClasses: [],
  34216. messageSends: []
  34217. }),
  34218. $globals.AssignmentNode);
  34219. $core.addMethod(
  34220. $core.method({
  34221. selector: "right:",
  34222. protocol: "accessing",
  34223. fn: function (aNode){
  34224. var self=this,$self=this;
  34225. $self.right=aNode;
  34226. return self;
  34227. },
  34228. args: ["aNode"],
  34229. source: "right: aNode\x0a\x09right := aNode",
  34230. referencedClasses: [],
  34231. messageSends: []
  34232. }),
  34233. $globals.AssignmentNode);
  34234. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  34235. $globals.BlockNode.comment="I represent an block closure node.";
  34236. $core.addMethod(
  34237. $core.method({
  34238. selector: "acceptDagVisitor:",
  34239. protocol: "visiting",
  34240. fn: function (aVisitor){
  34241. var self=this,$self=this;
  34242. return $core.withContext(function($ctx1) {
  34243. return $recv(aVisitor)._visitBlockNode_(self);
  34244. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  34245. },
  34246. args: ["aVisitor"],
  34247. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  34248. referencedClasses: [],
  34249. messageSends: ["visitBlockNode:"]
  34250. }),
  34251. $globals.BlockNode);
  34252. $core.addMethod(
  34253. $core.method({
  34254. selector: "isBlockNode",
  34255. protocol: "testing",
  34256. fn: function (){
  34257. var self=this,$self=this;
  34258. return true;
  34259. },
  34260. args: [],
  34261. source: "isBlockNode\x0a\x09^ true",
  34262. referencedClasses: [],
  34263. messageSends: []
  34264. }),
  34265. $globals.BlockNode);
  34266. $core.addMethod(
  34267. $core.method({
  34268. selector: "parameters",
  34269. protocol: "accessing",
  34270. fn: function (){
  34271. var self=this,$self=this;
  34272. return $core.withContext(function($ctx1) {
  34273. var $1,$receiver;
  34274. $1=$self.parameters;
  34275. if(($receiver = $1) == null || $receiver.a$nil){
  34276. $self.parameters=$recv($globals.Array)._new();
  34277. return $self.parameters;
  34278. } else {
  34279. return $1;
  34280. }
  34281. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  34282. },
  34283. args: [],
  34284. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  34285. referencedClasses: ["Array"],
  34286. messageSends: ["ifNil:", "new"]
  34287. }),
  34288. $globals.BlockNode);
  34289. $core.addMethod(
  34290. $core.method({
  34291. selector: "parameters:",
  34292. protocol: "accessing",
  34293. fn: function (aCollection){
  34294. var self=this,$self=this;
  34295. $self.parameters=aCollection;
  34296. return self;
  34297. },
  34298. args: ["aCollection"],
  34299. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  34300. referencedClasses: [],
  34301. messageSends: []
  34302. }),
  34303. $globals.BlockNode);
  34304. $core.addMethod(
  34305. $core.method({
  34306. selector: "scope",
  34307. protocol: "accessing",
  34308. fn: function (){
  34309. var self=this,$self=this;
  34310. return $self.scope;
  34311. },
  34312. args: [],
  34313. source: "scope\x0a\x09^ scope",
  34314. referencedClasses: [],
  34315. messageSends: []
  34316. }),
  34317. $globals.BlockNode);
  34318. $core.addMethod(
  34319. $core.method({
  34320. selector: "scope:",
  34321. protocol: "accessing",
  34322. fn: function (aLexicalScope){
  34323. var self=this,$self=this;
  34324. $self.scope=aLexicalScope;
  34325. return self;
  34326. },
  34327. args: ["aLexicalScope"],
  34328. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34329. referencedClasses: [],
  34330. messageSends: []
  34331. }),
  34332. $globals.BlockNode);
  34333. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  34334. $globals.CascadeNode.comment="I represent an cascade node.";
  34335. $core.addMethod(
  34336. $core.method({
  34337. selector: "acceptDagVisitor:",
  34338. protocol: "visiting",
  34339. fn: function (aVisitor){
  34340. var self=this,$self=this;
  34341. return $core.withContext(function($ctx1) {
  34342. return $recv(aVisitor)._visitCascadeNode_(self);
  34343. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  34344. },
  34345. args: ["aVisitor"],
  34346. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  34347. referencedClasses: [],
  34348. messageSends: ["visitCascadeNode:"]
  34349. }),
  34350. $globals.CascadeNode);
  34351. $core.addMethod(
  34352. $core.method({
  34353. selector: "isCascadeNode",
  34354. protocol: "testing",
  34355. fn: function (){
  34356. var self=this,$self=this;
  34357. return true;
  34358. },
  34359. args: [],
  34360. source: "isCascadeNode\x0a\x09^ true",
  34361. referencedClasses: [],
  34362. messageSends: []
  34363. }),
  34364. $globals.CascadeNode);
  34365. $core.addMethod(
  34366. $core.method({
  34367. selector: "receiver",
  34368. protocol: "accessing",
  34369. fn: function (){
  34370. var self=this,$self=this;
  34371. return $self.receiver;
  34372. },
  34373. args: [],
  34374. source: "receiver\x0a\x09^ receiver",
  34375. referencedClasses: [],
  34376. messageSends: []
  34377. }),
  34378. $globals.CascadeNode);
  34379. $core.addMethod(
  34380. $core.method({
  34381. selector: "receiver:",
  34382. protocol: "accessing",
  34383. fn: function (aNode){
  34384. var self=this,$self=this;
  34385. $self.receiver=aNode;
  34386. return self;
  34387. },
  34388. args: ["aNode"],
  34389. source: "receiver: aNode\x0a\x09receiver := aNode",
  34390. referencedClasses: [],
  34391. messageSends: []
  34392. }),
  34393. $globals.CascadeNode);
  34394. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  34395. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  34396. $core.addMethod(
  34397. $core.method({
  34398. selector: "acceptDagVisitor:",
  34399. protocol: "visiting",
  34400. fn: function (aVisitor){
  34401. var self=this,$self=this;
  34402. return $core.withContext(function($ctx1) {
  34403. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  34404. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  34405. },
  34406. args: ["aVisitor"],
  34407. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  34408. referencedClasses: [],
  34409. messageSends: ["visitDynamicArrayNode:"]
  34410. }),
  34411. $globals.DynamicArrayNode);
  34412. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  34413. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  34414. $core.addMethod(
  34415. $core.method({
  34416. selector: "acceptDagVisitor:",
  34417. protocol: "visiting",
  34418. fn: function (aVisitor){
  34419. var self=this,$self=this;
  34420. return $core.withContext(function($ctx1) {
  34421. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  34422. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  34423. },
  34424. args: ["aVisitor"],
  34425. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  34426. referencedClasses: [],
  34427. messageSends: ["visitDynamicDictionaryNode:"]
  34428. }),
  34429. $globals.DynamicDictionaryNode);
  34430. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  34431. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  34432. $core.addMethod(
  34433. $core.method({
  34434. selector: "acceptDagVisitor:",
  34435. protocol: "visiting",
  34436. fn: function (aVisitor){
  34437. var self=this,$self=this;
  34438. return $core.withContext(function($ctx1) {
  34439. return $recv(aVisitor)._visitJSStatementNode_(self);
  34440. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  34441. },
  34442. args: ["aVisitor"],
  34443. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  34444. referencedClasses: [],
  34445. messageSends: ["visitJSStatementNode:"]
  34446. }),
  34447. $globals.JSStatementNode);
  34448. $core.addMethod(
  34449. $core.method({
  34450. selector: "isJSStatementNode",
  34451. protocol: "testing",
  34452. fn: function (){
  34453. var self=this,$self=this;
  34454. return true;
  34455. },
  34456. args: [],
  34457. source: "isJSStatementNode\x0a\x09^ true",
  34458. referencedClasses: [],
  34459. messageSends: []
  34460. }),
  34461. $globals.JSStatementNode);
  34462. $core.addMethod(
  34463. $core.method({
  34464. selector: "requiresSmalltalkContext",
  34465. protocol: "testing",
  34466. fn: function (){
  34467. var self=this,$self=this;
  34468. return true;
  34469. },
  34470. args: [],
  34471. source: "requiresSmalltalkContext\x0a\x09^ true",
  34472. referencedClasses: [],
  34473. messageSends: []
  34474. }),
  34475. $globals.JSStatementNode);
  34476. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  34477. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  34478. $core.addMethod(
  34479. $core.method({
  34480. selector: "acceptDagVisitor:",
  34481. protocol: "visiting",
  34482. fn: function (aVisitor){
  34483. var self=this,$self=this;
  34484. return $core.withContext(function($ctx1) {
  34485. return $recv(aVisitor)._visitMethodNode_(self);
  34486. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  34487. },
  34488. args: ["aVisitor"],
  34489. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  34490. referencedClasses: [],
  34491. messageSends: ["visitMethodNode:"]
  34492. }),
  34493. $globals.MethodNode);
  34494. $core.addMethod(
  34495. $core.method({
  34496. selector: "arguments",
  34497. protocol: "accessing",
  34498. fn: function (){
  34499. var self=this,$self=this;
  34500. return $core.withContext(function($ctx1) {
  34501. var $1,$receiver;
  34502. $1=$self.arguments;
  34503. if(($receiver = $1) == null || $receiver.a$nil){
  34504. return [];
  34505. } else {
  34506. return $1;
  34507. }
  34508. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  34509. },
  34510. args: [],
  34511. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  34512. referencedClasses: [],
  34513. messageSends: ["ifNil:"]
  34514. }),
  34515. $globals.MethodNode);
  34516. $core.addMethod(
  34517. $core.method({
  34518. selector: "arguments:",
  34519. protocol: "accessing",
  34520. fn: function (aCollection){
  34521. var self=this,$self=this;
  34522. $self.arguments=aCollection;
  34523. return self;
  34524. },
  34525. args: ["aCollection"],
  34526. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34527. referencedClasses: [],
  34528. messageSends: []
  34529. }),
  34530. $globals.MethodNode);
  34531. $core.addMethod(
  34532. $core.method({
  34533. selector: "classReferences",
  34534. protocol: "accessing",
  34535. fn: function (){
  34536. var self=this,$self=this;
  34537. return $self.classReferences;
  34538. },
  34539. args: [],
  34540. source: "classReferences\x0a\x09^ classReferences",
  34541. referencedClasses: [],
  34542. messageSends: []
  34543. }),
  34544. $globals.MethodNode);
  34545. $core.addMethod(
  34546. $core.method({
  34547. selector: "classReferences:",
  34548. protocol: "accessing",
  34549. fn: function (aCollection){
  34550. var self=this,$self=this;
  34551. $self.classReferences=aCollection;
  34552. return self;
  34553. },
  34554. args: ["aCollection"],
  34555. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  34556. referencedClasses: [],
  34557. messageSends: []
  34558. }),
  34559. $globals.MethodNode);
  34560. $core.addMethod(
  34561. $core.method({
  34562. selector: "messageSends",
  34563. protocol: "accessing",
  34564. fn: function (){
  34565. var self=this,$self=this;
  34566. return $core.withContext(function($ctx1) {
  34567. return $recv($self._sendIndexes())._keys();
  34568. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  34569. },
  34570. args: [],
  34571. source: "messageSends\x0a\x09^ self sendIndexes keys",
  34572. referencedClasses: [],
  34573. messageSends: ["keys", "sendIndexes"]
  34574. }),
  34575. $globals.MethodNode);
  34576. $core.addMethod(
  34577. $core.method({
  34578. selector: "method",
  34579. protocol: "accessing",
  34580. fn: function (){
  34581. var self=this,$self=this;
  34582. return self;
  34583. },
  34584. args: [],
  34585. source: "method\x0a\x09^ self",
  34586. referencedClasses: [],
  34587. messageSends: []
  34588. }),
  34589. $globals.MethodNode);
  34590. $core.addMethod(
  34591. $core.method({
  34592. selector: "scope",
  34593. protocol: "accessing",
  34594. fn: function (){
  34595. var self=this,$self=this;
  34596. return $self.scope;
  34597. },
  34598. args: [],
  34599. source: "scope\x0a\x09^ scope",
  34600. referencedClasses: [],
  34601. messageSends: []
  34602. }),
  34603. $globals.MethodNode);
  34604. $core.addMethod(
  34605. $core.method({
  34606. selector: "scope:",
  34607. protocol: "accessing",
  34608. fn: function (aMethodScope){
  34609. var self=this,$self=this;
  34610. $self.scope=aMethodScope;
  34611. return self;
  34612. },
  34613. args: ["aMethodScope"],
  34614. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  34615. referencedClasses: [],
  34616. messageSends: []
  34617. }),
  34618. $globals.MethodNode);
  34619. $core.addMethod(
  34620. $core.method({
  34621. selector: "selector",
  34622. protocol: "accessing",
  34623. fn: function (){
  34624. var self=this,$self=this;
  34625. return $self.selector;
  34626. },
  34627. args: [],
  34628. source: "selector\x0a\x09^ selector",
  34629. referencedClasses: [],
  34630. messageSends: []
  34631. }),
  34632. $globals.MethodNode);
  34633. $core.addMethod(
  34634. $core.method({
  34635. selector: "selector:",
  34636. protocol: "accessing",
  34637. fn: function (aString){
  34638. var self=this,$self=this;
  34639. $self.selector=aString;
  34640. return self;
  34641. },
  34642. args: ["aString"],
  34643. source: "selector: aString\x0a\x09selector := aString",
  34644. referencedClasses: [],
  34645. messageSends: []
  34646. }),
  34647. $globals.MethodNode);
  34648. $core.addMethod(
  34649. $core.method({
  34650. selector: "sendIndexes",
  34651. protocol: "accessing",
  34652. fn: function (){
  34653. var self=this,$self=this;
  34654. return $self.sendIndexes;
  34655. },
  34656. args: [],
  34657. source: "sendIndexes\x0a\x09^ sendIndexes",
  34658. referencedClasses: [],
  34659. messageSends: []
  34660. }),
  34661. $globals.MethodNode);
  34662. $core.addMethod(
  34663. $core.method({
  34664. selector: "sendIndexes:",
  34665. protocol: "accessing",
  34666. fn: function (aDictionary){
  34667. var self=this,$self=this;
  34668. $self.sendIndexes=aDictionary;
  34669. return self;
  34670. },
  34671. args: ["aDictionary"],
  34672. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  34673. referencedClasses: [],
  34674. messageSends: []
  34675. }),
  34676. $globals.MethodNode);
  34677. $core.addMethod(
  34678. $core.method({
  34679. selector: "sequenceNode",
  34680. protocol: "accessing",
  34681. fn: function (){
  34682. var self=this,$self=this;
  34683. return $core.withContext(function($ctx1) {
  34684. var $1;
  34685. var $early={};
  34686. try {
  34687. $recv($self._dagChildren())._do_((function(each){
  34688. return $core.withContext(function($ctx2) {
  34689. $1=$recv(each)._isSequenceNode();
  34690. if($core.assert($1)){
  34691. throw $early=[each];
  34692. }
  34693. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34694. }));
  34695. return nil;
  34696. }
  34697. catch(e) {if(e===$early)return e[0]; throw e}
  34698. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  34699. },
  34700. args: [],
  34701. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  34702. referencedClasses: [],
  34703. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  34704. }),
  34705. $globals.MethodNode);
  34706. $core.addMethod(
  34707. $core.method({
  34708. selector: "source",
  34709. protocol: "accessing",
  34710. fn: function (){
  34711. var self=this,$self=this;
  34712. return $self.source;
  34713. },
  34714. args: [],
  34715. source: "source\x0a\x09^ source",
  34716. referencedClasses: [],
  34717. messageSends: []
  34718. }),
  34719. $globals.MethodNode);
  34720. $core.addMethod(
  34721. $core.method({
  34722. selector: "source:",
  34723. protocol: "accessing",
  34724. fn: function (aString){
  34725. var self=this,$self=this;
  34726. $self.source=aString;
  34727. return self;
  34728. },
  34729. args: ["aString"],
  34730. source: "source: aString\x0a\x09source := aString",
  34731. referencedClasses: [],
  34732. messageSends: []
  34733. }),
  34734. $globals.MethodNode);
  34735. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  34736. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  34737. $core.addMethod(
  34738. $core.method({
  34739. selector: "acceptDagVisitor:",
  34740. protocol: "visiting",
  34741. fn: function (aVisitor){
  34742. var self=this,$self=this;
  34743. return $core.withContext(function($ctx1) {
  34744. return $recv(aVisitor)._visitReturnNode_(self);
  34745. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  34746. },
  34747. args: ["aVisitor"],
  34748. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  34749. referencedClasses: [],
  34750. messageSends: ["visitReturnNode:"]
  34751. }),
  34752. $globals.ReturnNode);
  34753. $core.addMethod(
  34754. $core.method({
  34755. selector: "isReturnNode",
  34756. protocol: "testing",
  34757. fn: function (){
  34758. var self=this,$self=this;
  34759. return true;
  34760. },
  34761. args: [],
  34762. source: "isReturnNode\x0a\x09^ true",
  34763. referencedClasses: [],
  34764. messageSends: []
  34765. }),
  34766. $globals.ReturnNode);
  34767. $core.addMethod(
  34768. $core.method({
  34769. selector: "nonLocalReturn",
  34770. protocol: "testing",
  34771. fn: function (){
  34772. var self=this,$self=this;
  34773. return $core.withContext(function($ctx1) {
  34774. return $recv($recv($self._scope())._isMethodScope())._not();
  34775. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  34776. },
  34777. args: [],
  34778. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  34779. referencedClasses: [],
  34780. messageSends: ["not", "isMethodScope", "scope"]
  34781. }),
  34782. $globals.ReturnNode);
  34783. $core.addMethod(
  34784. $core.method({
  34785. selector: "scope",
  34786. protocol: "accessing",
  34787. fn: function (){
  34788. var self=this,$self=this;
  34789. return $self.scope;
  34790. },
  34791. args: [],
  34792. source: "scope\x0a\x09^ scope",
  34793. referencedClasses: [],
  34794. messageSends: []
  34795. }),
  34796. $globals.ReturnNode);
  34797. $core.addMethod(
  34798. $core.method({
  34799. selector: "scope:",
  34800. protocol: "accessing",
  34801. fn: function (aLexicalScope){
  34802. var self=this,$self=this;
  34803. $self.scope=aLexicalScope;
  34804. return self;
  34805. },
  34806. args: ["aLexicalScope"],
  34807. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34808. referencedClasses: [],
  34809. messageSends: []
  34810. }),
  34811. $globals.ReturnNode);
  34812. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  34813. $globals.SendNode.comment="I represent an message send node.";
  34814. $core.addMethod(
  34815. $core.method({
  34816. selector: "acceptDagVisitor:",
  34817. protocol: "visiting",
  34818. fn: function (aVisitor){
  34819. var self=this,$self=this;
  34820. return $core.withContext(function($ctx1) {
  34821. return $recv(aVisitor)._visitSendNode_(self);
  34822. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  34823. },
  34824. args: ["aVisitor"],
  34825. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  34826. referencedClasses: [],
  34827. messageSends: ["visitSendNode:"]
  34828. }),
  34829. $globals.SendNode);
  34830. $core.addMethod(
  34831. $core.method({
  34832. selector: "arguments",
  34833. protocol: "accessing",
  34834. fn: function (){
  34835. var self=this,$self=this;
  34836. return $core.withContext(function($ctx1) {
  34837. var $1,$receiver;
  34838. $1=$self.arguments;
  34839. if(($receiver = $1) == null || $receiver.a$nil){
  34840. $self.arguments=[];
  34841. return $self.arguments;
  34842. } else {
  34843. return $1;
  34844. }
  34845. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  34846. },
  34847. args: [],
  34848. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  34849. referencedClasses: [],
  34850. messageSends: ["ifNil:"]
  34851. }),
  34852. $globals.SendNode);
  34853. $core.addMethod(
  34854. $core.method({
  34855. selector: "arguments:",
  34856. protocol: "accessing",
  34857. fn: function (aCollection){
  34858. var self=this,$self=this;
  34859. $self.arguments=aCollection;
  34860. return self;
  34861. },
  34862. args: ["aCollection"],
  34863. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34864. referencedClasses: [],
  34865. messageSends: []
  34866. }),
  34867. $globals.SendNode);
  34868. $core.addMethod(
  34869. $core.method({
  34870. selector: "dagChildren",
  34871. protocol: "accessing",
  34872. fn: function (){
  34873. var self=this,$self=this;
  34874. return $core.withContext(function($ctx1) {
  34875. var $1,$2,$3,$receiver;
  34876. $1=$self._receiver();
  34877. $ctx1.sendIdx["receiver"]=1;
  34878. if(($receiver = $1) == null || $receiver.a$nil){
  34879. $2=$self._arguments();
  34880. $ctx1.sendIdx["arguments"]=1;
  34881. return $recv($2)._copy();
  34882. } else {
  34883. $1;
  34884. }
  34885. $3=$recv($globals.Array)._with_($self._receiver());
  34886. $recv($3)._addAll_($self._arguments());
  34887. return $recv($3)._yourself();
  34888. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  34889. },
  34890. args: [],
  34891. 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",
  34892. referencedClasses: ["Array"],
  34893. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  34894. }),
  34895. $globals.SendNode);
  34896. $core.addMethod(
  34897. $core.method({
  34898. selector: "index",
  34899. protocol: "accessing",
  34900. fn: function (){
  34901. var self=this,$self=this;
  34902. return $self.index;
  34903. },
  34904. args: [],
  34905. source: "index\x0a\x09^ index",
  34906. referencedClasses: [],
  34907. messageSends: []
  34908. }),
  34909. $globals.SendNode);
  34910. $core.addMethod(
  34911. $core.method({
  34912. selector: "index:",
  34913. protocol: "accessing",
  34914. fn: function (anInteger){
  34915. var self=this,$self=this;
  34916. $self.index=anInteger;
  34917. return self;
  34918. },
  34919. args: ["anInteger"],
  34920. source: "index: anInteger\x0a\x09index := anInteger",
  34921. referencedClasses: [],
  34922. messageSends: []
  34923. }),
  34924. $globals.SendNode);
  34925. $core.addMethod(
  34926. $core.method({
  34927. selector: "isNavigationNode",
  34928. protocol: "testing",
  34929. fn: function (){
  34930. var self=this,$self=this;
  34931. return true;
  34932. },
  34933. args: [],
  34934. source: "isNavigationNode\x0a\x09^ true",
  34935. referencedClasses: [],
  34936. messageSends: []
  34937. }),
  34938. $globals.SendNode);
  34939. $core.addMethod(
  34940. $core.method({
  34941. selector: "isSendNode",
  34942. protocol: "testing",
  34943. fn: function (){
  34944. var self=this,$self=this;
  34945. return true;
  34946. },
  34947. args: [],
  34948. source: "isSendNode\x0a\x09^ true",
  34949. referencedClasses: [],
  34950. messageSends: []
  34951. }),
  34952. $globals.SendNode);
  34953. $core.addMethod(
  34954. $core.method({
  34955. selector: "navigationLink",
  34956. protocol: "accessing",
  34957. fn: function (){
  34958. var self=this,$self=this;
  34959. return $core.withContext(function($ctx1) {
  34960. return $self._selector();
  34961. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  34962. },
  34963. args: [],
  34964. source: "navigationLink\x0a\x09^ self selector",
  34965. referencedClasses: [],
  34966. messageSends: ["selector"]
  34967. }),
  34968. $globals.SendNode);
  34969. $core.addMethod(
  34970. $core.method({
  34971. selector: "receiver",
  34972. protocol: "accessing",
  34973. fn: function (){
  34974. var self=this,$self=this;
  34975. return $self.receiver;
  34976. },
  34977. args: [],
  34978. source: "receiver\x0a\x09^ receiver",
  34979. referencedClasses: [],
  34980. messageSends: []
  34981. }),
  34982. $globals.SendNode);
  34983. $core.addMethod(
  34984. $core.method({
  34985. selector: "receiver:",
  34986. protocol: "accessing",
  34987. fn: function (aNode){
  34988. var self=this,$self=this;
  34989. $self.receiver=aNode;
  34990. return self;
  34991. },
  34992. args: ["aNode"],
  34993. source: "receiver: aNode\x0a\x09receiver := aNode",
  34994. referencedClasses: [],
  34995. messageSends: []
  34996. }),
  34997. $globals.SendNode);
  34998. $core.addMethod(
  34999. $core.method({
  35000. selector: "requiresSmalltalkContext",
  35001. protocol: "testing",
  35002. fn: function (){
  35003. var self=this,$self=this;
  35004. return true;
  35005. },
  35006. args: [],
  35007. source: "requiresSmalltalkContext\x0a\x09^ true",
  35008. referencedClasses: [],
  35009. messageSends: []
  35010. }),
  35011. $globals.SendNode);
  35012. $core.addMethod(
  35013. $core.method({
  35014. selector: "selector",
  35015. protocol: "accessing",
  35016. fn: function (){
  35017. var self=this,$self=this;
  35018. return $self.selector;
  35019. },
  35020. args: [],
  35021. source: "selector\x0a\x09^ selector",
  35022. referencedClasses: [],
  35023. messageSends: []
  35024. }),
  35025. $globals.SendNode);
  35026. $core.addMethod(
  35027. $core.method({
  35028. selector: "selector:",
  35029. protocol: "accessing",
  35030. fn: function (aString){
  35031. var self=this,$self=this;
  35032. $self.selector=aString;
  35033. return self;
  35034. },
  35035. args: ["aString"],
  35036. source: "selector: aString\x0a\x09selector := aString",
  35037. referencedClasses: [],
  35038. messageSends: []
  35039. }),
  35040. $globals.SendNode);
  35041. $core.addMethod(
  35042. $core.method({
  35043. selector: "shouldBeInlined",
  35044. protocol: "accessing",
  35045. fn: function (){
  35046. var self=this,$self=this;
  35047. return $core.withContext(function($ctx1) {
  35048. var $1,$receiver;
  35049. $1=$self.shouldBeInlined;
  35050. if(($receiver = $1) == null || $receiver.a$nil){
  35051. return false;
  35052. } else {
  35053. return $1;
  35054. }
  35055. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  35056. },
  35057. args: [],
  35058. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  35059. referencedClasses: [],
  35060. messageSends: ["ifNil:"]
  35061. }),
  35062. $globals.SendNode);
  35063. $core.addMethod(
  35064. $core.method({
  35065. selector: "shouldBeInlined:",
  35066. protocol: "accessing",
  35067. fn: function (aBoolean){
  35068. var self=this,$self=this;
  35069. $self.shouldBeInlined=aBoolean;
  35070. return self;
  35071. },
  35072. args: ["aBoolean"],
  35073. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  35074. referencedClasses: [],
  35075. messageSends: []
  35076. }),
  35077. $globals.SendNode);
  35078. $core.addMethod(
  35079. $core.method({
  35080. selector: "superSend",
  35081. protocol: "accessing",
  35082. fn: function (){
  35083. var self=this,$self=this;
  35084. return $core.withContext(function($ctx1) {
  35085. var $2,$1;
  35086. $2=$self._receiver();
  35087. $ctx1.sendIdx["receiver"]=1;
  35088. $1=$recv($2)._notNil();
  35089. return $recv($1)._and_((function(){
  35090. return $core.withContext(function($ctx2) {
  35091. return $recv($self._receiver())._isSuperKeyword();
  35092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35093. }));
  35094. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  35095. },
  35096. args: [],
  35097. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  35098. referencedClasses: [],
  35099. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  35100. }),
  35101. $globals.SendNode);
  35102. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "pragmas", "scope"], "Compiler-AST");
  35103. $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).";
  35104. $core.addMethod(
  35105. $core.method({
  35106. selector: "acceptDagVisitor:",
  35107. protocol: "visiting",
  35108. fn: function (aVisitor){
  35109. var self=this,$self=this;
  35110. return $core.withContext(function($ctx1) {
  35111. return $recv(aVisitor)._visitSequenceNode_(self);
  35112. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  35113. },
  35114. args: ["aVisitor"],
  35115. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  35116. referencedClasses: [],
  35117. messageSends: ["visitSequenceNode:"]
  35118. }),
  35119. $globals.SequenceNode);
  35120. $core.addMethod(
  35121. $core.method({
  35122. selector: "asBlockSequenceNode",
  35123. protocol: "building",
  35124. fn: function (){
  35125. var self=this,$self=this;
  35126. return $core.withContext(function($ctx1) {
  35127. var $1;
  35128. $1=$recv($globals.BlockSequenceNode)._new();
  35129. $recv($1)._position_($self._position());
  35130. $recv($1)._source_($self._source());
  35131. $recv($1)._dagChildren_($self._dagChildren());
  35132. $recv($1)._temps_($self._temps());
  35133. $recv($1)._pragmas_($self._pragmas());
  35134. return $recv($1)._yourself();
  35135. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  35136. },
  35137. args: [],
  35138. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09dagChildren: self dagChildren;\x0a\x09\x09temps: self temps;\x0a\x09\x09pragmas: self pragmas;\x0a\x09\x09yourself",
  35139. referencedClasses: ["BlockSequenceNode"],
  35140. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "pragmas:", "pragmas", "yourself"]
  35141. }),
  35142. $globals.SequenceNode);
  35143. $core.addMethod(
  35144. $core.method({
  35145. selector: "isSequenceNode",
  35146. protocol: "testing",
  35147. fn: function (){
  35148. var self=this,$self=this;
  35149. return true;
  35150. },
  35151. args: [],
  35152. source: "isSequenceNode\x0a\x09^ true",
  35153. referencedClasses: [],
  35154. messageSends: []
  35155. }),
  35156. $globals.SequenceNode);
  35157. $core.addMethod(
  35158. $core.method({
  35159. selector: "pragmas",
  35160. protocol: "accessing",
  35161. fn: function (){
  35162. var self=this,$self=this;
  35163. return $core.withContext(function($ctx1) {
  35164. var $1,$receiver;
  35165. $1=$self.pragmas;
  35166. if(($receiver = $1) == null || $receiver.a$nil){
  35167. return [];
  35168. } else {
  35169. return $1;
  35170. }
  35171. }, function($ctx1) {$ctx1.fill(self,"pragmas",{},$globals.SequenceNode)});
  35172. },
  35173. args: [],
  35174. source: "pragmas\x0a\x09^ pragmas ifNil: [ #() ]",
  35175. referencedClasses: [],
  35176. messageSends: ["ifNil:"]
  35177. }),
  35178. $globals.SequenceNode);
  35179. $core.addMethod(
  35180. $core.method({
  35181. selector: "pragmas:",
  35182. protocol: "accessing",
  35183. fn: function (aCollection){
  35184. var self=this,$self=this;
  35185. $self.pragmas=aCollection;
  35186. return self;
  35187. },
  35188. args: ["aCollection"],
  35189. source: "pragmas: aCollection\x0a\x09pragmas := aCollection",
  35190. referencedClasses: [],
  35191. messageSends: []
  35192. }),
  35193. $globals.SequenceNode);
  35194. $core.addMethod(
  35195. $core.method({
  35196. selector: "scope",
  35197. protocol: "accessing",
  35198. fn: function (){
  35199. var self=this,$self=this;
  35200. return $self.scope;
  35201. },
  35202. args: [],
  35203. source: "scope\x0a\x09^ scope",
  35204. referencedClasses: [],
  35205. messageSends: []
  35206. }),
  35207. $globals.SequenceNode);
  35208. $core.addMethod(
  35209. $core.method({
  35210. selector: "scope:",
  35211. protocol: "accessing",
  35212. fn: function (aLexicalScope){
  35213. var self=this,$self=this;
  35214. $self.scope=aLexicalScope;
  35215. return self;
  35216. },
  35217. args: ["aLexicalScope"],
  35218. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  35219. referencedClasses: [],
  35220. messageSends: []
  35221. }),
  35222. $globals.SequenceNode);
  35223. $core.addMethod(
  35224. $core.method({
  35225. selector: "temps",
  35226. protocol: "accessing",
  35227. fn: function (){
  35228. var self=this,$self=this;
  35229. return $core.withContext(function($ctx1) {
  35230. var $1,$receiver;
  35231. $1=$self.temps;
  35232. if(($receiver = $1) == null || $receiver.a$nil){
  35233. return [];
  35234. } else {
  35235. return $1;
  35236. }
  35237. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  35238. },
  35239. args: [],
  35240. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  35241. referencedClasses: [],
  35242. messageSends: ["ifNil:"]
  35243. }),
  35244. $globals.SequenceNode);
  35245. $core.addMethod(
  35246. $core.method({
  35247. selector: "temps:",
  35248. protocol: "accessing",
  35249. fn: function (aCollection){
  35250. var self=this,$self=this;
  35251. $self.temps=aCollection;
  35252. return self;
  35253. },
  35254. args: ["aCollection"],
  35255. source: "temps: aCollection\x0a\x09temps := aCollection",
  35256. referencedClasses: [],
  35257. messageSends: []
  35258. }),
  35259. $globals.SequenceNode);
  35260. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  35261. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  35262. $core.addMethod(
  35263. $core.method({
  35264. selector: "acceptDagVisitor:",
  35265. protocol: "visiting",
  35266. fn: function (aVisitor){
  35267. var self=this,$self=this;
  35268. return $core.withContext(function($ctx1) {
  35269. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  35270. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  35271. },
  35272. args: ["aVisitor"],
  35273. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  35274. referencedClasses: [],
  35275. messageSends: ["visitBlockSequenceNode:"]
  35276. }),
  35277. $globals.BlockSequenceNode);
  35278. $core.addMethod(
  35279. $core.method({
  35280. selector: "isBlockSequenceNode",
  35281. protocol: "testing",
  35282. fn: function (){
  35283. var self=this,$self=this;
  35284. return true;
  35285. },
  35286. args: [],
  35287. source: "isBlockSequenceNode\x0a\x09^ true",
  35288. referencedClasses: [],
  35289. messageSends: []
  35290. }),
  35291. $globals.BlockSequenceNode);
  35292. $core.addMethod(
  35293. $core.method({
  35294. selector: "pragmas:",
  35295. protocol: "visiting",
  35296. fn: function (aCollection){
  35297. var self=this,$self=this;
  35298. return $core.withContext(function($ctx1) {
  35299. var $1;
  35300. $recv(aCollection)._ifNotEmpty_((function(){
  35301. return $core.withContext(function($ctx2) {
  35302. return $recv($globals.CompilerError)._signal_("Block must have no pragmas.");
  35303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35304. }));
  35305. $1=(
  35306. $ctx1.supercall = true,
  35307. ($globals.BlockSequenceNode.superclass||$boot.nilAsClass).fn.prototype._pragmas_.apply($self, [aCollection]));
  35308. $ctx1.supercall = false;
  35309. return $1;
  35310. }, function($ctx1) {$ctx1.fill(self,"pragmas:",{aCollection:aCollection},$globals.BlockSequenceNode)});
  35311. },
  35312. args: ["aCollection"],
  35313. source: "pragmas: aCollection\x0a\x09aCollection ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'Block must have no pragmas.' ].\x0a\x09^ super pragmas: aCollection",
  35314. referencedClasses: ["CompilerError"],
  35315. messageSends: ["ifNotEmpty:", "signal:", "pragmas:"]
  35316. }),
  35317. $globals.BlockSequenceNode);
  35318. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  35319. $globals.ValueNode.comment="I represent a value node.";
  35320. $core.addMethod(
  35321. $core.method({
  35322. selector: "acceptDagVisitor:",
  35323. protocol: "visiting",
  35324. fn: function (aVisitor){
  35325. var self=this,$self=this;
  35326. return $core.withContext(function($ctx1) {
  35327. return $recv(aVisitor)._visitValueNode_(self);
  35328. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  35329. },
  35330. args: ["aVisitor"],
  35331. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  35332. referencedClasses: [],
  35333. messageSends: ["visitValueNode:"]
  35334. }),
  35335. $globals.ValueNode);
  35336. $core.addMethod(
  35337. $core.method({
  35338. selector: "isImmutable",
  35339. protocol: "testing",
  35340. fn: function (){
  35341. var self=this,$self=this;
  35342. return $core.withContext(function($ctx1) {
  35343. return $recv($self._value())._isImmutable();
  35344. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  35345. },
  35346. args: [],
  35347. source: "isImmutable\x0a\x09^ self value isImmutable",
  35348. referencedClasses: [],
  35349. messageSends: ["isImmutable", "value"]
  35350. }),
  35351. $globals.ValueNode);
  35352. $core.addMethod(
  35353. $core.method({
  35354. selector: "isValueNode",
  35355. protocol: "testing",
  35356. fn: function (){
  35357. var self=this,$self=this;
  35358. return true;
  35359. },
  35360. args: [],
  35361. source: "isValueNode\x0a\x09^ true",
  35362. referencedClasses: [],
  35363. messageSends: []
  35364. }),
  35365. $globals.ValueNode);
  35366. $core.addMethod(
  35367. $core.method({
  35368. selector: "value",
  35369. protocol: "accessing",
  35370. fn: function (){
  35371. var self=this,$self=this;
  35372. return $self.value;
  35373. },
  35374. args: [],
  35375. source: "value\x0a\x09^ value",
  35376. referencedClasses: [],
  35377. messageSends: []
  35378. }),
  35379. $globals.ValueNode);
  35380. $core.addMethod(
  35381. $core.method({
  35382. selector: "value:",
  35383. protocol: "accessing",
  35384. fn: function (anObject){
  35385. var self=this,$self=this;
  35386. $self.value=anObject;
  35387. return self;
  35388. },
  35389. args: ["anObject"],
  35390. source: "value: anObject\x0a\x09value := anObject",
  35391. referencedClasses: [],
  35392. messageSends: []
  35393. }),
  35394. $globals.ValueNode);
  35395. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  35396. $globals.VariableNode.comment="I represent an variable node.";
  35397. $core.addMethod(
  35398. $core.method({
  35399. selector: "acceptDagVisitor:",
  35400. protocol: "visiting",
  35401. fn: function (aVisitor){
  35402. var self=this,$self=this;
  35403. return $core.withContext(function($ctx1) {
  35404. return $recv(aVisitor)._visitVariableNode_(self);
  35405. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  35406. },
  35407. args: ["aVisitor"],
  35408. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  35409. referencedClasses: [],
  35410. messageSends: ["visitVariableNode:"]
  35411. }),
  35412. $globals.VariableNode);
  35413. $core.addMethod(
  35414. $core.method({
  35415. selector: "alias",
  35416. protocol: "accessing",
  35417. fn: function (){
  35418. var self=this,$self=this;
  35419. return $core.withContext(function($ctx1) {
  35420. return $recv($self._binding())._alias();
  35421. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  35422. },
  35423. args: [],
  35424. source: "alias\x0a\x09^ self binding alias",
  35425. referencedClasses: [],
  35426. messageSends: ["alias", "binding"]
  35427. }),
  35428. $globals.VariableNode);
  35429. $core.addMethod(
  35430. $core.method({
  35431. selector: "assigned",
  35432. protocol: "accessing",
  35433. fn: function (){
  35434. var self=this,$self=this;
  35435. return $core.withContext(function($ctx1) {
  35436. var $1,$receiver;
  35437. $1=$self.assigned;
  35438. if(($receiver = $1) == null || $receiver.a$nil){
  35439. return false;
  35440. } else {
  35441. return $1;
  35442. }
  35443. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  35444. },
  35445. args: [],
  35446. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  35447. referencedClasses: [],
  35448. messageSends: ["ifNil:"]
  35449. }),
  35450. $globals.VariableNode);
  35451. $core.addMethod(
  35452. $core.method({
  35453. selector: "assigned:",
  35454. protocol: "accessing",
  35455. fn: function (aBoolean){
  35456. var self=this,$self=this;
  35457. $self.assigned=aBoolean;
  35458. return self;
  35459. },
  35460. args: ["aBoolean"],
  35461. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  35462. referencedClasses: [],
  35463. messageSends: []
  35464. }),
  35465. $globals.VariableNode);
  35466. $core.addMethod(
  35467. $core.method({
  35468. selector: "beAssigned",
  35469. protocol: "accessing",
  35470. fn: function (){
  35471. var self=this,$self=this;
  35472. return $core.withContext(function($ctx1) {
  35473. $recv($self._binding())._validateAssignment();
  35474. $self.assigned=true;
  35475. return self;
  35476. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  35477. },
  35478. args: [],
  35479. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  35480. referencedClasses: [],
  35481. messageSends: ["validateAssignment", "binding"]
  35482. }),
  35483. $globals.VariableNode);
  35484. $core.addMethod(
  35485. $core.method({
  35486. selector: "binding",
  35487. protocol: "accessing",
  35488. fn: function (){
  35489. var self=this,$self=this;
  35490. return $self.binding;
  35491. },
  35492. args: [],
  35493. source: "binding\x0a\x09^ binding",
  35494. referencedClasses: [],
  35495. messageSends: []
  35496. }),
  35497. $globals.VariableNode);
  35498. $core.addMethod(
  35499. $core.method({
  35500. selector: "binding:",
  35501. protocol: "accessing",
  35502. fn: function (aScopeVar){
  35503. var self=this,$self=this;
  35504. $self.binding=aScopeVar;
  35505. return self;
  35506. },
  35507. args: ["aScopeVar"],
  35508. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  35509. referencedClasses: [],
  35510. messageSends: []
  35511. }),
  35512. $globals.VariableNode);
  35513. $core.addMethod(
  35514. $core.method({
  35515. selector: "isArgument",
  35516. protocol: "testing",
  35517. fn: function (){
  35518. var self=this,$self=this;
  35519. return $core.withContext(function($ctx1) {
  35520. return $recv($self._binding())._isArgVar();
  35521. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  35522. },
  35523. args: [],
  35524. source: "isArgument\x0a\x09^ self binding isArgVar",
  35525. referencedClasses: [],
  35526. messageSends: ["isArgVar", "binding"]
  35527. }),
  35528. $globals.VariableNode);
  35529. $core.addMethod(
  35530. $core.method({
  35531. selector: "isImmutable",
  35532. protocol: "testing",
  35533. fn: function (){
  35534. var self=this,$self=this;
  35535. return $core.withContext(function($ctx1) {
  35536. return $recv($self._binding())._isImmutable();
  35537. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  35538. },
  35539. args: [],
  35540. source: "isImmutable\x0a\x09^ self binding isImmutable",
  35541. referencedClasses: [],
  35542. messageSends: ["isImmutable", "binding"]
  35543. }),
  35544. $globals.VariableNode);
  35545. $core.addMethod(
  35546. $core.method({
  35547. selector: "isNavigationNode",
  35548. protocol: "testing",
  35549. fn: function (){
  35550. var self=this,$self=this;
  35551. return true;
  35552. },
  35553. args: [],
  35554. source: "isNavigationNode\x0a\x09^ true",
  35555. referencedClasses: [],
  35556. messageSends: []
  35557. }),
  35558. $globals.VariableNode);
  35559. $core.addMethod(
  35560. $core.method({
  35561. selector: "isSuperKeyword",
  35562. protocol: "testing",
  35563. fn: function (){
  35564. var self=this,$self=this;
  35565. return $core.withContext(function($ctx1) {
  35566. return $recv($self._value()).__eq("super");
  35567. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  35568. },
  35569. args: [],
  35570. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  35571. referencedClasses: [],
  35572. messageSends: ["=", "value"]
  35573. }),
  35574. $globals.VariableNode);
  35575. $core.addMethod(
  35576. $core.method({
  35577. selector: "isVariableNode",
  35578. protocol: "testing",
  35579. fn: function (){
  35580. var self=this,$self=this;
  35581. return true;
  35582. },
  35583. args: [],
  35584. source: "isVariableNode\x0a\x09^ true",
  35585. referencedClasses: [],
  35586. messageSends: []
  35587. }),
  35588. $globals.VariableNode);
  35589. $core.addMethod(
  35590. $core.method({
  35591. selector: "navigationLink",
  35592. protocol: "accessing",
  35593. fn: function (){
  35594. var self=this,$self=this;
  35595. return $core.withContext(function($ctx1) {
  35596. return $self._value();
  35597. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  35598. },
  35599. args: [],
  35600. source: "navigationLink\x0a\x09^ self value",
  35601. referencedClasses: [],
  35602. messageSends: ["value"]
  35603. }),
  35604. $globals.VariableNode);
  35605. $core.addClass("CompilerError", $globals.Error, [], "Compiler-AST");
  35606. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  35607. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  35608. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  35609. $core.addMethod(
  35610. $core.method({
  35611. selector: "visit:",
  35612. protocol: "visiting",
  35613. fn: function (aNode){
  35614. var self=this,$self=this;
  35615. return $core.withContext(function($ctx1) {
  35616. var $1;
  35617. $recv($self._path())._ifNotEmpty_((function(p){
  35618. return $core.withContext(function($ctx2) {
  35619. return $recv(aNode)._parent_($recv(p)._last());
  35620. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  35621. }));
  35622. $1=(
  35623. $ctx1.supercall = true,
  35624. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  35625. $ctx1.supercall = false;
  35626. return $1;
  35627. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  35628. },
  35629. args: ["aNode"],
  35630. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  35631. referencedClasses: [],
  35632. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  35633. }),
  35634. $globals.ParentFakingPathDagVisitor);
  35635. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  35636. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  35637. $core.addMethod(
  35638. $core.method({
  35639. selector: "visitAssignmentNode:",
  35640. protocol: "visiting",
  35641. fn: function (aNode){
  35642. var self=this,$self=this;
  35643. return $core.withContext(function($ctx1) {
  35644. return $self._visitDagNode_(aNode);
  35645. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  35646. },
  35647. args: ["aNode"],
  35648. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35649. referencedClasses: [],
  35650. messageSends: ["visitDagNode:"]
  35651. }),
  35652. $globals.NodeVisitor);
  35653. $core.addMethod(
  35654. $core.method({
  35655. selector: "visitBlockNode:",
  35656. protocol: "visiting",
  35657. fn: function (aNode){
  35658. var self=this,$self=this;
  35659. return $core.withContext(function($ctx1) {
  35660. return $self._visitDagNode_(aNode);
  35661. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  35662. },
  35663. args: ["aNode"],
  35664. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35665. referencedClasses: [],
  35666. messageSends: ["visitDagNode:"]
  35667. }),
  35668. $globals.NodeVisitor);
  35669. $core.addMethod(
  35670. $core.method({
  35671. selector: "visitBlockSequenceNode:",
  35672. protocol: "visiting",
  35673. fn: function (aNode){
  35674. var self=this,$self=this;
  35675. return $core.withContext(function($ctx1) {
  35676. return $self._visitSequenceNode_(aNode);
  35677. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35678. },
  35679. args: ["aNode"],
  35680. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  35681. referencedClasses: [],
  35682. messageSends: ["visitSequenceNode:"]
  35683. }),
  35684. $globals.NodeVisitor);
  35685. $core.addMethod(
  35686. $core.method({
  35687. selector: "visitCascadeNode:",
  35688. protocol: "visiting",
  35689. fn: function (aNode){
  35690. var self=this,$self=this;
  35691. return $core.withContext(function($ctx1) {
  35692. return $self._visitDagNode_(aNode);
  35693. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  35694. },
  35695. args: ["aNode"],
  35696. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35697. referencedClasses: [],
  35698. messageSends: ["visitDagNode:"]
  35699. }),
  35700. $globals.NodeVisitor);
  35701. $core.addMethod(
  35702. $core.method({
  35703. selector: "visitDagNode:",
  35704. protocol: "visiting",
  35705. fn: function (aNode){
  35706. var self=this,$self=this;
  35707. return $core.withContext(function($ctx1) {
  35708. return $self._visitDagNodeVariantSimple_(aNode);
  35709. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  35710. },
  35711. args: ["aNode"],
  35712. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  35713. referencedClasses: [],
  35714. messageSends: ["visitDagNodeVariantSimple:"]
  35715. }),
  35716. $globals.NodeVisitor);
  35717. $core.addMethod(
  35718. $core.method({
  35719. selector: "visitDynamicArrayNode:",
  35720. protocol: "visiting",
  35721. fn: function (aNode){
  35722. var self=this,$self=this;
  35723. return $core.withContext(function($ctx1) {
  35724. return $self._visitDagNode_(aNode);
  35725. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  35726. },
  35727. args: ["aNode"],
  35728. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35729. referencedClasses: [],
  35730. messageSends: ["visitDagNode:"]
  35731. }),
  35732. $globals.NodeVisitor);
  35733. $core.addMethod(
  35734. $core.method({
  35735. selector: "visitDynamicDictionaryNode:",
  35736. protocol: "visiting",
  35737. fn: function (aNode){
  35738. var self=this,$self=this;
  35739. return $core.withContext(function($ctx1) {
  35740. return $self._visitDagNode_(aNode);
  35741. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  35742. },
  35743. args: ["aNode"],
  35744. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35745. referencedClasses: [],
  35746. messageSends: ["visitDagNode:"]
  35747. }),
  35748. $globals.NodeVisitor);
  35749. $core.addMethod(
  35750. $core.method({
  35751. selector: "visitJSStatementNode:",
  35752. protocol: "visiting",
  35753. fn: function (aNode){
  35754. var self=this,$self=this;
  35755. return $core.withContext(function($ctx1) {
  35756. return $self._visitDagNode_(aNode);
  35757. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  35758. },
  35759. args: ["aNode"],
  35760. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35761. referencedClasses: [],
  35762. messageSends: ["visitDagNode:"]
  35763. }),
  35764. $globals.NodeVisitor);
  35765. $core.addMethod(
  35766. $core.method({
  35767. selector: "visitMethodNode:",
  35768. protocol: "visiting",
  35769. fn: function (aNode){
  35770. var self=this,$self=this;
  35771. return $core.withContext(function($ctx1) {
  35772. return $self._visitDagNode_(aNode);
  35773. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  35774. },
  35775. args: ["aNode"],
  35776. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35777. referencedClasses: [],
  35778. messageSends: ["visitDagNode:"]
  35779. }),
  35780. $globals.NodeVisitor);
  35781. $core.addMethod(
  35782. $core.method({
  35783. selector: "visitReturnNode:",
  35784. protocol: "visiting",
  35785. fn: function (aNode){
  35786. var self=this,$self=this;
  35787. return $core.withContext(function($ctx1) {
  35788. return $self._visitDagNode_(aNode);
  35789. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  35790. },
  35791. args: ["aNode"],
  35792. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35793. referencedClasses: [],
  35794. messageSends: ["visitDagNode:"]
  35795. }),
  35796. $globals.NodeVisitor);
  35797. $core.addMethod(
  35798. $core.method({
  35799. selector: "visitSendNode:",
  35800. protocol: "visiting",
  35801. fn: function (aNode){
  35802. var self=this,$self=this;
  35803. return $core.withContext(function($ctx1) {
  35804. return $self._visitDagNode_(aNode);
  35805. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  35806. },
  35807. args: ["aNode"],
  35808. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35809. referencedClasses: [],
  35810. messageSends: ["visitDagNode:"]
  35811. }),
  35812. $globals.NodeVisitor);
  35813. $core.addMethod(
  35814. $core.method({
  35815. selector: "visitSequenceNode:",
  35816. protocol: "visiting",
  35817. fn: function (aNode){
  35818. var self=this,$self=this;
  35819. return $core.withContext(function($ctx1) {
  35820. return $self._visitDagNode_(aNode);
  35821. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35822. },
  35823. args: ["aNode"],
  35824. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35825. referencedClasses: [],
  35826. messageSends: ["visitDagNode:"]
  35827. }),
  35828. $globals.NodeVisitor);
  35829. $core.addMethod(
  35830. $core.method({
  35831. selector: "visitValueNode:",
  35832. protocol: "visiting",
  35833. fn: function (aNode){
  35834. var self=this,$self=this;
  35835. return $core.withContext(function($ctx1) {
  35836. return $self._visitDagNode_(aNode);
  35837. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  35838. },
  35839. args: ["aNode"],
  35840. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35841. referencedClasses: [],
  35842. messageSends: ["visitDagNode:"]
  35843. }),
  35844. $globals.NodeVisitor);
  35845. $core.addMethod(
  35846. $core.method({
  35847. selector: "visitVariableNode:",
  35848. protocol: "visiting",
  35849. fn: function (aNode){
  35850. var self=this,$self=this;
  35851. return $core.withContext(function($ctx1) {
  35852. return $self._visitDagNode_(aNode);
  35853. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  35854. },
  35855. args: ["aNode"],
  35856. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35857. referencedClasses: [],
  35858. messageSends: ["visitDagNode:"]
  35859. }),
  35860. $globals.NodeVisitor);
  35861. $core.addMethod(
  35862. $core.method({
  35863. selector: "ast",
  35864. protocol: "*Compiler-AST",
  35865. fn: function (){
  35866. var self=this,$self=this;
  35867. return $core.withContext(function($ctx1) {
  35868. var $1;
  35869. $1=$self._source();
  35870. $ctx1.sendIdx["source"]=1;
  35871. $recv($1)._ifEmpty_((function(){
  35872. return $core.withContext(function($ctx2) {
  35873. return $recv($globals.CompilerError)._signal_("Method source is empty");
  35874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35875. }));
  35876. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_($self._source(),$self._methodClass(),$self._protocol());
  35877. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  35878. },
  35879. args: [],
  35880. source: "ast\x0a\x09self source ifEmpty: [ CompilerError signal: 'Method source is empty' ].\x0a\x09\x0a\x09^ Compiler new\x0a\x09\x09ast: self source\x0a\x09\x09forClass: self methodClass\x0a\x09\x09protocol: self protocol",
  35881. referencedClasses: ["CompilerError", "Compiler"],
  35882. messageSends: ["ifEmpty:", "source", "signal:", "ast:forClass:protocol:", "new", "methodClass", "protocol"]
  35883. }),
  35884. $globals.CompiledMethod);
  35885. });
  35886. define('amber/core/Compiler-Core',["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Kernel-Collections", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  35887. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  35888. var $pkg = $core.addPackage("Compiler-Core");
  35889. $pkg.innerEval = function (expr) { return eval(expr); };
  35890. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  35891. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  35892. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  35893. $core.addMethod(
  35894. $core.method({
  35895. selector: "compileNode:",
  35896. protocol: "compiling",
  35897. fn: function (aNode){
  35898. var self=this,$self=this;
  35899. return $core.withContext(function($ctx1) {
  35900. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  35901. return $core.withContext(function($ctx2) {
  35902. return $recv(transformer)._value_(input);
  35903. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  35904. }));
  35905. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  35906. },
  35907. args: ["aNode"],
  35908. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  35909. referencedClasses: [],
  35910. messageSends: ["inject:into:", "transformers", "value:"]
  35911. }),
  35912. $globals.AbstractCodeGenerator);
  35913. $core.addMethod(
  35914. $core.method({
  35915. selector: "currentClass",
  35916. protocol: "accessing",
  35917. fn: function (){
  35918. var self=this,$self=this;
  35919. return $self.currentClass;
  35920. },
  35921. args: [],
  35922. source: "currentClass\x0a\x09^ currentClass",
  35923. referencedClasses: [],
  35924. messageSends: []
  35925. }),
  35926. $globals.AbstractCodeGenerator);
  35927. $core.addMethod(
  35928. $core.method({
  35929. selector: "currentClass:",
  35930. protocol: "accessing",
  35931. fn: function (aClass){
  35932. var self=this,$self=this;
  35933. $self.currentClass=aClass;
  35934. return self;
  35935. },
  35936. args: ["aClass"],
  35937. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  35938. referencedClasses: [],
  35939. messageSends: []
  35940. }),
  35941. $globals.AbstractCodeGenerator);
  35942. $core.addMethod(
  35943. $core.method({
  35944. selector: "currentPackage",
  35945. protocol: "accessing",
  35946. fn: function (){
  35947. var self=this,$self=this;
  35948. return $self.currentPackage;
  35949. },
  35950. args: [],
  35951. source: "currentPackage\x0a\x09^ currentPackage",
  35952. referencedClasses: [],
  35953. messageSends: []
  35954. }),
  35955. $globals.AbstractCodeGenerator);
  35956. $core.addMethod(
  35957. $core.method({
  35958. selector: "currentPackage:",
  35959. protocol: "accessing",
  35960. fn: function (anObject){
  35961. var self=this,$self=this;
  35962. $self.currentPackage=anObject;
  35963. return self;
  35964. },
  35965. args: ["anObject"],
  35966. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  35967. referencedClasses: [],
  35968. messageSends: []
  35969. }),
  35970. $globals.AbstractCodeGenerator);
  35971. $core.addMethod(
  35972. $core.method({
  35973. selector: "pseudoVariables",
  35974. protocol: "accessing",
  35975. fn: function (){
  35976. var self=this,$self=this;
  35977. return $core.withContext(function($ctx1) {
  35978. return $recv($globals.Smalltalk)._pseudoVariableNames();
  35979. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  35980. },
  35981. args: [],
  35982. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  35983. referencedClasses: ["Smalltalk"],
  35984. messageSends: ["pseudoVariableNames"]
  35985. }),
  35986. $globals.AbstractCodeGenerator);
  35987. $core.addMethod(
  35988. $core.method({
  35989. selector: "source",
  35990. protocol: "accessing",
  35991. fn: function (){
  35992. var self=this,$self=this;
  35993. return $core.withContext(function($ctx1) {
  35994. var $1,$receiver;
  35995. $1=$self.source;
  35996. if(($receiver = $1) == null || $receiver.a$nil){
  35997. return "";
  35998. } else {
  35999. return $1;
  36000. }
  36001. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  36002. },
  36003. args: [],
  36004. source: "source\x0a\x09^ source ifNil: [ '' ]",
  36005. referencedClasses: [],
  36006. messageSends: ["ifNil:"]
  36007. }),
  36008. $globals.AbstractCodeGenerator);
  36009. $core.addMethod(
  36010. $core.method({
  36011. selector: "source:",
  36012. protocol: "accessing",
  36013. fn: function (aString){
  36014. var self=this,$self=this;
  36015. $self.source=aString;
  36016. return self;
  36017. },
  36018. args: ["aString"],
  36019. source: "source: aString\x0a\x09source := aString",
  36020. referencedClasses: [],
  36021. messageSends: []
  36022. }),
  36023. $globals.AbstractCodeGenerator);
  36024. $core.addMethod(
  36025. $core.method({
  36026. selector: "transformers",
  36027. protocol: "compiling",
  36028. fn: function (){
  36029. var self=this,$self=this;
  36030. var dict;
  36031. return $core.withContext(function($ctx1) {
  36032. dict=$self._transformersDictionary();
  36033. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  36034. return $core.withContext(function($ctx2) {
  36035. return $recv(dict)._at_(each);
  36036. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36037. }));
  36038. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  36039. },
  36040. args: [],
  36041. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  36042. referencedClasses: [],
  36043. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  36044. }),
  36045. $globals.AbstractCodeGenerator);
  36046. $core.addMethod(
  36047. $core.method({
  36048. selector: "transformersDictionary",
  36049. protocol: "compiling",
  36050. fn: function (){
  36051. var self=this,$self=this;
  36052. return $core.withContext(function($ctx1) {
  36053. $self._subclassResponsibility();
  36054. return self;
  36055. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  36056. },
  36057. args: [],
  36058. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  36059. referencedClasses: [],
  36060. messageSends: ["subclassResponsibility"]
  36061. }),
  36062. $globals.AbstractCodeGenerator);
  36063. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  36064. $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.";
  36065. $core.addMethod(
  36066. $core.method({
  36067. selector: "irTranslator",
  36068. protocol: "compiling",
  36069. fn: function (){
  36070. var self=this,$self=this;
  36071. return $core.withContext(function($ctx1) {
  36072. var $1;
  36073. $1=$recv($self._irTranslatorClass())._new();
  36074. $recv($1)._currentClass_($self._currentClass());
  36075. return $recv($1)._yourself();
  36076. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  36077. },
  36078. args: [],
  36079. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  36080. referencedClasses: [],
  36081. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  36082. }),
  36083. $globals.CodeGenerator);
  36084. $core.addMethod(
  36085. $core.method({
  36086. selector: "irTranslatorClass",
  36087. protocol: "compiling",
  36088. fn: function (){
  36089. var self=this,$self=this;
  36090. return $globals.IRJSTranslator;
  36091. },
  36092. args: [],
  36093. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  36094. referencedClasses: ["IRJSTranslator"],
  36095. messageSends: []
  36096. }),
  36097. $globals.CodeGenerator);
  36098. $core.addMethod(
  36099. $core.method({
  36100. selector: "semanticAnalyzer",
  36101. protocol: "compiling",
  36102. fn: function (){
  36103. var self=this,$self=this;
  36104. return $core.withContext(function($ctx1) {
  36105. var $1;
  36106. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  36107. $recv($1)._thePackage_($self._currentPackage());
  36108. return $recv($1)._yourself();
  36109. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  36110. },
  36111. args: [],
  36112. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  36113. referencedClasses: ["SemanticAnalyzer"],
  36114. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  36115. }),
  36116. $globals.CodeGenerator);
  36117. $core.addMethod(
  36118. $core.method({
  36119. selector: "transformersDictionary",
  36120. protocol: "compiling",
  36121. fn: function (){
  36122. var self=this,$self=this;
  36123. return $core.withContext(function($ctx1) {
  36124. var $1,$2,$receiver;
  36125. $1=$self.transformersDictionary;
  36126. if(($receiver = $1) == null || $receiver.a$nil){
  36127. $2=$recv($globals.Dictionary)._new();
  36128. $ctx1.sendIdx["new"]=1;
  36129. $recv($2)._at_put_("1000-earlyPragmas",$recv($globals.EarlyPragmator)._new());
  36130. $ctx1.sendIdx["at:put:"]=1;
  36131. $recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer());
  36132. $ctx1.sendIdx["at:put:"]=2;
  36133. $recv($2)._at_put_("5000-astToIr",$self._translator());
  36134. $ctx1.sendIdx["at:put:"]=3;
  36135. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  36136. $self.transformersDictionary=$recv($2)._yourself();
  36137. return $self.transformersDictionary;
  36138. } else {
  36139. return $1;
  36140. }
  36141. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  36142. },
  36143. args: [],
  36144. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary new\x0a\x09\x09at: '1000-earlyPragmas' put: EarlyPragmator new;\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  36145. referencedClasses: ["Dictionary", "EarlyPragmator"],
  36146. messageSends: ["ifNil:", "at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  36147. }),
  36148. $globals.CodeGenerator);
  36149. $core.addMethod(
  36150. $core.method({
  36151. selector: "translator",
  36152. protocol: "compiling",
  36153. fn: function (){
  36154. var self=this,$self=this;
  36155. return $core.withContext(function($ctx1) {
  36156. var $1;
  36157. $1=$recv($globals.IRASTTranslator)._new();
  36158. $recv($1)._source_($self._source());
  36159. $recv($1)._theClass_($self._currentClass());
  36160. return $recv($1)._yourself();
  36161. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  36162. },
  36163. args: [],
  36164. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  36165. referencedClasses: ["IRASTTranslator"],
  36166. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  36167. }),
  36168. $globals.CodeGenerator);
  36169. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "codeGeneratorClass", "codeGenerator"], "Compiler-Core");
  36170. $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`";
  36171. $core.addMethod(
  36172. $core.method({
  36173. selector: "ast:forClass:protocol:",
  36174. protocol: "compiling",
  36175. fn: function (aString,aClass,anotherString){
  36176. var self=this,$self=this;
  36177. return $core.withContext(function($ctx1) {
  36178. var $early={};
  36179. try {
  36180. $self._source_(aString);
  36181. $self._forClass_protocol_(aClass,anotherString);
  36182. $recv($recv($self._codeGenerator())._transformersDictionary())._at_put_("2500-astCheckpoint",(function(x){
  36183. throw $early=[x];
  36184. }));
  36185. $self._compileNode_($self._parse_(aString));
  36186. $recv($globals.CompilerError)._signal_("AST transformation failed.");
  36187. return self;
  36188. }
  36189. catch(e) {if(e===$early)return e[0]; throw e}
  36190. }, function($ctx1) {$ctx1.fill(self,"ast:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36191. },
  36192. args: ["aString", "aClass", "anotherString"],
  36193. source: "ast: aString forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString.\x0a\x0a\x09self codeGenerator transformersDictionary at: '2500-astCheckpoint' put: [ :x | ^x ].\x0a\x09\x0a\x09self compileNode: (self parse: aString).\x0a\x0a\x09CompilerError signal: 'AST transformation failed.'",
  36194. referencedClasses: ["CompilerError"],
  36195. messageSends: ["source:", "forClass:protocol:", "at:put:", "transformersDictionary", "codeGenerator", "compileNode:", "parse:", "signal:"]
  36196. }),
  36197. $globals.Compiler);
  36198. $core.addMethod(
  36199. $core.method({
  36200. selector: "cleanCodeGenerator",
  36201. protocol: "accessing",
  36202. fn: function (){
  36203. var self=this,$self=this;
  36204. $self.codeGenerator=nil;
  36205. return self;
  36206. },
  36207. args: [],
  36208. source: "cleanCodeGenerator\x0a\x09codeGenerator := nil",
  36209. referencedClasses: [],
  36210. messageSends: []
  36211. }),
  36212. $globals.Compiler);
  36213. $core.addMethod(
  36214. $core.method({
  36215. selector: "codeGenerator",
  36216. protocol: "accessing",
  36217. fn: function (){
  36218. var self=this,$self=this;
  36219. return $core.withContext(function($ctx1) {
  36220. var $1,$2,$receiver;
  36221. $1=$self.codeGenerator;
  36222. if(($receiver = $1) == null || $receiver.a$nil){
  36223. $2=$recv($self._codeGeneratorClass())._new();
  36224. $recv($2)._source_($self._source());
  36225. $recv($2)._currentClass_($self._currentClass());
  36226. $recv($2)._currentPackage_($self._currentPackage());
  36227. $self.codeGenerator=$recv($2)._yourself();
  36228. return $self.codeGenerator;
  36229. } else {
  36230. return $1;
  36231. }
  36232. }, function($ctx1) {$ctx1.fill(self,"codeGenerator",{},$globals.Compiler)});
  36233. },
  36234. args: [],
  36235. source: "codeGenerator\x0a\x09^ codeGenerator ifNil: [ codeGenerator := self codeGeneratorClass new\x0a\x09\x09\x09source: self source;\x0a\x09\x09\x09currentClass: self currentClass;\x0a\x09\x09\x09currentPackage: self currentPackage;\x0a\x09\x09\x09yourself ]",
  36236. referencedClasses: [],
  36237. messageSends: ["ifNil:", "source:", "new", "codeGeneratorClass", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "yourself"]
  36238. }),
  36239. $globals.Compiler);
  36240. $core.addMethod(
  36241. $core.method({
  36242. selector: "codeGeneratorClass",
  36243. protocol: "accessing",
  36244. fn: function (){
  36245. var self=this,$self=this;
  36246. return $core.withContext(function($ctx1) {
  36247. var $1,$receiver;
  36248. $1=$self.codeGeneratorClass;
  36249. if(($receiver = $1) == null || $receiver.a$nil){
  36250. return $globals.InliningCodeGenerator;
  36251. } else {
  36252. return $1;
  36253. }
  36254. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  36255. },
  36256. args: [],
  36257. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  36258. referencedClasses: ["InliningCodeGenerator"],
  36259. messageSends: ["ifNil:"]
  36260. }),
  36261. $globals.Compiler);
  36262. $core.addMethod(
  36263. $core.method({
  36264. selector: "codeGeneratorClass:",
  36265. protocol: "accessing",
  36266. fn: function (aClass){
  36267. var self=this,$self=this;
  36268. $self.codeGeneratorClass=aClass;
  36269. return self;
  36270. },
  36271. args: ["aClass"],
  36272. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  36273. referencedClasses: [],
  36274. messageSends: []
  36275. }),
  36276. $globals.Compiler);
  36277. $core.addMethod(
  36278. $core.method({
  36279. selector: "compile:forClass:protocol:",
  36280. protocol: "compiling",
  36281. fn: function (aString,aClass,anotherString){
  36282. var self=this,$self=this;
  36283. return $core.withContext(function($ctx1) {
  36284. $self._source_(aString);
  36285. $self._forClass_protocol_(aClass,anotherString);
  36286. return $self._compileNode_($self._parse_(aString));
  36287. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36288. },
  36289. args: ["aString", "aClass", "anotherString"],
  36290. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString;\x0a\x09\x09compileNode: (self parse: aString)",
  36291. referencedClasses: [],
  36292. messageSends: ["source:", "forClass:protocol:", "compileNode:", "parse:"]
  36293. }),
  36294. $globals.Compiler);
  36295. $core.addMethod(
  36296. $core.method({
  36297. selector: "compileExpression:on:",
  36298. protocol: "compiling",
  36299. fn: function (aString,anObject){
  36300. var self=this,$self=this;
  36301. return $core.withContext(function($ctx1) {
  36302. var $1;
  36303. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  36304. $ctx1.sendIdx[","]=1;
  36305. return $self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  36306. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  36307. },
  36308. args: ["aString", "anObject"],
  36309. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  36310. referencedClasses: [],
  36311. messageSends: ["compile:forClass:protocol:", ",", "class"]
  36312. }),
  36313. $globals.Compiler);
  36314. $core.addMethod(
  36315. $core.method({
  36316. selector: "compileNode:",
  36317. protocol: "compiling",
  36318. fn: function (aNode){
  36319. var self=this,$self=this;
  36320. var result;
  36321. return $core.withContext(function($ctx1) {
  36322. result=$recv($self._codeGenerator())._compileNode_(aNode);
  36323. $self._cleanCodeGenerator();
  36324. return result;
  36325. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,result:result},$globals.Compiler)});
  36326. },
  36327. args: ["aNode"],
  36328. source: "compileNode: aNode\x0a | result |\x0a\x09result := self codeGenerator compileNode: aNode.\x0a\x09self cleanCodeGenerator.\x0a\x09^ result",
  36329. referencedClasses: [],
  36330. messageSends: ["compileNode:", "codeGenerator", "cleanCodeGenerator"]
  36331. }),
  36332. $globals.Compiler);
  36333. $core.addMethod(
  36334. $core.method({
  36335. selector: "currentClass",
  36336. protocol: "accessing",
  36337. fn: function (){
  36338. var self=this,$self=this;
  36339. return $self.currentClass;
  36340. },
  36341. args: [],
  36342. source: "currentClass\x0a\x09^ currentClass",
  36343. referencedClasses: [],
  36344. messageSends: []
  36345. }),
  36346. $globals.Compiler);
  36347. $core.addMethod(
  36348. $core.method({
  36349. selector: "currentClass:",
  36350. protocol: "accessing",
  36351. fn: function (aClass){
  36352. var self=this,$self=this;
  36353. $self.currentClass=aClass;
  36354. return self;
  36355. },
  36356. args: ["aClass"],
  36357. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  36358. referencedClasses: [],
  36359. messageSends: []
  36360. }),
  36361. $globals.Compiler);
  36362. $core.addMethod(
  36363. $core.method({
  36364. selector: "currentPackage",
  36365. protocol: "accessing",
  36366. fn: function (){
  36367. var self=this,$self=this;
  36368. return $self.currentPackage;
  36369. },
  36370. args: [],
  36371. source: "currentPackage\x0a\x09^ currentPackage",
  36372. referencedClasses: [],
  36373. messageSends: []
  36374. }),
  36375. $globals.Compiler);
  36376. $core.addMethod(
  36377. $core.method({
  36378. selector: "currentPackage:",
  36379. protocol: "accessing",
  36380. fn: function (anObject){
  36381. var self=this,$self=this;
  36382. $self.currentPackage=anObject;
  36383. return self;
  36384. },
  36385. args: ["anObject"],
  36386. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  36387. referencedClasses: [],
  36388. messageSends: []
  36389. }),
  36390. $globals.Compiler);
  36391. $core.addMethod(
  36392. $core.method({
  36393. selector: "eval:",
  36394. protocol: "compiling",
  36395. fn: function (aString){
  36396. var self=this,$self=this;
  36397. return $core.withContext(function($ctx1) {
  36398. return eval(aString);
  36399. return self;
  36400. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  36401. },
  36402. args: ["aString"],
  36403. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  36404. referencedClasses: [],
  36405. messageSends: []
  36406. }),
  36407. $globals.Compiler);
  36408. $core.addMethod(
  36409. $core.method({
  36410. selector: "eval:forPackage:",
  36411. protocol: "compiling",
  36412. fn: function (aString,aPackage){
  36413. var self=this,$self=this;
  36414. return $core.withContext(function($ctx1) {
  36415. var $receiver;
  36416. if(($receiver = aPackage) == null || $receiver.a$nil){
  36417. return $self._eval_(aString);
  36418. $ctx1.sendIdx["eval:"]=1;
  36419. } else {
  36420. return $recv(aPackage)._eval_(aString);
  36421. }
  36422. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  36423. },
  36424. args: ["aString", "aPackage"],
  36425. source: "eval: aString forPackage: aPackage\x0a\x09^ aPackage\x0a\x09\x09ifNil: [ self eval: aString ]\x0a\x09\x09ifNotNil: [ aPackage eval: aString ]",
  36426. referencedClasses: [],
  36427. messageSends: ["ifNil:ifNotNil:", "eval:"]
  36428. }),
  36429. $globals.Compiler);
  36430. $core.addMethod(
  36431. $core.method({
  36432. selector: "evaluateExpression:",
  36433. protocol: "compiling",
  36434. fn: function (aString){
  36435. var self=this,$self=this;
  36436. return $core.withContext(function($ctx1) {
  36437. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  36438. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  36439. },
  36440. args: ["aString"],
  36441. 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",
  36442. referencedClasses: ["DoIt"],
  36443. messageSends: ["evaluateExpression:on:", "new"]
  36444. }),
  36445. $globals.Compiler);
  36446. $core.addMethod(
  36447. $core.method({
  36448. selector: "evaluateExpression:on:",
  36449. protocol: "compiling",
  36450. fn: function (aString,anObject){
  36451. var self=this,$self=this;
  36452. var result,method;
  36453. return $core.withContext(function($ctx1) {
  36454. var $1;
  36455. method=$self._eval_($self._compileExpression_on_(aString,anObject));
  36456. $recv(method)._protocol_("**xxxDoIt");
  36457. $1=$recv(anObject)._class();
  36458. $ctx1.sendIdx["class"]=1;
  36459. $recv($1)._addCompiledMethod_(method);
  36460. result=$recv(anObject)._xxxDoIt();
  36461. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  36462. return result;
  36463. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  36464. },
  36465. args: ["aString", "anObject"],
  36466. 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",
  36467. referencedClasses: [],
  36468. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  36469. }),
  36470. $globals.Compiler);
  36471. $core.addMethod(
  36472. $core.method({
  36473. selector: "forClass:protocol:",
  36474. protocol: "compiling",
  36475. fn: function (aClass,anotherString){
  36476. var self=this,$self=this;
  36477. return $core.withContext(function($ctx1) {
  36478. $self._currentPackage_($recv(aClass)._packageOfProtocol_(anotherString));
  36479. $self._currentClass_(aClass);
  36480. return self;
  36481. }, function($ctx1) {$ctx1.fill(self,"forClass:protocol:",{aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36482. },
  36483. args: ["aClass", "anotherString"],
  36484. source: "forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09currentPackage: (aClass packageOfProtocol: anotherString);\x0a\x09\x09currentClass: aClass",
  36485. referencedClasses: [],
  36486. messageSends: ["currentPackage:", "packageOfProtocol:", "currentClass:"]
  36487. }),
  36488. $globals.Compiler);
  36489. $core.addMethod(
  36490. $core.method({
  36491. selector: "install:forClass:protocol:",
  36492. protocol: "compiling",
  36493. fn: function (aString,aBehavior,anotherString){
  36494. var self=this,$self=this;
  36495. var compiledMethod;
  36496. return $core.withContext(function($ctx1) {
  36497. compiledMethod=$self._eval_forPackage_($self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  36498. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  36499. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  36500. },
  36501. args: ["aString", "aBehavior", "anotherString"],
  36502. 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",
  36503. referencedClasses: ["ClassBuilder"],
  36504. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  36505. }),
  36506. $globals.Compiler);
  36507. $core.addMethod(
  36508. $core.method({
  36509. selector: "parse:",
  36510. protocol: "compiling",
  36511. fn: function (aString){
  36512. var self=this,$self=this;
  36513. return $core.withContext(function($ctx1) {
  36514. return $recv($globals.Smalltalk)._parse_(aString);
  36515. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  36516. },
  36517. args: ["aString"],
  36518. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  36519. referencedClasses: ["Smalltalk"],
  36520. messageSends: ["parse:"]
  36521. }),
  36522. $globals.Compiler);
  36523. $core.addMethod(
  36524. $core.method({
  36525. selector: "parseExpression:",
  36526. protocol: "compiling",
  36527. fn: function (aString){
  36528. var self=this,$self=this;
  36529. return $core.withContext(function($ctx1) {
  36530. var $1;
  36531. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  36532. $ctx1.sendIdx[","]=1;
  36533. return $self._parse_($1);
  36534. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  36535. },
  36536. args: ["aString"],
  36537. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  36538. referencedClasses: [],
  36539. messageSends: ["parse:", ","]
  36540. }),
  36541. $globals.Compiler);
  36542. $core.addMethod(
  36543. $core.method({
  36544. selector: "recompile:",
  36545. protocol: "compiling",
  36546. fn: function (aClass){
  36547. var self=this,$self=this;
  36548. return $core.withContext(function($ctx1) {
  36549. var $1,$2,$3,$receiver;
  36550. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  36551. return $core.withContext(function($ctx2) {
  36552. $1=$recv($recv(each)._methodClass()).__eq(aClass);
  36553. $ctx2.sendIdx["="]=1;
  36554. if($core.assert($1)){
  36555. return $self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  36556. }
  36557. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36558. }),"Recompiling ".__comma($recv(aClass)._name()));
  36559. $2=$recv(aClass)._theMetaClass();
  36560. if(($receiver = $2) == null || $receiver.a$nil){
  36561. $2;
  36562. } else {
  36563. var meta;
  36564. meta=$receiver;
  36565. $3=$recv(meta).__eq(aClass);
  36566. if(!$core.assert($3)){
  36567. $self._recompile_(meta);
  36568. }
  36569. }
  36570. return self;
  36571. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  36572. },
  36573. args: ["aClass"],
  36574. 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 ] ]",
  36575. referencedClasses: [],
  36576. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
  36577. }),
  36578. $globals.Compiler);
  36579. $core.addMethod(
  36580. $core.method({
  36581. selector: "recompileAll",
  36582. protocol: "compiling",
  36583. fn: function (){
  36584. var self=this,$self=this;
  36585. return $core.withContext(function($ctx1) {
  36586. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  36587. return $core.withContext(function($ctx2) {
  36588. return $self._recompile_(each);
  36589. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36590. }),"Compiling all classes...");
  36591. return self;
  36592. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  36593. },
  36594. args: [],
  36595. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  36596. referencedClasses: ["Smalltalk"],
  36597. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  36598. }),
  36599. $globals.Compiler);
  36600. $core.addMethod(
  36601. $core.method({
  36602. selector: "source",
  36603. protocol: "accessing",
  36604. fn: function (){
  36605. var self=this,$self=this;
  36606. return $core.withContext(function($ctx1) {
  36607. var $1,$receiver;
  36608. $1=$self.source;
  36609. if(($receiver = $1) == null || $receiver.a$nil){
  36610. return "";
  36611. } else {
  36612. return $1;
  36613. }
  36614. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  36615. },
  36616. args: [],
  36617. source: "source\x0a\x09^ source ifNil: [ '' ]",
  36618. referencedClasses: [],
  36619. messageSends: ["ifNil:"]
  36620. }),
  36621. $globals.Compiler);
  36622. $core.addMethod(
  36623. $core.method({
  36624. selector: "source:",
  36625. protocol: "accessing",
  36626. fn: function (aString){
  36627. var self=this,$self=this;
  36628. $self.source=aString;
  36629. return self;
  36630. },
  36631. args: ["aString"],
  36632. source: "source: aString\x0a\x09source := aString",
  36633. referencedClasses: [],
  36634. messageSends: []
  36635. }),
  36636. $globals.Compiler);
  36637. $core.addMethod(
  36638. $core.method({
  36639. selector: "eval:",
  36640. protocol: "evaluating",
  36641. fn: function (aString){
  36642. var self=this,$self=this;
  36643. return $core.withContext(function($ctx1) {
  36644. return $recv($self._new())._eval_(aString);
  36645. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler.a$cls)});
  36646. },
  36647. args: ["aString"],
  36648. source: "eval: aString\x0a\x09^ self new eval: aString",
  36649. referencedClasses: [],
  36650. messageSends: ["eval:", "new"]
  36651. }),
  36652. $globals.Compiler.a$cls);
  36653. $core.addMethod(
  36654. $core.method({
  36655. selector: "recompile:",
  36656. protocol: "compiling",
  36657. fn: function (aClass){
  36658. var self=this,$self=this;
  36659. return $core.withContext(function($ctx1) {
  36660. $recv($self._new())._recompile_(aClass);
  36661. return self;
  36662. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.a$cls)});
  36663. },
  36664. args: ["aClass"],
  36665. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  36666. referencedClasses: [],
  36667. messageSends: ["recompile:", "new"]
  36668. }),
  36669. $globals.Compiler.a$cls);
  36670. $core.addMethod(
  36671. $core.method({
  36672. selector: "recompileAll",
  36673. protocol: "compiling",
  36674. fn: function (){
  36675. var self=this,$self=this;
  36676. return $core.withContext(function($ctx1) {
  36677. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  36678. return $core.withContext(function($ctx2) {
  36679. return $self._recompile_(each);
  36680. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36681. }));
  36682. return self;
  36683. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.a$cls)});
  36684. },
  36685. args: [],
  36686. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  36687. referencedClasses: ["Smalltalk"],
  36688. messageSends: ["do:", "classes", "recompile:"]
  36689. }),
  36690. $globals.Compiler.a$cls);
  36691. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  36692. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  36693. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  36694. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  36695. $core.addMethod(
  36696. $core.method({
  36697. selector: "evaluate:context:",
  36698. protocol: "evaluating",
  36699. fn: function (aString,aContext){
  36700. var self=this,$self=this;
  36701. var compiler,ast;
  36702. return $core.withContext(function($ctx1) {
  36703. var $1;
  36704. var $early={};
  36705. try {
  36706. compiler=$recv($globals.Compiler)._new();
  36707. $recv((function(){
  36708. return $core.withContext(function($ctx2) {
  36709. ast=$recv(compiler)._parseExpression_(aString);
  36710. return ast;
  36711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36712. }))._on_do_($globals.Error,(function(ex){
  36713. return $core.withContext(function($ctx2) {
  36714. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36715. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36716. }));
  36717. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  36718. $recv($1)._context_(aContext);
  36719. $recv($1)._visit_(ast);
  36720. return $recv(aContext)._evaluateNode_(ast);
  36721. }
  36722. catch(e) {if(e===$early)return e[0]; throw e}
  36723. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  36724. },
  36725. args: ["aString", "aContext"],
  36726. 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",
  36727. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  36728. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  36729. }),
  36730. $globals.Evaluator);
  36731. $core.addMethod(
  36732. $core.method({
  36733. selector: "evaluate:for:",
  36734. protocol: "evaluating",
  36735. fn: function (aString,anObject){
  36736. var self=this,$self=this;
  36737. return $core.withContext(function($ctx1) {
  36738. return $recv(anObject)._evaluate_on_(aString,self);
  36739. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  36740. },
  36741. args: ["aString", "anObject"],
  36742. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  36743. referencedClasses: [],
  36744. messageSends: ["evaluate:on:"]
  36745. }),
  36746. $globals.Evaluator);
  36747. $core.addMethod(
  36748. $core.method({
  36749. selector: "evaluate:receiver:",
  36750. protocol: "evaluating",
  36751. fn: function (aString,anObject){
  36752. var self=this,$self=this;
  36753. var compiler;
  36754. return $core.withContext(function($ctx1) {
  36755. var $early={};
  36756. try {
  36757. compiler=$recv($globals.Compiler)._new();
  36758. $recv((function(){
  36759. return $core.withContext(function($ctx2) {
  36760. return $recv(compiler)._parseExpression_(aString);
  36761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36762. }))._on_do_($globals.Error,(function(ex){
  36763. return $core.withContext(function($ctx2) {
  36764. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36765. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36766. }));
  36767. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  36768. }
  36769. catch(e) {if(e===$early)return e[0]; throw e}
  36770. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  36771. },
  36772. args: ["aString", "anObject"],
  36773. 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",
  36774. referencedClasses: ["Compiler", "Error", "Terminal"],
  36775. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  36776. }),
  36777. $globals.Evaluator);
  36778. $core.addMethod(
  36779. $core.method({
  36780. selector: "evaluate:for:",
  36781. protocol: "instance creation",
  36782. fn: function (aString,anObject){
  36783. var self=this,$self=this;
  36784. return $core.withContext(function($ctx1) {
  36785. return $recv($self._new())._evaluate_for_(aString,anObject);
  36786. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.a$cls)});
  36787. },
  36788. args: ["aString", "anObject"],
  36789. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  36790. referencedClasses: [],
  36791. messageSends: ["evaluate:for:", "new"]
  36792. }),
  36793. $globals.Evaluator.a$cls);
  36794. $core.addClass("Pragmator", $globals.NodeVisitor, ["methodNode", "sequenceNode"], "Compiler-Core");
  36795. $globals.Pragmator.comment="I am abstract superclass for pragma-processing transformer.\x0a\x0aMy subclasses should implement messages for each pragma\x0athey process. Pragma processing checks if a message is known\x0ato a class but not to its superclass. IOW, each and only those\x0apragmas are processed which are defined as methods in the subclass.\x0a\x0aThese messages can access sequence node in which\x0aa pragma occurred and its containing method node\x0aas `self sequenceNode` and `self methodNode`.\x0a\x0aSee `EarlyPragmator` for an example.";
  36796. $core.addMethod(
  36797. $core.method({
  36798. selector: "canProcessPragma:",
  36799. protocol: "pragma processing",
  36800. fn: function (aMessage){
  36801. var self=this,$self=this;
  36802. var selector;
  36803. return $core.withContext(function($ctx1) {
  36804. selector=$recv(aMessage)._selector();
  36805. return $recv($self._respondsTo_(selector))._and_((function(){
  36806. return $core.withContext(function($ctx2) {
  36807. return $recv($recv($recv($self._class())._superclass())._canUnderstand_(selector))._not();
  36808. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36809. }));
  36810. }, function($ctx1) {$ctx1.fill(self,"canProcessPragma:",{aMessage:aMessage,selector:selector},$globals.Pragmator)});
  36811. },
  36812. args: ["aMessage"],
  36813. source: "canProcessPragma: aMessage\x0a\x09| selector |\x0a\x09selector := aMessage selector.\x0a\x09^ (self respondsTo: selector) and: [\x0a\x09\x09(self class superclass canUnderstand: selector) not]",
  36814. referencedClasses: [],
  36815. messageSends: ["selector", "and:", "respondsTo:", "not", "canUnderstand:", "superclass", "class"]
  36816. }),
  36817. $globals.Pragmator);
  36818. $core.addMethod(
  36819. $core.method({
  36820. selector: "methodNode",
  36821. protocol: "accessing",
  36822. fn: function (){
  36823. var self=this,$self=this;
  36824. return $self.methodNode;
  36825. },
  36826. args: [],
  36827. source: "methodNode\x0a\x09^ methodNode",
  36828. referencedClasses: [],
  36829. messageSends: []
  36830. }),
  36831. $globals.Pragmator);
  36832. $core.addMethod(
  36833. $core.method({
  36834. selector: "methodNode:",
  36835. protocol: "accessing",
  36836. fn: function (anObject){
  36837. var self=this,$self=this;
  36838. $self.methodNode=anObject;
  36839. return self;
  36840. },
  36841. args: ["anObject"],
  36842. source: "methodNode: anObject\x0a\x09methodNode := anObject",
  36843. referencedClasses: [],
  36844. messageSends: []
  36845. }),
  36846. $globals.Pragmator);
  36847. $core.addMethod(
  36848. $core.method({
  36849. selector: "processPragma:",
  36850. protocol: "pragma processing",
  36851. fn: function (aMessage){
  36852. var self=this,$self=this;
  36853. return $core.withContext(function($ctx1) {
  36854. var $1;
  36855. $1=$self._canProcessPragma_(aMessage);
  36856. if($core.assert($1)){
  36857. return $recv(aMessage)._sendTo_(self);
  36858. }
  36859. return self;
  36860. }, function($ctx1) {$ctx1.fill(self,"processPragma:",{aMessage:aMessage},$globals.Pragmator)});
  36861. },
  36862. args: ["aMessage"],
  36863. source: "processPragma: aMessage\x0a\x09(self canProcessPragma: aMessage) ifTrue: [\x0a\x09\x09^ aMessage sendTo: self ]",
  36864. referencedClasses: [],
  36865. messageSends: ["ifTrue:", "canProcessPragma:", "sendTo:"]
  36866. }),
  36867. $globals.Pragmator);
  36868. $core.addMethod(
  36869. $core.method({
  36870. selector: "sequenceNode",
  36871. protocol: "accessing",
  36872. fn: function (){
  36873. var self=this,$self=this;
  36874. return $self.sequenceNode;
  36875. },
  36876. args: [],
  36877. source: "sequenceNode\x0a\x09^ sequenceNode",
  36878. referencedClasses: [],
  36879. messageSends: []
  36880. }),
  36881. $globals.Pragmator);
  36882. $core.addMethod(
  36883. $core.method({
  36884. selector: "sequenceNode:",
  36885. protocol: "accessing",
  36886. fn: function (anObject){
  36887. var self=this,$self=this;
  36888. $self.sequenceNode=anObject;
  36889. return self;
  36890. },
  36891. args: ["anObject"],
  36892. source: "sequenceNode: anObject\x0a\x09sequenceNode := anObject",
  36893. referencedClasses: [],
  36894. messageSends: []
  36895. }),
  36896. $globals.Pragmator);
  36897. $core.addMethod(
  36898. $core.method({
  36899. selector: "visitMethodNode:",
  36900. protocol: "pragma processing",
  36901. fn: function (aNode){
  36902. var self=this,$self=this;
  36903. return $core.withContext(function($ctx1) {
  36904. var $1;
  36905. $self._methodNode_(aNode);
  36906. $1=(
  36907. $ctx1.supercall = true,
  36908. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  36909. $ctx1.supercall = false;
  36910. return $1;
  36911. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.Pragmator)});
  36912. },
  36913. args: ["aNode"],
  36914. source: "visitMethodNode: aNode\x0a\x09self methodNode: aNode.\x0a\x09^ super visitMethodNode: aNode",
  36915. referencedClasses: [],
  36916. messageSends: ["methodNode:", "visitMethodNode:"]
  36917. }),
  36918. $globals.Pragmator);
  36919. $core.addMethod(
  36920. $core.method({
  36921. selector: "visitSequenceNode:",
  36922. protocol: "pragma processing",
  36923. fn: function (aNode){
  36924. var self=this,$self=this;
  36925. return $core.withContext(function($ctx1) {
  36926. var $1;
  36927. $self._sequenceNode_(aNode);
  36928. $recv($recv(aNode)._pragmas())._do_((function(each){
  36929. return $core.withContext(function($ctx2) {
  36930. return $self._processPragma_(each);
  36931. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36932. }));
  36933. $1=(
  36934. $ctx1.supercall = true,
  36935. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  36936. $ctx1.supercall = false;
  36937. return $1;
  36938. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.Pragmator)});
  36939. },
  36940. args: ["aNode"],
  36941. source: "visitSequenceNode: aNode\x0a\x09self sequenceNode: aNode.\x0a\x09aNode pragmas do: [ :each | self processPragma: each ].\x0a\x09^ super visitSequenceNode: aNode",
  36942. referencedClasses: [],
  36943. messageSends: ["sequenceNode:", "do:", "pragmas", "processPragma:", "visitSequenceNode:"]
  36944. }),
  36945. $globals.Pragmator);
  36946. $core.addClass("EarlyPragmator", $globals.Pragmator, [], "Compiler-Core");
  36947. $core.addMethod(
  36948. $core.method({
  36949. selector: "asVariableName",
  36950. protocol: "*Compiler-Core",
  36951. fn: function (){
  36952. var self=this,$self=this;
  36953. return $core.withContext(function($ctx1) {
  36954. var $1;
  36955. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  36956. if($core.assert($1)){
  36957. return $self.__comma("_");
  36958. } else {
  36959. return self;
  36960. }
  36961. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  36962. },
  36963. args: [],
  36964. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  36965. referencedClasses: ["Smalltalk"],
  36966. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  36967. }),
  36968. $globals.String);
  36969. });
  36970. define('amber/core/Compiler-Semantic',["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Compiler-Core", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  36971. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  36972. var $pkg = $core.addPackage("Compiler-Semantic");
  36973. $pkg.innerEval = function (expr) { return eval(expr); };
  36974. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  36975. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  36976. $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.";
  36977. $core.addMethod(
  36978. $core.method({
  36979. selector: "addArg:",
  36980. protocol: "adding",
  36981. fn: function (aString){
  36982. var self=this,$self=this;
  36983. return $core.withContext(function($ctx1) {
  36984. var $1;
  36985. $1=$self._args();
  36986. $ctx1.sendIdx["args"]=1;
  36987. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  36988. $recv($recv($self._args())._at_(aString))._scope_(self);
  36989. return self;
  36990. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  36991. },
  36992. args: ["aString"],
  36993. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  36994. referencedClasses: ["ArgVar"],
  36995. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  36996. }),
  36997. $globals.LexicalScope);
  36998. $core.addMethod(
  36999. $core.method({
  37000. selector: "addTemp:",
  37001. protocol: "adding",
  37002. fn: function (aString){
  37003. var self=this,$self=this;
  37004. return $core.withContext(function($ctx1) {
  37005. var $1;
  37006. $1=$self._temps();
  37007. $ctx1.sendIdx["temps"]=1;
  37008. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  37009. $recv($recv($self._temps())._at_(aString))._scope_(self);
  37010. return self;
  37011. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  37012. },
  37013. args: ["aString"],
  37014. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  37015. referencedClasses: ["TempVar"],
  37016. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  37017. }),
  37018. $globals.LexicalScope);
  37019. $core.addMethod(
  37020. $core.method({
  37021. selector: "alias",
  37022. protocol: "accessing",
  37023. fn: function (){
  37024. var self=this,$self=this;
  37025. return $core.withContext(function($ctx1) {
  37026. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  37027. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  37028. },
  37029. args: [],
  37030. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  37031. referencedClasses: [],
  37032. messageSends: [",", "asString", "scopeLevel"]
  37033. }),
  37034. $globals.LexicalScope);
  37035. $core.addMethod(
  37036. $core.method({
  37037. selector: "allVariableNames",
  37038. protocol: "accessing",
  37039. fn: function (){
  37040. var self=this,$self=this;
  37041. return $core.withContext(function($ctx1) {
  37042. var $1;
  37043. $1=$recv($self._args())._keys();
  37044. $ctx1.sendIdx["keys"]=1;
  37045. return $recv($1).__comma($recv($self._temps())._keys());
  37046. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  37047. },
  37048. args: [],
  37049. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  37050. referencedClasses: [],
  37051. messageSends: [",", "keys", "args", "temps"]
  37052. }),
  37053. $globals.LexicalScope);
  37054. $core.addMethod(
  37055. $core.method({
  37056. selector: "args",
  37057. protocol: "accessing",
  37058. fn: function (){
  37059. var self=this,$self=this;
  37060. return $core.withContext(function($ctx1) {
  37061. var $1,$receiver;
  37062. $1=$self.args;
  37063. if(($receiver = $1) == null || $receiver.a$nil){
  37064. $self.args=$recv($globals.Dictionary)._new();
  37065. return $self.args;
  37066. } else {
  37067. return $1;
  37068. }
  37069. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  37070. },
  37071. args: [],
  37072. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  37073. referencedClasses: ["Dictionary"],
  37074. messageSends: ["ifNil:", "new"]
  37075. }),
  37076. $globals.LexicalScope);
  37077. $core.addMethod(
  37078. $core.method({
  37079. selector: "bindingFor:",
  37080. protocol: "accessing",
  37081. fn: function (aStringOrNode){
  37082. var self=this,$self=this;
  37083. return $core.withContext(function($ctx1) {
  37084. var $2,$3,$4,$5,$1;
  37085. $2=$self._pseudoVars();
  37086. $3=$recv(aStringOrNode)._value();
  37087. $ctx1.sendIdx["value"]=1;
  37088. $1=$recv($2)._at_ifAbsent_($3,(function(){
  37089. return $core.withContext(function($ctx2) {
  37090. $4=$self._args();
  37091. $5=$recv(aStringOrNode)._value();
  37092. $ctx2.sendIdx["value"]=2;
  37093. return $recv($4)._at_ifAbsent_($5,(function(){
  37094. return $core.withContext(function($ctx3) {
  37095. return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  37096. return nil;
  37097. }));
  37098. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  37099. }));
  37100. $ctx2.sendIdx["at:ifAbsent:"]=2;
  37101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37102. }));
  37103. $ctx1.sendIdx["at:ifAbsent:"]=1;
  37104. return $1;
  37105. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  37106. },
  37107. args: ["aStringOrNode"],
  37108. 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 ]]]",
  37109. referencedClasses: [],
  37110. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  37111. }),
  37112. $globals.LexicalScope);
  37113. $core.addMethod(
  37114. $core.method({
  37115. selector: "blockIndex",
  37116. protocol: "accessing",
  37117. fn: function (){
  37118. var self=this,$self=this;
  37119. return $core.withContext(function($ctx1) {
  37120. var $1,$receiver;
  37121. $1=$self.blockIndex;
  37122. if(($receiver = $1) == null || $receiver.a$nil){
  37123. return (0);
  37124. } else {
  37125. return $1;
  37126. }
  37127. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  37128. },
  37129. args: [],
  37130. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  37131. referencedClasses: [],
  37132. messageSends: ["ifNil:"]
  37133. }),
  37134. $globals.LexicalScope);
  37135. $core.addMethod(
  37136. $core.method({
  37137. selector: "blockIndex:",
  37138. protocol: "accessing",
  37139. fn: function (anInteger){
  37140. var self=this,$self=this;
  37141. $self.blockIndex=anInteger;
  37142. return self;
  37143. },
  37144. args: ["anInteger"],
  37145. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  37146. referencedClasses: [],
  37147. messageSends: []
  37148. }),
  37149. $globals.LexicalScope);
  37150. $core.addMethod(
  37151. $core.method({
  37152. selector: "canInlineNonLocalReturns",
  37153. protocol: "testing",
  37154. fn: function (){
  37155. var self=this,$self=this;
  37156. return $core.withContext(function($ctx1) {
  37157. return $recv($self._isInlined())._and_((function(){
  37158. return $core.withContext(function($ctx2) {
  37159. return $recv($self._outerScope())._canInlineNonLocalReturns();
  37160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37161. }));
  37162. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  37163. },
  37164. args: [],
  37165. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  37166. referencedClasses: [],
  37167. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  37168. }),
  37169. $globals.LexicalScope);
  37170. $core.addMethod(
  37171. $core.method({
  37172. selector: "instruction",
  37173. protocol: "accessing",
  37174. fn: function (){
  37175. var self=this,$self=this;
  37176. return $self.instruction;
  37177. },
  37178. args: [],
  37179. source: "instruction\x0a\x09^ instruction",
  37180. referencedClasses: [],
  37181. messageSends: []
  37182. }),
  37183. $globals.LexicalScope);
  37184. $core.addMethod(
  37185. $core.method({
  37186. selector: "instruction:",
  37187. protocol: "accessing",
  37188. fn: function (anIRInstruction){
  37189. var self=this,$self=this;
  37190. $self.instruction=anIRInstruction;
  37191. return self;
  37192. },
  37193. args: ["anIRInstruction"],
  37194. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  37195. referencedClasses: [],
  37196. messageSends: []
  37197. }),
  37198. $globals.LexicalScope);
  37199. $core.addMethod(
  37200. $core.method({
  37201. selector: "isBlockScope",
  37202. protocol: "testing",
  37203. fn: function (){
  37204. var self=this,$self=this;
  37205. return $core.withContext(function($ctx1) {
  37206. return $recv($self._isMethodScope())._not();
  37207. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  37208. },
  37209. args: [],
  37210. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  37211. referencedClasses: [],
  37212. messageSends: ["not", "isMethodScope"]
  37213. }),
  37214. $globals.LexicalScope);
  37215. $core.addMethod(
  37216. $core.method({
  37217. selector: "isInlined",
  37218. protocol: "testing",
  37219. fn: function (){
  37220. var self=this,$self=this;
  37221. return $core.withContext(function($ctx1) {
  37222. var $2,$1;
  37223. $2=$self._instruction();
  37224. $ctx1.sendIdx["instruction"]=1;
  37225. $1=$recv($2)._notNil();
  37226. return $recv($1)._and_((function(){
  37227. return $core.withContext(function($ctx2) {
  37228. return $recv($self._instruction())._isInlined();
  37229. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37230. }));
  37231. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  37232. },
  37233. args: [],
  37234. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  37235. referencedClasses: [],
  37236. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  37237. }),
  37238. $globals.LexicalScope);
  37239. $core.addMethod(
  37240. $core.method({
  37241. selector: "isMethodScope",
  37242. protocol: "testing",
  37243. fn: function (){
  37244. var self=this,$self=this;
  37245. return false;
  37246. },
  37247. args: [],
  37248. source: "isMethodScope\x0a\x09^ false",
  37249. referencedClasses: [],
  37250. messageSends: []
  37251. }),
  37252. $globals.LexicalScope);
  37253. $core.addMethod(
  37254. $core.method({
  37255. selector: "lookupVariable:",
  37256. protocol: "accessing",
  37257. fn: function (aNode){
  37258. var self=this,$self=this;
  37259. var lookup;
  37260. return $core.withContext(function($ctx1) {
  37261. var $1,$2,$receiver;
  37262. lookup=$self._bindingFor_(aNode);
  37263. $1=lookup;
  37264. if(($receiver = $1) == null || $receiver.a$nil){
  37265. $2=$self._outerScope();
  37266. $ctx1.sendIdx["outerScope"]=1;
  37267. if(($receiver = $2) == null || $receiver.a$nil){
  37268. lookup=$2;
  37269. } else {
  37270. lookup=$recv($self._outerScope())._lookupVariable_(aNode);
  37271. }
  37272. lookup;
  37273. } else {
  37274. $1;
  37275. }
  37276. return lookup;
  37277. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  37278. },
  37279. args: ["aNode"],
  37280. 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",
  37281. referencedClasses: [],
  37282. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  37283. }),
  37284. $globals.LexicalScope);
  37285. $core.addMethod(
  37286. $core.method({
  37287. selector: "methodScope",
  37288. protocol: "accessing",
  37289. fn: function (){
  37290. var self=this,$self=this;
  37291. return $core.withContext(function($ctx1) {
  37292. var $1,$receiver;
  37293. $1=$self._outerScope();
  37294. $ctx1.sendIdx["outerScope"]=1;
  37295. if(($receiver = $1) == null || $receiver.a$nil){
  37296. return $1;
  37297. } else {
  37298. return $recv($self._outerScope())._methodScope();
  37299. }
  37300. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  37301. },
  37302. args: [],
  37303. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  37304. referencedClasses: [],
  37305. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  37306. }),
  37307. $globals.LexicalScope);
  37308. $core.addMethod(
  37309. $core.method({
  37310. selector: "node",
  37311. protocol: "accessing",
  37312. fn: function (){
  37313. var self=this,$self=this;
  37314. return $self.node;
  37315. },
  37316. args: [],
  37317. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  37318. referencedClasses: [],
  37319. messageSends: []
  37320. }),
  37321. $globals.LexicalScope);
  37322. $core.addMethod(
  37323. $core.method({
  37324. selector: "node:",
  37325. protocol: "accessing",
  37326. fn: function (aNode){
  37327. var self=this,$self=this;
  37328. $self.node=aNode;
  37329. return self;
  37330. },
  37331. args: ["aNode"],
  37332. source: "node: aNode\x0a\x09node := aNode",
  37333. referencedClasses: [],
  37334. messageSends: []
  37335. }),
  37336. $globals.LexicalScope);
  37337. $core.addMethod(
  37338. $core.method({
  37339. selector: "outerScope",
  37340. protocol: "accessing",
  37341. fn: function (){
  37342. var self=this,$self=this;
  37343. return $self.outerScope;
  37344. },
  37345. args: [],
  37346. source: "outerScope\x0a\x09^ outerScope",
  37347. referencedClasses: [],
  37348. messageSends: []
  37349. }),
  37350. $globals.LexicalScope);
  37351. $core.addMethod(
  37352. $core.method({
  37353. selector: "outerScope:",
  37354. protocol: "accessing",
  37355. fn: function (aLexicalScope){
  37356. var self=this,$self=this;
  37357. $self.outerScope=aLexicalScope;
  37358. return self;
  37359. },
  37360. args: ["aLexicalScope"],
  37361. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  37362. referencedClasses: [],
  37363. messageSends: []
  37364. }),
  37365. $globals.LexicalScope);
  37366. $core.addMethod(
  37367. $core.method({
  37368. selector: "pseudoVars",
  37369. protocol: "accessing",
  37370. fn: function (){
  37371. var self=this,$self=this;
  37372. return $core.withContext(function($ctx1) {
  37373. return $recv($self._methodScope())._pseudoVars();
  37374. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  37375. },
  37376. args: [],
  37377. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  37378. referencedClasses: [],
  37379. messageSends: ["pseudoVars", "methodScope"]
  37380. }),
  37381. $globals.LexicalScope);
  37382. $core.addMethod(
  37383. $core.method({
  37384. selector: "scopeLevel",
  37385. protocol: "accessing",
  37386. fn: function (){
  37387. var self=this,$self=this;
  37388. return $core.withContext(function($ctx1) {
  37389. var $1,$2,$4,$3,$receiver;
  37390. $1=$self._outerScope();
  37391. $ctx1.sendIdx["outerScope"]=1;
  37392. if(($receiver = $1) == null || $receiver.a$nil){
  37393. return (1);
  37394. } else {
  37395. $1;
  37396. }
  37397. $2=$self._isInlined();
  37398. if($core.assert($2)){
  37399. $4=$self._outerScope();
  37400. $ctx1.sendIdx["outerScope"]=2;
  37401. $3=$recv($4)._scopeLevel();
  37402. $ctx1.sendIdx["scopeLevel"]=1;
  37403. return $3;
  37404. }
  37405. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  37406. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  37407. },
  37408. args: [],
  37409. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  37410. referencedClasses: [],
  37411. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  37412. }),
  37413. $globals.LexicalScope);
  37414. $core.addMethod(
  37415. $core.method({
  37416. selector: "temps",
  37417. protocol: "accessing",
  37418. fn: function (){
  37419. var self=this,$self=this;
  37420. return $core.withContext(function($ctx1) {
  37421. var $1,$receiver;
  37422. $1=$self.temps;
  37423. if(($receiver = $1) == null || $receiver.a$nil){
  37424. $self.temps=$recv($globals.Dictionary)._new();
  37425. return $self.temps;
  37426. } else {
  37427. return $1;
  37428. }
  37429. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  37430. },
  37431. args: [],
  37432. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  37433. referencedClasses: ["Dictionary"],
  37434. messageSends: ["ifNil:", "new"]
  37435. }),
  37436. $globals.LexicalScope);
  37437. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  37438. $globals.MethodLexicalScope.comment="I represent a method scope.";
  37439. $core.addMethod(
  37440. $core.method({
  37441. selector: "addIVar:",
  37442. protocol: "adding",
  37443. fn: function (aString){
  37444. var self=this,$self=this;
  37445. return $core.withContext(function($ctx1) {
  37446. var $1;
  37447. $1=$self._iVars();
  37448. $ctx1.sendIdx["iVars"]=1;
  37449. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  37450. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  37451. return self;
  37452. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  37453. },
  37454. args: ["aString"],
  37455. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  37456. referencedClasses: ["InstanceVar"],
  37457. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  37458. }),
  37459. $globals.MethodLexicalScope);
  37460. $core.addMethod(
  37461. $core.method({
  37462. selector: "addNonLocalReturn:",
  37463. protocol: "adding",
  37464. fn: function (aScope){
  37465. var self=this,$self=this;
  37466. return $core.withContext(function($ctx1) {
  37467. $recv($self._nonLocalReturns())._add_(aScope);
  37468. return self;
  37469. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37470. },
  37471. args: ["aScope"],
  37472. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  37473. referencedClasses: [],
  37474. messageSends: ["add:", "nonLocalReturns"]
  37475. }),
  37476. $globals.MethodLexicalScope);
  37477. $core.addMethod(
  37478. $core.method({
  37479. selector: "allVariableNames",
  37480. protocol: "accessing",
  37481. fn: function (){
  37482. var self=this,$self=this;
  37483. return $core.withContext(function($ctx1) {
  37484. var $1;
  37485. $1=(
  37486. $ctx1.supercall = true,
  37487. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, []));
  37488. $ctx1.supercall = false;
  37489. return $recv($1).__comma($recv($self._iVars())._keys());
  37490. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  37491. },
  37492. args: [],
  37493. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  37494. referencedClasses: [],
  37495. messageSends: [",", "allVariableNames", "keys", "iVars"]
  37496. }),
  37497. $globals.MethodLexicalScope);
  37498. $core.addMethod(
  37499. $core.method({
  37500. selector: "bindingFor:",
  37501. protocol: "accessing",
  37502. fn: function (aNode){
  37503. var self=this,$self=this;
  37504. return $core.withContext(function($ctx1) {
  37505. var $1,$receiver;
  37506. $1=(
  37507. $ctx1.supercall = true,
  37508. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode]));
  37509. $ctx1.supercall = false;
  37510. if(($receiver = $1) == null || $receiver.a$nil){
  37511. return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  37512. return nil;
  37513. }));
  37514. } else {
  37515. return $1;
  37516. }
  37517. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  37518. },
  37519. args: ["aNode"],
  37520. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  37521. referencedClasses: [],
  37522. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  37523. }),
  37524. $globals.MethodLexicalScope);
  37525. $core.addMethod(
  37526. $core.method({
  37527. selector: "canInlineNonLocalReturns",
  37528. protocol: "testing",
  37529. fn: function (){
  37530. var self=this,$self=this;
  37531. return true;
  37532. },
  37533. args: [],
  37534. source: "canInlineNonLocalReturns\x0a\x09^ true",
  37535. referencedClasses: [],
  37536. messageSends: []
  37537. }),
  37538. $globals.MethodLexicalScope);
  37539. $core.addMethod(
  37540. $core.method({
  37541. selector: "hasLocalReturn",
  37542. protocol: "testing",
  37543. fn: function (){
  37544. var self=this,$self=this;
  37545. return $core.withContext(function($ctx1) {
  37546. return $self._localReturn();
  37547. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  37548. },
  37549. args: [],
  37550. source: "hasLocalReturn\x0a\x09^ self localReturn",
  37551. referencedClasses: [],
  37552. messageSends: ["localReturn"]
  37553. }),
  37554. $globals.MethodLexicalScope);
  37555. $core.addMethod(
  37556. $core.method({
  37557. selector: "hasNonLocalReturn",
  37558. protocol: "testing",
  37559. fn: function (){
  37560. var self=this,$self=this;
  37561. return $core.withContext(function($ctx1) {
  37562. return $recv($self._nonLocalReturns())._notEmpty();
  37563. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  37564. },
  37565. args: [],
  37566. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  37567. referencedClasses: [],
  37568. messageSends: ["notEmpty", "nonLocalReturns"]
  37569. }),
  37570. $globals.MethodLexicalScope);
  37571. $core.addMethod(
  37572. $core.method({
  37573. selector: "iVars",
  37574. protocol: "accessing",
  37575. fn: function (){
  37576. var self=this,$self=this;
  37577. return $core.withContext(function($ctx1) {
  37578. var $1,$receiver;
  37579. $1=$self.iVars;
  37580. if(($receiver = $1) == null || $receiver.a$nil){
  37581. $self.iVars=$recv($globals.Dictionary)._new();
  37582. return $self.iVars;
  37583. } else {
  37584. return $1;
  37585. }
  37586. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  37587. },
  37588. args: [],
  37589. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  37590. referencedClasses: ["Dictionary"],
  37591. messageSends: ["ifNil:", "new"]
  37592. }),
  37593. $globals.MethodLexicalScope);
  37594. $core.addMethod(
  37595. $core.method({
  37596. selector: "isMethodScope",
  37597. protocol: "testing",
  37598. fn: function (){
  37599. var self=this,$self=this;
  37600. return true;
  37601. },
  37602. args: [],
  37603. source: "isMethodScope\x0a\x09^ true",
  37604. referencedClasses: [],
  37605. messageSends: []
  37606. }),
  37607. $globals.MethodLexicalScope);
  37608. $core.addMethod(
  37609. $core.method({
  37610. selector: "localReturn",
  37611. protocol: "accessing",
  37612. fn: function (){
  37613. var self=this,$self=this;
  37614. return $core.withContext(function($ctx1) {
  37615. var $1,$receiver;
  37616. $1=$self.localReturn;
  37617. if(($receiver = $1) == null || $receiver.a$nil){
  37618. return false;
  37619. } else {
  37620. return $1;
  37621. }
  37622. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  37623. },
  37624. args: [],
  37625. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  37626. referencedClasses: [],
  37627. messageSends: ["ifNil:"]
  37628. }),
  37629. $globals.MethodLexicalScope);
  37630. $core.addMethod(
  37631. $core.method({
  37632. selector: "localReturn:",
  37633. protocol: "accessing",
  37634. fn: function (aBoolean){
  37635. var self=this,$self=this;
  37636. $self.localReturn=aBoolean;
  37637. return self;
  37638. },
  37639. args: ["aBoolean"],
  37640. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  37641. referencedClasses: [],
  37642. messageSends: []
  37643. }),
  37644. $globals.MethodLexicalScope);
  37645. $core.addMethod(
  37646. $core.method({
  37647. selector: "methodScope",
  37648. protocol: "accessing",
  37649. fn: function (){
  37650. var self=this,$self=this;
  37651. return self;
  37652. },
  37653. args: [],
  37654. source: "methodScope\x0a\x09^ self",
  37655. referencedClasses: [],
  37656. messageSends: []
  37657. }),
  37658. $globals.MethodLexicalScope);
  37659. $core.addMethod(
  37660. $core.method({
  37661. selector: "nonLocalReturns",
  37662. protocol: "accessing",
  37663. fn: function (){
  37664. var self=this,$self=this;
  37665. return $core.withContext(function($ctx1) {
  37666. var $1,$receiver;
  37667. $1=$self.nonLocalReturns;
  37668. if(($receiver = $1) == null || $receiver.a$nil){
  37669. $self.nonLocalReturns=$recv($globals.OrderedCollection)._new();
  37670. return $self.nonLocalReturns;
  37671. } else {
  37672. return $1;
  37673. }
  37674. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  37675. },
  37676. args: [],
  37677. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  37678. referencedClasses: ["OrderedCollection"],
  37679. messageSends: ["ifNil:", "new"]
  37680. }),
  37681. $globals.MethodLexicalScope);
  37682. $core.addMethod(
  37683. $core.method({
  37684. selector: "pseudoVars",
  37685. protocol: "accessing",
  37686. fn: function (){
  37687. var self=this,$self=this;
  37688. return $core.withContext(function($ctx1) {
  37689. var $1,$2,$4,$3,$receiver;
  37690. $1=$self.pseudoVars;
  37691. if(($receiver = $1) == null || $receiver.a$nil){
  37692. $self.pseudoVars=$recv($globals.Dictionary)._new();
  37693. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  37694. return $core.withContext(function($ctx2) {
  37695. $2=$self.pseudoVars;
  37696. $4=$recv($globals.PseudoVar)._on_(each);
  37697. $recv($4)._scope_($self._methodScope());
  37698. $3=$recv($4)._yourself();
  37699. return $recv($2)._at_put_(each,$3);
  37700. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37701. }));
  37702. } else {
  37703. $1;
  37704. }
  37705. return $self.pseudoVars;
  37706. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  37707. },
  37708. args: [],
  37709. 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",
  37710. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  37711. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  37712. }),
  37713. $globals.MethodLexicalScope);
  37714. $core.addMethod(
  37715. $core.method({
  37716. selector: "removeNonLocalReturn:",
  37717. protocol: "adding",
  37718. fn: function (aScope){
  37719. var self=this,$self=this;
  37720. return $core.withContext(function($ctx1) {
  37721. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  37722. }));
  37723. return self;
  37724. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37725. },
  37726. args: ["aScope"],
  37727. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  37728. referencedClasses: [],
  37729. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  37730. }),
  37731. $globals.MethodLexicalScope);
  37732. $core.addMethod(
  37733. $core.method({
  37734. selector: "unknownVariables",
  37735. protocol: "accessing",
  37736. fn: function (){
  37737. var self=this,$self=this;
  37738. return $core.withContext(function($ctx1) {
  37739. var $1,$receiver;
  37740. $1=$self.unknownVariables;
  37741. if(($receiver = $1) == null || $receiver.a$nil){
  37742. $self.unknownVariables=$recv($globals.OrderedCollection)._new();
  37743. return $self.unknownVariables;
  37744. } else {
  37745. return $1;
  37746. }
  37747. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  37748. },
  37749. args: [],
  37750. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  37751. referencedClasses: ["OrderedCollection"],
  37752. messageSends: ["ifNil:", "new"]
  37753. }),
  37754. $globals.MethodLexicalScope);
  37755. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  37756. $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.";
  37757. $core.addMethod(
  37758. $core.method({
  37759. selector: "alias",
  37760. protocol: "accessing",
  37761. fn: function (){
  37762. var self=this,$self=this;
  37763. return $core.withContext(function($ctx1) {
  37764. return $recv($self._name())._asVariableName();
  37765. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  37766. },
  37767. args: [],
  37768. source: "alias\x0a\x09^ self name asVariableName",
  37769. referencedClasses: [],
  37770. messageSends: ["asVariableName", "name"]
  37771. }),
  37772. $globals.ScopeVar);
  37773. $core.addMethod(
  37774. $core.method({
  37775. selector: "isArgVar",
  37776. protocol: "testing",
  37777. fn: function (){
  37778. var self=this,$self=this;
  37779. return false;
  37780. },
  37781. args: [],
  37782. source: "isArgVar\x0a\x09^ false",
  37783. referencedClasses: [],
  37784. messageSends: []
  37785. }),
  37786. $globals.ScopeVar);
  37787. $core.addMethod(
  37788. $core.method({
  37789. selector: "isClassRefVar",
  37790. protocol: "testing",
  37791. fn: function (){
  37792. var self=this,$self=this;
  37793. return false;
  37794. },
  37795. args: [],
  37796. source: "isClassRefVar\x0a\x09^ false",
  37797. referencedClasses: [],
  37798. messageSends: []
  37799. }),
  37800. $globals.ScopeVar);
  37801. $core.addMethod(
  37802. $core.method({
  37803. selector: "isImmutable",
  37804. protocol: "testing",
  37805. fn: function (){
  37806. var self=this,$self=this;
  37807. return false;
  37808. },
  37809. args: [],
  37810. source: "isImmutable\x0a\x09^ false",
  37811. referencedClasses: [],
  37812. messageSends: []
  37813. }),
  37814. $globals.ScopeVar);
  37815. $core.addMethod(
  37816. $core.method({
  37817. selector: "isInstanceVar",
  37818. protocol: "testing",
  37819. fn: function (){
  37820. var self=this,$self=this;
  37821. return false;
  37822. },
  37823. args: [],
  37824. source: "isInstanceVar\x0a\x09^ false",
  37825. referencedClasses: [],
  37826. messageSends: []
  37827. }),
  37828. $globals.ScopeVar);
  37829. $core.addMethod(
  37830. $core.method({
  37831. selector: "isPseudoVar",
  37832. protocol: "testing",
  37833. fn: function (){
  37834. var self=this,$self=this;
  37835. return false;
  37836. },
  37837. args: [],
  37838. source: "isPseudoVar\x0a\x09^ false",
  37839. referencedClasses: [],
  37840. messageSends: []
  37841. }),
  37842. $globals.ScopeVar);
  37843. $core.addMethod(
  37844. $core.method({
  37845. selector: "isSelf",
  37846. protocol: "testing",
  37847. fn: function (){
  37848. var self=this,$self=this;
  37849. return false;
  37850. },
  37851. args: [],
  37852. source: "isSelf\x0a\x09^ false",
  37853. referencedClasses: [],
  37854. messageSends: []
  37855. }),
  37856. $globals.ScopeVar);
  37857. $core.addMethod(
  37858. $core.method({
  37859. selector: "isSuper",
  37860. protocol: "testing",
  37861. fn: function (){
  37862. var self=this,$self=this;
  37863. return false;
  37864. },
  37865. args: [],
  37866. source: "isSuper\x0a\x09^ false",
  37867. referencedClasses: [],
  37868. messageSends: []
  37869. }),
  37870. $globals.ScopeVar);
  37871. $core.addMethod(
  37872. $core.method({
  37873. selector: "isTempVar",
  37874. protocol: "testing",
  37875. fn: function (){
  37876. var self=this,$self=this;
  37877. return false;
  37878. },
  37879. args: [],
  37880. source: "isTempVar\x0a\x09^ false",
  37881. referencedClasses: [],
  37882. messageSends: []
  37883. }),
  37884. $globals.ScopeVar);
  37885. $core.addMethod(
  37886. $core.method({
  37887. selector: "isUnknownVar",
  37888. protocol: "testing",
  37889. fn: function (){
  37890. var self=this,$self=this;
  37891. return false;
  37892. },
  37893. args: [],
  37894. source: "isUnknownVar\x0a\x09^ false",
  37895. referencedClasses: [],
  37896. messageSends: []
  37897. }),
  37898. $globals.ScopeVar);
  37899. $core.addMethod(
  37900. $core.method({
  37901. selector: "name",
  37902. protocol: "accessing",
  37903. fn: function (){
  37904. var self=this,$self=this;
  37905. return $self.name;
  37906. },
  37907. args: [],
  37908. source: "name\x0a\x09^ name",
  37909. referencedClasses: [],
  37910. messageSends: []
  37911. }),
  37912. $globals.ScopeVar);
  37913. $core.addMethod(
  37914. $core.method({
  37915. selector: "name:",
  37916. protocol: "accessing",
  37917. fn: function (aString){
  37918. var self=this,$self=this;
  37919. $self.name=aString;
  37920. return self;
  37921. },
  37922. args: ["aString"],
  37923. source: "name: aString\x0a\x09name := aString",
  37924. referencedClasses: [],
  37925. messageSends: []
  37926. }),
  37927. $globals.ScopeVar);
  37928. $core.addMethod(
  37929. $core.method({
  37930. selector: "scope",
  37931. protocol: "accessing",
  37932. fn: function (){
  37933. var self=this,$self=this;
  37934. return $self.scope;
  37935. },
  37936. args: [],
  37937. source: "scope\x0a\x09^ scope",
  37938. referencedClasses: [],
  37939. messageSends: []
  37940. }),
  37941. $globals.ScopeVar);
  37942. $core.addMethod(
  37943. $core.method({
  37944. selector: "scope:",
  37945. protocol: "accessing",
  37946. fn: function (aScope){
  37947. var self=this,$self=this;
  37948. $self.scope=aScope;
  37949. return self;
  37950. },
  37951. args: ["aScope"],
  37952. source: "scope: aScope\x0a\x09scope := aScope",
  37953. referencedClasses: [],
  37954. messageSends: []
  37955. }),
  37956. $globals.ScopeVar);
  37957. $core.addMethod(
  37958. $core.method({
  37959. selector: "validateAssignment",
  37960. protocol: "testing",
  37961. fn: function (){
  37962. var self=this,$self=this;
  37963. return $core.withContext(function($ctx1) {
  37964. var $1,$2;
  37965. $1=$recv($self._isArgVar())._or_((function(){
  37966. return $core.withContext(function($ctx2) {
  37967. return $self._isPseudoVar();
  37968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37969. }));
  37970. if($core.assert($1)){
  37971. $2=$recv($globals.InvalidAssignmentError)._new();
  37972. $recv($2)._variableName_($self._name());
  37973. $recv($2)._signal();
  37974. }
  37975. return self;
  37976. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  37977. },
  37978. args: [],
  37979. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  37980. referencedClasses: ["InvalidAssignmentError"],
  37981. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  37982. }),
  37983. $globals.ScopeVar);
  37984. $core.addMethod(
  37985. $core.method({
  37986. selector: "on:",
  37987. protocol: "instance creation",
  37988. fn: function (aString){
  37989. var self=this,$self=this;
  37990. return $core.withContext(function($ctx1) {
  37991. var $1;
  37992. $1=$self._new();
  37993. $recv($1)._name_(aString);
  37994. return $recv($1)._yourself();
  37995. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.a$cls)});
  37996. },
  37997. args: ["aString"],
  37998. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  37999. referencedClasses: [],
  38000. messageSends: ["name:", "new", "yourself"]
  38001. }),
  38002. $globals.ScopeVar.a$cls);
  38003. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  38004. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  38005. $core.addMethod(
  38006. $core.method({
  38007. selector: "isImmutable",
  38008. protocol: "testing",
  38009. fn: function (){
  38010. var self=this,$self=this;
  38011. return true;
  38012. },
  38013. args: [],
  38014. source: "isImmutable\x0a\x09^ true",
  38015. referencedClasses: [],
  38016. messageSends: []
  38017. }),
  38018. $globals.AliasVar);
  38019. $core.addMethod(
  38020. $core.method({
  38021. selector: "node",
  38022. protocol: "accessing",
  38023. fn: function (){
  38024. var self=this,$self=this;
  38025. return $self.node;
  38026. },
  38027. args: [],
  38028. source: "node\x0a\x09^ node",
  38029. referencedClasses: [],
  38030. messageSends: []
  38031. }),
  38032. $globals.AliasVar);
  38033. $core.addMethod(
  38034. $core.method({
  38035. selector: "node:",
  38036. protocol: "accessing",
  38037. fn: function (aNode){
  38038. var self=this,$self=this;
  38039. $self.node=aNode;
  38040. return self;
  38041. },
  38042. args: ["aNode"],
  38043. source: "node: aNode\x0a\x09node := aNode",
  38044. referencedClasses: [],
  38045. messageSends: []
  38046. }),
  38047. $globals.AliasVar);
  38048. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38049. $globals.ArgVar.comment="I am an argument of a method or block.";
  38050. $core.addMethod(
  38051. $core.method({
  38052. selector: "isArgVar",
  38053. protocol: "testing",
  38054. fn: function (){
  38055. var self=this,$self=this;
  38056. return true;
  38057. },
  38058. args: [],
  38059. source: "isArgVar\x0a\x09^ true",
  38060. referencedClasses: [],
  38061. messageSends: []
  38062. }),
  38063. $globals.ArgVar);
  38064. $core.addMethod(
  38065. $core.method({
  38066. selector: "isImmutable",
  38067. protocol: "testing",
  38068. fn: function (){
  38069. var self=this,$self=this;
  38070. return true;
  38071. },
  38072. args: [],
  38073. source: "isImmutable\x0a\x09^ true",
  38074. referencedClasses: [],
  38075. messageSends: []
  38076. }),
  38077. $globals.ArgVar);
  38078. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38079. $globals.ClassRefVar.comment="I am an class reference variable";
  38080. $core.addMethod(
  38081. $core.method({
  38082. selector: "alias",
  38083. protocol: "accessing",
  38084. fn: function (){
  38085. var self=this,$self=this;
  38086. return $core.withContext(function($ctx1) {
  38087. return "$globals.".__comma($self._name());
  38088. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  38089. },
  38090. args: [],
  38091. 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",
  38092. referencedClasses: [],
  38093. messageSends: [",", "name"]
  38094. }),
  38095. $globals.ClassRefVar);
  38096. $core.addMethod(
  38097. $core.method({
  38098. selector: "isClassRefVar",
  38099. protocol: "testing",
  38100. fn: function (){
  38101. var self=this,$self=this;
  38102. return true;
  38103. },
  38104. args: [],
  38105. source: "isClassRefVar\x0a\x09^ true",
  38106. referencedClasses: [],
  38107. messageSends: []
  38108. }),
  38109. $globals.ClassRefVar);
  38110. $core.addMethod(
  38111. $core.method({
  38112. selector: "isImmutable",
  38113. protocol: "testing",
  38114. fn: function (){
  38115. var self=this,$self=this;
  38116. return true;
  38117. },
  38118. args: [],
  38119. source: "isImmutable\x0a\x09^ true",
  38120. referencedClasses: [],
  38121. messageSends: []
  38122. }),
  38123. $globals.ClassRefVar);
  38124. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38125. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  38126. $core.addMethod(
  38127. $core.method({
  38128. selector: "alias",
  38129. protocol: "testing",
  38130. fn: function (){
  38131. var self=this,$self=this;
  38132. return $core.withContext(function($ctx1) {
  38133. return "$self.".__comma($self._name());
  38134. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  38135. },
  38136. args: [],
  38137. source: "alias\x0a\x09^ '$self.', self name",
  38138. referencedClasses: [],
  38139. messageSends: [",", "name"]
  38140. }),
  38141. $globals.InstanceVar);
  38142. $core.addMethod(
  38143. $core.method({
  38144. selector: "isInstanceVar",
  38145. protocol: "testing",
  38146. fn: function (){
  38147. var self=this,$self=this;
  38148. return true;
  38149. },
  38150. args: [],
  38151. source: "isInstanceVar\x0a\x09^ true",
  38152. referencedClasses: [],
  38153. messageSends: []
  38154. }),
  38155. $globals.InstanceVar);
  38156. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38157. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  38158. $core.addMethod(
  38159. $core.method({
  38160. selector: "alias",
  38161. protocol: "accessing",
  38162. fn: function (){
  38163. var self=this,$self=this;
  38164. return $core.withContext(function($ctx1) {
  38165. return $self._name();
  38166. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  38167. },
  38168. args: [],
  38169. source: "alias\x0a\x09^ self name",
  38170. referencedClasses: [],
  38171. messageSends: ["name"]
  38172. }),
  38173. $globals.PseudoVar);
  38174. $core.addMethod(
  38175. $core.method({
  38176. selector: "isImmutable",
  38177. protocol: "testing",
  38178. fn: function (){
  38179. var self=this,$self=this;
  38180. return true;
  38181. },
  38182. args: [],
  38183. source: "isImmutable\x0a\x09^ true",
  38184. referencedClasses: [],
  38185. messageSends: []
  38186. }),
  38187. $globals.PseudoVar);
  38188. $core.addMethod(
  38189. $core.method({
  38190. selector: "isPseudoVar",
  38191. protocol: "testing",
  38192. fn: function (){
  38193. var self=this,$self=this;
  38194. return true;
  38195. },
  38196. args: [],
  38197. source: "isPseudoVar\x0a\x09^ true",
  38198. referencedClasses: [],
  38199. messageSends: []
  38200. }),
  38201. $globals.PseudoVar);
  38202. $core.addMethod(
  38203. $core.method({
  38204. selector: "isSelf",
  38205. protocol: "testing",
  38206. fn: function (){
  38207. var self=this,$self=this;
  38208. return $core.withContext(function($ctx1) {
  38209. return $recv($self.name).__eq("self");
  38210. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.PseudoVar)});
  38211. },
  38212. args: [],
  38213. source: "isSelf\x0a\x09^ name = 'self'",
  38214. referencedClasses: [],
  38215. messageSends: ["="]
  38216. }),
  38217. $globals.PseudoVar);
  38218. $core.addMethod(
  38219. $core.method({
  38220. selector: "isSuper",
  38221. protocol: "testing",
  38222. fn: function (){
  38223. var self=this,$self=this;
  38224. return $core.withContext(function($ctx1) {
  38225. return $recv($self.name).__eq("super");
  38226. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.PseudoVar)});
  38227. },
  38228. args: [],
  38229. source: "isSuper\x0a\x09^ name = 'super'",
  38230. referencedClasses: [],
  38231. messageSends: ["="]
  38232. }),
  38233. $globals.PseudoVar);
  38234. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38235. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  38236. $core.addMethod(
  38237. $core.method({
  38238. selector: "isTempVar",
  38239. protocol: "testing",
  38240. fn: function (){
  38241. var self=this,$self=this;
  38242. return true;
  38243. },
  38244. args: [],
  38245. source: "isTempVar\x0a\x09^ true",
  38246. referencedClasses: [],
  38247. messageSends: []
  38248. }),
  38249. $globals.TempVar);
  38250. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38251. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  38252. $core.addMethod(
  38253. $core.method({
  38254. selector: "isUnknownVar",
  38255. protocol: "testing",
  38256. fn: function (){
  38257. var self=this,$self=this;
  38258. return true;
  38259. },
  38260. args: [],
  38261. source: "isUnknownVar\x0a\x09^ true",
  38262. referencedClasses: [],
  38263. messageSends: []
  38264. }),
  38265. $globals.UnknownVar);
  38266. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  38267. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  38268. $core.addMethod(
  38269. $core.method({
  38270. selector: "classReferences",
  38271. protocol: "accessing",
  38272. fn: function (){
  38273. var self=this,$self=this;
  38274. return $core.withContext(function($ctx1) {
  38275. var $1,$receiver;
  38276. $1=$self.classReferences;
  38277. if(($receiver = $1) == null || $receiver.a$nil){
  38278. $self.classReferences=$recv($globals.Set)._new();
  38279. return $self.classReferences;
  38280. } else {
  38281. return $1;
  38282. }
  38283. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  38284. },
  38285. args: [],
  38286. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  38287. referencedClasses: ["Set"],
  38288. messageSends: ["ifNil:", "new"]
  38289. }),
  38290. $globals.SemanticAnalyzer);
  38291. $core.addMethod(
  38292. $core.method({
  38293. selector: "errorShadowingVariable:",
  38294. protocol: "error handling",
  38295. fn: function (aString){
  38296. var self=this,$self=this;
  38297. return $core.withContext(function($ctx1) {
  38298. var $1;
  38299. $1=$recv($globals.ShadowingVariableError)._new();
  38300. $recv($1)._variableName_(aString);
  38301. $recv($1)._signal();
  38302. return self;
  38303. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  38304. },
  38305. args: ["aString"],
  38306. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  38307. referencedClasses: ["ShadowingVariableError"],
  38308. messageSends: ["variableName:", "new", "signal"]
  38309. }),
  38310. $globals.SemanticAnalyzer);
  38311. $core.addMethod(
  38312. $core.method({
  38313. selector: "errorUnknownVariable:",
  38314. protocol: "error handling",
  38315. fn: function (aNode){
  38316. var self=this,$self=this;
  38317. var identifier;
  38318. return $core.withContext(function($ctx1) {
  38319. var $1,$2,$3;
  38320. identifier=$recv(aNode)._value();
  38321. $ctx1.sendIdx["value"]=1;
  38322. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  38323. return $core.withContext(function($ctx2) {
  38324. return $self._isVariableUndefined_inPackage_(identifier,$self._thePackage());
  38325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38326. }));
  38327. if($core.assert($1)){
  38328. $2=$recv($globals.UnknownVariableError)._new();
  38329. $3=$recv(aNode)._value();
  38330. $ctx1.sendIdx["value"]=2;
  38331. $recv($2)._variableName_($3);
  38332. $recv($2)._signal();
  38333. } else {
  38334. $recv($recv($recv($self.currentScope)._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  38335. }
  38336. return self;
  38337. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  38338. },
  38339. args: ["aNode"],
  38340. 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 ]",
  38341. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  38342. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  38343. }),
  38344. $globals.SemanticAnalyzer);
  38345. $core.addMethod(
  38346. $core.method({
  38347. selector: "isVariableUndefined:inPackage:",
  38348. protocol: "testing",
  38349. fn: function (aString,aPackage){
  38350. var self=this,$self=this;
  38351. return $core.withContext(function($ctx1) {
  38352. var $1,$2,$receiver;
  38353. if(($receiver = aPackage) == null || $receiver.a$nil){
  38354. aPackage;
  38355. } else {
  38356. var packageKnownVars;
  38357. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  38358. $1=$recv(packageKnownVars)._includes_(aString);
  38359. if($core.assert($1)){
  38360. return false;
  38361. }
  38362. }
  38363. $2=$recv("typeof ".__comma(aString)).__comma(" === \x22undefined\x22");
  38364. $ctx1.sendIdx[","]=1;
  38365. return $recv($globals.Compiler)._eval_($2);
  38366. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  38367. },
  38368. args: ["aString", "aPackage"],
  38369. 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'",
  38370. referencedClasses: ["Compiler"],
  38371. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", ","]
  38372. }),
  38373. $globals.SemanticAnalyzer);
  38374. $core.addMethod(
  38375. $core.method({
  38376. selector: "messageSends",
  38377. protocol: "accessing",
  38378. fn: function (){
  38379. var self=this,$self=this;
  38380. return $core.withContext(function($ctx1) {
  38381. var $1,$receiver;
  38382. $1=$self.messageSends;
  38383. if(($receiver = $1) == null || $receiver.a$nil){
  38384. $self.messageSends=$recv($globals.Dictionary)._new();
  38385. return $self.messageSends;
  38386. } else {
  38387. return $1;
  38388. }
  38389. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  38390. },
  38391. args: [],
  38392. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  38393. referencedClasses: ["Dictionary"],
  38394. messageSends: ["ifNil:", "new"]
  38395. }),
  38396. $globals.SemanticAnalyzer);
  38397. $core.addMethod(
  38398. $core.method({
  38399. selector: "newBlockScope",
  38400. protocol: "factory",
  38401. fn: function (){
  38402. var self=this,$self=this;
  38403. return $core.withContext(function($ctx1) {
  38404. return $self._newScopeOfClass_($globals.LexicalScope);
  38405. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  38406. },
  38407. args: [],
  38408. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  38409. referencedClasses: ["LexicalScope"],
  38410. messageSends: ["newScopeOfClass:"]
  38411. }),
  38412. $globals.SemanticAnalyzer);
  38413. $core.addMethod(
  38414. $core.method({
  38415. selector: "newMethodScope",
  38416. protocol: "factory",
  38417. fn: function (){
  38418. var self=this,$self=this;
  38419. return $core.withContext(function($ctx1) {
  38420. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  38421. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  38422. },
  38423. args: [],
  38424. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  38425. referencedClasses: ["MethodLexicalScope"],
  38426. messageSends: ["newScopeOfClass:"]
  38427. }),
  38428. $globals.SemanticAnalyzer);
  38429. $core.addMethod(
  38430. $core.method({
  38431. selector: "newScopeOfClass:",
  38432. protocol: "factory",
  38433. fn: function (aLexicalScopeClass){
  38434. var self=this,$self=this;
  38435. return $core.withContext(function($ctx1) {
  38436. var $1;
  38437. $1=$recv(aLexicalScopeClass)._new();
  38438. $recv($1)._outerScope_($self.currentScope);
  38439. return $recv($1)._yourself();
  38440. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  38441. },
  38442. args: ["aLexicalScopeClass"],
  38443. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  38444. referencedClasses: [],
  38445. messageSends: ["outerScope:", "new", "yourself"]
  38446. }),
  38447. $globals.SemanticAnalyzer);
  38448. $core.addMethod(
  38449. $core.method({
  38450. selector: "nextBlockIndex",
  38451. protocol: "private",
  38452. fn: function (){
  38453. var self=this,$self=this;
  38454. return $core.withContext(function($ctx1) {
  38455. var $1,$receiver;
  38456. $1=$self.blockIndex;
  38457. if(($receiver = $1) == null || $receiver.a$nil){
  38458. $self.blockIndex=(0);
  38459. $self.blockIndex;
  38460. } else {
  38461. $1;
  38462. }
  38463. $self.blockIndex=$recv($self.blockIndex).__plus((1));
  38464. return $self.blockIndex;
  38465. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  38466. },
  38467. args: [],
  38468. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  38469. referencedClasses: [],
  38470. messageSends: ["ifNil:", "+"]
  38471. }),
  38472. $globals.SemanticAnalyzer);
  38473. $core.addMethod(
  38474. $core.method({
  38475. selector: "popScope",
  38476. protocol: "scope",
  38477. fn: function (){
  38478. var self=this,$self=this;
  38479. return $core.withContext(function($ctx1) {
  38480. var $1,$receiver;
  38481. $1=$self.currentScope;
  38482. if(($receiver = $1) == null || $receiver.a$nil){
  38483. $1;
  38484. } else {
  38485. $self.currentScope=$recv($self.currentScope)._outerScope();
  38486. $self.currentScope;
  38487. }
  38488. return self;
  38489. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  38490. },
  38491. args: [],
  38492. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  38493. referencedClasses: [],
  38494. messageSends: ["ifNotNil:", "outerScope"]
  38495. }),
  38496. $globals.SemanticAnalyzer);
  38497. $core.addMethod(
  38498. $core.method({
  38499. selector: "pushScope:",
  38500. protocol: "scope",
  38501. fn: function (aScope){
  38502. var self=this,$self=this;
  38503. return $core.withContext(function($ctx1) {
  38504. $recv(aScope)._outerScope_($self.currentScope);
  38505. $self.currentScope=aScope;
  38506. return self;
  38507. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  38508. },
  38509. args: ["aScope"],
  38510. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  38511. referencedClasses: [],
  38512. messageSends: ["outerScope:"]
  38513. }),
  38514. $globals.SemanticAnalyzer);
  38515. $core.addMethod(
  38516. $core.method({
  38517. selector: "theClass",
  38518. protocol: "accessing",
  38519. fn: function (){
  38520. var self=this,$self=this;
  38521. return $self.theClass;
  38522. },
  38523. args: [],
  38524. source: "theClass\x0a\x09^ theClass",
  38525. referencedClasses: [],
  38526. messageSends: []
  38527. }),
  38528. $globals.SemanticAnalyzer);
  38529. $core.addMethod(
  38530. $core.method({
  38531. selector: "theClass:",
  38532. protocol: "accessing",
  38533. fn: function (aClass){
  38534. var self=this,$self=this;
  38535. $self.theClass=aClass;
  38536. return self;
  38537. },
  38538. args: ["aClass"],
  38539. source: "theClass: aClass\x0a\x09theClass := aClass",
  38540. referencedClasses: [],
  38541. messageSends: []
  38542. }),
  38543. $globals.SemanticAnalyzer);
  38544. $core.addMethod(
  38545. $core.method({
  38546. selector: "thePackage",
  38547. protocol: "accessing",
  38548. fn: function (){
  38549. var self=this,$self=this;
  38550. return $self.thePackage;
  38551. },
  38552. args: [],
  38553. source: "thePackage\x0a\x09^ thePackage",
  38554. referencedClasses: [],
  38555. messageSends: []
  38556. }),
  38557. $globals.SemanticAnalyzer);
  38558. $core.addMethod(
  38559. $core.method({
  38560. selector: "thePackage:",
  38561. protocol: "accessing",
  38562. fn: function (aPackage){
  38563. var self=this,$self=this;
  38564. $self.thePackage=aPackage;
  38565. return self;
  38566. },
  38567. args: ["aPackage"],
  38568. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  38569. referencedClasses: [],
  38570. messageSends: []
  38571. }),
  38572. $globals.SemanticAnalyzer);
  38573. $core.addMethod(
  38574. $core.method({
  38575. selector: "validateVariableScope:",
  38576. protocol: "scope",
  38577. fn: function (aString){
  38578. var self=this,$self=this;
  38579. return $core.withContext(function($ctx1) {
  38580. var $1,$receiver;
  38581. $1=$recv($self.currentScope)._lookupVariable_(aString);
  38582. if(($receiver = $1) == null || $receiver.a$nil){
  38583. $1;
  38584. } else {
  38585. $self._errorShadowingVariable_(aString);
  38586. }
  38587. return self;
  38588. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  38589. },
  38590. args: ["aString"],
  38591. 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 ]",
  38592. referencedClasses: [],
  38593. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  38594. }),
  38595. $globals.SemanticAnalyzer);
  38596. $core.addMethod(
  38597. $core.method({
  38598. selector: "visitAssignmentNode:",
  38599. protocol: "visiting",
  38600. fn: function (aNode){
  38601. var self=this,$self=this;
  38602. return $core.withContext(function($ctx1) {
  38603. (
  38604. $ctx1.supercall = true,
  38605. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($self, [aNode]));
  38606. $ctx1.supercall = false;
  38607. $recv($recv(aNode)._left())._beAssigned();
  38608. return self;
  38609. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38610. },
  38611. args: ["aNode"],
  38612. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  38613. referencedClasses: [],
  38614. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  38615. }),
  38616. $globals.SemanticAnalyzer);
  38617. $core.addMethod(
  38618. $core.method({
  38619. selector: "visitBlockNode:",
  38620. protocol: "visiting",
  38621. fn: function (aNode){
  38622. var self=this,$self=this;
  38623. return $core.withContext(function($ctx1) {
  38624. $self._pushScope_($self._newBlockScope());
  38625. $recv(aNode)._scope_($self.currentScope);
  38626. $recv($self.currentScope)._node_(aNode);
  38627. $recv($self.currentScope)._blockIndex_($self._nextBlockIndex());
  38628. $recv($recv(aNode)._parameters())._do_((function(each){
  38629. return $core.withContext(function($ctx2) {
  38630. $self._validateVariableScope_(each);
  38631. return $recv($self.currentScope)._addArg_(each);
  38632. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38633. }));
  38634. (
  38635. $ctx1.supercall = true,
  38636. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($self, [aNode]));
  38637. $ctx1.supercall = false;
  38638. $self._popScope();
  38639. return self;
  38640. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38641. },
  38642. args: ["aNode"],
  38643. 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",
  38644. referencedClasses: [],
  38645. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  38646. }),
  38647. $globals.SemanticAnalyzer);
  38648. $core.addMethod(
  38649. $core.method({
  38650. selector: "visitCascadeNode:",
  38651. protocol: "visiting",
  38652. fn: function (aNode){
  38653. var self=this,$self=this;
  38654. return $core.withContext(function($ctx1) {
  38655. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  38656. (
  38657. $ctx1.supercall = true,
  38658. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($self, [aNode]));
  38659. $ctx1.supercall = false;
  38660. return self;
  38661. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38662. },
  38663. args: ["aNode"],
  38664. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  38665. referencedClasses: [],
  38666. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  38667. }),
  38668. $globals.SemanticAnalyzer);
  38669. $core.addMethod(
  38670. $core.method({
  38671. selector: "visitMethodNode:",
  38672. protocol: "visiting",
  38673. fn: function (aNode){
  38674. var self=this,$self=this;
  38675. return $core.withContext(function($ctx1) {
  38676. $self._pushScope_($self._newMethodScope());
  38677. $recv(aNode)._scope_($self.currentScope);
  38678. $recv($self.currentScope)._node_(aNode);
  38679. $recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  38680. return $core.withContext(function($ctx2) {
  38681. return $recv($self.currentScope)._addIVar_(each);
  38682. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38683. }));
  38684. $ctx1.sendIdx["do:"]=1;
  38685. $recv($recv(aNode)._arguments())._do_((function(each){
  38686. return $core.withContext(function($ctx2) {
  38687. $self._validateVariableScope_(each);
  38688. return $recv($self.currentScope)._addArg_(each);
  38689. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38690. }));
  38691. (
  38692. $ctx1.supercall = true,
  38693. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  38694. $ctx1.supercall = false;
  38695. $recv(aNode)._classReferences_($self._classReferences());
  38696. $recv(aNode)._sendIndexes_($self._messageSends());
  38697. $self._popScope();
  38698. return aNode;
  38699. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38700. },
  38701. args: ["aNode"],
  38702. 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",
  38703. referencedClasses: [],
  38704. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  38705. }),
  38706. $globals.SemanticAnalyzer);
  38707. $core.addMethod(
  38708. $core.method({
  38709. selector: "visitReturnNode:",
  38710. protocol: "visiting",
  38711. fn: function (aNode){
  38712. var self=this,$self=this;
  38713. return $core.withContext(function($ctx1) {
  38714. var $1;
  38715. $recv(aNode)._scope_($self.currentScope);
  38716. $1=$recv($self.currentScope)._isMethodScope();
  38717. if($core.assert($1)){
  38718. $recv($self.currentScope)._localReturn_(true);
  38719. } else {
  38720. $recv($recv($self.currentScope)._methodScope())._addNonLocalReturn_($self.currentScope);
  38721. }
  38722. (
  38723. $ctx1.supercall = true,
  38724. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($self, [aNode]));
  38725. $ctx1.supercall = false;
  38726. return self;
  38727. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38728. },
  38729. args: ["aNode"],
  38730. 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",
  38731. referencedClasses: [],
  38732. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  38733. }),
  38734. $globals.SemanticAnalyzer);
  38735. $core.addMethod(
  38736. $core.method({
  38737. selector: "visitSendNode:",
  38738. protocol: "visiting",
  38739. fn: function (aNode){
  38740. var self=this,$self=this;
  38741. var sends;
  38742. return $core.withContext(function($ctx1) {
  38743. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  38744. return $core.withContext(function($ctx2) {
  38745. return $recv($globals.OrderedCollection)._new();
  38746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38747. }));
  38748. $recv(sends)._add_(aNode);
  38749. $recv(aNode)._index_($recv(sends)._size());
  38750. (
  38751. $ctx1.supercall = true,
  38752. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  38753. $ctx1.supercall = false;
  38754. return self;
  38755. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  38756. },
  38757. args: ["aNode"],
  38758. 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",
  38759. referencedClasses: ["OrderedCollection"],
  38760. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  38761. }),
  38762. $globals.SemanticAnalyzer);
  38763. $core.addMethod(
  38764. $core.method({
  38765. selector: "visitSequenceNode:",
  38766. protocol: "visiting",
  38767. fn: function (aNode){
  38768. var self=this,$self=this;
  38769. return $core.withContext(function($ctx1) {
  38770. $recv($recv(aNode)._temps())._do_((function(each){
  38771. return $core.withContext(function($ctx2) {
  38772. $self._validateVariableScope_(each);
  38773. return $recv($self.currentScope)._addTemp_(each);
  38774. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38775. }));
  38776. (
  38777. $ctx1.supercall = true,
  38778. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  38779. $ctx1.supercall = false;
  38780. return self;
  38781. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38782. },
  38783. args: ["aNode"],
  38784. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  38785. referencedClasses: [],
  38786. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  38787. }),
  38788. $globals.SemanticAnalyzer);
  38789. $core.addMethod(
  38790. $core.method({
  38791. selector: "visitVariableNode:",
  38792. protocol: "visiting",
  38793. fn: function (aNode){
  38794. var self=this,$self=this;
  38795. var binding;
  38796. return $core.withContext(function($ctx1) {
  38797. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  38798. binding=$recv($self.currentScope)._lookupVariable_(aNode);
  38799. $1=binding;
  38800. if(($receiver = $1) == null || $receiver.a$nil){
  38801. $3=$recv(aNode)._value();
  38802. $ctx1.sendIdx["value"]=1;
  38803. $2=$recv($3)._isCapitalized();
  38804. if($core.assert($2)){
  38805. $4=$recv($globals.ClassRefVar)._new();
  38806. $ctx1.sendIdx["new"]=1;
  38807. $5=$recv(aNode)._value();
  38808. $ctx1.sendIdx["value"]=2;
  38809. $recv($4)._name_($5);
  38810. $ctx1.sendIdx["name:"]=1;
  38811. $6=$recv($4)._yourself();
  38812. $ctx1.sendIdx["yourself"]=1;
  38813. binding=$6;
  38814. $7=$self._classReferences();
  38815. $8=$recv(aNode)._value();
  38816. $ctx1.sendIdx["value"]=3;
  38817. $recv($7)._add_($8);
  38818. } else {
  38819. $self._errorUnknownVariable_(aNode);
  38820. $9=$recv($globals.UnknownVar)._new();
  38821. $recv($9)._name_($recv(aNode)._value());
  38822. binding=$recv($9)._yourself();
  38823. binding;
  38824. }
  38825. } else {
  38826. $1;
  38827. }
  38828. $recv(aNode)._binding_(binding);
  38829. return self;
  38830. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  38831. },
  38832. args: ["aNode"],
  38833. 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.",
  38834. referencedClasses: ["ClassRefVar", "UnknownVar"],
  38835. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  38836. }),
  38837. $globals.SemanticAnalyzer);
  38838. $core.addMethod(
  38839. $core.method({
  38840. selector: "on:",
  38841. protocol: "instance creation",
  38842. fn: function (aClass){
  38843. var self=this,$self=this;
  38844. return $core.withContext(function($ctx1) {
  38845. var $1;
  38846. $1=$self._new();
  38847. $recv($1)._theClass_(aClass);
  38848. return $recv($1)._yourself();
  38849. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.a$cls)});
  38850. },
  38851. args: ["aClass"],
  38852. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  38853. referencedClasses: [],
  38854. messageSends: ["theClass:", "new", "yourself"]
  38855. }),
  38856. $globals.SemanticAnalyzer.a$cls);
  38857. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  38858. $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";
  38859. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38860. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  38861. $core.addMethod(
  38862. $core.method({
  38863. selector: "messageText",
  38864. protocol: "accessing",
  38865. fn: function (){
  38866. var self=this,$self=this;
  38867. return $core.withContext(function($ctx1) {
  38868. return " Invalid assignment to variable: ".__comma($self._variableName());
  38869. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  38870. },
  38871. args: [],
  38872. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  38873. referencedClasses: [],
  38874. messageSends: [",", "variableName"]
  38875. }),
  38876. $globals.InvalidAssignmentError);
  38877. $core.addMethod(
  38878. $core.method({
  38879. selector: "variableName",
  38880. protocol: "accessing",
  38881. fn: function (){
  38882. var self=this,$self=this;
  38883. return $self.variableName;
  38884. },
  38885. args: [],
  38886. source: "variableName\x0a\x09^ variableName",
  38887. referencedClasses: [],
  38888. messageSends: []
  38889. }),
  38890. $globals.InvalidAssignmentError);
  38891. $core.addMethod(
  38892. $core.method({
  38893. selector: "variableName:",
  38894. protocol: "accessing",
  38895. fn: function (aString){
  38896. var self=this,$self=this;
  38897. $self.variableName=aString;
  38898. return self;
  38899. },
  38900. args: ["aString"],
  38901. source: "variableName: aString\x0a\x09variableName := aString",
  38902. referencedClasses: [],
  38903. messageSends: []
  38904. }),
  38905. $globals.InvalidAssignmentError);
  38906. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38907. $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.";
  38908. $core.addMethod(
  38909. $core.method({
  38910. selector: "messageText",
  38911. protocol: "accessing",
  38912. fn: function (){
  38913. var self=this,$self=this;
  38914. return $core.withContext(function($ctx1) {
  38915. var $1;
  38916. $1=$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined");
  38917. $ctx1.sendIdx[","]=1;
  38918. return $1;
  38919. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  38920. },
  38921. args: [],
  38922. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  38923. referencedClasses: [],
  38924. messageSends: [",", "variableName"]
  38925. }),
  38926. $globals.ShadowingVariableError);
  38927. $core.addMethod(
  38928. $core.method({
  38929. selector: "variableName",
  38930. protocol: "accessing",
  38931. fn: function (){
  38932. var self=this,$self=this;
  38933. return $self.variableName;
  38934. },
  38935. args: [],
  38936. source: "variableName\x0a\x09^ variableName",
  38937. referencedClasses: [],
  38938. messageSends: []
  38939. }),
  38940. $globals.ShadowingVariableError);
  38941. $core.addMethod(
  38942. $core.method({
  38943. selector: "variableName:",
  38944. protocol: "accessing",
  38945. fn: function (aString){
  38946. var self=this,$self=this;
  38947. $self.variableName=aString;
  38948. return self;
  38949. },
  38950. args: ["aString"],
  38951. source: "variableName: aString\x0a\x09variableName := aString",
  38952. referencedClasses: [],
  38953. messageSends: []
  38954. }),
  38955. $globals.ShadowingVariableError);
  38956. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38957. $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.";
  38958. $core.addMethod(
  38959. $core.method({
  38960. selector: "messageText",
  38961. protocol: "accessing",
  38962. fn: function (){
  38963. var self=this,$self=this;
  38964. return $core.withContext(function($ctx1) {
  38965. var $1;
  38966. $1=$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined");
  38967. $ctx1.sendIdx[","]=1;
  38968. return $1;
  38969. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  38970. },
  38971. args: [],
  38972. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  38973. referencedClasses: [],
  38974. messageSends: [",", "variableName"]
  38975. }),
  38976. $globals.UnknownVariableError);
  38977. $core.addMethod(
  38978. $core.method({
  38979. selector: "variableName",
  38980. protocol: "accessing",
  38981. fn: function (){
  38982. var self=this,$self=this;
  38983. return $self.variableName;
  38984. },
  38985. args: [],
  38986. source: "variableName\x0a\x09^ variableName",
  38987. referencedClasses: [],
  38988. messageSends: []
  38989. }),
  38990. $globals.UnknownVariableError);
  38991. $core.addMethod(
  38992. $core.method({
  38993. selector: "variableName:",
  38994. protocol: "accessing",
  38995. fn: function (aString){
  38996. var self=this,$self=this;
  38997. $self.variableName=aString;
  38998. return self;
  38999. },
  39000. args: ["aString"],
  39001. source: "variableName: aString\x0a\x09variableName := aString",
  39002. referencedClasses: [],
  39003. messageSends: []
  39004. }),
  39005. $globals.UnknownVariableError);
  39006. $core.addMethod(
  39007. $core.method({
  39008. selector: "inlineJS:",
  39009. protocol: "*Compiler-Semantic",
  39010. fn: function (aString){
  39011. var self=this,$self=this;
  39012. return $core.withContext(function($ctx1) {
  39013. var $2,$1,$3,$5,$4;
  39014. $2=$self._sequenceNode();
  39015. $ctx1.sendIdx["sequenceNode"]=1;
  39016. $1=$recv($2)._dagChildren();
  39017. $recv($1)._ifNotEmpty_((function(){
  39018. return $core.withContext(function($ctx2) {
  39019. return $recv($globals.CompilerError)._signal_("inlineJS: does not allow smalltalk statements");
  39020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39021. }));
  39022. $3=$self._sequenceNode();
  39023. $5=$recv($globals.JSStatementNode)._new();
  39024. $recv($5)._source_(aString);
  39025. $4=$recv($5)._yourself();
  39026. $recv($3)._addDagChild_($4);
  39027. return self;
  39028. }, function($ctx1) {$ctx1.fill(self,"inlineJS:",{aString:aString},$globals.EarlyPragmator)});
  39029. },
  39030. args: ["aString"],
  39031. source: "inlineJS: aString\x0a\x09self sequenceNode dagChildren ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'inlineJS: does not allow smalltalk statements' ].\x0a\x09self sequenceNode addDagChild: (\x0a\x09\x09JSStatementNode new\x0a\x09\x09\x09source: aString;\x0a\x09\x09\x09yourself)",
  39032. referencedClasses: ["CompilerError", "JSStatementNode"],
  39033. messageSends: ["ifNotEmpty:", "dagChildren", "sequenceNode", "signal:", "addDagChild:", "source:", "new", "yourself"]
  39034. }),
  39035. $globals.EarlyPragmator);
  39036. });
  39037. define('amber/core/Compiler-IR',["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Kernel-Dag", "amber/core/Kernel-Methods", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  39038. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  39039. var $pkg = $core.addPackage("Compiler-IR");
  39040. $pkg.innerEval = function (expr) { return eval(expr); };
  39041. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  39042. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  39043. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  39044. $core.addMethod(
  39045. $core.method({
  39046. selector: "addToSequence:",
  39047. protocol: "visiting",
  39048. fn: function (anInstruction){
  39049. var self=this,$self=this;
  39050. return $core.withContext(function($ctx1) {
  39051. var $1,$receiver;
  39052. if(($receiver = anInstruction) == null || $receiver.a$nil){
  39053. anInstruction;
  39054. } else {
  39055. $1=$recv(anInstruction)._isVariable();
  39056. if(!$core.assert($1)){
  39057. $recv($self._sequence())._add_(anInstruction);
  39058. }
  39059. }
  39060. return anInstruction;
  39061. }, function($ctx1) {$ctx1.fill(self,"addToSequence:",{anInstruction:anInstruction},$globals.IRASTTranslator)});
  39062. },
  39063. args: ["anInstruction"],
  39064. source: "addToSequence: anInstruction\x0a\x09anInstruction ifNotNil: [\x0a\x09\x09anInstruction isVariable ifFalse: [\x0a\x09\x09\x09self sequence add: anInstruction ] ].\x0a\x09^ anInstruction",
  39065. referencedClasses: [],
  39066. messageSends: ["ifNotNil:", "ifFalse:", "isVariable", "add:", "sequence"]
  39067. }),
  39068. $globals.IRASTTranslator);
  39069. $core.addMethod(
  39070. $core.method({
  39071. selector: "alias:",
  39072. protocol: "visiting",
  39073. fn: function (aNode){
  39074. var self=this,$self=this;
  39075. var variable;
  39076. return $core.withContext(function($ctx1) {
  39077. var $1,$2,$3,$5,$4,$6,$8,$7;
  39078. $1=$recv(aNode)._isImmutable();
  39079. if($core.assert($1)){
  39080. $2=$self._visit_(aNode);
  39081. $ctx1.sendIdx["visit:"]=1;
  39082. return $2;
  39083. }
  39084. $3=$recv($globals.IRVariable)._new();
  39085. $ctx1.sendIdx["new"]=1;
  39086. $5=$recv($globals.AliasVar)._new();
  39087. $ctx1.sendIdx["new"]=2;
  39088. $4=$recv($5)._name_("$".__comma($self._nextAlias()));
  39089. $recv($3)._variable_($4);
  39090. $6=$recv($3)._yourself();
  39091. $ctx1.sendIdx["yourself"]=1;
  39092. variable=$6;
  39093. $8=$recv($globals.IRAssignment)._new();
  39094. $recv($8)._add_(variable);
  39095. $ctx1.sendIdx["add:"]=1;
  39096. $recv($8)._add_($self._visit_(aNode));
  39097. $ctx1.sendIdx["add:"]=2;
  39098. $7=$recv($8)._yourself();
  39099. $self._addToSequence_($7);
  39100. $recv($recv($self._method())._internalVariables())._add_(variable);
  39101. return variable;
  39102. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  39103. },
  39104. args: ["aNode"],
  39105. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self addToSequence: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  39106. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  39107. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "addToSequence:", "add:", "internalVariables", "method"]
  39108. }),
  39109. $globals.IRASTTranslator);
  39110. $core.addMethod(
  39111. $core.method({
  39112. selector: "aliasTemporally:",
  39113. protocol: "visiting",
  39114. fn: function (aCollection){
  39115. var self=this,$self=this;
  39116. var threshold,result;
  39117. return $core.withContext(function($ctx1) {
  39118. var $1,$2,$4,$3;
  39119. threshold=(0);
  39120. $recv(aCollection)._withIndexDo_((function(each,i){
  39121. return $core.withContext(function($ctx2) {
  39122. $1=$recv(each)._subtreeNeedsAliasing();
  39123. if($core.assert($1)){
  39124. threshold=i;
  39125. return threshold;
  39126. }
  39127. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  39128. }));
  39129. $ctx1.sendIdx["withIndexDo:"]=1;
  39130. result=$recv($globals.OrderedCollection)._new();
  39131. $recv(aCollection)._withIndexDo_((function(each,i){
  39132. return $core.withContext(function($ctx2) {
  39133. $2=result;
  39134. $4=$recv(i).__lt_eq(threshold);
  39135. if($core.assert($4)){
  39136. $3=$self._alias_(each);
  39137. } else {
  39138. $3=$self._visit_(each);
  39139. }
  39140. return $recv($2)._add_($3);
  39141. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  39142. }));
  39143. return result;
  39144. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  39145. },
  39146. args: ["aCollection"],
  39147. 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",
  39148. referencedClasses: ["OrderedCollection"],
  39149. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  39150. }),
  39151. $globals.IRASTTranslator);
  39152. $core.addMethod(
  39153. $core.method({
  39154. selector: "method",
  39155. protocol: "accessing",
  39156. fn: function (){
  39157. var self=this,$self=this;
  39158. return $self.method;
  39159. },
  39160. args: [],
  39161. source: "method\x0a\x09^ method",
  39162. referencedClasses: [],
  39163. messageSends: []
  39164. }),
  39165. $globals.IRASTTranslator);
  39166. $core.addMethod(
  39167. $core.method({
  39168. selector: "method:",
  39169. protocol: "accessing",
  39170. fn: function (anIRMethod){
  39171. var self=this,$self=this;
  39172. $self.method=anIRMethod;
  39173. return self;
  39174. },
  39175. args: ["anIRMethod"],
  39176. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  39177. referencedClasses: [],
  39178. messageSends: []
  39179. }),
  39180. $globals.IRASTTranslator);
  39181. $core.addMethod(
  39182. $core.method({
  39183. selector: "nextAlias",
  39184. protocol: "accessing",
  39185. fn: function (){
  39186. var self=this,$self=this;
  39187. return $core.withContext(function($ctx1) {
  39188. var $1,$receiver;
  39189. $1=$self.nextAlias;
  39190. if(($receiver = $1) == null || $receiver.a$nil){
  39191. $self.nextAlias=(0);
  39192. $self.nextAlias;
  39193. } else {
  39194. $1;
  39195. }
  39196. $self.nextAlias=$recv($self.nextAlias).__plus((1));
  39197. return $recv($self.nextAlias)._asString();
  39198. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  39199. },
  39200. args: [],
  39201. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  39202. referencedClasses: [],
  39203. messageSends: ["ifNil:", "+", "asString"]
  39204. }),
  39205. $globals.IRASTTranslator);
  39206. $core.addMethod(
  39207. $core.method({
  39208. selector: "sequence",
  39209. protocol: "accessing",
  39210. fn: function (){
  39211. var self=this,$self=this;
  39212. return $self.sequence;
  39213. },
  39214. args: [],
  39215. source: "sequence\x0a\x09^ sequence",
  39216. referencedClasses: [],
  39217. messageSends: []
  39218. }),
  39219. $globals.IRASTTranslator);
  39220. $core.addMethod(
  39221. $core.method({
  39222. selector: "sequence:",
  39223. protocol: "accessing",
  39224. fn: function (anIRSequence){
  39225. var self=this,$self=this;
  39226. $self.sequence=anIRSequence;
  39227. return self;
  39228. },
  39229. args: ["anIRSequence"],
  39230. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  39231. referencedClasses: [],
  39232. messageSends: []
  39233. }),
  39234. $globals.IRASTTranslator);
  39235. $core.addMethod(
  39236. $core.method({
  39237. selector: "source",
  39238. protocol: "accessing",
  39239. fn: function (){
  39240. var self=this,$self=this;
  39241. return $self.source;
  39242. },
  39243. args: [],
  39244. source: "source\x0a\x09^ source",
  39245. referencedClasses: [],
  39246. messageSends: []
  39247. }),
  39248. $globals.IRASTTranslator);
  39249. $core.addMethod(
  39250. $core.method({
  39251. selector: "source:",
  39252. protocol: "accessing",
  39253. fn: function (aString){
  39254. var self=this,$self=this;
  39255. $self.source=aString;
  39256. return self;
  39257. },
  39258. args: ["aString"],
  39259. source: "source: aString\x0a\x09source := aString",
  39260. referencedClasses: [],
  39261. messageSends: []
  39262. }),
  39263. $globals.IRASTTranslator);
  39264. $core.addMethod(
  39265. $core.method({
  39266. selector: "theClass",
  39267. protocol: "accessing",
  39268. fn: function (){
  39269. var self=this,$self=this;
  39270. return $self.theClass;
  39271. },
  39272. args: [],
  39273. source: "theClass\x0a\x09^ theClass",
  39274. referencedClasses: [],
  39275. messageSends: []
  39276. }),
  39277. $globals.IRASTTranslator);
  39278. $core.addMethod(
  39279. $core.method({
  39280. selector: "theClass:",
  39281. protocol: "accessing",
  39282. fn: function (aClass){
  39283. var self=this,$self=this;
  39284. $self.theClass=aClass;
  39285. return self;
  39286. },
  39287. args: ["aClass"],
  39288. source: "theClass: aClass\x0a\x09theClass := aClass",
  39289. referencedClasses: [],
  39290. messageSends: []
  39291. }),
  39292. $globals.IRASTTranslator);
  39293. $core.addMethod(
  39294. $core.method({
  39295. selector: "visitAssignmentNode:",
  39296. protocol: "visiting",
  39297. fn: function (aNode){
  39298. var self=this,$self=this;
  39299. var left,right,assignment;
  39300. return $core.withContext(function($ctx1) {
  39301. var $2,$1;
  39302. right=$self._visit_($recv(aNode)._right());
  39303. $ctx1.sendIdx["visit:"]=1;
  39304. left=$self._visit_($recv(aNode)._left());
  39305. $2=$recv($globals.IRAssignment)._new();
  39306. $recv($2)._add_(left);
  39307. $ctx1.sendIdx["add:"]=1;
  39308. $recv($2)._add_(right);
  39309. $1=$recv($2)._yourself();
  39310. $self._addToSequence_($1);
  39311. return left;
  39312. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  39313. },
  39314. args: ["aNode"],
  39315. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self addToSequence: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  39316. referencedClasses: ["IRAssignment"],
  39317. messageSends: ["visit:", "right", "left", "addToSequence:", "add:", "new", "yourself"]
  39318. }),
  39319. $globals.IRASTTranslator);
  39320. $core.addMethod(
  39321. $core.method({
  39322. selector: "visitBlockNode:",
  39323. protocol: "visiting",
  39324. fn: function (aNode){
  39325. var self=this,$self=this;
  39326. var closure;
  39327. return $core.withContext(function($ctx1) {
  39328. var $1,$2,$3,$5,$4,$6,$8,$7;
  39329. $1=$recv($globals.IRClosure)._new();
  39330. $ctx1.sendIdx["new"]=1;
  39331. $recv($1)._arguments_($recv(aNode)._parameters());
  39332. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39333. $2=$recv(aNode)._scope();
  39334. $ctx1.sendIdx["scope"]=1;
  39335. $recv($1)._scope_($2);
  39336. $ctx1.sendIdx["scope:"]=1;
  39337. $3=$recv($1)._yourself();
  39338. $ctx1.sendIdx["yourself"]=1;
  39339. closure=$3;
  39340. $5=$recv(aNode)._scope();
  39341. $ctx1.sendIdx["scope"]=2;
  39342. $4=$recv($5)._temps();
  39343. $recv($4)._do_((function(each){
  39344. return $core.withContext(function($ctx2) {
  39345. $6=closure;
  39346. $8=$recv($globals.IRTempDeclaration)._new();
  39347. $recv($8)._name_($recv(each)._name());
  39348. $recv($8)._scope_($recv(aNode)._scope());
  39349. $7=$recv($8)._yourself();
  39350. return $recv($6)._add_($7);
  39351. $ctx2.sendIdx["add:"]=1;
  39352. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39353. }));
  39354. $ctx1.sendIdx["do:"]=1;
  39355. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39356. return $core.withContext(function($ctx2) {
  39357. return $recv(closure)._add_($self._visit_(each));
  39358. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39359. }));
  39360. return closure;
  39361. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  39362. },
  39363. args: ["aNode"],
  39364. 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",
  39365. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  39366. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  39367. }),
  39368. $globals.IRASTTranslator);
  39369. $core.addMethod(
  39370. $core.method({
  39371. selector: "visitBlockSequenceNode:",
  39372. protocol: "visiting",
  39373. fn: function (aNode){
  39374. var self=this,$self=this;
  39375. return $core.withContext(function($ctx1) {
  39376. var $1,$2,$4,$3,$5,$8,$7,$6,$10,$13,$12,$11,$9;
  39377. $1=$recv($globals.IRBlockSequence)._new();
  39378. $ctx1.sendIdx["new"]=1;
  39379. return $self._withSequence_do_($1,(function(){
  39380. return $core.withContext(function($ctx2) {
  39381. $2=$recv(aNode)._dagChildren();
  39382. $ctx2.sendIdx["dagChildren"]=1;
  39383. return $recv($2)._ifNotEmpty_((function(){
  39384. return $core.withContext(function($ctx3) {
  39385. $4=$recv(aNode)._dagChildren();
  39386. $ctx3.sendIdx["dagChildren"]=2;
  39387. $3=$recv($4)._allButLast();
  39388. $recv($3)._do_((function(each){
  39389. return $core.withContext(function($ctx4) {
  39390. $5=$self._visitOrAlias_(each);
  39391. $ctx4.sendIdx["visitOrAlias:"]=1;
  39392. return $self._addToSequence_($5);
  39393. $ctx4.sendIdx["addToSequence:"]=1;
  39394. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  39395. }));
  39396. $8=$recv(aNode)._dagChildren();
  39397. $ctx3.sendIdx["dagChildren"]=3;
  39398. $7=$recv($8)._last();
  39399. $ctx3.sendIdx["last"]=1;
  39400. $6=$recv($7)._isReturnNode();
  39401. if($core.assert($6)){
  39402. return $self._addToSequence_($self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  39403. } else {
  39404. $10=$recv($globals.IRBlockReturn)._new();
  39405. $13=$recv(aNode)._dagChildren();
  39406. $ctx3.sendIdx["dagChildren"]=4;
  39407. $12=$recv($13)._last();
  39408. $ctx3.sendIdx["last"]=2;
  39409. $11=$self._visitOrAlias_($12);
  39410. $ctx3.sendIdx["visitOrAlias:"]=2;
  39411. $recv($10)._add_($11);
  39412. $9=$recv($10)._yourself();
  39413. return $self._addToSequence_($9);
  39414. $ctx3.sendIdx["addToSequence:"]=2;
  39415. }
  39416. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39417. }));
  39418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39419. }));
  39420. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39421. },
  39422. args: ["aNode"],
  39423. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren ifNotEmpty: [\x0a\x09\x09\x09\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self addToSequence: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self addToSequence: (IRBlockReturn new add: (self visitOrAlias: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self addToSequence: (self visitOrAlias: aNode dagChildren last) ] ]]",
  39424. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  39425. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "addToSequence:", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "add:", "yourself"]
  39426. }),
  39427. $globals.IRASTTranslator);
  39428. $core.addMethod(
  39429. $core.method({
  39430. selector: "visitCascadeNode:",
  39431. protocol: "visiting",
  39432. fn: function (aNode){
  39433. var self=this,$self=this;
  39434. var receiver;
  39435. return $core.withContext(function($ctx1) {
  39436. var $1,$2,$4,$3;
  39437. receiver=$recv(aNode)._receiver();
  39438. $1=$recv(receiver)._isImmutable();
  39439. if(!$core.assert($1)){
  39440. var alias;
  39441. alias=$self._alias_(receiver);
  39442. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  39443. receiver;
  39444. }
  39445. $2=$recv(aNode)._dagChildren();
  39446. $ctx1.sendIdx["dagChildren"]=1;
  39447. $recv($2)._do_((function(each){
  39448. return $core.withContext(function($ctx2) {
  39449. return $recv(each)._receiver_(receiver);
  39450. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39451. }));
  39452. $ctx1.sendIdx["do:"]=1;
  39453. $4=$recv(aNode)._dagChildren();
  39454. $ctx1.sendIdx["dagChildren"]=2;
  39455. $3=$recv($4)._allButLast();
  39456. $recv($3)._do_((function(each){
  39457. return $core.withContext(function($ctx2) {
  39458. return $self._addToSequence_($self._visit_(each));
  39459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39460. }));
  39461. return $self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  39462. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  39463. },
  39464. args: ["aNode"],
  39465. source: "visitCascadeNode: aNode\x0a\x09| receiver |\x0a\x09receiver := aNode receiver.\x0a\x09receiver isImmutable ifFalse: [\x0a\x09\x09| alias |\x0a\x09\x09alias := self alias: receiver.\x0a\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09aNode dagChildren do: [ :each | each receiver: receiver ].\x0a\x0a\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09self addToSequence: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode dagChildren last",
  39466. referencedClasses: ["VariableNode"],
  39467. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "addToSequence:", "visit:", "visitOrAlias:", "last"]
  39468. }),
  39469. $globals.IRASTTranslator);
  39470. $core.addMethod(
  39471. $core.method({
  39472. selector: "visitDynamicArrayNode:",
  39473. protocol: "visiting",
  39474. fn: function (aNode){
  39475. var self=this,$self=this;
  39476. var array;
  39477. return $core.withContext(function($ctx1) {
  39478. array=$recv($globals.IRDynamicArray)._new();
  39479. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39480. return $core.withContext(function($ctx2) {
  39481. return $recv(array)._add_(each);
  39482. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39483. }));
  39484. return array;
  39485. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  39486. },
  39487. args: ["aNode"],
  39488. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  39489. referencedClasses: ["IRDynamicArray"],
  39490. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39491. }),
  39492. $globals.IRASTTranslator);
  39493. $core.addMethod(
  39494. $core.method({
  39495. selector: "visitDynamicDictionaryNode:",
  39496. protocol: "visiting",
  39497. fn: function (aNode){
  39498. var self=this,$self=this;
  39499. var dictionary;
  39500. return $core.withContext(function($ctx1) {
  39501. dictionary=$recv($globals.IRDynamicDictionary)._new();
  39502. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39503. return $core.withContext(function($ctx2) {
  39504. return $recv(dictionary)._add_(each);
  39505. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39506. }));
  39507. return dictionary;
  39508. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  39509. },
  39510. args: ["aNode"],
  39511. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  39512. referencedClasses: ["IRDynamicDictionary"],
  39513. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39514. }),
  39515. $globals.IRASTTranslator);
  39516. $core.addMethod(
  39517. $core.method({
  39518. selector: "visitJSStatementNode:",
  39519. protocol: "visiting",
  39520. fn: function (aNode){
  39521. var self=this,$self=this;
  39522. return $core.withContext(function($ctx1) {
  39523. var $1;
  39524. $1=$recv($globals.IRVerbatim)._new();
  39525. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  39526. return $recv($1)._yourself();
  39527. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39528. },
  39529. args: ["aNode"],
  39530. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  39531. referencedClasses: ["IRVerbatim"],
  39532. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  39533. }),
  39534. $globals.IRASTTranslator);
  39535. $core.addMethod(
  39536. $core.method({
  39537. selector: "visitMethodNode:",
  39538. protocol: "visiting",
  39539. fn: function (aNode){
  39540. var self=this,$self=this;
  39541. return $core.withContext(function($ctx1) {
  39542. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  39543. $2=$recv($globals.IRMethod)._new();
  39544. $ctx1.sendIdx["new"]=1;
  39545. $recv($2)._source_($recv($self._source())._crlfSanitized());
  39546. $ctx1.sendIdx["source:"]=1;
  39547. $recv($2)._theClass_($self._theClass());
  39548. $recv($2)._arguments_($recv(aNode)._arguments());
  39549. $recv($2)._selector_($recv(aNode)._selector());
  39550. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  39551. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39552. $recv($2)._classReferences_($recv(aNode)._classReferences());
  39553. $3=$recv(aNode)._scope();
  39554. $ctx1.sendIdx["scope"]=1;
  39555. $recv($2)._scope_($3);
  39556. $ctx1.sendIdx["scope:"]=1;
  39557. $4=$recv($2)._yourself();
  39558. $ctx1.sendIdx["yourself"]=1;
  39559. $1=$4;
  39560. $self._method_($1);
  39561. $6=$recv(aNode)._scope();
  39562. $ctx1.sendIdx["scope"]=2;
  39563. $5=$recv($6)._temps();
  39564. $recv($5)._do_((function(each){
  39565. return $core.withContext(function($ctx2) {
  39566. $7=$self._method();
  39567. $ctx2.sendIdx["method"]=1;
  39568. $9=$recv($globals.IRTempDeclaration)._new();
  39569. $ctx2.sendIdx["new"]=2;
  39570. $recv($9)._name_($recv(each)._name());
  39571. $10=$recv(aNode)._scope();
  39572. $ctx2.sendIdx["scope"]=3;
  39573. $recv($9)._scope_($10);
  39574. $11=$recv($9)._yourself();
  39575. $ctx2.sendIdx["yourself"]=2;
  39576. $8=$11;
  39577. return $recv($7)._add_($8);
  39578. $ctx2.sendIdx["add:"]=1;
  39579. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39580. }));
  39581. $ctx1.sendIdx["do:"]=1;
  39582. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39583. return $core.withContext(function($ctx2) {
  39584. $12=$self._method();
  39585. $ctx2.sendIdx["method"]=2;
  39586. return $recv($12)._add_($self._visit_(each));
  39587. $ctx2.sendIdx["add:"]=2;
  39588. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39589. }));
  39590. $14=$recv(aNode)._scope();
  39591. $ctx1.sendIdx["scope"]=4;
  39592. $13=$recv($14)._hasLocalReturn();
  39593. if(!$core.assert($13)){
  39594. $15=$self._method();
  39595. $ctx1.sendIdx["method"]=3;
  39596. $17=$recv($globals.IRReturn)._new();
  39597. $ctx1.sendIdx["new"]=3;
  39598. $19=$recv($globals.IRVariable)._new();
  39599. $ctx1.sendIdx["new"]=4;
  39600. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  39601. $20=$recv($19)._yourself();
  39602. $ctx1.sendIdx["yourself"]=3;
  39603. $18=$20;
  39604. $recv($17)._add_($18);
  39605. $ctx1.sendIdx["add:"]=4;
  39606. $21=$recv($17)._yourself();
  39607. $ctx1.sendIdx["yourself"]=4;
  39608. $16=$21;
  39609. $recv($15)._add_($16);
  39610. $ctx1.sendIdx["add:"]=3;
  39611. $23=$recv($globals.IRVerbatim)._new();
  39612. $recv($23)._source_(";".__comma($recv($globals.String)._lf()));
  39613. $22=$recv($23)._yourself();
  39614. $recv($15)._add_($22);
  39615. }
  39616. return $self._method();
  39617. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39618. },
  39619. args: ["aNode"],
  39620. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ';', String lf; yourself) ].\x0a\x0a\x09^ self method",
  39621. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim", "String"],
  39622. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "dagChildren", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars", ",", "lf"]
  39623. }),
  39624. $globals.IRASTTranslator);
  39625. $core.addMethod(
  39626. $core.method({
  39627. selector: "visitOrAlias:",
  39628. protocol: "visiting",
  39629. fn: function (aNode){
  39630. var self=this,$self=this;
  39631. return $core.withContext(function($ctx1) {
  39632. var $1;
  39633. $1=$recv(aNode)._shouldBeAliased();
  39634. if($core.assert($1)){
  39635. return $self._alias_(aNode);
  39636. } else {
  39637. return $self._visit_(aNode);
  39638. }
  39639. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  39640. },
  39641. args: ["aNode"],
  39642. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  39643. referencedClasses: [],
  39644. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  39645. }),
  39646. $globals.IRASTTranslator);
  39647. $core.addMethod(
  39648. $core.method({
  39649. selector: "visitReturnNode:",
  39650. protocol: "visiting",
  39651. fn: function (aNode){
  39652. var self=this,$self=this;
  39653. var return_;
  39654. return $core.withContext(function($ctx1) {
  39655. var $1;
  39656. $1=$recv(aNode)._nonLocalReturn();
  39657. if($core.assert($1)){
  39658. return_=$recv($globals.IRNonLocalReturn)._new();
  39659. $ctx1.sendIdx["new"]=1;
  39660. } else {
  39661. return_=$recv($globals.IRReturn)._new();
  39662. }
  39663. $recv(return_)._scope_($recv(aNode)._scope());
  39664. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39665. return $core.withContext(function($ctx2) {
  39666. return $recv(return_)._add_($self._visitOrAlias_(each));
  39667. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39668. }));
  39669. return return_;
  39670. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  39671. },
  39672. args: ["aNode"],
  39673. 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",
  39674. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  39675. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  39676. }),
  39677. $globals.IRASTTranslator);
  39678. $core.addMethod(
  39679. $core.method({
  39680. selector: "visitSendNode:",
  39681. protocol: "visiting",
  39682. fn: function (aNode){
  39683. var self=this,$self=this;
  39684. var send;
  39685. return $core.withContext(function($ctx1) {
  39686. var $1;
  39687. send=$recv($globals.IRSend)._new();
  39688. $1=send;
  39689. $recv($1)._selector_($recv(aNode)._selector());
  39690. $recv($1)._index_($recv(aNode)._index());
  39691. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39692. return $core.withContext(function($ctx2) {
  39693. return $recv(send)._add_(each);
  39694. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39695. }));
  39696. return send;
  39697. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  39698. },
  39699. args: ["aNode"],
  39700. 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",
  39701. referencedClasses: ["IRSend"],
  39702. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39703. }),
  39704. $globals.IRASTTranslator);
  39705. $core.addMethod(
  39706. $core.method({
  39707. selector: "visitSequenceNode:",
  39708. protocol: "visiting",
  39709. fn: function (aNode){
  39710. var self=this,$self=this;
  39711. return $core.withContext(function($ctx1) {
  39712. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  39713. return $core.withContext(function($ctx2) {
  39714. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  39715. return $core.withContext(function($ctx3) {
  39716. return $self._addToSequence_($self._visitOrAlias_(each));
  39717. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39718. }));
  39719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39720. }));
  39721. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39722. },
  39723. args: ["aNode"],
  39724. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [ aNode dagChildren do: [ :each |\x0a\x09\x09\x09self addToSequence: (self visitOrAlias: each) ] ]",
  39725. referencedClasses: ["IRSequence"],
  39726. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "addToSequence:", "visitOrAlias:"]
  39727. }),
  39728. $globals.IRASTTranslator);
  39729. $core.addMethod(
  39730. $core.method({
  39731. selector: "visitValueNode:",
  39732. protocol: "visiting",
  39733. fn: function (aNode){
  39734. var self=this,$self=this;
  39735. return $core.withContext(function($ctx1) {
  39736. var $1;
  39737. $1=$recv($globals.IRValue)._new();
  39738. $recv($1)._value_($recv(aNode)._value());
  39739. return $recv($1)._yourself();
  39740. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39741. },
  39742. args: ["aNode"],
  39743. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  39744. referencedClasses: ["IRValue"],
  39745. messageSends: ["value:", "new", "value", "yourself"]
  39746. }),
  39747. $globals.IRASTTranslator);
  39748. $core.addMethod(
  39749. $core.method({
  39750. selector: "visitVariableNode:",
  39751. protocol: "visiting",
  39752. fn: function (aNode){
  39753. var self=this,$self=this;
  39754. return $core.withContext(function($ctx1) {
  39755. var $1;
  39756. $1=$recv($globals.IRVariable)._new();
  39757. $recv($1)._variable_($recv(aNode)._binding());
  39758. return $recv($1)._yourself();
  39759. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39760. },
  39761. args: ["aNode"],
  39762. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  39763. referencedClasses: ["IRVariable"],
  39764. messageSends: ["variable:", "new", "binding", "yourself"]
  39765. }),
  39766. $globals.IRASTTranslator);
  39767. $core.addMethod(
  39768. $core.method({
  39769. selector: "withSequence:do:",
  39770. protocol: "accessing",
  39771. fn: function (aSequence,aBlock){
  39772. var self=this,$self=this;
  39773. var outerSequence;
  39774. return $core.withContext(function($ctx1) {
  39775. outerSequence=$self._sequence();
  39776. $self._sequence_(aSequence);
  39777. $ctx1.sendIdx["sequence:"]=1;
  39778. $recv(aBlock)._value();
  39779. $self._sequence_(outerSequence);
  39780. return aSequence;
  39781. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  39782. },
  39783. args: ["aSequence", "aBlock"],
  39784. 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",
  39785. referencedClasses: [],
  39786. messageSends: ["sequence", "sequence:", "value"]
  39787. }),
  39788. $globals.IRASTTranslator);
  39789. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  39790. $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.";
  39791. $core.addMethod(
  39792. $core.method({
  39793. selector: "add:",
  39794. protocol: "building",
  39795. fn: function (anObject){
  39796. var self=this,$self=this;
  39797. return $core.withContext(function($ctx1) {
  39798. $recv(anObject)._parent_(self);
  39799. return $recv($self._dagChildren())._add_(anObject);
  39800. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  39801. },
  39802. args: ["anObject"],
  39803. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  39804. referencedClasses: [],
  39805. messageSends: ["parent:", "add:", "dagChildren"]
  39806. }),
  39807. $globals.IRInstruction);
  39808. $core.addMethod(
  39809. $core.method({
  39810. selector: "isClosure",
  39811. protocol: "testing",
  39812. fn: function (){
  39813. var self=this,$self=this;
  39814. return false;
  39815. },
  39816. args: [],
  39817. source: "isClosure\x0a\x09^ false",
  39818. referencedClasses: [],
  39819. messageSends: []
  39820. }),
  39821. $globals.IRInstruction);
  39822. $core.addMethod(
  39823. $core.method({
  39824. selector: "isInlined",
  39825. protocol: "testing",
  39826. fn: function (){
  39827. var self=this,$self=this;
  39828. return false;
  39829. },
  39830. args: [],
  39831. source: "isInlined\x0a\x09^ false",
  39832. referencedClasses: [],
  39833. messageSends: []
  39834. }),
  39835. $globals.IRInstruction);
  39836. $core.addMethod(
  39837. $core.method({
  39838. selector: "isMethod",
  39839. protocol: "testing",
  39840. fn: function (){
  39841. var self=this,$self=this;
  39842. return false;
  39843. },
  39844. args: [],
  39845. source: "isMethod\x0a\x09^ false",
  39846. referencedClasses: [],
  39847. messageSends: []
  39848. }),
  39849. $globals.IRInstruction);
  39850. $core.addMethod(
  39851. $core.method({
  39852. selector: "isSelf",
  39853. protocol: "testing",
  39854. fn: function (){
  39855. var self=this,$self=this;
  39856. return false;
  39857. },
  39858. args: [],
  39859. source: "isSelf\x0a\x09^ false",
  39860. referencedClasses: [],
  39861. messageSends: []
  39862. }),
  39863. $globals.IRInstruction);
  39864. $core.addMethod(
  39865. $core.method({
  39866. selector: "isSend",
  39867. protocol: "testing",
  39868. fn: function (){
  39869. var self=this,$self=this;
  39870. return false;
  39871. },
  39872. args: [],
  39873. source: "isSend\x0a\x09^ false",
  39874. referencedClasses: [],
  39875. messageSends: []
  39876. }),
  39877. $globals.IRInstruction);
  39878. $core.addMethod(
  39879. $core.method({
  39880. selector: "isSequence",
  39881. protocol: "testing",
  39882. fn: function (){
  39883. var self=this,$self=this;
  39884. return false;
  39885. },
  39886. args: [],
  39887. source: "isSequence\x0a\x09^ false",
  39888. referencedClasses: [],
  39889. messageSends: []
  39890. }),
  39891. $globals.IRInstruction);
  39892. $core.addMethod(
  39893. $core.method({
  39894. selector: "isSuper",
  39895. protocol: "testing",
  39896. fn: function (){
  39897. var self=this,$self=this;
  39898. return false;
  39899. },
  39900. args: [],
  39901. source: "isSuper\x0a\x09^ false",
  39902. referencedClasses: [],
  39903. messageSends: []
  39904. }),
  39905. $globals.IRInstruction);
  39906. $core.addMethod(
  39907. $core.method({
  39908. selector: "isTempDeclaration",
  39909. protocol: "testing",
  39910. fn: function (){
  39911. var self=this,$self=this;
  39912. return false;
  39913. },
  39914. args: [],
  39915. source: "isTempDeclaration\x0a\x09^ false",
  39916. referencedClasses: [],
  39917. messageSends: []
  39918. }),
  39919. $globals.IRInstruction);
  39920. $core.addMethod(
  39921. $core.method({
  39922. selector: "isVariable",
  39923. protocol: "testing",
  39924. fn: function (){
  39925. var self=this,$self=this;
  39926. return false;
  39927. },
  39928. args: [],
  39929. source: "isVariable\x0a\x09^ false",
  39930. referencedClasses: [],
  39931. messageSends: []
  39932. }),
  39933. $globals.IRInstruction);
  39934. $core.addMethod(
  39935. $core.method({
  39936. selector: "method",
  39937. protocol: "accessing",
  39938. fn: function (){
  39939. var self=this,$self=this;
  39940. return $core.withContext(function($ctx1) {
  39941. return $recv($self._parent())._method();
  39942. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  39943. },
  39944. args: [],
  39945. source: "method\x0a\x09^ self parent method",
  39946. referencedClasses: [],
  39947. messageSends: ["method", "parent"]
  39948. }),
  39949. $globals.IRInstruction);
  39950. $core.addMethod(
  39951. $core.method({
  39952. selector: "needsBoxingAsReceiver",
  39953. protocol: "testing",
  39954. fn: function (){
  39955. var self=this,$self=this;
  39956. return true;
  39957. },
  39958. args: [],
  39959. source: "needsBoxingAsReceiver\x0a\x09^ true",
  39960. referencedClasses: [],
  39961. messageSends: []
  39962. }),
  39963. $globals.IRInstruction);
  39964. $core.addMethod(
  39965. $core.method({
  39966. selector: "parent",
  39967. protocol: "accessing",
  39968. fn: function (){
  39969. var self=this,$self=this;
  39970. return $self.parent;
  39971. },
  39972. args: [],
  39973. source: "parent\x0a\x09^ parent",
  39974. referencedClasses: [],
  39975. messageSends: []
  39976. }),
  39977. $globals.IRInstruction);
  39978. $core.addMethod(
  39979. $core.method({
  39980. selector: "parent:",
  39981. protocol: "accessing",
  39982. fn: function (anIRInstruction){
  39983. var self=this,$self=this;
  39984. $self.parent=anIRInstruction;
  39985. return self;
  39986. },
  39987. args: ["anIRInstruction"],
  39988. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  39989. referencedClasses: [],
  39990. messageSends: []
  39991. }),
  39992. $globals.IRInstruction);
  39993. $core.addMethod(
  39994. $core.method({
  39995. selector: "remove:",
  39996. protocol: "building",
  39997. fn: function (anIRInstruction){
  39998. var self=this,$self=this;
  39999. return $core.withContext(function($ctx1) {
  40000. $recv($self._dagChildren())._remove_(anIRInstruction);
  40001. return self;
  40002. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  40003. },
  40004. args: ["anIRInstruction"],
  40005. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  40006. referencedClasses: [],
  40007. messageSends: ["remove:", "dagChildren"]
  40008. }),
  40009. $globals.IRInstruction);
  40010. $core.addMethod(
  40011. $core.method({
  40012. selector: "replace:with:",
  40013. protocol: "building",
  40014. fn: function (anIRInstruction,anotherIRInstruction){
  40015. var self=this,$self=this;
  40016. return $core.withContext(function($ctx1) {
  40017. var $1;
  40018. $recv(anotherIRInstruction)._parent_(self);
  40019. $1=$self._dagChildren();
  40020. $ctx1.sendIdx["dagChildren"]=1;
  40021. $recv($1)._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  40022. return self;
  40023. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  40024. },
  40025. args: ["anIRInstruction", "anotherIRInstruction"],
  40026. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  40027. referencedClasses: [],
  40028. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  40029. }),
  40030. $globals.IRInstruction);
  40031. $core.addMethod(
  40032. $core.method({
  40033. selector: "replaceWith:",
  40034. protocol: "building",
  40035. fn: function (anIRInstruction){
  40036. var self=this,$self=this;
  40037. return $core.withContext(function($ctx1) {
  40038. $recv($self._parent())._replace_with_(self,anIRInstruction);
  40039. return self;
  40040. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  40041. },
  40042. args: ["anIRInstruction"],
  40043. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  40044. referencedClasses: [],
  40045. messageSends: ["replace:with:", "parent"]
  40046. }),
  40047. $globals.IRInstruction);
  40048. $core.addMethod(
  40049. $core.method({
  40050. selector: "scope",
  40051. protocol: "accessing",
  40052. fn: function (){
  40053. var self=this,$self=this;
  40054. return $core.withContext(function($ctx1) {
  40055. var $1,$receiver;
  40056. $1=$self._parent();
  40057. if(($receiver = $1) == null || $receiver.a$nil){
  40058. return $1;
  40059. } else {
  40060. var node;
  40061. node=$receiver;
  40062. return $recv(node)._scope();
  40063. }
  40064. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  40065. },
  40066. args: [],
  40067. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  40068. referencedClasses: [],
  40069. messageSends: ["ifNotNil:", "parent", "scope"]
  40070. }),
  40071. $globals.IRInstruction);
  40072. $core.addMethod(
  40073. $core.method({
  40074. selector: "yieldsValue",
  40075. protocol: "testing",
  40076. fn: function (){
  40077. var self=this,$self=this;
  40078. return true;
  40079. },
  40080. args: [],
  40081. source: "yieldsValue\x0a\x09^ true",
  40082. referencedClasses: [],
  40083. messageSends: []
  40084. }),
  40085. $globals.IRInstruction);
  40086. $core.addMethod(
  40087. $core.method({
  40088. selector: "on:",
  40089. protocol: "instance creation",
  40090. fn: function (aBuilder){
  40091. var self=this,$self=this;
  40092. return $core.withContext(function($ctx1) {
  40093. var $1;
  40094. $1=$self._new();
  40095. $recv($1)._builder_(aBuilder);
  40096. return $recv($1)._yourself();
  40097. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.a$cls)});
  40098. },
  40099. args: ["aBuilder"],
  40100. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  40101. referencedClasses: [],
  40102. messageSends: ["builder:", "new", "yourself"]
  40103. }),
  40104. $globals.IRInstruction.a$cls);
  40105. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  40106. $core.addMethod(
  40107. $core.method({
  40108. selector: "acceptDagVisitor:",
  40109. protocol: "visiting",
  40110. fn: function (aVisitor){
  40111. var self=this,$self=this;
  40112. return $core.withContext(function($ctx1) {
  40113. return $recv(aVisitor)._visitIRAssignment_(self);
  40114. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  40115. },
  40116. args: ["aVisitor"],
  40117. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  40118. referencedClasses: [],
  40119. messageSends: ["visitIRAssignment:"]
  40120. }),
  40121. $globals.IRAssignment);
  40122. $core.addMethod(
  40123. $core.method({
  40124. selector: "left",
  40125. protocol: "accessing",
  40126. fn: function (){
  40127. var self=this,$self=this;
  40128. return $core.withContext(function($ctx1) {
  40129. return $recv($self._dagChildren())._first();
  40130. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  40131. },
  40132. args: [],
  40133. source: "left\x0a\x09^ self dagChildren first",
  40134. referencedClasses: [],
  40135. messageSends: ["first", "dagChildren"]
  40136. }),
  40137. $globals.IRAssignment);
  40138. $core.addMethod(
  40139. $core.method({
  40140. selector: "right",
  40141. protocol: "accessing",
  40142. fn: function (){
  40143. var self=this,$self=this;
  40144. return $core.withContext(function($ctx1) {
  40145. return $recv($self._dagChildren())._last();
  40146. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  40147. },
  40148. args: [],
  40149. source: "right\x0a\x09^ self dagChildren last",
  40150. referencedClasses: [],
  40151. messageSends: ["last", "dagChildren"]
  40152. }),
  40153. $globals.IRAssignment);
  40154. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  40155. $core.addMethod(
  40156. $core.method({
  40157. selector: "acceptDagVisitor:",
  40158. protocol: "visiting",
  40159. fn: function (aVisitor){
  40160. var self=this,$self=this;
  40161. return $core.withContext(function($ctx1) {
  40162. return $recv(aVisitor)._visitIRDynamicArray_(self);
  40163. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  40164. },
  40165. args: ["aVisitor"],
  40166. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  40167. referencedClasses: [],
  40168. messageSends: ["visitIRDynamicArray:"]
  40169. }),
  40170. $globals.IRDynamicArray);
  40171. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  40172. $core.addMethod(
  40173. $core.method({
  40174. selector: "acceptDagVisitor:",
  40175. protocol: "visiting",
  40176. fn: function (aVisitor){
  40177. var self=this,$self=this;
  40178. return $core.withContext(function($ctx1) {
  40179. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  40180. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  40181. },
  40182. args: ["aVisitor"],
  40183. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  40184. referencedClasses: [],
  40185. messageSends: ["visitIRDynamicDictionary:"]
  40186. }),
  40187. $globals.IRDynamicDictionary);
  40188. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  40189. $core.addMethod(
  40190. $core.method({
  40191. selector: "scope",
  40192. protocol: "accessing",
  40193. fn: function (){
  40194. var self=this,$self=this;
  40195. return $self.scope;
  40196. },
  40197. args: [],
  40198. source: "scope\x0a\x09^ scope",
  40199. referencedClasses: [],
  40200. messageSends: []
  40201. }),
  40202. $globals.IRScopedInstruction);
  40203. $core.addMethod(
  40204. $core.method({
  40205. selector: "scope:",
  40206. protocol: "accessing",
  40207. fn: function (aScope){
  40208. var self=this,$self=this;
  40209. $self.scope=aScope;
  40210. return self;
  40211. },
  40212. args: ["aScope"],
  40213. source: "scope: aScope\x0a\x09scope := aScope",
  40214. referencedClasses: [],
  40215. messageSends: []
  40216. }),
  40217. $globals.IRScopedInstruction);
  40218. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  40219. $core.addMethod(
  40220. $core.method({
  40221. selector: "arguments",
  40222. protocol: "accessing",
  40223. fn: function (){
  40224. var self=this,$self=this;
  40225. return $core.withContext(function($ctx1) {
  40226. var $1,$receiver;
  40227. $1=$self.arguments;
  40228. if(($receiver = $1) == null || $receiver.a$nil){
  40229. return [];
  40230. } else {
  40231. return $1;
  40232. }
  40233. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  40234. },
  40235. args: [],
  40236. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  40237. referencedClasses: [],
  40238. messageSends: ["ifNil:"]
  40239. }),
  40240. $globals.IRClosureInstruction);
  40241. $core.addMethod(
  40242. $core.method({
  40243. selector: "arguments:",
  40244. protocol: "accessing",
  40245. fn: function (aCollection){
  40246. var self=this,$self=this;
  40247. $self.arguments=aCollection;
  40248. return self;
  40249. },
  40250. args: ["aCollection"],
  40251. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  40252. referencedClasses: [],
  40253. messageSends: []
  40254. }),
  40255. $globals.IRClosureInstruction);
  40256. $core.addMethod(
  40257. $core.method({
  40258. selector: "locals",
  40259. protocol: "accessing",
  40260. fn: function (){
  40261. var self=this,$self=this;
  40262. return $core.withContext(function($ctx1) {
  40263. var $1;
  40264. $1=$recv($self._arguments())._copy();
  40265. $recv($1)._addAll_($recv($self._tempDeclarations())._collect_((function(each){
  40266. return $core.withContext(function($ctx2) {
  40267. return $recv(each)._name();
  40268. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40269. })));
  40270. return $recv($1)._yourself();
  40271. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  40272. },
  40273. args: [],
  40274. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  40275. referencedClasses: [],
  40276. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  40277. }),
  40278. $globals.IRClosureInstruction);
  40279. $core.addMethod(
  40280. $core.method({
  40281. selector: "requiresSmalltalkContext",
  40282. protocol: "accessing",
  40283. fn: function (){
  40284. var self=this,$self=this;
  40285. return $core.withContext(function($ctx1) {
  40286. var $1,$receiver;
  40287. $1=$self.requiresSmalltalkContext;
  40288. if(($receiver = $1) == null || $receiver.a$nil){
  40289. return false;
  40290. } else {
  40291. return $1;
  40292. }
  40293. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  40294. },
  40295. args: [],
  40296. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  40297. referencedClasses: [],
  40298. messageSends: ["ifNil:"]
  40299. }),
  40300. $globals.IRClosureInstruction);
  40301. $core.addMethod(
  40302. $core.method({
  40303. selector: "requiresSmalltalkContext:",
  40304. protocol: "accessing",
  40305. fn: function (anObject){
  40306. var self=this,$self=this;
  40307. $self.requiresSmalltalkContext=anObject;
  40308. return self;
  40309. },
  40310. args: ["anObject"],
  40311. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  40312. referencedClasses: [],
  40313. messageSends: []
  40314. }),
  40315. $globals.IRClosureInstruction);
  40316. $core.addMethod(
  40317. $core.method({
  40318. selector: "scope:",
  40319. protocol: "accessing",
  40320. fn: function (aScope){
  40321. var self=this,$self=this;
  40322. return $core.withContext(function($ctx1) {
  40323. (
  40324. $ctx1.supercall = true,
  40325. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($self, [aScope]));
  40326. $ctx1.supercall = false;
  40327. $recv(aScope)._instruction_(self);
  40328. return self;
  40329. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  40330. },
  40331. args: ["aScope"],
  40332. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  40333. referencedClasses: [],
  40334. messageSends: ["scope:", "instruction:"]
  40335. }),
  40336. $globals.IRClosureInstruction);
  40337. $core.addMethod(
  40338. $core.method({
  40339. selector: "tempDeclarations",
  40340. protocol: "accessing",
  40341. fn: function (){
  40342. var self=this,$self=this;
  40343. return $core.withContext(function($ctx1) {
  40344. return $recv($self._dagChildren())._select_((function(each){
  40345. return $core.withContext(function($ctx2) {
  40346. return $recv(each)._isTempDeclaration();
  40347. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40348. }));
  40349. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  40350. },
  40351. args: [],
  40352. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  40353. referencedClasses: [],
  40354. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  40355. }),
  40356. $globals.IRClosureInstruction);
  40357. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  40358. $core.addMethod(
  40359. $core.method({
  40360. selector: "acceptDagVisitor:",
  40361. protocol: "visiting",
  40362. fn: function (aVisitor){
  40363. var self=this,$self=this;
  40364. return $core.withContext(function($ctx1) {
  40365. return $recv(aVisitor)._visitIRClosure_(self);
  40366. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  40367. },
  40368. args: ["aVisitor"],
  40369. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  40370. referencedClasses: [],
  40371. messageSends: ["visitIRClosure:"]
  40372. }),
  40373. $globals.IRClosure);
  40374. $core.addMethod(
  40375. $core.method({
  40376. selector: "isClosure",
  40377. protocol: "testing",
  40378. fn: function (){
  40379. var self=this,$self=this;
  40380. return true;
  40381. },
  40382. args: [],
  40383. source: "isClosure\x0a\x09^ true",
  40384. referencedClasses: [],
  40385. messageSends: []
  40386. }),
  40387. $globals.IRClosure);
  40388. $core.addMethod(
  40389. $core.method({
  40390. selector: "sequence",
  40391. protocol: "accessing",
  40392. fn: function (){
  40393. var self=this,$self=this;
  40394. return $core.withContext(function($ctx1) {
  40395. return $recv($self._dagChildren())._last();
  40396. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  40397. },
  40398. args: [],
  40399. source: "sequence\x0a\x09^ self dagChildren last",
  40400. referencedClasses: [],
  40401. messageSends: ["last", "dagChildren"]
  40402. }),
  40403. $globals.IRClosure);
  40404. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  40405. $globals.IRMethod.comment="I am a method instruction";
  40406. $core.addMethod(
  40407. $core.method({
  40408. selector: "acceptDagVisitor:",
  40409. protocol: "visiting",
  40410. fn: function (aVisitor){
  40411. var self=this,$self=this;
  40412. return $core.withContext(function($ctx1) {
  40413. return $recv(aVisitor)._visitIRMethod_(self);
  40414. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  40415. },
  40416. args: ["aVisitor"],
  40417. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  40418. referencedClasses: [],
  40419. messageSends: ["visitIRMethod:"]
  40420. }),
  40421. $globals.IRMethod);
  40422. $core.addMethod(
  40423. $core.method({
  40424. selector: "classReferences",
  40425. protocol: "accessing",
  40426. fn: function (){
  40427. var self=this,$self=this;
  40428. return $self.classReferences;
  40429. },
  40430. args: [],
  40431. source: "classReferences\x0a\x09^ classReferences",
  40432. referencedClasses: [],
  40433. messageSends: []
  40434. }),
  40435. $globals.IRMethod);
  40436. $core.addMethod(
  40437. $core.method({
  40438. selector: "classReferences:",
  40439. protocol: "accessing",
  40440. fn: function (aCollection){
  40441. var self=this,$self=this;
  40442. $self.classReferences=aCollection;
  40443. return self;
  40444. },
  40445. args: ["aCollection"],
  40446. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  40447. referencedClasses: [],
  40448. messageSends: []
  40449. }),
  40450. $globals.IRMethod);
  40451. $core.addMethod(
  40452. $core.method({
  40453. selector: "internalVariables",
  40454. protocol: "accessing",
  40455. fn: function (){
  40456. var self=this,$self=this;
  40457. return $core.withContext(function($ctx1) {
  40458. var $1,$receiver;
  40459. $1=$self.internalVariables;
  40460. if(($receiver = $1) == null || $receiver.a$nil){
  40461. $self.internalVariables=$recv($globals.Set)._new();
  40462. return $self.internalVariables;
  40463. } else {
  40464. return $1;
  40465. }
  40466. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  40467. },
  40468. args: [],
  40469. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  40470. referencedClasses: ["Set"],
  40471. messageSends: ["ifNil:", "new"]
  40472. }),
  40473. $globals.IRMethod);
  40474. $core.addMethod(
  40475. $core.method({
  40476. selector: "isMethod",
  40477. protocol: "testing",
  40478. fn: function (){
  40479. var self=this,$self=this;
  40480. return true;
  40481. },
  40482. args: [],
  40483. source: "isMethod\x0a\x09^ true",
  40484. referencedClasses: [],
  40485. messageSends: []
  40486. }),
  40487. $globals.IRMethod);
  40488. $core.addMethod(
  40489. $core.method({
  40490. selector: "messageSends",
  40491. protocol: "accessing",
  40492. fn: function (){
  40493. var self=this,$self=this;
  40494. return $core.withContext(function($ctx1) {
  40495. return $recv($self._sendIndexes())._keys();
  40496. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  40497. },
  40498. args: [],
  40499. source: "messageSends\x0a\x09^ self sendIndexes keys",
  40500. referencedClasses: [],
  40501. messageSends: ["keys", "sendIndexes"]
  40502. }),
  40503. $globals.IRMethod);
  40504. $core.addMethod(
  40505. $core.method({
  40506. selector: "method",
  40507. protocol: "accessing",
  40508. fn: function (){
  40509. var self=this,$self=this;
  40510. return self;
  40511. },
  40512. args: [],
  40513. source: "method\x0a\x09^ self",
  40514. referencedClasses: [],
  40515. messageSends: []
  40516. }),
  40517. $globals.IRMethod);
  40518. $core.addMethod(
  40519. $core.method({
  40520. selector: "selector",
  40521. protocol: "accessing",
  40522. fn: function (){
  40523. var self=this,$self=this;
  40524. return $self.selector;
  40525. },
  40526. args: [],
  40527. source: "selector\x0a\x09^ selector",
  40528. referencedClasses: [],
  40529. messageSends: []
  40530. }),
  40531. $globals.IRMethod);
  40532. $core.addMethod(
  40533. $core.method({
  40534. selector: "selector:",
  40535. protocol: "accessing",
  40536. fn: function (aString){
  40537. var self=this,$self=this;
  40538. $self.selector=aString;
  40539. return self;
  40540. },
  40541. args: ["aString"],
  40542. source: "selector: aString\x0a\x09selector := aString",
  40543. referencedClasses: [],
  40544. messageSends: []
  40545. }),
  40546. $globals.IRMethod);
  40547. $core.addMethod(
  40548. $core.method({
  40549. selector: "sendIndexes",
  40550. protocol: "accessing",
  40551. fn: function (){
  40552. var self=this,$self=this;
  40553. return $self.sendIndexes;
  40554. },
  40555. args: [],
  40556. source: "sendIndexes\x0a\x09^ sendIndexes",
  40557. referencedClasses: [],
  40558. messageSends: []
  40559. }),
  40560. $globals.IRMethod);
  40561. $core.addMethod(
  40562. $core.method({
  40563. selector: "sendIndexes:",
  40564. protocol: "accessing",
  40565. fn: function (aDictionary){
  40566. var self=this,$self=this;
  40567. $self.sendIndexes=aDictionary;
  40568. return self;
  40569. },
  40570. args: ["aDictionary"],
  40571. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  40572. referencedClasses: [],
  40573. messageSends: []
  40574. }),
  40575. $globals.IRMethod);
  40576. $core.addMethod(
  40577. $core.method({
  40578. selector: "source",
  40579. protocol: "accessing",
  40580. fn: function (){
  40581. var self=this,$self=this;
  40582. return $self.source;
  40583. },
  40584. args: [],
  40585. source: "source\x0a\x09^ source",
  40586. referencedClasses: [],
  40587. messageSends: []
  40588. }),
  40589. $globals.IRMethod);
  40590. $core.addMethod(
  40591. $core.method({
  40592. selector: "source:",
  40593. protocol: "accessing",
  40594. fn: function (aString){
  40595. var self=this,$self=this;
  40596. $self.source=aString;
  40597. return self;
  40598. },
  40599. args: ["aString"],
  40600. source: "source: aString\x0a\x09source := aString",
  40601. referencedClasses: [],
  40602. messageSends: []
  40603. }),
  40604. $globals.IRMethod);
  40605. $core.addMethod(
  40606. $core.method({
  40607. selector: "theClass",
  40608. protocol: "accessing",
  40609. fn: function (){
  40610. var self=this,$self=this;
  40611. return $self.theClass;
  40612. },
  40613. args: [],
  40614. source: "theClass\x0a\x09^ theClass",
  40615. referencedClasses: [],
  40616. messageSends: []
  40617. }),
  40618. $globals.IRMethod);
  40619. $core.addMethod(
  40620. $core.method({
  40621. selector: "theClass:",
  40622. protocol: "accessing",
  40623. fn: function (aClass){
  40624. var self=this,$self=this;
  40625. $self.theClass=aClass;
  40626. return self;
  40627. },
  40628. args: ["aClass"],
  40629. source: "theClass: aClass\x0a\x09theClass := aClass",
  40630. referencedClasses: [],
  40631. messageSends: []
  40632. }),
  40633. $globals.IRMethod);
  40634. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  40635. $globals.IRReturn.comment="I am a local return instruction.";
  40636. $core.addMethod(
  40637. $core.method({
  40638. selector: "acceptDagVisitor:",
  40639. protocol: "visiting",
  40640. fn: function (aVisitor){
  40641. var self=this,$self=this;
  40642. return $core.withContext(function($ctx1) {
  40643. return $recv(aVisitor)._visitIRReturn_(self);
  40644. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  40645. },
  40646. args: ["aVisitor"],
  40647. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  40648. referencedClasses: [],
  40649. messageSends: ["visitIRReturn:"]
  40650. }),
  40651. $globals.IRReturn);
  40652. $core.addMethod(
  40653. $core.method({
  40654. selector: "expression",
  40655. protocol: "accessing",
  40656. fn: function (){
  40657. var self=this,$self=this;
  40658. return $core.withContext(function($ctx1) {
  40659. return $recv($self._dagChildren())._single();
  40660. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  40661. },
  40662. args: [],
  40663. source: "expression\x0a\x09^ self dagChildren single",
  40664. referencedClasses: [],
  40665. messageSends: ["single", "dagChildren"]
  40666. }),
  40667. $globals.IRReturn);
  40668. $core.addMethod(
  40669. $core.method({
  40670. selector: "scope",
  40671. protocol: "accessing",
  40672. fn: function (){
  40673. var self=this,$self=this;
  40674. return $core.withContext(function($ctx1) {
  40675. var $1,$receiver;
  40676. $1=$self.scope;
  40677. if(($receiver = $1) == null || $receiver.a$nil){
  40678. return $recv($self._parent())._scope();
  40679. } else {
  40680. return $1;
  40681. }
  40682. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  40683. },
  40684. args: [],
  40685. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  40686. referencedClasses: [],
  40687. messageSends: ["ifNil:", "scope", "parent"]
  40688. }),
  40689. $globals.IRReturn);
  40690. $core.addMethod(
  40691. $core.method({
  40692. selector: "yieldsValue",
  40693. protocol: "testing",
  40694. fn: function (){
  40695. var self=this,$self=this;
  40696. return false;
  40697. },
  40698. args: [],
  40699. source: "yieldsValue\x0a\x09^ false",
  40700. referencedClasses: [],
  40701. messageSends: []
  40702. }),
  40703. $globals.IRReturn);
  40704. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  40705. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  40706. $core.addMethod(
  40707. $core.method({
  40708. selector: "acceptDagVisitor:",
  40709. protocol: "visiting",
  40710. fn: function (aVisitor){
  40711. var self=this,$self=this;
  40712. return $core.withContext(function($ctx1) {
  40713. return $recv(aVisitor)._visitIRBlockReturn_(self);
  40714. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  40715. },
  40716. args: ["aVisitor"],
  40717. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  40718. referencedClasses: [],
  40719. messageSends: ["visitIRBlockReturn:"]
  40720. }),
  40721. $globals.IRBlockReturn);
  40722. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  40723. $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.";
  40724. $core.addMethod(
  40725. $core.method({
  40726. selector: "acceptDagVisitor:",
  40727. protocol: "visiting",
  40728. fn: function (aVisitor){
  40729. var self=this,$self=this;
  40730. return $core.withContext(function($ctx1) {
  40731. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  40732. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  40733. },
  40734. args: ["aVisitor"],
  40735. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  40736. referencedClasses: [],
  40737. messageSends: ["visitIRNonLocalReturn:"]
  40738. }),
  40739. $globals.IRNonLocalReturn);
  40740. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  40741. $core.addMethod(
  40742. $core.method({
  40743. selector: "acceptDagVisitor:",
  40744. protocol: "visiting",
  40745. fn: function (aVisitor){
  40746. var self=this,$self=this;
  40747. return $core.withContext(function($ctx1) {
  40748. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  40749. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  40750. },
  40751. args: ["aVisitor"],
  40752. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  40753. referencedClasses: [],
  40754. messageSends: ["visitIRTempDeclaration:"]
  40755. }),
  40756. $globals.IRTempDeclaration);
  40757. $core.addMethod(
  40758. $core.method({
  40759. selector: "isTempDeclaration",
  40760. protocol: "testing",
  40761. fn: function (){
  40762. var self=this,$self=this;
  40763. return true;
  40764. },
  40765. args: [],
  40766. source: "isTempDeclaration\x0a\x09^ true",
  40767. referencedClasses: [],
  40768. messageSends: []
  40769. }),
  40770. $globals.IRTempDeclaration);
  40771. $core.addMethod(
  40772. $core.method({
  40773. selector: "name",
  40774. protocol: "accessing",
  40775. fn: function (){
  40776. var self=this,$self=this;
  40777. return $self.name;
  40778. },
  40779. args: [],
  40780. source: "name\x0a\x09^ name",
  40781. referencedClasses: [],
  40782. messageSends: []
  40783. }),
  40784. $globals.IRTempDeclaration);
  40785. $core.addMethod(
  40786. $core.method({
  40787. selector: "name:",
  40788. protocol: "accessing",
  40789. fn: function (aString){
  40790. var self=this,$self=this;
  40791. $self.name=aString;
  40792. return self;
  40793. },
  40794. args: ["aString"],
  40795. source: "name: aString\x0a\x09name := aString",
  40796. referencedClasses: [],
  40797. messageSends: []
  40798. }),
  40799. $globals.IRTempDeclaration);
  40800. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "index"], "Compiler-IR");
  40801. $globals.IRSend.comment="I am a message send instruction.";
  40802. $core.addMethod(
  40803. $core.method({
  40804. selector: "acceptDagVisitor:",
  40805. protocol: "visiting",
  40806. fn: function (aVisitor){
  40807. var self=this,$self=this;
  40808. return $core.withContext(function($ctx1) {
  40809. return $recv(aVisitor)._visitIRSend_(self);
  40810. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  40811. },
  40812. args: ["aVisitor"],
  40813. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  40814. referencedClasses: [],
  40815. messageSends: ["visitIRSend:"]
  40816. }),
  40817. $globals.IRSend);
  40818. $core.addMethod(
  40819. $core.method({
  40820. selector: "arguments",
  40821. protocol: "accessing",
  40822. fn: function (){
  40823. var self=this,$self=this;
  40824. return $core.withContext(function($ctx1) {
  40825. return $recv($self._dagChildren())._allButFirst();
  40826. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  40827. },
  40828. args: [],
  40829. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  40830. referencedClasses: [],
  40831. messageSends: ["allButFirst", "dagChildren"]
  40832. }),
  40833. $globals.IRSend);
  40834. $core.addMethod(
  40835. $core.method({
  40836. selector: "index",
  40837. protocol: "accessing",
  40838. fn: function (){
  40839. var self=this,$self=this;
  40840. return $self.index;
  40841. },
  40842. args: [],
  40843. source: "index\x0a\x09^ index",
  40844. referencedClasses: [],
  40845. messageSends: []
  40846. }),
  40847. $globals.IRSend);
  40848. $core.addMethod(
  40849. $core.method({
  40850. selector: "index:",
  40851. protocol: "accessing",
  40852. fn: function (anInteger){
  40853. var self=this,$self=this;
  40854. $self.index=anInteger;
  40855. return self;
  40856. },
  40857. args: ["anInteger"],
  40858. source: "index: anInteger\x0a\x09index := anInteger",
  40859. referencedClasses: [],
  40860. messageSends: []
  40861. }),
  40862. $globals.IRSend);
  40863. $core.addMethod(
  40864. $core.method({
  40865. selector: "isSend",
  40866. protocol: "testing",
  40867. fn: function (){
  40868. var self=this,$self=this;
  40869. return true;
  40870. },
  40871. args: [],
  40872. source: "isSend\x0a\x09^ true",
  40873. referencedClasses: [],
  40874. messageSends: []
  40875. }),
  40876. $globals.IRSend);
  40877. $core.addMethod(
  40878. $core.method({
  40879. selector: "receiver",
  40880. protocol: "accessing",
  40881. fn: function (){
  40882. var self=this,$self=this;
  40883. return $core.withContext(function($ctx1) {
  40884. return $recv($self._dagChildren())._first();
  40885. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  40886. },
  40887. args: [],
  40888. source: "receiver\x0a\x09^ self dagChildren first",
  40889. referencedClasses: [],
  40890. messageSends: ["first", "dagChildren"]
  40891. }),
  40892. $globals.IRSend);
  40893. $core.addMethod(
  40894. $core.method({
  40895. selector: "selector",
  40896. protocol: "accessing",
  40897. fn: function (){
  40898. var self=this,$self=this;
  40899. return $self.selector;
  40900. },
  40901. args: [],
  40902. source: "selector\x0a\x09^ selector",
  40903. referencedClasses: [],
  40904. messageSends: []
  40905. }),
  40906. $globals.IRSend);
  40907. $core.addMethod(
  40908. $core.method({
  40909. selector: "selector:",
  40910. protocol: "accessing",
  40911. fn: function (aString){
  40912. var self=this,$self=this;
  40913. $self.selector=aString;
  40914. return self;
  40915. },
  40916. args: ["aString"],
  40917. source: "selector: aString\x0a\x09selector := aString",
  40918. referencedClasses: [],
  40919. messageSends: []
  40920. }),
  40921. $globals.IRSend);
  40922. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  40923. $core.addMethod(
  40924. $core.method({
  40925. selector: "acceptDagVisitor:",
  40926. protocol: "visiting",
  40927. fn: function (aVisitor){
  40928. var self=this,$self=this;
  40929. return $core.withContext(function($ctx1) {
  40930. return $recv(aVisitor)._visitIRSequence_(self);
  40931. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  40932. },
  40933. args: ["aVisitor"],
  40934. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  40935. referencedClasses: [],
  40936. messageSends: ["visitIRSequence:"]
  40937. }),
  40938. $globals.IRSequence);
  40939. $core.addMethod(
  40940. $core.method({
  40941. selector: "isSequence",
  40942. protocol: "testing",
  40943. fn: function (){
  40944. var self=this,$self=this;
  40945. return true;
  40946. },
  40947. args: [],
  40948. source: "isSequence\x0a\x09^ true",
  40949. referencedClasses: [],
  40950. messageSends: []
  40951. }),
  40952. $globals.IRSequence);
  40953. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  40954. $core.addMethod(
  40955. $core.method({
  40956. selector: "acceptDagVisitor:",
  40957. protocol: "visiting",
  40958. fn: function (aVisitor){
  40959. var self=this,$self=this;
  40960. return $core.withContext(function($ctx1) {
  40961. return $recv(aVisitor)._visitIRBlockSequence_(self);
  40962. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  40963. },
  40964. args: ["aVisitor"],
  40965. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  40966. referencedClasses: [],
  40967. messageSends: ["visitIRBlockSequence:"]
  40968. }),
  40969. $globals.IRBlockSequence);
  40970. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  40971. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  40972. $core.addMethod(
  40973. $core.method({
  40974. selector: "acceptDagVisitor:",
  40975. protocol: "visiting",
  40976. fn: function (aVisitor){
  40977. var self=this,$self=this;
  40978. return $core.withContext(function($ctx1) {
  40979. return $recv(aVisitor)._visitIRValue_(self);
  40980. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  40981. },
  40982. args: ["aVisitor"],
  40983. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  40984. referencedClasses: [],
  40985. messageSends: ["visitIRValue:"]
  40986. }),
  40987. $globals.IRValue);
  40988. $core.addMethod(
  40989. $core.method({
  40990. selector: "needsBoxingAsReceiver",
  40991. protocol: "testing",
  40992. fn: function (){
  40993. var self=this,$self=this;
  40994. return false;
  40995. },
  40996. args: [],
  40997. source: "needsBoxingAsReceiver\x0a\x09^ false",
  40998. referencedClasses: [],
  40999. messageSends: []
  41000. }),
  41001. $globals.IRValue);
  41002. $core.addMethod(
  41003. $core.method({
  41004. selector: "value",
  41005. protocol: "accessing",
  41006. fn: function (){
  41007. var self=this,$self=this;
  41008. return $self.value;
  41009. },
  41010. args: [],
  41011. source: "value\x0a\x09^ value",
  41012. referencedClasses: [],
  41013. messageSends: []
  41014. }),
  41015. $globals.IRValue);
  41016. $core.addMethod(
  41017. $core.method({
  41018. selector: "value:",
  41019. protocol: "accessing",
  41020. fn: function (aString){
  41021. var self=this,$self=this;
  41022. $self.value=aString;
  41023. return self;
  41024. },
  41025. args: ["aString"],
  41026. source: "value: aString\x0a\x09value := aString",
  41027. referencedClasses: [],
  41028. messageSends: []
  41029. }),
  41030. $globals.IRValue);
  41031. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  41032. $globals.IRVariable.comment="I am a variable instruction.";
  41033. $core.addMethod(
  41034. $core.method({
  41035. selector: "acceptDagVisitor:",
  41036. protocol: "visiting",
  41037. fn: function (aVisitor){
  41038. var self=this,$self=this;
  41039. return $core.withContext(function($ctx1) {
  41040. return $recv(aVisitor)._visitIRVariable_(self);
  41041. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  41042. },
  41043. args: ["aVisitor"],
  41044. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  41045. referencedClasses: [],
  41046. messageSends: ["visitIRVariable:"]
  41047. }),
  41048. $globals.IRVariable);
  41049. $core.addMethod(
  41050. $core.method({
  41051. selector: "isSelf",
  41052. protocol: "testing",
  41053. fn: function (){
  41054. var self=this,$self=this;
  41055. return $core.withContext(function($ctx1) {
  41056. return $recv($self._variable())._isSelf();
  41057. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.IRVariable)});
  41058. },
  41059. args: [],
  41060. source: "isSelf\x0a\x09^ self variable isSelf",
  41061. referencedClasses: [],
  41062. messageSends: ["isSelf", "variable"]
  41063. }),
  41064. $globals.IRVariable);
  41065. $core.addMethod(
  41066. $core.method({
  41067. selector: "isSuper",
  41068. protocol: "testing",
  41069. fn: function (){
  41070. var self=this,$self=this;
  41071. return $core.withContext(function($ctx1) {
  41072. return $recv($self._variable())._isSuper();
  41073. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.IRVariable)});
  41074. },
  41075. args: [],
  41076. source: "isSuper\x0a\x09^ self variable isSuper",
  41077. referencedClasses: [],
  41078. messageSends: ["isSuper", "variable"]
  41079. }),
  41080. $globals.IRVariable);
  41081. $core.addMethod(
  41082. $core.method({
  41083. selector: "isVariable",
  41084. protocol: "testing",
  41085. fn: function (){
  41086. var self=this,$self=this;
  41087. return true;
  41088. },
  41089. args: [],
  41090. source: "isVariable\x0a\x09^ true",
  41091. referencedClasses: [],
  41092. messageSends: []
  41093. }),
  41094. $globals.IRVariable);
  41095. $core.addMethod(
  41096. $core.method({
  41097. selector: "needsBoxingAsReceiver",
  41098. protocol: "testing",
  41099. fn: function (){
  41100. var self=this,$self=this;
  41101. return $core.withContext(function($ctx1) {
  41102. return $recv($recv($self._variable())._isPseudoVar())._not();
  41103. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  41104. },
  41105. args: [],
  41106. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  41107. referencedClasses: [],
  41108. messageSends: ["not", "isPseudoVar", "variable"]
  41109. }),
  41110. $globals.IRVariable);
  41111. $core.addMethod(
  41112. $core.method({
  41113. selector: "variable",
  41114. protocol: "accessing",
  41115. fn: function (){
  41116. var self=this,$self=this;
  41117. return $self.variable;
  41118. },
  41119. args: [],
  41120. source: "variable\x0a\x09^ variable",
  41121. referencedClasses: [],
  41122. messageSends: []
  41123. }),
  41124. $globals.IRVariable);
  41125. $core.addMethod(
  41126. $core.method({
  41127. selector: "variable:",
  41128. protocol: "accessing",
  41129. fn: function (aScopeVariable){
  41130. var self=this,$self=this;
  41131. $self.variable=aScopeVariable;
  41132. return self;
  41133. },
  41134. args: ["aScopeVariable"],
  41135. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  41136. referencedClasses: [],
  41137. messageSends: []
  41138. }),
  41139. $globals.IRVariable);
  41140. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  41141. $core.addMethod(
  41142. $core.method({
  41143. selector: "acceptDagVisitor:",
  41144. protocol: "visiting",
  41145. fn: function (aVisitor){
  41146. var self=this,$self=this;
  41147. return $core.withContext(function($ctx1) {
  41148. return $recv(aVisitor)._visitIRVerbatim_(self);
  41149. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  41150. },
  41151. args: ["aVisitor"],
  41152. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  41153. referencedClasses: [],
  41154. messageSends: ["visitIRVerbatim:"]
  41155. }),
  41156. $globals.IRVerbatim);
  41157. $core.addMethod(
  41158. $core.method({
  41159. selector: "source",
  41160. protocol: "accessing",
  41161. fn: function (){
  41162. var self=this,$self=this;
  41163. return $self.source;
  41164. },
  41165. args: [],
  41166. source: "source\x0a\x09^ source",
  41167. referencedClasses: [],
  41168. messageSends: []
  41169. }),
  41170. $globals.IRVerbatim);
  41171. $core.addMethod(
  41172. $core.method({
  41173. selector: "source:",
  41174. protocol: "accessing",
  41175. fn: function (aString){
  41176. var self=this,$self=this;
  41177. $self.source=aString;
  41178. return self;
  41179. },
  41180. args: ["aString"],
  41181. source: "source: aString\x0a\x09source := aString",
  41182. referencedClasses: [],
  41183. messageSends: []
  41184. }),
  41185. $globals.IRVerbatim);
  41186. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  41187. $core.addMethod(
  41188. $core.method({
  41189. selector: "visitDagNode:",
  41190. protocol: "visiting",
  41191. fn: function (aNode){
  41192. var self=this,$self=this;
  41193. return $core.withContext(function($ctx1) {
  41194. return $self._visitDagNodeVariantSimple_(aNode);
  41195. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  41196. },
  41197. args: ["aNode"],
  41198. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  41199. referencedClasses: [],
  41200. messageSends: ["visitDagNodeVariantSimple:"]
  41201. }),
  41202. $globals.IRVisitor);
  41203. $core.addMethod(
  41204. $core.method({
  41205. selector: "visitIRAssignment:",
  41206. protocol: "visiting",
  41207. fn: function (anIRAssignment){
  41208. var self=this,$self=this;
  41209. return $core.withContext(function($ctx1) {
  41210. return $self._visitDagNode_(anIRAssignment);
  41211. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  41212. },
  41213. args: ["anIRAssignment"],
  41214. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  41215. referencedClasses: [],
  41216. messageSends: ["visitDagNode:"]
  41217. }),
  41218. $globals.IRVisitor);
  41219. $core.addMethod(
  41220. $core.method({
  41221. selector: "visitIRBlockReturn:",
  41222. protocol: "visiting",
  41223. fn: function (anIRBlockReturn){
  41224. var self=this,$self=this;
  41225. return $core.withContext(function($ctx1) {
  41226. return $self._visitIRReturn_(anIRBlockReturn);
  41227. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  41228. },
  41229. args: ["anIRBlockReturn"],
  41230. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  41231. referencedClasses: [],
  41232. messageSends: ["visitIRReturn:"]
  41233. }),
  41234. $globals.IRVisitor);
  41235. $core.addMethod(
  41236. $core.method({
  41237. selector: "visitIRBlockSequence:",
  41238. protocol: "visiting",
  41239. fn: function (anIRBlockSequence){
  41240. var self=this,$self=this;
  41241. return $core.withContext(function($ctx1) {
  41242. return $self._visitIRSequence_(anIRBlockSequence);
  41243. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  41244. },
  41245. args: ["anIRBlockSequence"],
  41246. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  41247. referencedClasses: [],
  41248. messageSends: ["visitIRSequence:"]
  41249. }),
  41250. $globals.IRVisitor);
  41251. $core.addMethod(
  41252. $core.method({
  41253. selector: "visitIRClosure:",
  41254. protocol: "visiting",
  41255. fn: function (anIRClosure){
  41256. var self=this,$self=this;
  41257. return $core.withContext(function($ctx1) {
  41258. return $self._visitDagNode_(anIRClosure);
  41259. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  41260. },
  41261. args: ["anIRClosure"],
  41262. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  41263. referencedClasses: [],
  41264. messageSends: ["visitDagNode:"]
  41265. }),
  41266. $globals.IRVisitor);
  41267. $core.addMethod(
  41268. $core.method({
  41269. selector: "visitIRDynamicArray:",
  41270. protocol: "visiting",
  41271. fn: function (anIRDynamicArray){
  41272. var self=this,$self=this;
  41273. return $core.withContext(function($ctx1) {
  41274. return $self._visitDagNode_(anIRDynamicArray);
  41275. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  41276. },
  41277. args: ["anIRDynamicArray"],
  41278. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  41279. referencedClasses: [],
  41280. messageSends: ["visitDagNode:"]
  41281. }),
  41282. $globals.IRVisitor);
  41283. $core.addMethod(
  41284. $core.method({
  41285. selector: "visitIRDynamicDictionary:",
  41286. protocol: "visiting",
  41287. fn: function (anIRDynamicDictionary){
  41288. var self=this,$self=this;
  41289. return $core.withContext(function($ctx1) {
  41290. return $self._visitDagNode_(anIRDynamicDictionary);
  41291. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  41292. },
  41293. args: ["anIRDynamicDictionary"],
  41294. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  41295. referencedClasses: [],
  41296. messageSends: ["visitDagNode:"]
  41297. }),
  41298. $globals.IRVisitor);
  41299. $core.addMethod(
  41300. $core.method({
  41301. selector: "visitIRInlinedClosure:",
  41302. protocol: "visiting",
  41303. fn: function (anIRInlinedClosure){
  41304. var self=this,$self=this;
  41305. return $core.withContext(function($ctx1) {
  41306. return $self._visitIRClosure_(anIRInlinedClosure);
  41307. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  41308. },
  41309. args: ["anIRInlinedClosure"],
  41310. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  41311. referencedClasses: [],
  41312. messageSends: ["visitIRClosure:"]
  41313. }),
  41314. $globals.IRVisitor);
  41315. $core.addMethod(
  41316. $core.method({
  41317. selector: "visitIRInlinedSequence:",
  41318. protocol: "visiting",
  41319. fn: function (anIRInlinedSequence){
  41320. var self=this,$self=this;
  41321. return $core.withContext(function($ctx1) {
  41322. return $self._visitIRSequence_(anIRInlinedSequence);
  41323. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  41324. },
  41325. args: ["anIRInlinedSequence"],
  41326. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  41327. referencedClasses: [],
  41328. messageSends: ["visitIRSequence:"]
  41329. }),
  41330. $globals.IRVisitor);
  41331. $core.addMethod(
  41332. $core.method({
  41333. selector: "visitIRMethod:",
  41334. protocol: "visiting",
  41335. fn: function (anIRMethod){
  41336. var self=this,$self=this;
  41337. return $core.withContext(function($ctx1) {
  41338. return $self._visitDagNode_(anIRMethod);
  41339. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  41340. },
  41341. args: ["anIRMethod"],
  41342. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  41343. referencedClasses: [],
  41344. messageSends: ["visitDagNode:"]
  41345. }),
  41346. $globals.IRVisitor);
  41347. $core.addMethod(
  41348. $core.method({
  41349. selector: "visitIRNonLocalReturn:",
  41350. protocol: "visiting",
  41351. fn: function (anIRNonLocalReturn){
  41352. var self=this,$self=this;
  41353. return $core.withContext(function($ctx1) {
  41354. return $self._visitDagNode_(anIRNonLocalReturn);
  41355. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  41356. },
  41357. args: ["anIRNonLocalReturn"],
  41358. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  41359. referencedClasses: [],
  41360. messageSends: ["visitDagNode:"]
  41361. }),
  41362. $globals.IRVisitor);
  41363. $core.addMethod(
  41364. $core.method({
  41365. selector: "visitIRNonLocalReturnHandling:",
  41366. protocol: "visiting",
  41367. fn: function (anIRNonLocalReturnHandling){
  41368. var self=this,$self=this;
  41369. return $core.withContext(function($ctx1) {
  41370. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  41371. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  41372. },
  41373. args: ["anIRNonLocalReturnHandling"],
  41374. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  41375. referencedClasses: [],
  41376. messageSends: ["visitDagNode:"]
  41377. }),
  41378. $globals.IRVisitor);
  41379. $core.addMethod(
  41380. $core.method({
  41381. selector: "visitIRReturn:",
  41382. protocol: "visiting",
  41383. fn: function (anIRReturn){
  41384. var self=this,$self=this;
  41385. return $core.withContext(function($ctx1) {
  41386. return $self._visitDagNode_(anIRReturn);
  41387. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  41388. },
  41389. args: ["anIRReturn"],
  41390. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  41391. referencedClasses: [],
  41392. messageSends: ["visitDagNode:"]
  41393. }),
  41394. $globals.IRVisitor);
  41395. $core.addMethod(
  41396. $core.method({
  41397. selector: "visitIRSend:",
  41398. protocol: "visiting",
  41399. fn: function (anIRSend){
  41400. var self=this,$self=this;
  41401. return $core.withContext(function($ctx1) {
  41402. return $self._visitDagNode_(anIRSend);
  41403. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  41404. },
  41405. args: ["anIRSend"],
  41406. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  41407. referencedClasses: [],
  41408. messageSends: ["visitDagNode:"]
  41409. }),
  41410. $globals.IRVisitor);
  41411. $core.addMethod(
  41412. $core.method({
  41413. selector: "visitIRSequence:",
  41414. protocol: "visiting",
  41415. fn: function (anIRSequence){
  41416. var self=this,$self=this;
  41417. return $core.withContext(function($ctx1) {
  41418. return $self._visitDagNode_(anIRSequence);
  41419. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  41420. },
  41421. args: ["anIRSequence"],
  41422. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  41423. referencedClasses: [],
  41424. messageSends: ["visitDagNode:"]
  41425. }),
  41426. $globals.IRVisitor);
  41427. $core.addMethod(
  41428. $core.method({
  41429. selector: "visitIRTempDeclaration:",
  41430. protocol: "visiting",
  41431. fn: function (anIRTempDeclaration){
  41432. var self=this,$self=this;
  41433. return $core.withContext(function($ctx1) {
  41434. return $self._visitDagNode_(anIRTempDeclaration);
  41435. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  41436. },
  41437. args: ["anIRTempDeclaration"],
  41438. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  41439. referencedClasses: [],
  41440. messageSends: ["visitDagNode:"]
  41441. }),
  41442. $globals.IRVisitor);
  41443. $core.addMethod(
  41444. $core.method({
  41445. selector: "visitIRValue:",
  41446. protocol: "visiting",
  41447. fn: function (anIRValue){
  41448. var self=this,$self=this;
  41449. return $core.withContext(function($ctx1) {
  41450. return $self._visitDagNode_(anIRValue);
  41451. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  41452. },
  41453. args: ["anIRValue"],
  41454. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  41455. referencedClasses: [],
  41456. messageSends: ["visitDagNode:"]
  41457. }),
  41458. $globals.IRVisitor);
  41459. $core.addMethod(
  41460. $core.method({
  41461. selector: "visitIRVariable:",
  41462. protocol: "visiting",
  41463. fn: function (anIRVariable){
  41464. var self=this,$self=this;
  41465. return $core.withContext(function($ctx1) {
  41466. return $self._visitDagNode_(anIRVariable);
  41467. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  41468. },
  41469. args: ["anIRVariable"],
  41470. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  41471. referencedClasses: [],
  41472. messageSends: ["visitDagNode:"]
  41473. }),
  41474. $globals.IRVisitor);
  41475. $core.addMethod(
  41476. $core.method({
  41477. selector: "visitIRVerbatim:",
  41478. protocol: "visiting",
  41479. fn: function (anIRVerbatim){
  41480. var self=this,$self=this;
  41481. return $core.withContext(function($ctx1) {
  41482. return $self._visitDagNode_(anIRVerbatim);
  41483. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  41484. },
  41485. args: ["anIRVerbatim"],
  41486. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  41487. referencedClasses: [],
  41488. messageSends: ["visitDagNode:"]
  41489. }),
  41490. $globals.IRVisitor);
  41491. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  41492. $core.addMethod(
  41493. $core.method({
  41494. selector: "contents",
  41495. protocol: "accessing",
  41496. fn: function (){
  41497. var self=this,$self=this;
  41498. return $core.withContext(function($ctx1) {
  41499. return $recv($self._stream())._contents();
  41500. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  41501. },
  41502. args: [],
  41503. source: "contents\x0a\x09^ self stream contents",
  41504. referencedClasses: [],
  41505. messageSends: ["contents", "stream"]
  41506. }),
  41507. $globals.IRJSTranslator);
  41508. $core.addMethod(
  41509. $core.method({
  41510. selector: "currentClass",
  41511. protocol: "accessing",
  41512. fn: function (){
  41513. var self=this,$self=this;
  41514. return $self.currentClass;
  41515. },
  41516. args: [],
  41517. source: "currentClass\x0a\x09^ currentClass",
  41518. referencedClasses: [],
  41519. messageSends: []
  41520. }),
  41521. $globals.IRJSTranslator);
  41522. $core.addMethod(
  41523. $core.method({
  41524. selector: "currentClass:",
  41525. protocol: "accessing",
  41526. fn: function (aClass){
  41527. var self=this,$self=this;
  41528. $self.currentClass=aClass;
  41529. return self;
  41530. },
  41531. args: ["aClass"],
  41532. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  41533. referencedClasses: [],
  41534. messageSends: []
  41535. }),
  41536. $globals.IRJSTranslator);
  41537. $core.addMethod(
  41538. $core.method({
  41539. selector: "initialize",
  41540. protocol: "initialization",
  41541. fn: function (){
  41542. var self=this,$self=this;
  41543. return $core.withContext(function($ctx1) {
  41544. (
  41545. $ctx1.supercall = true,
  41546. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41547. $ctx1.supercall = false;
  41548. $self.stream=$recv($globals.JSStream)._new();
  41549. return self;
  41550. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  41551. },
  41552. args: [],
  41553. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  41554. referencedClasses: ["JSStream"],
  41555. messageSends: ["initialize", "new"]
  41556. }),
  41557. $globals.IRJSTranslator);
  41558. $core.addMethod(
  41559. $core.method({
  41560. selector: "stream",
  41561. protocol: "accessing",
  41562. fn: function (){
  41563. var self=this,$self=this;
  41564. return $self.stream;
  41565. },
  41566. args: [],
  41567. source: "stream\x0a\x09^ stream",
  41568. referencedClasses: [],
  41569. messageSends: []
  41570. }),
  41571. $globals.IRJSTranslator);
  41572. $core.addMethod(
  41573. $core.method({
  41574. selector: "stream:",
  41575. protocol: "accessing",
  41576. fn: function (aStream){
  41577. var self=this,$self=this;
  41578. $self.stream=aStream;
  41579. return self;
  41580. },
  41581. args: ["aStream"],
  41582. source: "stream: aStream\x0a\x09stream := aStream",
  41583. referencedClasses: [],
  41584. messageSends: []
  41585. }),
  41586. $globals.IRJSTranslator);
  41587. $core.addMethod(
  41588. $core.method({
  41589. selector: "visitIRAssignment:",
  41590. protocol: "visiting",
  41591. fn: function (anIRAssignment){
  41592. var self=this,$self=this;
  41593. return $core.withContext(function($ctx1) {
  41594. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  41595. return $core.withContext(function($ctx2) {
  41596. return $self._visit_($recv(anIRAssignment)._left());
  41597. $ctx2.sendIdx["visit:"]=1;
  41598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41599. }),(function(){
  41600. return $core.withContext(function($ctx2) {
  41601. return $self._visit_($recv(anIRAssignment)._right());
  41602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41603. }));
  41604. return self;
  41605. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  41606. },
  41607. args: ["anIRAssignment"],
  41608. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  41609. referencedClasses: [],
  41610. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  41611. }),
  41612. $globals.IRJSTranslator);
  41613. $core.addMethod(
  41614. $core.method({
  41615. selector: "visitIRClosure:",
  41616. protocol: "visiting",
  41617. fn: function (anIRClosure){
  41618. var self=this,$self=this;
  41619. return $core.withContext(function($ctx1) {
  41620. var $1,$2;
  41621. $1=$self._stream();
  41622. $ctx1.sendIdx["stream"]=1;
  41623. $recv($1)._nextPutClosureWith_arguments_((function(){
  41624. return $core.withContext(function($ctx2) {
  41625. $2=$self._stream();
  41626. $ctx2.sendIdx["stream"]=2;
  41627. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  41628. return $core.withContext(function($ctx3) {
  41629. return $recv($recv(each)._name())._asVariableName();
  41630. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  41631. })));
  41632. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  41633. return $core.withContext(function($ctx3) {
  41634. return (
  41635. $ctx3.supercall = true,
  41636. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($self, [anIRClosure]));
  41637. $ctx3.supercall = false;
  41638. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  41639. }));
  41640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41641. }),$recv(anIRClosure)._arguments());
  41642. return self;
  41643. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  41644. },
  41645. args: ["anIRClosure"],
  41646. 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",
  41647. referencedClasses: [],
  41648. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  41649. }),
  41650. $globals.IRJSTranslator);
  41651. $core.addMethod(
  41652. $core.method({
  41653. selector: "visitIRDynamicArray:",
  41654. protocol: "visiting",
  41655. fn: function (anIRDynamicArray){
  41656. var self=this,$self=this;
  41657. return $core.withContext(function($ctx1) {
  41658. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  41659. return self;
  41660. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  41661. },
  41662. args: ["anIRDynamicArray"],
  41663. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  41664. referencedClasses: [],
  41665. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41666. }),
  41667. $globals.IRJSTranslator);
  41668. $core.addMethod(
  41669. $core.method({
  41670. selector: "visitIRDynamicDictionary:",
  41671. protocol: "visiting",
  41672. fn: function (anIRDynamicDictionary){
  41673. var self=this,$self=this;
  41674. return $core.withContext(function($ctx1) {
  41675. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  41676. return self;
  41677. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  41678. },
  41679. args: ["anIRDynamicDictionary"],
  41680. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  41681. referencedClasses: [],
  41682. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41683. }),
  41684. $globals.IRJSTranslator);
  41685. $core.addMethod(
  41686. $core.method({
  41687. selector: "visitIRMethod:",
  41688. protocol: "visiting",
  41689. fn: function (anIRMethod){
  41690. var self=this,$self=this;
  41691. return $core.withContext(function($ctx1) {
  41692. var $1,$2,$3,$4,$5,$6,$7;
  41693. $1=$self._stream();
  41694. $ctx1.sendIdx["stream"]=1;
  41695. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  41696. return $core.withContext(function($ctx2) {
  41697. $2=$self._stream();
  41698. $ctx2.sendIdx["stream"]=2;
  41699. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  41700. return $core.withContext(function($ctx3) {
  41701. $3=$self._stream();
  41702. $ctx3.sendIdx["stream"]=3;
  41703. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  41704. return $core.withContext(function($ctx4) {
  41705. return $recv($recv(each)._name())._asVariableName();
  41706. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  41707. }));
  41708. $ctx3.sendIdx["collect:"]=1;
  41709. $recv($3)._nextPutVars_($4);
  41710. $ctx3.sendIdx["nextPutVars:"]=1;
  41711. $5=$self._stream();
  41712. $ctx3.sendIdx["stream"]=4;
  41713. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  41714. return $core.withContext(function($ctx4) {
  41715. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  41716. return $core.withContext(function($ctx5) {
  41717. $6=$self._stream();
  41718. $ctx5.sendIdx["stream"]=5;
  41719. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  41720. return $core.withContext(function($ctx6) {
  41721. return $recv($recv(each)._variable())._alias();
  41722. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  41723. })));
  41724. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  41725. }));
  41726. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  41727. if($core.assert($7)){
  41728. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  41729. return $core.withContext(function($ctx5) {
  41730. return (
  41731. $ctx5.supercall = true,
  41732. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41733. $ctx5.supercall = false;
  41734. $ctx5.sendIdx["visitIRMethod:"]=1;
  41735. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  41736. }));
  41737. } else {
  41738. return (
  41739. $ctx4.supercall = true,
  41740. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41741. $ctx4.supercall = false;
  41742. }
  41743. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  41744. }));
  41745. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41746. }),$recv(anIRMethod)._arguments());
  41747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41748. }));
  41749. return $self._contents();
  41750. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  41751. },
  41752. args: ["anIRMethod"],
  41753. 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",
  41754. referencedClasses: [],
  41755. 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"]
  41756. }),
  41757. $globals.IRJSTranslator);
  41758. $core.addMethod(
  41759. $core.method({
  41760. selector: "visitIRNonLocalReturn:",
  41761. protocol: "visiting",
  41762. fn: function (anIRNonLocalReturn){
  41763. var self=this,$self=this;
  41764. return $core.withContext(function($ctx1) {
  41765. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  41766. return $core.withContext(function($ctx2) {
  41767. return (
  41768. $ctx2.supercall = true,
  41769. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  41770. $ctx2.supercall = false;
  41771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41772. }));
  41773. return self;
  41774. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  41775. },
  41776. args: ["anIRNonLocalReturn"],
  41777. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  41778. referencedClasses: [],
  41779. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  41780. }),
  41781. $globals.IRJSTranslator);
  41782. $core.addMethod(
  41783. $core.method({
  41784. selector: "visitIRReturn:",
  41785. protocol: "visiting",
  41786. fn: function (anIRReturn){
  41787. var self=this,$self=this;
  41788. return $core.withContext(function($ctx1) {
  41789. $recv($self._stream())._nextPutReturnWith_((function(){
  41790. return $core.withContext(function($ctx2) {
  41791. return (
  41792. $ctx2.supercall = true,
  41793. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  41794. $ctx2.supercall = false;
  41795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41796. }));
  41797. return self;
  41798. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  41799. },
  41800. args: ["anIRReturn"],
  41801. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  41802. referencedClasses: [],
  41803. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  41804. }),
  41805. $globals.IRJSTranslator);
  41806. $core.addMethod(
  41807. $core.method({
  41808. selector: "visitIRSend:",
  41809. protocol: "visiting",
  41810. fn: function (anIRSend){
  41811. var self=this,$self=this;
  41812. var sends,superclass;
  41813. return $core.withContext(function($ctx1) {
  41814. var $1,$2;
  41815. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  41816. $1=$recv($recv(anIRSend)._receiver())._isSuper();
  41817. if($core.assert($1)){
  41818. $self._visitSuperSend_(anIRSend);
  41819. } else {
  41820. $self._visitSend_(anIRSend);
  41821. }
  41822. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  41823. if($core.assert($2)){
  41824. $recv($self._stream())._nextPutSendIndexFor_(anIRSend);
  41825. }
  41826. return self;
  41827. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  41828. },
  41829. args: ["anIRSend"],
  41830. 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 ]",
  41831. referencedClasses: [],
  41832. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuper", "receiver", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  41833. }),
  41834. $globals.IRJSTranslator);
  41835. $core.addMethod(
  41836. $core.method({
  41837. selector: "visitIRSequence:",
  41838. protocol: "visiting",
  41839. fn: function (anIRSequence){
  41840. var self=this,$self=this;
  41841. return $core.withContext(function($ctx1) {
  41842. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  41843. return $core.withContext(function($ctx2) {
  41844. return $recv($self._stream())._nextPutStatementWith_((function(){
  41845. return $core.withContext(function($ctx3) {
  41846. return $self._visit_(each);
  41847. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41848. }));
  41849. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41850. }));
  41851. return self;
  41852. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  41853. },
  41854. args: ["anIRSequence"],
  41855. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  41856. referencedClasses: [],
  41857. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  41858. }),
  41859. $globals.IRJSTranslator);
  41860. $core.addMethod(
  41861. $core.method({
  41862. selector: "visitIRTempDeclaration:",
  41863. protocol: "visiting",
  41864. fn: function (anIRTempDeclaration){
  41865. var self=this,$self=this;
  41866. return self;
  41867. },
  41868. args: ["anIRTempDeclaration"],
  41869. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  41870. referencedClasses: [],
  41871. messageSends: []
  41872. }),
  41873. $globals.IRJSTranslator);
  41874. $core.addMethod(
  41875. $core.method({
  41876. selector: "visitIRValue:",
  41877. protocol: "visiting",
  41878. fn: function (anIRValue){
  41879. var self=this,$self=this;
  41880. return $core.withContext(function($ctx1) {
  41881. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  41882. return self;
  41883. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  41884. },
  41885. args: ["anIRValue"],
  41886. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  41887. referencedClasses: [],
  41888. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  41889. }),
  41890. $globals.IRJSTranslator);
  41891. $core.addMethod(
  41892. $core.method({
  41893. selector: "visitIRVariable:",
  41894. protocol: "visiting",
  41895. fn: function (anIRVariable){
  41896. var self=this,$self=this;
  41897. return $core.withContext(function($ctx1) {
  41898. var $3,$2,$1,$4;
  41899. $3=$recv(anIRVariable)._variable();
  41900. $ctx1.sendIdx["variable"]=1;
  41901. $2=$recv($3)._name();
  41902. $1=$recv($2).__eq("thisContext");
  41903. if($core.assert($1)){
  41904. $4=$self._stream();
  41905. $ctx1.sendIdx["stream"]=1;
  41906. $recv($4)._nextPutAll_("$core.getThisContext()");
  41907. $ctx1.sendIdx["nextPutAll:"]=1;
  41908. } else {
  41909. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  41910. }
  41911. return self;
  41912. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  41913. },
  41914. args: ["anIRVariable"],
  41915. 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 ]",
  41916. referencedClasses: [],
  41917. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  41918. }),
  41919. $globals.IRJSTranslator);
  41920. $core.addMethod(
  41921. $core.method({
  41922. selector: "visitIRVerbatim:",
  41923. protocol: "visiting",
  41924. fn: function (anIRVerbatim){
  41925. var self=this,$self=this;
  41926. return $core.withContext(function($ctx1) {
  41927. $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  41928. return self;
  41929. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  41930. },
  41931. args: ["anIRVerbatim"],
  41932. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutAll: anIRVerbatim source",
  41933. referencedClasses: [],
  41934. messageSends: ["nextPutAll:", "stream", "source"]
  41935. }),
  41936. $globals.IRJSTranslator);
  41937. $core.addMethod(
  41938. $core.method({
  41939. selector: "visitInstructionList:enclosedBetween:and:",
  41940. protocol: "visiting",
  41941. fn: function (anArray,aString,anotherString){
  41942. var self=this,$self=this;
  41943. return $core.withContext(function($ctx1) {
  41944. var $1;
  41945. $1=$self._stream();
  41946. $ctx1.sendIdx["stream"]=1;
  41947. $recv($1)._nextPutAll_(aString);
  41948. $ctx1.sendIdx["nextPutAll:"]=1;
  41949. $recv(anArray)._do_separatedBy_((function(each){
  41950. return $core.withContext(function($ctx2) {
  41951. return $self._visit_(each);
  41952. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41953. }),(function(){
  41954. return $core.withContext(function($ctx2) {
  41955. return $recv($self._stream())._nextPutAll_(",");
  41956. $ctx2.sendIdx["nextPutAll:"]=2;
  41957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41958. }));
  41959. $recv($self.stream)._nextPutAll_(anotherString);
  41960. return self;
  41961. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  41962. },
  41963. args: ["anArray", "aString", "anotherString"],
  41964. 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",
  41965. referencedClasses: [],
  41966. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  41967. }),
  41968. $globals.IRJSTranslator);
  41969. $core.addMethod(
  41970. $core.method({
  41971. selector: "visitReceiver:",
  41972. protocol: "visiting",
  41973. fn: function (anIRInstruction){
  41974. var self=this,$self=this;
  41975. var instr;
  41976. return $core.withContext(function($ctx1) {
  41977. var $1,$2,$4,$5,$3,$6,$7,$8;
  41978. $1=$recv(anIRInstruction)._isSelf();
  41979. if($core.assert($1)){
  41980. $2=$recv(anIRInstruction)._copy();
  41981. $ctx1.sendIdx["copy"]=1;
  41982. $4=$recv($recv(anIRInstruction)._variable())._copy();
  41983. $recv($4)._name_("$self");
  41984. $5=$recv($4)._yourself();
  41985. $ctx1.sendIdx["yourself"]=1;
  41986. $3=$5;
  41987. $recv($2)._variable_($3);
  41988. instr=$recv($2)._yourself();
  41989. instr;
  41990. } else {
  41991. instr=anIRInstruction;
  41992. instr;
  41993. }
  41994. $6=$recv(instr)._needsBoxingAsReceiver();
  41995. if(!$core.assert($6)){
  41996. $7=$self._visit_(instr);
  41997. $ctx1.sendIdx["visit:"]=1;
  41998. return $7;
  41999. }
  42000. $8=$self._stream();
  42001. $ctx1.sendIdx["stream"]=1;
  42002. $recv($8)._nextPutAll_("$recv(");
  42003. $ctx1.sendIdx["nextPutAll:"]=1;
  42004. $self._visit_(instr);
  42005. $recv($self._stream())._nextPutAll_(")");
  42006. return self;
  42007. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction,instr:instr},$globals.IRJSTranslator)});
  42008. },
  42009. args: ["anIRInstruction"],
  42010. 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: ')'",
  42011. referencedClasses: [],
  42012. messageSends: ["ifTrue:ifFalse:", "isSelf", "variable:", "copy", "name:", "variable", "yourself", "ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  42013. }),
  42014. $globals.IRJSTranslator);
  42015. $core.addMethod(
  42016. $core.method({
  42017. selector: "visitSend:",
  42018. protocol: "visiting",
  42019. fn: function (anIRSend){
  42020. var self=this,$self=this;
  42021. return $core.withContext(function($ctx1) {
  42022. $self._visitReceiver_($recv(anIRSend)._receiver());
  42023. $recv($self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  42024. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  42025. return self;
  42026. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  42027. },
  42028. args: ["anIRSend"],
  42029. 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: ')'",
  42030. referencedClasses: [],
  42031. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  42032. }),
  42033. $globals.IRJSTranslator);
  42034. $core.addMethod(
  42035. $core.method({
  42036. selector: "visitSuperSend:",
  42037. protocol: "visiting",
  42038. fn: function (anIRSend){
  42039. var self=this,$self=this;
  42040. return $core.withContext(function($ctx1) {
  42041. var $1,$4,$3,$2,$5,$6,$7,$8;
  42042. $1=$self._stream();
  42043. $ctx1.sendIdx["stream"]=1;
  42044. $recv($1)._nextPutAll_("(");
  42045. $ctx1.sendIdx["nextPutAll:"]=1;
  42046. $recv($1)._lf();
  42047. $ctx1.sendIdx["lf"]=1;
  42048. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42049. $ctx1.sendIdx["nextPutAll:"]=2;
  42050. $recv($1)._lf();
  42051. $ctx1.sendIdx["lf"]=2;
  42052. $4=$recv(anIRSend)._scope();
  42053. $ctx1.sendIdx["scope"]=1;
  42054. $3=$recv($4)._alias();
  42055. $ctx1.sendIdx["alias"]=1;
  42056. $2=$recv($3).__comma(".supercall = true,");
  42057. $ctx1.sendIdx[","]=1;
  42058. $recv($1)._nextPutAll_($2);
  42059. $ctx1.sendIdx["nextPutAll:"]=3;
  42060. $recv($1)._lf();
  42061. $ctx1.sendIdx["lf"]=3;
  42062. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42063. $ctx1.sendIdx["nextPutAll:"]=4;
  42064. $recv($1)._lf();
  42065. $ctx1.sendIdx["lf"]=4;
  42066. $5="(".__comma($recv($self._currentClass())._asJavaScriptSource());
  42067. $ctx1.sendIdx[","]=2;
  42068. $recv($1)._nextPutAll_($5);
  42069. $ctx1.sendIdx["nextPutAll:"]=5;
  42070. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  42071. $ctx1.sendIdx["nextPutAll:"]=6;
  42072. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  42073. $ctx1.sendIdx[","]=3;
  42074. $recv($1)._nextPutAll_($6);
  42075. $ctx1.sendIdx["nextPutAll:"]=7;
  42076. $7=$recv($1)._nextPutAll_("$self, ");
  42077. $ctx1.sendIdx["nextPutAll:"]=8;
  42078. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  42079. $8=$self._stream();
  42080. $recv($8)._nextPutAll_("));");
  42081. $ctx1.sendIdx["nextPutAll:"]=9;
  42082. $recv($8)._lf();
  42083. $ctx1.sendIdx["lf"]=5;
  42084. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42085. $ctx1.sendIdx["nextPutAll:"]=10;
  42086. $recv($8)._lf();
  42087. $ctx1.sendIdx["lf"]=6;
  42088. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  42089. $ctx1.sendIdx["nextPutAll:"]=11;
  42090. $recv($8)._lf();
  42091. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42092. return self;
  42093. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  42094. },
  42095. args: ["anIRSend"],
  42096. 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);'",
  42097. referencedClasses: [],
  42098. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  42099. }),
  42100. $globals.IRJSTranslator);
  42101. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  42102. $core.addMethod(
  42103. $core.method({
  42104. selector: "contents",
  42105. protocol: "accessing",
  42106. fn: function (){
  42107. var self=this,$self=this;
  42108. return $core.withContext(function($ctx1) {
  42109. return $recv($self.stream)._contents();
  42110. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  42111. },
  42112. args: [],
  42113. source: "contents\x0a\x09^ stream contents",
  42114. referencedClasses: [],
  42115. messageSends: ["contents"]
  42116. }),
  42117. $globals.JSStream);
  42118. $core.addMethod(
  42119. $core.method({
  42120. selector: "initialize",
  42121. protocol: "initialization",
  42122. fn: function (){
  42123. var self=this,$self=this;
  42124. return $core.withContext(function($ctx1) {
  42125. (
  42126. $ctx1.supercall = true,
  42127. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  42128. $ctx1.supercall = false;
  42129. $self.stream=""._writeStream();
  42130. return self;
  42131. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  42132. },
  42133. args: [],
  42134. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  42135. referencedClasses: [],
  42136. messageSends: ["initialize", "writeStream"]
  42137. }),
  42138. $globals.JSStream);
  42139. $core.addMethod(
  42140. $core.method({
  42141. selector: "lf",
  42142. protocol: "streaming",
  42143. fn: function (){
  42144. var self=this,$self=this;
  42145. return $core.withContext(function($ctx1) {
  42146. $recv($self.stream)._lf();
  42147. return self;
  42148. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  42149. },
  42150. args: [],
  42151. source: "lf\x0a\x09stream lf",
  42152. referencedClasses: [],
  42153. messageSends: ["lf"]
  42154. }),
  42155. $globals.JSStream);
  42156. $core.addMethod(
  42157. $core.method({
  42158. selector: "nextPut:",
  42159. protocol: "streaming",
  42160. fn: function (aString){
  42161. var self=this,$self=this;
  42162. return $core.withContext(function($ctx1) {
  42163. $recv($self.stream)._nextPut_(aString);
  42164. return self;
  42165. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  42166. },
  42167. args: ["aString"],
  42168. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  42169. referencedClasses: [],
  42170. messageSends: ["nextPut:"]
  42171. }),
  42172. $globals.JSStream);
  42173. $core.addMethod(
  42174. $core.method({
  42175. selector: "nextPutAll:",
  42176. protocol: "streaming",
  42177. fn: function (aString){
  42178. var self=this,$self=this;
  42179. return $core.withContext(function($ctx1) {
  42180. $recv($self.stream)._nextPutAll_(aString);
  42181. return self;
  42182. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  42183. },
  42184. args: ["aString"],
  42185. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  42186. referencedClasses: [],
  42187. messageSends: ["nextPutAll:"]
  42188. }),
  42189. $globals.JSStream);
  42190. $core.addMethod(
  42191. $core.method({
  42192. selector: "nextPutAssignLhs:rhs:",
  42193. protocol: "streaming",
  42194. fn: function (aBlock,anotherBlock){
  42195. var self=this,$self=this;
  42196. return $core.withContext(function($ctx1) {
  42197. $recv(aBlock)._value();
  42198. $ctx1.sendIdx["value"]=1;
  42199. $recv($self.stream)._nextPutAll_("=");
  42200. $recv(anotherBlock)._value();
  42201. return self;
  42202. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  42203. },
  42204. args: ["aBlock", "anotherBlock"],
  42205. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  42206. referencedClasses: [],
  42207. messageSends: ["value", "nextPutAll:"]
  42208. }),
  42209. $globals.JSStream);
  42210. $core.addMethod(
  42211. $core.method({
  42212. selector: "nextPutBlockContextFor:during:",
  42213. protocol: "streaming",
  42214. fn: function (anIRClosure,aBlock){
  42215. var self=this,$self=this;
  42216. return $core.withContext(function($ctx1) {
  42217. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  42218. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  42219. if(!$core.assert($1)){
  42220. $2=$recv(aBlock)._value();
  42221. $ctx1.sendIdx["value"]=1;
  42222. return $2;
  42223. }
  42224. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42225. $ctx1.sendIdx["nextPutAll:"]=1;
  42226. $self._lf();
  42227. $ctx1.sendIdx["lf"]=1;
  42228. $6=$recv(anIRClosure)._scope();
  42229. $ctx1.sendIdx["scope"]=1;
  42230. $5=$recv($6)._alias();
  42231. $ctx1.sendIdx["alias"]=1;
  42232. $4="return $core.withContext(function(".__comma($5);
  42233. $ctx1.sendIdx[","]=2;
  42234. $3=$recv($4).__comma(") {");
  42235. $ctx1.sendIdx[","]=1;
  42236. $self._nextPutAll_($3);
  42237. $ctx1.sendIdx["nextPutAll:"]=2;
  42238. $self._lf();
  42239. $ctx1.sendIdx["lf"]=2;
  42240. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42241. $ctx1.sendIdx["nextPutAll:"]=3;
  42242. $7=$self._lf();
  42243. $ctx1.sendIdx["lf"]=3;
  42244. $recv(aBlock)._value();
  42245. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42246. $ctx1.sendIdx["nextPutAll:"]=4;
  42247. $self._lf();
  42248. $ctx1.sendIdx["lf"]=4;
  42249. $11=$recv(anIRClosure)._scope();
  42250. $ctx1.sendIdx["scope"]=2;
  42251. $10=$recv($11)._alias();
  42252. $ctx1.sendIdx["alias"]=2;
  42253. $9="}, function(".__comma($10);
  42254. $ctx1.sendIdx[","]=4;
  42255. $8=$recv($9).__comma(") {");
  42256. $ctx1.sendIdx[","]=3;
  42257. $self._nextPutAll_($8);
  42258. $ctx1.sendIdx["nextPutAll:"]=5;
  42259. $15=$recv(anIRClosure)._scope();
  42260. $ctx1.sendIdx["scope"]=3;
  42261. $14=$recv($15)._alias();
  42262. $ctx1.sendIdx["alias"]=3;
  42263. $13=$recv($14).__comma(".fillBlock({");
  42264. $ctx1.sendIdx[","]=5;
  42265. $12=$self._nextPutAll_($13);
  42266. $ctx1.sendIdx["nextPutAll:"]=6;
  42267. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  42268. return $core.withContext(function($ctx2) {
  42269. $16=$recv(each)._asVariableName();
  42270. $ctx2.sendIdx["asVariableName"]=1;
  42271. $self._nextPutAll_($16);
  42272. $ctx2.sendIdx["nextPutAll:"]=7;
  42273. $self._nextPutAll_(":");
  42274. $ctx2.sendIdx["nextPutAll:"]=8;
  42275. $17=$self._nextPutAll_($recv(each)._asVariableName());
  42276. $ctx2.sendIdx["nextPutAll:"]=9;
  42277. return $17;
  42278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42279. }),(function(){
  42280. return $core.withContext(function($ctx2) {
  42281. return $self._nextPutAll_(",");
  42282. $ctx2.sendIdx["nextPutAll:"]=10;
  42283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42284. }));
  42285. $self._nextPutAll_("},");
  42286. $ctx1.sendIdx["nextPutAll:"]=11;
  42287. $23=$recv(anIRClosure)._scope();
  42288. $ctx1.sendIdx["scope"]=4;
  42289. $22=$recv($23)._outerScope();
  42290. $21=$recv($22)._alias();
  42291. $20=$recv($21).__comma(",");
  42292. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  42293. $ctx1.sendIdx[","]=7;
  42294. $18=$recv($19).__comma(")});");
  42295. $ctx1.sendIdx[","]=6;
  42296. $self._nextPutAll_($18);
  42297. $ctx1.sendIdx["nextPutAll:"]=12;
  42298. $self._lf();
  42299. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42300. return self;
  42301. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  42302. },
  42303. args: ["anIRClosure", "aBlock"],
  42304. 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);'",
  42305. referencedClasses: [],
  42306. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  42307. }),
  42308. $globals.JSStream);
  42309. $core.addMethod(
  42310. $core.method({
  42311. selector: "nextPutClosureWith:arguments:",
  42312. protocol: "streaming",
  42313. fn: function (aBlock,anArray){
  42314. var self=this,$self=this;
  42315. return $core.withContext(function($ctx1) {
  42316. var $1,$2,$3;
  42317. $recv($self.stream)._nextPutAll_("(function(");
  42318. $ctx1.sendIdx["nextPutAll:"]=1;
  42319. $recv(anArray)._do_separatedBy_((function(each){
  42320. return $core.withContext(function($ctx2) {
  42321. return $recv($self.stream)._nextPutAll_($recv(each)._asVariableName());
  42322. $ctx2.sendIdx["nextPutAll:"]=2;
  42323. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42324. }),(function(){
  42325. return $core.withContext(function($ctx2) {
  42326. return $recv($self.stream)._nextPut_(",");
  42327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42328. }));
  42329. $1=$self.stream;
  42330. $recv($1)._nextPutAll_("){");
  42331. $ctx1.sendIdx["nextPutAll:"]=3;
  42332. $2=$recv($1)._lf();
  42333. $ctx1.sendIdx["lf"]=1;
  42334. $recv(aBlock)._value();
  42335. $3=$self.stream;
  42336. $recv($3)._lf();
  42337. $recv($3)._nextPutAll_("})");
  42338. return self;
  42339. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42340. },
  42341. args: ["aBlock", "anArray"],
  42342. 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: '})'",
  42343. referencedClasses: [],
  42344. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42345. }),
  42346. $globals.JSStream);
  42347. $core.addMethod(
  42348. $core.method({
  42349. selector: "nextPutContextFor:during:",
  42350. protocol: "streaming",
  42351. fn: function (aMethod,aBlock){
  42352. var self=this,$self=this;
  42353. return $core.withContext(function($ctx1) {
  42354. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  42355. $1=$recv(aMethod)._requiresSmalltalkContext();
  42356. if(!$core.assert($1)){
  42357. $2=$recv(aBlock)._value();
  42358. $ctx1.sendIdx["value"]=1;
  42359. return $2;
  42360. }
  42361. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42362. $ctx1.sendIdx["nextPutAll:"]=1;
  42363. $self._lf();
  42364. $ctx1.sendIdx["lf"]=1;
  42365. $6=$recv(aMethod)._scope();
  42366. $ctx1.sendIdx["scope"]=1;
  42367. $5=$recv($6)._alias();
  42368. $ctx1.sendIdx["alias"]=1;
  42369. $4="return $core.withContext(function(".__comma($5);
  42370. $ctx1.sendIdx[","]=2;
  42371. $3=$recv($4).__comma(") {");
  42372. $ctx1.sendIdx[","]=1;
  42373. $self._nextPutAll_($3);
  42374. $ctx1.sendIdx["nextPutAll:"]=2;
  42375. $self._lf();
  42376. $ctx1.sendIdx["lf"]=2;
  42377. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42378. $ctx1.sendIdx["nextPutAll:"]=3;
  42379. $7=$self._lf();
  42380. $ctx1.sendIdx["lf"]=3;
  42381. $recv(aBlock)._value();
  42382. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42383. $ctx1.sendIdx["nextPutAll:"]=4;
  42384. $self._lf();
  42385. $ctx1.sendIdx["lf"]=4;
  42386. $12=$recv(aMethod)._scope();
  42387. $ctx1.sendIdx["scope"]=2;
  42388. $11=$recv($12)._alias();
  42389. $ctx1.sendIdx["alias"]=2;
  42390. $10="}, function(".__comma($11);
  42391. $ctx1.sendIdx[","]=5;
  42392. $9=$recv($10).__comma(") {");
  42393. $ctx1.sendIdx[","]=4;
  42394. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  42395. $ctx1.sendIdx[","]=3;
  42396. $self._nextPutAll_($8);
  42397. $ctx1.sendIdx["nextPutAll:"]=5;
  42398. $16=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42399. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42400. $15=".fill(self,".__comma($16);
  42401. $14=$recv($15).__comma(",{");
  42402. $ctx1.sendIdx[","]=6;
  42403. $13=$self._nextPutAll_($14);
  42404. $ctx1.sendIdx["nextPutAll:"]=6;
  42405. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  42406. return $core.withContext(function($ctx2) {
  42407. $17=$recv(each)._asVariableName();
  42408. $ctx2.sendIdx["asVariableName"]=1;
  42409. $self._nextPutAll_($17);
  42410. $ctx2.sendIdx["nextPutAll:"]=7;
  42411. $self._nextPutAll_(":");
  42412. $ctx2.sendIdx["nextPutAll:"]=8;
  42413. $18=$self._nextPutAll_($recv(each)._asVariableName());
  42414. $ctx2.sendIdx["nextPutAll:"]=9;
  42415. return $18;
  42416. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42417. }),(function(){
  42418. return $core.withContext(function($ctx2) {
  42419. return $self._nextPutAll_(",");
  42420. $ctx2.sendIdx["nextPutAll:"]=10;
  42421. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42422. }));
  42423. $self._nextPutAll_("},");
  42424. $ctx1.sendIdx["nextPutAll:"]=11;
  42425. $self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavaScriptSource());
  42426. $ctx1.sendIdx["nextPutAll:"]=12;
  42427. $self._nextPutAll_(")});");
  42428. $ctx1.sendIdx["nextPutAll:"]=13;
  42429. $self._lf();
  42430. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42431. return self;
  42432. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42433. },
  42434. args: ["aMethod", "aBlock"],
  42435. 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);'",
  42436. referencedClasses: [],
  42437. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  42438. }),
  42439. $globals.JSStream);
  42440. $core.addMethod(
  42441. $core.method({
  42442. selector: "nextPutFunctionWith:arguments:",
  42443. protocol: "streaming",
  42444. fn: function (aBlock,anArray){
  42445. var self=this,$self=this;
  42446. return $core.withContext(function($ctx1) {
  42447. var $1,$2,$3,$4,$5;
  42448. $recv($self.stream)._nextPutAll_("fn: function (");
  42449. $ctx1.sendIdx["nextPutAll:"]=1;
  42450. $recv(anArray)._do_separatedBy_((function(each){
  42451. return $core.withContext(function($ctx2) {
  42452. return $recv($self.stream)._nextPutAll_($recv(each)._asVariableName());
  42453. $ctx2.sendIdx["nextPutAll:"]=2;
  42454. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42455. }),(function(){
  42456. return $core.withContext(function($ctx2) {
  42457. return $recv($self.stream)._nextPut_(",");
  42458. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42459. }));
  42460. $1=$self.stream;
  42461. $recv($1)._nextPutAll_("){");
  42462. $ctx1.sendIdx["nextPutAll:"]=3;
  42463. $2=$recv($1)._lf();
  42464. $ctx1.sendIdx["lf"]=1;
  42465. $3=$self.stream;
  42466. $recv($3)._nextPutAll_("var self=this,$self=this;");
  42467. $ctx1.sendIdx["nextPutAll:"]=4;
  42468. $4=$recv($3)._lf();
  42469. $ctx1.sendIdx["lf"]=2;
  42470. $recv(aBlock)._value();
  42471. $5=$self.stream;
  42472. $recv($5)._lf();
  42473. $recv($5)._nextPutAll_("}");
  42474. return self;
  42475. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42476. },
  42477. args: ["aBlock", "anArray"],
  42478. 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: '}'",
  42479. referencedClasses: [],
  42480. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42481. }),
  42482. $globals.JSStream);
  42483. $core.addMethod(
  42484. $core.method({
  42485. selector: "nextPutIf:then:",
  42486. protocol: "streaming",
  42487. fn: function (aBlock,anotherBlock){
  42488. var self=this,$self=this;
  42489. return $core.withContext(function($ctx1) {
  42490. var $1;
  42491. $recv($self.stream)._nextPutAll_("if(");
  42492. $ctx1.sendIdx["nextPutAll:"]=1;
  42493. $recv(aBlock)._value();
  42494. $ctx1.sendIdx["value"]=1;
  42495. $1=$self.stream;
  42496. $recv($1)._nextPutAll_("){");
  42497. $ctx1.sendIdx["nextPutAll:"]=2;
  42498. $recv($1)._lf();
  42499. $recv(anotherBlock)._value();
  42500. $recv($self.stream)._nextPutAll_("}");
  42501. $self._omitSemicolon_(true);
  42502. return self;
  42503. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  42504. },
  42505. args: ["aBlock", "anotherBlock"],
  42506. 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",
  42507. referencedClasses: [],
  42508. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42509. }),
  42510. $globals.JSStream);
  42511. $core.addMethod(
  42512. $core.method({
  42513. selector: "nextPutIf:then:else:",
  42514. protocol: "streaming",
  42515. fn: function (aBlock,ifBlock,elseBlock){
  42516. var self=this,$self=this;
  42517. return $core.withContext(function($ctx1) {
  42518. var $1,$2,$3;
  42519. $recv($self.stream)._nextPutAll_("if(");
  42520. $ctx1.sendIdx["nextPutAll:"]=1;
  42521. $recv(aBlock)._value();
  42522. $ctx1.sendIdx["value"]=1;
  42523. $1=$self.stream;
  42524. $recv($1)._nextPutAll_("){");
  42525. $ctx1.sendIdx["nextPutAll:"]=2;
  42526. $2=$recv($1)._lf();
  42527. $ctx1.sendIdx["lf"]=1;
  42528. $recv(ifBlock)._value();
  42529. $ctx1.sendIdx["value"]=2;
  42530. $3=$self.stream;
  42531. $recv($3)._nextPutAll_("} else {");
  42532. $ctx1.sendIdx["nextPutAll:"]=3;
  42533. $recv($3)._lf();
  42534. $recv(elseBlock)._value();
  42535. $recv($self.stream)._nextPutAll_("}");
  42536. $self._omitSemicolon_(true);
  42537. return self;
  42538. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  42539. },
  42540. args: ["aBlock", "ifBlock", "elseBlock"],
  42541. 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",
  42542. referencedClasses: [],
  42543. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42544. }),
  42545. $globals.JSStream);
  42546. $core.addMethod(
  42547. $core.method({
  42548. selector: "nextPutMethodDeclaration:with:",
  42549. protocol: "streaming",
  42550. fn: function (aMethod,aBlock){
  42551. var self=this,$self=this;
  42552. return $core.withContext(function($ctx1) {
  42553. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  42554. $1=$self.stream;
  42555. $recv($1)._nextPutAll_("$core.method({");
  42556. $ctx1.sendIdx["nextPutAll:"]=1;
  42557. $recv($1)._lf();
  42558. $ctx1.sendIdx["lf"]=1;
  42559. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42560. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42561. $3="selector: ".__comma($4);
  42562. $ctx1.sendIdx[","]=2;
  42563. $2=$recv($3).__comma(",");
  42564. $ctx1.sendIdx[","]=1;
  42565. $recv($1)._nextPutAll_($2);
  42566. $ctx1.sendIdx["nextPutAll:"]=2;
  42567. $recv($1)._lf();
  42568. $ctx1.sendIdx["lf"]=2;
  42569. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  42570. $ctx1.sendIdx["asJavaScriptSource"]=2;
  42571. $6="source: ".__comma($7);
  42572. $ctx1.sendIdx[","]=4;
  42573. $5=$recv($6).__comma(",");
  42574. $ctx1.sendIdx[","]=3;
  42575. $recv($1)._nextPutAll_($5);
  42576. $ctx1.sendIdx["nextPutAll:"]=3;
  42577. $8=$recv($1)._lf();
  42578. $ctx1.sendIdx["lf"]=3;
  42579. $recv(aBlock)._value();
  42580. $ctx1.sendIdx["value"]=1;
  42581. $9=$self.stream;
  42582. $12=$recv($globals.String)._lf();
  42583. $ctx1.sendIdx["lf"]=4;
  42584. $11=",".__comma($12);
  42585. $ctx1.sendIdx[","]=6;
  42586. $10=$recv($11).__comma("messageSends: ");
  42587. $ctx1.sendIdx[","]=5;
  42588. $recv($9)._nextPutAll_($10);
  42589. $ctx1.sendIdx["nextPutAll:"]=4;
  42590. $15=$recv($recv(aMethod)._messageSends())._asArray();
  42591. $ctx1.sendIdx["asArray"]=1;
  42592. $14=$recv($15)._asJavaScriptSource();
  42593. $ctx1.sendIdx["asJavaScriptSource"]=3;
  42594. $13=$recv($14).__comma(",");
  42595. $ctx1.sendIdx[","]=7;
  42596. $recv($9)._nextPutAll_($13);
  42597. $ctx1.sendIdx["nextPutAll:"]=5;
  42598. $recv($9)._lf();
  42599. $ctx1.sendIdx["lf"]=5;
  42600. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  42601. return $core.withContext(function($ctx2) {
  42602. return $recv(each)._value();
  42603. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42604. })))._asArray())._asJavaScriptSource();
  42605. $ctx1.sendIdx["asJavaScriptSource"]=4;
  42606. $17="args: ".__comma($18);
  42607. $16=$recv($17).__comma(",");
  42608. $ctx1.sendIdx[","]=8;
  42609. $recv($9)._nextPutAll_($16);
  42610. $ctx1.sendIdx["nextPutAll:"]=6;
  42611. $recv($9)._lf();
  42612. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  42613. $ctx1.sendIdx["nextPutAll:"]=7;
  42614. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  42615. return $core.withContext(function($ctx2) {
  42616. return $recv($self.stream)._nextPutAll_($recv(each)._asJavaScriptSource());
  42617. $ctx2.sendIdx["nextPutAll:"]=8;
  42618. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42619. }),(function(){
  42620. return $core.withContext(function($ctx2) {
  42621. return $recv($self.stream)._nextPutAll_(",");
  42622. $ctx2.sendIdx["nextPutAll:"]=9;
  42623. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42624. }));
  42625. $20=$self.stream;
  42626. $recv($20)._nextPutAll_("]");
  42627. $ctx1.sendIdx["nextPutAll:"]=10;
  42628. $recv($20)._nextPutAll_("})");
  42629. return self;
  42630. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42631. },
  42632. args: ["aMethod", "aBlock"],
  42633. 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: '})'",
  42634. referencedClasses: ["String"],
  42635. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  42636. }),
  42637. $globals.JSStream);
  42638. $core.addMethod(
  42639. $core.method({
  42640. selector: "nextPutNonLocalReturnHandlingWith:",
  42641. protocol: "streaming",
  42642. fn: function (aBlock){
  42643. var self=this,$self=this;
  42644. return $core.withContext(function($ctx1) {
  42645. var $1,$2,$3;
  42646. $1=$self.stream;
  42647. $recv($1)._nextPutAll_("var $early={};");
  42648. $ctx1.sendIdx["nextPutAll:"]=1;
  42649. $recv($1)._lf();
  42650. $ctx1.sendIdx["lf"]=1;
  42651. $recv($1)._nextPutAll_("try {");
  42652. $ctx1.sendIdx["nextPutAll:"]=2;
  42653. $2=$recv($1)._lf();
  42654. $ctx1.sendIdx["lf"]=2;
  42655. $recv(aBlock)._value();
  42656. $3=$self.stream;
  42657. $recv($3)._nextPutAll_("}");
  42658. $ctx1.sendIdx["nextPutAll:"]=3;
  42659. $recv($3)._lf();
  42660. $ctx1.sendIdx["lf"]=3;
  42661. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  42662. $recv($3)._lf();
  42663. return self;
  42664. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  42665. },
  42666. args: ["aBlock"],
  42667. 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",
  42668. referencedClasses: [],
  42669. messageSends: ["nextPutAll:", "lf", "value"]
  42670. }),
  42671. $globals.JSStream);
  42672. $core.addMethod(
  42673. $core.method({
  42674. selector: "nextPutNonLocalReturnWith:",
  42675. protocol: "streaming",
  42676. fn: function (aBlock){
  42677. var self=this,$self=this;
  42678. return $core.withContext(function($ctx1) {
  42679. $recv($self.stream)._nextPutAll_("throw $early=[");
  42680. $ctx1.sendIdx["nextPutAll:"]=1;
  42681. $recv(aBlock)._value();
  42682. $recv($self.stream)._nextPutAll_("]");
  42683. return self;
  42684. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42685. },
  42686. args: ["aBlock"],
  42687. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  42688. referencedClasses: [],
  42689. messageSends: ["nextPutAll:", "value"]
  42690. }),
  42691. $globals.JSStream);
  42692. $core.addMethod(
  42693. $core.method({
  42694. selector: "nextPutReturnWith:",
  42695. protocol: "streaming",
  42696. fn: function (aBlock){
  42697. var self=this,$self=this;
  42698. return $core.withContext(function($ctx1) {
  42699. $recv($self.stream)._nextPutAll_("return ");
  42700. $recv(aBlock)._value();
  42701. return self;
  42702. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42703. },
  42704. args: ["aBlock"],
  42705. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  42706. referencedClasses: [],
  42707. messageSends: ["nextPutAll:", "value"]
  42708. }),
  42709. $globals.JSStream);
  42710. $core.addMethod(
  42711. $core.method({
  42712. selector: "nextPutSendIndexFor:",
  42713. protocol: "streaming",
  42714. fn: function (anIRSend){
  42715. var self=this,$self=this;
  42716. return $core.withContext(function($ctx1) {
  42717. $self._nextPutAll_(";");
  42718. $ctx1.sendIdx["nextPutAll:"]=1;
  42719. $self._lf();
  42720. $ctx1.sendIdx["lf"]=1;
  42721. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42722. $ctx1.sendIdx["nextPutAll:"]=2;
  42723. $self._lf();
  42724. $ctx1.sendIdx["lf"]=2;
  42725. $self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  42726. $ctx1.sendIdx["nextPutAll:"]=3;
  42727. $self._nextPutAll_(".sendIdx[");
  42728. $ctx1.sendIdx["nextPutAll:"]=4;
  42729. $self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  42730. $ctx1.sendIdx["nextPutAll:"]=5;
  42731. $self._nextPutAll_("]=");
  42732. $ctx1.sendIdx["nextPutAll:"]=6;
  42733. $self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  42734. $ctx1.sendIdx["nextPutAll:"]=7;
  42735. $self._nextPutAll_(";");
  42736. $ctx1.sendIdx["nextPutAll:"]=8;
  42737. $self._lf();
  42738. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  42739. return self;
  42740. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  42741. },
  42742. args: ["anIRSend"],
  42743. 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)'",
  42744. referencedClasses: [],
  42745. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  42746. }),
  42747. $globals.JSStream);
  42748. $core.addMethod(
  42749. $core.method({
  42750. selector: "nextPutStatementWith:",
  42751. protocol: "streaming",
  42752. fn: function (aBlock){
  42753. var self=this,$self=this;
  42754. return $core.withContext(function($ctx1) {
  42755. var $1;
  42756. $self._omitSemicolon_(false);
  42757. $ctx1.sendIdx["omitSemicolon:"]=1;
  42758. $recv(aBlock)._value();
  42759. $1=$self._omitSemicolon();
  42760. if(!$core.assert($1)){
  42761. $recv($self.stream)._nextPutAll_(";");
  42762. }
  42763. $self._omitSemicolon_(false);
  42764. $recv($self.stream)._lf();
  42765. return self;
  42766. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  42767. },
  42768. args: ["aBlock"],
  42769. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  42770. referencedClasses: [],
  42771. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  42772. }),
  42773. $globals.JSStream);
  42774. $core.addMethod(
  42775. $core.method({
  42776. selector: "nextPutVars:",
  42777. protocol: "streaming",
  42778. fn: function (aCollection){
  42779. var self=this,$self=this;
  42780. return $core.withContext(function($ctx1) {
  42781. var $1;
  42782. $recv(aCollection)._ifNotEmpty_((function(){
  42783. return $core.withContext(function($ctx2) {
  42784. $recv($self.stream)._nextPutAll_("var ");
  42785. $ctx2.sendIdx["nextPutAll:"]=1;
  42786. $recv(aCollection)._do_separatedBy_((function(each){
  42787. return $core.withContext(function($ctx3) {
  42788. return $recv($self.stream)._nextPutAll_(each);
  42789. $ctx3.sendIdx["nextPutAll:"]=2;
  42790. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42791. }),(function(){
  42792. return $core.withContext(function($ctx3) {
  42793. return $recv($self.stream)._nextPutAll_(",");
  42794. $ctx3.sendIdx["nextPutAll:"]=3;
  42795. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42796. }));
  42797. $1=$self.stream;
  42798. $recv($1)._nextPutAll_(";");
  42799. return $recv($1)._lf();
  42800. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42801. }));
  42802. return self;
  42803. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  42804. },
  42805. args: ["aCollection"],
  42806. 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 ]",
  42807. referencedClasses: [],
  42808. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  42809. }),
  42810. $globals.JSStream);
  42811. $core.addMethod(
  42812. $core.method({
  42813. selector: "omitSemicolon",
  42814. protocol: "accessing",
  42815. fn: function (){
  42816. var self=this,$self=this;
  42817. return $self.omitSemicolon;
  42818. },
  42819. args: [],
  42820. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  42821. referencedClasses: [],
  42822. messageSends: []
  42823. }),
  42824. $globals.JSStream);
  42825. $core.addMethod(
  42826. $core.method({
  42827. selector: "omitSemicolon:",
  42828. protocol: "accessing",
  42829. fn: function (aBoolean){
  42830. var self=this,$self=this;
  42831. $self.omitSemicolon=aBoolean;
  42832. return self;
  42833. },
  42834. args: ["aBoolean"],
  42835. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  42836. referencedClasses: [],
  42837. messageSends: []
  42838. }),
  42839. $globals.JSStream);
  42840. $core.addMethod(
  42841. $core.method({
  42842. selector: "isReferenced",
  42843. protocol: "*Compiler-IR",
  42844. fn: function (){
  42845. var self=this,$self=this;
  42846. return $core.withContext(function($ctx1) {
  42847. var $3,$2,$1;
  42848. $3=$self._parent();
  42849. $ctx1.sendIdx["parent"]=1;
  42850. $2=$recv($3)._isSequenceNode();
  42851. $1=$recv($2)._or_((function(){
  42852. return $core.withContext(function($ctx2) {
  42853. return $recv($self._parent())._isAssignmentNode();
  42854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42855. }));
  42856. return $recv($1)._not();
  42857. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  42858. },
  42859. args: [],
  42860. 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",
  42861. referencedClasses: [],
  42862. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  42863. }),
  42864. $globals.ASTNode);
  42865. $core.addMethod(
  42866. $core.method({
  42867. selector: "subtreeNeedsAliasing",
  42868. protocol: "*Compiler-IR",
  42869. fn: function (){
  42870. var self=this,$self=this;
  42871. return $core.withContext(function($ctx1) {
  42872. return $recv($self._shouldBeAliased())._or_((function(){
  42873. return $core.withContext(function($ctx2) {
  42874. return $recv($self._dagChildren())._anySatisfy_((function(each){
  42875. return $core.withContext(function($ctx3) {
  42876. return $recv(each)._subtreeNeedsAliasing();
  42877. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42878. }));
  42879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42880. }));
  42881. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  42882. },
  42883. args: [],
  42884. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  42885. referencedClasses: [],
  42886. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  42887. }),
  42888. $globals.ASTNode);
  42889. $core.addMethod(
  42890. $core.method({
  42891. selector: "shouldBeAliased",
  42892. protocol: "*Compiler-IR",
  42893. fn: function (){
  42894. var self=this,$self=this;
  42895. return $core.withContext(function($ctx1) {
  42896. var $1;
  42897. $1=(
  42898. $ctx1.supercall = true,
  42899. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42900. $ctx1.supercall = false;
  42901. return $recv($1)._or_((function(){
  42902. return $core.withContext(function($ctx2) {
  42903. return $self._isReferenced();
  42904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42905. }));
  42906. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  42907. },
  42908. args: [],
  42909. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  42910. referencedClasses: [],
  42911. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  42912. }),
  42913. $globals.AssignmentNode);
  42914. $core.addMethod(
  42915. $core.method({
  42916. selector: "appendToInstruction:",
  42917. protocol: "*Compiler-IR",
  42918. fn: function (anIRInstruction){
  42919. var self=this,$self=this;
  42920. return $core.withContext(function($ctx1) {
  42921. $recv(anIRInstruction)._appendBlock_(self);
  42922. return self;
  42923. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  42924. },
  42925. args: ["anIRInstruction"],
  42926. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  42927. referencedClasses: [],
  42928. messageSends: ["appendBlock:"]
  42929. }),
  42930. $globals.BlockClosure);
  42931. $core.addMethod(
  42932. $core.method({
  42933. selector: "subtreeNeedsAliasing",
  42934. protocol: "*Compiler-IR",
  42935. fn: function (){
  42936. var self=this,$self=this;
  42937. return $core.withContext(function($ctx1) {
  42938. return $self._shouldBeAliased();
  42939. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  42940. },
  42941. args: [],
  42942. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  42943. referencedClasses: [],
  42944. messageSends: ["shouldBeAliased"]
  42945. }),
  42946. $globals.BlockNode);
  42947. $core.addMethod(
  42948. $core.method({
  42949. selector: "subtreeNeedsAliasing",
  42950. protocol: "*Compiler-IR",
  42951. fn: function (){
  42952. var self=this,$self=this;
  42953. return $core.withContext(function($ctx1) {
  42954. return $recv($recv($self._parent())._isSequenceNode())._not();
  42955. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  42956. },
  42957. args: [],
  42958. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  42959. referencedClasses: [],
  42960. messageSends: ["not", "isSequenceNode", "parent"]
  42961. }),
  42962. $globals.CascadeNode);
  42963. $core.addMethod(
  42964. $core.method({
  42965. selector: "shouldBeAliased",
  42966. protocol: "*Compiler-IR",
  42967. fn: function (){
  42968. var self=this,$self=this;
  42969. var sends;
  42970. return $core.withContext(function($ctx1) {
  42971. var $2,$1;
  42972. sends=$recv($recv($recv($self._method())._sendIndexes())._at_($self._selector()))._size();
  42973. $2=(
  42974. $ctx1.supercall = true,
  42975. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42976. $ctx1.supercall = false;
  42977. $1=$recv($2)._or_((function(){
  42978. return $core.withContext(function($ctx2) {
  42979. return $recv($self._isReferenced())._and_((function(){
  42980. return $core.withContext(function($ctx3) {
  42981. return $recv($recv($self._index()).__lt(sends))._or_((function(){
  42982. return $core.withContext(function($ctx4) {
  42983. return $self._superSend();
  42984. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  42985. }));
  42986. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42987. }));
  42988. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42989. }));
  42990. $ctx1.sendIdx["or:"]=1;
  42991. return $1;
  42992. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  42993. },
  42994. args: [],
  42995. 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 ] ] ])",
  42996. referencedClasses: [],
  42997. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  42998. }),
  42999. $globals.SendNode);
  43000. $core.addMethod(
  43001. $core.method({
  43002. selector: "subtreeNeedsAliasing",
  43003. protocol: "*Compiler-IR",
  43004. fn: function (){
  43005. var self=this,$self=this;
  43006. return $core.withContext(function($ctx1) {
  43007. return $recv($self._shouldBeInlined())._or_((function(){
  43008. return $core.withContext(function($ctx2) {
  43009. return (
  43010. $ctx2.supercall = true,
  43011. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($self, []));
  43012. $ctx2.supercall = false;
  43013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43014. }));
  43015. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  43016. },
  43017. args: [],
  43018. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  43019. referencedClasses: [],
  43020. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  43021. }),
  43022. $globals.SendNode);
  43023. });
  43024. define('amber/core/Compiler-Inlining',["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Compiler-Core", "amber/core/Compiler-IR", "amber/core/Compiler-Semantic", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  43025. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  43026. var $pkg = $core.addPackage("Compiler-Inlining");
  43027. $pkg.innerEval = function (expr) { return eval(expr); };
  43028. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  43029. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  43030. $core.addMethod(
  43031. $core.method({
  43032. selector: "visitSendNode:",
  43033. protocol: "visiting",
  43034. fn: function (aNode){
  43035. var self=this,$self=this;
  43036. return $core.withContext(function($ctx1) {
  43037. var $1,$2,$3,$4,$receiver;
  43038. $1=$recv(aNode)._superSend();
  43039. if(!$core.assert($1)){
  43040. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  43041. if($core.assert($2)){
  43042. $recv(aNode)._shouldBeInlined_(true);
  43043. $3=$recv(aNode)._receiver();
  43044. if(($receiver = $3) == null || $receiver.a$nil){
  43045. $3;
  43046. } else {
  43047. var receiver;
  43048. receiver=$receiver;
  43049. $recv(receiver)._shouldBeAliased_(true);
  43050. }
  43051. }
  43052. }
  43053. $4=(
  43054. $ctx1.supercall = true,
  43055. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  43056. $ctx1.supercall = false;
  43057. return $4;
  43058. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  43059. },
  43060. args: ["aNode"],
  43061. 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",
  43062. referencedClasses: ["IRSendInliner"],
  43063. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  43064. }),
  43065. $globals.ASTPreInliner);
  43066. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  43067. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  43068. $core.addMethod(
  43069. $core.method({
  43070. selector: "acceptDagVisitor:",
  43071. protocol: "visiting",
  43072. fn: function (aVisitor){
  43073. var self=this,$self=this;
  43074. return $core.withContext(function($ctx1) {
  43075. $recv(aVisitor)._visitIRInlinedClosure_(self);
  43076. return self;
  43077. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  43078. },
  43079. args: ["aVisitor"],
  43080. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  43081. referencedClasses: [],
  43082. messageSends: ["visitIRInlinedClosure:"]
  43083. }),
  43084. $globals.IRInlinedClosure);
  43085. $core.addMethod(
  43086. $core.method({
  43087. selector: "isInlined",
  43088. protocol: "testing",
  43089. fn: function (){
  43090. var self=this,$self=this;
  43091. return true;
  43092. },
  43093. args: [],
  43094. source: "isInlined\x0a\x09^ true",
  43095. referencedClasses: [],
  43096. messageSends: []
  43097. }),
  43098. $globals.IRInlinedClosure);
  43099. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  43100. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  43101. $core.addMethod(
  43102. $core.method({
  43103. selector: "acceptDagVisitor:",
  43104. protocol: "visiting",
  43105. fn: function (aVisitor){
  43106. var self=this,$self=this;
  43107. return $core.withContext(function($ctx1) {
  43108. $recv(aVisitor)._visitInlinedSend_(self);
  43109. return self;
  43110. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  43111. },
  43112. args: ["aVisitor"],
  43113. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  43114. referencedClasses: [],
  43115. messageSends: ["visitInlinedSend:"]
  43116. }),
  43117. $globals.IRInlinedSend);
  43118. $core.addMethod(
  43119. $core.method({
  43120. selector: "internalVariables",
  43121. protocol: "accessing",
  43122. fn: function (){
  43123. var self=this,$self=this;
  43124. return [];
  43125. },
  43126. args: [],
  43127. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  43128. referencedClasses: [],
  43129. messageSends: []
  43130. }),
  43131. $globals.IRInlinedSend);
  43132. $core.addMethod(
  43133. $core.method({
  43134. selector: "isInlined",
  43135. protocol: "testing",
  43136. fn: function (){
  43137. var self=this,$self=this;
  43138. return true;
  43139. },
  43140. args: [],
  43141. source: "isInlined\x0a\x09^ true",
  43142. referencedClasses: [],
  43143. messageSends: []
  43144. }),
  43145. $globals.IRInlinedSend);
  43146. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  43147. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  43148. $core.addMethod(
  43149. $core.method({
  43150. selector: "acceptDagVisitor:",
  43151. protocol: "visiting",
  43152. fn: function (aVisitor){
  43153. var self=this,$self=this;
  43154. return $core.withContext(function($ctx1) {
  43155. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  43156. return self;
  43157. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  43158. },
  43159. args: ["aVisitor"],
  43160. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  43161. referencedClasses: [],
  43162. messageSends: ["visitIRInlinedIfFalse:"]
  43163. }),
  43164. $globals.IRInlinedIfFalse);
  43165. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  43166. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  43167. $core.addMethod(
  43168. $core.method({
  43169. selector: "acceptDagVisitor:",
  43170. protocol: "visiting",
  43171. fn: function (aVisitor){
  43172. var self=this,$self=this;
  43173. return $core.withContext(function($ctx1) {
  43174. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  43175. return self;
  43176. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  43177. },
  43178. args: ["aVisitor"],
  43179. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  43180. referencedClasses: [],
  43181. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  43182. }),
  43183. $globals.IRInlinedIfNilIfNotNil);
  43184. $core.addMethod(
  43185. $core.method({
  43186. selector: "internalVariables",
  43187. protocol: "accessing",
  43188. fn: function (){
  43189. var self=this,$self=this;
  43190. return $core.withContext(function($ctx1) {
  43191. return $recv($globals.Array)._with_($self._receiverInternalVariable());
  43192. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  43193. },
  43194. args: [],
  43195. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  43196. referencedClasses: ["Array"],
  43197. messageSends: ["with:", "receiverInternalVariable"]
  43198. }),
  43199. $globals.IRInlinedIfNilIfNotNil);
  43200. $core.addMethod(
  43201. $core.method({
  43202. selector: "receiverInternalVariable",
  43203. protocol: "accessing",
  43204. fn: function (){
  43205. var self=this,$self=this;
  43206. return $core.withContext(function($ctx1) {
  43207. var $1;
  43208. $1=$recv($globals.IRVariable)._new();
  43209. $ctx1.sendIdx["new"]=1;
  43210. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_($self._receiverInternalVariableName()));
  43211. return $recv($1)._yourself();
  43212. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  43213. },
  43214. args: [],
  43215. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  43216. referencedClasses: ["IRVariable", "AliasVar"],
  43217. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  43218. }),
  43219. $globals.IRInlinedIfNilIfNotNil);
  43220. $core.addMethod(
  43221. $core.method({
  43222. selector: "receiverInternalVariableName",
  43223. protocol: "accessing",
  43224. fn: function (){
  43225. var self=this,$self=this;
  43226. return "$receiver";
  43227. },
  43228. args: [],
  43229. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  43230. referencedClasses: [],
  43231. messageSends: []
  43232. }),
  43233. $globals.IRInlinedIfNilIfNotNil);
  43234. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  43235. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  43236. $core.addMethod(
  43237. $core.method({
  43238. selector: "acceptDagVisitor:",
  43239. protocol: "visiting",
  43240. fn: function (aVisitor){
  43241. var self=this,$self=this;
  43242. return $core.withContext(function($ctx1) {
  43243. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  43244. return self;
  43245. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  43246. },
  43247. args: ["aVisitor"],
  43248. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  43249. referencedClasses: [],
  43250. messageSends: ["visitIRInlinedIfTrue:"]
  43251. }),
  43252. $globals.IRInlinedIfTrue);
  43253. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  43254. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  43255. $core.addMethod(
  43256. $core.method({
  43257. selector: "acceptDagVisitor:",
  43258. protocol: "visiting",
  43259. fn: function (aVisitor){
  43260. var self=this,$self=this;
  43261. return $core.withContext(function($ctx1) {
  43262. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  43263. return self;
  43264. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  43265. },
  43266. args: ["aVisitor"],
  43267. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  43268. referencedClasses: [],
  43269. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  43270. }),
  43271. $globals.IRInlinedIfTrueIfFalse);
  43272. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  43273. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  43274. $core.addMethod(
  43275. $core.method({
  43276. selector: "acceptDagVisitor:",
  43277. protocol: "visiting",
  43278. fn: function (aVisitor){
  43279. var self=this,$self=this;
  43280. return $core.withContext(function($ctx1) {
  43281. $recv(aVisitor)._visitIRInlinedSequence_(self);
  43282. return self;
  43283. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  43284. },
  43285. args: ["aVisitor"],
  43286. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  43287. referencedClasses: [],
  43288. messageSends: ["visitIRInlinedSequence:"]
  43289. }),
  43290. $globals.IRInlinedSequence);
  43291. $core.addMethod(
  43292. $core.method({
  43293. selector: "isInlined",
  43294. protocol: "testing",
  43295. fn: function (){
  43296. var self=this,$self=this;
  43297. return true;
  43298. },
  43299. args: [],
  43300. source: "isInlined\x0a\x09^ true",
  43301. referencedClasses: [],
  43302. messageSends: []
  43303. }),
  43304. $globals.IRInlinedSequence);
  43305. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  43306. $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`";
  43307. $core.addMethod(
  43308. $core.method({
  43309. selector: "assignmentInliner",
  43310. protocol: "factory",
  43311. fn: function (){
  43312. var self=this,$self=this;
  43313. return $core.withContext(function($ctx1) {
  43314. var $1;
  43315. $1=$recv($globals.IRAssignmentInliner)._new();
  43316. $recv($1)._translator_(self);
  43317. return $recv($1)._yourself();
  43318. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  43319. },
  43320. args: [],
  43321. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43322. referencedClasses: ["IRAssignmentInliner"],
  43323. messageSends: ["translator:", "new", "yourself"]
  43324. }),
  43325. $globals.IRInliner);
  43326. $core.addMethod(
  43327. $core.method({
  43328. selector: "returnInliner",
  43329. protocol: "factory",
  43330. fn: function (){
  43331. var self=this,$self=this;
  43332. return $core.withContext(function($ctx1) {
  43333. var $1;
  43334. $1=$recv($globals.IRReturnInliner)._new();
  43335. $recv($1)._translator_(self);
  43336. return $recv($1)._yourself();
  43337. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  43338. },
  43339. args: [],
  43340. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43341. referencedClasses: ["IRReturnInliner"],
  43342. messageSends: ["translator:", "new", "yourself"]
  43343. }),
  43344. $globals.IRInliner);
  43345. $core.addMethod(
  43346. $core.method({
  43347. selector: "sendInliner",
  43348. protocol: "factory",
  43349. fn: function (){
  43350. var self=this,$self=this;
  43351. return $core.withContext(function($ctx1) {
  43352. var $1;
  43353. $1=$recv($globals.IRSendInliner)._new();
  43354. $recv($1)._translator_(self);
  43355. return $recv($1)._yourself();
  43356. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  43357. },
  43358. args: [],
  43359. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43360. referencedClasses: ["IRSendInliner"],
  43361. messageSends: ["translator:", "new", "yourself"]
  43362. }),
  43363. $globals.IRInliner);
  43364. $core.addMethod(
  43365. $core.method({
  43366. selector: "shouldInlineAssignment:",
  43367. protocol: "testing",
  43368. fn: function (anIRAssignment){
  43369. var self=this,$self=this;
  43370. return $core.withContext(function($ctx1) {
  43371. var $3,$2,$1;
  43372. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  43373. return $core.withContext(function($ctx2) {
  43374. $3=$recv(anIRAssignment)._right();
  43375. $ctx2.sendIdx["right"]=1;
  43376. $2=$recv($3)._isSend();
  43377. return $recv($2)._and_((function(){
  43378. return $core.withContext(function($ctx3) {
  43379. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  43380. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43381. }));
  43382. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43383. }));
  43384. $ctx1.sendIdx["and:"]=1;
  43385. return $1;
  43386. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43387. },
  43388. args: ["anIRAssignment"],
  43389. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  43390. referencedClasses: [],
  43391. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  43392. }),
  43393. $globals.IRInliner);
  43394. $core.addMethod(
  43395. $core.method({
  43396. selector: "shouldInlineReturn:",
  43397. protocol: "testing",
  43398. fn: function (anIRReturn){
  43399. var self=this,$self=this;
  43400. return $core.withContext(function($ctx1) {
  43401. var $3,$2,$1;
  43402. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  43403. return $core.withContext(function($ctx2) {
  43404. $3=$recv(anIRReturn)._expression();
  43405. $ctx2.sendIdx["expression"]=1;
  43406. $2=$recv($3)._isSend();
  43407. return $recv($2)._and_((function(){
  43408. return $core.withContext(function($ctx3) {
  43409. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  43410. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43411. }));
  43412. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43413. }));
  43414. $ctx1.sendIdx["and:"]=1;
  43415. return $1;
  43416. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43417. },
  43418. args: ["anIRReturn"],
  43419. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  43420. referencedClasses: [],
  43421. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  43422. }),
  43423. $globals.IRInliner);
  43424. $core.addMethod(
  43425. $core.method({
  43426. selector: "shouldInlineSend:",
  43427. protocol: "testing",
  43428. fn: function (anIRSend){
  43429. var self=this,$self=this;
  43430. return $core.withContext(function($ctx1) {
  43431. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  43432. return $core.withContext(function($ctx2) {
  43433. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  43434. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43435. }));
  43436. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43437. },
  43438. args: ["anIRSend"],
  43439. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  43440. referencedClasses: ["IRSendInliner"],
  43441. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  43442. }),
  43443. $globals.IRInliner);
  43444. $core.addMethod(
  43445. $core.method({
  43446. selector: "visitIRAssignment:",
  43447. protocol: "visiting",
  43448. fn: function (anIRAssignment){
  43449. var self=this,$self=this;
  43450. return $core.withContext(function($ctx1) {
  43451. var $1;
  43452. $1=$self._shouldInlineAssignment_(anIRAssignment);
  43453. if($core.assert($1)){
  43454. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  43455. } else {
  43456. return (
  43457. $ctx1.supercall = true,
  43458. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($self, [anIRAssignment]));
  43459. $ctx1.supercall = false;
  43460. }
  43461. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43462. },
  43463. args: ["anIRAssignment"],
  43464. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  43465. referencedClasses: [],
  43466. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  43467. }),
  43468. $globals.IRInliner);
  43469. $core.addMethod(
  43470. $core.method({
  43471. selector: "visitIRNonLocalReturn:",
  43472. protocol: "visiting",
  43473. fn: function (anIRNonLocalReturn){
  43474. var self=this,$self=this;
  43475. var localReturn;
  43476. return $core.withContext(function($ctx1) {
  43477. var $2,$1,$4,$3,$5,$6,$7;
  43478. $2=$recv(anIRNonLocalReturn)._scope();
  43479. $ctx1.sendIdx["scope"]=1;
  43480. $1=$recv($2)._canInlineNonLocalReturns();
  43481. if($core.assert($1)){
  43482. $4=$recv(anIRNonLocalReturn)._scope();
  43483. $ctx1.sendIdx["scope"]=2;
  43484. $3=$recv($4)._methodScope();
  43485. $5=$recv(anIRNonLocalReturn)._scope();
  43486. $ctx1.sendIdx["scope"]=3;
  43487. $recv($3)._removeNonLocalReturn_($5);
  43488. $6=$recv($globals.IRReturn)._new();
  43489. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  43490. localReturn=$recv($6)._yourself();
  43491. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  43492. return $core.withContext(function($ctx2) {
  43493. return $recv(localReturn)._add_(each);
  43494. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43495. }));
  43496. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  43497. return $self._visitIRReturn_(localReturn);
  43498. }
  43499. $7=(
  43500. $ctx1.supercall = true,
  43501. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  43502. $ctx1.supercall = false;
  43503. return $7;
  43504. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  43505. },
  43506. args: ["anIRNonLocalReturn"],
  43507. 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",
  43508. referencedClasses: ["IRReturn"],
  43509. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  43510. }),
  43511. $globals.IRInliner);
  43512. $core.addMethod(
  43513. $core.method({
  43514. selector: "visitIRReturn:",
  43515. protocol: "visiting",
  43516. fn: function (anIRReturn){
  43517. var self=this,$self=this;
  43518. return $core.withContext(function($ctx1) {
  43519. var $1;
  43520. $1=$self._shouldInlineReturn_(anIRReturn);
  43521. if($core.assert($1)){
  43522. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  43523. } else {
  43524. return (
  43525. $ctx1.supercall = true,
  43526. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  43527. $ctx1.supercall = false;
  43528. }
  43529. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43530. },
  43531. args: ["anIRReturn"],
  43532. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  43533. referencedClasses: [],
  43534. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  43535. }),
  43536. $globals.IRInliner);
  43537. $core.addMethod(
  43538. $core.method({
  43539. selector: "visitIRSend:",
  43540. protocol: "visiting",
  43541. fn: function (anIRSend){
  43542. var self=this,$self=this;
  43543. return $core.withContext(function($ctx1) {
  43544. var $1;
  43545. $1=$self._shouldInlineSend_(anIRSend);
  43546. if($core.assert($1)){
  43547. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  43548. } else {
  43549. return (
  43550. $ctx1.supercall = true,
  43551. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($self, [anIRSend]));
  43552. $ctx1.supercall = false;
  43553. }
  43554. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43555. },
  43556. args: ["anIRSend"],
  43557. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  43558. referencedClasses: [],
  43559. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  43560. }),
  43561. $globals.IRInliner);
  43562. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  43563. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  43564. $core.addMethod(
  43565. $core.method({
  43566. selector: "visitIRInlinedClosure:",
  43567. protocol: "visiting",
  43568. fn: function (anIRInlinedClosure){
  43569. var self=this,$self=this;
  43570. return $core.withContext(function($ctx1) {
  43571. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  43572. return $core.withContext(function($ctx2) {
  43573. return $recv($recv(each)._name())._asVariableName();
  43574. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43575. })));
  43576. $self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  43577. return self;
  43578. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  43579. },
  43580. args: ["anIRInlinedClosure"],
  43581. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  43582. referencedClasses: [],
  43583. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  43584. }),
  43585. $globals.IRInliningJSTranslator);
  43586. $core.addMethod(
  43587. $core.method({
  43588. selector: "visitIRInlinedIfFalse:",
  43589. protocol: "visiting",
  43590. fn: function (anIRInlinedIfFalse){
  43591. var self=this,$self=this;
  43592. return $core.withContext(function($ctx1) {
  43593. var $1,$2,$4,$3;
  43594. $1=$self._stream();
  43595. $ctx1.sendIdx["stream"]=1;
  43596. $recv($1)._nextPutIf_then_((function(){
  43597. return $core.withContext(function($ctx2) {
  43598. $2=$self._stream();
  43599. $ctx2.sendIdx["stream"]=2;
  43600. $recv($2)._nextPutAll_("!$core.assert(");
  43601. $ctx2.sendIdx["nextPutAll:"]=1;
  43602. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  43603. $ctx2.sendIdx["dagChildren"]=1;
  43604. $3=$recv($4)._first();
  43605. $self._visit_($3);
  43606. $ctx2.sendIdx["visit:"]=1;
  43607. return $recv($self._stream())._nextPutAll_(")");
  43608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43609. }),(function(){
  43610. return $core.withContext(function($ctx2) {
  43611. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  43612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43613. }));
  43614. return self;
  43615. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  43616. },
  43617. args: ["anIRInlinedIfFalse"],
  43618. 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 ]",
  43619. referencedClasses: [],
  43620. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43621. }),
  43622. $globals.IRInliningJSTranslator);
  43623. $core.addMethod(
  43624. $core.method({
  43625. selector: "visitIRInlinedIfNilIfNotNil:",
  43626. protocol: "visiting",
  43627. fn: function (anIRInlinedIfNilIfNotNil){
  43628. var self=this,$self=this;
  43629. return $core.withContext(function($ctx1) {
  43630. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  43631. $1=$self._stream();
  43632. $ctx1.sendIdx["stream"]=1;
  43633. $recv($1)._nextPutIf_then_else_((function(){
  43634. var recvVarName;
  43635. return $core.withContext(function($ctx2) {
  43636. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  43637. $2=$self._stream();
  43638. $ctx2.sendIdx["stream"]=2;
  43639. $4="(".__comma(recvVarName);
  43640. $ctx2.sendIdx[","]=2;
  43641. $3=$recv($4).__comma(" = ");
  43642. $ctx2.sendIdx[","]=1;
  43643. $recv($2)._nextPutAll_($3);
  43644. $ctx2.sendIdx["nextPutAll:"]=1;
  43645. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43646. $ctx2.sendIdx["dagChildren"]=1;
  43647. $5=$recv($6)._first();
  43648. $self._visit_($5);
  43649. $ctx2.sendIdx["visit:"]=1;
  43650. $7=$self._stream();
  43651. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".a$nil");
  43652. $ctx2.sendIdx[","]=3;
  43653. return $recv($7)._nextPutAll_($8);
  43654. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  43655. }),(function(){
  43656. return $core.withContext(function($ctx2) {
  43657. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43658. $ctx2.sendIdx["dagChildren"]=2;
  43659. $9=$recv($10)._second();
  43660. return $self._visit_($9);
  43661. $ctx2.sendIdx["visit:"]=2;
  43662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43663. }),(function(){
  43664. return $core.withContext(function($ctx2) {
  43665. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  43666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43667. }));
  43668. return self;
  43669. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  43670. },
  43671. args: ["anIRInlinedIfNilIfNotNil"],
  43672. 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 ]",
  43673. referencedClasses: [],
  43674. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  43675. }),
  43676. $globals.IRInliningJSTranslator);
  43677. $core.addMethod(
  43678. $core.method({
  43679. selector: "visitIRInlinedIfTrue:",
  43680. protocol: "visiting",
  43681. fn: function (anIRInlinedIfTrue){
  43682. var self=this,$self=this;
  43683. return $core.withContext(function($ctx1) {
  43684. var $1,$2,$4,$3;
  43685. $1=$self._stream();
  43686. $ctx1.sendIdx["stream"]=1;
  43687. $recv($1)._nextPutIf_then_((function(){
  43688. return $core.withContext(function($ctx2) {
  43689. $2=$self._stream();
  43690. $ctx2.sendIdx["stream"]=2;
  43691. $recv($2)._nextPutAll_("$core.assert(");
  43692. $ctx2.sendIdx["nextPutAll:"]=1;
  43693. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  43694. $ctx2.sendIdx["dagChildren"]=1;
  43695. $3=$recv($4)._first();
  43696. $self._visit_($3);
  43697. $ctx2.sendIdx["visit:"]=1;
  43698. return $recv($self._stream())._nextPutAll_(")");
  43699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43700. }),(function(){
  43701. return $core.withContext(function($ctx2) {
  43702. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  43703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43704. }));
  43705. return self;
  43706. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  43707. },
  43708. args: ["anIRInlinedIfTrue"],
  43709. 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 ]",
  43710. referencedClasses: [],
  43711. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43712. }),
  43713. $globals.IRInliningJSTranslator);
  43714. $core.addMethod(
  43715. $core.method({
  43716. selector: "visitIRInlinedIfTrueIfFalse:",
  43717. protocol: "visiting",
  43718. fn: function (anIRInlinedIfTrueIfFalse){
  43719. var self=this,$self=this;
  43720. return $core.withContext(function($ctx1) {
  43721. var $1,$2,$4,$3,$6,$5;
  43722. $1=$self._stream();
  43723. $ctx1.sendIdx["stream"]=1;
  43724. $recv($1)._nextPutIf_then_else_((function(){
  43725. return $core.withContext(function($ctx2) {
  43726. $2=$self._stream();
  43727. $ctx2.sendIdx["stream"]=2;
  43728. $recv($2)._nextPutAll_("$core.assert(");
  43729. $ctx2.sendIdx["nextPutAll:"]=1;
  43730. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43731. $ctx2.sendIdx["dagChildren"]=1;
  43732. $3=$recv($4)._first();
  43733. $self._visit_($3);
  43734. $ctx2.sendIdx["visit:"]=1;
  43735. return $recv($self._stream())._nextPutAll_(")");
  43736. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43737. }),(function(){
  43738. return $core.withContext(function($ctx2) {
  43739. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43740. $ctx2.sendIdx["dagChildren"]=2;
  43741. $5=$recv($6)._second();
  43742. return $self._visit_($5);
  43743. $ctx2.sendIdx["visit:"]=2;
  43744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43745. }),(function(){
  43746. return $core.withContext(function($ctx2) {
  43747. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  43748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43749. }));
  43750. return self;
  43751. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  43752. },
  43753. args: ["anIRInlinedIfTrueIfFalse"],
  43754. 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 ]",
  43755. referencedClasses: [],
  43756. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  43757. }),
  43758. $globals.IRInliningJSTranslator);
  43759. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  43760. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  43761. $core.addMethod(
  43762. $core.method({
  43763. selector: "ifFalse:",
  43764. protocol: "inlining",
  43765. fn: function (anIRInstruction){
  43766. var self=this,$self=this;
  43767. return $core.withContext(function($ctx1) {
  43768. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  43769. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43770. },
  43771. args: ["anIRInstruction"],
  43772. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  43773. referencedClasses: ["IRInlinedIfFalse"],
  43774. messageSends: ["inlinedSend:withBlock:", "new"]
  43775. }),
  43776. $globals.IRSendInliner);
  43777. $core.addMethod(
  43778. $core.method({
  43779. selector: "ifFalse:ifTrue:",
  43780. protocol: "inlining",
  43781. fn: function (anIRInstruction,anotherIRInstruction){
  43782. var self=this,$self=this;
  43783. return $core.withContext(function($ctx1) {
  43784. return $self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  43785. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43786. },
  43787. args: ["anIRInstruction", "anotherIRInstruction"],
  43788. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  43789. referencedClasses: [],
  43790. messageSends: ["perform:withArguments:"]
  43791. }),
  43792. $globals.IRSendInliner);
  43793. $core.addMethod(
  43794. $core.method({
  43795. selector: "ifNil:",
  43796. protocol: "inlining",
  43797. fn: function (anIRInstruction){
  43798. var self=this,$self=this;
  43799. return $core.withContext(function($ctx1) {
  43800. var $1,$3,$5,$6,$4,$2;
  43801. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43802. $ctx1.sendIdx["new"]=1;
  43803. $3=$recv($globals.IRClosure)._new();
  43804. $ctx1.sendIdx["new"]=2;
  43805. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43806. $5=$recv($globals.IRBlockSequence)._new();
  43807. $recv($5)._add_($recv($self._send())._receiver());
  43808. $6=$recv($5)._yourself();
  43809. $ctx1.sendIdx["yourself"]=1;
  43810. $4=$6;
  43811. $recv($3)._add_($4);
  43812. $ctx1.sendIdx["add:"]=1;
  43813. $2=$recv($3)._yourself();
  43814. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  43815. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43816. },
  43817. args: ["anIRInstruction"],
  43818. 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)",
  43819. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43820. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43821. }),
  43822. $globals.IRSendInliner);
  43823. $core.addMethod(
  43824. $core.method({
  43825. selector: "ifNil:ifNotNil:",
  43826. protocol: "inlining",
  43827. fn: function (anIRInstruction,anotherIRInstruction){
  43828. var self=this,$self=this;
  43829. return $core.withContext(function($ctx1) {
  43830. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  43831. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43832. },
  43833. args: ["anIRInstruction", "anotherIRInstruction"],
  43834. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43835. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43836. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43837. }),
  43838. $globals.IRSendInliner);
  43839. $core.addMethod(
  43840. $core.method({
  43841. selector: "ifNotNil:",
  43842. protocol: "inlining",
  43843. fn: function (anIRInstruction){
  43844. var self=this,$self=this;
  43845. return $core.withContext(function($ctx1) {
  43846. var $1,$3,$5,$6,$4,$2;
  43847. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43848. $ctx1.sendIdx["new"]=1;
  43849. $3=$recv($globals.IRClosure)._new();
  43850. $ctx1.sendIdx["new"]=2;
  43851. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43852. $5=$recv($globals.IRBlockSequence)._new();
  43853. $recv($5)._add_($recv($self._send())._receiver());
  43854. $6=$recv($5)._yourself();
  43855. $ctx1.sendIdx["yourself"]=1;
  43856. $4=$6;
  43857. $recv($3)._add_($4);
  43858. $ctx1.sendIdx["add:"]=1;
  43859. $2=$recv($3)._yourself();
  43860. return $self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  43861. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43862. },
  43863. args: ["anIRInstruction"],
  43864. 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",
  43865. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43866. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43867. }),
  43868. $globals.IRSendInliner);
  43869. $core.addMethod(
  43870. $core.method({
  43871. selector: "ifNotNil:ifNil:",
  43872. protocol: "inlining",
  43873. fn: function (anIRInstruction,anotherIRInstruction){
  43874. var self=this,$self=this;
  43875. return $core.withContext(function($ctx1) {
  43876. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  43877. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43878. },
  43879. args: ["anIRInstruction", "anotherIRInstruction"],
  43880. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  43881. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43882. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43883. }),
  43884. $globals.IRSendInliner);
  43885. $core.addMethod(
  43886. $core.method({
  43887. selector: "ifTrue:",
  43888. protocol: "inlining",
  43889. fn: function (anIRInstruction){
  43890. var self=this,$self=this;
  43891. return $core.withContext(function($ctx1) {
  43892. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  43893. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43894. },
  43895. args: ["anIRInstruction"],
  43896. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  43897. referencedClasses: ["IRInlinedIfTrue"],
  43898. messageSends: ["inlinedSend:withBlock:", "new"]
  43899. }),
  43900. $globals.IRSendInliner);
  43901. $core.addMethod(
  43902. $core.method({
  43903. selector: "ifTrue:ifFalse:",
  43904. protocol: "inlining",
  43905. fn: function (anIRInstruction,anotherIRInstruction){
  43906. var self=this,$self=this;
  43907. return $core.withContext(function($ctx1) {
  43908. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  43909. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43910. },
  43911. args: ["anIRInstruction", "anotherIRInstruction"],
  43912. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43913. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  43914. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43915. }),
  43916. $globals.IRSendInliner);
  43917. $core.addMethod(
  43918. $core.method({
  43919. selector: "inlineClosure:",
  43920. protocol: "inlining",
  43921. fn: function (anIRClosure){
  43922. var self=this,$self=this;
  43923. var inlinedClosure,sequence,statements;
  43924. return $core.withContext(function($ctx1) {
  43925. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  43926. inlinedClosure=$self._inlinedClosure();
  43927. $1=inlinedClosure;
  43928. $2=$recv(anIRClosure)._scope();
  43929. $ctx1.sendIdx["scope"]=1;
  43930. $recv($1)._scope_($2);
  43931. $ctx1.sendIdx["scope:"]=1;
  43932. $recv($1)._parent_($recv(anIRClosure)._parent());
  43933. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  43934. return $core.withContext(function($ctx2) {
  43935. return $recv(inlinedClosure)._add_(each);
  43936. $ctx2.sendIdx["add:"]=1;
  43937. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43938. }));
  43939. $ctx1.sendIdx["do:"]=1;
  43940. sequence=$self._inlinedSequence();
  43941. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  43942. return $core.withContext(function($ctx2) {
  43943. $3=inlinedClosure;
  43944. $5=$recv($globals.IRTempDeclaration)._new();
  43945. $ctx2.sendIdx["new"]=1;
  43946. $recv($5)._name_(each);
  43947. $ctx2.sendIdx["name:"]=1;
  43948. $6=$recv($5)._yourself();
  43949. $ctx2.sendIdx["yourself"]=1;
  43950. $4=$6;
  43951. $recv($3)._add_($4);
  43952. $ctx2.sendIdx["add:"]=2;
  43953. $7=sequence;
  43954. $9=$recv($globals.IRAssignment)._new();
  43955. $ctx2.sendIdx["new"]=2;
  43956. $11=$recv($globals.IRVariable)._new();
  43957. $ctx2.sendIdx["new"]=3;
  43958. $13=$recv($globals.AliasVar)._new();
  43959. $ctx2.sendIdx["new"]=4;
  43960. $14=$recv(inlinedClosure)._scope();
  43961. $ctx2.sendIdx["scope"]=2;
  43962. $recv($13)._scope_($14);
  43963. $ctx2.sendIdx["scope:"]=2;
  43964. $recv($13)._name_(each);
  43965. $ctx2.sendIdx["name:"]=2;
  43966. $15=$recv($13)._yourself();
  43967. $ctx2.sendIdx["yourself"]=2;
  43968. $12=$15;
  43969. $10=$recv($11)._variable_($12);
  43970. $ctx2.sendIdx["variable:"]=1;
  43971. $recv($9)._add_($10);
  43972. $ctx2.sendIdx["add:"]=4;
  43973. $17=$recv($globals.IRVariable)._new();
  43974. $ctx2.sendIdx["new"]=5;
  43975. $19=$recv($globals.AliasVar)._new();
  43976. $recv($19)._scope_($recv(inlinedClosure)._scope());
  43977. $recv($19)._name_("$receiver");
  43978. $20=$recv($19)._yourself();
  43979. $ctx2.sendIdx["yourself"]=3;
  43980. $18=$20;
  43981. $16=$recv($17)._variable_($18);
  43982. $recv($9)._add_($16);
  43983. $ctx2.sendIdx["add:"]=5;
  43984. $8=$recv($9)._yourself();
  43985. return $recv($7)._add_($8);
  43986. $ctx2.sendIdx["add:"]=3;
  43987. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43988. }));
  43989. $ctx1.sendIdx["do:"]=2;
  43990. $recv(inlinedClosure)._add_(sequence);
  43991. $ctx1.sendIdx["add:"]=6;
  43992. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  43993. $recv(statements)._ifNotEmpty_((function(){
  43994. return $core.withContext(function($ctx2) {
  43995. $recv($recv(statements)._allButLast())._do_((function(each){
  43996. return $core.withContext(function($ctx3) {
  43997. return $recv(sequence)._add_(each);
  43998. $ctx3.sendIdx["add:"]=7;
  43999. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  44000. }));
  44001. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  44002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44003. }));
  44004. return inlinedClosure;
  44005. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  44006. },
  44007. args: ["anIRClosure"],
  44008. 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",
  44009. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  44010. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  44011. }),
  44012. $globals.IRSendInliner);
  44013. $core.addMethod(
  44014. $core.method({
  44015. selector: "inlineSend:",
  44016. protocol: "inlining",
  44017. fn: function (anIRSend){
  44018. var self=this,$self=this;
  44019. return $core.withContext(function($ctx1) {
  44020. var $2,$1;
  44021. $self._send_(anIRSend);
  44022. $2=$self._send();
  44023. $ctx1.sendIdx["send"]=1;
  44024. $1=$recv($2)._selector();
  44025. return $self._perform_withArguments_($1,$recv($self._send())._arguments());
  44026. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  44027. },
  44028. args: ["anIRSend"],
  44029. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  44030. referencedClasses: [],
  44031. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  44032. }),
  44033. $globals.IRSendInliner);
  44034. $core.addMethod(
  44035. $core.method({
  44036. selector: "inlineSend:andReplace:",
  44037. protocol: "private",
  44038. fn: function (anIRSend,anIRInstruction){
  44039. var self=this,$self=this;
  44040. return $core.withContext(function($ctx1) {
  44041. $recv(anIRInstruction)._replaceWith_(anIRSend);
  44042. return $self._inlineSend_(anIRSend);
  44043. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  44044. },
  44045. args: ["anIRSend", "anIRInstruction"],
  44046. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  44047. referencedClasses: [],
  44048. messageSends: ["replaceWith:", "inlineSend:"]
  44049. }),
  44050. $globals.IRSendInliner);
  44051. $core.addMethod(
  44052. $core.method({
  44053. selector: "inlinedClosure",
  44054. protocol: "factory",
  44055. fn: function (){
  44056. var self=this,$self=this;
  44057. return $core.withContext(function($ctx1) {
  44058. return $recv($globals.IRInlinedClosure)._new();
  44059. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  44060. },
  44061. args: [],
  44062. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  44063. referencedClasses: ["IRInlinedClosure"],
  44064. messageSends: ["new"]
  44065. }),
  44066. $globals.IRSendInliner);
  44067. $core.addMethod(
  44068. $core.method({
  44069. selector: "inlinedSend:withBlock:",
  44070. protocol: "private",
  44071. fn: function (inlinedSend,anIRInstruction){
  44072. var self=this,$self=this;
  44073. var inlinedClosure;
  44074. return $core.withContext(function($ctx1) {
  44075. var $1,$2,$4,$3,$5;
  44076. $1=$recv(anIRInstruction)._isClosure();
  44077. if(!$core.assert($1)){
  44078. $self._inliningError_("Message argument should be a block");
  44079. $ctx1.sendIdx["inliningError:"]=1;
  44080. }
  44081. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  44082. if(!$core.assert($2)){
  44083. $self._inliningError_("Inlined block should have zero argument");
  44084. }
  44085. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  44086. $4=$self._send();
  44087. $ctx1.sendIdx["send"]=1;
  44088. $3=$recv($4)._receiver();
  44089. $recv(inlinedSend)._add_($3);
  44090. $ctx1.sendIdx["add:"]=1;
  44091. $recv(inlinedSend)._add_(inlinedClosure);
  44092. $recv($self._send())._replaceWith_(inlinedSend);
  44093. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  44094. $ctx1.sendIdx["internalVariables"]=1;
  44095. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  44096. return inlinedSend;
  44097. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  44098. },
  44099. args: ["inlinedSend", "anIRInstruction"],
  44100. 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",
  44101. referencedClasses: [],
  44102. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  44103. }),
  44104. $globals.IRSendInliner);
  44105. $core.addMethod(
  44106. $core.method({
  44107. selector: "inlinedSend:withBlock:withBlock:",
  44108. protocol: "private",
  44109. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  44110. var self=this,$self=this;
  44111. var inlinedClosure1,inlinedClosure2;
  44112. return $core.withContext(function($ctx1) {
  44113. var $1,$2,$3,$4,$6,$5,$7;
  44114. $1=$recv(anIRInstruction)._isClosure();
  44115. $ctx1.sendIdx["isClosure"]=1;
  44116. if(!$core.assert($1)){
  44117. $self._inliningError_("Message argument should be a block");
  44118. $ctx1.sendIdx["inliningError:"]=1;
  44119. }
  44120. $2=$recv(anotherIRInstruction)._isClosure();
  44121. if(!$core.assert($2)){
  44122. $self._inliningError_("Message argument should be a block");
  44123. }
  44124. $3=$self._translator();
  44125. $ctx1.sendIdx["translator"]=1;
  44126. $4=$self._inlineClosure_(anIRInstruction);
  44127. $ctx1.sendIdx["inlineClosure:"]=1;
  44128. inlinedClosure1=$recv($3)._visit_($4);
  44129. $ctx1.sendIdx["visit:"]=1;
  44130. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  44131. $6=$self._send();
  44132. $ctx1.sendIdx["send"]=1;
  44133. $5=$recv($6)._receiver();
  44134. $recv(inlinedSend)._add_($5);
  44135. $ctx1.sendIdx["add:"]=1;
  44136. $recv(inlinedSend)._add_(inlinedClosure1);
  44137. $ctx1.sendIdx["add:"]=2;
  44138. $recv(inlinedSend)._add_(inlinedClosure2);
  44139. $recv($self._send())._replaceWith_(inlinedSend);
  44140. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  44141. $ctx1.sendIdx["internalVariables"]=1;
  44142. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  44143. return inlinedSend;
  44144. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  44145. },
  44146. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  44147. 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",
  44148. referencedClasses: [],
  44149. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  44150. }),
  44151. $globals.IRSendInliner);
  44152. $core.addMethod(
  44153. $core.method({
  44154. selector: "inlinedSequence",
  44155. protocol: "factory",
  44156. fn: function (){
  44157. var self=this,$self=this;
  44158. return $core.withContext(function($ctx1) {
  44159. return $recv($globals.IRInlinedSequence)._new();
  44160. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  44161. },
  44162. args: [],
  44163. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  44164. referencedClasses: ["IRInlinedSequence"],
  44165. messageSends: ["new"]
  44166. }),
  44167. $globals.IRSendInliner);
  44168. $core.addMethod(
  44169. $core.method({
  44170. selector: "inliningError:",
  44171. protocol: "error handling",
  44172. fn: function (aString){
  44173. var self=this,$self=this;
  44174. return $core.withContext(function($ctx1) {
  44175. $recv($globals.InliningError)._signal_(aString);
  44176. return self;
  44177. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  44178. },
  44179. args: ["aString"],
  44180. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  44181. referencedClasses: ["InliningError"],
  44182. messageSends: ["signal:"]
  44183. }),
  44184. $globals.IRSendInliner);
  44185. $core.addMethod(
  44186. $core.method({
  44187. selector: "send",
  44188. protocol: "accessing",
  44189. fn: function (){
  44190. var self=this,$self=this;
  44191. return $self.send;
  44192. },
  44193. args: [],
  44194. source: "send\x0a\x09^ send",
  44195. referencedClasses: [],
  44196. messageSends: []
  44197. }),
  44198. $globals.IRSendInliner);
  44199. $core.addMethod(
  44200. $core.method({
  44201. selector: "send:",
  44202. protocol: "accessing",
  44203. fn: function (anIRSend){
  44204. var self=this,$self=this;
  44205. $self.send=anIRSend;
  44206. return self;
  44207. },
  44208. args: ["anIRSend"],
  44209. source: "send: anIRSend\x0a\x09send := anIRSend",
  44210. referencedClasses: [],
  44211. messageSends: []
  44212. }),
  44213. $globals.IRSendInliner);
  44214. $core.addMethod(
  44215. $core.method({
  44216. selector: "translator",
  44217. protocol: "accessing",
  44218. fn: function (){
  44219. var self=this,$self=this;
  44220. return $self.translator;
  44221. },
  44222. args: [],
  44223. source: "translator\x0a\x09^ translator",
  44224. referencedClasses: [],
  44225. messageSends: []
  44226. }),
  44227. $globals.IRSendInliner);
  44228. $core.addMethod(
  44229. $core.method({
  44230. selector: "translator:",
  44231. protocol: "accessing",
  44232. fn: function (anASTTranslator){
  44233. var self=this,$self=this;
  44234. $self.translator=anASTTranslator;
  44235. return self;
  44236. },
  44237. args: ["anASTTranslator"],
  44238. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  44239. referencedClasses: [],
  44240. messageSends: []
  44241. }),
  44242. $globals.IRSendInliner);
  44243. $core.addMethod(
  44244. $core.method({
  44245. selector: "inlinedSelectors",
  44246. protocol: "accessing",
  44247. fn: function (){
  44248. var self=this,$self=this;
  44249. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  44250. },
  44251. args: [],
  44252. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  44253. referencedClasses: [],
  44254. messageSends: []
  44255. }),
  44256. $globals.IRSendInliner.a$cls);
  44257. $core.addMethod(
  44258. $core.method({
  44259. selector: "shouldInline:",
  44260. protocol: "accessing",
  44261. fn: function (anIRSend){
  44262. var self=this,$self=this;
  44263. return $core.withContext(function($ctx1) {
  44264. var $1;
  44265. $1=$recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  44266. if(!$core.assert($1)){
  44267. return false;
  44268. }
  44269. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  44270. return $core.withContext(function($ctx2) {
  44271. return $recv(each)._isClosure();
  44272. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44273. }));
  44274. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.a$cls)});
  44275. },
  44276. args: ["anIRSend"],
  44277. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  44278. referencedClasses: [],
  44279. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  44280. }),
  44281. $globals.IRSendInliner.a$cls);
  44282. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  44283. $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};";
  44284. $core.addMethod(
  44285. $core.method({
  44286. selector: "inlineAssignment:",
  44287. protocol: "inlining",
  44288. fn: function (anIRAssignment){
  44289. var self=this,$self=this;
  44290. return $core.withContext(function($ctx1) {
  44291. $self._target_($recv(anIRAssignment)._left());
  44292. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  44293. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  44294. },
  44295. args: ["anIRAssignment"],
  44296. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  44297. referencedClasses: [],
  44298. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  44299. }),
  44300. $globals.IRAssignmentInliner);
  44301. $core.addMethod(
  44302. $core.method({
  44303. selector: "inlineClosure:",
  44304. protocol: "inlining",
  44305. fn: function (anIRClosure){
  44306. var self=this,$self=this;
  44307. var closure,sequence,statements;
  44308. return $core.withContext(function($ctx1) {
  44309. var $1,$2,$3,$5,$4;
  44310. closure=(
  44311. $ctx1.supercall = true,
  44312. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  44313. $ctx1.supercall = false;
  44314. sequence=$recv(closure)._sequence();
  44315. statements=$recv(sequence)._dagChildren();
  44316. $recv(statements)._ifNotEmpty_((function(){
  44317. var final;
  44318. return $core.withContext(function($ctx2) {
  44319. final=$recv(statements)._last();
  44320. $1=$recv(final)._yieldsValue();
  44321. if($core.assert($1)){
  44322. $2=sequence;
  44323. $3=final;
  44324. $5=$recv($globals.IRAssignment)._new();
  44325. $recv($5)._add_($self._target());
  44326. $ctx2.sendIdx["add:"]=1;
  44327. $recv($5)._add_($recv(final)._copy());
  44328. $4=$recv($5)._yourself();
  44329. return $recv($2)._replace_with_($3,$4);
  44330. }
  44331. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44332. }));
  44333. return closure;
  44334. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  44335. },
  44336. args: ["anIRClosure"],
  44337. 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",
  44338. referencedClasses: ["IRAssignment"],
  44339. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  44340. }),
  44341. $globals.IRAssignmentInliner);
  44342. $core.addMethod(
  44343. $core.method({
  44344. selector: "target",
  44345. protocol: "accessing",
  44346. fn: function (){
  44347. var self=this,$self=this;
  44348. return $self.target;
  44349. },
  44350. args: [],
  44351. source: "target\x0a\x09^ target",
  44352. referencedClasses: [],
  44353. messageSends: []
  44354. }),
  44355. $globals.IRAssignmentInliner);
  44356. $core.addMethod(
  44357. $core.method({
  44358. selector: "target:",
  44359. protocol: "accessing",
  44360. fn: function (anObject){
  44361. var self=this,$self=this;
  44362. $self.target=anObject;
  44363. return self;
  44364. },
  44365. args: ["anObject"],
  44366. source: "target: anObject\x0a\x09target := anObject",
  44367. referencedClasses: [],
  44368. messageSends: []
  44369. }),
  44370. $globals.IRAssignmentInliner);
  44371. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  44372. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  44373. $core.addMethod(
  44374. $core.method({
  44375. selector: "inlineClosure:",
  44376. protocol: "inlining",
  44377. fn: function (anIRClosure){
  44378. var self=this,$self=this;
  44379. var closure,sequence,statements;
  44380. return $core.withContext(function($ctx1) {
  44381. var $1,$2,$3,$5,$4;
  44382. closure=(
  44383. $ctx1.supercall = true,
  44384. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  44385. $ctx1.supercall = false;
  44386. sequence=$recv(closure)._sequence();
  44387. statements=$recv(sequence)._dagChildren();
  44388. $recv(statements)._ifNotEmpty_((function(){
  44389. var final;
  44390. return $core.withContext(function($ctx2) {
  44391. final=$recv(statements)._last();
  44392. $1=$recv(final)._yieldsValue();
  44393. if($core.assert($1)){
  44394. $2=sequence;
  44395. $3=final;
  44396. $5=$recv($globals.IRReturn)._new();
  44397. $recv($5)._add_($recv(final)._copy());
  44398. $4=$recv($5)._yourself();
  44399. return $recv($2)._replace_with_($3,$4);
  44400. }
  44401. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44402. }));
  44403. return closure;
  44404. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  44405. },
  44406. args: ["anIRClosure"],
  44407. 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",
  44408. referencedClasses: ["IRReturn"],
  44409. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  44410. }),
  44411. $globals.IRReturnInliner);
  44412. $core.addMethod(
  44413. $core.method({
  44414. selector: "inlineReturn:",
  44415. protocol: "inlining",
  44416. fn: function (anIRReturn){
  44417. var self=this,$self=this;
  44418. return $core.withContext(function($ctx1) {
  44419. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  44420. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  44421. },
  44422. args: ["anIRReturn"],
  44423. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  44424. referencedClasses: [],
  44425. messageSends: ["inlineSend:andReplace:", "expression"]
  44426. }),
  44427. $globals.IRReturnInliner);
  44428. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  44429. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  44430. $core.addMethod(
  44431. $core.method({
  44432. selector: "inliner",
  44433. protocol: "compiling",
  44434. fn: function (){
  44435. var self=this,$self=this;
  44436. return $core.withContext(function($ctx1) {
  44437. return $recv($globals.IRInliner)._new();
  44438. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  44439. },
  44440. args: [],
  44441. source: "inliner\x0a\x09^ IRInliner new",
  44442. referencedClasses: ["IRInliner"],
  44443. messageSends: ["new"]
  44444. }),
  44445. $globals.InliningCodeGenerator);
  44446. $core.addMethod(
  44447. $core.method({
  44448. selector: "irTranslatorClass",
  44449. protocol: "compiling",
  44450. fn: function (){
  44451. var self=this,$self=this;
  44452. return $globals.IRInliningJSTranslator;
  44453. },
  44454. args: [],
  44455. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  44456. referencedClasses: ["IRInliningJSTranslator"],
  44457. messageSends: []
  44458. }),
  44459. $globals.InliningCodeGenerator);
  44460. $core.addMethod(
  44461. $core.method({
  44462. selector: "preInliner",
  44463. protocol: "compiling",
  44464. fn: function (){
  44465. var self=this,$self=this;
  44466. return $core.withContext(function($ctx1) {
  44467. return $recv($globals.ASTPreInliner)._new();
  44468. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  44469. },
  44470. args: [],
  44471. source: "preInliner\x0a\x09^ ASTPreInliner new",
  44472. referencedClasses: ["ASTPreInliner"],
  44473. messageSends: ["new"]
  44474. }),
  44475. $globals.InliningCodeGenerator);
  44476. $core.addMethod(
  44477. $core.method({
  44478. selector: "transformersDictionary",
  44479. protocol: "compiling",
  44480. fn: function (){
  44481. var self=this,$self=this;
  44482. return $core.withContext(function($ctx1) {
  44483. var $1,$2,$receiver;
  44484. $1=$self.transformersDictionary;
  44485. if(($receiver = $1) == null || $receiver.a$nil){
  44486. $2=(
  44487. $ctx1.supercall = true,
  44488. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($self, []));
  44489. $ctx1.supercall = false;
  44490. $recv($2)._at_put_("3000-inlinerTagging",$self._preInliner());
  44491. $ctx1.sendIdx["at:put:"]=1;
  44492. $recv($2)._at_put_("6000-inliner",$self._inliner());
  44493. $ctx1.sendIdx["at:put:"]=2;
  44494. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  44495. $self.transformersDictionary=$recv($2)._yourself();
  44496. return $self.transformersDictionary;
  44497. } else {
  44498. return $1;
  44499. }
  44500. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  44501. },
  44502. args: [],
  44503. 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 ]",
  44504. referencedClasses: [],
  44505. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  44506. }),
  44507. $globals.InliningCodeGenerator);
  44508. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  44509. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  44510. $core.addClass("InliningSemanticAnalyzer", $globals.SemanticAnalyzer, [], "Compiler-Inlining");
  44511. $core.addMethod(
  44512. $core.method({
  44513. selector: "visitSendNode:",
  44514. protocol: "visiting",
  44515. fn: function (aNode){
  44516. var self=this,$self=this;
  44517. return $core.withContext(function($ctx1) {
  44518. var $1,$2,$3,$receiver;
  44519. $1=$recv(aNode)._superSend();
  44520. if(!$core.assert($1)){
  44521. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  44522. if($core.assert($2)){
  44523. $recv(aNode)._shouldBeInlined_(true);
  44524. $3=$recv(aNode)._receiver();
  44525. if(($receiver = $3) == null || $receiver.a$nil){
  44526. $3;
  44527. } else {
  44528. var receiver;
  44529. receiver=$receiver;
  44530. $recv(receiver)._shouldBeAliased_(true);
  44531. }
  44532. }
  44533. }
  44534. (
  44535. $ctx1.supercall = true,
  44536. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  44537. $ctx1.supercall = false;
  44538. return self;
  44539. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  44540. },
  44541. args: ["aNode"],
  44542. 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",
  44543. referencedClasses: ["IRSendInliner"],
  44544. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  44545. }),
  44546. $globals.InliningSemanticAnalyzer);
  44547. $core.addMethod(
  44548. $core.method({
  44549. selector: "asInlinedBlockResult",
  44550. protocol: "*Compiler-Inlining",
  44551. fn: function (){
  44552. var self=this,$self=this;
  44553. return $core.withContext(function($ctx1) {
  44554. return $self._expression();
  44555. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  44556. },
  44557. args: [],
  44558. source: "asInlinedBlockResult\x0a\x09^ self expression",
  44559. referencedClasses: [],
  44560. messageSends: ["expression"]
  44561. }),
  44562. $globals.IRBlockReturn);
  44563. $core.addMethod(
  44564. $core.method({
  44565. selector: "asInlinedBlockResult",
  44566. protocol: "*Compiler-Inlining",
  44567. fn: function (){
  44568. var self=this,$self=this;
  44569. return self;
  44570. },
  44571. args: [],
  44572. source: "asInlinedBlockResult\x0a\x09^ self",
  44573. referencedClasses: [],
  44574. messageSends: []
  44575. }),
  44576. $globals.IRInstruction);
  44577. });
  44578. define('amber/core/Compiler-Interpreter',["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Compiler-Semantic", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Methods", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  44579. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  44580. var $pkg = $core.addPackage("Compiler-Interpreter");
  44581. $pkg.innerEval = function (expr) { return eval(expr); };
  44582. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  44583. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  44584. $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`).";
  44585. $core.addMethod(
  44586. $core.method({
  44587. selector: "applyTo:arguments:",
  44588. protocol: "evaluating",
  44589. fn: function (anObject,aCollection){
  44590. var self=this,$self=this;
  44591. return $core.withContext(function($ctx1) {
  44592. $self._interpreterError();
  44593. return self;
  44594. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  44595. },
  44596. args: ["anObject", "aCollection"],
  44597. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  44598. referencedClasses: [],
  44599. messageSends: ["interpreterError"]
  44600. }),
  44601. $globals.AIBlockClosure);
  44602. $core.addMethod(
  44603. $core.method({
  44604. selector: "compiledSource",
  44605. protocol: "accessing",
  44606. fn: function (){
  44607. var self=this,$self=this;
  44608. return "[ AST Block closure ]";
  44609. },
  44610. args: [],
  44611. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  44612. referencedClasses: [],
  44613. messageSends: []
  44614. }),
  44615. $globals.AIBlockClosure);
  44616. $core.addMethod(
  44617. $core.method({
  44618. selector: "currySelf",
  44619. protocol: "converting",
  44620. fn: function (){
  44621. var self=this,$self=this;
  44622. return $core.withContext(function($ctx1) {
  44623. $self._interpreterError();
  44624. return self;
  44625. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  44626. },
  44627. args: [],
  44628. source: "currySelf\x0a\x09self interpreterError",
  44629. referencedClasses: [],
  44630. messageSends: ["interpreterError"]
  44631. }),
  44632. $globals.AIBlockClosure);
  44633. $core.addMethod(
  44634. $core.method({
  44635. selector: "initializeWithContext:node:",
  44636. protocol: "initialization",
  44637. fn: function (aContext,aNode){
  44638. var self=this,$self=this;
  44639. $self.node=aNode;
  44640. $self.outerContext=aContext;
  44641. return self;
  44642. },
  44643. args: ["aContext", "aNode"],
  44644. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  44645. referencedClasses: [],
  44646. messageSends: []
  44647. }),
  44648. $globals.AIBlockClosure);
  44649. $core.addMethod(
  44650. $core.method({
  44651. selector: "interpreterError",
  44652. protocol: "error handling",
  44653. fn: function (){
  44654. var self=this,$self=this;
  44655. return $core.withContext(function($ctx1) {
  44656. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  44657. return self;
  44658. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  44659. },
  44660. args: [],
  44661. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  44662. referencedClasses: ["ASTInterpreterError"],
  44663. messageSends: ["signal:"]
  44664. }),
  44665. $globals.AIBlockClosure);
  44666. $core.addMethod(
  44667. $core.method({
  44668. selector: "numArgs",
  44669. protocol: "accessing",
  44670. fn: function (){
  44671. var self=this,$self=this;
  44672. return $core.withContext(function($ctx1) {
  44673. return $recv($recv($self.node)._temps())._size();
  44674. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  44675. },
  44676. args: [],
  44677. source: "numArgs\x0a\x09^ node temps size",
  44678. referencedClasses: [],
  44679. messageSends: ["size", "temps"]
  44680. }),
  44681. $globals.AIBlockClosure);
  44682. $core.addMethod(
  44683. $core.method({
  44684. selector: "value",
  44685. protocol: "evaluating",
  44686. fn: function (){
  44687. var self=this,$self=this;
  44688. return $core.withContext(function($ctx1) {
  44689. return $self._valueWithPossibleArguments_([]);
  44690. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  44691. },
  44692. args: [],
  44693. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  44694. referencedClasses: [],
  44695. messageSends: ["valueWithPossibleArguments:"]
  44696. }),
  44697. $globals.AIBlockClosure);
  44698. $core.addMethod(
  44699. $core.method({
  44700. selector: "value:",
  44701. protocol: "evaluating",
  44702. fn: function (anArgument){
  44703. var self=this,$self=this;
  44704. return $core.withContext(function($ctx1) {
  44705. return $self._valueWithPossibleArguments_([anArgument]);
  44706. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  44707. },
  44708. args: ["anArgument"],
  44709. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  44710. referencedClasses: [],
  44711. messageSends: ["valueWithPossibleArguments:"]
  44712. }),
  44713. $globals.AIBlockClosure);
  44714. $core.addMethod(
  44715. $core.method({
  44716. selector: "value:value:",
  44717. protocol: "evaluating",
  44718. fn: function (firstArgument,secondArgument){
  44719. var self=this,$self=this;
  44720. return $core.withContext(function($ctx1) {
  44721. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  44722. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  44723. },
  44724. args: ["firstArgument", "secondArgument"],
  44725. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  44726. referencedClasses: [],
  44727. messageSends: ["valueWithPossibleArguments:"]
  44728. }),
  44729. $globals.AIBlockClosure);
  44730. $core.addMethod(
  44731. $core.method({
  44732. selector: "value:value:value:",
  44733. protocol: "evaluating",
  44734. fn: function (firstArgument,secondArgument,thirdArgument){
  44735. var self=this,$self=this;
  44736. return $core.withContext(function($ctx1) {
  44737. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  44738. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  44739. },
  44740. args: ["firstArgument", "secondArgument", "thirdArgument"],
  44741. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  44742. referencedClasses: [],
  44743. messageSends: ["valueWithPossibleArguments:"]
  44744. }),
  44745. $globals.AIBlockClosure);
  44746. $core.addMethod(
  44747. $core.method({
  44748. selector: "valueWithPossibleArguments:",
  44749. protocol: "evaluating",
  44750. fn: function (aCollection){
  44751. var self=this,$self=this;
  44752. var context,sequenceNode;
  44753. return $core.withContext(function($ctx1) {
  44754. var $1,$2,$3;
  44755. context=$recv($self.outerContext)._newInnerContext();
  44756. $1=$recv($recv($recv($self.node)._dagChildren())._first())._copy();
  44757. $recv($1)._parent_(nil);
  44758. sequenceNode=$recv($1)._yourself();
  44759. $recv($recv(sequenceNode)._temps())._do_((function(each){
  44760. return $core.withContext(function($ctx2) {
  44761. return $recv(context)._defineLocal_(each);
  44762. $ctx2.sendIdx["defineLocal:"]=1;
  44763. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44764. }));
  44765. $recv($recv($self.node)._parameters())._withIndexDo_((function(each,index){
  44766. return $core.withContext(function($ctx2) {
  44767. $recv(context)._defineLocal_(each);
  44768. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  44769. return nil;
  44770. })));
  44771. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  44772. }));
  44773. $2=$recv(context)._interpreter();
  44774. $ctx1.sendIdx["interpreter"]=1;
  44775. $recv($2)._node_(sequenceNode);
  44776. $recv($2)._enterNode();
  44777. $recv($2)._proceed();
  44778. $3=$recv($self.outerContext)._interpreter();
  44779. $ctx1.sendIdx["interpreter"]=2;
  44780. $recv($3)._setNonLocalReturnFromContext_(context);
  44781. return $recv($recv(context)._interpreter())._pop();
  44782. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  44783. },
  44784. args: ["aCollection"],
  44785. 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",
  44786. referencedClasses: [],
  44787. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  44788. }),
  44789. $globals.AIBlockClosure);
  44790. $core.addMethod(
  44791. $core.method({
  44792. selector: "forContext:node:",
  44793. protocol: "instance creation",
  44794. fn: function (aContext,aNode){
  44795. var self=this,$self=this;
  44796. return $core.withContext(function($ctx1) {
  44797. var $1;
  44798. $1=$self._new();
  44799. $recv($1)._initializeWithContext_node_(aContext,aNode);
  44800. return $recv($1)._yourself();
  44801. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.a$cls)});
  44802. },
  44803. args: ["aContext", "aNode"],
  44804. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  44805. referencedClasses: [],
  44806. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  44807. }),
  44808. $globals.AIBlockClosure.a$cls);
  44809. $core.addClass("AIContext", $globals.Object, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  44810. $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)";
  44811. $core.addMethod(
  44812. $core.method({
  44813. selector: "arguments",
  44814. protocol: "interpreting",
  44815. fn: function (){
  44816. var self=this,$self=this;
  44817. return $core.withContext(function($ctx1) {
  44818. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  44819. return $core.withContext(function($ctx2) {
  44820. return $self._localAt_ifAbsent_(each,(function(){
  44821. return $core.withContext(function($ctx3) {
  44822. return $self._error_("Argument not in context");
  44823. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44824. }));
  44825. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44826. }));
  44827. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  44828. },
  44829. args: [],
  44830. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  44831. referencedClasses: [],
  44832. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  44833. }),
  44834. $globals.AIContext);
  44835. $core.addMethod(
  44836. $core.method({
  44837. selector: "ast",
  44838. protocol: "interpreting",
  44839. fn: function (){
  44840. var self=this,$self=this;
  44841. return $core.withContext(function($ctx1) {
  44842. var $1,$2,$3,$receiver;
  44843. $1=$self._isBlockContext();
  44844. if($core.assert($1)){
  44845. $2=$self._outerContext();
  44846. if(($receiver = $2) == null || $receiver.a$nil){
  44847. return $2;
  44848. } else {
  44849. var context;
  44850. context=$receiver;
  44851. return $recv(context)._ast();
  44852. }
  44853. }
  44854. $3=$self.ast;
  44855. if(($receiver = $3) == null || $receiver.a$nil){
  44856. $self._initializeAST();
  44857. } else {
  44858. $3;
  44859. }
  44860. return $self.ast;
  44861. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  44862. },
  44863. args: [],
  44864. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  44865. referencedClasses: [],
  44866. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  44867. }),
  44868. $globals.AIContext);
  44869. $core.addMethod(
  44870. $core.method({
  44871. selector: "basicLocalAt:",
  44872. protocol: "private",
  44873. fn: function (aString){
  44874. var self=this,$self=this;
  44875. return $core.withContext(function($ctx1) {
  44876. return $recv($self._locals())._at_(aString);
  44877. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  44878. },
  44879. args: ["aString"],
  44880. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  44881. referencedClasses: [],
  44882. messageSends: ["at:", "locals"]
  44883. }),
  44884. $globals.AIContext);
  44885. $core.addMethod(
  44886. $core.method({
  44887. selector: "basicLocalAt:put:",
  44888. protocol: "private",
  44889. fn: function (aString,anObject){
  44890. var self=this,$self=this;
  44891. return $core.withContext(function($ctx1) {
  44892. $recv($self._locals())._at_put_(aString,anObject);
  44893. return self;
  44894. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  44895. },
  44896. args: ["aString", "anObject"],
  44897. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  44898. referencedClasses: [],
  44899. messageSends: ["at:put:", "locals"]
  44900. }),
  44901. $globals.AIContext);
  44902. $core.addMethod(
  44903. $core.method({
  44904. selector: "basicReceiver",
  44905. protocol: "interpreting",
  44906. fn: function (){
  44907. var self=this,$self=this;
  44908. return $core.withContext(function($ctx1) {
  44909. return $self._localAt_("self");
  44910. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  44911. },
  44912. args: [],
  44913. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  44914. referencedClasses: [],
  44915. messageSends: ["localAt:"]
  44916. }),
  44917. $globals.AIContext);
  44918. $core.addMethod(
  44919. $core.method({
  44920. selector: "defineLocal:",
  44921. protocol: "accessing",
  44922. fn: function (aString){
  44923. var self=this,$self=this;
  44924. return $core.withContext(function($ctx1) {
  44925. $recv($self._locals())._at_put_(aString,nil);
  44926. return self;
  44927. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  44928. },
  44929. args: ["aString"],
  44930. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  44931. referencedClasses: [],
  44932. messageSends: ["at:put:", "locals"]
  44933. }),
  44934. $globals.AIContext);
  44935. $core.addMethod(
  44936. $core.method({
  44937. selector: "evaluate:on:",
  44938. protocol: "evaluating",
  44939. fn: function (aString,anEvaluator){
  44940. var self=this,$self=this;
  44941. return $core.withContext(function($ctx1) {
  44942. return $recv(anEvaluator)._evaluate_context_(aString,self);
  44943. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  44944. },
  44945. args: ["aString", "anEvaluator"],
  44946. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  44947. referencedClasses: [],
  44948. messageSends: ["evaluate:context:"]
  44949. }),
  44950. $globals.AIContext);
  44951. $core.addMethod(
  44952. $core.method({
  44953. selector: "evaluateNode:",
  44954. protocol: "evaluating",
  44955. fn: function (aNode){
  44956. var self=this,$self=this;
  44957. return $core.withContext(function($ctx1) {
  44958. var $1;
  44959. $1=$recv($globals.ASTInterpreter)._new();
  44960. $recv($1)._context_(self);
  44961. $recv($1)._node_(aNode);
  44962. $recv($1)._enterNode();
  44963. $recv($1)._proceed();
  44964. return $recv($1)._result();
  44965. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  44966. },
  44967. args: ["aNode"],
  44968. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  44969. referencedClasses: ["ASTInterpreter"],
  44970. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  44971. }),
  44972. $globals.AIContext);
  44973. $core.addMethod(
  44974. $core.method({
  44975. selector: "evaluatedSelector",
  44976. protocol: "accessing",
  44977. fn: function (){
  44978. var self=this,$self=this;
  44979. return $self.evaluatedSelector;
  44980. },
  44981. args: [],
  44982. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  44983. referencedClasses: [],
  44984. messageSends: []
  44985. }),
  44986. $globals.AIContext);
  44987. $core.addMethod(
  44988. $core.method({
  44989. selector: "evaluatedSelector:",
  44990. protocol: "accessing",
  44991. fn: function (aString){
  44992. var self=this,$self=this;
  44993. $self.evaluatedSelector=aString;
  44994. return self;
  44995. },
  44996. args: ["aString"],
  44997. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  44998. referencedClasses: [],
  44999. messageSends: []
  45000. }),
  45001. $globals.AIContext);
  45002. $core.addMethod(
  45003. $core.method({
  45004. selector: "index",
  45005. protocol: "accessing",
  45006. fn: function (){
  45007. var self=this,$self=this;
  45008. return $core.withContext(function($ctx1) {
  45009. var $1,$receiver;
  45010. $1=$self.index;
  45011. if(($receiver = $1) == null || $receiver.a$nil){
  45012. return (0);
  45013. } else {
  45014. return $1;
  45015. }
  45016. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  45017. },
  45018. args: [],
  45019. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  45020. referencedClasses: [],
  45021. messageSends: ["ifNil:"]
  45022. }),
  45023. $globals.AIContext);
  45024. $core.addMethod(
  45025. $core.method({
  45026. selector: "index:",
  45027. protocol: "accessing",
  45028. fn: function (anInteger){
  45029. var self=this,$self=this;
  45030. $self.index=anInteger;
  45031. return self;
  45032. },
  45033. args: ["anInteger"],
  45034. source: "index: anInteger\x0a\x09index := anInteger",
  45035. referencedClasses: [],
  45036. messageSends: []
  45037. }),
  45038. $globals.AIContext);
  45039. $core.addMethod(
  45040. $core.method({
  45041. selector: "initializeAST",
  45042. protocol: "initialization",
  45043. fn: function (){
  45044. var self=this,$self=this;
  45045. return $core.withContext(function($ctx1) {
  45046. var $1;
  45047. $1=$self._method();
  45048. $ctx1.sendIdx["method"]=1;
  45049. $self.ast=$recv($1)._ast();
  45050. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._methodClass()))._visit_($self.ast);
  45051. return self;
  45052. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  45053. },
  45054. args: [],
  45055. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  45056. referencedClasses: ["SemanticAnalyzer"],
  45057. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  45058. }),
  45059. $globals.AIContext);
  45060. $core.addMethod(
  45061. $core.method({
  45062. selector: "initializeFromMethodContext:",
  45063. protocol: "initialization",
  45064. fn: function (aMethodContext){
  45065. var self=this,$self=this;
  45066. return $core.withContext(function($ctx1) {
  45067. var $1,$2,$3,$receiver;
  45068. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  45069. $self._index_($recv(aMethodContext)._index());
  45070. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  45071. $self._receiver_($recv(aMethodContext)._receiver());
  45072. $self._supercall_($recv(aMethodContext)._supercall());
  45073. $self._selector_($recv(aMethodContext)._selector());
  45074. $1=$recv(aMethodContext)._outerContext();
  45075. $ctx1.sendIdx["outerContext"]=1;
  45076. if(($receiver = $1) == null || $receiver.a$nil){
  45077. $1;
  45078. } else {
  45079. var outer;
  45080. outer=$receiver;
  45081. $2=$recv(outer)._methodContext();
  45082. if(($receiver = $2) == null || $receiver.a$nil){
  45083. $2;
  45084. } else {
  45085. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  45086. }
  45087. $3=$recv(aMethodContext)._locals();
  45088. $ctx1.sendIdx["locals"]=1;
  45089. $recv($3)._keysAndValuesDo_((function(key,value){
  45090. return $core.withContext(function($ctx2) {
  45091. return $recv($self._locals())._at_put_(key,value);
  45092. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  45093. }));
  45094. }
  45095. return self;
  45096. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  45097. },
  45098. args: ["aMethodContext"],
  45099. 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 ] ]",
  45100. referencedClasses: [],
  45101. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  45102. }),
  45103. $globals.AIContext);
  45104. $core.addMethod(
  45105. $core.method({
  45106. selector: "initializeInterpreter",
  45107. protocol: "initialization",
  45108. fn: function (){
  45109. var self=this,$self=this;
  45110. return $core.withContext(function($ctx1) {
  45111. var $1,$2,$receiver;
  45112. $1=$recv($globals.ASTInterpreter)._new();
  45113. $recv($1)._context_(self);
  45114. $self.interpreter=$recv($1)._yourself();
  45115. $2=$self._innerContext();
  45116. if(($receiver = $2) == null || $receiver.a$nil){
  45117. $2;
  45118. } else {
  45119. $self._setupInterpreter_($self.interpreter);
  45120. }
  45121. return self;
  45122. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  45123. },
  45124. args: [],
  45125. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  45126. referencedClasses: ["ASTInterpreter"],
  45127. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  45128. }),
  45129. $globals.AIContext);
  45130. $core.addMethod(
  45131. $core.method({
  45132. selector: "initializeLocals",
  45133. protocol: "initialization",
  45134. fn: function (){
  45135. var self=this,$self=this;
  45136. return $core.withContext(function($ctx1) {
  45137. $self.locals=$recv($globals.Dictionary)._new();
  45138. $recv($self.locals)._at_put_("thisContext",self);
  45139. return self;
  45140. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  45141. },
  45142. args: [],
  45143. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  45144. referencedClasses: ["Dictionary"],
  45145. messageSends: ["new", "at:put:"]
  45146. }),
  45147. $globals.AIContext);
  45148. $core.addMethod(
  45149. $core.method({
  45150. selector: "innerContext",
  45151. protocol: "accessing",
  45152. fn: function (){
  45153. var self=this,$self=this;
  45154. return $self.innerContext;
  45155. },
  45156. args: [],
  45157. source: "innerContext\x0a\x09^ innerContext",
  45158. referencedClasses: [],
  45159. messageSends: []
  45160. }),
  45161. $globals.AIContext);
  45162. $core.addMethod(
  45163. $core.method({
  45164. selector: "innerContext:",
  45165. protocol: "accessing",
  45166. fn: function (anAIContext){
  45167. var self=this,$self=this;
  45168. $self.innerContext=anAIContext;
  45169. return self;
  45170. },
  45171. args: ["anAIContext"],
  45172. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  45173. referencedClasses: [],
  45174. messageSends: []
  45175. }),
  45176. $globals.AIContext);
  45177. $core.addMethod(
  45178. $core.method({
  45179. selector: "interpreter",
  45180. protocol: "interpreting",
  45181. fn: function (){
  45182. var self=this,$self=this;
  45183. return $core.withContext(function($ctx1) {
  45184. var $1,$receiver;
  45185. $1=$self.interpreter;
  45186. if(($receiver = $1) == null || $receiver.a$nil){
  45187. $self._initializeInterpreter();
  45188. } else {
  45189. $1;
  45190. }
  45191. return $self.interpreter;
  45192. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  45193. },
  45194. args: [],
  45195. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  45196. referencedClasses: [],
  45197. messageSends: ["ifNil:", "initializeInterpreter"]
  45198. }),
  45199. $globals.AIContext);
  45200. $core.addMethod(
  45201. $core.method({
  45202. selector: "interpreter:",
  45203. protocol: "interpreting",
  45204. fn: function (anInterpreter){
  45205. var self=this,$self=this;
  45206. $self.interpreter=anInterpreter;
  45207. return self;
  45208. },
  45209. args: ["anInterpreter"],
  45210. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  45211. referencedClasses: [],
  45212. messageSends: []
  45213. }),
  45214. $globals.AIContext);
  45215. $core.addMethod(
  45216. $core.method({
  45217. selector: "isTopContext",
  45218. protocol: "testing",
  45219. fn: function (){
  45220. var self=this,$self=this;
  45221. return $core.withContext(function($ctx1) {
  45222. return $recv($self._innerContext())._isNil();
  45223. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  45224. },
  45225. args: [],
  45226. source: "isTopContext\x0a\x09^ self innerContext isNil",
  45227. referencedClasses: [],
  45228. messageSends: ["isNil", "innerContext"]
  45229. }),
  45230. $globals.AIContext);
  45231. $core.addMethod(
  45232. $core.method({
  45233. selector: "localAt:",
  45234. protocol: "accessing",
  45235. fn: function (aString){
  45236. var self=this,$self=this;
  45237. var context;
  45238. return $core.withContext(function($ctx1) {
  45239. context=$self._lookupContextForLocal_(aString);
  45240. return $recv(context)._basicLocalAt_(aString);
  45241. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  45242. },
  45243. args: ["aString"],
  45244. 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",
  45245. referencedClasses: [],
  45246. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  45247. }),
  45248. $globals.AIContext);
  45249. $core.addMethod(
  45250. $core.method({
  45251. selector: "localAt:ifAbsent:",
  45252. protocol: "accessing",
  45253. fn: function (aString,aBlock){
  45254. var self=this,$self=this;
  45255. var context;
  45256. return $core.withContext(function($ctx1) {
  45257. var $early={};
  45258. try {
  45259. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  45260. return $core.withContext(function($ctx2) {
  45261. throw $early=[$recv(aBlock)._value()];
  45262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45263. }));
  45264. return $recv(context)._basicLocalAt_(aString);
  45265. }
  45266. catch(e) {if(e===$early)return e[0]; throw e}
  45267. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  45268. },
  45269. args: ["aString", "aBlock"],
  45270. 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",
  45271. referencedClasses: [],
  45272. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  45273. }),
  45274. $globals.AIContext);
  45275. $core.addMethod(
  45276. $core.method({
  45277. selector: "localAt:put:",
  45278. protocol: "accessing",
  45279. fn: function (aString,anObject){
  45280. var self=this,$self=this;
  45281. var context;
  45282. return $core.withContext(function($ctx1) {
  45283. context=$self._lookupContextForLocal_(aString);
  45284. $recv(context)._basicLocalAt_put_(aString,anObject);
  45285. return self;
  45286. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  45287. },
  45288. args: ["aString", "anObject"],
  45289. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  45290. referencedClasses: [],
  45291. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  45292. }),
  45293. $globals.AIContext);
  45294. $core.addMethod(
  45295. $core.method({
  45296. selector: "locals",
  45297. protocol: "accessing",
  45298. fn: function (){
  45299. var self=this,$self=this;
  45300. return $core.withContext(function($ctx1) {
  45301. var $1,$receiver;
  45302. $1=$self.locals;
  45303. if(($receiver = $1) == null || $receiver.a$nil){
  45304. $self._initializeLocals();
  45305. } else {
  45306. $1;
  45307. }
  45308. return $self.locals;
  45309. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  45310. },
  45311. args: [],
  45312. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  45313. referencedClasses: [],
  45314. messageSends: ["ifNil:", "initializeLocals"]
  45315. }),
  45316. $globals.AIContext);
  45317. $core.addMethod(
  45318. $core.method({
  45319. selector: "lookupContextForLocal:",
  45320. protocol: "private",
  45321. fn: function (aString){
  45322. var self=this,$self=this;
  45323. return $core.withContext(function($ctx1) {
  45324. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  45325. return $core.withContext(function($ctx2) {
  45326. return $self._variableNotFound();
  45327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45328. }));
  45329. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  45330. },
  45331. args: ["aString"],
  45332. 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 ]",
  45333. referencedClasses: [],
  45334. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  45335. }),
  45336. $globals.AIContext);
  45337. $core.addMethod(
  45338. $core.method({
  45339. selector: "lookupContextForLocal:ifNone:",
  45340. protocol: "private",
  45341. fn: function (aString,aBlock){
  45342. var self=this,$self=this;
  45343. return $core.withContext(function($ctx1) {
  45344. var $1;
  45345. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  45346. return self;
  45347. }),(function(){
  45348. return $core.withContext(function($ctx2) {
  45349. $1=$self._outerContext();
  45350. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  45351. return $core.withContext(function($ctx3) {
  45352. return $recv(context)._lookupContextForLocal_(aString);
  45353. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  45354. }));
  45355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45356. }));
  45357. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  45358. },
  45359. args: ["aString", "aBlock"],
  45360. 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 ] ]",
  45361. referencedClasses: [],
  45362. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  45363. }),
  45364. $globals.AIContext);
  45365. $core.addMethod(
  45366. $core.method({
  45367. selector: "newInnerContext",
  45368. protocol: "factory",
  45369. fn: function (){
  45370. var self=this,$self=this;
  45371. return $core.withContext(function($ctx1) {
  45372. var $1;
  45373. $1=$recv($self._class())._new();
  45374. $recv($1)._outerContext_(self);
  45375. return $recv($1)._yourself();
  45376. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  45377. },
  45378. args: [],
  45379. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  45380. referencedClasses: [],
  45381. messageSends: ["outerContext:", "new", "class", "yourself"]
  45382. }),
  45383. $globals.AIContext);
  45384. $core.addMethod(
  45385. $core.method({
  45386. selector: "outerContext",
  45387. protocol: "accessing",
  45388. fn: function (){
  45389. var self=this,$self=this;
  45390. return $self.outerContext;
  45391. },
  45392. args: [],
  45393. source: "outerContext\x0a\x09^ outerContext",
  45394. referencedClasses: [],
  45395. messageSends: []
  45396. }),
  45397. $globals.AIContext);
  45398. $core.addMethod(
  45399. $core.method({
  45400. selector: "outerContext:",
  45401. protocol: "accessing",
  45402. fn: function (anAIContext){
  45403. var self=this,$self=this;
  45404. return $core.withContext(function($ctx1) {
  45405. var $1,$receiver;
  45406. $self.outerContext=anAIContext;
  45407. $1=$self.outerContext;
  45408. if(($receiver = $1) == null || $receiver.a$nil){
  45409. $1;
  45410. } else {
  45411. var context;
  45412. context=$receiver;
  45413. $recv(context)._innerContext_(self);
  45414. }
  45415. return self;
  45416. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  45417. },
  45418. args: ["anAIContext"],
  45419. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  45420. referencedClasses: [],
  45421. messageSends: ["ifNotNil:", "innerContext:"]
  45422. }),
  45423. $globals.AIContext);
  45424. $core.addMethod(
  45425. $core.method({
  45426. selector: "receiver:",
  45427. protocol: "interpreting",
  45428. fn: function (anObject){
  45429. var self=this,$self=this;
  45430. return $core.withContext(function($ctx1) {
  45431. $recv($self._locals())._at_put_("self",anObject);
  45432. return self;
  45433. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  45434. },
  45435. args: ["anObject"],
  45436. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  45437. referencedClasses: [],
  45438. messageSends: ["at:put:", "locals"]
  45439. }),
  45440. $globals.AIContext);
  45441. $core.addMethod(
  45442. $core.method({
  45443. selector: "selector",
  45444. protocol: "accessing",
  45445. fn: function (){
  45446. var self=this,$self=this;
  45447. return $self.selector;
  45448. },
  45449. args: [],
  45450. source: "selector\x0a\x09^ selector",
  45451. referencedClasses: [],
  45452. messageSends: []
  45453. }),
  45454. $globals.AIContext);
  45455. $core.addMethod(
  45456. $core.method({
  45457. selector: "selector:",
  45458. protocol: "accessing",
  45459. fn: function (aString){
  45460. var self=this,$self=this;
  45461. $self.selector=aString;
  45462. return self;
  45463. },
  45464. args: ["aString"],
  45465. source: "selector: aString\x0a\x09selector := aString",
  45466. referencedClasses: [],
  45467. messageSends: []
  45468. }),
  45469. $globals.AIContext);
  45470. $core.addMethod(
  45471. $core.method({
  45472. selector: "sendIndexAt:",
  45473. protocol: "accessing",
  45474. fn: function (aString){
  45475. var self=this,$self=this;
  45476. return $core.withContext(function($ctx1) {
  45477. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  45478. return (0);
  45479. }));
  45480. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  45481. },
  45482. args: ["aString"],
  45483. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  45484. referencedClasses: [],
  45485. messageSends: ["at:ifAbsent:", "sendIndexes"]
  45486. }),
  45487. $globals.AIContext);
  45488. $core.addMethod(
  45489. $core.method({
  45490. selector: "sendIndexes",
  45491. protocol: "accessing",
  45492. fn: function (){
  45493. var self=this,$self=this;
  45494. return $core.withContext(function($ctx1) {
  45495. var $1,$receiver;
  45496. $1=$self.sendIndexes;
  45497. if(($receiver = $1) == null || $receiver.a$nil){
  45498. return $recv($globals.Dictionary)._new();
  45499. } else {
  45500. return $1;
  45501. }
  45502. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  45503. },
  45504. args: [],
  45505. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  45506. referencedClasses: ["Dictionary"],
  45507. messageSends: ["ifNil:", "new"]
  45508. }),
  45509. $globals.AIContext);
  45510. $core.addMethod(
  45511. $core.method({
  45512. selector: "sendIndexes:",
  45513. protocol: "accessing",
  45514. fn: function (aDictionary){
  45515. var self=this,$self=this;
  45516. $self.sendIndexes=aDictionary;
  45517. return self;
  45518. },
  45519. args: ["aDictionary"],
  45520. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  45521. referencedClasses: [],
  45522. messageSends: []
  45523. }),
  45524. $globals.AIContext);
  45525. $core.addMethod(
  45526. $core.method({
  45527. selector: "setupInterpreter:",
  45528. protocol: "interpreting",
  45529. fn: function (anInterpreter){
  45530. var self=this,$self=this;
  45531. var currentNode;
  45532. return $core.withContext(function($ctx1) {
  45533. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  45534. $1=$recv($globals.ASTPCNodeVisitor)._new();
  45535. $2=$self._evaluatedSelector();
  45536. $ctx1.sendIdx["evaluatedSelector"]=1;
  45537. $recv($1)._selector_($2);
  45538. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  45539. $3=$self._ast();
  45540. $ctx1.sendIdx["ast"]=1;
  45541. $recv($1)._visit_($3);
  45542. currentNode=$recv($1)._currentNode();
  45543. $4=$recv($self._ast())._sequenceNode();
  45544. if(($receiver = $4) == null || $receiver.a$nil){
  45545. $4;
  45546. } else {
  45547. var sequence;
  45548. sequence=$receiver;
  45549. $recv($recv(sequence)._temps())._do_((function(each){
  45550. return $core.withContext(function($ctx2) {
  45551. return $self._defineLocal_(each);
  45552. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45553. }));
  45554. $ctx1.sendIdx["do:"]=1;
  45555. }
  45556. $recv(anInterpreter)._node_(currentNode);
  45557. $7=$self._innerContext();
  45558. $ctx1.sendIdx["innerContext"]=1;
  45559. $6=$recv($7)._arguments();
  45560. $5=$recv($6)._reversed();
  45561. $recv($5)._do_((function(each){
  45562. return $core.withContext(function($ctx2) {
  45563. return $recv(anInterpreter)._push_(each);
  45564. $ctx2.sendIdx["push:"]=1;
  45565. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  45566. }));
  45567. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  45568. return self;
  45569. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  45570. },
  45571. args: ["anInterpreter"],
  45572. 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)",
  45573. referencedClasses: ["ASTPCNodeVisitor"],
  45574. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  45575. }),
  45576. $globals.AIContext);
  45577. $core.addMethod(
  45578. $core.method({
  45579. selector: "supercall",
  45580. protocol: "interpreting",
  45581. fn: function (){
  45582. var self=this,$self=this;
  45583. return $core.withContext(function($ctx1) {
  45584. var $1,$receiver;
  45585. $1=$self.supercall;
  45586. if(($receiver = $1) == null || $receiver.a$nil){
  45587. return false;
  45588. } else {
  45589. return $1;
  45590. }
  45591. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  45592. },
  45593. args: [],
  45594. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  45595. referencedClasses: [],
  45596. messageSends: ["ifNil:"]
  45597. }),
  45598. $globals.AIContext);
  45599. $core.addMethod(
  45600. $core.method({
  45601. selector: "supercall:",
  45602. protocol: "interpreting",
  45603. fn: function (aBoolean){
  45604. var self=this,$self=this;
  45605. $self.supercall=aBoolean;
  45606. return self;
  45607. },
  45608. args: ["aBoolean"],
  45609. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  45610. referencedClasses: [],
  45611. messageSends: []
  45612. }),
  45613. $globals.AIContext);
  45614. $core.addMethod(
  45615. $core.method({
  45616. selector: "variableNotFound",
  45617. protocol: "error handling",
  45618. fn: function (){
  45619. var self=this,$self=this;
  45620. return $core.withContext(function($ctx1) {
  45621. $self._error_("Variable missing");
  45622. return self;
  45623. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  45624. },
  45625. args: [],
  45626. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  45627. referencedClasses: [],
  45628. messageSends: ["error:"]
  45629. }),
  45630. $globals.AIContext);
  45631. $core.addMethod(
  45632. $core.method({
  45633. selector: "fromMethodContext:",
  45634. protocol: "instance creation",
  45635. fn: function (aMethodContext){
  45636. var self=this,$self=this;
  45637. return $core.withContext(function($ctx1) {
  45638. var $1;
  45639. $1=$self._new();
  45640. $recv($1)._initializeFromMethodContext_(aMethodContext);
  45641. return $recv($1)._yourself();
  45642. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.a$cls)});
  45643. },
  45644. args: ["aMethodContext"],
  45645. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  45646. referencedClasses: [],
  45647. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  45648. }),
  45649. $globals.AIContext.a$cls);
  45650. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  45651. $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.";
  45652. $core.addMethod(
  45653. $core.method({
  45654. selector: "context",
  45655. protocol: "accessing",
  45656. fn: function (){
  45657. var self=this,$self=this;
  45658. return $self.context;
  45659. },
  45660. args: [],
  45661. source: "context\x0a\x09^ context",
  45662. referencedClasses: [],
  45663. messageSends: []
  45664. }),
  45665. $globals.AISemanticAnalyzer);
  45666. $core.addMethod(
  45667. $core.method({
  45668. selector: "context:",
  45669. protocol: "accessing",
  45670. fn: function (anAIContext){
  45671. var self=this,$self=this;
  45672. $self.context=anAIContext;
  45673. return self;
  45674. },
  45675. args: ["anAIContext"],
  45676. source: "context: anAIContext\x0a\x09context := anAIContext",
  45677. referencedClasses: [],
  45678. messageSends: []
  45679. }),
  45680. $globals.AISemanticAnalyzer);
  45681. $core.addMethod(
  45682. $core.method({
  45683. selector: "visitVariableNode:",
  45684. protocol: "visiting",
  45685. fn: function (aNode){
  45686. var self=this,$self=this;
  45687. return $core.withContext(function($ctx1) {
  45688. var $1;
  45689. var $early={};
  45690. try {
  45691. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  45692. return $core.withContext(function($ctx2) {
  45693. $1=(
  45694. $ctx2.supercall = true,
  45695. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  45696. $ctx2.supercall = false;
  45697. throw $early=[$1];
  45698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45699. }));
  45700. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  45701. return self;
  45702. }
  45703. catch(e) {if(e===$early)return e[0]; throw e}
  45704. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  45705. },
  45706. args: ["aNode"],
  45707. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  45708. referencedClasses: ["ASTContextVar"],
  45709. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  45710. }),
  45711. $globals.AISemanticAnalyzer);
  45712. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  45713. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  45714. $core.addMethod(
  45715. $core.method({
  45716. selector: "context",
  45717. protocol: "accessing",
  45718. fn: function (){
  45719. var self=this,$self=this;
  45720. return $self.context;
  45721. },
  45722. args: [],
  45723. source: "context\x0a\x09^ context",
  45724. referencedClasses: [],
  45725. messageSends: []
  45726. }),
  45727. $globals.ASTContextVar);
  45728. $core.addMethod(
  45729. $core.method({
  45730. selector: "context:",
  45731. protocol: "accessing",
  45732. fn: function (anObject){
  45733. var self=this,$self=this;
  45734. $self.context=anObject;
  45735. return self;
  45736. },
  45737. args: ["anObject"],
  45738. source: "context: anObject\x0a\x09context := anObject",
  45739. referencedClasses: [],
  45740. messageSends: []
  45741. }),
  45742. $globals.ASTContextVar);
  45743. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  45744. $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.";
  45745. $core.addMethod(
  45746. $core.method({
  45747. selector: "atEnd",
  45748. protocol: "testing",
  45749. fn: function (){
  45750. var self=this,$self=this;
  45751. return $core.withContext(function($ctx1) {
  45752. var $1,$receiver;
  45753. $1=$self._context();
  45754. $ctx1.sendIdx["context"]=1;
  45755. if(($receiver = $1) == null || $receiver.a$nil){
  45756. return true;
  45757. } else {
  45758. $1;
  45759. }
  45760. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  45761. return $core.withContext(function($ctx2) {
  45762. return $recv($self._context())._isTopContext();
  45763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45764. }));
  45765. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  45766. },
  45767. args: [],
  45768. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  45769. referencedClasses: [],
  45770. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  45771. }),
  45772. $globals.ASTDebugger);
  45773. $core.addMethod(
  45774. $core.method({
  45775. selector: "context",
  45776. protocol: "accessing",
  45777. fn: function (){
  45778. var self=this,$self=this;
  45779. return $self.context;
  45780. },
  45781. args: [],
  45782. source: "context\x0a\x09^ context",
  45783. referencedClasses: [],
  45784. messageSends: []
  45785. }),
  45786. $globals.ASTDebugger);
  45787. $core.addMethod(
  45788. $core.method({
  45789. selector: "context:",
  45790. protocol: "accessing",
  45791. fn: function (aContext){
  45792. var self=this,$self=this;
  45793. $self.context=aContext;
  45794. return self;
  45795. },
  45796. args: ["aContext"],
  45797. source: "context: aContext\x0a\x09context := aContext",
  45798. referencedClasses: [],
  45799. messageSends: []
  45800. }),
  45801. $globals.ASTDebugger);
  45802. $core.addMethod(
  45803. $core.method({
  45804. selector: "flushInnerContexts",
  45805. protocol: "actions",
  45806. fn: function (){
  45807. var self=this,$self=this;
  45808. return $core.withContext(function($ctx1) {
  45809. var $1,$receiver;
  45810. $1=$self._context();
  45811. if(($receiver = $1) == null || $receiver.a$nil){
  45812. $1;
  45813. } else {
  45814. var cxt;
  45815. cxt=$receiver;
  45816. $recv(cxt)._innerContext_(nil);
  45817. }
  45818. return self;
  45819. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  45820. },
  45821. args: [],
  45822. 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 ]",
  45823. referencedClasses: [],
  45824. messageSends: ["ifNotNil:", "context", "innerContext:"]
  45825. }),
  45826. $globals.ASTDebugger);
  45827. $core.addMethod(
  45828. $core.method({
  45829. selector: "interpreter",
  45830. protocol: "accessing",
  45831. fn: function (){
  45832. var self=this,$self=this;
  45833. return $core.withContext(function($ctx1) {
  45834. var $1,$receiver;
  45835. $1=$self._context();
  45836. if(($receiver = $1) == null || $receiver.a$nil){
  45837. return $1;
  45838. } else {
  45839. var ctx;
  45840. ctx=$receiver;
  45841. return $recv(ctx)._interpreter();
  45842. }
  45843. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  45844. },
  45845. args: [],
  45846. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  45847. referencedClasses: [],
  45848. messageSends: ["ifNotNil:", "context", "interpreter"]
  45849. }),
  45850. $globals.ASTDebugger);
  45851. $core.addMethod(
  45852. $core.method({
  45853. selector: "method",
  45854. protocol: "accessing",
  45855. fn: function (){
  45856. var self=this,$self=this;
  45857. return $core.withContext(function($ctx1) {
  45858. return $recv($self._context())._method();
  45859. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  45860. },
  45861. args: [],
  45862. source: "method\x0a\x09^ self context method",
  45863. referencedClasses: [],
  45864. messageSends: ["method", "context"]
  45865. }),
  45866. $globals.ASTDebugger);
  45867. $core.addMethod(
  45868. $core.method({
  45869. selector: "node",
  45870. protocol: "accessing",
  45871. fn: function (){
  45872. var self=this,$self=this;
  45873. return $core.withContext(function($ctx1) {
  45874. var $1,$receiver;
  45875. $1=$self._interpreter();
  45876. $ctx1.sendIdx["interpreter"]=1;
  45877. if(($receiver = $1) == null || $receiver.a$nil){
  45878. return $1;
  45879. } else {
  45880. return $recv($self._interpreter())._node();
  45881. }
  45882. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  45883. },
  45884. args: [],
  45885. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  45886. referencedClasses: [],
  45887. messageSends: ["ifNotNil:", "interpreter", "node"]
  45888. }),
  45889. $globals.ASTDebugger);
  45890. $core.addMethod(
  45891. $core.method({
  45892. selector: "onStep",
  45893. protocol: "private",
  45894. fn: function (){
  45895. var self=this,$self=this;
  45896. return $core.withContext(function($ctx1) {
  45897. var $1,$3,$2,$4,$6,$5,$receiver;
  45898. $1=$self._interpreter();
  45899. $ctx1.sendIdx["interpreter"]=1;
  45900. $self.result=$recv($1)._result();
  45901. $3=$self._interpreter();
  45902. $ctx1.sendIdx["interpreter"]=2;
  45903. $2=$recv($3)._atEnd();
  45904. $ctx1.sendIdx["atEnd"]=1;
  45905. if($core.assert($2)){
  45906. $4=$recv($self._context())._outerContext();
  45907. if(($receiver = $4) == null || $receiver.a$nil){
  45908. $4;
  45909. } else {
  45910. var outerContext;
  45911. outerContext=$receiver;
  45912. $self._context_(outerContext);
  45913. }
  45914. $6=$self._interpreter();
  45915. $ctx1.sendIdx["interpreter"]=3;
  45916. $5=$recv($6)._atEnd();
  45917. if(!$core.assert($5)){
  45918. $recv($self._interpreter())._skip();
  45919. }
  45920. }
  45921. $self._flushInnerContexts();
  45922. return self;
  45923. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  45924. },
  45925. args: [],
  45926. 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",
  45927. referencedClasses: [],
  45928. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  45929. }),
  45930. $globals.ASTDebugger);
  45931. $core.addMethod(
  45932. $core.method({
  45933. selector: "proceed",
  45934. protocol: "stepping",
  45935. fn: function (){
  45936. var self=this,$self=this;
  45937. return $core.withContext(function($ctx1) {
  45938. $recv((function(){
  45939. return $core.withContext(function($ctx2) {
  45940. return $self._atEnd();
  45941. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45942. }))._whileFalse_((function(){
  45943. return $core.withContext(function($ctx2) {
  45944. return $self._stepOver();
  45945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45946. }));
  45947. return self;
  45948. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  45949. },
  45950. args: [],
  45951. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  45952. referencedClasses: [],
  45953. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  45954. }),
  45955. $globals.ASTDebugger);
  45956. $core.addMethod(
  45957. $core.method({
  45958. selector: "restart",
  45959. protocol: "stepping",
  45960. fn: function (){
  45961. var self=this,$self=this;
  45962. return $core.withContext(function($ctx1) {
  45963. $recv($self._interpreter())._restart();
  45964. $self._flushInnerContexts();
  45965. return self;
  45966. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  45967. },
  45968. args: [],
  45969. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  45970. referencedClasses: [],
  45971. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  45972. }),
  45973. $globals.ASTDebugger);
  45974. $core.addMethod(
  45975. $core.method({
  45976. selector: "result",
  45977. protocol: "accessing",
  45978. fn: function (){
  45979. var self=this,$self=this;
  45980. return $self.result;
  45981. },
  45982. args: [],
  45983. source: "result\x0a\x09^ result",
  45984. referencedClasses: [],
  45985. messageSends: []
  45986. }),
  45987. $globals.ASTDebugger);
  45988. $core.addMethod(
  45989. $core.method({
  45990. selector: "stepInto",
  45991. protocol: "stepping",
  45992. fn: function (){
  45993. var self=this,$self=this;
  45994. return $core.withContext(function($ctx1) {
  45995. $self._shouldBeImplemented();
  45996. return self;
  45997. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  45998. },
  45999. args: [],
  46000. source: "stepInto\x0a\x09self shouldBeImplemented",
  46001. referencedClasses: [],
  46002. messageSends: ["shouldBeImplemented"]
  46003. }),
  46004. $globals.ASTDebugger);
  46005. $core.addMethod(
  46006. $core.method({
  46007. selector: "stepOver",
  46008. protocol: "stepping",
  46009. fn: function (){
  46010. var self=this,$self=this;
  46011. return $core.withContext(function($ctx1) {
  46012. var $1,$2;
  46013. $1=$recv($self._context())._isTopContext();
  46014. if($core.assert($1)){
  46015. $recv($self._interpreter())._stepOver();
  46016. } else {
  46017. $2=$self._interpreter();
  46018. $ctx1.sendIdx["interpreter"]=1;
  46019. $recv($2)._skip();
  46020. }
  46021. $self._onStep();
  46022. return self;
  46023. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  46024. },
  46025. args: [],
  46026. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  46027. referencedClasses: [],
  46028. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  46029. }),
  46030. $globals.ASTDebugger);
  46031. $core.addMethod(
  46032. $core.method({
  46033. selector: "context:",
  46034. protocol: "instance creation",
  46035. fn: function (aContext){
  46036. var self=this,$self=this;
  46037. return $core.withContext(function($ctx1) {
  46038. var $1;
  46039. $1=$self._new();
  46040. $recv($1)._context_(aContext);
  46041. return $recv($1)._yourself();
  46042. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.a$cls)});
  46043. },
  46044. args: ["aContext"],
  46045. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  46046. referencedClasses: [],
  46047. messageSends: ["context:", "new", "yourself"]
  46048. }),
  46049. $globals.ASTDebugger.a$cls);
  46050. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  46051. $core.addMethod(
  46052. $core.method({
  46053. selector: "interpreter",
  46054. protocol: "accessing",
  46055. fn: function (){
  46056. var self=this,$self=this;
  46057. return $self.interpreter;
  46058. },
  46059. args: [],
  46060. source: "interpreter\x0a\x09^ interpreter",
  46061. referencedClasses: [],
  46062. messageSends: []
  46063. }),
  46064. $globals.ASTEnterNode);
  46065. $core.addMethod(
  46066. $core.method({
  46067. selector: "interpreter:",
  46068. protocol: "accessing",
  46069. fn: function (anObject){
  46070. var self=this,$self=this;
  46071. $self.interpreter=anObject;
  46072. return self;
  46073. },
  46074. args: ["anObject"],
  46075. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  46076. referencedClasses: [],
  46077. messageSends: []
  46078. }),
  46079. $globals.ASTEnterNode);
  46080. $core.addMethod(
  46081. $core.method({
  46082. selector: "visitBlockNode:",
  46083. protocol: "visiting",
  46084. fn: function (aNode){
  46085. var self=this,$self=this;
  46086. return aNode;
  46087. },
  46088. args: ["aNode"],
  46089. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  46090. referencedClasses: [],
  46091. messageSends: []
  46092. }),
  46093. $globals.ASTEnterNode);
  46094. $core.addMethod(
  46095. $core.method({
  46096. selector: "visitDagNode:",
  46097. protocol: "visiting",
  46098. fn: function (aNode){
  46099. var self=this,$self=this;
  46100. return $core.withContext(function($ctx1) {
  46101. var $early={};
  46102. try {
  46103. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  46104. throw $early=[aNode];
  46105. }),(function(nodes){
  46106. return $core.withContext(function($ctx2) {
  46107. throw $early=[$self._visit_($recv(nodes)._first())];
  46108. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  46109. }));
  46110. return self;
  46111. }
  46112. catch(e) {if(e===$early)return e[0]; throw e}
  46113. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  46114. },
  46115. args: ["aNode"],
  46116. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  46117. referencedClasses: [],
  46118. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  46119. }),
  46120. $globals.ASTEnterNode);
  46121. $core.addMethod(
  46122. $core.method({
  46123. selector: "visitSequenceNode:",
  46124. protocol: "visiting",
  46125. fn: function (aNode){
  46126. var self=this,$self=this;
  46127. return $core.withContext(function($ctx1) {
  46128. var $1;
  46129. $recv($recv(aNode)._temps())._do_((function(each){
  46130. return $core.withContext(function($ctx2) {
  46131. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  46132. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46133. }));
  46134. $1=(
  46135. $ctx1.supercall = true,
  46136. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  46137. $ctx1.supercall = false;
  46138. return $1;
  46139. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  46140. },
  46141. args: ["aNode"],
  46142. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  46143. referencedClasses: [],
  46144. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  46145. }),
  46146. $globals.ASTEnterNode);
  46147. $core.addMethod(
  46148. $core.method({
  46149. selector: "on:",
  46150. protocol: "instance creation",
  46151. fn: function (anInterpreter){
  46152. var self=this,$self=this;
  46153. return $core.withContext(function($ctx1) {
  46154. var $1;
  46155. $1=$self._new();
  46156. $recv($1)._interpreter_(anInterpreter);
  46157. return $recv($1)._yourself();
  46158. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.a$cls)});
  46159. },
  46160. args: ["anInterpreter"],
  46161. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  46162. referencedClasses: [],
  46163. messageSends: ["interpreter:", "new", "yourself"]
  46164. }),
  46165. $globals.ASTEnterNode.a$cls);
  46166. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  46167. $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";
  46168. $core.addMethod(
  46169. $core.method({
  46170. selector: "assign:to:",
  46171. protocol: "private",
  46172. fn: function (aNode,anObject){
  46173. var self=this,$self=this;
  46174. return $core.withContext(function($ctx1) {
  46175. var $1,$3,$2,$4;
  46176. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  46177. if($core.assert($1)){
  46178. $3=$self._context();
  46179. $ctx1.sendIdx["context"]=1;
  46180. $2=$recv($3)._receiver();
  46181. $4=$recv(aNode)._value();
  46182. $ctx1.sendIdx["value"]=1;
  46183. $recv($2)._instVarAt_put_($4,anObject);
  46184. } else {
  46185. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  46186. }
  46187. return self;
  46188. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  46189. },
  46190. args: ["aNode", "anObject"],
  46191. 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 ]",
  46192. referencedClasses: [],
  46193. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  46194. }),
  46195. $globals.ASTInterpreter);
  46196. $core.addMethod(
  46197. $core.method({
  46198. selector: "atEnd",
  46199. protocol: "testing",
  46200. fn: function (){
  46201. var self=this,$self=this;
  46202. return $core.withContext(function($ctx1) {
  46203. var $1;
  46204. $1=$self.forceAtEnd;
  46205. if($core.assert($1)){
  46206. return true;
  46207. }
  46208. return $recv($self._hasReturned())._or_((function(){
  46209. return $core.withContext(function($ctx2) {
  46210. return $recv($self._node())._isNil();
  46211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46212. }));
  46213. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  46214. },
  46215. args: [],
  46216. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  46217. referencedClasses: [],
  46218. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  46219. }),
  46220. $globals.ASTInterpreter);
  46221. $core.addMethod(
  46222. $core.method({
  46223. selector: "context",
  46224. protocol: "accessing",
  46225. fn: function (){
  46226. var self=this,$self=this;
  46227. return $self.context;
  46228. },
  46229. args: [],
  46230. source: "context\x0a\x09^ context",
  46231. referencedClasses: [],
  46232. messageSends: []
  46233. }),
  46234. $globals.ASTInterpreter);
  46235. $core.addMethod(
  46236. $core.method({
  46237. selector: "context:",
  46238. protocol: "accessing",
  46239. fn: function (aContext){
  46240. var self=this,$self=this;
  46241. $self.context=aContext;
  46242. return self;
  46243. },
  46244. args: ["aContext"],
  46245. source: "context: aContext\x0a\x09context := aContext",
  46246. referencedClasses: [],
  46247. messageSends: []
  46248. }),
  46249. $globals.ASTInterpreter);
  46250. $core.addMethod(
  46251. $core.method({
  46252. selector: "enterNode",
  46253. protocol: "interpreting",
  46254. fn: function (){
  46255. var self=this,$self=this;
  46256. return $core.withContext(function($ctx1) {
  46257. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  46258. return self;
  46259. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  46260. },
  46261. args: [],
  46262. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  46263. referencedClasses: ["ASTEnterNode"],
  46264. messageSends: ["node:", "visit:", "on:", "node"]
  46265. }),
  46266. $globals.ASTInterpreter);
  46267. $core.addMethod(
  46268. $core.method({
  46269. selector: "eval:",
  46270. protocol: "private",
  46271. fn: function (aString){
  46272. var self=this,$self=this;
  46273. var source,function_;
  46274. return $core.withContext(function($ctx1) {
  46275. var $3,$2,$1;
  46276. source=$recv($globals.String)._streamContents_((function(str){
  46277. return $core.withContext(function($ctx2) {
  46278. $recv(str)._nextPutAll_("0,(function(");
  46279. $ctx2.sendIdx["nextPutAll:"]=1;
  46280. $3=$self._context();
  46281. $ctx2.sendIdx["context"]=1;
  46282. $2=$recv($3)._locals();
  46283. $ctx2.sendIdx["locals"]=1;
  46284. $1=$recv($2)._keys();
  46285. $recv($1)._do_separatedBy_((function(each){
  46286. return $core.withContext(function($ctx3) {
  46287. return $recv(str)._nextPutAll_(each);
  46288. $ctx3.sendIdx["nextPutAll:"]=2;
  46289. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  46290. }),(function(){
  46291. return $core.withContext(function($ctx3) {
  46292. return $recv(str)._nextPutAll_(",");
  46293. $ctx3.sendIdx["nextPutAll:"]=3;
  46294. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  46295. }));
  46296. $recv(str)._nextPutAll_("){ return (function() {");
  46297. $ctx2.sendIdx["nextPutAll:"]=4;
  46298. $recv(str)._nextPutAll_(aString);
  46299. $ctx2.sendIdx["nextPutAll:"]=5;
  46300. return $recv(str)._nextPutAll_("})()})");
  46301. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  46302. }));
  46303. function_=$recv($globals.Compiler)._eval_(source);
  46304. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  46305. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  46306. },
  46307. args: ["aString"],
  46308. 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",
  46309. referencedClasses: ["String", "Compiler"],
  46310. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  46311. }),
  46312. $globals.ASTInterpreter);
  46313. $core.addMethod(
  46314. $core.method({
  46315. selector: "hasReturned",
  46316. protocol: "testing",
  46317. fn: function (){
  46318. var self=this,$self=this;
  46319. return $core.withContext(function($ctx1) {
  46320. var $1,$receiver;
  46321. $1=$self.returned;
  46322. if(($receiver = $1) == null || $receiver.a$nil){
  46323. return false;
  46324. } else {
  46325. return $1;
  46326. }
  46327. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  46328. },
  46329. args: [],
  46330. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  46331. referencedClasses: [],
  46332. messageSends: ["ifNil:"]
  46333. }),
  46334. $globals.ASTInterpreter);
  46335. $core.addMethod(
  46336. $core.method({
  46337. selector: "initialize",
  46338. protocol: "initialization",
  46339. fn: function (){
  46340. var self=this,$self=this;
  46341. return $core.withContext(function($ctx1) {
  46342. (
  46343. $ctx1.supercall = true,
  46344. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  46345. $ctx1.supercall = false;
  46346. $self.forceAtEnd=false;
  46347. return self;
  46348. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  46349. },
  46350. args: [],
  46351. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  46352. referencedClasses: [],
  46353. messageSends: ["initialize"]
  46354. }),
  46355. $globals.ASTInterpreter);
  46356. $core.addMethod(
  46357. $core.method({
  46358. selector: "interpret",
  46359. protocol: "interpreting",
  46360. fn: function (){
  46361. var self=this,$self=this;
  46362. return $core.withContext(function($ctx1) {
  46363. $self._visit_($self._node());
  46364. return self;
  46365. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  46366. },
  46367. args: [],
  46368. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  46369. referencedClasses: [],
  46370. messageSends: ["visit:", "node"]
  46371. }),
  46372. $globals.ASTInterpreter);
  46373. $core.addMethod(
  46374. $core.method({
  46375. selector: "messageFromSendNode:arguments:",
  46376. protocol: "private",
  46377. fn: function (aSendNode,aCollection){
  46378. var self=this,$self=this;
  46379. return $core.withContext(function($ctx1) {
  46380. var $1;
  46381. $1=$recv($globals.Message)._new();
  46382. $recv($1)._selector_($recv(aSendNode)._selector());
  46383. $recv($1)._arguments_(aCollection);
  46384. return $recv($1)._yourself();
  46385. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  46386. },
  46387. args: ["aSendNode", "aCollection"],
  46388. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  46389. referencedClasses: ["Message"],
  46390. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  46391. }),
  46392. $globals.ASTInterpreter);
  46393. $core.addMethod(
  46394. $core.method({
  46395. selector: "messageNotUnderstood:receiver:",
  46396. protocol: "private",
  46397. fn: function (aMessage,anObject){
  46398. var self=this,$self=this;
  46399. return $core.withContext(function($ctx1) {
  46400. var $1;
  46401. $1=$recv($globals.MessageNotUnderstood)._new();
  46402. $recv($1)._message_(aMessage);
  46403. $recv($1)._receiver_(anObject);
  46404. $recv($1)._signal();
  46405. return self;
  46406. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  46407. },
  46408. args: ["aMessage", "anObject"],
  46409. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  46410. referencedClasses: ["MessageNotUnderstood"],
  46411. messageSends: ["message:", "new", "receiver:", "signal"]
  46412. }),
  46413. $globals.ASTInterpreter);
  46414. $core.addMethod(
  46415. $core.method({
  46416. selector: "next",
  46417. protocol: "interpreting",
  46418. fn: function (){
  46419. var self=this,$self=this;
  46420. var nd,nextNode;
  46421. return $core.withContext(function($ctx1) {
  46422. var $1,$2,$receiver;
  46423. nd=$self._node();
  46424. $1=$recv(nd)._parent();
  46425. if(($receiver = $1) == null || $receiver.a$nil){
  46426. nextNode=$1;
  46427. } else {
  46428. var parent;
  46429. parent=$receiver;
  46430. $2=$recv(parent)._nextSiblingNode_(nd);
  46431. if(($receiver = $2) == null || $receiver.a$nil){
  46432. nextNode=parent;
  46433. } else {
  46434. var sibling;
  46435. sibling=$receiver;
  46436. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  46437. }
  46438. }
  46439. $self._node_(nextNode);
  46440. return self;
  46441. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  46442. },
  46443. args: [],
  46444. 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",
  46445. referencedClasses: ["ASTEnterNode"],
  46446. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  46447. }),
  46448. $globals.ASTInterpreter);
  46449. $core.addMethod(
  46450. $core.method({
  46451. selector: "node",
  46452. protocol: "accessing",
  46453. fn: function (){
  46454. var self=this,$self=this;
  46455. return $self.node;
  46456. },
  46457. args: [],
  46458. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  46459. referencedClasses: [],
  46460. messageSends: []
  46461. }),
  46462. $globals.ASTInterpreter);
  46463. $core.addMethod(
  46464. $core.method({
  46465. selector: "node:",
  46466. protocol: "accessing",
  46467. fn: function (aNode){
  46468. var self=this,$self=this;
  46469. $self.node=aNode;
  46470. return self;
  46471. },
  46472. args: ["aNode"],
  46473. source: "node: aNode\x0a\x09node := aNode",
  46474. referencedClasses: [],
  46475. messageSends: []
  46476. }),
  46477. $globals.ASTInterpreter);
  46478. $core.addMethod(
  46479. $core.method({
  46480. selector: "peek",
  46481. protocol: "stack",
  46482. fn: function (){
  46483. var self=this,$self=this;
  46484. return $core.withContext(function($ctx1) {
  46485. var $1;
  46486. var $early={};
  46487. try {
  46488. $1=$self._stack();
  46489. $ctx1.sendIdx["stack"]=1;
  46490. $recv($1)._ifEmpty_((function(){
  46491. throw $early=[nil];
  46492. }));
  46493. return $recv($self._stack())._last();
  46494. }
  46495. catch(e) {if(e===$early)return e[0]; throw e}
  46496. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  46497. },
  46498. args: [],
  46499. 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",
  46500. referencedClasses: [],
  46501. messageSends: ["ifEmpty:", "stack", "last"]
  46502. }),
  46503. $globals.ASTInterpreter);
  46504. $core.addMethod(
  46505. $core.method({
  46506. selector: "pop",
  46507. protocol: "stack",
  46508. fn: function (){
  46509. var self=this,$self=this;
  46510. var peekedValue;
  46511. return $core.withContext(function($ctx1) {
  46512. peekedValue=$self._peek();
  46513. $recv($self._stack())._removeLast();
  46514. return peekedValue;
  46515. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  46516. },
  46517. args: [],
  46518. 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",
  46519. referencedClasses: [],
  46520. messageSends: ["peek", "removeLast", "stack"]
  46521. }),
  46522. $globals.ASTInterpreter);
  46523. $core.addMethod(
  46524. $core.method({
  46525. selector: "proceed",
  46526. protocol: "interpreting",
  46527. fn: function (){
  46528. var self=this,$self=this;
  46529. return $core.withContext(function($ctx1) {
  46530. $recv((function(){
  46531. return $core.withContext(function($ctx2) {
  46532. return $self._atEnd();
  46533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46534. }))._whileFalse_((function(){
  46535. return $core.withContext(function($ctx2) {
  46536. return $self._step();
  46537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46538. }));
  46539. return self;
  46540. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  46541. },
  46542. args: [],
  46543. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  46544. referencedClasses: [],
  46545. messageSends: ["whileFalse:", "atEnd", "step"]
  46546. }),
  46547. $globals.ASTInterpreter);
  46548. $core.addMethod(
  46549. $core.method({
  46550. selector: "push:",
  46551. protocol: "stack",
  46552. fn: function (anObject){
  46553. var self=this,$self=this;
  46554. return $core.withContext(function($ctx1) {
  46555. return $recv($self._stack())._add_(anObject);
  46556. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  46557. },
  46558. args: ["anObject"],
  46559. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  46560. referencedClasses: [],
  46561. messageSends: ["add:", "stack"]
  46562. }),
  46563. $globals.ASTInterpreter);
  46564. $core.addMethod(
  46565. $core.method({
  46566. selector: "restart",
  46567. protocol: "interpreting",
  46568. fn: function (){
  46569. var self=this,$self=this;
  46570. return $core.withContext(function($ctx1) {
  46571. $self._node_($recv($self._context())._ast());
  46572. $self._enterNode();
  46573. return self;
  46574. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  46575. },
  46576. args: [],
  46577. source: "restart\x0a\x09self node: self context ast; enterNode",
  46578. referencedClasses: [],
  46579. messageSends: ["node:", "ast", "context", "enterNode"]
  46580. }),
  46581. $globals.ASTInterpreter);
  46582. $core.addMethod(
  46583. $core.method({
  46584. selector: "result",
  46585. protocol: "accessing",
  46586. fn: function (){
  46587. var self=this,$self=this;
  46588. return $core.withContext(function($ctx1) {
  46589. var $1;
  46590. $1=$self._hasReturned();
  46591. if($core.assert($1)){
  46592. return $self._returnValue();
  46593. } else {
  46594. return $recv($self._context())._receiver();
  46595. }
  46596. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  46597. },
  46598. args: [],
  46599. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  46600. referencedClasses: [],
  46601. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  46602. }),
  46603. $globals.ASTInterpreter);
  46604. $core.addMethod(
  46605. $core.method({
  46606. selector: "returnValue",
  46607. protocol: "accessing",
  46608. fn: function (){
  46609. var self=this,$self=this;
  46610. return $self.returnValue;
  46611. },
  46612. args: [],
  46613. source: "returnValue\x0a\x09^ returnValue",
  46614. referencedClasses: [],
  46615. messageSends: []
  46616. }),
  46617. $globals.ASTInterpreter);
  46618. $core.addMethod(
  46619. $core.method({
  46620. selector: "returnValue:",
  46621. protocol: "accessing",
  46622. fn: function (anObject){
  46623. var self=this,$self=this;
  46624. $self.returnValue=anObject;
  46625. return self;
  46626. },
  46627. args: ["anObject"],
  46628. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  46629. referencedClasses: [],
  46630. messageSends: []
  46631. }),
  46632. $globals.ASTInterpreter);
  46633. $core.addMethod(
  46634. $core.method({
  46635. selector: "sendMessage:to:superSend:",
  46636. protocol: "private",
  46637. fn: function (aMessage,anObject,aBoolean){
  46638. var self=this,$self=this;
  46639. var method;
  46640. return $core.withContext(function($ctx1) {
  46641. var $2,$1,$3,$receiver;
  46642. var $early={};
  46643. try {
  46644. if(!$core.assert(aBoolean)){
  46645. return $recv(aMessage)._sendTo_(anObject);
  46646. }
  46647. $2=$recv(anObject)._class();
  46648. $ctx1.sendIdx["class"]=1;
  46649. $1=$recv($2)._superclass();
  46650. $ctx1.sendIdx["superclass"]=1;
  46651. if(($receiver = $1) == null || $receiver.a$nil){
  46652. $3=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  46653. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  46654. return $3;
  46655. } else {
  46656. $1;
  46657. }
  46658. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  46659. return $core.withContext(function($ctx2) {
  46660. throw $early=[$self._messageNotUnderstood_receiver_(aMessage,anObject)];
  46661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46662. }));
  46663. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  46664. }
  46665. catch(e) {if(e===$early)return e[0]; throw e}
  46666. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  46667. },
  46668. args: ["aMessage", "anObject", "aBoolean"],
  46669. 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",
  46670. referencedClasses: [],
  46671. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  46672. }),
  46673. $globals.ASTInterpreter);
  46674. $core.addMethod(
  46675. $core.method({
  46676. selector: "setNonLocalReturnFromContext:",
  46677. protocol: "interpreting",
  46678. fn: function (aContext){
  46679. var self=this,$self=this;
  46680. return $core.withContext(function($ctx1) {
  46681. var $2,$1;
  46682. $2=$recv(aContext)._interpreter();
  46683. $ctx1.sendIdx["interpreter"]=1;
  46684. $1=$recv($2)._hasReturned();
  46685. if($core.assert($1)){
  46686. $self.returned=true;
  46687. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  46688. }
  46689. return self;
  46690. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  46691. },
  46692. args: ["aContext"],
  46693. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  46694. referencedClasses: [],
  46695. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  46696. }),
  46697. $globals.ASTInterpreter);
  46698. $core.addMethod(
  46699. $core.method({
  46700. selector: "skip",
  46701. protocol: "interpreting",
  46702. fn: function (){
  46703. var self=this,$self=this;
  46704. return $core.withContext(function($ctx1) {
  46705. $self._next();
  46706. return self;
  46707. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  46708. },
  46709. args: [],
  46710. source: "skip\x0a\x09self next",
  46711. referencedClasses: [],
  46712. messageSends: ["next"]
  46713. }),
  46714. $globals.ASTInterpreter);
  46715. $core.addMethod(
  46716. $core.method({
  46717. selector: "stack",
  46718. protocol: "accessing",
  46719. fn: function (){
  46720. var self=this,$self=this;
  46721. return $core.withContext(function($ctx1) {
  46722. var $1,$receiver;
  46723. $1=$self.stack;
  46724. if(($receiver = $1) == null || $receiver.a$nil){
  46725. $self.stack=$recv($globals.OrderedCollection)._new();
  46726. return $self.stack;
  46727. } else {
  46728. return $1;
  46729. }
  46730. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  46731. },
  46732. args: [],
  46733. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  46734. referencedClasses: ["OrderedCollection"],
  46735. messageSends: ["ifNil:", "new"]
  46736. }),
  46737. $globals.ASTInterpreter);
  46738. $core.addMethod(
  46739. $core.method({
  46740. selector: "step",
  46741. protocol: "interpreting",
  46742. fn: function (){
  46743. var self=this,$self=this;
  46744. return $core.withContext(function($ctx1) {
  46745. $self._interpret();
  46746. $self._next();
  46747. return self;
  46748. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  46749. },
  46750. args: [],
  46751. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  46752. referencedClasses: [],
  46753. messageSends: ["interpret", "next"]
  46754. }),
  46755. $globals.ASTInterpreter);
  46756. $core.addMethod(
  46757. $core.method({
  46758. selector: "stepOver",
  46759. protocol: "interpreting",
  46760. fn: function (){
  46761. var self=this,$self=this;
  46762. return $core.withContext(function($ctx1) {
  46763. var $2,$1;
  46764. $self._step();
  46765. $ctx1.sendIdx["step"]=1;
  46766. $recv((function(){
  46767. return $core.withContext(function($ctx2) {
  46768. $2=$self._node();
  46769. $ctx2.sendIdx["node"]=1;
  46770. $1=$recv($2)._isNil();
  46771. return $recv($1)._or_((function(){
  46772. return $core.withContext(function($ctx3) {
  46773. return $recv($self._node())._isSteppingNode();
  46774. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46775. }));
  46776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46777. }))._whileFalse_((function(){
  46778. return $core.withContext(function($ctx2) {
  46779. return $self._step();
  46780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46781. }));
  46782. return self;
  46783. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  46784. },
  46785. args: [],
  46786. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  46787. referencedClasses: [],
  46788. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  46789. }),
  46790. $globals.ASTInterpreter);
  46791. $core.addMethod(
  46792. $core.method({
  46793. selector: "visit:",
  46794. protocol: "visiting",
  46795. fn: function (aNode){
  46796. var self=this,$self=this;
  46797. return $core.withContext(function($ctx1) {
  46798. var $1;
  46799. $1=$self._hasReturned();
  46800. if(!$core.assert($1)){
  46801. (
  46802. $ctx1.supercall = true,
  46803. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  46804. $ctx1.supercall = false;
  46805. }
  46806. return self;
  46807. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  46808. },
  46809. args: ["aNode"],
  46810. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  46811. referencedClasses: [],
  46812. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  46813. }),
  46814. $globals.ASTInterpreter);
  46815. $core.addMethod(
  46816. $core.method({
  46817. selector: "visitAssignmentNode:",
  46818. protocol: "visiting",
  46819. fn: function (aNode){
  46820. var self=this,$self=this;
  46821. var poppedValue;
  46822. return $core.withContext(function($ctx1) {
  46823. poppedValue=$self._pop();
  46824. $ctx1.sendIdx["pop"]=1;
  46825. $self._pop();
  46826. $self._push_(poppedValue);
  46827. $self._assign_to_($recv(aNode)._left(),poppedValue);
  46828. return self;
  46829. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  46830. },
  46831. args: ["aNode"],
  46832. 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",
  46833. referencedClasses: [],
  46834. messageSends: ["pop", "push:", "assign:to:", "left"]
  46835. }),
  46836. $globals.ASTInterpreter);
  46837. $core.addMethod(
  46838. $core.method({
  46839. selector: "visitBlockNode:",
  46840. protocol: "visiting",
  46841. fn: function (aNode){
  46842. var self=this,$self=this;
  46843. var block;
  46844. return $core.withContext(function($ctx1) {
  46845. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  46846. $self._push_(block);
  46847. return self;
  46848. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  46849. },
  46850. args: ["aNode"],
  46851. 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",
  46852. referencedClasses: ["AIBlockClosure"],
  46853. messageSends: ["forContext:node:", "context", "push:"]
  46854. }),
  46855. $globals.ASTInterpreter);
  46856. $core.addMethod(
  46857. $core.method({
  46858. selector: "visitBlockSequenceNode:",
  46859. protocol: "visiting",
  46860. fn: function (aNode){
  46861. var self=this,$self=this;
  46862. return $core.withContext(function($ctx1) {
  46863. (
  46864. $ctx1.supercall = true,
  46865. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  46866. $ctx1.supercall = false;
  46867. $self.forceAtEnd=true;
  46868. return self;
  46869. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46870. },
  46871. args: ["aNode"],
  46872. 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",
  46873. referencedClasses: [],
  46874. messageSends: ["visitBlockSequenceNode:"]
  46875. }),
  46876. $globals.ASTInterpreter);
  46877. $core.addMethod(
  46878. $core.method({
  46879. selector: "visitDagNode:",
  46880. protocol: "visiting",
  46881. fn: function (aNode){
  46882. var self=this,$self=this;
  46883. return self;
  46884. },
  46885. args: ["aNode"],
  46886. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  46887. referencedClasses: [],
  46888. messageSends: []
  46889. }),
  46890. $globals.ASTInterpreter);
  46891. $core.addMethod(
  46892. $core.method({
  46893. selector: "visitDynamicArrayNode:",
  46894. protocol: "visiting",
  46895. fn: function (aNode){
  46896. var self=this,$self=this;
  46897. var array;
  46898. return $core.withContext(function($ctx1) {
  46899. array=[];
  46900. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46901. return $core.withContext(function($ctx2) {
  46902. return $recv(array)._addFirst_($self._pop());
  46903. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46904. }));
  46905. $self._push_(array);
  46906. return self;
  46907. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  46908. },
  46909. args: ["aNode"],
  46910. 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",
  46911. referencedClasses: [],
  46912. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  46913. }),
  46914. $globals.ASTInterpreter);
  46915. $core.addMethod(
  46916. $core.method({
  46917. selector: "visitDynamicDictionaryNode:",
  46918. protocol: "visiting",
  46919. fn: function (aNode){
  46920. var self=this,$self=this;
  46921. var keyValueList;
  46922. return $core.withContext(function($ctx1) {
  46923. keyValueList=$recv($globals.OrderedCollection)._new();
  46924. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46925. return $core.withContext(function($ctx2) {
  46926. return $recv(keyValueList)._add_($self._pop());
  46927. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46928. }));
  46929. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  46930. return self;
  46931. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  46932. },
  46933. args: ["aNode"],
  46934. 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)",
  46935. referencedClasses: ["OrderedCollection", "HashedCollection"],
  46936. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  46937. }),
  46938. $globals.ASTInterpreter);
  46939. $core.addMethod(
  46940. $core.method({
  46941. selector: "visitJSStatementNode:",
  46942. protocol: "visiting",
  46943. fn: function (aNode){
  46944. var self=this,$self=this;
  46945. return $core.withContext(function($ctx1) {
  46946. $self.returned=true;
  46947. $self._returnValue_($self._eval_($recv(aNode)._source()));
  46948. return self;
  46949. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46950. },
  46951. args: ["aNode"],
  46952. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  46953. referencedClasses: [],
  46954. messageSends: ["returnValue:", "eval:", "source"]
  46955. }),
  46956. $globals.ASTInterpreter);
  46957. $core.addMethod(
  46958. $core.method({
  46959. selector: "visitReturnNode:",
  46960. protocol: "visiting",
  46961. fn: function (aNode){
  46962. var self=this,$self=this;
  46963. return $core.withContext(function($ctx1) {
  46964. $self.returned=true;
  46965. $self._returnValue_($self._pop());
  46966. return self;
  46967. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46968. },
  46969. args: ["aNode"],
  46970. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  46971. referencedClasses: [],
  46972. messageSends: ["returnValue:", "pop"]
  46973. }),
  46974. $globals.ASTInterpreter);
  46975. $core.addMethod(
  46976. $core.method({
  46977. selector: "visitSendNode:",
  46978. protocol: "visiting",
  46979. fn: function (aNode){
  46980. var self=this,$self=this;
  46981. var receiver,args,message,result;
  46982. return $core.withContext(function($ctx1) {
  46983. var $1;
  46984. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  46985. return $core.withContext(function($ctx2) {
  46986. return $self._pop();
  46987. $ctx2.sendIdx["pop"]=1;
  46988. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46989. }));
  46990. receiver=$self._peek();
  46991. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  46992. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  46993. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  46994. return $core.withContext(function($ctx2) {
  46995. return $recv($recv(aNode)._isLastChild())._not();
  46996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46997. }));
  46998. if(!$core.assert($1)){
  46999. $self._pop();
  47000. $self._push_(result);
  47001. }
  47002. return self;
  47003. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  47004. },
  47005. args: ["aNode"],
  47006. 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 ]",
  47007. referencedClasses: [],
  47008. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  47009. }),
  47010. $globals.ASTInterpreter);
  47011. $core.addMethod(
  47012. $core.method({
  47013. selector: "visitValueNode:",
  47014. protocol: "visiting",
  47015. fn: function (aNode){
  47016. var self=this,$self=this;
  47017. return $core.withContext(function($ctx1) {
  47018. $self._push_($recv(aNode)._value());
  47019. return self;
  47020. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  47021. },
  47022. args: ["aNode"],
  47023. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  47024. referencedClasses: [],
  47025. messageSends: ["push:", "value"]
  47026. }),
  47027. $globals.ASTInterpreter);
  47028. $core.addMethod(
  47029. $core.method({
  47030. selector: "visitVariableNode:",
  47031. protocol: "visiting",
  47032. fn: function (aNode){
  47033. var self=this,$self=this;
  47034. return $core.withContext(function($ctx1) {
  47035. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  47036. $2=$recv(aNode)._binding();
  47037. $ctx1.sendIdx["binding"]=1;
  47038. $1=$recv($2)._isUnknownVar();
  47039. if($core.assert($1)){
  47040. $5=$recv($globals.Platform)._globals();
  47041. $ctx1.sendIdx["globals"]=1;
  47042. $6=$recv(aNode)._value();
  47043. $ctx1.sendIdx["value"]=1;
  47044. $4=$recv($5)._at_ifAbsent_($6,(function(){
  47045. return $core.withContext(function($ctx2) {
  47046. return $self._error_("Unknown variable");
  47047. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47048. }));
  47049. $ctx1.sendIdx["at:ifAbsent:"]=1;
  47050. $3=$self._push_($4);
  47051. $ctx1.sendIdx["push:"]=1;
  47052. return $3;
  47053. }
  47054. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  47055. if($core.assert($8)){
  47056. $10=$self._context();
  47057. $ctx1.sendIdx["context"]=1;
  47058. $9=$recv($10)._receiver();
  47059. $11=$recv(aNode)._value();
  47060. $ctx1.sendIdx["value"]=2;
  47061. $7=$recv($9)._instVarAt_($11);
  47062. } else {
  47063. $12=$self._context();
  47064. $13=$recv(aNode)._value();
  47065. $ctx1.sendIdx["value"]=3;
  47066. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  47067. return $core.withContext(function($ctx2) {
  47068. $15=$recv(aNode)._value();
  47069. $ctx2.sendIdx["value"]=4;
  47070. $14=$recv($15)._isCapitalized();
  47071. if($core.assert($14)){
  47072. $16=$recv($globals.Smalltalk)._globals();
  47073. $ctx2.sendIdx["globals"]=2;
  47074. $17=$recv(aNode)._value();
  47075. $ctx2.sendIdx["value"]=5;
  47076. return $recv($16)._at_ifAbsent_($17,(function(){
  47077. return $core.withContext(function($ctx3) {
  47078. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  47079. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  47080. }));
  47081. }
  47082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  47083. }));
  47084. }
  47085. $self._push_($7);
  47086. return self;
  47087. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  47088. },
  47089. args: ["aNode"],
  47090. 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 ] ] ] ])",
  47091. referencedClasses: ["Platform", "Smalltalk"],
  47092. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  47093. }),
  47094. $globals.ASTInterpreter);
  47095. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  47096. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  47097. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  47098. $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`";
  47099. $core.addMethod(
  47100. $core.method({
  47101. selector: "currentNode",
  47102. protocol: "accessing",
  47103. fn: function (){
  47104. var self=this,$self=this;
  47105. return $self.currentNode;
  47106. },
  47107. args: [],
  47108. source: "currentNode\x0a\x09^ currentNode",
  47109. referencedClasses: [],
  47110. messageSends: []
  47111. }),
  47112. $globals.ASTPCNodeVisitor);
  47113. $core.addMethod(
  47114. $core.method({
  47115. selector: "increaseTrackedIndex",
  47116. protocol: "accessing",
  47117. fn: function (){
  47118. var self=this,$self=this;
  47119. return $core.withContext(function($ctx1) {
  47120. $self.trackedIndex=$recv($self._trackedIndex()).__plus((1));
  47121. return self;
  47122. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  47123. },
  47124. args: [],
  47125. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  47126. referencedClasses: [],
  47127. messageSends: ["+", "trackedIndex"]
  47128. }),
  47129. $globals.ASTPCNodeVisitor);
  47130. $core.addMethod(
  47131. $core.method({
  47132. selector: "index",
  47133. protocol: "accessing",
  47134. fn: function (){
  47135. var self=this,$self=this;
  47136. return $self.index;
  47137. },
  47138. args: [],
  47139. source: "index\x0a\x09^ index",
  47140. referencedClasses: [],
  47141. messageSends: []
  47142. }),
  47143. $globals.ASTPCNodeVisitor);
  47144. $core.addMethod(
  47145. $core.method({
  47146. selector: "index:",
  47147. protocol: "accessing",
  47148. fn: function (aNumber){
  47149. var self=this,$self=this;
  47150. $self.index=aNumber;
  47151. return self;
  47152. },
  47153. args: ["aNumber"],
  47154. source: "index: aNumber\x0a\x09index := aNumber",
  47155. referencedClasses: [],
  47156. messageSends: []
  47157. }),
  47158. $globals.ASTPCNodeVisitor);
  47159. $core.addMethod(
  47160. $core.method({
  47161. selector: "selector",
  47162. protocol: "accessing",
  47163. fn: function (){
  47164. var self=this,$self=this;
  47165. return $self.selector;
  47166. },
  47167. args: [],
  47168. source: "selector\x0a\x09^ selector",
  47169. referencedClasses: [],
  47170. messageSends: []
  47171. }),
  47172. $globals.ASTPCNodeVisitor);
  47173. $core.addMethod(
  47174. $core.method({
  47175. selector: "selector:",
  47176. protocol: "accessing",
  47177. fn: function (aString){
  47178. var self=this,$self=this;
  47179. $self.selector=aString;
  47180. return self;
  47181. },
  47182. args: ["aString"],
  47183. source: "selector: aString\x0a\x09selector := aString",
  47184. referencedClasses: [],
  47185. messageSends: []
  47186. }),
  47187. $globals.ASTPCNodeVisitor);
  47188. $core.addMethod(
  47189. $core.method({
  47190. selector: "trackedIndex",
  47191. protocol: "accessing",
  47192. fn: function (){
  47193. var self=this,$self=this;
  47194. return $core.withContext(function($ctx1) {
  47195. var $1,$receiver;
  47196. $1=$self.trackedIndex;
  47197. if(($receiver = $1) == null || $receiver.a$nil){
  47198. $self.trackedIndex=(0);
  47199. return $self.trackedIndex;
  47200. } else {
  47201. return $1;
  47202. }
  47203. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  47204. },
  47205. args: [],
  47206. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  47207. referencedClasses: [],
  47208. messageSends: ["ifNil:"]
  47209. }),
  47210. $globals.ASTPCNodeVisitor);
  47211. $core.addMethod(
  47212. $core.method({
  47213. selector: "visitJSStatementNode:",
  47214. protocol: "visiting",
  47215. fn: function (aNode){
  47216. var self=this,$self=this;
  47217. $self.currentNode=aNode;
  47218. return self;
  47219. },
  47220. args: ["aNode"],
  47221. 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",
  47222. referencedClasses: [],
  47223. messageSends: []
  47224. }),
  47225. $globals.ASTPCNodeVisitor);
  47226. $core.addMethod(
  47227. $core.method({
  47228. selector: "visitSendNode:",
  47229. protocol: "visiting",
  47230. fn: function (aNode){
  47231. var self=this,$self=this;
  47232. return $core.withContext(function($ctx1) {
  47233. var $2,$1,$3;
  47234. (
  47235. $ctx1.supercall = true,
  47236. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  47237. $ctx1.supercall = false;
  47238. $2=$self._selector();
  47239. $ctx1.sendIdx["selector"]=1;
  47240. $1=$recv($2).__eq($recv(aNode)._selector());
  47241. $ctx1.sendIdx["="]=1;
  47242. if($core.assert($1)){
  47243. $3=$recv($self._trackedIndex()).__eq($self._index());
  47244. if($core.assert($3)){
  47245. $self.currentNode=aNode;
  47246. $self.currentNode;
  47247. }
  47248. $self._increaseTrackedIndex();
  47249. }
  47250. return self;
  47251. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  47252. },
  47253. args: ["aNode"],
  47254. 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 ]",
  47255. referencedClasses: [],
  47256. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  47257. }),
  47258. $globals.ASTPCNodeVisitor);
  47259. $core.setTraitComposition([{trait: $globals.TMethodContext}], $globals.AIContext);
  47260. $core.addMethod(
  47261. $core.method({
  47262. selector: "isLastChild",
  47263. protocol: "*Compiler-Interpreter",
  47264. fn: function (){
  47265. var self=this,$self=this;
  47266. return $core.withContext(function($ctx1) {
  47267. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  47268. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  47269. },
  47270. args: [],
  47271. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  47272. referencedClasses: [],
  47273. messageSends: ["=", "last", "dagChildren", "parent"]
  47274. }),
  47275. $globals.ASTNode);
  47276. $core.addMethod(
  47277. $core.method({
  47278. selector: "isSteppingNode",
  47279. protocol: "*Compiler-Interpreter",
  47280. fn: function (){
  47281. var self=this,$self=this;
  47282. return false;
  47283. },
  47284. args: [],
  47285. source: "isSteppingNode\x0a\x09^ false",
  47286. referencedClasses: [],
  47287. messageSends: []
  47288. }),
  47289. $globals.ASTNode);
  47290. $core.addMethod(
  47291. $core.method({
  47292. selector: "nextSiblingNode:",
  47293. protocol: "*Compiler-Interpreter",
  47294. fn: function (aNode){
  47295. var self=this,$self=this;
  47296. return $core.withContext(function($ctx1) {
  47297. var $1;
  47298. var $early={};
  47299. try {
  47300. $1=$self._dagChildren();
  47301. $ctx1.sendIdx["dagChildren"]=1;
  47302. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  47303. throw $early=[nil];
  47304. }));
  47305. }
  47306. catch(e) {if(e===$early)return e[0]; throw e}
  47307. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  47308. },
  47309. args: ["aNode"],
  47310. 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 ]",
  47311. referencedClasses: [],
  47312. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  47313. }),
  47314. $globals.ASTNode);
  47315. $core.addMethod(
  47316. $core.method({
  47317. selector: "isSteppingNode",
  47318. protocol: "*Compiler-Interpreter",
  47319. fn: function (){
  47320. var self=this,$self=this;
  47321. return true;
  47322. },
  47323. args: [],
  47324. source: "isSteppingNode\x0a\x09^ true",
  47325. referencedClasses: [],
  47326. messageSends: []
  47327. }),
  47328. $globals.AssignmentNode);
  47329. $core.addMethod(
  47330. $core.method({
  47331. selector: "isSteppingNode",
  47332. protocol: "*Compiler-Interpreter",
  47333. fn: function (){
  47334. var self=this,$self=this;
  47335. return true;
  47336. },
  47337. args: [],
  47338. source: "isSteppingNode\x0a\x09^ true",
  47339. referencedClasses: [],
  47340. messageSends: []
  47341. }),
  47342. $globals.BlockNode);
  47343. $core.addMethod(
  47344. $core.method({
  47345. selector: "nextSiblingNode:",
  47346. protocol: "*Compiler-Interpreter",
  47347. fn: function (aNode){
  47348. var self=this,$self=this;
  47349. return nil;
  47350. },
  47351. args: ["aNode"],
  47352. 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",
  47353. referencedClasses: [],
  47354. messageSends: []
  47355. }),
  47356. $globals.BlockNode);
  47357. $core.addMethod(
  47358. $core.method({
  47359. selector: "isSteppingNode",
  47360. protocol: "*Compiler-Interpreter",
  47361. fn: function (){
  47362. var self=this,$self=this;
  47363. return true;
  47364. },
  47365. args: [],
  47366. source: "isSteppingNode\x0a\x09^ true",
  47367. referencedClasses: [],
  47368. messageSends: []
  47369. }),
  47370. $globals.DynamicArrayNode);
  47371. $core.addMethod(
  47372. $core.method({
  47373. selector: "isSteppingNode",
  47374. protocol: "*Compiler-Interpreter",
  47375. fn: function (){
  47376. var self=this,$self=this;
  47377. return true;
  47378. },
  47379. args: [],
  47380. source: "isSteppingNode\x0a\x09^ true",
  47381. referencedClasses: [],
  47382. messageSends: []
  47383. }),
  47384. $globals.DynamicDictionaryNode);
  47385. $core.addMethod(
  47386. $core.method({
  47387. selector: "isSteppingNode",
  47388. protocol: "*Compiler-Interpreter",
  47389. fn: function (){
  47390. var self=this,$self=this;
  47391. return true;
  47392. },
  47393. args: [],
  47394. source: "isSteppingNode\x0a\x09^ true",
  47395. referencedClasses: [],
  47396. messageSends: []
  47397. }),
  47398. $globals.JSStatementNode);
  47399. $core.addMethod(
  47400. $core.method({
  47401. selector: "isCascadeSendNode",
  47402. protocol: "*Compiler-Interpreter",
  47403. fn: function (){
  47404. var self=this,$self=this;
  47405. return $core.withContext(function($ctx1) {
  47406. return $recv($self._parent())._isCascadeNode();
  47407. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  47408. },
  47409. args: [],
  47410. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  47411. referencedClasses: [],
  47412. messageSends: ["isCascadeNode", "parent"]
  47413. }),
  47414. $globals.SendNode);
  47415. $core.addMethod(
  47416. $core.method({
  47417. selector: "isSteppingNode",
  47418. protocol: "*Compiler-Interpreter",
  47419. fn: function (){
  47420. var self=this,$self=this;
  47421. return true;
  47422. },
  47423. args: [],
  47424. source: "isSteppingNode\x0a\x09^ true",
  47425. referencedClasses: [],
  47426. messageSends: []
  47427. }),
  47428. $globals.SendNode);
  47429. });
  47430. define('amber/lang',[
  47431. './deploy',
  47432. './boot', // pre-fetch, dep of ./helpers
  47433. './helpers', // pre-fetch, dep of ./deploy
  47434. './parser',
  47435. // --- packages for the Amber reflection begin here ---
  47436. 'amber/core/Platform-ImportExport',
  47437. 'amber/core/Compiler-Core',
  47438. 'amber/core/Compiler-AST',
  47439. 'amber/core/Compiler-Semantic',
  47440. 'amber/core/Compiler-IR',
  47441. 'amber/core/Compiler-Inlining',
  47442. 'amber/core/Compiler-Interpreter'
  47443. // --- packages for the Amber reflection end here ---
  47444. ], function (amber) {
  47445. return amber;
  47446. });
  47447. define('amber/core/Platform-DOM',["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Infrastructure", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  47448. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47449. var $pkg = $core.addPackage("Platform-DOM");
  47450. $pkg.innerEval = function (expr) { return eval(expr); };
  47451. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  47452. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  47453. $core.addMethod(
  47454. $core.method({
  47455. selector: "isDomNode:",
  47456. protocol: "testing",
  47457. fn: function (anObject){
  47458. var self=this,$self=this;
  47459. return $core.withContext(function($ctx1) {
  47460. return anObject.nodeType > 0 &&
  47461. Object.prototype.toString.call(anObject) !== "[object Object]";
  47462. return self;
  47463. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.a$cls)});
  47464. },
  47465. args: ["anObject"],
  47466. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  47467. referencedClasses: [],
  47468. messageSends: []
  47469. }),
  47470. $globals.PlatformDom.a$cls);
  47471. $core.addMethod(
  47472. $core.method({
  47473. selector: "isFeasible",
  47474. protocol: "testing",
  47475. fn: function (){
  47476. var self=this,$self=this;
  47477. return $core.withContext(function($ctx1) {
  47478. if (typeof document === "undefined") return false;
  47479. try {
  47480. var d = document.createElement("div"),
  47481. f = document.createDocumentFragment(),
  47482. t = document.createTextNode("Hello, Amber!");
  47483. f.appendChild(t);
  47484. d.insertBefore(f, null);
  47485. return d.innerHTML === "Hello, Amber!";
  47486. } catch (e) {
  47487. return false;
  47488. };
  47489. return self;
  47490. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.a$cls)});
  47491. },
  47492. args: [],
  47493. 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'>",
  47494. referencedClasses: [],
  47495. messageSends: []
  47496. }),
  47497. $globals.PlatformDom.a$cls);
  47498. $core.addMethod(
  47499. $core.method({
  47500. selector: "newCustomEvent:detail:",
  47501. protocol: "creation",
  47502. fn: function (aString,anObject){
  47503. var self=this,$self=this;
  47504. return $core.withContext(function($ctx1) {
  47505. return new CustomEvent(aString, {detail: anObject});
  47506. return self;
  47507. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.a$cls)});
  47508. },
  47509. args: ["aString", "anObject"],
  47510. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  47511. referencedClasses: [],
  47512. messageSends: []
  47513. }),
  47514. $globals.PlatformDom.a$cls);
  47515. $core.addMethod(
  47516. $core.method({
  47517. selector: "toArray:",
  47518. protocol: "converting",
  47519. fn: function (aDomList){
  47520. var self=this,$self=this;
  47521. return $core.withContext(function($ctx1) {
  47522. return Array.prototype.slice.call(aDomList);
  47523. return self;
  47524. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.a$cls)});
  47525. },
  47526. args: ["aDomList"],
  47527. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  47528. referencedClasses: [],
  47529. messageSends: []
  47530. }),
  47531. $globals.PlatformDom.a$cls);
  47532. $core.addMethod(
  47533. $core.method({
  47534. selector: "asDomNode",
  47535. protocol: "*Platform-DOM",
  47536. fn: function (){
  47537. var self=this,$self=this;
  47538. var fragment;
  47539. return $core.withContext(function($ctx1) {
  47540. fragment=$recv(document)._createDocumentFragment();
  47541. $self._do_((function(each){
  47542. return $core.withContext(function($ctx2) {
  47543. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  47544. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47545. }));
  47546. return fragment;
  47547. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  47548. },
  47549. args: [],
  47550. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  47551. referencedClasses: [],
  47552. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  47553. }),
  47554. $globals.Collection);
  47555. $core.addMethod(
  47556. $core.method({
  47557. selector: "asDomNode",
  47558. protocol: "*Platform-DOM",
  47559. fn: function (){
  47560. var self=this,$self=this;
  47561. return $core.withContext(function($ctx1) {
  47562. var $1,$2;
  47563. $1=$recv($globals.PlatformDom)._isDomNode_($self.jsObject);
  47564. if($core.assert($1)){
  47565. return $self.jsObject;
  47566. } else {
  47567. $2=(
  47568. $ctx1.supercall = true,
  47569. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, []));
  47570. $ctx1.supercall = false;
  47571. return $2;
  47572. }
  47573. return self;
  47574. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  47575. },
  47576. args: [],
  47577. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  47578. referencedClasses: ["PlatformDom"],
  47579. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  47580. }),
  47581. $globals.JSObjectProxy);
  47582. $core.addMethod(
  47583. $core.method({
  47584. selector: "asDomNode",
  47585. protocol: "*Platform-DOM",
  47586. fn: function (){
  47587. var self=this,$self=this;
  47588. return $core.withContext(function($ctx1) {
  47589. return $recv(document)._createTextNode_($self._asString());
  47590. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.String)});
  47591. },
  47592. args: [],
  47593. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  47594. referencedClasses: [],
  47595. messageSends: ["createTextNode:", "asString"]
  47596. }),
  47597. $globals.String);
  47598. $core.addMethod(
  47599. $core.method({
  47600. selector: "htmlTextContent",
  47601. protocol: "*Platform-DOM",
  47602. fn: function (){
  47603. var self=this,$self=this;
  47604. return $core.withContext(function($ctx1) {
  47605. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  47606. return self;
  47607. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  47608. },
  47609. args: [],
  47610. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  47611. referencedClasses: [],
  47612. messageSends: []
  47613. }),
  47614. $globals.String);
  47615. });
  47616. define('amber/core/SUnit',["amber/boot", "require", "amber/core/Kernel-Classes", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Infrastructure", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  47617. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47618. var $pkg = $core.addPackage("SUnit");
  47619. $pkg.innerEval = function (expr) { return eval(expr); };
  47620. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  47621. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  47622. $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.";
  47623. $core.addMethod(
  47624. $core.method({
  47625. selector: "result",
  47626. protocol: "accessing",
  47627. fn: function (){
  47628. var self=this,$self=this;
  47629. return $self.result;
  47630. },
  47631. args: [],
  47632. source: "result\x0a\x09^ result",
  47633. referencedClasses: [],
  47634. messageSends: []
  47635. }),
  47636. $globals.ResultAnnouncement);
  47637. $core.addMethod(
  47638. $core.method({
  47639. selector: "result:",
  47640. protocol: "accessing",
  47641. fn: function (aTestResult){
  47642. var self=this,$self=this;
  47643. $self.result=aTestResult;
  47644. return self;
  47645. },
  47646. args: ["aTestResult"],
  47647. source: "result: aTestResult\x0a\x09result := aTestResult",
  47648. referencedClasses: [],
  47649. messageSends: []
  47650. }),
  47651. $globals.ResultAnnouncement);
  47652. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  47653. $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.";
  47654. $core.addMethod(
  47655. $core.method({
  47656. selector: "assert:",
  47657. protocol: "testing",
  47658. fn: function (aBoolean){
  47659. var self=this,$self=this;
  47660. return $core.withContext(function($ctx1) {
  47661. $self._assert_description_(aBoolean,"Assertion failed");
  47662. return self;
  47663. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  47664. },
  47665. args: ["aBoolean"],
  47666. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  47667. referencedClasses: [],
  47668. messageSends: ["assert:description:"]
  47669. }),
  47670. $globals.TestCase);
  47671. $core.addMethod(
  47672. $core.method({
  47673. selector: "assert:description:",
  47674. protocol: "testing",
  47675. fn: function (aBoolean,aString){
  47676. var self=this,$self=this;
  47677. return $core.withContext(function($ctx1) {
  47678. if(!$core.assert(aBoolean)){
  47679. $self._signalFailure_(aString);
  47680. }
  47681. return self;
  47682. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  47683. },
  47684. args: ["aBoolean", "aString"],
  47685. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  47686. referencedClasses: [],
  47687. messageSends: ["ifFalse:", "signalFailure:"]
  47688. }),
  47689. $globals.TestCase);
  47690. $core.addMethod(
  47691. $core.method({
  47692. selector: "assert:equals:",
  47693. protocol: "testing",
  47694. fn: function (actual,expected){
  47695. var self=this,$self=this;
  47696. return $core.withContext(function($ctx1) {
  47697. var $1,$5,$4,$3,$2;
  47698. $1=$recv(actual).__eq(expected);
  47699. $5=$recv(expected)._printString();
  47700. $ctx1.sendIdx["printString"]=1;
  47701. $4="Expected: ".__comma($5);
  47702. $3=$recv($4).__comma(" but was: ");
  47703. $ctx1.sendIdx[","]=2;
  47704. $2=$recv($3).__comma($recv(actual)._printString());
  47705. $ctx1.sendIdx[","]=1;
  47706. return $self._assert_description_($1,$2);
  47707. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  47708. },
  47709. args: ["actual", "expected"],
  47710. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  47711. referencedClasses: [],
  47712. messageSends: ["assert:description:", "=", ",", "printString"]
  47713. }),
  47714. $globals.TestCase);
  47715. $core.addMethod(
  47716. $core.method({
  47717. selector: "async:",
  47718. protocol: "async",
  47719. fn: function (aBlock){
  47720. var self=this,$self=this;
  47721. var c;
  47722. return $core.withContext(function($ctx1) {
  47723. var $1;
  47724. $self._errorIfNotAsync_("#async");
  47725. c=$self.context;
  47726. return (function(){
  47727. return $core.withContext(function($ctx2) {
  47728. $1=$self._isAsync();
  47729. if($core.assert($1)){
  47730. return $recv(c)._execute_(aBlock);
  47731. }
  47732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47733. });
  47734. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  47735. },
  47736. args: ["aBlock"],
  47737. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  47738. referencedClasses: [],
  47739. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  47740. }),
  47741. $globals.TestCase);
  47742. $core.addMethod(
  47743. $core.method({
  47744. selector: "context:",
  47745. protocol: "accessing",
  47746. fn: function (aRunningTestContext){
  47747. var self=this,$self=this;
  47748. $self.context=aRunningTestContext;
  47749. return self;
  47750. },
  47751. args: ["aRunningTestContext"],
  47752. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  47753. referencedClasses: [],
  47754. messageSends: []
  47755. }),
  47756. $globals.TestCase);
  47757. $core.addMethod(
  47758. $core.method({
  47759. selector: "deny:",
  47760. protocol: "testing",
  47761. fn: function (aBoolean){
  47762. var self=this,$self=this;
  47763. return $core.withContext(function($ctx1) {
  47764. $self._assert_($recv(aBoolean)._not());
  47765. return self;
  47766. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  47767. },
  47768. args: ["aBoolean"],
  47769. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  47770. referencedClasses: [],
  47771. messageSends: ["assert:", "not"]
  47772. }),
  47773. $globals.TestCase);
  47774. $core.addMethod(
  47775. $core.method({
  47776. selector: "errorIfNotAsync:",
  47777. protocol: "error handling",
  47778. fn: function (aString){
  47779. var self=this,$self=this;
  47780. return $core.withContext(function($ctx1) {
  47781. var $1;
  47782. $1=$self._isAsync();
  47783. if(!$core.assert($1)){
  47784. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  47785. }
  47786. return self;
  47787. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  47788. },
  47789. args: ["aString"],
  47790. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  47791. referencedClasses: [],
  47792. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  47793. }),
  47794. $globals.TestCase);
  47795. $core.addMethod(
  47796. $core.method({
  47797. selector: "finished",
  47798. protocol: "async",
  47799. fn: function (){
  47800. var self=this,$self=this;
  47801. return $core.withContext(function($ctx1) {
  47802. $self._errorIfNotAsync_("#finished");
  47803. $self.asyncTimeout=nil;
  47804. return self;
  47805. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  47806. },
  47807. args: [],
  47808. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  47809. referencedClasses: [],
  47810. messageSends: ["errorIfNotAsync:"]
  47811. }),
  47812. $globals.TestCase);
  47813. $core.addMethod(
  47814. $core.method({
  47815. selector: "isAsync",
  47816. protocol: "testing",
  47817. fn: function (){
  47818. var self=this,$self=this;
  47819. return $core.withContext(function($ctx1) {
  47820. return $recv($self.asyncTimeout)._notNil();
  47821. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  47822. },
  47823. args: [],
  47824. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  47825. referencedClasses: [],
  47826. messageSends: ["notNil"]
  47827. }),
  47828. $globals.TestCase);
  47829. $core.addMethod(
  47830. $core.method({
  47831. selector: "performTest",
  47832. protocol: "running",
  47833. fn: function (){
  47834. var self=this,$self=this;
  47835. return $core.withContext(function($ctx1) {
  47836. $self.asyncTimeout=nil;
  47837. $self._perform_($self._selector());
  47838. return self;
  47839. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  47840. },
  47841. args: [],
  47842. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  47843. referencedClasses: [],
  47844. messageSends: ["perform:", "selector"]
  47845. }),
  47846. $globals.TestCase);
  47847. $core.addMethod(
  47848. $core.method({
  47849. selector: "runCase",
  47850. protocol: "running",
  47851. fn: function (){
  47852. var self=this,$self=this;
  47853. return $core.withContext(function($ctx1) {
  47854. $recv($recv($globals.TestContext)._testCase_(self))._start();
  47855. return self;
  47856. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  47857. },
  47858. args: [],
  47859. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  47860. referencedClasses: ["TestContext"],
  47861. messageSends: ["start", "testCase:"]
  47862. }),
  47863. $globals.TestCase);
  47864. $core.addMethod(
  47865. $core.method({
  47866. selector: "selector",
  47867. protocol: "accessing",
  47868. fn: function (){
  47869. var self=this,$self=this;
  47870. return $self.testSelector;
  47871. },
  47872. args: [],
  47873. source: "selector\x0a\x09^ testSelector",
  47874. referencedClasses: [],
  47875. messageSends: []
  47876. }),
  47877. $globals.TestCase);
  47878. $core.addMethod(
  47879. $core.method({
  47880. selector: "setTestSelector:",
  47881. protocol: "accessing",
  47882. fn: function (aSelector){
  47883. var self=this,$self=this;
  47884. $self.testSelector=aSelector;
  47885. return self;
  47886. },
  47887. args: ["aSelector"],
  47888. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  47889. referencedClasses: [],
  47890. messageSends: []
  47891. }),
  47892. $globals.TestCase);
  47893. $core.addMethod(
  47894. $core.method({
  47895. selector: "setUp",
  47896. protocol: "running",
  47897. fn: function (){
  47898. var self=this,$self=this;
  47899. return self;
  47900. },
  47901. args: [],
  47902. source: "setUp",
  47903. referencedClasses: [],
  47904. messageSends: []
  47905. }),
  47906. $globals.TestCase);
  47907. $core.addMethod(
  47908. $core.method({
  47909. selector: "should:",
  47910. protocol: "testing",
  47911. fn: function (aBlock){
  47912. var self=this,$self=this;
  47913. return $core.withContext(function($ctx1) {
  47914. $self._assert_($recv(aBlock)._value());
  47915. return self;
  47916. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  47917. },
  47918. args: ["aBlock"],
  47919. source: "should: aBlock\x0a\x09self assert: aBlock value",
  47920. referencedClasses: [],
  47921. messageSends: ["assert:", "value"]
  47922. }),
  47923. $globals.TestCase);
  47924. $core.addMethod(
  47925. $core.method({
  47926. selector: "should:raise:",
  47927. protocol: "testing",
  47928. fn: function (aBlock,anExceptionClass){
  47929. var self=this,$self=this;
  47930. return $core.withContext(function($ctx1) {
  47931. $self._assert_($recv((function(){
  47932. return $core.withContext(function($ctx2) {
  47933. $recv(aBlock)._value();
  47934. return false;
  47935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47936. }))._on_do_(anExceptionClass,(function(ex){
  47937. return true;
  47938. })));
  47939. return self;
  47940. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47941. },
  47942. args: ["aBlock", "anExceptionClass"],
  47943. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  47944. referencedClasses: [],
  47945. messageSends: ["assert:", "on:do:", "value"]
  47946. }),
  47947. $globals.TestCase);
  47948. $core.addMethod(
  47949. $core.method({
  47950. selector: "shouldnt:raise:",
  47951. protocol: "testing",
  47952. fn: function (aBlock,anExceptionClass){
  47953. var self=this,$self=this;
  47954. return $core.withContext(function($ctx1) {
  47955. $self._assert_($recv((function(){
  47956. return $core.withContext(function($ctx2) {
  47957. $recv(aBlock)._value();
  47958. return true;
  47959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47960. }))._on_do_(anExceptionClass,(function(ex){
  47961. return false;
  47962. })));
  47963. return self;
  47964. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47965. },
  47966. args: ["aBlock", "anExceptionClass"],
  47967. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  47968. referencedClasses: [],
  47969. messageSends: ["assert:", "on:do:", "value"]
  47970. }),
  47971. $globals.TestCase);
  47972. $core.addMethod(
  47973. $core.method({
  47974. selector: "signalFailure:",
  47975. protocol: "private",
  47976. fn: function (aString){
  47977. var self=this,$self=this;
  47978. return $core.withContext(function($ctx1) {
  47979. var $1;
  47980. $1=$recv($globals.TestFailure)._new();
  47981. $recv($1)._messageText_(aString);
  47982. $recv($1)._signal();
  47983. return self;
  47984. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  47985. },
  47986. args: ["aString"],
  47987. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  47988. referencedClasses: ["TestFailure"],
  47989. messageSends: ["messageText:", "new", "signal"]
  47990. }),
  47991. $globals.TestCase);
  47992. $core.addMethod(
  47993. $core.method({
  47994. selector: "tearDown",
  47995. protocol: "running",
  47996. fn: function (){
  47997. var self=this,$self=this;
  47998. return self;
  47999. },
  48000. args: [],
  48001. source: "tearDown",
  48002. referencedClasses: [],
  48003. messageSends: []
  48004. }),
  48005. $globals.TestCase);
  48006. $core.addMethod(
  48007. $core.method({
  48008. selector: "timeout:",
  48009. protocol: "async",
  48010. fn: function (aNumber){
  48011. var self=this,$self=this;
  48012. return $core.withContext(function($ctx1) {
  48013. var $1,$receiver;
  48014. $1=$self.asyncTimeout;
  48015. if(($receiver = $1) == null || $receiver.a$nil){
  48016. $1;
  48017. } else {
  48018. $recv($self.asyncTimeout)._clearTimeout();
  48019. }
  48020. $self.asyncTimeout=(0);
  48021. $self.asyncTimeout=$recv($self._async_((function(){
  48022. return $core.withContext(function($ctx2) {
  48023. return $self._assert_description_(false,"SUnit grace time exhausted");
  48024. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48025. })))._valueWithTimeout_(aNumber);
  48026. return self;
  48027. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  48028. },
  48029. args: ["aNumber"],
  48030. 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",
  48031. referencedClasses: [],
  48032. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  48033. }),
  48034. $globals.TestCase);
  48035. $core.addMethod(
  48036. $core.method({
  48037. selector: "allTestSelectors",
  48038. protocol: "accessing",
  48039. fn: function (){
  48040. var self=this,$self=this;
  48041. var selectors;
  48042. return $core.withContext(function($ctx1) {
  48043. var $1;
  48044. selectors=$self._testSelectors();
  48045. $1=$self._shouldInheritSelectors();
  48046. if($core.assert($1)){
  48047. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  48048. }
  48049. return selectors;
  48050. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.a$cls)});
  48051. },
  48052. args: [],
  48053. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  48054. referencedClasses: [],
  48055. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  48056. }),
  48057. $globals.TestCase.a$cls);
  48058. $core.addMethod(
  48059. $core.method({
  48060. selector: "buildSuite",
  48061. protocol: "accessing",
  48062. fn: function (){
  48063. var self=this,$self=this;
  48064. return $core.withContext(function($ctx1) {
  48065. return $recv($self._allTestSelectors())._collect_((function(each){
  48066. return $core.withContext(function($ctx2) {
  48067. return $self._selector_(each);
  48068. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48069. }));
  48070. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.a$cls)});
  48071. },
  48072. args: [],
  48073. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  48074. referencedClasses: [],
  48075. messageSends: ["collect:", "allTestSelectors", "selector:"]
  48076. }),
  48077. $globals.TestCase.a$cls);
  48078. $core.addMethod(
  48079. $core.method({
  48080. selector: "classTag",
  48081. protocol: "accessing",
  48082. fn: function (){
  48083. var self=this,$self=this;
  48084. return "test";
  48085. },
  48086. args: [],
  48087. 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'",
  48088. referencedClasses: [],
  48089. messageSends: []
  48090. }),
  48091. $globals.TestCase.a$cls);
  48092. $core.addMethod(
  48093. $core.method({
  48094. selector: "isAbstract",
  48095. protocol: "testing",
  48096. fn: function (){
  48097. var self=this,$self=this;
  48098. return $core.withContext(function($ctx1) {
  48099. return $recv($self._name()).__eq("TestCase");
  48100. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.a$cls)});
  48101. },
  48102. args: [],
  48103. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  48104. referencedClasses: [],
  48105. messageSends: ["=", "name"]
  48106. }),
  48107. $globals.TestCase.a$cls);
  48108. $core.addMethod(
  48109. $core.method({
  48110. selector: "isTestClass",
  48111. protocol: "testing",
  48112. fn: function (){
  48113. var self=this,$self=this;
  48114. return $core.withContext(function($ctx1) {
  48115. return $recv($self._isAbstract())._not();
  48116. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.a$cls)});
  48117. },
  48118. args: [],
  48119. source: "isTestClass\x0a\x09^ self isAbstract not",
  48120. referencedClasses: [],
  48121. messageSends: ["not", "isAbstract"]
  48122. }),
  48123. $globals.TestCase.a$cls);
  48124. $core.addMethod(
  48125. $core.method({
  48126. selector: "lookupHierarchyRoot",
  48127. protocol: "accessing",
  48128. fn: function (){
  48129. var self=this,$self=this;
  48130. return $globals.TestCase;
  48131. },
  48132. args: [],
  48133. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  48134. referencedClasses: ["TestCase"],
  48135. messageSends: []
  48136. }),
  48137. $globals.TestCase.a$cls);
  48138. $core.addMethod(
  48139. $core.method({
  48140. selector: "selector:",
  48141. protocol: "accessing",
  48142. fn: function (aSelector){
  48143. var self=this,$self=this;
  48144. return $core.withContext(function($ctx1) {
  48145. var $1;
  48146. $1=$self._new();
  48147. $recv($1)._setTestSelector_(aSelector);
  48148. return $recv($1)._yourself();
  48149. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.a$cls)});
  48150. },
  48151. args: ["aSelector"],
  48152. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  48153. referencedClasses: [],
  48154. messageSends: ["setTestSelector:", "new", "yourself"]
  48155. }),
  48156. $globals.TestCase.a$cls);
  48157. $core.addMethod(
  48158. $core.method({
  48159. selector: "shouldInheritSelectors",
  48160. protocol: "testing",
  48161. fn: function (){
  48162. var self=this,$self=this;
  48163. return $core.withContext(function($ctx1) {
  48164. return $self.__tild_eq($self._lookupHierarchyRoot());
  48165. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.a$cls)});
  48166. },
  48167. args: [],
  48168. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  48169. referencedClasses: [],
  48170. messageSends: ["~=", "lookupHierarchyRoot"]
  48171. }),
  48172. $globals.TestCase.a$cls);
  48173. $core.addMethod(
  48174. $core.method({
  48175. selector: "testSelectors",
  48176. protocol: "accessing",
  48177. fn: function (){
  48178. var self=this,$self=this;
  48179. return $core.withContext(function($ctx1) {
  48180. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  48181. return $core.withContext(function($ctx2) {
  48182. return $recv(each)._match_("^test");
  48183. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48184. }));
  48185. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.a$cls)});
  48186. },
  48187. args: [],
  48188. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  48189. referencedClasses: [],
  48190. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  48191. }),
  48192. $globals.TestCase.a$cls);
  48193. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  48194. $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).";
  48195. $core.addMethod(
  48196. $core.method({
  48197. selector: "execute:",
  48198. protocol: "running",
  48199. fn: function (aBlock){
  48200. var self=this,$self=this;
  48201. var failed;
  48202. return $core.withContext(function($ctx1) {
  48203. var $1,$2;
  48204. $recv($self.testCase)._context_(self);
  48205. $ctx1.sendIdx["context:"]=1;
  48206. $recv((function(){
  48207. return $core.withContext(function($ctx2) {
  48208. failed=true;
  48209. $recv(aBlock)._value();
  48210. failed=false;
  48211. return failed;
  48212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48213. }))._ensure_((function(){
  48214. return $core.withContext(function($ctx2) {
  48215. $recv($self.testCase)._context_(nil);
  48216. $1=$recv(failed)._and_((function(){
  48217. return $core.withContext(function($ctx3) {
  48218. return $recv($self.testCase)._isAsync();
  48219. $ctx3.sendIdx["isAsync"]=1;
  48220. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  48221. }));
  48222. if($core.assert($1)){
  48223. $recv($self.testCase)._finished();
  48224. }
  48225. $2=$recv($self.testCase)._isAsync();
  48226. if(!$core.assert($2)){
  48227. return $recv($self.testCase)._tearDown();
  48228. }
  48229. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48230. }));
  48231. return self;
  48232. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  48233. },
  48234. args: ["aBlock"],
  48235. 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 ] ]",
  48236. referencedClasses: [],
  48237. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  48238. }),
  48239. $globals.TestContext);
  48240. $core.addMethod(
  48241. $core.method({
  48242. selector: "start",
  48243. protocol: "running",
  48244. fn: function (){
  48245. var self=this,$self=this;
  48246. return $core.withContext(function($ctx1) {
  48247. $self._execute_((function(){
  48248. return $core.withContext(function($ctx2) {
  48249. $recv($self.testCase)._setUp();
  48250. return $recv($self.testCase)._performTest();
  48251. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48252. }));
  48253. return self;
  48254. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  48255. },
  48256. args: [],
  48257. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  48258. referencedClasses: [],
  48259. messageSends: ["execute:", "setUp", "performTest"]
  48260. }),
  48261. $globals.TestContext);
  48262. $core.addMethod(
  48263. $core.method({
  48264. selector: "testCase:",
  48265. protocol: "accessing",
  48266. fn: function (aTestCase){
  48267. var self=this,$self=this;
  48268. $self.testCase=aTestCase;
  48269. return self;
  48270. },
  48271. args: ["aTestCase"],
  48272. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  48273. referencedClasses: [],
  48274. messageSends: []
  48275. }),
  48276. $globals.TestContext);
  48277. $core.addMethod(
  48278. $core.method({
  48279. selector: "testCase:",
  48280. protocol: "instance creation",
  48281. fn: function (aTestCase){
  48282. var self=this,$self=this;
  48283. return $core.withContext(function($ctx1) {
  48284. var $1;
  48285. $1=$self._new();
  48286. $recv($1)._testCase_(aTestCase);
  48287. return $recv($1)._yourself();
  48288. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.a$cls)});
  48289. },
  48290. args: ["aTestCase"],
  48291. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  48292. referencedClasses: [],
  48293. messageSends: ["testCase:", "new", "yourself"]
  48294. }),
  48295. $globals.TestContext.a$cls);
  48296. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  48297. $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`.";
  48298. $core.addMethod(
  48299. $core.method({
  48300. selector: "execute:",
  48301. protocol: "running",
  48302. fn: function (aBlock){
  48303. var self=this,$self=this;
  48304. return $core.withContext(function($ctx1) {
  48305. var $1;
  48306. $recv((function(){
  48307. return $core.withContext(function($ctx2) {
  48308. return $self._withErrorReporting_((function(){
  48309. return $core.withContext(function($ctx3) {
  48310. return (
  48311. $ctx3.supercall = true,
  48312. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
  48313. $ctx3.supercall = false;
  48314. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48315. }));
  48316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48317. }))._ensure_((function(){
  48318. return $core.withContext(function($ctx2) {
  48319. $1=$recv($self.testCase)._isAsync();
  48320. if(!$core.assert($1)){
  48321. $recv($self.result)._increaseRuns();
  48322. return $recv($self.finished)._value();
  48323. }
  48324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48325. }));
  48326. return self;
  48327. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48328. },
  48329. args: ["aBlock"],
  48330. 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 ] ]",
  48331. referencedClasses: [],
  48332. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  48333. }),
  48334. $globals.ReportingTestContext);
  48335. $core.addMethod(
  48336. $core.method({
  48337. selector: "finished:",
  48338. protocol: "accessing",
  48339. fn: function (aBlock){
  48340. var self=this,$self=this;
  48341. $self.finished=aBlock;
  48342. return self;
  48343. },
  48344. args: ["aBlock"],
  48345. source: "finished: aBlock\x0a\x09finished := aBlock",
  48346. referencedClasses: [],
  48347. messageSends: []
  48348. }),
  48349. $globals.ReportingTestContext);
  48350. $core.addMethod(
  48351. $core.method({
  48352. selector: "result:",
  48353. protocol: "accessing",
  48354. fn: function (aTestResult){
  48355. var self=this,$self=this;
  48356. $self.result=aTestResult;
  48357. return self;
  48358. },
  48359. args: ["aTestResult"],
  48360. source: "result: aTestResult\x0a\x09result := aTestResult",
  48361. referencedClasses: [],
  48362. messageSends: []
  48363. }),
  48364. $globals.ReportingTestContext);
  48365. $core.addMethod(
  48366. $core.method({
  48367. selector: "withErrorReporting:",
  48368. protocol: "private",
  48369. fn: function (aBlock){
  48370. var self=this,$self=this;
  48371. return $core.withContext(function($ctx1) {
  48372. $recv((function(){
  48373. return $core.withContext(function($ctx2) {
  48374. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  48375. return $core.withContext(function($ctx3) {
  48376. return $recv($self.result)._addFailure_($self.testCase);
  48377. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  48378. }));
  48379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48380. }))._on_do_($globals.Error,(function(ex){
  48381. return $core.withContext(function($ctx2) {
  48382. return $recv($self.result)._addError_($self.testCase);
  48383. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  48384. }));
  48385. $ctx1.sendIdx["on:do:"]=1;
  48386. return self;
  48387. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48388. },
  48389. args: ["aBlock"],
  48390. 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 ]",
  48391. referencedClasses: ["TestFailure", "Error"],
  48392. messageSends: ["on:do:", "addFailure:", "addError:"]
  48393. }),
  48394. $globals.ReportingTestContext);
  48395. $core.addMethod(
  48396. $core.method({
  48397. selector: "testCase:result:finished:",
  48398. protocol: "instance creation",
  48399. fn: function (aTestCase,aTestResult,aBlock){
  48400. var self=this,$self=this;
  48401. return $core.withContext(function($ctx1) {
  48402. var $1;
  48403. $1=(
  48404. $ctx1.supercall = true,
  48405. ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
  48406. $ctx1.supercall = false;
  48407. $recv($1)._result_(aTestResult);
  48408. $recv($1)._finished_(aBlock);
  48409. return $recv($1)._yourself();
  48410. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.a$cls)});
  48411. },
  48412. args: ["aTestCase", "aTestResult", "aBlock"],
  48413. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  48414. referencedClasses: [],
  48415. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  48416. }),
  48417. $globals.ReportingTestContext.a$cls);
  48418. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  48419. $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.";
  48420. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  48421. $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";
  48422. $core.addMethod(
  48423. $core.method({
  48424. selector: "addError:",
  48425. protocol: "accessing",
  48426. fn: function (anError){
  48427. var self=this,$self=this;
  48428. return $core.withContext(function($ctx1) {
  48429. $recv($self._errors())._add_(anError);
  48430. return self;
  48431. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  48432. },
  48433. args: ["anError"],
  48434. source: "addError: anError\x0a\x09self errors add: anError",
  48435. referencedClasses: [],
  48436. messageSends: ["add:", "errors"]
  48437. }),
  48438. $globals.TestResult);
  48439. $core.addMethod(
  48440. $core.method({
  48441. selector: "addFailure:",
  48442. protocol: "accessing",
  48443. fn: function (aFailure){
  48444. var self=this,$self=this;
  48445. return $core.withContext(function($ctx1) {
  48446. $recv($self._failures())._add_(aFailure);
  48447. return self;
  48448. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  48449. },
  48450. args: ["aFailure"],
  48451. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  48452. referencedClasses: [],
  48453. messageSends: ["add:", "failures"]
  48454. }),
  48455. $globals.TestResult);
  48456. $core.addMethod(
  48457. $core.method({
  48458. selector: "errors",
  48459. protocol: "accessing",
  48460. fn: function (){
  48461. var self=this,$self=this;
  48462. return $self.errors;
  48463. },
  48464. args: [],
  48465. source: "errors\x0a\x09^ errors",
  48466. referencedClasses: [],
  48467. messageSends: []
  48468. }),
  48469. $globals.TestResult);
  48470. $core.addMethod(
  48471. $core.method({
  48472. selector: "failures",
  48473. protocol: "accessing",
  48474. fn: function (){
  48475. var self=this,$self=this;
  48476. return $self.failures;
  48477. },
  48478. args: [],
  48479. source: "failures\x0a\x09^ failures",
  48480. referencedClasses: [],
  48481. messageSends: []
  48482. }),
  48483. $globals.TestResult);
  48484. $core.addMethod(
  48485. $core.method({
  48486. selector: "increaseRuns",
  48487. protocol: "accessing",
  48488. fn: function (){
  48489. var self=this,$self=this;
  48490. return $core.withContext(function($ctx1) {
  48491. $self.runs=$recv($self.runs).__plus((1));
  48492. return self;
  48493. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  48494. },
  48495. args: [],
  48496. source: "increaseRuns\x0a\x09runs := runs + 1",
  48497. referencedClasses: [],
  48498. messageSends: ["+"]
  48499. }),
  48500. $globals.TestResult);
  48501. $core.addMethod(
  48502. $core.method({
  48503. selector: "initialize",
  48504. protocol: "initialization",
  48505. fn: function (){
  48506. var self=this,$self=this;
  48507. return $core.withContext(function($ctx1) {
  48508. (
  48509. $ctx1.supercall = true,
  48510. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48511. $ctx1.supercall = false;
  48512. $self.timestamp=$recv($globals.Date)._now();
  48513. $self.runs=(0);
  48514. $self.errors=$recv($globals.Array)._new();
  48515. $ctx1.sendIdx["new"]=1;
  48516. $self.failures=$recv($globals.Array)._new();
  48517. $self.total=(0);
  48518. return self;
  48519. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  48520. },
  48521. args: [],
  48522. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  48523. referencedClasses: ["Date", "Array"],
  48524. messageSends: ["initialize", "now", "new"]
  48525. }),
  48526. $globals.TestResult);
  48527. $core.addMethod(
  48528. $core.method({
  48529. selector: "nextRunDo:",
  48530. protocol: "running",
  48531. fn: function (aBlock){
  48532. var self=this,$self=this;
  48533. return $core.withContext(function($ctx1) {
  48534. var $2,$1;
  48535. $2=$self._runs();
  48536. $ctx1.sendIdx["runs"]=1;
  48537. $1=$recv($2).__eq_eq($self._total());
  48538. if(!$core.assert($1)){
  48539. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  48540. }
  48541. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  48542. },
  48543. args: ["aBlock"],
  48544. 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 ]",
  48545. referencedClasses: [],
  48546. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  48547. }),
  48548. $globals.TestResult);
  48549. $core.addMethod(
  48550. $core.method({
  48551. selector: "runCase:",
  48552. protocol: "running",
  48553. fn: function (aTestCase){
  48554. var self=this,$self=this;
  48555. return $core.withContext(function($ctx1) {
  48556. $recv((function(){
  48557. return $core.withContext(function($ctx2) {
  48558. return $recv((function(){
  48559. return $core.withContext(function($ctx3) {
  48560. $self._increaseRuns();
  48561. return $recv(aTestCase)._runCase();
  48562. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48563. }))._on_do_($globals.TestFailure,(function(ex){
  48564. return $core.withContext(function($ctx3) {
  48565. return $self._addFailure_(aTestCase);
  48566. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  48567. }));
  48568. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48569. }))._on_do_($globals.Error,(function(ex){
  48570. return $core.withContext(function($ctx2) {
  48571. return $self._addError_(aTestCase);
  48572. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  48573. }));
  48574. $ctx1.sendIdx["on:do:"]=1;
  48575. return self;
  48576. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  48577. },
  48578. args: ["aTestCase"],
  48579. 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 ]",
  48580. referencedClasses: ["TestFailure", "Error"],
  48581. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  48582. }),
  48583. $globals.TestResult);
  48584. $core.addMethod(
  48585. $core.method({
  48586. selector: "runs",
  48587. protocol: "accessing",
  48588. fn: function (){
  48589. var self=this,$self=this;
  48590. return $self.runs;
  48591. },
  48592. args: [],
  48593. source: "runs\x0a\x09^ runs",
  48594. referencedClasses: [],
  48595. messageSends: []
  48596. }),
  48597. $globals.TestResult);
  48598. $core.addMethod(
  48599. $core.method({
  48600. selector: "status",
  48601. protocol: "accessing",
  48602. fn: function (){
  48603. var self=this,$self=this;
  48604. return $core.withContext(function($ctx1) {
  48605. var $1;
  48606. $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  48607. return "error";
  48608. }),(function(){
  48609. return $core.withContext(function($ctx2) {
  48610. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  48611. return "failure";
  48612. }),(function(){
  48613. return "success";
  48614. }));
  48615. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48616. }));
  48617. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  48618. return $1;
  48619. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  48620. },
  48621. args: [],
  48622. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  48623. referencedClasses: [],
  48624. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  48625. }),
  48626. $globals.TestResult);
  48627. $core.addMethod(
  48628. $core.method({
  48629. selector: "timestamp",
  48630. protocol: "accessing",
  48631. fn: function (){
  48632. var self=this,$self=this;
  48633. return $self.timestamp;
  48634. },
  48635. args: [],
  48636. source: "timestamp\x0a\x09^ timestamp",
  48637. referencedClasses: [],
  48638. messageSends: []
  48639. }),
  48640. $globals.TestResult);
  48641. $core.addMethod(
  48642. $core.method({
  48643. selector: "total",
  48644. protocol: "accessing",
  48645. fn: function (){
  48646. var self=this,$self=this;
  48647. return $self.total;
  48648. },
  48649. args: [],
  48650. source: "total\x0a\x09^ total",
  48651. referencedClasses: [],
  48652. messageSends: []
  48653. }),
  48654. $globals.TestResult);
  48655. $core.addMethod(
  48656. $core.method({
  48657. selector: "total:",
  48658. protocol: "accessing",
  48659. fn: function (aNumber){
  48660. var self=this,$self=this;
  48661. $self.total=aNumber;
  48662. return self;
  48663. },
  48664. args: ["aNumber"],
  48665. source: "total: aNumber\x0a\x09total := aNumber",
  48666. referencedClasses: [],
  48667. messageSends: []
  48668. }),
  48669. $globals.TestResult);
  48670. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  48671. $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`.";
  48672. $core.addMethod(
  48673. $core.method({
  48674. selector: "announcer",
  48675. protocol: "accessing",
  48676. fn: function (){
  48677. var self=this,$self=this;
  48678. return $self.announcer;
  48679. },
  48680. args: [],
  48681. source: "announcer\x0a\x09^ announcer",
  48682. referencedClasses: [],
  48683. messageSends: []
  48684. }),
  48685. $globals.TestSuiteRunner);
  48686. $core.addMethod(
  48687. $core.method({
  48688. selector: "contextOf:",
  48689. protocol: "private",
  48690. fn: function (anInteger){
  48691. var self=this,$self=this;
  48692. return $core.withContext(function($ctx1) {
  48693. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self.suite)._at_(anInteger),$self.result,(function(){
  48694. return $core.withContext(function($ctx2) {
  48695. return $self._resume();
  48696. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48697. }));
  48698. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  48699. },
  48700. args: ["anInteger"],
  48701. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  48702. referencedClasses: ["ReportingTestContext"],
  48703. messageSends: ["testCase:result:finished:", "at:", "resume"]
  48704. }),
  48705. $globals.TestSuiteRunner);
  48706. $core.addMethod(
  48707. $core.method({
  48708. selector: "initialize",
  48709. protocol: "initialization",
  48710. fn: function (){
  48711. var self=this,$self=this;
  48712. return $core.withContext(function($ctx1) {
  48713. var $1;
  48714. (
  48715. $ctx1.supercall = true,
  48716. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48717. $ctx1.supercall = false;
  48718. $self.announcer=$recv($globals.Announcer)._new();
  48719. $ctx1.sendIdx["new"]=1;
  48720. $self.result=$recv($globals.TestResult)._new();
  48721. $self.runNextTest=(function(){
  48722. var runs;
  48723. return $core.withContext(function($ctx2) {
  48724. runs=$recv($self.result)._runs();
  48725. $1=$recv(runs).__lt($recv($self.result)._total());
  48726. if($core.assert($1)){
  48727. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  48728. }
  48729. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  48730. });
  48731. return self;
  48732. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  48733. },
  48734. args: [],
  48735. 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 ] ].",
  48736. referencedClasses: ["Announcer", "TestResult"],
  48737. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  48738. }),
  48739. $globals.TestSuiteRunner);
  48740. $core.addMethod(
  48741. $core.method({
  48742. selector: "result",
  48743. protocol: "accessing",
  48744. fn: function (){
  48745. var self=this,$self=this;
  48746. return $self.result;
  48747. },
  48748. args: [],
  48749. source: "result\x0a\x09^ result",
  48750. referencedClasses: [],
  48751. messageSends: []
  48752. }),
  48753. $globals.TestSuiteRunner);
  48754. $core.addMethod(
  48755. $core.method({
  48756. selector: "resume",
  48757. protocol: "actions",
  48758. fn: function (){
  48759. var self=this,$self=this;
  48760. return $core.withContext(function($ctx1) {
  48761. $recv($self.runNextTest)._fork();
  48762. $recv($self.announcer)._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self.result));
  48763. return self;
  48764. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  48765. },
  48766. args: [],
  48767. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  48768. referencedClasses: ["ResultAnnouncement"],
  48769. messageSends: ["fork", "announce:", "result:", "new"]
  48770. }),
  48771. $globals.TestSuiteRunner);
  48772. $core.addMethod(
  48773. $core.method({
  48774. selector: "run",
  48775. protocol: "actions",
  48776. fn: function (){
  48777. var self=this,$self=this;
  48778. return $core.withContext(function($ctx1) {
  48779. $recv($self.result)._total_($recv($self.suite)._size());
  48780. $self._resume();
  48781. return self;
  48782. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  48783. },
  48784. args: [],
  48785. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  48786. referencedClasses: [],
  48787. messageSends: ["total:", "size", "resume"]
  48788. }),
  48789. $globals.TestSuiteRunner);
  48790. $core.addMethod(
  48791. $core.method({
  48792. selector: "suite:",
  48793. protocol: "accessing",
  48794. fn: function (aCollection){
  48795. var self=this,$self=this;
  48796. $self.suite=aCollection;
  48797. return self;
  48798. },
  48799. args: ["aCollection"],
  48800. source: "suite: aCollection\x0a\x09suite := aCollection",
  48801. referencedClasses: [],
  48802. messageSends: []
  48803. }),
  48804. $globals.TestSuiteRunner);
  48805. $core.addMethod(
  48806. $core.method({
  48807. selector: "new",
  48808. protocol: "instance creation",
  48809. fn: function (){
  48810. var self=this,$self=this;
  48811. return $core.withContext(function($ctx1) {
  48812. $self._shouldNotImplement();
  48813. return self;
  48814. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.a$cls)});
  48815. },
  48816. args: [],
  48817. source: "new\x0a\x09self shouldNotImplement",
  48818. referencedClasses: [],
  48819. messageSends: ["shouldNotImplement"]
  48820. }),
  48821. $globals.TestSuiteRunner.a$cls);
  48822. $core.addMethod(
  48823. $core.method({
  48824. selector: "on:",
  48825. protocol: "instance creation",
  48826. fn: function (aCollection){
  48827. var self=this,$self=this;
  48828. return $core.withContext(function($ctx1) {
  48829. var $1;
  48830. $1=(
  48831. $ctx1.supercall = true,
  48832. ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  48833. $ctx1.supercall = false;
  48834. return $recv($1)._suite_(aCollection);
  48835. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.a$cls)});
  48836. },
  48837. args: ["aCollection"],
  48838. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  48839. referencedClasses: [],
  48840. messageSends: ["suite:", "new"]
  48841. }),
  48842. $globals.TestSuiteRunner.a$cls);
  48843. $core.addMethod(
  48844. $core.method({
  48845. selector: "isTestPackage",
  48846. protocol: "*SUnit",
  48847. fn: function (){
  48848. var self=this,$self=this;
  48849. return $core.withContext(function($ctx1) {
  48850. return $recv($self._classes())._anySatisfy_((function(each){
  48851. return $core.withContext(function($ctx2) {
  48852. return $recv(each)._isTestClass();
  48853. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48854. }));
  48855. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  48856. },
  48857. args: [],
  48858. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  48859. referencedClasses: [],
  48860. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  48861. }),
  48862. $globals.Package);
  48863. $core.addMethod(
  48864. $core.method({
  48865. selector: "isTestClass",
  48866. protocol: "*SUnit",
  48867. fn: function (){
  48868. var self=this,$self=this;
  48869. return false;
  48870. },
  48871. args: [],
  48872. source: "isTestClass\x0a\x09^ false",
  48873. referencedClasses: [],
  48874. messageSends: []
  48875. }),
  48876. $globals.TBehaviorDefaults);
  48877. });
  48878. define('amber/core/Compiler-Tests',["amber/boot", "require", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  48879. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48880. var $pkg = $core.addPackage("Compiler-Tests");
  48881. $pkg.innerEval = function (expr) { return eval(expr); };
  48882. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  48883. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  48884. $core.addMethod(
  48885. $core.method({
  48886. selector: "parse:forClass:",
  48887. protocol: "parsing",
  48888. fn: function (aString,aClass){
  48889. var self=this,$self=this;
  48890. return $core.withContext(function($ctx1) {
  48891. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_(aString,aClass,"test");
  48892. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  48893. },
  48894. args: ["aString", "aClass"],
  48895. source: "parse: aString forClass: aClass\x0a\x09^ Compiler new\x0a\x09\x09ast: aString\x0a\x09\x09forClass: aClass\x0a\x09\x09protocol: 'test'",
  48896. referencedClasses: ["Compiler"],
  48897. messageSends: ["ast:forClass:protocol:", "new"]
  48898. }),
  48899. $globals.ASTParsingTest);
  48900. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48901. $core.addMethod(
  48902. $core.method({
  48903. selector: "astPCNodeVisitor",
  48904. protocol: "factory",
  48905. fn: function (){
  48906. var self=this,$self=this;
  48907. return $core.withContext(function($ctx1) {
  48908. var $1;
  48909. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48910. $recv($1)._index_((0));
  48911. return $recv($1)._yourself();
  48912. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  48913. },
  48914. args: [],
  48915. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48916. referencedClasses: ["ASTPCNodeVisitor"],
  48917. messageSends: ["index:", "new", "yourself"]
  48918. }),
  48919. $globals.ASTPCNodeVisitorTest);
  48920. $core.addMethod(
  48921. $core.method({
  48922. selector: "astPCNodeVisitorForSelector:",
  48923. protocol: "factory",
  48924. fn: function (aString){
  48925. var self=this,$self=this;
  48926. return $core.withContext(function($ctx1) {
  48927. var $1;
  48928. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48929. $recv($1)._selector_(aString);
  48930. $recv($1)._index_((0));
  48931. return $recv($1)._yourself();
  48932. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  48933. },
  48934. args: ["aString"],
  48935. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48936. referencedClasses: ["ASTPCNodeVisitor"],
  48937. messageSends: ["selector:", "new", "index:", "yourself"]
  48938. }),
  48939. $globals.ASTPCNodeVisitorTest);
  48940. $core.addMethod(
  48941. $core.method({
  48942. selector: "testJSStatementNode",
  48943. protocol: "tests",
  48944. fn: function (){
  48945. var self=this,$self=this;
  48946. var ast,visitor;
  48947. return $core.withContext(function($ctx1) {
  48948. var $3,$2,$1;
  48949. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  48950. $3=$self._astPCNodeVisitor();
  48951. $recv($3)._visit_(ast);
  48952. $2=$recv($3)._currentNode();
  48953. $1=$recv($2)._isJSStatementNode();
  48954. $self._assert_($1);
  48955. return self;
  48956. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48957. },
  48958. args: [],
  48959. 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",
  48960. referencedClasses: ["Object"],
  48961. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48962. }),
  48963. $globals.ASTPCNodeVisitorTest);
  48964. $core.addMethod(
  48965. $core.method({
  48966. selector: "testMessageSend",
  48967. protocol: "tests",
  48968. fn: function (){
  48969. var self=this,$self=this;
  48970. var ast;
  48971. return $core.withContext(function($ctx1) {
  48972. var $3,$2,$1;
  48973. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  48974. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48975. $recv($3)._visit_(ast);
  48976. $2=$recv($3)._currentNode();
  48977. $1=$recv($2)._selector();
  48978. $self._assert_equals_($1,"yourself");
  48979. return self;
  48980. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48981. },
  48982. args: [],
  48983. 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'",
  48984. referencedClasses: ["Object"],
  48985. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48986. }),
  48987. $globals.ASTPCNodeVisitorTest);
  48988. $core.addMethod(
  48989. $core.method({
  48990. selector: "testMessageSendWithBlocks",
  48991. protocol: "tests",
  48992. fn: function (){
  48993. var self=this,$self=this;
  48994. var ast;
  48995. return $core.withContext(function($ctx1) {
  48996. var $3,$2,$1;
  48997. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  48998. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48999. $recv($3)._visit_(ast);
  49000. $2=$recv($3)._currentNode();
  49001. $1=$recv($2)._selector();
  49002. $self._assert_equals_($1,"yourself");
  49003. return self;
  49004. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  49005. },
  49006. args: [],
  49007. 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'",
  49008. referencedClasses: ["Object"],
  49009. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  49010. }),
  49011. $globals.ASTPCNodeVisitorTest);
  49012. $core.addMethod(
  49013. $core.method({
  49014. selector: "testMessageSendWithInlining",
  49015. protocol: "tests",
  49016. fn: function (){
  49017. var self=this,$self=this;
  49018. var ast;
  49019. return $core.withContext(function($ctx1) {
  49020. var $3,$4,$2,$1,$7,$6,$5;
  49021. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  49022. $ctx1.sendIdx["parse:forClass:"]=1;
  49023. $3=$self._astPCNodeVisitorForSelector_("yourself");
  49024. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  49025. $recv($3)._visit_(ast);
  49026. $ctx1.sendIdx["visit:"]=1;
  49027. $4=$recv($3)._currentNode();
  49028. $ctx1.sendIdx["currentNode"]=1;
  49029. $2=$4;
  49030. $1=$recv($2)._selector();
  49031. $ctx1.sendIdx["selector"]=1;
  49032. $self._assert_equals_($1,"yourself");
  49033. $ctx1.sendIdx["assert:equals:"]=1;
  49034. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  49035. $7=$self._astPCNodeVisitorForSelector_("asBoolean");
  49036. $recv($7)._visit_(ast);
  49037. $6=$recv($7)._currentNode();
  49038. $5=$recv($6)._selector();
  49039. $self._assert_equals_($5,"asBoolean");
  49040. return self;
  49041. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  49042. },
  49043. args: [],
  49044. 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'",
  49045. referencedClasses: ["Object"],
  49046. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  49047. }),
  49048. $globals.ASTPCNodeVisitorTest);
  49049. $core.addMethod(
  49050. $core.method({
  49051. selector: "testNoMessageSend",
  49052. protocol: "tests",
  49053. fn: function (){
  49054. var self=this,$self=this;
  49055. var ast;
  49056. return $core.withContext(function($ctx1) {
  49057. var $3,$2,$1;
  49058. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  49059. $3=$self._astPCNodeVisitor();
  49060. $recv($3)._visit_(ast);
  49061. $2=$recv($3)._currentNode();
  49062. $1=$recv($2)._isNil();
  49063. $self._assert_($1);
  49064. return self;
  49065. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  49066. },
  49067. args: [],
  49068. 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",
  49069. referencedClasses: ["Object"],
  49070. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  49071. }),
  49072. $globals.ASTPCNodeVisitorTest);
  49073. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  49074. $core.addMethod(
  49075. $core.method({
  49076. selector: "testNodeAtPosition",
  49077. protocol: "tests",
  49078. fn: function (){
  49079. var self=this,$self=this;
  49080. var node;
  49081. return $core.withContext(function($ctx1) {
  49082. var $3,$4,$2,$1,$7,$8,$6,$5;
  49083. node=$self._parse_forClass_("yourself\x0a\x09^ self",$globals.Object);
  49084. $ctx1.sendIdx["parse:forClass:"]=1;
  49085. $3=node;
  49086. $4=(2).__at((4));
  49087. $ctx1.sendIdx["@"]=1;
  49088. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  49089. return nil;
  49090. }));
  49091. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  49092. $1=$recv($2)._source();
  49093. $self._assert_equals_($1,"self");
  49094. $ctx1.sendIdx["assert:equals:"]=1;
  49095. node=$self._parse_forClass_("foo\x0a\x09true ifTrue: [ 1 ]",$globals.Object);
  49096. $ctx1.sendIdx["parse:forClass:"]=2;
  49097. $7=node;
  49098. $8=(2).__at((7));
  49099. $ctx1.sendIdx["@"]=2;
  49100. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  49101. return nil;
  49102. }));
  49103. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  49104. $5=$recv($6)._selector();
  49105. $ctx1.sendIdx["selector"]=1;
  49106. $self._assert_equals_($5,"ifTrue:");
  49107. $ctx1.sendIdx["assert:equals:"]=2;
  49108. node=$self._parse_forClass_("foo\x0a\x09self foo; bar; baz",$globals.Object);
  49109. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  49110. return nil;
  49111. })))._selector(),"foo");
  49112. return self;
  49113. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  49114. },
  49115. args: [],
  49116. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  49117. referencedClasses: ["Object"],
  49118. messageSends: ["parse:forClass:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  49119. }),
  49120. $globals.ASTPositionTest);
  49121. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  49122. $core.addMethod(
  49123. $core.method({
  49124. selector: "codeGeneratorClass",
  49125. protocol: "accessing",
  49126. fn: function (){
  49127. var self=this,$self=this;
  49128. return $globals.CodeGenerator;
  49129. },
  49130. args: [],
  49131. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  49132. referencedClasses: ["CodeGenerator"],
  49133. messageSends: []
  49134. }),
  49135. $globals.CodeGeneratorTest);
  49136. $core.addMethod(
  49137. $core.method({
  49138. selector: "compiler",
  49139. protocol: "factory",
  49140. fn: function (){
  49141. var self=this,$self=this;
  49142. return $core.withContext(function($ctx1) {
  49143. var $1;
  49144. $1=$recv($globals.Compiler)._new();
  49145. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  49146. return $recv($1)._yourself();
  49147. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  49148. },
  49149. args: [],
  49150. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  49151. referencedClasses: ["Compiler"],
  49152. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  49153. }),
  49154. $globals.CodeGeneratorTest);
  49155. $core.addMethod(
  49156. $core.method({
  49157. selector: "setUp",
  49158. protocol: "initialization",
  49159. fn: function (){
  49160. var self=this,$self=this;
  49161. return $core.withContext(function($ctx1) {
  49162. $self.receiver=$recv($globals.DoIt)._new();
  49163. return self;
  49164. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  49165. },
  49166. args: [],
  49167. source: "setUp\x0a\x09receiver := DoIt new",
  49168. referencedClasses: ["DoIt"],
  49169. messageSends: ["new"]
  49170. }),
  49171. $globals.CodeGeneratorTest);
  49172. $core.addMethod(
  49173. $core.method({
  49174. selector: "should:receiver:raise:",
  49175. protocol: "testing",
  49176. fn: function (aString,anObject,anErrorClass){
  49177. var self=this,$self=this;
  49178. var method,result;
  49179. return $core.withContext(function($ctx1) {
  49180. var $1,$2,$3,$receiver;
  49181. $self.receiver=anObject;
  49182. $recv((function(){
  49183. return $core.withContext(function($ctx2) {
  49184. return $self._should_raise_((function(){
  49185. return $core.withContext(function($ctx3) {
  49186. $1=$self._compiler();
  49187. $2=$recv(anObject)._class();
  49188. $ctx3.sendIdx["class"]=1;
  49189. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  49190. return $recv($self.receiver)._perform_($recv(method)._selector());
  49191. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49192. }),anErrorClass);
  49193. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49194. }))._ensure_((function(){
  49195. return $core.withContext(function($ctx2) {
  49196. $3=method;
  49197. if(($receiver = $3) == null || $receiver.a$nil){
  49198. return $3;
  49199. } else {
  49200. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  49201. }
  49202. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49203. }));
  49204. return self;
  49205. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  49206. },
  49207. args: ["aString", "anObject", "anErrorClass"],
  49208. 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 ] ]",
  49209. referencedClasses: [],
  49210. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  49211. }),
  49212. $globals.CodeGeneratorTest);
  49213. $core.addMethod(
  49214. $core.method({
  49215. selector: "should:receiver:return:",
  49216. protocol: "testing",
  49217. fn: function (aString,anObject,aResult){
  49218. var self=this,$self=this;
  49219. var method,result;
  49220. return $core.withContext(function($ctx1) {
  49221. var $1,$2;
  49222. $self.receiver=anObject;
  49223. $1=$self._compiler();
  49224. $2=$recv(anObject)._class();
  49225. $ctx1.sendIdx["class"]=1;
  49226. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  49227. result=$recv($self.receiver)._perform_($recv(method)._selector());
  49228. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  49229. $self._assert_equals_(aResult,result);
  49230. return self;
  49231. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  49232. },
  49233. args: ["aString", "anObject", "aResult"],
  49234. 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",
  49235. referencedClasses: [],
  49236. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  49237. }),
  49238. $globals.CodeGeneratorTest);
  49239. $core.addMethod(
  49240. $core.method({
  49241. selector: "should:return:",
  49242. protocol: "testing",
  49243. fn: function (aString,anObject){
  49244. var self=this,$self=this;
  49245. return $core.withContext(function($ctx1) {
  49246. return $self._should_receiver_return_(aString,$self.receiver,anObject);
  49247. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  49248. },
  49249. args: ["aString", "anObject"],
  49250. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  49251. referencedClasses: [],
  49252. messageSends: ["should:receiver:return:"]
  49253. }),
  49254. $globals.CodeGeneratorTest);
  49255. $core.addMethod(
  49256. $core.method({
  49257. selector: "tearDown",
  49258. protocol: "initialization",
  49259. fn: function (){
  49260. var self=this,$self=this;
  49261. return self;
  49262. },
  49263. args: [],
  49264. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  49265. referencedClasses: [],
  49266. messageSends: []
  49267. }),
  49268. $globals.CodeGeneratorTest);
  49269. $core.addMethod(
  49270. $core.method({
  49271. selector: "testAssignment",
  49272. protocol: "tests",
  49273. fn: function (){
  49274. var self=this,$self=this;
  49275. return $core.withContext(function($ctx1) {
  49276. $self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  49277. $ctx1.sendIdx["should:return:"]=1;
  49278. $self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  49279. $ctx1.sendIdx["should:return:"]=2;
  49280. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  49281. return self;
  49282. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  49283. },
  49284. args: [],
  49285. 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",
  49286. referencedClasses: [],
  49287. messageSends: ["should:return:"]
  49288. }),
  49289. $globals.CodeGeneratorTest);
  49290. $core.addMethod(
  49291. $core.method({
  49292. selector: "testBackslashSelectors",
  49293. protocol: "tests",
  49294. fn: function (){
  49295. var self=this,$self=this;
  49296. return $core.withContext(function($ctx1) {
  49297. $self._should_return_("\x5c arg ^ 4",(4));
  49298. $ctx1.sendIdx["should:return:"]=1;
  49299. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  49300. return self;
  49301. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  49302. },
  49303. args: [],
  49304. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  49305. referencedClasses: [],
  49306. messageSends: ["should:return:"]
  49307. }),
  49308. $globals.CodeGeneratorTest);
  49309. $core.addMethod(
  49310. $core.method({
  49311. selector: "testBlockReturn",
  49312. protocol: "tests",
  49313. fn: function (){
  49314. var self=this,$self=this;
  49315. return $core.withContext(function($ctx1) {
  49316. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  49317. $ctx1.sendIdx["should:return:"]=1;
  49318. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  49319. $ctx1.sendIdx["should:return:"]=2;
  49320. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  49321. return self;
  49322. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  49323. },
  49324. args: [],
  49325. 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).",
  49326. referencedClasses: [],
  49327. messageSends: ["should:return:"]
  49328. }),
  49329. $globals.CodeGeneratorTest);
  49330. $core.addMethod(
  49331. $core.method({
  49332. selector: "testCascades",
  49333. protocol: "tests",
  49334. fn: function (){
  49335. var self=this,$self=this;
  49336. return $core.withContext(function($ctx1) {
  49337. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  49338. return self;
  49339. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  49340. },
  49341. args: [],
  49342. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  49343. referencedClasses: [],
  49344. messageSends: ["should:return:"]
  49345. }),
  49346. $globals.CodeGeneratorTest);
  49347. $core.addMethod(
  49348. $core.method({
  49349. selector: "testCascadesInDynamicArray",
  49350. protocol: "tests",
  49351. fn: function (){
  49352. var self=this,$self=this;
  49353. return $core.withContext(function($ctx1) {
  49354. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  49355. return self;
  49356. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  49357. },
  49358. args: [],
  49359. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  49360. referencedClasses: [],
  49361. messageSends: ["should:return:"]
  49362. }),
  49363. $globals.CodeGeneratorTest);
  49364. $core.addMethod(
  49365. $core.method({
  49366. selector: "testCascadesInDynamicDictioary",
  49367. protocol: "tests",
  49368. fn: function (){
  49369. var self=this,$self=this;
  49370. return $core.withContext(function($ctx1) {
  49371. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  49372. return self;
  49373. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  49374. },
  49375. args: [],
  49376. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  49377. referencedClasses: [],
  49378. messageSends: ["should:return:"]
  49379. }),
  49380. $globals.CodeGeneratorTest);
  49381. $core.addMethod(
  49382. $core.method({
  49383. selector: "testCascadesInSend",
  49384. protocol: "tests",
  49385. fn: function (){
  49386. var self=this,$self=this;
  49387. return $core.withContext(function($ctx1) {
  49388. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  49389. return self;
  49390. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  49391. },
  49392. args: [],
  49393. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  49394. referencedClasses: [],
  49395. messageSends: ["should:return:"]
  49396. }),
  49397. $globals.CodeGeneratorTest);
  49398. $core.addMethod(
  49399. $core.method({
  49400. selector: "testCascadesWithInlining",
  49401. protocol: "tests",
  49402. fn: function (){
  49403. var self=this,$self=this;
  49404. return $core.withContext(function($ctx1) {
  49405. $self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  49406. $ctx1.sendIdx["should:return:"]=1;
  49407. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  49408. return self;
  49409. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  49410. },
  49411. args: [],
  49412. 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",
  49413. referencedClasses: [],
  49414. messageSends: ["should:return:"]
  49415. }),
  49416. $globals.CodeGeneratorTest);
  49417. $core.addMethod(
  49418. $core.method({
  49419. selector: "testDynamicArrayElementsOrdered",
  49420. protocol: "tests",
  49421. fn: function (){
  49422. var self=this,$self=this;
  49423. return $core.withContext(function($ctx1) {
  49424. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  49425. $ctx1.sendIdx["should:return:"]=1;
  49426. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  49427. return self;
  49428. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  49429. },
  49430. args: [],
  49431. 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).",
  49432. referencedClasses: [],
  49433. messageSends: ["should:return:"]
  49434. }),
  49435. $globals.CodeGeneratorTest);
  49436. $core.addMethod(
  49437. $core.method({
  49438. selector: "testDynamicDictionaryElementsOrdered",
  49439. protocol: "tests",
  49440. fn: function (){
  49441. var self=this,$self=this;
  49442. return $core.withContext(function($ctx1) {
  49443. $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)]));
  49444. return self;
  49445. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  49446. },
  49447. args: [],
  49448. 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}.",
  49449. referencedClasses: [],
  49450. messageSends: ["should:return:"]
  49451. }),
  49452. $globals.CodeGeneratorTest);
  49453. $core.addMethod(
  49454. $core.method({
  49455. selector: "testDynamicDictionaryWithMoreArrows",
  49456. protocol: "tests",
  49457. fn: function (){
  49458. var self=this,$self=this;
  49459. return $core.withContext(function($ctx1) {
  49460. var $2,$1;
  49461. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  49462. $ctx1.sendIdx["->"]=1;
  49463. $1=$recv($globals.HashedCollection)._with_($2);
  49464. $self._should_return_("foo ^ #{1->2->3}",$1);
  49465. return self;
  49466. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  49467. },
  49468. args: [],
  49469. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  49470. referencedClasses: ["HashedCollection"],
  49471. messageSends: ["should:return:", "with:", "->"]
  49472. }),
  49473. $globals.CodeGeneratorTest);
  49474. $core.addMethod(
  49475. $core.method({
  49476. selector: "testGlobalVar",
  49477. protocol: "tests",
  49478. fn: function (){
  49479. var self=this,$self=this;
  49480. return $core.withContext(function($ctx1) {
  49481. $self._should_return_("foo ^ eval class",$globals.BlockClosure);
  49482. $ctx1.sendIdx["should:return:"]=1;
  49483. $self._should_return_("foo ^ Math cos: 0",(1));
  49484. $ctx1.sendIdx["should:return:"]=2;
  49485. $self._should_return_("foo ^ NonExistingVar",nil);
  49486. return self;
  49487. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  49488. },
  49489. args: [],
  49490. 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",
  49491. referencedClasses: ["BlockClosure"],
  49492. messageSends: ["should:return:"]
  49493. }),
  49494. $globals.CodeGeneratorTest);
  49495. $core.addMethod(
  49496. $core.method({
  49497. selector: "testInnerTemporalDependentElementsOrdered",
  49498. protocol: "tests",
  49499. fn: function (){
  49500. var self=this,$self=this;
  49501. return $core.withContext(function($ctx1) {
  49502. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  49503. $2="foo".__minus_gt($globals.Array);
  49504. $ctx1.sendIdx["->"]=1;
  49505. $3="bar".__minus_gt((2));
  49506. $ctx1.sendIdx["->"]=2;
  49507. $1=[$2,$3];
  49508. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  49509. $ctx1.sendIdx["should:return:"]=1;
  49510. $5="foo".__minus_gt($globals.Array);
  49511. $ctx1.sendIdx["->"]=3;
  49512. $6="bar".__minus_gt((2));
  49513. $ctx1.sendIdx["->"]=4;
  49514. $4=[$5,$6];
  49515. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  49516. $ctx1.sendIdx["should:return:"]=2;
  49517. $8="foo".__minus_gt((1));
  49518. $ctx1.sendIdx["->"]=5;
  49519. $9="bar".__minus_gt((2));
  49520. $ctx1.sendIdx["->"]=6;
  49521. $7=[$8,$9];
  49522. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  49523. $ctx1.sendIdx["should:return:"]=3;
  49524. $11="foo".__minus_gt((1));
  49525. $ctx1.sendIdx["->"]=7;
  49526. $10=[$11,"bar".__minus_gt((2))];
  49527. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  49528. $ctx1.sendIdx["should:return:"]=4;
  49529. $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)]));
  49530. return self;
  49531. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  49532. },
  49533. args: [],
  49534. 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}.",
  49535. referencedClasses: ["Array"],
  49536. messageSends: ["should:return:", "->"]
  49537. }),
  49538. $globals.CodeGeneratorTest);
  49539. $core.addMethod(
  49540. $core.method({
  49541. selector: "testLexicalScope",
  49542. protocol: "tests",
  49543. fn: function (){
  49544. var self=this,$self=this;
  49545. return $core.withContext(function($ctx1) {
  49546. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  49547. return self;
  49548. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  49549. },
  49550. args: [],
  49551. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  49552. referencedClasses: [],
  49553. messageSends: ["should:return:"]
  49554. }),
  49555. $globals.CodeGeneratorTest);
  49556. $core.addMethod(
  49557. $core.method({
  49558. selector: "testLiterals",
  49559. protocol: "tests",
  49560. fn: function (){
  49561. var self=this,$self=this;
  49562. return $core.withContext(function($ctx1) {
  49563. $self._should_return_("foo ^ 1",(1));
  49564. $ctx1.sendIdx["should:return:"]=1;
  49565. $self._should_return_("foo ^ 'hello'","hello");
  49566. $ctx1.sendIdx["should:return:"]=2;
  49567. $self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  49568. $ctx1.sendIdx["should:return:"]=3;
  49569. $self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  49570. $ctx1.sendIdx["should:return:"]=4;
  49571. $self._should_return_("foo ^ true",true);
  49572. $ctx1.sendIdx["should:return:"]=5;
  49573. $self._should_return_("foo ^ false",false);
  49574. $ctx1.sendIdx["should:return:"]=6;
  49575. $self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  49576. $ctx1.sendIdx["should:return:"]=7;
  49577. $self._should_return_("foo ^ #hello","hello");
  49578. $ctx1.sendIdx["should:return:"]=8;
  49579. $self._should_return_("foo ^ $h","h");
  49580. $ctx1.sendIdx["should:return:"]=9;
  49581. $self._should_return_("foo ^ -123.456",(-123.456));
  49582. $ctx1.sendIdx["should:return:"]=10;
  49583. $self._should_return_("foo ^ -2.5e4",(-25000));
  49584. return self;
  49585. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  49586. },
  49587. args: [],
  49588. 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.",
  49589. referencedClasses: [],
  49590. messageSends: ["should:return:"]
  49591. }),
  49592. $globals.CodeGeneratorTest);
  49593. $core.addMethod(
  49594. $core.method({
  49595. selector: "testLocalReturn",
  49596. protocol: "tests",
  49597. fn: function (){
  49598. var self=this,$self=this;
  49599. return $core.withContext(function($ctx1) {
  49600. $self._should_return_("foo ^ 1",(1));
  49601. $ctx1.sendIdx["should:return:"]=1;
  49602. $self._should_return_("foo ^ 1 + 1",(2));
  49603. $ctx1.sendIdx["should:return:"]=2;
  49604. $self._should_return_("foo ",$self.receiver);
  49605. $ctx1.sendIdx["should:return:"]=3;
  49606. $self._should_return_("foo self asString",$self.receiver);
  49607. $ctx1.sendIdx["should:return:"]=4;
  49608. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  49609. return self;
  49610. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  49611. },
  49612. args: [],
  49613. 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",
  49614. referencedClasses: [],
  49615. messageSends: ["should:return:"]
  49616. }),
  49617. $globals.CodeGeneratorTest);
  49618. $core.addMethod(
  49619. $core.method({
  49620. selector: "testMessageSends",
  49621. protocol: "tests",
  49622. fn: function (){
  49623. var self=this,$self=this;
  49624. return $core.withContext(function($ctx1) {
  49625. $self._should_return_("foo ^ 1 asString","1");
  49626. $ctx1.sendIdx["should:return:"]=1;
  49627. $self._should_return_("foo ^ 1 + 1",(2));
  49628. $ctx1.sendIdx["should:return:"]=2;
  49629. $self._should_return_("foo ^ 1 + 2 * 3",(9));
  49630. $ctx1.sendIdx["should:return:"]=3;
  49631. $self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  49632. $ctx1.sendIdx["should:return:"]=4;
  49633. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  49634. return self;
  49635. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  49636. },
  49637. args: [],
  49638. 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)",
  49639. referencedClasses: [],
  49640. messageSends: ["should:return:"]
  49641. }),
  49642. $globals.CodeGeneratorTest);
  49643. $core.addMethod(
  49644. $core.method({
  49645. selector: "testMistypedPragmaJSStatement",
  49646. protocol: "tests",
  49647. fn: function (){
  49648. var self=this,$self=this;
  49649. return $core.withContext(function($ctx1) {
  49650. $self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",$self.receiver,$globals.ParseError);
  49651. return self;
  49652. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49653. },
  49654. args: [],
  49655. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  49656. referencedClasses: ["ParseError"],
  49657. messageSends: ["should:receiver:raise:"]
  49658. }),
  49659. $globals.CodeGeneratorTest);
  49660. $core.addMethod(
  49661. $core.method({
  49662. selector: "testMultipleSequences",
  49663. protocol: "tests",
  49664. fn: function (){
  49665. var self=this,$self=this;
  49666. return $core.withContext(function($ctx1) {
  49667. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  49668. return self;
  49669. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  49670. },
  49671. args: [],
  49672. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  49673. referencedClasses: [],
  49674. messageSends: ["should:return:"]
  49675. }),
  49676. $globals.CodeGeneratorTest);
  49677. $core.addMethod(
  49678. $core.method({
  49679. selector: "testMutableLiterals",
  49680. protocol: "tests",
  49681. fn: function (){
  49682. var self=this,$self=this;
  49683. return $core.withContext(function($ctx1) {
  49684. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  49685. return self;
  49686. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  49687. },
  49688. args: [],
  49689. 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)",
  49690. referencedClasses: [],
  49691. messageSends: ["should:return:"]
  49692. }),
  49693. $globals.CodeGeneratorTest);
  49694. $core.addMethod(
  49695. $core.method({
  49696. selector: "testNestedIfTrue",
  49697. protocol: "tests",
  49698. fn: function (){
  49699. var self=this,$self=this;
  49700. return $core.withContext(function($ctx1) {
  49701. $self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  49702. $ctx1.sendIdx["should:return:"]=1;
  49703. $self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  49704. $ctx1.sendIdx["should:return:"]=2;
  49705. $self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  49706. $ctx1.sendIdx["should:return:"]=3;
  49707. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self.receiver);
  49708. return self;
  49709. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  49710. },
  49711. args: [],
  49712. 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.",
  49713. referencedClasses: [],
  49714. messageSends: ["should:return:"]
  49715. }),
  49716. $globals.CodeGeneratorTest);
  49717. $core.addMethod(
  49718. $core.method({
  49719. selector: "testNestedSends",
  49720. protocol: "tests",
  49721. fn: function (){
  49722. var self=this,$self=this;
  49723. return $core.withContext(function($ctx1) {
  49724. $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());
  49725. return self;
  49726. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  49727. },
  49728. args: [],
  49729. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  49730. referencedClasses: ["Point"],
  49731. messageSends: ["should:return:", "asString", "x:y:", "@"]
  49732. }),
  49733. $globals.CodeGeneratorTest);
  49734. $core.addMethod(
  49735. $core.method({
  49736. selector: "testNonLocalReturn",
  49737. protocol: "tests",
  49738. fn: function (){
  49739. var self=this,$self=this;
  49740. return $core.withContext(function($ctx1) {
  49741. $self._should_return_("foo [ ^ 1 ] value",(1));
  49742. $ctx1.sendIdx["should:return:"]=1;
  49743. $self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  49744. $ctx1.sendIdx["should:return:"]=2;
  49745. $self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  49746. $ctx1.sendIdx["should:return:"]=3;
  49747. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  49748. return self;
  49749. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  49750. },
  49751. args: [],
  49752. 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",
  49753. referencedClasses: [],
  49754. messageSends: ["should:return:"]
  49755. }),
  49756. $globals.CodeGeneratorTest);
  49757. $core.addMethod(
  49758. $core.method({
  49759. selector: "testPascalCaseGlobal",
  49760. protocol: "tests",
  49761. fn: function (){
  49762. var self=this,$self=this;
  49763. return $core.withContext(function($ctx1) {
  49764. $self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  49765. $ctx1.sendIdx["should:return:"]=1;
  49766. $self._should_return_("foo ^NonExistent",nil);
  49767. return self;
  49768. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  49769. },
  49770. args: [],
  49771. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  49772. referencedClasses: ["Smalltalk"],
  49773. messageSends: ["should:return:", "at:", "globals"]
  49774. }),
  49775. $globals.CodeGeneratorTest);
  49776. $core.addMethod(
  49777. $core.method({
  49778. selector: "testPragmaInBlock",
  49779. protocol: "tests",
  49780. fn: function (){
  49781. var self=this,$self=this;
  49782. return $core.withContext(function($ctx1) {
  49783. $self._should_receiver_raise_("foo ^ [ < fooBar > 4 ] value",$self.receiver,$globals.CompilerError);
  49784. return self;
  49785. }, function($ctx1) {$ctx1.fill(self,"testPragmaInBlock",{},$globals.CodeGeneratorTest)});
  49786. },
  49787. args: [],
  49788. source: "testPragmaInBlock\x0a\x09self should: 'foo ^ [ < fooBar > 4 ] value' receiver: receiver raise: CompilerError",
  49789. referencedClasses: ["CompilerError"],
  49790. messageSends: ["should:receiver:raise:"]
  49791. }),
  49792. $globals.CodeGeneratorTest);
  49793. $core.addMethod(
  49794. $core.method({
  49795. selector: "testPragmaJSStatement",
  49796. protocol: "tests",
  49797. fn: function (){
  49798. var self=this,$self=this;
  49799. return $core.withContext(function($ctx1) {
  49800. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  49801. return self;
  49802. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49803. },
  49804. args: [],
  49805. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  49806. referencedClasses: [],
  49807. messageSends: ["should:return:"]
  49808. }),
  49809. $globals.CodeGeneratorTest);
  49810. $core.addMethod(
  49811. $core.method({
  49812. selector: "testRootSuperSend",
  49813. protocol: "tests",
  49814. fn: function (){
  49815. var self=this,$self=this;
  49816. return $core.withContext(function($ctx1) {
  49817. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  49818. return self;
  49819. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  49820. },
  49821. args: [],
  49822. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  49823. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  49824. messageSends: ["should:receiver:raise:", "new"]
  49825. }),
  49826. $globals.CodeGeneratorTest);
  49827. $core.addMethod(
  49828. $core.method({
  49829. selector: "testSendReceiverAndArgumentsOrdered",
  49830. protocol: "tests",
  49831. fn: function (){
  49832. var self=this,$self=this;
  49833. return $core.withContext(function($ctx1) {
  49834. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  49835. $ctx1.sendIdx["should:return:"]=1;
  49836. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  49837. return self;
  49838. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  49839. },
  49840. args: [],
  49841. 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}.",
  49842. referencedClasses: ["Array"],
  49843. messageSends: ["should:return:"]
  49844. }),
  49845. $globals.CodeGeneratorTest);
  49846. $core.addMethod(
  49847. $core.method({
  49848. selector: "testSuperSend",
  49849. protocol: "tests",
  49850. fn: function (){
  49851. var self=this,$self=this;
  49852. return $core.withContext(function($ctx1) {
  49853. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  49854. return self;
  49855. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  49856. },
  49857. args: [],
  49858. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  49859. referencedClasses: [],
  49860. messageSends: ["should:receiver:return:"]
  49861. }),
  49862. $globals.CodeGeneratorTest);
  49863. $core.addMethod(
  49864. $core.method({
  49865. selector: "testTempVariables",
  49866. protocol: "tests",
  49867. fn: function (){
  49868. var self=this,$self=this;
  49869. return $core.withContext(function($ctx1) {
  49870. $self._should_return_("foo | a | ^ a",nil);
  49871. $ctx1.sendIdx["should:return:"]=1;
  49872. $self._should_return_("foo | AVariable | ^ AVariable",nil);
  49873. $ctx1.sendIdx["should:return:"]=2;
  49874. $self._should_return_("foo | a b c | ^ c",nil);
  49875. $ctx1.sendIdx["should:return:"]=3;
  49876. $self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  49877. $ctx1.sendIdx["should:return:"]=4;
  49878. $self._should_return_("foo | a | a:= 1. ^ a",(1));
  49879. $ctx1.sendIdx["should:return:"]=5;
  49880. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  49881. return self;
  49882. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  49883. },
  49884. args: [],
  49885. 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.",
  49886. referencedClasses: [],
  49887. messageSends: ["should:return:"]
  49888. }),
  49889. $globals.CodeGeneratorTest);
  49890. $core.addMethod(
  49891. $core.method({
  49892. selector: "testThisContext",
  49893. protocol: "tests",
  49894. fn: function (){
  49895. var self=this,$self=this;
  49896. return $core.withContext(function($ctx1) {
  49897. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  49898. return self;
  49899. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  49900. },
  49901. args: [],
  49902. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  49903. referencedClasses: [],
  49904. messageSends: ["should:return:"]
  49905. }),
  49906. $globals.CodeGeneratorTest);
  49907. $core.addMethod(
  49908. $core.method({
  49909. selector: "testUnknownPragma",
  49910. protocol: "tests",
  49911. fn: function (){
  49912. var self=this,$self=this;
  49913. return $core.withContext(function($ctx1) {
  49914. $self._should_return_("foo < fooBar: 'return 2+3' > | x | ^ x := 6",(6));
  49915. $ctx1.sendIdx["should:return:"]=1;
  49916. $self._should_return_("foo | x | < fooBar: 'return 2+3' > ^ x := 6",(6));
  49917. return self;
  49918. }, function($ctx1) {$ctx1.fill(self,"testUnknownPragma",{},$globals.CodeGeneratorTest)});
  49919. },
  49920. args: [],
  49921. source: "testUnknownPragma\x0a\x09self should: 'foo < fooBar: ''return 2+3'' > | x | ^ x := 6' return: 6.\x0a\x09self should: 'foo | x | < fooBar: ''return 2+3'' > ^ x := 6' return: 6",
  49922. referencedClasses: [],
  49923. messageSends: ["should:return:"]
  49924. }),
  49925. $globals.CodeGeneratorTest);
  49926. $core.addMethod(
  49927. $core.method({
  49928. selector: "testifFalse",
  49929. protocol: "tests",
  49930. fn: function (){
  49931. var self=this,$self=this;
  49932. return $core.withContext(function($ctx1) {
  49933. $self._should_return_("foo true ifFalse: [ ^ 1 ]",$self.receiver);
  49934. $ctx1.sendIdx["should:return:"]=1;
  49935. $self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  49936. $ctx1.sendIdx["should:return:"]=2;
  49937. $self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  49938. $ctx1.sendIdx["should:return:"]=3;
  49939. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  49940. return self;
  49941. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  49942. },
  49943. args: [],
  49944. 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.",
  49945. referencedClasses: [],
  49946. messageSends: ["should:return:"]
  49947. }),
  49948. $globals.CodeGeneratorTest);
  49949. $core.addMethod(
  49950. $core.method({
  49951. selector: "testifFalseIfTrue",
  49952. protocol: "tests",
  49953. fn: function (){
  49954. var self=this,$self=this;
  49955. return $core.withContext(function($ctx1) {
  49956. $self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  49957. $ctx1.sendIdx["should:return:"]=1;
  49958. $self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  49959. $ctx1.sendIdx["should:return:"]=2;
  49960. $self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  49961. $ctx1.sendIdx["should:return:"]=3;
  49962. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  49963. return self;
  49964. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  49965. },
  49966. args: [],
  49967. 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.",
  49968. referencedClasses: [],
  49969. messageSends: ["should:return:"]
  49970. }),
  49971. $globals.CodeGeneratorTest);
  49972. $core.addMethod(
  49973. $core.method({
  49974. selector: "testifNil",
  49975. protocol: "tests",
  49976. fn: function (){
  49977. var self=this,$self=this;
  49978. return $core.withContext(function($ctx1) {
  49979. $self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  49980. $ctx1.sendIdx["should:return:"]=1;
  49981. $self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  49982. $ctx1.sendIdx["should:return:"]=2;
  49983. $self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self.receiver);
  49984. $ctx1.sendIdx["should:return:"]=3;
  49985. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  49986. return self;
  49987. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  49988. },
  49989. args: [],
  49990. 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.",
  49991. referencedClasses: [],
  49992. messageSends: ["should:return:"]
  49993. }),
  49994. $globals.CodeGeneratorTest);
  49995. $core.addMethod(
  49996. $core.method({
  49997. selector: "testifNilIfNotNil",
  49998. protocol: "tests",
  49999. fn: function (){
  50000. var self=this,$self=this;
  50001. return $core.withContext(function($ctx1) {
  50002. $self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  50003. $ctx1.sendIdx["should:return:"]=1;
  50004. $self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  50005. $ctx1.sendIdx["should:return:"]=2;
  50006. $self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  50007. $ctx1.sendIdx["should:return:"]=3;
  50008. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  50009. return self;
  50010. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  50011. },
  50012. args: [],
  50013. 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.",
  50014. referencedClasses: [],
  50015. messageSends: ["should:return:"]
  50016. }),
  50017. $globals.CodeGeneratorTest);
  50018. $core.addMethod(
  50019. $core.method({
  50020. selector: "testifNotNil",
  50021. protocol: "tests",
  50022. fn: function (){
  50023. var self=this,$self=this;
  50024. return $core.withContext(function($ctx1) {
  50025. $self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  50026. $ctx1.sendIdx["should:return:"]=1;
  50027. $self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  50028. $ctx1.sendIdx["should:return:"]=2;
  50029. $self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  50030. $ctx1.sendIdx["should:return:"]=3;
  50031. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self.receiver);
  50032. return self;
  50033. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  50034. },
  50035. args: [],
  50036. 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.",
  50037. referencedClasses: [],
  50038. messageSends: ["should:return:"]
  50039. }),
  50040. $globals.CodeGeneratorTest);
  50041. $core.addMethod(
  50042. $core.method({
  50043. selector: "testifNotNilWithArgument",
  50044. protocol: "tests",
  50045. fn: function (){
  50046. var self=this,$self=this;
  50047. return $core.withContext(function($ctx1) {
  50048. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  50049. $ctx1.sendIdx["should:return:"]=1;
  50050. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  50051. $ctx1.sendIdx["should:return:"]=2;
  50052. $self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  50053. $ctx1.sendIdx["should:return:"]=3;
  50054. $self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  50055. $ctx1.sendIdx["should:return:"]=4;
  50056. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  50057. $ctx1.sendIdx["should:return:"]=5;
  50058. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  50059. return self;
  50060. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  50061. },
  50062. args: [],
  50063. 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",
  50064. referencedClasses: [],
  50065. messageSends: ["should:return:"]
  50066. }),
  50067. $globals.CodeGeneratorTest);
  50068. $core.addMethod(
  50069. $core.method({
  50070. selector: "testifTrue",
  50071. protocol: "tests",
  50072. fn: function (){
  50073. var self=this,$self=this;
  50074. return $core.withContext(function($ctx1) {
  50075. $self._should_return_("foo false ifTrue: [ ^ 1 ]",$self.receiver);
  50076. $ctx1.sendIdx["should:return:"]=1;
  50077. $self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  50078. $ctx1.sendIdx["should:return:"]=2;
  50079. $self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  50080. $ctx1.sendIdx["should:return:"]=3;
  50081. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  50082. return self;
  50083. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  50084. },
  50085. args: [],
  50086. 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.",
  50087. referencedClasses: [],
  50088. messageSends: ["should:return:"]
  50089. }),
  50090. $globals.CodeGeneratorTest);
  50091. $core.addMethod(
  50092. $core.method({
  50093. selector: "testifTrueIfFalse",
  50094. protocol: "tests",
  50095. fn: function (){
  50096. var self=this,$self=this;
  50097. return $core.withContext(function($ctx1) {
  50098. $self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  50099. $ctx1.sendIdx["should:return:"]=1;
  50100. $self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  50101. $ctx1.sendIdx["should:return:"]=2;
  50102. $self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  50103. $ctx1.sendIdx["should:return:"]=3;
  50104. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  50105. return self;
  50106. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  50107. },
  50108. args: [],
  50109. 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.",
  50110. referencedClasses: [],
  50111. messageSends: ["should:return:"]
  50112. }),
  50113. $globals.CodeGeneratorTest);
  50114. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  50115. $core.addMethod(
  50116. $core.method({
  50117. selector: "interpret:receiver:withArguments:",
  50118. protocol: "private",
  50119. fn: function (aString,anObject,aDictionary){
  50120. var self=this,$self=this;
  50121. var ctx,ast,interpreter;
  50122. return $core.withContext(function($ctx1) {
  50123. var $1,$2,$3,$receiver;
  50124. interpreter=$recv($globals.ASTInterpreter)._new();
  50125. $ctx1.sendIdx["new"]=1;
  50126. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  50127. $1=$recv($globals.AIContext)._new();
  50128. $recv($1)._receiver_(anObject);
  50129. $recv($1)._interpreter_(interpreter);
  50130. ctx=$recv($1)._yourself();
  50131. $2=$recv(ast)._sequenceNode();
  50132. if(($receiver = $2) == null || $receiver.a$nil){
  50133. $2;
  50134. } else {
  50135. var sequence;
  50136. sequence=$receiver;
  50137. $recv($recv(sequence)._temps())._do_((function(each){
  50138. return $core.withContext(function($ctx2) {
  50139. return $recv(ctx)._defineLocal_(each);
  50140. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50141. }));
  50142. }
  50143. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  50144. return $core.withContext(function($ctx2) {
  50145. return $recv(ctx)._localAt_put_(key,value);
  50146. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  50147. }));
  50148. $3=interpreter;
  50149. $recv($3)._context_(ctx);
  50150. $recv($3)._node_(ast);
  50151. $recv($3)._enterNode();
  50152. $recv($3)._proceed();
  50153. return $recv($3)._result();
  50154. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  50155. },
  50156. args: ["aString", "anObject", "aDictionary"],
  50157. 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",
  50158. referencedClasses: ["ASTInterpreter", "AIContext"],
  50159. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  50160. }),
  50161. $globals.ASTInterpreterTest);
  50162. $core.addMethod(
  50163. $core.method({
  50164. selector: "should:receiver:return:",
  50165. protocol: "testing",
  50166. fn: function (aString,anObject,aResult){
  50167. var self=this,$self=this;
  50168. return $core.withContext(function($ctx1) {
  50169. $self.receiver=anObject;
  50170. return $self._assert_equals_($self._interpret_receiver_withArguments_(aString,$self.receiver,$globals.HashedCollection._newFromPairs_([])),aResult);
  50171. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  50172. },
  50173. args: ["aString", "anObject", "aResult"],
  50174. 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",
  50175. referencedClasses: [],
  50176. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  50177. }),
  50178. $globals.ASTInterpreterTest);
  50179. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  50180. $core.addMethod(
  50181. $core.method({
  50182. selector: "interpret:receiver:withArguments:",
  50183. protocol: "private",
  50184. fn: function (aString,anObject,aDictionary){
  50185. var self=this,$self=this;
  50186. var ctx,ast,debugger_;
  50187. return $core.withContext(function($ctx1) {
  50188. var $1,$2,$3,$4,$5,$receiver;
  50189. $1=$recv($globals.AIContext)._new();
  50190. $ctx1.sendIdx["new"]=1;
  50191. $recv($1)._receiver_(anObject);
  50192. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  50193. ctx=$recv($1)._yourself();
  50194. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  50195. $2=$recv(ast)._sequenceNode();
  50196. if(($receiver = $2) == null || $receiver.a$nil){
  50197. $2;
  50198. } else {
  50199. var sequence;
  50200. sequence=$receiver;
  50201. $recv($recv(sequence)._temps())._do_((function(each){
  50202. return $core.withContext(function($ctx2) {
  50203. return $recv(ctx)._defineLocal_(each);
  50204. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50205. }));
  50206. }
  50207. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  50208. return $core.withContext(function($ctx2) {
  50209. return $recv(ctx)._localAt_put_(key,value);
  50210. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  50211. }));
  50212. $3=$recv(ctx)._interpreter();
  50213. $ctx1.sendIdx["interpreter"]=1;
  50214. $recv($3)._context_(ctx);
  50215. $ctx1.sendIdx["context:"]=1;
  50216. $4=$recv(ctx)._interpreter();
  50217. $recv($4)._node_(ast);
  50218. $recv($4)._enterNode();
  50219. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  50220. $5=debugger_;
  50221. $recv($5)._proceed();
  50222. return $recv($5)._result();
  50223. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  50224. },
  50225. args: ["aString", "anObject", "aDictionary"],
  50226. 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",
  50227. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  50228. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  50229. }),
  50230. $globals.ASTDebuggerTest);
  50231. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  50232. $core.addMethod(
  50233. $core.method({
  50234. selector: "codeGeneratorClass",
  50235. protocol: "accessing",
  50236. fn: function (){
  50237. var self=this,$self=this;
  50238. return $globals.InliningCodeGenerator;
  50239. },
  50240. args: [],
  50241. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  50242. referencedClasses: ["InliningCodeGenerator"],
  50243. messageSends: []
  50244. }),
  50245. $globals.InliningCodeGeneratorTest);
  50246. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  50247. $core.addMethod(
  50248. $core.method({
  50249. selector: "testClassRefVar",
  50250. protocol: "tests",
  50251. fn: function (){
  50252. var self=this,$self=this;
  50253. var node;
  50254. return $core.withContext(function($ctx1) {
  50255. var $1,$2;
  50256. $1=$recv($globals.VariableNode)._new();
  50257. $ctx1.sendIdx["new"]=1;
  50258. $recv($1)._value_("Object");
  50259. node=$recv($1)._yourself();
  50260. $2=$recv($globals.SemanticAnalyzer)._new();
  50261. $ctx1.sendIdx["new"]=2;
  50262. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  50263. $recv($2)._visit_(node);
  50264. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  50265. return self;
  50266. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  50267. },
  50268. args: [],
  50269. 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",
  50270. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  50271. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  50272. }),
  50273. $globals.ScopeVarTest);
  50274. $core.addMethod(
  50275. $core.method({
  50276. selector: "testInstanceVar",
  50277. protocol: "tests",
  50278. fn: function (){
  50279. var self=this,$self=this;
  50280. var node,scope;
  50281. return $core.withContext(function($ctx1) {
  50282. var $1;
  50283. $1=$recv($globals.VariableNode)._new();
  50284. $ctx1.sendIdx["new"]=1;
  50285. $recv($1)._value_("bzzz");
  50286. node=$recv($1)._yourself();
  50287. scope=$recv($globals.MethodLexicalScope)._new();
  50288. $recv(scope)._addIVar_("bzzz");
  50289. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  50290. return self;
  50291. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  50292. },
  50293. args: [],
  50294. 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",
  50295. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50296. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  50297. }),
  50298. $globals.ScopeVarTest);
  50299. $core.addMethod(
  50300. $core.method({
  50301. selector: "testPseudoVar",
  50302. protocol: "tests",
  50303. fn: function (){
  50304. var self=this,$self=this;
  50305. var node,pseudoVars;
  50306. return $core.withContext(function($ctx1) {
  50307. var $1;
  50308. pseudoVars=["self", "super", "true", "false", "nil"];
  50309. $recv(pseudoVars)._do_((function(each){
  50310. return $core.withContext(function($ctx2) {
  50311. $1=$recv($globals.VariableNode)._new();
  50312. $ctx2.sendIdx["new"]=1;
  50313. $recv($1)._value_(each);
  50314. node=$recv($1)._yourself();
  50315. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  50316. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50317. }));
  50318. return self;
  50319. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  50320. },
  50321. args: [],
  50322. 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]",
  50323. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50324. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  50325. }),
  50326. $globals.ScopeVarTest);
  50327. $core.addMethod(
  50328. $core.method({
  50329. selector: "testTempVar",
  50330. protocol: "tests",
  50331. fn: function (){
  50332. var self=this,$self=this;
  50333. var node,scope;
  50334. return $core.withContext(function($ctx1) {
  50335. var $1;
  50336. $1=$recv($globals.VariableNode)._new();
  50337. $ctx1.sendIdx["new"]=1;
  50338. $recv($1)._value_("bzzz");
  50339. node=$recv($1)._yourself();
  50340. scope=$recv($globals.MethodLexicalScope)._new();
  50341. $recv(scope)._addTemp_("bzzz");
  50342. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  50343. return self;
  50344. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  50345. },
  50346. args: [],
  50347. 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",
  50348. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50349. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  50350. }),
  50351. $globals.ScopeVarTest);
  50352. $core.addMethod(
  50353. $core.method({
  50354. selector: "testUnknownVar",
  50355. protocol: "tests",
  50356. fn: function (){
  50357. var self=this,$self=this;
  50358. var node;
  50359. return $core.withContext(function($ctx1) {
  50360. var $1;
  50361. $1=$recv($globals.VariableNode)._new();
  50362. $ctx1.sendIdx["new"]=1;
  50363. $recv($1)._value_("bzzz");
  50364. node=$recv($1)._yourself();
  50365. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  50366. return self;
  50367. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  50368. },
  50369. args: [],
  50370. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  50371. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50372. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  50373. }),
  50374. $globals.ScopeVarTest);
  50375. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  50376. $core.addMethod(
  50377. $core.method({
  50378. selector: "setUp",
  50379. protocol: "running",
  50380. fn: function (){
  50381. var self=this,$self=this;
  50382. return $core.withContext(function($ctx1) {
  50383. $self.analyzer=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  50384. return self;
  50385. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  50386. },
  50387. args: [],
  50388. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  50389. referencedClasses: ["SemanticAnalyzer", "Object"],
  50390. messageSends: ["on:"]
  50391. }),
  50392. $globals.SemanticAnalyzerTest);
  50393. $core.addMethod(
  50394. $core.method({
  50395. selector: "testAssignment",
  50396. protocol: "tests",
  50397. fn: function (){
  50398. var self=this,$self=this;
  50399. var src,ast;
  50400. return $core.withContext(function($ctx1) {
  50401. src="foo self := 1";
  50402. ast=$recv($globals.Smalltalk)._parse_(src);
  50403. $self._should_raise_((function(){
  50404. return $core.withContext(function($ctx2) {
  50405. return $recv($self.analyzer)._visit_(ast);
  50406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50407. }),$globals.InvalidAssignmentError);
  50408. return self;
  50409. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50410. },
  50411. args: [],
  50412. 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",
  50413. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  50414. messageSends: ["parse:", "should:raise:", "visit:"]
  50415. }),
  50416. $globals.SemanticAnalyzerTest);
  50417. $core.addMethod(
  50418. $core.method({
  50419. selector: "testNonLocalReturn",
  50420. protocol: "tests",
  50421. fn: function (){
  50422. var self=this,$self=this;
  50423. var src,ast;
  50424. return $core.withContext(function($ctx1) {
  50425. src="foo | a | a + 1. ^ a";
  50426. ast=$recv($globals.Smalltalk)._parse_(src);
  50427. $recv($self.analyzer)._visit_(ast);
  50428. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50429. return self;
  50430. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50431. },
  50432. args: [],
  50433. 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",
  50434. referencedClasses: ["Smalltalk"],
  50435. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  50436. }),
  50437. $globals.SemanticAnalyzerTest);
  50438. $core.addMethod(
  50439. $core.method({
  50440. selector: "testNonLocalReturn2",
  50441. protocol: "tests",
  50442. fn: function (){
  50443. var self=this,$self=this;
  50444. var src,ast;
  50445. return $core.withContext(function($ctx1) {
  50446. src="foo | a | a + 1. [ [ ^ a] ]";
  50447. ast=$recv($globals.Smalltalk)._parse_(src);
  50448. $recv($self.analyzer)._visit_(ast);
  50449. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50450. return self;
  50451. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50452. },
  50453. args: [],
  50454. 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",
  50455. referencedClasses: ["Smalltalk"],
  50456. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  50457. }),
  50458. $globals.SemanticAnalyzerTest);
  50459. $core.addMethod(
  50460. $core.method({
  50461. selector: "testScope",
  50462. protocol: "tests",
  50463. fn: function (){
  50464. var self=this,$self=this;
  50465. var src,ast;
  50466. return $core.withContext(function($ctx1) {
  50467. var $4,$3,$2,$1;
  50468. src="foo | a | a + 1. [ | b | b := a ]";
  50469. ast=$recv($globals.Smalltalk)._parse_(src);
  50470. $recv($self.analyzer)._visit_(ast);
  50471. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50472. $ctx1.sendIdx["dagChildren"]=1;
  50473. $3=$recv($4)._last();
  50474. $2=$recv($3)._scope();
  50475. $ctx1.sendIdx["scope"]=1;
  50476. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50477. $self._deny_($1);
  50478. return self;
  50479. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50480. },
  50481. args: [],
  50482. 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.",
  50483. referencedClasses: ["Smalltalk"],
  50484. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  50485. }),
  50486. $globals.SemanticAnalyzerTest);
  50487. $core.addMethod(
  50488. $core.method({
  50489. selector: "testScope2",
  50490. protocol: "tests",
  50491. fn: function (){
  50492. var self=this,$self=this;
  50493. var src,ast;
  50494. return $core.withContext(function($ctx1) {
  50495. var $8,$7,$6,$5,$4,$3,$2,$1;
  50496. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50497. ast=$recv($globals.Smalltalk)._parse_(src);
  50498. $recv($self.analyzer)._visit_(ast);
  50499. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50500. $ctx1.sendIdx["dagChildren"]=3;
  50501. $7=$recv($8)._last();
  50502. $6=$recv($7)._dagChildren();
  50503. $ctx1.sendIdx["dagChildren"]=2;
  50504. $5=$recv($6)._first();
  50505. $ctx1.sendIdx["first"]=2;
  50506. $4=$recv($5)._dagChildren();
  50507. $ctx1.sendIdx["dagChildren"]=1;
  50508. $3=$recv($4)._first();
  50509. $ctx1.sendIdx["first"]=1;
  50510. $2=$recv($3)._scope();
  50511. $ctx1.sendIdx["scope"]=1;
  50512. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50513. $self._deny_($1);
  50514. return self;
  50515. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50516. },
  50517. args: [],
  50518. 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.",
  50519. referencedClasses: ["Smalltalk"],
  50520. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  50521. }),
  50522. $globals.SemanticAnalyzerTest);
  50523. $core.addMethod(
  50524. $core.method({
  50525. selector: "testScopeLevel",
  50526. protocol: "tests",
  50527. fn: function (){
  50528. var self=this,$self=this;
  50529. var src,ast;
  50530. return $core.withContext(function($ctx1) {
  50531. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  50532. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50533. ast=$recv($globals.Smalltalk)._parse_(src);
  50534. $recv($self.analyzer)._visit_(ast);
  50535. $2=$recv(ast)._scope();
  50536. $ctx1.sendIdx["scope"]=1;
  50537. $1=$recv($2)._scopeLevel();
  50538. $ctx1.sendIdx["scopeLevel"]=1;
  50539. $self._assert_equals_($1,(1));
  50540. $ctx1.sendIdx["assert:equals:"]=1;
  50541. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50542. $ctx1.sendIdx["dagChildren"]=3;
  50543. $9=$recv($10)._last();
  50544. $8=$recv($9)._dagChildren();
  50545. $ctx1.sendIdx["dagChildren"]=2;
  50546. $7=$recv($8)._first();
  50547. $ctx1.sendIdx["first"]=2;
  50548. $6=$recv($7)._dagChildren();
  50549. $ctx1.sendIdx["dagChildren"]=1;
  50550. $5=$recv($6)._first();
  50551. $ctx1.sendIdx["first"]=1;
  50552. $4=$recv($5)._scope();
  50553. $3=$recv($4)._scopeLevel();
  50554. $self._assert_equals_($3,(3));
  50555. return self;
  50556. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50557. },
  50558. args: [],
  50559. 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",
  50560. referencedClasses: ["Smalltalk"],
  50561. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  50562. }),
  50563. $globals.SemanticAnalyzerTest);
  50564. $core.addMethod(
  50565. $core.method({
  50566. selector: "testUnknownVariables",
  50567. protocol: "tests",
  50568. fn: function (){
  50569. var self=this,$self=this;
  50570. var src,ast;
  50571. return $core.withContext(function($ctx1) {
  50572. src="foo | a | b + a";
  50573. ast=$recv($globals.Smalltalk)._parse_(src);
  50574. $self._should_raise_((function(){
  50575. return $core.withContext(function($ctx2) {
  50576. return $recv($self.analyzer)._visit_(ast);
  50577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50578. }),$globals.UnknownVariableError);
  50579. return self;
  50580. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50581. },
  50582. args: [],
  50583. 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",
  50584. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50585. messageSends: ["parse:", "should:raise:", "visit:"]
  50586. }),
  50587. $globals.SemanticAnalyzerTest);
  50588. $core.addMethod(
  50589. $core.method({
  50590. selector: "testUnknownVariablesWithScope",
  50591. protocol: "tests",
  50592. fn: function (){
  50593. var self=this,$self=this;
  50594. var src,ast;
  50595. return $core.withContext(function($ctx1) {
  50596. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  50597. ast=$recv($globals.Smalltalk)._parse_(src);
  50598. $self._should_raise_((function(){
  50599. return $core.withContext(function($ctx2) {
  50600. return $recv($self.analyzer)._visit_(ast);
  50601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50602. }),$globals.UnknownVariableError);
  50603. return self;
  50604. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50605. },
  50606. args: [],
  50607. 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",
  50608. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50609. messageSends: ["parse:", "should:raise:", "visit:"]
  50610. }),
  50611. $globals.SemanticAnalyzerTest);
  50612. $core.addMethod(
  50613. $core.method({
  50614. selector: "testVariableShadowing",
  50615. protocol: "tests",
  50616. fn: function (){
  50617. var self=this,$self=this;
  50618. var src,ast;
  50619. return $core.withContext(function($ctx1) {
  50620. src="foo | a | a + 1";
  50621. ast=$recv($globals.Smalltalk)._parse_(src);
  50622. $recv($self.analyzer)._visit_(ast);
  50623. return self;
  50624. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50625. },
  50626. args: [],
  50627. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50628. referencedClasses: ["Smalltalk"],
  50629. messageSends: ["parse:", "visit:"]
  50630. }),
  50631. $globals.SemanticAnalyzerTest);
  50632. $core.addMethod(
  50633. $core.method({
  50634. selector: "testVariableShadowing2",
  50635. protocol: "tests",
  50636. fn: function (){
  50637. var self=this,$self=this;
  50638. var src,ast;
  50639. return $core.withContext(function($ctx1) {
  50640. src="foo | a | a + 1. [ | a | a := 2 ]";
  50641. ast=$recv($globals.Smalltalk)._parse_(src);
  50642. $self._should_raise_((function(){
  50643. return $core.withContext(function($ctx2) {
  50644. return $recv($self.analyzer)._visit_(ast);
  50645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50646. }),$globals.ShadowingVariableError);
  50647. return self;
  50648. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50649. },
  50650. args: [],
  50651. 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",
  50652. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50653. messageSends: ["parse:", "should:raise:", "visit:"]
  50654. }),
  50655. $globals.SemanticAnalyzerTest);
  50656. $core.addMethod(
  50657. $core.method({
  50658. selector: "testVariableShadowing3",
  50659. protocol: "tests",
  50660. fn: function (){
  50661. var self=this,$self=this;
  50662. var src,ast;
  50663. return $core.withContext(function($ctx1) {
  50664. src="foo | a | a + 1. [ | b | b := 2 ]";
  50665. ast=$recv($globals.Smalltalk)._parse_(src);
  50666. $recv($self.analyzer)._visit_(ast);
  50667. return self;
  50668. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50669. },
  50670. args: [],
  50671. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50672. referencedClasses: ["Smalltalk"],
  50673. messageSends: ["parse:", "visit:"]
  50674. }),
  50675. $globals.SemanticAnalyzerTest);
  50676. $core.addMethod(
  50677. $core.method({
  50678. selector: "testVariableShadowing4",
  50679. protocol: "tests",
  50680. fn: function (){
  50681. var self=this,$self=this;
  50682. var src,ast;
  50683. return $core.withContext(function($ctx1) {
  50684. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  50685. ast=$recv($globals.Smalltalk)._parse_(src);
  50686. $recv($self.analyzer)._visit_(ast);
  50687. return self;
  50688. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50689. },
  50690. args: [],
  50691. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50692. referencedClasses: ["Smalltalk"],
  50693. messageSends: ["parse:", "visit:"]
  50694. }),
  50695. $globals.SemanticAnalyzerTest);
  50696. $core.addMethod(
  50697. $core.method({
  50698. selector: "testVariableShadowing5",
  50699. protocol: "tests",
  50700. fn: function (){
  50701. var self=this,$self=this;
  50702. var src,ast;
  50703. return $core.withContext(function($ctx1) {
  50704. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  50705. ast=$recv($globals.Smalltalk)._parse_(src);
  50706. $self._should_raise_((function(){
  50707. return $core.withContext(function($ctx2) {
  50708. return $recv($self.analyzer)._visit_(ast);
  50709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50710. }),$globals.ShadowingVariableError);
  50711. return self;
  50712. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50713. },
  50714. args: [],
  50715. 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",
  50716. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50717. messageSends: ["parse:", "should:raise:", "visit:"]
  50718. }),
  50719. $globals.SemanticAnalyzerTest);
  50720. $core.addMethod(
  50721. $core.method({
  50722. selector: "testVariablesLookup",
  50723. protocol: "tests",
  50724. fn: function (){
  50725. var self=this,$self=this;
  50726. var src,ast;
  50727. return $core.withContext(function($ctx1) {
  50728. 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;
  50729. src="foo | a | a + 1. [ | b | b := a ]";
  50730. ast=$recv($globals.Smalltalk)._parse_(src);
  50731. $recv($self.analyzer)._visit_(ast);
  50732. $7=$recv(ast)._dagChildren();
  50733. $ctx1.sendIdx["dagChildren"]=2;
  50734. $6=$recv($7)._first();
  50735. $ctx1.sendIdx["first"]=2;
  50736. $5=$recv($6)._dagChildren();
  50737. $ctx1.sendIdx["dagChildren"]=1;
  50738. $4=$recv($5)._first();
  50739. $ctx1.sendIdx["first"]=1;
  50740. $3=$recv($4)._receiver();
  50741. $ctx1.sendIdx["receiver"]=1;
  50742. $2=$recv($3)._binding();
  50743. $ctx1.sendIdx["binding"]=1;
  50744. $1=$recv($2)._isTempVar();
  50745. $ctx1.sendIdx["isTempVar"]=1;
  50746. $self._assert_($1);
  50747. $ctx1.sendIdx["assert:"]=1;
  50748. $15=$recv(ast)._dagChildren();
  50749. $ctx1.sendIdx["dagChildren"]=4;
  50750. $14=$recv($15)._first();
  50751. $ctx1.sendIdx["first"]=4;
  50752. $13=$recv($14)._dagChildren();
  50753. $ctx1.sendIdx["dagChildren"]=3;
  50754. $12=$recv($13)._first();
  50755. $ctx1.sendIdx["first"]=3;
  50756. $11=$recv($12)._receiver();
  50757. $10=$recv($11)._binding();
  50758. $ctx1.sendIdx["binding"]=2;
  50759. $9=$recv($10)._scope();
  50760. $ctx1.sendIdx["scope"]=1;
  50761. $16=$recv(ast)._scope();
  50762. $ctx1.sendIdx["scope"]=2;
  50763. $8=$recv($9).__eq_eq($16);
  50764. $ctx1.sendIdx["=="]=1;
  50765. $self._assert_($8);
  50766. $ctx1.sendIdx["assert:"]=2;
  50767. $27=$recv(ast)._dagChildren();
  50768. $ctx1.sendIdx["dagChildren"]=8;
  50769. $26=$recv($27)._first();
  50770. $ctx1.sendIdx["first"]=7;
  50771. $25=$recv($26)._dagChildren();
  50772. $ctx1.sendIdx["dagChildren"]=7;
  50773. $24=$recv($25)._last();
  50774. $ctx1.sendIdx["last"]=1;
  50775. $23=$recv($24)._dagChildren();
  50776. $ctx1.sendIdx["dagChildren"]=6;
  50777. $22=$recv($23)._first();
  50778. $ctx1.sendIdx["first"]=6;
  50779. $21=$recv($22)._dagChildren();
  50780. $ctx1.sendIdx["dagChildren"]=5;
  50781. $20=$recv($21)._first();
  50782. $ctx1.sendIdx["first"]=5;
  50783. $19=$recv($20)._left();
  50784. $ctx1.sendIdx["left"]=1;
  50785. $18=$recv($19)._binding();
  50786. $ctx1.sendIdx["binding"]=3;
  50787. $17=$recv($18)._isTempVar();
  50788. $self._assert_($17);
  50789. $ctx1.sendIdx["assert:"]=3;
  50790. $39=$recv(ast)._dagChildren();
  50791. $ctx1.sendIdx["dagChildren"]=12;
  50792. $38=$recv($39)._first();
  50793. $ctx1.sendIdx["first"]=10;
  50794. $37=$recv($38)._dagChildren();
  50795. $ctx1.sendIdx["dagChildren"]=11;
  50796. $36=$recv($37)._last();
  50797. $ctx1.sendIdx["last"]=2;
  50798. $35=$recv($36)._dagChildren();
  50799. $ctx1.sendIdx["dagChildren"]=10;
  50800. $34=$recv($35)._first();
  50801. $ctx1.sendIdx["first"]=9;
  50802. $33=$recv($34)._dagChildren();
  50803. $ctx1.sendIdx["dagChildren"]=9;
  50804. $32=$recv($33)._first();
  50805. $ctx1.sendIdx["first"]=8;
  50806. $31=$recv($32)._left();
  50807. $30=$recv($31)._binding();
  50808. $29=$recv($30)._scope();
  50809. $ctx1.sendIdx["scope"]=3;
  50810. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50811. $ctx1.sendIdx["dagChildren"]=13;
  50812. $41=$recv($42)._last();
  50813. $40=$recv($41)._scope();
  50814. $28=$recv($29).__eq_eq($40);
  50815. $self._assert_($28);
  50816. return self;
  50817. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50818. },
  50819. args: [],
  50820. 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.",
  50821. referencedClasses: ["Smalltalk"],
  50822. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  50823. }),
  50824. $globals.SemanticAnalyzerTest);
  50825. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  50826. $core.addMethod(
  50827. $core.method({
  50828. selector: "setUp",
  50829. protocol: "running",
  50830. fn: function (){
  50831. var self=this,$self=this;
  50832. return $core.withContext(function($ctx1) {
  50833. var $1,$3,$4,$2;
  50834. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  50835. $3=$recv($globals.AIContext)._new();
  50836. $recv($3)._defineLocal_("local");
  50837. $recv($3)._localAt_put_("local",(3));
  50838. $4=$recv($3)._yourself();
  50839. $ctx1.sendIdx["yourself"]=1;
  50840. $2=$4;
  50841. $recv($1)._context_($2);
  50842. $self.analyzer=$recv($1)._yourself();
  50843. return self;
  50844. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  50845. },
  50846. args: [],
  50847. 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",
  50848. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  50849. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  50850. }),
  50851. $globals.AISemanticAnalyzerTest);
  50852. $core.addMethod(
  50853. $core.method({
  50854. selector: "testContextVariables",
  50855. protocol: "tests",
  50856. fn: function (){
  50857. var self=this,$self=this;
  50858. var src,ast;
  50859. return $core.withContext(function($ctx1) {
  50860. src="foo | a | local + a";
  50861. ast=$recv($globals.Smalltalk)._parse_(src);
  50862. $self._shouldnt_raise_((function(){
  50863. return $core.withContext(function($ctx2) {
  50864. return $recv($self.analyzer)._visit_(ast);
  50865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50866. }),$globals.UnknownVariableError);
  50867. return self;
  50868. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  50869. },
  50870. args: [],
  50871. 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",
  50872. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50873. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  50874. }),
  50875. $globals.AISemanticAnalyzerTest);
  50876. });
  50877. define('amber/core/Kernel-Tests',["amber/boot", "require", "amber/core/Kernel-Objects", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  50878. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  50879. var $pkg = $core.addPackage("Kernel-Tests");
  50880. $pkg.innerEval = function (expr) { return eval(expr); };
  50881. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  50882. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  50883. $core.addMethod(
  50884. $core.method({
  50885. selector: "testAddExtensionMethod",
  50886. protocol: "tests",
  50887. fn: function (){
  50888. var self=this,$self=this;
  50889. var method,dirty;
  50890. return $core.withContext(function($ctx1) {
  50891. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  50892. $2=$self._class();
  50893. $ctx1.sendIdx["class"]=1;
  50894. $1=$recv($2)._package();
  50895. $ctx1.sendIdx["package"]=1;
  50896. dirty=$recv($1)._isDirty();
  50897. $ctx1.sendIdx["isDirty"]=1;
  50898. $4=$self._class();
  50899. $ctx1.sendIdx["class"]=2;
  50900. $3=$recv($4)._package();
  50901. $ctx1.sendIdx["package"]=2;
  50902. $recv($3)._beClean();
  50903. $5=$self._class();
  50904. $ctx1.sendIdx["class"]=3;
  50905. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  50906. $8=$self._class();
  50907. $ctx1.sendIdx["class"]=4;
  50908. $7=$recv($8)._package();
  50909. $ctx1.sendIdx["package"]=3;
  50910. $6=$recv($7)._isDirty();
  50911. $self._deny_($6);
  50912. $9=$self._class();
  50913. $ctx1.sendIdx["class"]=5;
  50914. $recv($9)._removeCompiledMethod_(method);
  50915. $10=dirty;
  50916. if($core.assert($10)){
  50917. $recv($recv($self._class())._package())._beDirty();
  50918. }
  50919. return self;
  50920. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  50921. },
  50922. args: [],
  50923. 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 ]",
  50924. referencedClasses: [],
  50925. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  50926. }),
  50927. $globals.AnnouncementSubscriptionTest);
  50928. $core.addMethod(
  50929. $core.method({
  50930. selector: "testHandlesAnnouncement",
  50931. protocol: "tests",
  50932. fn: function (){
  50933. var self=this,$self=this;
  50934. var subscription,announcementClass1,announcementClass2,classBuilder;
  50935. return $core.withContext(function($ctx1) {
  50936. var $1,$3,$4,$2,$6,$7,$5;
  50937. classBuilder=$recv($globals.ClassBuilder)._new();
  50938. $ctx1.sendIdx["new"]=1;
  50939. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  50940. $1=$recv($globals.AnnouncementSubscription)._new();
  50941. $ctx1.sendIdx["new"]=2;
  50942. subscription=$recv($1)._announcementClass_($globals.SystemAnnouncement);
  50943. $3=subscription;
  50944. $4=$recv($globals.SystemAnnouncement)._new();
  50945. $ctx1.sendIdx["new"]=3;
  50946. $2=$recv($3)._handlesAnnouncement_($4);
  50947. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  50948. $self._assert_equals_($2,true);
  50949. $ctx1.sendIdx["assert:equals:"]=1;
  50950. $6=subscription;
  50951. $7=$recv(announcementClass1)._new();
  50952. $ctx1.sendIdx["new"]=4;
  50953. $5=$recv($6)._handlesAnnouncement_($7);
  50954. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  50955. $self._assert_equals_($5,true);
  50956. $ctx1.sendIdx["assert:equals:"]=2;
  50957. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($recv($globals.Object)._new()),false);
  50958. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  50959. return self;
  50960. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  50961. },
  50962. args: [],
  50963. 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 new) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1 new) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object new) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  50964. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  50965. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  50966. }),
  50967. $globals.AnnouncementSubscriptionTest);
  50968. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  50969. $core.addMethod(
  50970. $core.method({
  50971. selector: "testOnDo",
  50972. protocol: "tests",
  50973. fn: function (){
  50974. var self=this,$self=this;
  50975. var counter,announcer;
  50976. return $core.withContext(function($ctx1) {
  50977. var $1,$2;
  50978. counter=(0);
  50979. announcer=$recv($globals.Announcer)._new();
  50980. $ctx1.sendIdx["new"]=1;
  50981. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  50982. return $core.withContext(function($ctx2) {
  50983. counter=$recv(counter).__plus((1));
  50984. return counter;
  50985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50986. }));
  50987. $1=announcer;
  50988. $2=$recv($globals.SystemAnnouncement)._new();
  50989. $ctx1.sendIdx["new"]=2;
  50990. $recv($1)._announce_($2);
  50991. $ctx1.sendIdx["announce:"]=1;
  50992. $self._assert_equals_(counter,(1));
  50993. $ctx1.sendIdx["assert:equals:"]=1;
  50994. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50995. $self._assert_equals_(counter,(2));
  50996. return self;
  50997. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50998. },
  50999. args: [],
  51000. 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.",
  51001. referencedClasses: ["Announcer", "SystemAnnouncement"],
  51002. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  51003. }),
  51004. $globals.AnnouncerTest);
  51005. $core.addMethod(
  51006. $core.method({
  51007. selector: "testOnDoFor",
  51008. protocol: "tests",
  51009. fn: function (){
  51010. var self=this,$self=this;
  51011. var counter,announcer;
  51012. return $core.withContext(function($ctx1) {
  51013. var $1,$2,$3,$4;
  51014. counter=(0);
  51015. announcer=$recv($globals.Announcer)._new();
  51016. $ctx1.sendIdx["new"]=1;
  51017. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  51018. return $core.withContext(function($ctx2) {
  51019. counter=$recv(counter).__plus((1));
  51020. return counter;
  51021. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51022. }),self);
  51023. $1=announcer;
  51024. $2=$recv($globals.SystemAnnouncement)._new();
  51025. $ctx1.sendIdx["new"]=2;
  51026. $recv($1)._announce_($2);
  51027. $ctx1.sendIdx["announce:"]=1;
  51028. $self._assert_equals_(counter,(1));
  51029. $ctx1.sendIdx["assert:equals:"]=1;
  51030. $3=announcer;
  51031. $4=$recv($globals.SystemAnnouncement)._new();
  51032. $ctx1.sendIdx["new"]=3;
  51033. $recv($3)._announce_($4);
  51034. $ctx1.sendIdx["announce:"]=2;
  51035. $self._assert_equals_(counter,(2));
  51036. $ctx1.sendIdx["assert:equals:"]=2;
  51037. $recv(announcer)._unsubscribe_(self);
  51038. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  51039. $self._assert_equals_(counter,(2));
  51040. return self;
  51041. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  51042. },
  51043. args: [],
  51044. 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.",
  51045. referencedClasses: ["Announcer", "SystemAnnouncement"],
  51046. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  51047. }),
  51048. $globals.AnnouncerTest);
  51049. $core.addMethod(
  51050. $core.method({
  51051. selector: "testOnDoOnce",
  51052. protocol: "tests",
  51053. fn: function (){
  51054. var self=this,$self=this;
  51055. var counter,announcer;
  51056. return $core.withContext(function($ctx1) {
  51057. var $1,$2;
  51058. counter=(0);
  51059. announcer=$recv($globals.Announcer)._new();
  51060. $ctx1.sendIdx["new"]=1;
  51061. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  51062. return $core.withContext(function($ctx2) {
  51063. counter=$recv(counter).__plus((1));
  51064. return counter;
  51065. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51066. }));
  51067. $1=announcer;
  51068. $2=$recv($globals.SystemAnnouncement)._new();
  51069. $ctx1.sendIdx["new"]=2;
  51070. $recv($1)._announce_($2);
  51071. $ctx1.sendIdx["announce:"]=1;
  51072. $self._assert_equals_(counter,(1));
  51073. $ctx1.sendIdx["assert:equals:"]=1;
  51074. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  51075. $self._assert_equals_(counter,(1));
  51076. return self;
  51077. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  51078. },
  51079. args: [],
  51080. 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.",
  51081. referencedClasses: ["Announcer", "SystemAnnouncement"],
  51082. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  51083. }),
  51084. $globals.AnnouncerTest);
  51085. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  51086. $core.addMethod(
  51087. $core.method({
  51088. selector: "localReturnOnDoCatch",
  51089. protocol: "fixture",
  51090. fn: function (){
  51091. var self=this,$self=this;
  51092. return $core.withContext(function($ctx1) {
  51093. var $early={};
  51094. try {
  51095. $recv((function(){
  51096. throw $early=[(2)];
  51097. }))._on_do_($globals.Error,(function(){
  51098. }));
  51099. return (3);
  51100. }
  51101. catch(e) {if(e===$early)return e[0]; throw e}
  51102. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  51103. },
  51104. args: [],
  51105. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  51106. referencedClasses: ["Error"],
  51107. messageSends: ["on:do:"]
  51108. }),
  51109. $globals.BlockClosureTest);
  51110. $core.addMethod(
  51111. $core.method({
  51112. selector: "localReturnOnDoMiss",
  51113. protocol: "fixture",
  51114. fn: function (){
  51115. var self=this,$self=this;
  51116. return $core.withContext(function($ctx1) {
  51117. var $early={};
  51118. try {
  51119. $recv((function(){
  51120. throw $early=[(2)];
  51121. }))._on_do_($globals.Class,(function(){
  51122. }));
  51123. return (3);
  51124. }
  51125. catch(e) {if(e===$early)return e[0]; throw e}
  51126. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  51127. },
  51128. args: [],
  51129. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  51130. referencedClasses: ["Class"],
  51131. messageSends: ["on:do:"]
  51132. }),
  51133. $globals.BlockClosureTest);
  51134. $core.addMethod(
  51135. $core.method({
  51136. selector: "testCanClearInterval",
  51137. protocol: "tests",
  51138. fn: function (){
  51139. var self=this,$self=this;
  51140. return $core.withContext(function($ctx1) {
  51141. $self._shouldnt_raise_((function(){
  51142. return $core.withContext(function($ctx2) {
  51143. return $recv($recv((function(){
  51144. return $core.withContext(function($ctx3) {
  51145. return $recv($recv($globals.Error)._new())._signal();
  51146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51147. }))._valueWithInterval_((0)))._clearInterval();
  51148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51149. }),$globals.Error);
  51150. return self;
  51151. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  51152. },
  51153. args: [],
  51154. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  51155. referencedClasses: ["Error"],
  51156. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  51157. }),
  51158. $globals.BlockClosureTest);
  51159. $core.addMethod(
  51160. $core.method({
  51161. selector: "testCanClearTimeout",
  51162. protocol: "tests",
  51163. fn: function (){
  51164. var self=this,$self=this;
  51165. return $core.withContext(function($ctx1) {
  51166. $self._shouldnt_raise_((function(){
  51167. return $core.withContext(function($ctx2) {
  51168. return $recv($recv((function(){
  51169. return $core.withContext(function($ctx3) {
  51170. return $recv($recv($globals.Error)._new())._signal();
  51171. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51172. }))._valueWithTimeout_((0)))._clearTimeout();
  51173. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51174. }),$globals.Error);
  51175. return self;
  51176. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  51177. },
  51178. args: [],
  51179. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  51180. referencedClasses: ["Error"],
  51181. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  51182. }),
  51183. $globals.BlockClosureTest);
  51184. $core.addMethod(
  51185. $core.method({
  51186. selector: "testCompiledSource",
  51187. protocol: "tests",
  51188. fn: function (){
  51189. var self=this,$self=this;
  51190. return $core.withContext(function($ctx1) {
  51191. $self._assert_($recv($recv((function(){
  51192. return $core.withContext(function($ctx2) {
  51193. return (1).__plus((1));
  51194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51195. }))._compiledSource())._includesSubString_("function"));
  51196. return self;
  51197. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  51198. },
  51199. args: [],
  51200. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  51201. referencedClasses: [],
  51202. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  51203. }),
  51204. $globals.BlockClosureTest);
  51205. $core.addMethod(
  51206. $core.method({
  51207. selector: "testCurrySelf",
  51208. protocol: "tests",
  51209. fn: function (){
  51210. var self=this,$self=this;
  51211. var curriedMethod,array;
  51212. return $core.withContext(function($ctx1) {
  51213. curriedMethod=$recv($recv((function(selfarg,x){
  51214. return $core.withContext(function($ctx2) {
  51215. return $recv(selfarg)._at_(x);
  51216. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  51217. }))._currySelf())._asCompiledMethod_("foo:");
  51218. array=[(3), (1), (4)];
  51219. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  51220. $recv((function(){
  51221. return $core.withContext(function($ctx2) {
  51222. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  51223. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51224. }))._ensure_((function(){
  51225. return $core.withContext(function($ctx2) {
  51226. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  51227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51228. }));
  51229. return self;
  51230. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  51231. },
  51232. args: [],
  51233. 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 ]",
  51234. referencedClasses: ["ClassBuilder", "Array"],
  51235. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  51236. }),
  51237. $globals.BlockClosureTest);
  51238. $core.addMethod(
  51239. $core.method({
  51240. selector: "testEnsure",
  51241. protocol: "tests",
  51242. fn: function (){
  51243. var self=this,$self=this;
  51244. return $core.withContext(function($ctx1) {
  51245. $self._assert_equals_($recv((function(){
  51246. return (3);
  51247. }))._ensure_((function(){
  51248. return (4);
  51249. })),(3));
  51250. return self;
  51251. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  51252. },
  51253. args: [],
  51254. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  51255. referencedClasses: [],
  51256. messageSends: ["assert:equals:", "ensure:"]
  51257. }),
  51258. $globals.BlockClosureTest);
  51259. $core.addMethod(
  51260. $core.method({
  51261. selector: "testEnsureRaises",
  51262. protocol: "tests",
  51263. fn: function (){
  51264. var self=this,$self=this;
  51265. return $core.withContext(function($ctx1) {
  51266. $self._should_raise_((function(){
  51267. return $core.withContext(function($ctx2) {
  51268. return $recv((function(){
  51269. return $core.withContext(function($ctx3) {
  51270. return $recv($recv($globals.Error)._new())._signal();
  51271. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51272. }))._ensure_((function(){
  51273. return true;
  51274. }));
  51275. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51276. }),$globals.Error);
  51277. return self;
  51278. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  51279. },
  51280. args: [],
  51281. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  51282. referencedClasses: ["Error"],
  51283. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  51284. }),
  51285. $globals.BlockClosureTest);
  51286. $core.addMethod(
  51287. $core.method({
  51288. selector: "testExceptionSemantics",
  51289. protocol: "tests",
  51290. fn: function (){
  51291. var self=this,$self=this;
  51292. return $core.withContext(function($ctx1) {
  51293. $self._timeout_((100));
  51294. $recv($self._async_((function(){
  51295. return $core.withContext(function($ctx2) {
  51296. return $recv((function(){
  51297. return $core.withContext(function($ctx3) {
  51298. $self._assert_(true);
  51299. $recv($globals.Error)._signal();
  51300. $self._deny_(true);
  51301. return $self._finished();
  51302. $ctx3.sendIdx["finished"]=1;
  51303. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51304. }))._on_do_($globals.Error,(function(ex){
  51305. return $core.withContext(function($ctx3) {
  51306. return $self._finished();
  51307. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  51308. }));
  51309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51310. })))._valueWithTimeout_((0));
  51311. return self;
  51312. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  51313. },
  51314. args: [],
  51315. 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",
  51316. referencedClasses: ["Error"],
  51317. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  51318. }),
  51319. $globals.BlockClosureTest);
  51320. $core.addMethod(
  51321. $core.method({
  51322. selector: "testLocalReturnOnDoCatch",
  51323. protocol: "tests",
  51324. fn: function (){
  51325. var self=this,$self=this;
  51326. return $core.withContext(function($ctx1) {
  51327. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  51328. return self;
  51329. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  51330. },
  51331. args: [],
  51332. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  51333. referencedClasses: [],
  51334. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  51335. }),
  51336. $globals.BlockClosureTest);
  51337. $core.addMethod(
  51338. $core.method({
  51339. selector: "testLocalReturnOnDoMiss",
  51340. protocol: "tests",
  51341. fn: function (){
  51342. var self=this,$self=this;
  51343. return $core.withContext(function($ctx1) {
  51344. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  51345. return self;
  51346. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  51347. },
  51348. args: [],
  51349. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  51350. referencedClasses: [],
  51351. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  51352. }),
  51353. $globals.BlockClosureTest);
  51354. $core.addMethod(
  51355. $core.method({
  51356. selector: "testNewWithValues",
  51357. protocol: "tests",
  51358. fn: function (){
  51359. var self=this,$self=this;
  51360. return $core.withContext(function($ctx1) {
  51361. function TestConstructor(arg1, arg2, arg3) {}
  51362. TestConstructor.prototype.name = "theTestPrototype";
  51363. var wrappedConstructor = $recv(TestConstructor);
  51364. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  51365. $self._assert_(result instanceof TestConstructor);
  51366. $self._assert_equals_(result.name, "theTestPrototype");
  51367. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  51368. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  51369. return self;
  51370. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  51371. },
  51372. args: [],
  51373. 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'>",
  51374. referencedClasses: [],
  51375. messageSends: []
  51376. }),
  51377. $globals.BlockClosureTest);
  51378. $core.addMethod(
  51379. $core.method({
  51380. selector: "testNumArgs",
  51381. protocol: "tests",
  51382. fn: function (){
  51383. var self=this,$self=this;
  51384. return $core.withContext(function($ctx1) {
  51385. var $1;
  51386. $1=$recv((function(){
  51387. }))._numArgs();
  51388. $ctx1.sendIdx["numArgs"]=1;
  51389. $self._assert_equals_($1,(0));
  51390. $ctx1.sendIdx["assert:equals:"]=1;
  51391. $self._assert_equals_($recv((function(a,b){
  51392. }))._numArgs(),(2));
  51393. return self;
  51394. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  51395. },
  51396. args: [],
  51397. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  51398. referencedClasses: [],
  51399. messageSends: ["assert:equals:", "numArgs"]
  51400. }),
  51401. $globals.BlockClosureTest);
  51402. $core.addMethod(
  51403. $core.method({
  51404. selector: "testOnDo",
  51405. protocol: "tests",
  51406. fn: function (){
  51407. var self=this,$self=this;
  51408. return $core.withContext(function($ctx1) {
  51409. $self._assert_($recv((function(){
  51410. return $core.withContext(function($ctx2) {
  51411. return $recv($recv($globals.Error)._new())._signal();
  51412. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51413. }))._on_do_($globals.Error,(function(ex){
  51414. return true;
  51415. })));
  51416. return self;
  51417. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  51418. },
  51419. args: [],
  51420. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  51421. referencedClasses: ["Error"],
  51422. messageSends: ["assert:", "on:do:", "signal", "new"]
  51423. }),
  51424. $globals.BlockClosureTest);
  51425. $core.addMethod(
  51426. $core.method({
  51427. selector: "testValue",
  51428. protocol: "tests",
  51429. fn: function (){
  51430. var self=this,$self=this;
  51431. return $core.withContext(function($ctx1) {
  51432. var $1;
  51433. $1=$recv((function(){
  51434. return $core.withContext(function($ctx2) {
  51435. return (1).__plus((1));
  51436. $ctx2.sendIdx["+"]=1;
  51437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51438. }))._value();
  51439. $ctx1.sendIdx["value"]=1;
  51440. $self._assert_equals_($1,(2));
  51441. $ctx1.sendIdx["assert:equals:"]=1;
  51442. $self._assert_equals_($recv((function(x){
  51443. return $core.withContext(function($ctx2) {
  51444. return $recv(x).__plus((1));
  51445. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  51446. }))._value_((2)),(3));
  51447. $ctx1.sendIdx["assert:equals:"]=2;
  51448. $self._assert_equals_($recv((function(x,y){
  51449. return $core.withContext(function($ctx2) {
  51450. return $recv(x).__star(y);
  51451. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  51452. }))._value_value_((2),(4)),(8));
  51453. $ctx1.sendIdx["assert:equals:"]=3;
  51454. $self._assert_equals_($recv((function(a,b,c){
  51455. return (1);
  51456. }))._value(),(1));
  51457. return self;
  51458. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  51459. },
  51460. args: [],
  51461. 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",
  51462. referencedClasses: [],
  51463. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  51464. }),
  51465. $globals.BlockClosureTest);
  51466. $core.addMethod(
  51467. $core.method({
  51468. selector: "testValueWithPossibleArguments",
  51469. protocol: "tests",
  51470. fn: function (){
  51471. var self=this,$self=this;
  51472. return $core.withContext(function($ctx1) {
  51473. var $1,$2;
  51474. $1=$recv((function(){
  51475. return (1);
  51476. }))._valueWithPossibleArguments_([(3), (4)]);
  51477. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  51478. $self._assert_equals_($1,(1));
  51479. $ctx1.sendIdx["assert:equals:"]=1;
  51480. $2=$recv((function(a){
  51481. return $core.withContext(function($ctx2) {
  51482. return $recv(a).__plus((4));
  51483. $ctx2.sendIdx["+"]=1;
  51484. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  51485. }))._valueWithPossibleArguments_([(3), (4)]);
  51486. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  51487. $self._assert_equals_($2,(7));
  51488. $ctx1.sendIdx["assert:equals:"]=2;
  51489. $self._assert_equals_($recv((function(a,b){
  51490. return $core.withContext(function($ctx2) {
  51491. return $recv(a).__plus(b);
  51492. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  51493. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  51494. return self;
  51495. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  51496. },
  51497. args: [],
  51498. 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.",
  51499. referencedClasses: [],
  51500. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  51501. }),
  51502. $globals.BlockClosureTest);
  51503. $core.addMethod(
  51504. $core.method({
  51505. selector: "testWhileFalse",
  51506. protocol: "tests",
  51507. fn: function (){
  51508. var self=this,$self=this;
  51509. var i;
  51510. return $core.withContext(function($ctx1) {
  51511. i=(0);
  51512. $recv((function(){
  51513. return $core.withContext(function($ctx2) {
  51514. return $recv(i).__gt((5));
  51515. $ctx2.sendIdx[">"]=1;
  51516. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51517. }))._whileFalse_((function(){
  51518. return $core.withContext(function($ctx2) {
  51519. i=$recv(i).__plus((1));
  51520. $ctx2.sendIdx["+"]=1;
  51521. return i;
  51522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51523. }));
  51524. $self._assert_equals_(i,(6));
  51525. $ctx1.sendIdx["assert:equals:"]=1;
  51526. i=(0);
  51527. $recv((function(){
  51528. return $core.withContext(function($ctx2) {
  51529. i=$recv(i).__plus((1));
  51530. return $recv(i).__gt((5));
  51531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51532. }))._whileFalse();
  51533. $self._assert_equals_(i,(6));
  51534. return self;
  51535. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  51536. },
  51537. args: [],
  51538. 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",
  51539. referencedClasses: [],
  51540. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  51541. }),
  51542. $globals.BlockClosureTest);
  51543. $core.addMethod(
  51544. $core.method({
  51545. selector: "testWhileTrue",
  51546. protocol: "tests",
  51547. fn: function (){
  51548. var self=this,$self=this;
  51549. var i;
  51550. return $core.withContext(function($ctx1) {
  51551. i=(0);
  51552. $recv((function(){
  51553. return $core.withContext(function($ctx2) {
  51554. return $recv(i).__lt((5));
  51555. $ctx2.sendIdx["<"]=1;
  51556. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51557. }))._whileTrue_((function(){
  51558. return $core.withContext(function($ctx2) {
  51559. i=$recv(i).__plus((1));
  51560. $ctx2.sendIdx["+"]=1;
  51561. return i;
  51562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51563. }));
  51564. $self._assert_equals_(i,(5));
  51565. $ctx1.sendIdx["assert:equals:"]=1;
  51566. i=(0);
  51567. $recv((function(){
  51568. return $core.withContext(function($ctx2) {
  51569. i=$recv(i).__plus((1));
  51570. return $recv(i).__lt((5));
  51571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51572. }))._whileTrue();
  51573. $self._assert_equals_(i,(5));
  51574. return self;
  51575. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  51576. },
  51577. args: [],
  51578. 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",
  51579. referencedClasses: [],
  51580. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  51581. }),
  51582. $globals.BlockClosureTest);
  51583. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  51584. $core.addMethod(
  51585. $core.method({
  51586. selector: "testEquality",
  51587. protocol: "tests",
  51588. fn: function (){
  51589. var self=this,$self=this;
  51590. return $core.withContext(function($ctx1) {
  51591. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51592. $1=(0).__eq(false);
  51593. $ctx1.sendIdx["="]=1;
  51594. $self._deny_($1);
  51595. $ctx1.sendIdx["deny:"]=1;
  51596. $2=false.__eq((0));
  51597. $ctx1.sendIdx["="]=2;
  51598. $self._deny_($2);
  51599. $ctx1.sendIdx["deny:"]=2;
  51600. $3="".__eq(false);
  51601. $ctx1.sendIdx["="]=3;
  51602. $self._deny_($3);
  51603. $ctx1.sendIdx["deny:"]=3;
  51604. $4=false.__eq("");
  51605. $ctx1.sendIdx["="]=4;
  51606. $self._deny_($4);
  51607. $ctx1.sendIdx["deny:"]=4;
  51608. $5=true.__eq(true);
  51609. $ctx1.sendIdx["="]=5;
  51610. $self._assert_($5);
  51611. $ctx1.sendIdx["assert:"]=1;
  51612. $6=false.__eq(true);
  51613. $ctx1.sendIdx["="]=6;
  51614. $self._deny_($6);
  51615. $ctx1.sendIdx["deny:"]=5;
  51616. $7=true.__eq(false);
  51617. $ctx1.sendIdx["="]=7;
  51618. $self._deny_($7);
  51619. $8=false.__eq(false);
  51620. $ctx1.sendIdx["="]=8;
  51621. $self._assert_($8);
  51622. $ctx1.sendIdx["assert:"]=2;
  51623. $10=true._yourself();
  51624. $ctx1.sendIdx["yourself"]=1;
  51625. $9=$recv($10).__eq(true);
  51626. $ctx1.sendIdx["="]=9;
  51627. $self._assert_($9);
  51628. $ctx1.sendIdx["assert:"]=3;
  51629. $12=true._yourself();
  51630. $ctx1.sendIdx["yourself"]=2;
  51631. $11=$recv($12).__eq(true._yourself());
  51632. $self._assert_($11);
  51633. return self;
  51634. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  51635. },
  51636. args: [],
  51637. 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)",
  51638. referencedClasses: [],
  51639. messageSends: ["deny:", "=", "assert:", "yourself"]
  51640. }),
  51641. $globals.BooleanTest);
  51642. $core.addMethod(
  51643. $core.method({
  51644. selector: "testIdentity",
  51645. protocol: "tests",
  51646. fn: function (){
  51647. var self=this,$self=this;
  51648. return $core.withContext(function($ctx1) {
  51649. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51650. $1=(0).__eq_eq(false);
  51651. $ctx1.sendIdx["=="]=1;
  51652. $self._deny_($1);
  51653. $ctx1.sendIdx["deny:"]=1;
  51654. $2=false.__eq_eq((0));
  51655. $ctx1.sendIdx["=="]=2;
  51656. $self._deny_($2);
  51657. $ctx1.sendIdx["deny:"]=2;
  51658. $3="".__eq_eq(false);
  51659. $ctx1.sendIdx["=="]=3;
  51660. $self._deny_($3);
  51661. $ctx1.sendIdx["deny:"]=3;
  51662. $4=false.__eq_eq("");
  51663. $ctx1.sendIdx["=="]=4;
  51664. $self._deny_($4);
  51665. $ctx1.sendIdx["deny:"]=4;
  51666. $5=true.__eq_eq(true);
  51667. $ctx1.sendIdx["=="]=5;
  51668. $self._assert_($5);
  51669. $ctx1.sendIdx["assert:"]=1;
  51670. $6=false.__eq_eq(true);
  51671. $ctx1.sendIdx["=="]=6;
  51672. $self._deny_($6);
  51673. $ctx1.sendIdx["deny:"]=5;
  51674. $7=true.__eq_eq(false);
  51675. $ctx1.sendIdx["=="]=7;
  51676. $self._deny_($7);
  51677. $8=false.__eq_eq(false);
  51678. $ctx1.sendIdx["=="]=8;
  51679. $self._assert_($8);
  51680. $ctx1.sendIdx["assert:"]=2;
  51681. $10=true._yourself();
  51682. $ctx1.sendIdx["yourself"]=1;
  51683. $9=$recv($10).__eq_eq(true);
  51684. $ctx1.sendIdx["=="]=9;
  51685. $self._assert_($9);
  51686. $ctx1.sendIdx["assert:"]=3;
  51687. $12=true._yourself();
  51688. $ctx1.sendIdx["yourself"]=2;
  51689. $11=$recv($12).__eq_eq(true._yourself());
  51690. $self._assert_($11);
  51691. return self;
  51692. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  51693. },
  51694. args: [],
  51695. 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",
  51696. referencedClasses: [],
  51697. messageSends: ["deny:", "==", "assert:", "yourself"]
  51698. }),
  51699. $globals.BooleanTest);
  51700. $core.addMethod(
  51701. $core.method({
  51702. selector: "testIfTrueIfFalse",
  51703. protocol: "tests",
  51704. fn: function (){
  51705. var self=this,$self=this;
  51706. return $core.withContext(function($ctx1) {
  51707. var $1,$2,$3,$4,$5,$6,$7,$8;
  51708. if($core.assert(true)){
  51709. $1="alternative block";
  51710. }
  51711. $self._assert_equals_($1,"alternative block");
  51712. $ctx1.sendIdx["assert:equals:"]=1;
  51713. if(!$core.assert(true)){
  51714. $2="alternative block";
  51715. }
  51716. $self._assert_equals_($2,nil);
  51717. $ctx1.sendIdx["assert:equals:"]=2;
  51718. if($core.assert(false)){
  51719. $3="alternative block";
  51720. }
  51721. $self._assert_equals_($3,nil);
  51722. $ctx1.sendIdx["assert:equals:"]=3;
  51723. if(!$core.assert(false)){
  51724. $4="alternative block";
  51725. }
  51726. $self._assert_equals_($4,"alternative block");
  51727. $ctx1.sendIdx["assert:equals:"]=4;
  51728. if($core.assert(false)){
  51729. $5="alternative block";
  51730. } else {
  51731. $5="alternative block2";
  51732. }
  51733. $self._assert_equals_($5,"alternative block2");
  51734. $ctx1.sendIdx["assert:equals:"]=5;
  51735. if($core.assert(false)){
  51736. $6="alternative block2";
  51737. } else {
  51738. $6="alternative block";
  51739. }
  51740. $self._assert_equals_($6,"alternative block");
  51741. $ctx1.sendIdx["assert:equals:"]=6;
  51742. if($core.assert(true)){
  51743. $7="alternative block";
  51744. } else {
  51745. $7="alternative block2";
  51746. }
  51747. $self._assert_equals_($7,"alternative block");
  51748. $ctx1.sendIdx["assert:equals:"]=7;
  51749. if($core.assert(true)){
  51750. $8="alternative block2";
  51751. } else {
  51752. $8="alternative block";
  51753. }
  51754. $self._assert_equals_($8,"alternative block2");
  51755. return self;
  51756. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  51757. },
  51758. args: [],
  51759. 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'.",
  51760. referencedClasses: [],
  51761. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51762. }),
  51763. $globals.BooleanTest);
  51764. $core.addMethod(
  51765. $core.method({
  51766. selector: "testIfTrueIfFalseWithBoxing",
  51767. protocol: "tests",
  51768. fn: function (){
  51769. var self=this,$self=this;
  51770. return $core.withContext(function($ctx1) {
  51771. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  51772. $2=true._yourself();
  51773. $ctx1.sendIdx["yourself"]=1;
  51774. if($core.assert($2)){
  51775. $1="alternative block";
  51776. }
  51777. $self._assert_equals_($1,"alternative block");
  51778. $ctx1.sendIdx["assert:equals:"]=1;
  51779. $4=true._yourself();
  51780. $ctx1.sendIdx["yourself"]=2;
  51781. if(!$core.assert($4)){
  51782. $3="alternative block";
  51783. }
  51784. $self._assert_equals_($3,nil);
  51785. $ctx1.sendIdx["assert:equals:"]=2;
  51786. $6=false._yourself();
  51787. $ctx1.sendIdx["yourself"]=3;
  51788. if($core.assert($6)){
  51789. $5="alternative block";
  51790. }
  51791. $self._assert_equals_($5,nil);
  51792. $ctx1.sendIdx["assert:equals:"]=3;
  51793. $8=false._yourself();
  51794. $ctx1.sendIdx["yourself"]=4;
  51795. if(!$core.assert($8)){
  51796. $7="alternative block";
  51797. }
  51798. $self._assert_equals_($7,"alternative block");
  51799. $ctx1.sendIdx["assert:equals:"]=4;
  51800. $10=false._yourself();
  51801. $ctx1.sendIdx["yourself"]=5;
  51802. if($core.assert($10)){
  51803. $9="alternative block";
  51804. } else {
  51805. $9="alternative block2";
  51806. }
  51807. $self._assert_equals_($9,"alternative block2");
  51808. $ctx1.sendIdx["assert:equals:"]=5;
  51809. $12=false._yourself();
  51810. $ctx1.sendIdx["yourself"]=6;
  51811. if($core.assert($12)){
  51812. $11="alternative block2";
  51813. } else {
  51814. $11="alternative block";
  51815. }
  51816. $self._assert_equals_($11,"alternative block");
  51817. $ctx1.sendIdx["assert:equals:"]=6;
  51818. $14=true._yourself();
  51819. $ctx1.sendIdx["yourself"]=7;
  51820. if($core.assert($14)){
  51821. $13="alternative block";
  51822. } else {
  51823. $13="alternative block2";
  51824. }
  51825. $self._assert_equals_($13,"alternative block");
  51826. $ctx1.sendIdx["assert:equals:"]=7;
  51827. $16=true._yourself();
  51828. if($core.assert($16)){
  51829. $15="alternative block2";
  51830. } else {
  51831. $15="alternative block";
  51832. }
  51833. $self._assert_equals_($15,"alternative block2");
  51834. return self;
  51835. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  51836. },
  51837. args: [],
  51838. 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'.",
  51839. referencedClasses: [],
  51840. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51841. }),
  51842. $globals.BooleanTest);
  51843. $core.addMethod(
  51844. $core.method({
  51845. selector: "testLogic",
  51846. protocol: "tests",
  51847. fn: function (){
  51848. var self=this,$self=this;
  51849. return $core.withContext(function($ctx1) {
  51850. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  51851. $1=true.__and(true);
  51852. $ctx1.sendIdx["&"]=1;
  51853. $self._assert_($1);
  51854. $ctx1.sendIdx["assert:"]=1;
  51855. $2=true.__and(false);
  51856. $ctx1.sendIdx["&"]=2;
  51857. $self._deny_($2);
  51858. $ctx1.sendIdx["deny:"]=1;
  51859. $3=false.__and(true);
  51860. $ctx1.sendIdx["&"]=3;
  51861. $self._deny_($3);
  51862. $ctx1.sendIdx["deny:"]=2;
  51863. $5=false.__and(false);
  51864. $ctx1.sendIdx["&"]=4;
  51865. $4=$self._deny_($5);
  51866. $ctx1.sendIdx["deny:"]=3;
  51867. $6=true.__or(true);
  51868. $ctx1.sendIdx["|"]=1;
  51869. $self._assert_($6);
  51870. $ctx1.sendIdx["assert:"]=2;
  51871. $7=true.__or(false);
  51872. $ctx1.sendIdx["|"]=2;
  51873. $self._assert_($7);
  51874. $ctx1.sendIdx["assert:"]=3;
  51875. $8=false.__or(true);
  51876. $ctx1.sendIdx["|"]=3;
  51877. $self._assert_($8);
  51878. $ctx1.sendIdx["assert:"]=4;
  51879. $10=false.__or(false);
  51880. $ctx1.sendIdx["|"]=4;
  51881. $9=$self._deny_($10);
  51882. $ctx1.sendIdx["deny:"]=4;
  51883. $12=(1).__gt((0));
  51884. $ctx1.sendIdx[">"]=1;
  51885. $11=true.__and($12);
  51886. $ctx1.sendIdx["&"]=5;
  51887. $self._assert_($11);
  51888. $ctx1.sendIdx["assert:"]=5;
  51889. $14=(1).__gt((0));
  51890. $ctx1.sendIdx[">"]=2;
  51891. $13=$recv($14).__and(false);
  51892. $ctx1.sendIdx["&"]=6;
  51893. $self._deny_($13);
  51894. $ctx1.sendIdx["deny:"]=5;
  51895. $16=(1).__gt((0));
  51896. $ctx1.sendIdx[">"]=3;
  51897. $17=(1).__gt((2));
  51898. $ctx1.sendIdx[">"]=4;
  51899. $15=$recv($16).__and($17);
  51900. $self._deny_($15);
  51901. $19=(1).__gt((0));
  51902. $ctx1.sendIdx[">"]=5;
  51903. $18=false.__or($19);
  51904. $ctx1.sendIdx["|"]=5;
  51905. $self._assert_($18);
  51906. $ctx1.sendIdx["assert:"]=6;
  51907. $21=(1).__gt((0));
  51908. $ctx1.sendIdx[">"]=6;
  51909. $20=$recv($21).__or(false);
  51910. $ctx1.sendIdx["|"]=6;
  51911. $self._assert_($20);
  51912. $ctx1.sendIdx["assert:"]=7;
  51913. $23=(1).__gt((0));
  51914. $ctx1.sendIdx[">"]=7;
  51915. $22=$recv($23).__or((1).__gt((2)));
  51916. $self._assert_($22);
  51917. return self;
  51918. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  51919. },
  51920. args: [],
  51921. 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))",
  51922. referencedClasses: [],
  51923. messageSends: ["assert:", "&", "deny:", "|", ">"]
  51924. }),
  51925. $globals.BooleanTest);
  51926. $core.addMethod(
  51927. $core.method({
  51928. selector: "testLogicKeywords",
  51929. protocol: "tests",
  51930. fn: function (){
  51931. var self=this,$self=this;
  51932. return $core.withContext(function($ctx1) {
  51933. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  51934. $1=true._and_((function(){
  51935. return true;
  51936. }));
  51937. $ctx1.sendIdx["and:"]=1;
  51938. $self._assert_($1);
  51939. $ctx1.sendIdx["assert:"]=1;
  51940. $2=true._and_((function(){
  51941. return false;
  51942. }));
  51943. $ctx1.sendIdx["and:"]=2;
  51944. $self._deny_($2);
  51945. $ctx1.sendIdx["deny:"]=1;
  51946. $3=false._and_((function(){
  51947. return true;
  51948. }));
  51949. $ctx1.sendIdx["and:"]=3;
  51950. $self._deny_($3);
  51951. $ctx1.sendIdx["deny:"]=2;
  51952. $5=false._and_((function(){
  51953. return false;
  51954. }));
  51955. $ctx1.sendIdx["and:"]=4;
  51956. $4=$self._deny_($5);
  51957. $ctx1.sendIdx["deny:"]=3;
  51958. $6=true._or_((function(){
  51959. return true;
  51960. }));
  51961. $ctx1.sendIdx["or:"]=1;
  51962. $self._assert_($6);
  51963. $ctx1.sendIdx["assert:"]=2;
  51964. $7=true._or_((function(){
  51965. return false;
  51966. }));
  51967. $ctx1.sendIdx["or:"]=2;
  51968. $self._assert_($7);
  51969. $ctx1.sendIdx["assert:"]=3;
  51970. $8=false._or_((function(){
  51971. return true;
  51972. }));
  51973. $ctx1.sendIdx["or:"]=3;
  51974. $self._assert_($8);
  51975. $ctx1.sendIdx["assert:"]=4;
  51976. $10=false._or_((function(){
  51977. return false;
  51978. }));
  51979. $ctx1.sendIdx["or:"]=4;
  51980. $9=$self._deny_($10);
  51981. $ctx1.sendIdx["deny:"]=4;
  51982. $11=true._and_((function(){
  51983. return $core.withContext(function($ctx2) {
  51984. return (1).__gt((0));
  51985. $ctx2.sendIdx[">"]=1;
  51986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  51987. }));
  51988. $ctx1.sendIdx["and:"]=5;
  51989. $self._assert_($11);
  51990. $ctx1.sendIdx["assert:"]=5;
  51991. $13=(1).__gt((0));
  51992. $ctx1.sendIdx[">"]=2;
  51993. $12=$recv($13)._and_((function(){
  51994. return false;
  51995. }));
  51996. $ctx1.sendIdx["and:"]=6;
  51997. $self._deny_($12);
  51998. $ctx1.sendIdx["deny:"]=5;
  51999. $15=(1).__gt((0));
  52000. $ctx1.sendIdx[">"]=3;
  52001. $14=$recv($15)._and_((function(){
  52002. return $core.withContext(function($ctx2) {
  52003. return (1).__gt((2));
  52004. $ctx2.sendIdx[">"]=4;
  52005. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  52006. }));
  52007. $self._deny_($14);
  52008. $16=false._or_((function(){
  52009. return $core.withContext(function($ctx2) {
  52010. return (1).__gt((0));
  52011. $ctx2.sendIdx[">"]=5;
  52012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  52013. }));
  52014. $ctx1.sendIdx["or:"]=5;
  52015. $self._assert_($16);
  52016. $ctx1.sendIdx["assert:"]=6;
  52017. $18=(1).__gt((0));
  52018. $ctx1.sendIdx[">"]=6;
  52019. $17=$recv($18)._or_((function(){
  52020. return false;
  52021. }));
  52022. $ctx1.sendIdx["or:"]=6;
  52023. $self._assert_($17);
  52024. $ctx1.sendIdx["assert:"]=7;
  52025. $20=(1).__gt((0));
  52026. $ctx1.sendIdx[">"]=7;
  52027. $19=$recv($20)._or_((function(){
  52028. return $core.withContext(function($ctx2) {
  52029. return (1).__gt((2));
  52030. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  52031. }));
  52032. $self._assert_($19);
  52033. return self;
  52034. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  52035. },
  52036. args: [],
  52037. 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 ])",
  52038. referencedClasses: [],
  52039. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  52040. }),
  52041. $globals.BooleanTest);
  52042. $core.addMethod(
  52043. $core.method({
  52044. selector: "testNonBooleanError",
  52045. protocol: "tests",
  52046. fn: function (){
  52047. var self=this,$self=this;
  52048. return $core.withContext(function($ctx1) {
  52049. $self._should_raise_((function(){
  52050. return $core.withContext(function($ctx2) {
  52051. if($core.assert("")){
  52052. } else {
  52053. }
  52054. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52055. }),$globals.NonBooleanReceiver);
  52056. return self;
  52057. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  52058. },
  52059. args: [],
  52060. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  52061. referencedClasses: ["NonBooleanReceiver"],
  52062. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  52063. }),
  52064. $globals.BooleanTest);
  52065. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  52066. $core.addMethod(
  52067. $core.method({
  52068. selector: "setUp",
  52069. protocol: "running",
  52070. fn: function (){
  52071. var self=this,$self=this;
  52072. return $core.withContext(function($ctx1) {
  52073. $self.builder=$recv($globals.ClassBuilder)._new();
  52074. return self;
  52075. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  52076. },
  52077. args: [],
  52078. source: "setUp\x0a\x09builder := ClassBuilder new",
  52079. referencedClasses: ["ClassBuilder"],
  52080. messageSends: ["new"]
  52081. }),
  52082. $globals.ClassBuilderTest);
  52083. $core.addMethod(
  52084. $core.method({
  52085. selector: "tearDown",
  52086. protocol: "running",
  52087. fn: function (){
  52088. var self=this,$self=this;
  52089. return $core.withContext(function($ctx1) {
  52090. var $1,$receiver;
  52091. $1=$self.theClass;
  52092. if(($receiver = $1) == null || $receiver.a$nil){
  52093. $1;
  52094. } else {
  52095. $recv($globals.Smalltalk)._removeClass_($self.theClass);
  52096. $self._deny_($recv($recv($recv($self.theClass)._package())._classes())._includes_($self.theClass));
  52097. $self._assert_equals_($recv($recv($globals.Smalltalk)._globals())._at_($recv($self.theClass)._name()),nil);
  52098. $self.theClass=nil;
  52099. $self.theClass;
  52100. }
  52101. return self;
  52102. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  52103. },
  52104. args: [],
  52105. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09self deny: (theClass package classes includes: theClass).\x0a\x09\x09self assert: (Smalltalk globals at: theClass name) equals: nil.\x0a\x09\x09theClass := nil ]",
  52106. referencedClasses: ["Smalltalk"],
  52107. messageSends: ["ifNotNil:", "removeClass:", "deny:", "includes:", "classes", "package", "assert:equals:", "at:", "globals", "name"]
  52108. }),
  52109. $globals.ClassBuilderTest);
  52110. $core.addMethod(
  52111. $core.method({
  52112. selector: "testAddTrait",
  52113. protocol: "tests",
  52114. fn: function (){
  52115. var self=this,$self=this;
  52116. return $core.withContext(function($ctx1) {
  52117. var $3,$2,$1,$4;
  52118. $self.theClass=$recv($self.builder)._addTraitNamed_package_("ObjectMock2","Kernel-Tests");
  52119. $self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2");
  52120. $ctx1.sendIdx["assert:equals:"]=1;
  52121. $3=$recv($self.theClass)._package();
  52122. $ctx1.sendIdx["package"]=1;
  52123. $2=$recv($3)._classes();
  52124. $1=$recv($2)._occurrencesOf_($self.theClass);
  52125. $self._assert_equals_($1,(1));
  52126. $ctx1.sendIdx["assert:equals:"]=2;
  52127. $4=$recv($self.theClass)._package();
  52128. $ctx1.sendIdx["package"]=2;
  52129. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  52130. return self;
  52131. }, function($ctx1) {$ctx1.fill(self,"testAddTrait",{},$globals.ClassBuilderTest)});
  52132. },
  52133. args: [],
  52134. 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",
  52135. referencedClasses: ["ObjectMock"],
  52136. messageSends: ["addTraitNamed:package:", "assert:equals:", "name", "occurrencesOf:", "classes", "package"]
  52137. }),
  52138. $globals.ClassBuilderTest);
  52139. $core.addMethod(
  52140. $core.method({
  52141. selector: "testClassCopy",
  52142. protocol: "tests",
  52143. fn: function (){
  52144. var self=this,$self=this;
  52145. return $core.withContext(function($ctx1) {
  52146. var $2,$1,$4,$3,$6,$7,$5,$9,$8;
  52147. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52148. $2=$recv($self.theClass)._superclass();
  52149. $ctx1.sendIdx["superclass"]=1;
  52150. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52151. $ctx1.sendIdx["=="]=1;
  52152. $self._assert_($1);
  52153. $ctx1.sendIdx["assert:"]=1;
  52154. $4=$recv($self.theClass)._instanceVariableNames();
  52155. $ctx1.sendIdx["instanceVariableNames"]=1;
  52156. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52157. $ctx1.sendIdx["=="]=2;
  52158. $self._assert_($3);
  52159. $ctx1.sendIdx["assert:"]=2;
  52160. $self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2");
  52161. $ctx1.sendIdx["assert:equals:"]=1;
  52162. $6=$recv($self.theClass)._package();
  52163. $ctx1.sendIdx["package"]=1;
  52164. $7=$recv($globals.ObjectMock)._package();
  52165. $ctx1.sendIdx["package"]=2;
  52166. $5=$recv($6).__eq_eq($7);
  52167. $self._assert_($5);
  52168. $ctx1.sendIdx["assert:"]=3;
  52169. $self._assert_($recv($recv($recv($self.theClass)._package())._classes())._includes_($self.theClass));
  52170. $9=$recv($self.theClass)._methodDictionary();
  52171. $ctx1.sendIdx["methodDictionary"]=1;
  52172. $8=$recv($9)._keys();
  52173. $ctx1.sendIdx["keys"]=1;
  52174. $self._assert_equals_($8,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52175. return self;
  52176. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  52177. },
  52178. args: [],
  52179. 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",
  52180. referencedClasses: ["ObjectMock"],
  52181. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "includes:", "classes", "keys", "methodDictionary"]
  52182. }),
  52183. $globals.ClassBuilderTest);
  52184. $core.addMethod(
  52185. $core.method({
  52186. selector: "testClassMigration",
  52187. protocol: "tests",
  52188. fn: function (){
  52189. var self=this,$self=this;
  52190. var instance,oldClass;
  52191. return $core.withContext(function($ctx1) {
  52192. var $2,$1,$3,$4,$5,$6,$8,$7,$10,$9;
  52193. oldClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52194. $2=$recv($globals.Smalltalk)._globals();
  52195. $ctx1.sendIdx["globals"]=1;
  52196. $1=$recv($2)._at_("ObjectMock2");
  52197. $ctx1.sendIdx["at:"]=1;
  52198. instance=$recv($1)._new();
  52199. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_("ObjectMock2","","Kernel-Tests");
  52200. $3=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  52201. $ctx1.sendIdx["=="]=1;
  52202. $self._deny_($3);
  52203. $ctx1.sendIdx["deny:"]=1;
  52204. $4=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  52205. $ctx1.sendIdx["=="]=2;
  52206. $self._assert_($4);
  52207. $ctx1.sendIdx["assert:"]=1;
  52208. $self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  52209. $ctx1.sendIdx["assert:"]=2;
  52210. $5=$recv($globals.ObjectMock2)._selectors();
  52211. $ctx1.sendIdx["selectors"]=1;
  52212. $self._assert_equals_($5,$recv(oldClass)._selectors());
  52213. $ctx1.sendIdx["assert:equals:"]=1;
  52214. $6=$recv($globals.ObjectMock2)._comment();
  52215. $ctx1.sendIdx["comment"]=1;
  52216. $self._assert_equals_($6,$recv(oldClass)._comment());
  52217. $ctx1.sendIdx["assert:equals:"]=2;
  52218. $8=$recv($globals.ObjectMock2)._package();
  52219. $ctx1.sendIdx["package"]=1;
  52220. $7=$recv($8)._name();
  52221. $ctx1.sendIdx["name"]=1;
  52222. $self._assert_equals_($7,"Kernel-Tests");
  52223. $self._assert_($recv($recv($recv($globals.ObjectMock2)._package())._classes())._includes_($globals.ObjectMock2));
  52224. $ctx1.sendIdx["assert:"]=3;
  52225. $10=$recv(instance)._class();
  52226. $ctx1.sendIdx["class"]=1;
  52227. $9=$recv($10).__eq_eq($globals.ObjectMock2);
  52228. $self._deny_($9);
  52229. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  52230. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  52231. return self;
  52232. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  52233. },
  52234. args: [],
  52235. 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: #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",
  52236. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  52237. 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:"]
  52238. }),
  52239. $globals.ClassBuilderTest);
  52240. $core.addMethod(
  52241. $core.method({
  52242. selector: "testClassMigrationWithClassInstanceVariables",
  52243. protocol: "tests",
  52244. fn: function (){
  52245. var self=this,$self=this;
  52246. return $core.withContext(function($ctx1) {
  52247. var $1;
  52248. $recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52249. $1=$recv($globals.ObjectMock2)._class();
  52250. $ctx1.sendIdx["class"]=1;
  52251. $recv($1)._instanceVariableNames_("foo bar");
  52252. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"))._name(),"","Kernel-Tests");
  52253. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  52254. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  52255. return self;
  52256. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  52257. },
  52258. args: [],
  52259. 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') name\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",
  52260. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  52261. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "name", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  52262. }),
  52263. $globals.ClassBuilderTest);
  52264. $core.addMethod(
  52265. $core.method({
  52266. selector: "testClassMigrationWithSubclasses",
  52267. protocol: "tests",
  52268. fn: function (){
  52269. var self=this,$self=this;
  52270. return $core.withContext(function($ctx1) {
  52271. var $2,$1,$4,$3;
  52272. $recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52273. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  52274. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  52275. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  52276. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  52277. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_("ObjectMock2","","Kernel-Tests");
  52278. $2=$recv($globals.ObjectMock)._subclasses();
  52279. $ctx1.sendIdx["subclasses"]=1;
  52280. $1=$recv($2)._includes_($globals.ObjectMock2);
  52281. $ctx1.sendIdx["includes:"]=1;
  52282. $self._assert_($1);
  52283. $ctx1.sendIdx["assert:"]=1;
  52284. $4=$recv($globals.ObjectMock2)._subclasses();
  52285. $ctx1.sendIdx["subclasses"]=2;
  52286. $3=$recv($4)._includes_($globals.ObjectMock3);
  52287. $ctx1.sendIdx["includes:"]=2;
  52288. $self._assert_($3);
  52289. $ctx1.sendIdx["assert:"]=2;
  52290. $self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  52291. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  52292. return $core.withContext(function($ctx2) {
  52293. return $recv($globals.Smalltalk)._removeClass_(each);
  52294. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52295. }));
  52296. return self;
  52297. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  52298. },
  52299. args: [],
  52300. 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: '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 ]",
  52301. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "ObjectMock4", "Smalltalk"],
  52302. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  52303. }),
  52304. $globals.ClassBuilderTest);
  52305. $core.addMethod(
  52306. $core.method({
  52307. selector: "testSubclass",
  52308. protocol: "tests",
  52309. fn: function (){
  52310. var self=this,$self=this;
  52311. return $core.withContext(function($ctx1) {
  52312. var $3,$2,$1,$4;
  52313. $self.theClass=$recv($self.builder)._addSubclassOf_named_instanceVariableNames_package_($globals.ObjectMock,"ObjectMock2",["foo", "bar"],"Kernel-Tests");
  52314. $self._assert_equals_($recv($self.theClass)._superclass(),$globals.ObjectMock);
  52315. $ctx1.sendIdx["assert:equals:"]=1;
  52316. $self._assert_equals_($recv($self.theClass)._instanceVariableNames(),["foo", "bar"]);
  52317. $ctx1.sendIdx["assert:equals:"]=2;
  52318. $self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2");
  52319. $ctx1.sendIdx["assert:equals:"]=3;
  52320. $3=$recv($self.theClass)._package();
  52321. $ctx1.sendIdx["package"]=1;
  52322. $2=$recv($3)._classes();
  52323. $1=$recv($2)._occurrencesOf_($self.theClass);
  52324. $self._assert_equals_($1,(1));
  52325. $ctx1.sendIdx["assert:equals:"]=4;
  52326. $4=$recv($self.theClass)._package();
  52327. $ctx1.sendIdx["package"]=2;
  52328. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  52329. $ctx1.sendIdx["assert:equals:"]=5;
  52330. $self._assert_equals_($recv($recv($recv($self.theClass)._methodDictionary())._keys())._size(),(0));
  52331. return self;
  52332. }, function($ctx1) {$ctx1.fill(self,"testSubclass",{},$globals.ClassBuilderTest)});
  52333. },
  52334. args: [],
  52335. 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",
  52336. referencedClasses: ["ObjectMock"],
  52337. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "assert:equals:", "superclass", "instanceVariableNames", "name", "occurrencesOf:", "classes", "package", "size", "keys", "methodDictionary"]
  52338. }),
  52339. $globals.ClassBuilderTest);
  52340. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  52341. $core.addMethod(
  52342. $core.method({
  52343. selector: "jsConstructor",
  52344. protocol: "running",
  52345. fn: function (){
  52346. var self=this,$self=this;
  52347. return $core.withContext(function($ctx1) {
  52348. function Foo(){}
  52349. Foo.prototype.valueOf = function () {return 4;};
  52350. return Foo;
  52351. ;
  52352. return self;
  52353. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  52354. },
  52355. args: [],
  52356. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  52357. referencedClasses: [],
  52358. messageSends: []
  52359. }),
  52360. $globals.ClassTest);
  52361. $core.addMethod(
  52362. $core.method({
  52363. selector: "setUp",
  52364. protocol: "running",
  52365. fn: function (){
  52366. var self=this,$self=this;
  52367. return $core.withContext(function($ctx1) {
  52368. $self.builder=$recv($globals.ClassBuilder)._new();
  52369. return self;
  52370. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  52371. },
  52372. args: [],
  52373. source: "setUp\x0a\x09builder := ClassBuilder new",
  52374. referencedClasses: ["ClassBuilder"],
  52375. messageSends: ["new"]
  52376. }),
  52377. $globals.ClassTest);
  52378. $core.addMethod(
  52379. $core.method({
  52380. selector: "tearDown",
  52381. protocol: "running",
  52382. fn: function (){
  52383. var self=this,$self=this;
  52384. return $core.withContext(function($ctx1) {
  52385. var $1,$receiver;
  52386. $1=$self.theClass;
  52387. if(($receiver = $1) == null || $receiver.a$nil){
  52388. $1;
  52389. } else {
  52390. $recv($recv($self.theClass)._allSubclasses())._reverseDo_((function(each){
  52391. return $core.withContext(function($ctx2) {
  52392. return $recv($globals.Smalltalk)._removeClass_(each);
  52393. $ctx2.sendIdx["removeClass:"]=1;
  52394. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52395. }));
  52396. $recv($globals.Smalltalk)._removeClass_($self.theClass);
  52397. $self.theClass=nil;
  52398. $self.theClass;
  52399. }
  52400. return self;
  52401. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  52402. },
  52403. args: [],
  52404. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  52405. referencedClasses: ["Smalltalk"],
  52406. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  52407. }),
  52408. $globals.ClassTest);
  52409. $core.addMethod(
  52410. $core.method({
  52411. selector: "testAllSubclasses",
  52412. protocol: "tests",
  52413. fn: function (){
  52414. var self=this,$self=this;
  52415. var subclasses,index;
  52416. return $core.withContext(function($ctx1) {
  52417. subclasses=$recv($globals.Object)._subclasses();
  52418. $ctx1.sendIdx["subclasses"]=1;
  52419. index=(1);
  52420. $recv((function(){
  52421. return $core.withContext(function($ctx2) {
  52422. return $recv(index).__gt($recv(subclasses)._size());
  52423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52424. }))._whileFalse_((function(){
  52425. return $core.withContext(function($ctx2) {
  52426. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  52427. index=$recv(index).__plus((1));
  52428. return index;
  52429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  52430. }));
  52431. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  52432. return self;
  52433. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  52434. },
  52435. args: [],
  52436. 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",
  52437. referencedClasses: ["Object"],
  52438. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  52439. }),
  52440. $globals.ClassTest);
  52441. $core.addMethod(
  52442. $core.method({
  52443. selector: "testMetaclassSubclasses",
  52444. protocol: "tests",
  52445. fn: function (){
  52446. var self=this,$self=this;
  52447. var subclasses;
  52448. return $core.withContext(function($ctx1) {
  52449. var $4,$3,$2,$1;
  52450. $4=$recv($globals.Object)._class();
  52451. $ctx1.sendIdx["class"]=1;
  52452. $3=$recv($4)._instanceClass();
  52453. $2=$recv($3)._subclasses();
  52454. $ctx1.sendIdx["subclasses"]=1;
  52455. $1=$recv($2)._select_((function(each){
  52456. return $core.withContext(function($ctx2) {
  52457. return $recv($recv(each)._isMetaclass())._not();
  52458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52459. }));
  52460. subclasses=$recv($1)._collect_((function(each){
  52461. return $core.withContext(function($ctx2) {
  52462. return $recv(each)._theMetaClass();
  52463. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52464. }));
  52465. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  52466. return self;
  52467. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  52468. },
  52469. args: [],
  52470. 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",
  52471. referencedClasses: ["Object"],
  52472. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  52473. }),
  52474. $globals.ClassTest);
  52475. $core.addMethod(
  52476. $core.method({
  52477. selector: "testSetJavaScriptConstructor",
  52478. protocol: "tests",
  52479. fn: function (){
  52480. var self=this,$self=this;
  52481. var instance;
  52482. return $core.withContext(function($ctx1) {
  52483. var $2,$1,$4,$3,$6,$5,$8,$7;
  52484. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52485. $recv($self.theClass)._javascriptConstructor_($self._jsConstructor());
  52486. $2=$recv($self.theClass)._superclass();
  52487. $ctx1.sendIdx["superclass"]=1;
  52488. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52489. $ctx1.sendIdx["=="]=1;
  52490. $self._assert_($1);
  52491. $ctx1.sendIdx["assert:"]=1;
  52492. $4=$recv($self.theClass)._instanceVariableNames();
  52493. $ctx1.sendIdx["instanceVariableNames"]=1;
  52494. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52495. $ctx1.sendIdx["=="]=2;
  52496. $self._assert_($3);
  52497. $ctx1.sendIdx["assert:"]=2;
  52498. $self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2");
  52499. $ctx1.sendIdx["assert:equals:"]=1;
  52500. $6=$recv($self.theClass)._package();
  52501. $ctx1.sendIdx["package"]=1;
  52502. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52503. $ctx1.sendIdx["=="]=3;
  52504. $self._assert_($5);
  52505. $ctx1.sendIdx["assert:"]=3;
  52506. $8=$recv($self.theClass)._methodDictionary();
  52507. $ctx1.sendIdx["methodDictionary"]=1;
  52508. $7=$recv($8)._keys();
  52509. $ctx1.sendIdx["keys"]=1;
  52510. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52511. $ctx1.sendIdx["assert:equals:"]=2;
  52512. instance=$recv($self.theClass)._new();
  52513. $self._assert_($recv($recv(instance)._class()).__eq_eq($self.theClass));
  52514. $self._assert_equals_($recv(instance)._value(),(4));
  52515. $ctx1.sendIdx["assert:equals:"]=3;
  52516. $self._shouldnt_raise_((function(){
  52517. return $core.withContext(function($ctx2) {
  52518. return $recv(instance)._foo_((9));
  52519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52520. }),$globals.Error);
  52521. $self._assert_equals_($recv(instance)._foo(),(9));
  52522. return self;
  52523. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52524. },
  52525. args: [],
  52526. 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",
  52527. referencedClasses: ["ObjectMock", "Error"],
  52528. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52529. }),
  52530. $globals.ClassTest);
  52531. $core.addMethod(
  52532. $core.method({
  52533. selector: "testSlotsFromInstanceVariablesString",
  52534. protocol: "tests",
  52535. fn: function (){
  52536. var self=this,$self=this;
  52537. return $core.withContext(function($ctx1) {
  52538. $self._assert_equals_(" hello world "._instanceVariablesStringAsSlotList(),["hello", "world"]);
  52539. return self;
  52540. }, function($ctx1) {$ctx1.fill(self,"testSlotsFromInstanceVariablesString",{},$globals.ClassTest)});
  52541. },
  52542. args: [],
  52543. source: "testSlotsFromInstanceVariablesString\x0a\x09self assert: ' hello world ' instanceVariablesStringAsSlotList equals: #('hello' 'world')",
  52544. referencedClasses: [],
  52545. messageSends: ["assert:equals:", "instanceVariablesStringAsSlotList"]
  52546. }),
  52547. $globals.ClassTest);
  52548. $core.addMethod(
  52549. $core.method({
  52550. selector: "testTrickySetJavaScriptConstructor",
  52551. protocol: "tests",
  52552. fn: function (){
  52553. var self=this,$self=this;
  52554. var instance;
  52555. return $core.withContext(function($ctx1) {
  52556. var $2,$1,$4,$3,$6,$5,$8,$7;
  52557. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52558. $recv($self.theClass)._javascriptConstructor_($self._trickyJsConstructor());
  52559. $2=$recv($self.theClass)._superclass();
  52560. $ctx1.sendIdx["superclass"]=1;
  52561. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52562. $ctx1.sendIdx["=="]=1;
  52563. $self._assert_($1);
  52564. $ctx1.sendIdx["assert:"]=1;
  52565. $4=$recv($self.theClass)._instanceVariableNames();
  52566. $ctx1.sendIdx["instanceVariableNames"]=1;
  52567. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52568. $ctx1.sendIdx["=="]=2;
  52569. $self._assert_($3);
  52570. $ctx1.sendIdx["assert:"]=2;
  52571. $self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2");
  52572. $ctx1.sendIdx["assert:equals:"]=1;
  52573. $6=$recv($self.theClass)._package();
  52574. $ctx1.sendIdx["package"]=1;
  52575. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52576. $ctx1.sendIdx["=="]=3;
  52577. $self._assert_($5);
  52578. $ctx1.sendIdx["assert:"]=3;
  52579. $8=$recv($self.theClass)._methodDictionary();
  52580. $ctx1.sendIdx["methodDictionary"]=1;
  52581. $7=$recv($8)._keys();
  52582. $ctx1.sendIdx["keys"]=1;
  52583. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52584. $ctx1.sendIdx["assert:equals:"]=2;
  52585. instance=$recv($self.theClass)._new();
  52586. $self._assert_($recv($recv(instance)._class()).__eq_eq($self.theClass));
  52587. $self._assert_equals_($recv(instance)._value(),(4));
  52588. $ctx1.sendIdx["assert:equals:"]=3;
  52589. $self._shouldnt_raise_((function(){
  52590. return $core.withContext(function($ctx2) {
  52591. return $recv(instance)._foo_((9));
  52592. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52593. }),$globals.Error);
  52594. $self._assert_equals_($recv(instance)._foo(),(9));
  52595. return self;
  52596. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52597. },
  52598. args: [],
  52599. 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",
  52600. referencedClasses: ["ObjectMock", "Error"],
  52601. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52602. }),
  52603. $globals.ClassTest);
  52604. $core.addMethod(
  52605. $core.method({
  52606. selector: "trickyJsConstructor",
  52607. protocol: "running",
  52608. fn: function (){
  52609. var self=this,$self=this;
  52610. return $core.withContext(function($ctx1) {
  52611. function Foo(){}
  52612. Foo.prototype.valueOf = function () {return 4;};
  52613. Foo.prototype._foo = function () {return "bar";};
  52614. return Foo;
  52615. ;
  52616. return self;
  52617. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  52618. },
  52619. args: [],
  52620. 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'>",
  52621. referencedClasses: [],
  52622. messageSends: []
  52623. }),
  52624. $globals.ClassTest);
  52625. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  52626. $core.addMethod(
  52627. $core.method({
  52628. selector: "assertSameContents:as:",
  52629. protocol: "convenience",
  52630. fn: function (aCollection,anotherCollection){
  52631. var self=this,$self=this;
  52632. return $core.withContext(function($ctx1) {
  52633. var $2,$1,$4,$3;
  52634. $2=$recv(aCollection)._size();
  52635. $ctx1.sendIdx["size"]=1;
  52636. $1=$recv($2).__eq($recv(anotherCollection)._size());
  52637. $ctx1.sendIdx["="]=1;
  52638. $self._assert_($1);
  52639. $ctx1.sendIdx["assert:"]=1;
  52640. $recv(aCollection)._do_((function(each){
  52641. return $core.withContext(function($ctx2) {
  52642. $4=$recv(aCollection)._occurrencesOf_(each);
  52643. $ctx2.sendIdx["occurrencesOf:"]=1;
  52644. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  52645. return $self._assert_($3);
  52646. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52647. }));
  52648. return self;
  52649. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  52650. },
  52651. args: ["aCollection", "anotherCollection"],
  52652. 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)) ]",
  52653. referencedClasses: [],
  52654. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  52655. }),
  52656. $globals.CollectionTest);
  52657. $core.addMethod(
  52658. $core.method({
  52659. selector: "collection",
  52660. protocol: "fixture",
  52661. fn: function (){
  52662. var self=this,$self=this;
  52663. return $core.withContext(function($ctx1) {
  52664. $self._subclassResponsibility();
  52665. return self;
  52666. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  52667. },
  52668. args: [],
  52669. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  52670. referencedClasses: [],
  52671. messageSends: ["subclassResponsibility"]
  52672. }),
  52673. $globals.CollectionTest);
  52674. $core.addMethod(
  52675. $core.method({
  52676. selector: "collectionClass",
  52677. protocol: "fixture",
  52678. fn: function (){
  52679. var self=this,$self=this;
  52680. return $core.withContext(function($ctx1) {
  52681. return $recv($self._class())._collectionClass();
  52682. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  52683. },
  52684. args: [],
  52685. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  52686. referencedClasses: [],
  52687. messageSends: ["collectionClass", "class"]
  52688. }),
  52689. $globals.CollectionTest);
  52690. $core.addMethod(
  52691. $core.method({
  52692. selector: "collectionOfPrintStrings",
  52693. protocol: "fixture",
  52694. fn: function (){
  52695. var self=this,$self=this;
  52696. return $core.withContext(function($ctx1) {
  52697. $self._subclassResponsibility();
  52698. return self;
  52699. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  52700. },
  52701. args: [],
  52702. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  52703. referencedClasses: [],
  52704. messageSends: ["subclassResponsibility"]
  52705. }),
  52706. $globals.CollectionTest);
  52707. $core.addMethod(
  52708. $core.method({
  52709. selector: "collectionSize",
  52710. protocol: "fixture",
  52711. fn: function (){
  52712. var self=this,$self=this;
  52713. return $core.withContext(function($ctx1) {
  52714. $self._subclassResponsibility();
  52715. return self;
  52716. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  52717. },
  52718. args: [],
  52719. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  52720. referencedClasses: [],
  52721. messageSends: ["subclassResponsibility"]
  52722. }),
  52723. $globals.CollectionTest);
  52724. $core.addMethod(
  52725. $core.method({
  52726. selector: "collectionWithDuplicates",
  52727. protocol: "fixture",
  52728. fn: function (){
  52729. var self=this,$self=this;
  52730. return $core.withContext(function($ctx1) {
  52731. $self._subclassResponsibility();
  52732. return self;
  52733. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  52734. },
  52735. args: [],
  52736. 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",
  52737. referencedClasses: [],
  52738. messageSends: ["subclassResponsibility"]
  52739. }),
  52740. $globals.CollectionTest);
  52741. $core.addMethod(
  52742. $core.method({
  52743. selector: "collectionWithNewValue",
  52744. protocol: "fixture",
  52745. fn: function (){
  52746. var self=this,$self=this;
  52747. return $core.withContext(function($ctx1) {
  52748. $self._subclassResponsibility();
  52749. return self;
  52750. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  52751. },
  52752. args: [],
  52753. 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",
  52754. referencedClasses: [],
  52755. messageSends: ["subclassResponsibility"]
  52756. }),
  52757. $globals.CollectionTest);
  52758. $core.addMethod(
  52759. $core.method({
  52760. selector: "initialize",
  52761. protocol: "initialization",
  52762. fn: function (){
  52763. var self=this,$self=this;
  52764. return $core.withContext(function($ctx1) {
  52765. (
  52766. $ctx1.supercall = true,
  52767. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  52768. $ctx1.supercall = false;
  52769. $self.sampleBlock=(function(){
  52770. });
  52771. return self;
  52772. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  52773. },
  52774. args: [],
  52775. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  52776. referencedClasses: [],
  52777. messageSends: ["initialize"]
  52778. }),
  52779. $globals.CollectionTest);
  52780. $core.addMethod(
  52781. $core.method({
  52782. selector: "sampleNewValue",
  52783. protocol: "fixture",
  52784. fn: function (){
  52785. var self=this,$self=this;
  52786. return "N";
  52787. },
  52788. args: [],
  52789. 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'",
  52790. referencedClasses: [],
  52791. messageSends: []
  52792. }),
  52793. $globals.CollectionTest);
  52794. $core.addMethod(
  52795. $core.method({
  52796. selector: "sampleNewValueAsCollection",
  52797. protocol: "fixture",
  52798. fn: function (){
  52799. var self=this,$self=this;
  52800. return $core.withContext(function($ctx1) {
  52801. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  52802. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  52803. },
  52804. args: [],
  52805. 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",
  52806. referencedClasses: [],
  52807. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  52808. }),
  52809. $globals.CollectionTest);
  52810. $core.addMethod(
  52811. $core.method({
  52812. selector: "testAddAll",
  52813. protocol: "tests",
  52814. fn: function (){
  52815. var self=this,$self=this;
  52816. return $core.withContext(function($ctx1) {
  52817. 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;
  52818. $2=$self._collection();
  52819. $ctx1.sendIdx["collection"]=1;
  52820. $4=$self._collectionClass();
  52821. $ctx1.sendIdx["collectionClass"]=1;
  52822. $3=$recv($4)._new();
  52823. $ctx1.sendIdx["new"]=1;
  52824. $recv($2)._addAll_($3);
  52825. $ctx1.sendIdx["addAll:"]=1;
  52826. $5=$recv($2)._yourself();
  52827. $ctx1.sendIdx["yourself"]=1;
  52828. $1=$5;
  52829. $6=$self._collection();
  52830. $ctx1.sendIdx["collection"]=2;
  52831. $self._assert_equals_($1,$6);
  52832. $ctx1.sendIdx["assert:equals:"]=1;
  52833. $9=$self._collectionClass();
  52834. $ctx1.sendIdx["collectionClass"]=2;
  52835. $8=$recv($9)._new();
  52836. $ctx1.sendIdx["new"]=2;
  52837. $10=$self._collection();
  52838. $ctx1.sendIdx["collection"]=3;
  52839. $recv($8)._addAll_($10);
  52840. $ctx1.sendIdx["addAll:"]=2;
  52841. $11=$recv($8)._yourself();
  52842. $ctx1.sendIdx["yourself"]=2;
  52843. $7=$11;
  52844. $12=$self._collection();
  52845. $ctx1.sendIdx["collection"]=4;
  52846. $self._assert_equals_($7,$12);
  52847. $ctx1.sendIdx["assert:equals:"]=2;
  52848. $15=$self._collectionClass();
  52849. $ctx1.sendIdx["collectionClass"]=3;
  52850. $14=$recv($15)._new();
  52851. $ctx1.sendIdx["new"]=3;
  52852. $17=$self._collectionClass();
  52853. $ctx1.sendIdx["collectionClass"]=4;
  52854. $16=$recv($17)._new();
  52855. $ctx1.sendIdx["new"]=4;
  52856. $recv($14)._addAll_($16);
  52857. $ctx1.sendIdx["addAll:"]=3;
  52858. $18=$recv($14)._yourself();
  52859. $ctx1.sendIdx["yourself"]=3;
  52860. $13=$18;
  52861. $self._assert_equals_($13,$recv($self._collectionClass())._new());
  52862. $ctx1.sendIdx["assert:equals:"]=3;
  52863. $20=$self._collection();
  52864. $ctx1.sendIdx["collection"]=5;
  52865. $21=$self._sampleNewValueAsCollection();
  52866. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52867. $recv($20)._addAll_($21);
  52868. $ctx1.sendIdx["addAll:"]=4;
  52869. $22=$recv($20)._yourself();
  52870. $ctx1.sendIdx["yourself"]=4;
  52871. $19=$22;
  52872. $23=$self._collectionWithNewValue();
  52873. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52874. $self._assert_equals_($19,$23);
  52875. $25=$self._sampleNewValueAsCollection();
  52876. $recv($25)._addAll_($self._collection());
  52877. $24=$recv($25)._yourself();
  52878. $self._assertSameContents_as_($24,$self._collectionWithNewValue());
  52879. return self;
  52880. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  52881. },
  52882. args: [],
  52883. 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",
  52884. referencedClasses: [],
  52885. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52886. }),
  52887. $globals.CollectionTest);
  52888. $core.addMethod(
  52889. $core.method({
  52890. selector: "testAllSatisfy",
  52891. protocol: "tests",
  52892. fn: function (){
  52893. var self=this,$self=this;
  52894. var collection,anyOne;
  52895. return $core.withContext(function($ctx1) {
  52896. var $1;
  52897. collection=$self._collection();
  52898. anyOne=$recv(collection)._anyOne();
  52899. $1=$recv(collection)._allSatisfy_((function(each){
  52900. return $core.withContext(function($ctx2) {
  52901. return $recv(collection)._includes_(each);
  52902. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52903. }));
  52904. $ctx1.sendIdx["allSatisfy:"]=1;
  52905. $self._assert_($1);
  52906. $self._deny_($recv(collection)._allSatisfy_((function(each){
  52907. return $core.withContext(function($ctx2) {
  52908. return $recv(each).__tild_eq(anyOne);
  52909. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52910. })));
  52911. return self;
  52912. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  52913. },
  52914. args: [],
  52915. 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 ])",
  52916. referencedClasses: [],
  52917. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  52918. }),
  52919. $globals.CollectionTest);
  52920. $core.addMethod(
  52921. $core.method({
  52922. selector: "testAnyOne",
  52923. protocol: "tests",
  52924. fn: function (){
  52925. var self=this,$self=this;
  52926. return $core.withContext(function($ctx1) {
  52927. var $2,$1;
  52928. $self._should_raise_((function(){
  52929. return $core.withContext(function($ctx2) {
  52930. return $recv($recv($self._collectionClass())._new())._anyOne();
  52931. $ctx2.sendIdx["anyOne"]=1;
  52932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52933. }),$globals.Error);
  52934. $2=$self._collection();
  52935. $ctx1.sendIdx["collection"]=1;
  52936. $1=$recv($2)._includes_($recv($self._collection())._anyOne());
  52937. $self._assert_($1);
  52938. return self;
  52939. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  52940. },
  52941. args: [],
  52942. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  52943. referencedClasses: ["Error"],
  52944. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  52945. }),
  52946. $globals.CollectionTest);
  52947. $core.addMethod(
  52948. $core.method({
  52949. selector: "testAnySatisfy",
  52950. protocol: "tests",
  52951. fn: function (){
  52952. var self=this,$self=this;
  52953. var anyOne;
  52954. return $core.withContext(function($ctx1) {
  52955. var $1,$3,$2;
  52956. $1=$self._collection();
  52957. $ctx1.sendIdx["collection"]=1;
  52958. anyOne=$recv($1)._anyOne();
  52959. $3=$self._collection();
  52960. $ctx1.sendIdx["collection"]=2;
  52961. $2=$recv($3)._anySatisfy_((function(each){
  52962. return $core.withContext(function($ctx2) {
  52963. return $recv(each).__eq(anyOne);
  52964. $ctx2.sendIdx["="]=1;
  52965. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52966. }));
  52967. $ctx1.sendIdx["anySatisfy:"]=1;
  52968. $self._assert_($2);
  52969. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  52970. return $core.withContext(function($ctx2) {
  52971. return $recv(each).__eq($recv($globals.Object)._new());
  52972. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52973. })));
  52974. return self;
  52975. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  52976. },
  52977. args: [],
  52978. 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 ])",
  52979. referencedClasses: ["Object"],
  52980. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  52981. }),
  52982. $globals.CollectionTest);
  52983. $core.addMethod(
  52984. $core.method({
  52985. selector: "testAsArray",
  52986. protocol: "tests",
  52987. fn: function (){
  52988. var self=this,$self=this;
  52989. return $core.withContext(function($ctx1) {
  52990. var $1;
  52991. $1=$self._collection();
  52992. $ctx1.sendIdx["collection"]=1;
  52993. $self._assertSameContents_as_($1,$recv($self._collection())._asArray());
  52994. return self;
  52995. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  52996. },
  52997. args: [],
  52998. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  52999. referencedClasses: [],
  53000. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  53001. }),
  53002. $globals.CollectionTest);
  53003. $core.addMethod(
  53004. $core.method({
  53005. selector: "testAsOrderedCollection",
  53006. protocol: "tests",
  53007. fn: function (){
  53008. var self=this,$self=this;
  53009. return $core.withContext(function($ctx1) {
  53010. var $1;
  53011. $1=$self._collection();
  53012. $ctx1.sendIdx["collection"]=1;
  53013. $self._assertSameContents_as_($1,$recv($self._collection())._asOrderedCollection());
  53014. return self;
  53015. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  53016. },
  53017. args: [],
  53018. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  53019. referencedClasses: [],
  53020. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  53021. }),
  53022. $globals.CollectionTest);
  53023. $core.addMethod(
  53024. $core.method({
  53025. selector: "testAsSet",
  53026. protocol: "tests",
  53027. fn: function (){
  53028. var self=this,$self=this;
  53029. var c,set;
  53030. return $core.withContext(function($ctx1) {
  53031. c=$self._collectionWithDuplicates();
  53032. set=$recv(c)._asSet();
  53033. $self._assert_equals_($recv(set)._size(),(6));
  53034. $recv(c)._do_((function(each){
  53035. return $core.withContext(function($ctx2) {
  53036. return $self._assert_($recv(set)._includes_(each));
  53037. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53038. }));
  53039. return self;
  53040. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  53041. },
  53042. args: [],
  53043. 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) ]",
  53044. referencedClasses: [],
  53045. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  53046. }),
  53047. $globals.CollectionTest);
  53048. $core.addMethod(
  53049. $core.method({
  53050. selector: "testCollect",
  53051. protocol: "tests",
  53052. fn: function (){
  53053. var self=this,$self=this;
  53054. return $core.withContext(function($ctx1) {
  53055. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  53056. $2=$self._collection();
  53057. $ctx1.sendIdx["collection"]=1;
  53058. $1=$recv($2)._collect_((function(each){
  53059. return each;
  53060. }));
  53061. $ctx1.sendIdx["collect:"]=1;
  53062. $3=$self._collection();
  53063. $ctx1.sendIdx["collection"]=2;
  53064. $self._assert_equals_($1,$3);
  53065. $ctx1.sendIdx["assert:equals:"]=1;
  53066. $5=$self._collectionWithNewValue();
  53067. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53068. $4=$recv($5)._collect_((function(each){
  53069. return each;
  53070. }));
  53071. $ctx1.sendIdx["collect:"]=2;
  53072. $self._assert_equals_($4,$self._collectionWithNewValue());
  53073. $ctx1.sendIdx["assert:equals:"]=2;
  53074. $8=$self._collectionClass();
  53075. $ctx1.sendIdx["collectionClass"]=1;
  53076. $7=$recv($8)._new();
  53077. $ctx1.sendIdx["new"]=1;
  53078. $6=$recv($7)._collect_((function(each){
  53079. return $core.withContext(function($ctx2) {
  53080. return $recv(each)._printString();
  53081. $ctx2.sendIdx["printString"]=1;
  53082. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  53083. }));
  53084. $ctx1.sendIdx["collect:"]=3;
  53085. $self._assert_equals_($6,$recv($self._collectionClass())._new());
  53086. $ctx1.sendIdx["assert:equals:"]=3;
  53087. $11=$self._collection();
  53088. $ctx1.sendIdx["collection"]=3;
  53089. $10=$recv($11)._collect_((function(){
  53090. return $core.withContext(function($ctx2) {
  53091. return $self._sampleNewValue();
  53092. $ctx2.sendIdx["sampleNewValue"]=1;
  53093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  53094. }));
  53095. $ctx1.sendIdx["collect:"]=4;
  53096. $9=$recv($10)._detect_((function(){
  53097. return true;
  53098. }));
  53099. $self._assert_equals_($9,$self._sampleNewValue());
  53100. $ctx1.sendIdx["assert:equals:"]=4;
  53101. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  53102. return $core.withContext(function($ctx2) {
  53103. return $recv(each)._printString();
  53104. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53105. })),$self._collectionOfPrintStrings());
  53106. return self;
  53107. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  53108. },
  53109. args: [],
  53110. 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",
  53111. referencedClasses: [],
  53112. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  53113. }),
  53114. $globals.CollectionTest);
  53115. $core.addMethod(
  53116. $core.method({
  53117. selector: "testComma",
  53118. protocol: "tests",
  53119. fn: function (){
  53120. var self=this,$self=this;
  53121. return $core.withContext(function($ctx1) {
  53122. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  53123. $2=$self._collection();
  53124. $ctx1.sendIdx["collection"]=1;
  53125. $4=$self._collectionClass();
  53126. $ctx1.sendIdx["collectionClass"]=1;
  53127. $3=$recv($4)._new();
  53128. $ctx1.sendIdx["new"]=1;
  53129. $1=$recv($2).__comma($3);
  53130. $ctx1.sendIdx[","]=1;
  53131. $5=$self._collection();
  53132. $ctx1.sendIdx["collection"]=2;
  53133. $self._assert_equals_($1,$5);
  53134. $ctx1.sendIdx["assert:equals:"]=1;
  53135. $8=$self._collectionClass();
  53136. $ctx1.sendIdx["collectionClass"]=2;
  53137. $7=$recv($8)._new();
  53138. $ctx1.sendIdx["new"]=2;
  53139. $9=$self._collection();
  53140. $ctx1.sendIdx["collection"]=3;
  53141. $6=$recv($7).__comma($9);
  53142. $ctx1.sendIdx[","]=2;
  53143. $10=$self._collection();
  53144. $ctx1.sendIdx["collection"]=4;
  53145. $self._assert_equals_($6,$10);
  53146. $ctx1.sendIdx["assert:equals:"]=2;
  53147. $13=$self._collectionClass();
  53148. $ctx1.sendIdx["collectionClass"]=3;
  53149. $12=$recv($13)._new();
  53150. $ctx1.sendIdx["new"]=3;
  53151. $15=$self._collectionClass();
  53152. $ctx1.sendIdx["collectionClass"]=4;
  53153. $14=$recv($15)._new();
  53154. $ctx1.sendIdx["new"]=4;
  53155. $11=$recv($12).__comma($14);
  53156. $ctx1.sendIdx[","]=3;
  53157. $self._assert_equals_($11,$recv($self._collectionClass())._new());
  53158. $ctx1.sendIdx["assert:equals:"]=3;
  53159. $17=$self._collection();
  53160. $ctx1.sendIdx["collection"]=5;
  53161. $18=$self._sampleNewValueAsCollection();
  53162. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  53163. $16=$recv($17).__comma($18);
  53164. $ctx1.sendIdx[","]=4;
  53165. $19=$self._collectionWithNewValue();
  53166. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53167. $self._assert_equals_($16,$19);
  53168. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  53169. return self;
  53170. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  53171. },
  53172. args: [],
  53173. 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",
  53174. referencedClasses: [],
  53175. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  53176. }),
  53177. $globals.CollectionTest);
  53178. $core.addMethod(
  53179. $core.method({
  53180. selector: "testCopy",
  53181. protocol: "tests",
  53182. fn: function (){
  53183. var self=this,$self=this;
  53184. return $core.withContext(function($ctx1) {
  53185. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  53186. $3=$self._collectionClass();
  53187. $ctx1.sendIdx["collectionClass"]=1;
  53188. $2=$recv($3)._new();
  53189. $ctx1.sendIdx["new"]=1;
  53190. $1=$recv($2)._copy();
  53191. $ctx1.sendIdx["copy"]=1;
  53192. $5=$self._collectionClass();
  53193. $ctx1.sendIdx["collectionClass"]=2;
  53194. $4=$recv($5)._new();
  53195. $ctx1.sendIdx["new"]=2;
  53196. $self._assert_equals_($1,$4);
  53197. $ctx1.sendIdx["assert:equals:"]=1;
  53198. $7=$self._collection();
  53199. $ctx1.sendIdx["collection"]=1;
  53200. $6=$recv($7)._copy();
  53201. $ctx1.sendIdx["copy"]=2;
  53202. $8=$self._collection();
  53203. $ctx1.sendIdx["collection"]=2;
  53204. $self._assert_equals_($6,$8);
  53205. $ctx1.sendIdx["assert:equals:"]=2;
  53206. $10=$self._collectionWithNewValue();
  53207. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53208. $9=$recv($10)._copy();
  53209. $ctx1.sendIdx["copy"]=3;
  53210. $11=$self._collectionWithNewValue();
  53211. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53212. $self._assert_equals_($9,$11);
  53213. $15=$self._collectionClass();
  53214. $ctx1.sendIdx["collectionClass"]=3;
  53215. $14=$recv($15)._new();
  53216. $ctx1.sendIdx["new"]=3;
  53217. $13=$recv($14)._copy();
  53218. $ctx1.sendIdx["copy"]=4;
  53219. $16=$self._collection();
  53220. $ctx1.sendIdx["collection"]=3;
  53221. $12=$recv($13).__eq($16);
  53222. $ctx1.sendIdx["="]=1;
  53223. $self._deny_($12);
  53224. $ctx1.sendIdx["deny:"]=1;
  53225. $19=$self._collection();
  53226. $ctx1.sendIdx["collection"]=4;
  53227. $18=$recv($19)._copy();
  53228. $ctx1.sendIdx["copy"]=5;
  53229. $17=$recv($18).__eq($recv($self._collectionClass())._new());
  53230. $ctx1.sendIdx["="]=2;
  53231. $self._deny_($17);
  53232. $ctx1.sendIdx["deny:"]=2;
  53233. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  53234. return self;
  53235. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  53236. },
  53237. args: [],
  53238. 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",
  53239. referencedClasses: [],
  53240. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  53241. }),
  53242. $globals.CollectionTest);
  53243. $core.addMethod(
  53244. $core.method({
  53245. selector: "testCopySeparates",
  53246. protocol: "tests",
  53247. fn: function (){
  53248. var self=this,$self=this;
  53249. var original,copy;
  53250. return $core.withContext(function($ctx1) {
  53251. original=$self._collection();
  53252. $ctx1.sendIdx["collection"]=1;
  53253. copy=$recv(original)._copy();
  53254. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  53255. $self._assert_($recv(original).__eq($self._collection()));
  53256. return self;
  53257. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  53258. },
  53259. args: [],
  53260. 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",
  53261. referencedClasses: [],
  53262. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  53263. }),
  53264. $globals.CollectionTest);
  53265. $core.addMethod(
  53266. $core.method({
  53267. selector: "testDetect",
  53268. protocol: "tests",
  53269. fn: function (){
  53270. var self=this,$self=this;
  53271. return $core.withContext(function($ctx1) {
  53272. var $1,$2,$3,$4,$6,$5,$7;
  53273. $self._shouldnt_raise_((function(){
  53274. return $core.withContext(function($ctx2) {
  53275. $1=$self._collection();
  53276. $ctx2.sendIdx["collection"]=1;
  53277. return $recv($1)._detect_((function(){
  53278. return true;
  53279. }));
  53280. $ctx2.sendIdx["detect:"]=1;
  53281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53282. }),$globals.Error);
  53283. $self._should_raise_((function(){
  53284. return $core.withContext(function($ctx2) {
  53285. $2=$self._collection();
  53286. $ctx2.sendIdx["collection"]=2;
  53287. return $recv($2)._detect_((function(){
  53288. return false;
  53289. }));
  53290. $ctx2.sendIdx["detect:"]=2;
  53291. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53292. }),$globals.Error);
  53293. $ctx1.sendIdx["should:raise:"]=1;
  53294. $3=$recv($self._sampleNewValueAsCollection())._detect_((function(){
  53295. return true;
  53296. }));
  53297. $ctx1.sendIdx["detect:"]=3;
  53298. $4=$self._sampleNewValue();
  53299. $ctx1.sendIdx["sampleNewValue"]=1;
  53300. $self._assert_equals_($3,$4);
  53301. $ctx1.sendIdx["assert:equals:"]=1;
  53302. $5=$recv($self._collectionWithNewValue())._detect_((function(each){
  53303. return $core.withContext(function($ctx2) {
  53304. $6=$self._sampleNewValue();
  53305. $ctx2.sendIdx["sampleNewValue"]=2;
  53306. return $recv(each).__eq($6);
  53307. $ctx2.sendIdx["="]=1;
  53308. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53309. }));
  53310. $ctx1.sendIdx["detect:"]=4;
  53311. $7=$self._sampleNewValue();
  53312. $ctx1.sendIdx["sampleNewValue"]=3;
  53313. $self._assert_equals_($5,$7);
  53314. $self._should_raise_((function(){
  53315. return $core.withContext(function($ctx2) {
  53316. return $recv($self._collection())._detect_((function(each){
  53317. return $core.withContext(function($ctx3) {
  53318. return $recv(each).__eq($self._sampleNewValue());
  53319. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  53320. }));
  53321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  53322. }),$globals.Error);
  53323. return self;
  53324. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  53325. },
  53326. args: [],
  53327. 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",
  53328. referencedClasses: ["Error"],
  53329. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53330. }),
  53331. $globals.CollectionTest);
  53332. $core.addMethod(
  53333. $core.method({
  53334. selector: "testDetectIfNone",
  53335. protocol: "tests",
  53336. fn: function (){
  53337. var self=this,$self=this;
  53338. var sentinel;
  53339. return $core.withContext(function($ctx1) {
  53340. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  53341. sentinel=$recv($globals.Object)._new();
  53342. $3=$self._collection();
  53343. $ctx1.sendIdx["collection"]=1;
  53344. $2=$recv($3)._detect_ifNone_((function(){
  53345. return true;
  53346. }),(function(){
  53347. return sentinel;
  53348. }));
  53349. $ctx1.sendIdx["detect:ifNone:"]=1;
  53350. $1=$recv($2).__tild_eq(sentinel);
  53351. $self._assert_($1);
  53352. $5=$self._collection();
  53353. $ctx1.sendIdx["collection"]=2;
  53354. $4=$recv($5)._detect_ifNone_((function(){
  53355. return false;
  53356. }),(function(){
  53357. return sentinel;
  53358. }));
  53359. $ctx1.sendIdx["detect:ifNone:"]=2;
  53360. $self._assert_equals_($4,sentinel);
  53361. $ctx1.sendIdx["assert:equals:"]=1;
  53362. $6=$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  53363. return true;
  53364. }),(function(){
  53365. return sentinel;
  53366. }));
  53367. $ctx1.sendIdx["detect:ifNone:"]=3;
  53368. $7=$self._sampleNewValue();
  53369. $ctx1.sendIdx["sampleNewValue"]=1;
  53370. $self._assert_equals_($6,$7);
  53371. $ctx1.sendIdx["assert:equals:"]=2;
  53372. $8=$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  53373. return $core.withContext(function($ctx2) {
  53374. $9=$self._sampleNewValue();
  53375. $ctx2.sendIdx["sampleNewValue"]=2;
  53376. return $recv(each).__eq($9);
  53377. $ctx2.sendIdx["="]=1;
  53378. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  53379. }),(function(){
  53380. return sentinel;
  53381. }));
  53382. $ctx1.sendIdx["detect:ifNone:"]=4;
  53383. $10=$self._sampleNewValue();
  53384. $ctx1.sendIdx["sampleNewValue"]=3;
  53385. $self._assert_equals_($8,$10);
  53386. $ctx1.sendIdx["assert:equals:"]=3;
  53387. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  53388. return $core.withContext(function($ctx2) {
  53389. return $recv(each).__eq($self._sampleNewValue());
  53390. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  53391. }),(function(){
  53392. return sentinel;
  53393. })),sentinel);
  53394. return self;
  53395. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  53396. },
  53397. args: [],
  53398. 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",
  53399. referencedClasses: ["Object"],
  53400. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53401. }),
  53402. $globals.CollectionTest);
  53403. $core.addMethod(
  53404. $core.method({
  53405. selector: "testDo",
  53406. protocol: "tests",
  53407. fn: function (){
  53408. var self=this,$self=this;
  53409. var newCollection;
  53410. return $core.withContext(function($ctx1) {
  53411. var $1,$2;
  53412. newCollection=$recv($globals.OrderedCollection)._new();
  53413. $ctx1.sendIdx["new"]=1;
  53414. $1=$self._collection();
  53415. $ctx1.sendIdx["collection"]=1;
  53416. $recv($1)._do_((function(each){
  53417. return $core.withContext(function($ctx2) {
  53418. return $recv(newCollection)._add_(each);
  53419. $ctx2.sendIdx["add:"]=1;
  53420. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53421. }));
  53422. $ctx1.sendIdx["do:"]=1;
  53423. $self._assertSameContents_as_($self._collection(),newCollection);
  53424. $ctx1.sendIdx["assertSameContents:as:"]=1;
  53425. newCollection=$recv($globals.OrderedCollection)._new();
  53426. $2=$self._collectionWithDuplicates();
  53427. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  53428. $recv($2)._do_((function(each){
  53429. return $core.withContext(function($ctx2) {
  53430. return $recv(newCollection)._add_(each);
  53431. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53432. }));
  53433. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  53434. return self;
  53435. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  53436. },
  53437. args: [],
  53438. 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",
  53439. referencedClasses: ["OrderedCollection"],
  53440. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  53441. }),
  53442. $globals.CollectionTest);
  53443. $core.addMethod(
  53444. $core.method({
  53445. selector: "testEquality",
  53446. protocol: "tests",
  53447. fn: function (){
  53448. var self=this,$self=this;
  53449. return $core.withContext(function($ctx1) {
  53450. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  53451. $2=$self._collectionClass();
  53452. $ctx1.sendIdx["collectionClass"]=1;
  53453. $1=$recv($2)._new();
  53454. $ctx1.sendIdx["new"]=1;
  53455. $4=$self._collectionClass();
  53456. $ctx1.sendIdx["collectionClass"]=2;
  53457. $3=$recv($4)._new();
  53458. $ctx1.sendIdx["new"]=2;
  53459. $self._assert_equals_($1,$3);
  53460. $ctx1.sendIdx["assert:equals:"]=1;
  53461. $5=$self._collection();
  53462. $ctx1.sendIdx["collection"]=1;
  53463. $6=$self._collection();
  53464. $ctx1.sendIdx["collection"]=2;
  53465. $self._assert_equals_($5,$6);
  53466. $ctx1.sendIdx["assert:equals:"]=2;
  53467. $7=$self._collectionWithNewValue();
  53468. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53469. $8=$self._collectionWithNewValue();
  53470. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53471. $self._assert_equals_($7,$8);
  53472. $11=$self._collectionClass();
  53473. $ctx1.sendIdx["collectionClass"]=3;
  53474. $10=$recv($11)._new();
  53475. $ctx1.sendIdx["new"]=3;
  53476. $12=$self._collection();
  53477. $ctx1.sendIdx["collection"]=3;
  53478. $9=$recv($10).__eq($12);
  53479. $ctx1.sendIdx["="]=1;
  53480. $self._deny_($9);
  53481. $ctx1.sendIdx["deny:"]=1;
  53482. $14=$self._collection();
  53483. $ctx1.sendIdx["collection"]=4;
  53484. $13=$recv($14).__eq($recv($self._collectionClass())._new());
  53485. $ctx1.sendIdx["="]=2;
  53486. $self._deny_($13);
  53487. $ctx1.sendIdx["deny:"]=2;
  53488. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  53489. return self;
  53490. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  53491. },
  53492. args: [],
  53493. 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",
  53494. referencedClasses: [],
  53495. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  53496. }),
  53497. $globals.CollectionTest);
  53498. $core.addMethod(
  53499. $core.method({
  53500. selector: "testIfEmptyFamily",
  53501. protocol: "tests",
  53502. fn: function (){
  53503. var self=this,$self=this;
  53504. return $core.withContext(function($ctx1) {
  53505. 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;
  53506. $3=$self._collectionClass();
  53507. $ctx1.sendIdx["collectionClass"]=1;
  53508. $2=$recv($3)._new();
  53509. $ctx1.sendIdx["new"]=1;
  53510. $1=$recv($2)._ifEmpty_((function(){
  53511. return (42);
  53512. }));
  53513. $ctx1.sendIdx["ifEmpty:"]=1;
  53514. $self._assert_equals_($1,(42));
  53515. $ctx1.sendIdx["assert:equals:"]=1;
  53516. $5=$self._collection();
  53517. $ctx1.sendIdx["collection"]=1;
  53518. $4=$recv($5)._ifEmpty_((function(){
  53519. return (42);
  53520. }));
  53521. $6=$self._collection();
  53522. $ctx1.sendIdx["collection"]=2;
  53523. $self._assert_equals_($4,$6);
  53524. $ctx1.sendIdx["assert:equals:"]=2;
  53525. $9=$self._collectionClass();
  53526. $ctx1.sendIdx["collectionClass"]=2;
  53527. $8=$recv($9)._new();
  53528. $ctx1.sendIdx["new"]=2;
  53529. $7=$recv($8)._ifNotEmpty_((function(){
  53530. return (42);
  53531. }));
  53532. $ctx1.sendIdx["ifNotEmpty:"]=1;
  53533. $11=$self._collectionClass();
  53534. $ctx1.sendIdx["collectionClass"]=3;
  53535. $10=$recv($11)._new();
  53536. $ctx1.sendIdx["new"]=3;
  53537. $self._assert_equals_($7,$10);
  53538. $ctx1.sendIdx["assert:equals:"]=3;
  53539. $13=$self._collection();
  53540. $ctx1.sendIdx["collection"]=3;
  53541. $12=$recv($13)._ifNotEmpty_((function(){
  53542. return (42);
  53543. }));
  53544. $ctx1.sendIdx["ifNotEmpty:"]=2;
  53545. $self._assert_equals_($12,(42));
  53546. $ctx1.sendIdx["assert:equals:"]=4;
  53547. $15=$self._collection();
  53548. $ctx1.sendIdx["collection"]=4;
  53549. $14=$recv($15)._ifNotEmpty_((function(col){
  53550. return col;
  53551. }));
  53552. $16=$self._collection();
  53553. $ctx1.sendIdx["collection"]=5;
  53554. $self._assert_equals_($14,$16);
  53555. $ctx1.sendIdx["assert:equals:"]=5;
  53556. $19=$self._collectionClass();
  53557. $ctx1.sendIdx["collectionClass"]=4;
  53558. $18=$recv($19)._new();
  53559. $ctx1.sendIdx["new"]=4;
  53560. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  53561. return (42);
  53562. }),(function(){
  53563. return (999);
  53564. }));
  53565. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  53566. $self._assert_equals_($17,(42));
  53567. $ctx1.sendIdx["assert:equals:"]=6;
  53568. $21=$self._collection();
  53569. $ctx1.sendIdx["collection"]=6;
  53570. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  53571. return (42);
  53572. }),(function(){
  53573. return (999);
  53574. }));
  53575. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  53576. $self._assert_equals_($20,(999));
  53577. $ctx1.sendIdx["assert:equals:"]=7;
  53578. $23=$self._collection();
  53579. $ctx1.sendIdx["collection"]=7;
  53580. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  53581. return (42);
  53582. }),(function(col){
  53583. return col;
  53584. }));
  53585. $24=$self._collection();
  53586. $ctx1.sendIdx["collection"]=8;
  53587. $self._assert_equals_($22,$24);
  53588. $ctx1.sendIdx["assert:equals:"]=8;
  53589. $25=$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  53590. return (42);
  53591. }),(function(){
  53592. return (999);
  53593. }));
  53594. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  53595. $self._assert_equals_($25,(999));
  53596. $ctx1.sendIdx["assert:equals:"]=9;
  53597. $27=$self._collection();
  53598. $ctx1.sendIdx["collection"]=9;
  53599. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  53600. return (42);
  53601. }),(function(){
  53602. return (999);
  53603. }));
  53604. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  53605. $self._assert_equals_($26,(42));
  53606. $ctx1.sendIdx["assert:equals:"]=10;
  53607. $29=$self._collection();
  53608. $ctx1.sendIdx["collection"]=10;
  53609. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  53610. return col;
  53611. }),(function(){
  53612. return (999);
  53613. }));
  53614. $self._assert_equals_($28,$self._collection());
  53615. return self;
  53616. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  53617. },
  53618. args: [],
  53619. 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.",
  53620. referencedClasses: [],
  53621. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  53622. }),
  53623. $globals.CollectionTest);
  53624. $core.addMethod(
  53625. $core.method({
  53626. selector: "testIsEmpty",
  53627. protocol: "tests",
  53628. fn: function (){
  53629. var self=this,$self=this;
  53630. return $core.withContext(function($ctx1) {
  53631. var $1;
  53632. $1=$recv($recv($self._collectionClass())._new())._isEmpty();
  53633. $ctx1.sendIdx["isEmpty"]=1;
  53634. $self._assert_($1);
  53635. $self._deny_($recv($self._collection())._isEmpty());
  53636. return self;
  53637. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  53638. },
  53639. args: [],
  53640. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  53641. referencedClasses: [],
  53642. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  53643. }),
  53644. $globals.CollectionTest);
  53645. $core.addMethod(
  53646. $core.method({
  53647. selector: "testNoneSatisfy",
  53648. protocol: "tests",
  53649. fn: function (){
  53650. var self=this,$self=this;
  53651. var anyOne;
  53652. return $core.withContext(function($ctx1) {
  53653. var $1,$3,$2;
  53654. $1=$self._collection();
  53655. $ctx1.sendIdx["collection"]=1;
  53656. anyOne=$recv($1)._anyOne();
  53657. $3=$self._collection();
  53658. $ctx1.sendIdx["collection"]=2;
  53659. $2=$recv($3)._noneSatisfy_((function(each){
  53660. return $core.withContext(function($ctx2) {
  53661. return $recv(each).__eq(anyOne);
  53662. $ctx2.sendIdx["="]=1;
  53663. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53664. }));
  53665. $ctx1.sendIdx["noneSatisfy:"]=1;
  53666. $self._deny_($2);
  53667. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  53668. return $core.withContext(function($ctx2) {
  53669. return $recv(each).__eq($recv($globals.Object)._new());
  53670. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53671. })));
  53672. return self;
  53673. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  53674. },
  53675. args: [],
  53676. 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 ])",
  53677. referencedClasses: ["Object"],
  53678. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  53679. }),
  53680. $globals.CollectionTest);
  53681. $core.addMethod(
  53682. $core.method({
  53683. selector: "testRegression1224",
  53684. protocol: "tests",
  53685. fn: function (){
  53686. var self=this,$self=this;
  53687. return $core.withContext(function($ctx1) {
  53688. var $3,$2,$1;
  53689. $3=$recv($self._collectionClass())._new();
  53690. $recv($3)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  53691. }));
  53692. $2=$recv($3)._yourself();
  53693. $1=$recv($2)._size();
  53694. $self._assert_equals_($1,(0));
  53695. return self;
  53696. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.CollectionTest)});
  53697. },
  53698. args: [],
  53699. source: "testRegression1224\x0a\x09self assert: (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size equals: 0",
  53700. referencedClasses: [],
  53701. messageSends: ["assert:equals:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  53702. }),
  53703. $globals.CollectionTest);
  53704. $core.addMethod(
  53705. $core.method({
  53706. selector: "testRemoveAll",
  53707. protocol: "tests",
  53708. fn: function (){
  53709. var self=this,$self=this;
  53710. return $core.withContext(function($ctx1) {
  53711. var $2,$1;
  53712. $2=$self._collection();
  53713. $recv($2)._removeAll();
  53714. $1=$recv($2)._yourself();
  53715. $self._assert_equals_($1,$recv($self._collectionClass())._new());
  53716. return self;
  53717. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  53718. },
  53719. args: [],
  53720. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  53721. referencedClasses: [],
  53722. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  53723. }),
  53724. $globals.CollectionTest);
  53725. $core.addMethod(
  53726. $core.method({
  53727. selector: "testSelect",
  53728. protocol: "tests",
  53729. fn: function (){
  53730. var self=this,$self=this;
  53731. return $core.withContext(function($ctx1) {
  53732. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  53733. $2=$self._collection();
  53734. $ctx1.sendIdx["collection"]=1;
  53735. $1=$recv($2)._select_((function(){
  53736. return false;
  53737. }));
  53738. $ctx1.sendIdx["select:"]=1;
  53739. $4=$self._collectionClass();
  53740. $ctx1.sendIdx["collectionClass"]=1;
  53741. $3=$recv($4)._new();
  53742. $ctx1.sendIdx["new"]=1;
  53743. $self._assert_equals_($1,$3);
  53744. $ctx1.sendIdx["assert:equals:"]=1;
  53745. $6=$self._collection();
  53746. $ctx1.sendIdx["collection"]=2;
  53747. $5=$recv($6)._select_((function(){
  53748. return true;
  53749. }));
  53750. $ctx1.sendIdx["select:"]=2;
  53751. $7=$self._collection();
  53752. $ctx1.sendIdx["collection"]=3;
  53753. $self._assert_equals_($5,$7);
  53754. $ctx1.sendIdx["assert:equals:"]=2;
  53755. $9=$self._collectionWithNewValue();
  53756. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53757. $8=$recv($9)._select_((function(each){
  53758. return $core.withContext(function($ctx2) {
  53759. $10=$self._sampleNewValue();
  53760. $ctx2.sendIdx["sampleNewValue"]=1;
  53761. return $recv(each).__eq($10);
  53762. $ctx2.sendIdx["="]=1;
  53763. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  53764. }));
  53765. $ctx1.sendIdx["select:"]=3;
  53766. $self._assert_equals_($8,$self._sampleNewValueAsCollection());
  53767. $ctx1.sendIdx["assert:equals:"]=3;
  53768. $12=$self._collectionWithNewValue();
  53769. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53770. $11=$recv($12)._select_((function(each){
  53771. return $core.withContext(function($ctx2) {
  53772. $13=$self._sampleNewValue();
  53773. $ctx2.sendIdx["sampleNewValue"]=2;
  53774. return $recv(each).__tild_eq($13);
  53775. $ctx2.sendIdx["~="]=1;
  53776. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53777. }));
  53778. $ctx1.sendIdx["select:"]=4;
  53779. $14=$self._collection();
  53780. $ctx1.sendIdx["collection"]=4;
  53781. $self._assert_equals_($11,$14);
  53782. $ctx1.sendIdx["assert:equals:"]=4;
  53783. $16=$self._collection();
  53784. $ctx1.sendIdx["collection"]=5;
  53785. $15=$recv($16)._select_((function(each){
  53786. return $core.withContext(function($ctx2) {
  53787. $17=$self._sampleNewValue();
  53788. $ctx2.sendIdx["sampleNewValue"]=3;
  53789. return $recv(each).__eq($17);
  53790. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  53791. }));
  53792. $ctx1.sendIdx["select:"]=5;
  53793. $self._assert_equals_($15,$recv($self._collectionClass())._new());
  53794. $ctx1.sendIdx["assert:equals:"]=5;
  53795. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  53796. return $core.withContext(function($ctx2) {
  53797. return $recv(each).__tild_eq($self._sampleNewValue());
  53798. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53799. })),$self._collection());
  53800. return self;
  53801. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  53802. },
  53803. args: [],
  53804. 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",
  53805. referencedClasses: [],
  53806. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  53807. }),
  53808. $globals.CollectionTest);
  53809. $core.addMethod(
  53810. $core.method({
  53811. selector: "testSelectThenCollect",
  53812. protocol: "tests",
  53813. fn: function (){
  53814. var self=this,$self=this;
  53815. return $core.withContext(function($ctx1) {
  53816. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  53817. $2=$self._collection();
  53818. $ctx1.sendIdx["collection"]=1;
  53819. $1=$recv($2)._select_thenCollect_((function(){
  53820. return false;
  53821. }),"isString");
  53822. $ctx1.sendIdx["select:thenCollect:"]=1;
  53823. $4=$self._collectionClass();
  53824. $ctx1.sendIdx["collectionClass"]=1;
  53825. $3=$recv($4)._new();
  53826. $ctx1.sendIdx["new"]=1;
  53827. $self._assert_equals_($1,$3);
  53828. $ctx1.sendIdx["assert:equals:"]=1;
  53829. $6=$self._collection();
  53830. $ctx1.sendIdx["collection"]=2;
  53831. $5=$recv($6)._select_thenCollect_((function(){
  53832. return true;
  53833. }),(function(x){
  53834. return x;
  53835. }));
  53836. $ctx1.sendIdx["select:thenCollect:"]=2;
  53837. $7=$self._collection();
  53838. $ctx1.sendIdx["collection"]=3;
  53839. $self._assert_equals_($5,$7);
  53840. $ctx1.sendIdx["assert:equals:"]=2;
  53841. $8=$recv($self._collection())._select_thenCollect_((function(each){
  53842. return $core.withContext(function($ctx2) {
  53843. $9=$self._sampleNewValue();
  53844. $ctx2.sendIdx["sampleNewValue"]=1;
  53845. return $recv(each).__eq($9);
  53846. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53847. }),(function(x){
  53848. return x;
  53849. }));
  53850. $ctx1.sendIdx["select:thenCollect:"]=3;
  53851. $self._assert_equals_($8,$recv($self._collectionClass())._new());
  53852. $ctx1.sendIdx["assert:equals:"]=3;
  53853. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  53854. return $core.withContext(function($ctx2) {
  53855. return $recv(each).__tild_eq($self._sampleNewValue());
  53856. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53857. }),"printString"),$self._collectionOfPrintStrings());
  53858. return self;
  53859. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{},$globals.CollectionTest)});
  53860. },
  53861. args: [],
  53862. 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",
  53863. referencedClasses: [],
  53864. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  53865. }),
  53866. $globals.CollectionTest);
  53867. $core.addMethod(
  53868. $core.method({
  53869. selector: "testSingle",
  53870. protocol: "tests",
  53871. fn: function (){
  53872. var self=this,$self=this;
  53873. return $core.withContext(function($ctx1) {
  53874. $self._should_raise_((function(){
  53875. return $core.withContext(function($ctx2) {
  53876. return $recv($recv($self._collectionClass())._new())._single();
  53877. $ctx2.sendIdx["single"]=1;
  53878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53879. }),$globals.Error);
  53880. $ctx1.sendIdx["should:raise:"]=1;
  53881. $self._should_raise_((function(){
  53882. return $core.withContext(function($ctx2) {
  53883. return $recv($self._collection())._single();
  53884. $ctx2.sendIdx["single"]=2;
  53885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53886. }),$globals.Error);
  53887. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  53888. return self;
  53889. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  53890. },
  53891. args: [],
  53892. 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",
  53893. referencedClasses: ["Error"],
  53894. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  53895. }),
  53896. $globals.CollectionTest);
  53897. $core.addMethod(
  53898. $core.method({
  53899. selector: "testSize",
  53900. protocol: "tests",
  53901. fn: function (){
  53902. var self=this,$self=this;
  53903. return $core.withContext(function($ctx1) {
  53904. var $1,$2;
  53905. $1=$recv($recv($self._collectionClass())._new())._size();
  53906. $ctx1.sendIdx["size"]=1;
  53907. $self._assert_equals_($1,(0));
  53908. $ctx1.sendIdx["assert:equals:"]=1;
  53909. $2=$recv($self._sampleNewValueAsCollection())._size();
  53910. $ctx1.sendIdx["size"]=2;
  53911. $self._assert_equals_($2,(1));
  53912. $ctx1.sendIdx["assert:equals:"]=2;
  53913. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  53914. return self;
  53915. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  53916. },
  53917. args: [],
  53918. 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",
  53919. referencedClasses: [],
  53920. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  53921. }),
  53922. $globals.CollectionTest);
  53923. $core.addMethod(
  53924. $core.method({
  53925. selector: "collectionClass",
  53926. protocol: "fixture",
  53927. fn: function (){
  53928. var self=this,$self=this;
  53929. return nil;
  53930. },
  53931. args: [],
  53932. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  53933. referencedClasses: [],
  53934. messageSends: []
  53935. }),
  53936. $globals.CollectionTest.a$cls);
  53937. $core.addMethod(
  53938. $core.method({
  53939. selector: "isAbstract",
  53940. protocol: "testing",
  53941. fn: function (){
  53942. var self=this,$self=this;
  53943. return $core.withContext(function($ctx1) {
  53944. return $recv($self._collectionClass())._isNil();
  53945. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.a$cls)});
  53946. },
  53947. args: [],
  53948. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  53949. referencedClasses: [],
  53950. messageSends: ["isNil", "collectionClass"]
  53951. }),
  53952. $globals.CollectionTest.a$cls);
  53953. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  53954. $core.addMethod(
  53955. $core.method({
  53956. selector: "collectionWithNewValue",
  53957. protocol: "fixture",
  53958. fn: function (){
  53959. var self=this,$self=this;
  53960. return $core.withContext(function($ctx1) {
  53961. $self._subclassResponsibility();
  53962. return self;
  53963. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  53964. },
  53965. args: [],
  53966. 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",
  53967. referencedClasses: [],
  53968. messageSends: ["subclassResponsibility"]
  53969. }),
  53970. $globals.IndexableCollectionTest);
  53971. $core.addMethod(
  53972. $core.method({
  53973. selector: "nonIndexesDo:",
  53974. protocol: "fixture",
  53975. fn: function (aBlock){
  53976. var self=this,$self=this;
  53977. return $core.withContext(function($ctx1) {
  53978. $self._subclassResponsibility();
  53979. return self;
  53980. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53981. },
  53982. args: ["aBlock"],
  53983. 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",
  53984. referencedClasses: [],
  53985. messageSends: ["subclassResponsibility"]
  53986. }),
  53987. $globals.IndexableCollectionTest);
  53988. $core.addMethod(
  53989. $core.method({
  53990. selector: "sampleNewIndex",
  53991. protocol: "fixture",
  53992. fn: function (){
  53993. var self=this,$self=this;
  53994. return $core.withContext(function($ctx1) {
  53995. $self._subclassResponsibility();
  53996. return self;
  53997. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  53998. },
  53999. args: [],
  54000. 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",
  54001. referencedClasses: [],
  54002. messageSends: ["subclassResponsibility"]
  54003. }),
  54004. $globals.IndexableCollectionTest);
  54005. $core.addMethod(
  54006. $core.method({
  54007. selector: "samplesDo:",
  54008. protocol: "fixture",
  54009. fn: function (aBlock){
  54010. var self=this,$self=this;
  54011. return $core.withContext(function($ctx1) {
  54012. $self._subclassResponsibility();
  54013. return self;
  54014. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  54015. },
  54016. args: ["aBlock"],
  54017. 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",
  54018. referencedClasses: [],
  54019. messageSends: ["subclassResponsibility"]
  54020. }),
  54021. $globals.IndexableCollectionTest);
  54022. $core.addMethod(
  54023. $core.method({
  54024. selector: "testAt",
  54025. protocol: "tests",
  54026. fn: function (){
  54027. var self=this,$self=this;
  54028. return $core.withContext(function($ctx1) {
  54029. var $1;
  54030. $self._nonIndexesDo_((function(each){
  54031. return $core.withContext(function($ctx2) {
  54032. return $self._should_raise_((function(){
  54033. return $core.withContext(function($ctx3) {
  54034. $1=$self._collection();
  54035. $ctx3.sendIdx["collection"]=1;
  54036. return $recv($1)._at_(each);
  54037. $ctx3.sendIdx["at:"]=1;
  54038. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54039. }),$globals.Error);
  54040. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54041. }));
  54042. $self._samplesDo_((function(index,value){
  54043. return $core.withContext(function($ctx2) {
  54044. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  54045. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  54046. }));
  54047. return self;
  54048. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  54049. },
  54050. args: [],
  54051. 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 ]",
  54052. referencedClasses: ["Error"],
  54053. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  54054. }),
  54055. $globals.IndexableCollectionTest);
  54056. $core.addMethod(
  54057. $core.method({
  54058. selector: "testAtIfAbsent",
  54059. protocol: "tests",
  54060. fn: function (){
  54061. var self=this,$self=this;
  54062. return $core.withContext(function($ctx1) {
  54063. var $2,$1,$3;
  54064. $self._nonIndexesDo_((function(each){
  54065. return $core.withContext(function($ctx2) {
  54066. $2=$self._collection();
  54067. $ctx2.sendIdx["collection"]=1;
  54068. $1=$recv($2)._at_ifAbsent_(each,(function(){
  54069. return $core.withContext(function($ctx3) {
  54070. return $self._sampleNewValue();
  54071. $ctx3.sendIdx["sampleNewValue"]=1;
  54072. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54073. }));
  54074. $ctx2.sendIdx["at:ifAbsent:"]=1;
  54075. $3=$self._sampleNewValue();
  54076. $ctx2.sendIdx["sampleNewValue"]=2;
  54077. return $self._assert_equals_($1,$3);
  54078. $ctx2.sendIdx["assert:equals:"]=1;
  54079. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54080. }));
  54081. $self._samplesDo_((function(index,value){
  54082. return $core.withContext(function($ctx2) {
  54083. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  54084. return $core.withContext(function($ctx3) {
  54085. return $self._sampleNewValue();
  54086. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  54087. })),value);
  54088. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  54089. }));
  54090. return self;
  54091. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  54092. },
  54093. args: [],
  54094. 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 ].",
  54095. referencedClasses: [],
  54096. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  54097. }),
  54098. $globals.IndexableCollectionTest);
  54099. $core.addMethod(
  54100. $core.method({
  54101. selector: "testAtIfAbsentPut",
  54102. protocol: "tests",
  54103. fn: function (){
  54104. var self=this,$self=this;
  54105. var newCollection;
  54106. return $core.withContext(function($ctx1) {
  54107. var $1;
  54108. newCollection=$self._collection();
  54109. $ctx1.sendIdx["collection"]=1;
  54110. $self._samplesDo_((function(index,value){
  54111. return $core.withContext(function($ctx2) {
  54112. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  54113. return $core.withContext(function($ctx3) {
  54114. return $self._sampleNewValue();
  54115. $ctx3.sendIdx["sampleNewValue"]=1;
  54116. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54117. }));
  54118. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  54119. return $self._assert_equals_($1,value);
  54120. $ctx2.sendIdx["assert:equals:"]=1;
  54121. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54122. }));
  54123. $self._assert_equals_(newCollection,$self._collection());
  54124. $ctx1.sendIdx["assert:equals:"]=2;
  54125. $self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  54126. return $core.withContext(function($ctx2) {
  54127. return $self._sampleNewValue();
  54128. $ctx2.sendIdx["sampleNewValue"]=2;
  54129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  54130. })),$self._sampleNewValue());
  54131. $ctx1.sendIdx["assert:equals:"]=3;
  54132. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  54133. return self;
  54134. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  54135. },
  54136. args: [],
  54137. 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",
  54138. referencedClasses: [],
  54139. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  54140. }),
  54141. $globals.IndexableCollectionTest);
  54142. $core.addMethod(
  54143. $core.method({
  54144. selector: "testAtIfPresent",
  54145. protocol: "tests",
  54146. fn: function (){
  54147. var self=this,$self=this;
  54148. var visited,sentinel;
  54149. return $core.withContext(function($ctx1) {
  54150. var $2,$1,$4,$3;
  54151. sentinel=$recv($globals.Object)._new();
  54152. $self._nonIndexesDo_((function(each){
  54153. return $core.withContext(function($ctx2) {
  54154. visited=nil;
  54155. $2=$self._collection();
  54156. $ctx2.sendIdx["collection"]=1;
  54157. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  54158. visited=value1;
  54159. return sentinel;
  54160. }));
  54161. $ctx2.sendIdx["at:ifPresent:"]=1;
  54162. $self._assert_equals_($1,nil);
  54163. $ctx2.sendIdx["assert:equals:"]=1;
  54164. return $self._assert_($recv(visited)._isNil());
  54165. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54166. }));
  54167. $self._samplesDo_((function(index,value){
  54168. return $core.withContext(function($ctx2) {
  54169. visited=nil;
  54170. $4=$self._collection();
  54171. $ctx2.sendIdx["collection"]=2;
  54172. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  54173. visited=value2;
  54174. return sentinel;
  54175. }));
  54176. $self._assert_equals_($3,sentinel);
  54177. $ctx2.sendIdx["assert:equals:"]=2;
  54178. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  54179. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  54180. }));
  54181. return self;
  54182. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  54183. },
  54184. args: [],
  54185. 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) ]",
  54186. referencedClasses: ["Object"],
  54187. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  54188. }),
  54189. $globals.IndexableCollectionTest);
  54190. $core.addMethod(
  54191. $core.method({
  54192. selector: "testAtIfPresentIfAbsent",
  54193. protocol: "tests",
  54194. fn: function (){
  54195. var self=this,$self=this;
  54196. var visited,sentinel;
  54197. return $core.withContext(function($ctx1) {
  54198. var $2,$1,$3,$5,$4;
  54199. sentinel=$recv($globals.Object)._new();
  54200. $self._nonIndexesDo_((function(each){
  54201. return $core.withContext(function($ctx2) {
  54202. visited=nil;
  54203. $2=$self._collection();
  54204. $ctx2.sendIdx["collection"]=1;
  54205. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  54206. visited=value1;
  54207. return sentinel;
  54208. }),(function(){
  54209. return $core.withContext(function($ctx3) {
  54210. return $self._sampleNewValue();
  54211. $ctx3.sendIdx["sampleNewValue"]=1;
  54212. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  54213. }));
  54214. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  54215. $3=$self._sampleNewValue();
  54216. $ctx2.sendIdx["sampleNewValue"]=2;
  54217. $self._assert_equals_($1,$3);
  54218. $ctx2.sendIdx["assert:equals:"]=1;
  54219. return $self._assert_($recv(visited)._isNil());
  54220. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54221. }));
  54222. $self._samplesDo_((function(index,value){
  54223. return $core.withContext(function($ctx2) {
  54224. visited=nil;
  54225. $5=$self._collection();
  54226. $ctx2.sendIdx["collection"]=2;
  54227. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  54228. visited=value2;
  54229. return sentinel;
  54230. }),(function(){
  54231. return $core.withContext(function($ctx3) {
  54232. return $self._sampleNewValue();
  54233. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  54234. }));
  54235. $self._assert_equals_($4,sentinel);
  54236. $ctx2.sendIdx["assert:equals:"]=2;
  54237. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  54238. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  54239. }));
  54240. return self;
  54241. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  54242. },
  54243. args: [],
  54244. 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) ]",
  54245. referencedClasses: ["Object"],
  54246. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  54247. }),
  54248. $globals.IndexableCollectionTest);
  54249. $core.addMethod(
  54250. $core.method({
  54251. selector: "testAtPut",
  54252. protocol: "tests",
  54253. fn: function (){
  54254. var self=this,$self=this;
  54255. var newCollection;
  54256. return $core.withContext(function($ctx1) {
  54257. newCollection=$self._collection();
  54258. $ctx1.sendIdx["collection"]=1;
  54259. $self._samplesDo_((function(index,value){
  54260. return $core.withContext(function($ctx2) {
  54261. return $recv(newCollection)._at_put_(index,value);
  54262. $ctx2.sendIdx["at:put:"]=1;
  54263. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54264. }));
  54265. $self._assert_equals_(newCollection,$self._collection());
  54266. $ctx1.sendIdx["assert:equals:"]=1;
  54267. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  54268. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  54269. return self;
  54270. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  54271. },
  54272. args: [],
  54273. 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",
  54274. referencedClasses: [],
  54275. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  54276. }),
  54277. $globals.IndexableCollectionTest);
  54278. $core.addMethod(
  54279. $core.method({
  54280. selector: "testIndexOf",
  54281. protocol: "tests",
  54282. fn: function (){
  54283. var self=this,$self=this;
  54284. return $core.withContext(function($ctx1) {
  54285. var $1;
  54286. $self._should_raise_((function(){
  54287. return $core.withContext(function($ctx2) {
  54288. $1=$self._collection();
  54289. $ctx2.sendIdx["collection"]=1;
  54290. return $recv($1)._indexOf_($self._sampleNewValue());
  54291. $ctx2.sendIdx["indexOf:"]=1;
  54292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54293. }),$globals.Error);
  54294. $self._samplesDo_((function(index,value){
  54295. return $core.withContext(function($ctx2) {
  54296. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  54297. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  54298. }));
  54299. return self;
  54300. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  54301. },
  54302. args: [],
  54303. 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 ]",
  54304. referencedClasses: ["Error"],
  54305. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  54306. }),
  54307. $globals.IndexableCollectionTest);
  54308. $core.addMethod(
  54309. $core.method({
  54310. selector: "testIndexOfWithNull",
  54311. protocol: "tests",
  54312. fn: function (){
  54313. var self=this,$self=this;
  54314. var jsNull;
  54315. return $core.withContext(function($ctx1) {
  54316. var $2,$1;
  54317. jsNull=$recv($globals.JSON)._parse_("null");
  54318. $self._samplesDo_((function(index,value){
  54319. return $core.withContext(function($ctx2) {
  54320. $2=$self._collection();
  54321. $recv($2)._at_put_(index,jsNull);
  54322. $1=$recv($2)._indexOf_(jsNull);
  54323. return $self._assert_equals_($1,index);
  54324. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54325. }));
  54326. return self;
  54327. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  54328. },
  54329. args: [],
  54330. 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 ]",
  54331. referencedClasses: ["JSON"],
  54332. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  54333. }),
  54334. $globals.IndexableCollectionTest);
  54335. $core.addMethod(
  54336. $core.method({
  54337. selector: "testWithIndexDo",
  54338. protocol: "tests",
  54339. fn: function (){
  54340. var self=this,$self=this;
  54341. var collection;
  54342. return $core.withContext(function($ctx1) {
  54343. collection=$self._collection();
  54344. $ctx1.sendIdx["collection"]=1;
  54345. $recv($self._collection())._withIndexDo_((function(each,index){
  54346. return $core.withContext(function($ctx2) {
  54347. return $self._assert_equals_($recv(collection)._at_(index),each);
  54348. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  54349. }));
  54350. return self;
  54351. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  54352. },
  54353. args: [],
  54354. 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 ]",
  54355. referencedClasses: [],
  54356. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  54357. }),
  54358. $globals.IndexableCollectionTest);
  54359. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  54360. $core.addMethod(
  54361. $core.method({
  54362. selector: "collectionKeys",
  54363. protocol: "fixture",
  54364. fn: function (){
  54365. var self=this,$self=this;
  54366. return $core.withContext(function($ctx1) {
  54367. $self._subclassResponsibility();
  54368. return self;
  54369. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  54370. },
  54371. args: [],
  54372. source: "collectionKeys\x0a\x09self subclassResponsibility",
  54373. referencedClasses: [],
  54374. messageSends: ["subclassResponsibility"]
  54375. }),
  54376. $globals.AssociativeCollectionTest);
  54377. $core.addMethod(
  54378. $core.method({
  54379. selector: "collectionValues",
  54380. protocol: "fixture",
  54381. fn: function (){
  54382. var self=this,$self=this;
  54383. return $core.withContext(function($ctx1) {
  54384. $self._subclassResponsibility();
  54385. return self;
  54386. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  54387. },
  54388. args: [],
  54389. source: "collectionValues\x0a\x09self subclassResponsibility",
  54390. referencedClasses: [],
  54391. messageSends: ["subclassResponsibility"]
  54392. }),
  54393. $globals.AssociativeCollectionTest);
  54394. $core.addMethod(
  54395. $core.method({
  54396. selector: "nonIndexesDo:",
  54397. protocol: "fixture",
  54398. fn: function (aBlock){
  54399. var self=this,$self=this;
  54400. return $core.withContext(function($ctx1) {
  54401. $recv(aBlock)._value_((5));
  54402. $ctx1.sendIdx["value:"]=1;
  54403. $recv(aBlock)._value_((function(){
  54404. }));
  54405. $ctx1.sendIdx["value:"]=2;
  54406. $recv(aBlock)._value_($recv($globals.Object)._new());
  54407. $ctx1.sendIdx["value:"]=3;
  54408. $recv(aBlock)._value_("z");
  54409. return self;
  54410. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54411. },
  54412. args: ["aBlock"],
  54413. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  54414. referencedClasses: ["Object"],
  54415. messageSends: ["value:", "new"]
  54416. }),
  54417. $globals.AssociativeCollectionTest);
  54418. $core.addMethod(
  54419. $core.method({
  54420. selector: "sampleNewIndex",
  54421. protocol: "fixture",
  54422. fn: function (){
  54423. var self=this,$self=this;
  54424. return "new";
  54425. },
  54426. args: [],
  54427. source: "sampleNewIndex\x0a\x09^ 'new'",
  54428. referencedClasses: [],
  54429. messageSends: []
  54430. }),
  54431. $globals.AssociativeCollectionTest);
  54432. $core.addMethod(
  54433. $core.method({
  54434. selector: "samplesDo:",
  54435. protocol: "fixture",
  54436. fn: function (aBlock){
  54437. var self=this,$self=this;
  54438. return $core.withContext(function($ctx1) {
  54439. $recv(aBlock)._value_value_("a",(2));
  54440. return self;
  54441. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54442. },
  54443. args: ["aBlock"],
  54444. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  54445. referencedClasses: [],
  54446. messageSends: ["value:value:"]
  54447. }),
  54448. $globals.AssociativeCollectionTest);
  54449. $core.addMethod(
  54450. $core.method({
  54451. selector: "testAddAll",
  54452. protocol: "tests",
  54453. fn: function (){
  54454. var self=this,$self=this;
  54455. return $core.withContext(function($ctx1) {
  54456. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  54457. (
  54458. $ctx1.supercall = true,
  54459. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  54460. $ctx1.supercall = false;
  54461. $2=$self._collection();
  54462. $ctx1.sendIdx["collection"]=1;
  54463. $3=$self._collection();
  54464. $ctx1.sendIdx["collection"]=2;
  54465. $recv($2)._addAll_($3);
  54466. $ctx1.sendIdx["addAll:"]=1;
  54467. $4=$recv($2)._yourself();
  54468. $ctx1.sendIdx["yourself"]=1;
  54469. $1=$4;
  54470. $5=$self._collection();
  54471. $ctx1.sendIdx["collection"]=3;
  54472. $self._assert_equals_($1,$5);
  54473. $ctx1.sendIdx["assert:equals:"]=1;
  54474. $7=$self._collection();
  54475. $ctx1.sendIdx["collection"]=4;
  54476. $8=$self._collectionWithNewValue();
  54477. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54478. $recv($7)._addAll_($8);
  54479. $ctx1.sendIdx["addAll:"]=2;
  54480. $9=$recv($7)._yourself();
  54481. $ctx1.sendIdx["yourself"]=2;
  54482. $6=$9;
  54483. $10=$self._collectionWithNewValue();
  54484. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54485. $self._assert_equals_($6,$10);
  54486. $ctx1.sendIdx["assert:equals:"]=2;
  54487. $12=$self._collectionWithNewValue();
  54488. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54489. $recv($12)._addAll_($self._collection());
  54490. $11=$recv($12)._yourself();
  54491. $self._assert_equals_($11,$self._collectionWithNewValue());
  54492. return self;
  54493. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  54494. },
  54495. args: [],
  54496. 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",
  54497. referencedClasses: [],
  54498. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  54499. }),
  54500. $globals.AssociativeCollectionTest);
  54501. $core.addMethod(
  54502. $core.method({
  54503. selector: "testAsDictionary",
  54504. protocol: "tests",
  54505. fn: function (){
  54506. var self=this,$self=this;
  54507. return $core.withContext(function($ctx1) {
  54508. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  54509. return self;
  54510. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  54511. },
  54512. args: [],
  54513. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  54514. referencedClasses: ["Dictionary"],
  54515. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  54516. }),
  54517. $globals.AssociativeCollectionTest);
  54518. $core.addMethod(
  54519. $core.method({
  54520. selector: "testAsHashedCollection",
  54521. protocol: "tests",
  54522. fn: function (){
  54523. var self=this,$self=this;
  54524. return $core.withContext(function($ctx1) {
  54525. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  54526. return self;
  54527. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  54528. },
  54529. args: [],
  54530. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  54531. referencedClasses: ["HashedCollection"],
  54532. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  54533. }),
  54534. $globals.AssociativeCollectionTest);
  54535. $core.addMethod(
  54536. $core.method({
  54537. selector: "testComma",
  54538. protocol: "tests",
  54539. fn: function (){
  54540. var self=this,$self=this;
  54541. return $core.withContext(function($ctx1) {
  54542. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  54543. (
  54544. $ctx1.supercall = true,
  54545. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  54546. $ctx1.supercall = false;
  54547. $2=$self._collection();
  54548. $ctx1.sendIdx["collection"]=1;
  54549. $3=$self._collection();
  54550. $ctx1.sendIdx["collection"]=2;
  54551. $1=$recv($2).__comma($3);
  54552. $ctx1.sendIdx[","]=1;
  54553. $4=$self._collection();
  54554. $ctx1.sendIdx["collection"]=3;
  54555. $self._assert_equals_($1,$4);
  54556. $ctx1.sendIdx["assert:equals:"]=1;
  54557. $6=$self._collection();
  54558. $ctx1.sendIdx["collection"]=4;
  54559. $7=$self._collectionWithNewValue();
  54560. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54561. $5=$recv($6).__comma($7);
  54562. $ctx1.sendIdx[","]=2;
  54563. $8=$self._collectionWithNewValue();
  54564. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54565. $self._assert_equals_($5,$8);
  54566. $ctx1.sendIdx["assert:equals:"]=2;
  54567. $10=$self._collectionWithNewValue();
  54568. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54569. $9=$recv($10).__comma($self._collection());
  54570. $self._assert_equals_($9,$self._collectionWithNewValue());
  54571. return self;
  54572. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  54573. },
  54574. args: [],
  54575. 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",
  54576. referencedClasses: [],
  54577. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  54578. }),
  54579. $globals.AssociativeCollectionTest);
  54580. $core.addMethod(
  54581. $core.method({
  54582. selector: "testFrom",
  54583. protocol: "tests",
  54584. fn: function (){
  54585. var self=this,$self=this;
  54586. var associations;
  54587. return $core.withContext(function($ctx1) {
  54588. var $1;
  54589. $1="a".__minus_gt((1));
  54590. $ctx1.sendIdx["->"]=1;
  54591. associations=[$1,"b".__minus_gt((2))];
  54592. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54593. return self;
  54594. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  54595. },
  54596. args: [],
  54597. 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 }.",
  54598. referencedClasses: [],
  54599. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  54600. }),
  54601. $globals.AssociativeCollectionTest);
  54602. $core.addMethod(
  54603. $core.method({
  54604. selector: "testKeys",
  54605. protocol: "tests",
  54606. fn: function (){
  54607. var self=this,$self=this;
  54608. return $core.withContext(function($ctx1) {
  54609. var $2,$1,$3,$4;
  54610. $2=$recv($recv($self._collectionClass())._new())._keys();
  54611. $ctx1.sendIdx["keys"]=1;
  54612. $1=$recv($2)._isEmpty();
  54613. $self._assert_($1);
  54614. $3=$recv($self._collection())._keys();
  54615. $ctx1.sendIdx["keys"]=2;
  54616. $4=$self._collectionKeys();
  54617. $ctx1.sendIdx["collectionKeys"]=1;
  54618. $self._assertSameContents_as_($3,$4);
  54619. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54620. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  54621. return self;
  54622. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  54623. },
  54624. args: [],
  54625. 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 }",
  54626. referencedClasses: [],
  54627. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  54628. }),
  54629. $globals.AssociativeCollectionTest);
  54630. $core.addMethod(
  54631. $core.method({
  54632. selector: "testNewFromPairs",
  54633. protocol: "tests",
  54634. fn: function (){
  54635. var self=this,$self=this;
  54636. var flattenedAssociations;
  54637. return $core.withContext(function($ctx1) {
  54638. flattenedAssociations=["a",(1),"b",(2)];
  54639. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54640. return self;
  54641. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  54642. },
  54643. args: [],
  54644. 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 }.",
  54645. referencedClasses: [],
  54646. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  54647. }),
  54648. $globals.AssociativeCollectionTest);
  54649. $core.addMethod(
  54650. $core.method({
  54651. selector: "testPrintString",
  54652. protocol: "tests",
  54653. fn: function (){
  54654. var self=this,$self=this;
  54655. return $core.withContext(function($ctx1) {
  54656. var $3,$2,$1,$4;
  54657. $3=$self._collectionClass();
  54658. $ctx1.sendIdx["collectionClass"]=1;
  54659. $2=$recv($3)._new();
  54660. $recv($2)._at_put_("firstname","James");
  54661. $ctx1.sendIdx["at:put:"]=1;
  54662. $recv($2)._at_put_("lastname","Bond");
  54663. $1=$recv($2)._printString();
  54664. $4=$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  54665. $ctx1.sendIdx[","]=1;
  54666. $self._assert_equals_($1,$4);
  54667. return self;
  54668. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  54669. },
  54670. args: [],
  54671. 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'')'",
  54672. referencedClasses: [],
  54673. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  54674. }),
  54675. $globals.AssociativeCollectionTest);
  54676. $core.addMethod(
  54677. $core.method({
  54678. selector: "testRemoveKey",
  54679. protocol: "tests",
  54680. fn: function (){
  54681. var self=this,$self=this;
  54682. return $core.withContext(function($ctx1) {
  54683. var $1,$2,$3,$5,$6,$4,$8,$7;
  54684. $self._nonIndexesDo_((function(each){
  54685. var collection;
  54686. return $core.withContext(function($ctx2) {
  54687. collection=$self._collection();
  54688. $ctx2.sendIdx["collection"]=1;
  54689. $self._should_raise_((function(){
  54690. return $core.withContext(function($ctx3) {
  54691. return $recv(collection)._removeKey_(each);
  54692. $ctx3.sendIdx["removeKey:"]=1;
  54693. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54694. }),$globals.Error);
  54695. $1=collection;
  54696. $2=$self._collection();
  54697. $ctx2.sendIdx["collection"]=2;
  54698. return $self._assert_equals_($1,$2);
  54699. $ctx2.sendIdx["assert:equals:"]=1;
  54700. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54701. }));
  54702. $self._samplesDo_((function(index,value){
  54703. var collection;
  54704. return $core.withContext(function($ctx2) {
  54705. collection=$self._collection();
  54706. $ctx2.sendIdx["collection"]=3;
  54707. $3=$recv(collection)._removeKey_(index);
  54708. $ctx2.sendIdx["removeKey:"]=2;
  54709. $self._assert_equals_($3,value);
  54710. $ctx2.sendIdx["assert:equals:"]=2;
  54711. $5=collection;
  54712. $6=$self._collection();
  54713. $ctx2.sendIdx["collection"]=4;
  54714. $4=$recv($5).__eq($6);
  54715. return $self._deny_($4);
  54716. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54717. }));
  54718. $8=$self._collectionWithNewValue();
  54719. $recv($8)._removeKey_($self._sampleNewIndex());
  54720. $7=$recv($8)._yourself();
  54721. $self._assert_equals_($7,$self._collection());
  54722. return self;
  54723. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  54724. },
  54725. args: [],
  54726. 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",
  54727. referencedClasses: ["Error"],
  54728. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  54729. }),
  54730. $globals.AssociativeCollectionTest);
  54731. $core.addMethod(
  54732. $core.method({
  54733. selector: "testRemoveKeyIfAbsent",
  54734. protocol: "tests",
  54735. fn: function (){
  54736. var self=this,$self=this;
  54737. return $core.withContext(function($ctx1) {
  54738. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  54739. $self._nonIndexesDo_((function(each){
  54740. var collection;
  54741. return $core.withContext(function($ctx2) {
  54742. collection=$self._collection();
  54743. $ctx2.sendIdx["collection"]=1;
  54744. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  54745. return $core.withContext(function($ctx3) {
  54746. return $self._sampleNewValue();
  54747. $ctx3.sendIdx["sampleNewValue"]=1;
  54748. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54749. }));
  54750. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  54751. $2=$self._sampleNewValue();
  54752. $ctx2.sendIdx["sampleNewValue"]=2;
  54753. $self._assert_equals_($1,$2);
  54754. $ctx2.sendIdx["assert:equals:"]=1;
  54755. $3=collection;
  54756. $4=$self._collection();
  54757. $ctx2.sendIdx["collection"]=2;
  54758. return $self._assert_equals_($3,$4);
  54759. $ctx2.sendIdx["assert:equals:"]=2;
  54760. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54761. }));
  54762. $self._samplesDo_((function(index,value){
  54763. var collection;
  54764. return $core.withContext(function($ctx2) {
  54765. collection=$self._collection();
  54766. $ctx2.sendIdx["collection"]=3;
  54767. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  54768. return $core.withContext(function($ctx3) {
  54769. return $self._sampleNewValue();
  54770. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  54771. }));
  54772. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  54773. $self._assert_equals_($5,value);
  54774. $ctx2.sendIdx["assert:equals:"]=3;
  54775. $7=collection;
  54776. $8=$self._collection();
  54777. $ctx2.sendIdx["collection"]=4;
  54778. $6=$recv($7).__eq($8);
  54779. return $self._deny_($6);
  54780. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54781. }));
  54782. $10=$self._collectionWithNewValue();
  54783. $recv($10)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  54784. return $core.withContext(function($ctx2) {
  54785. return $self._assert_(false);
  54786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54787. }));
  54788. $9=$recv($10)._yourself();
  54789. $self._assert_equals_($9,$self._collection());
  54790. return self;
  54791. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  54792. },
  54793. args: [],
  54794. 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",
  54795. referencedClasses: [],
  54796. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  54797. }),
  54798. $globals.AssociativeCollectionTest);
  54799. $core.addMethod(
  54800. $core.method({
  54801. selector: "testValues",
  54802. protocol: "tests",
  54803. fn: function (){
  54804. var self=this,$self=this;
  54805. return $core.withContext(function($ctx1) {
  54806. var $2,$1,$3,$4;
  54807. $2=$recv($recv($self._collectionClass())._new())._values();
  54808. $ctx1.sendIdx["values"]=1;
  54809. $1=$recv($2)._isEmpty();
  54810. $self._assert_($1);
  54811. $3=$recv($self._collection())._values();
  54812. $ctx1.sendIdx["values"]=2;
  54813. $4=$self._collectionValues();
  54814. $ctx1.sendIdx["collectionValues"]=1;
  54815. $self._assertSameContents_as_($3,$4);
  54816. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54817. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  54818. return self;
  54819. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  54820. },
  54821. args: [],
  54822. 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 }",
  54823. referencedClasses: [],
  54824. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  54825. }),
  54826. $globals.AssociativeCollectionTest);
  54827. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54828. $core.addMethod(
  54829. $core.method({
  54830. selector: "collection",
  54831. protocol: "fixture",
  54832. fn: function (){
  54833. var self=this,$self=this;
  54834. return $core.withContext(function($ctx1) {
  54835. var $1;
  54836. $1=$recv($globals.Dictionary)._new();
  54837. $recv($1)._at_put_((1),(1));
  54838. $ctx1.sendIdx["at:put:"]=1;
  54839. $recv($1)._at_put_("a",(2));
  54840. $ctx1.sendIdx["at:put:"]=2;
  54841. $recv($1)._at_put_(true,(3));
  54842. $ctx1.sendIdx["at:put:"]=3;
  54843. $recv($1)._at_put_((1).__at((3)),(-4));
  54844. $ctx1.sendIdx["at:put:"]=4;
  54845. $recv($1)._at_put_($self.sampleBlock,(9));
  54846. return $recv($1)._yourself();
  54847. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  54848. },
  54849. args: [],
  54850. 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",
  54851. referencedClasses: ["Dictionary"],
  54852. messageSends: ["at:put:", "new", "@", "yourself"]
  54853. }),
  54854. $globals.DictionaryTest);
  54855. $core.addMethod(
  54856. $core.method({
  54857. selector: "collectionKeys",
  54858. protocol: "fixture",
  54859. fn: function (){
  54860. var self=this,$self=this;
  54861. return $core.withContext(function($ctx1) {
  54862. return [(1),"a",true,(1).__at((3)),$self.sampleBlock];
  54863. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  54864. },
  54865. args: [],
  54866. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  54867. referencedClasses: [],
  54868. messageSends: ["@"]
  54869. }),
  54870. $globals.DictionaryTest);
  54871. $core.addMethod(
  54872. $core.method({
  54873. selector: "collectionOfPrintStrings",
  54874. protocol: "fixture",
  54875. fn: function (){
  54876. var self=this,$self=this;
  54877. return $core.withContext(function($ctx1) {
  54878. var $1;
  54879. $1=$recv($globals.Dictionary)._new();
  54880. $recv($1)._at_put_((1),"1");
  54881. $ctx1.sendIdx["at:put:"]=1;
  54882. $recv($1)._at_put_("a","2");
  54883. $ctx1.sendIdx["at:put:"]=2;
  54884. $recv($1)._at_put_(true,"3");
  54885. $ctx1.sendIdx["at:put:"]=3;
  54886. $recv($1)._at_put_((1).__at((3)),"-4");
  54887. $ctx1.sendIdx["at:put:"]=4;
  54888. $recv($1)._at_put_($self.sampleBlock,"9");
  54889. return $recv($1)._yourself();
  54890. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  54891. },
  54892. args: [],
  54893. 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",
  54894. referencedClasses: ["Dictionary"],
  54895. messageSends: ["at:put:", "new", "@", "yourself"]
  54896. }),
  54897. $globals.DictionaryTest);
  54898. $core.addMethod(
  54899. $core.method({
  54900. selector: "collectionSize",
  54901. protocol: "fixture",
  54902. fn: function (){
  54903. var self=this,$self=this;
  54904. return (5);
  54905. },
  54906. args: [],
  54907. source: "collectionSize\x0a\x09^ 5",
  54908. referencedClasses: [],
  54909. messageSends: []
  54910. }),
  54911. $globals.DictionaryTest);
  54912. $core.addMethod(
  54913. $core.method({
  54914. selector: "collectionValues",
  54915. protocol: "fixture",
  54916. fn: function (){
  54917. var self=this,$self=this;
  54918. return [(1),(2),(3),(-4),(9)];
  54919. },
  54920. args: [],
  54921. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  54922. referencedClasses: [],
  54923. messageSends: []
  54924. }),
  54925. $globals.DictionaryTest);
  54926. $core.addMethod(
  54927. $core.method({
  54928. selector: "collectionWithDuplicates",
  54929. protocol: "fixture",
  54930. fn: function (){
  54931. var self=this,$self=this;
  54932. return $core.withContext(function($ctx1) {
  54933. var $1;
  54934. $1=$recv($globals.Dictionary)._new();
  54935. $recv($1)._at_put_((1),(1));
  54936. $ctx1.sendIdx["at:put:"]=1;
  54937. $recv($1)._at_put_("a",(2));
  54938. $ctx1.sendIdx["at:put:"]=2;
  54939. $recv($1)._at_put_(true,(3));
  54940. $ctx1.sendIdx["at:put:"]=3;
  54941. $recv($1)._at_put_((4),(-4));
  54942. $ctx1.sendIdx["at:put:"]=4;
  54943. $recv($1)._at_put_($self.sampleBlock,(9));
  54944. $ctx1.sendIdx["at:put:"]=5;
  54945. $recv($1)._at_put_("b",(1));
  54946. $ctx1.sendIdx["at:put:"]=6;
  54947. $recv($1)._at_put_((3),(3));
  54948. $ctx1.sendIdx["at:put:"]=7;
  54949. $recv($1)._at_put_(false,(12));
  54950. return $recv($1)._yourself();
  54951. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  54952. },
  54953. args: [],
  54954. 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",
  54955. referencedClasses: ["Dictionary"],
  54956. messageSends: ["at:put:", "new", "yourself"]
  54957. }),
  54958. $globals.DictionaryTest);
  54959. $core.addMethod(
  54960. $core.method({
  54961. selector: "collectionWithNewValue",
  54962. protocol: "fixture",
  54963. fn: function (){
  54964. var self=this,$self=this;
  54965. return $core.withContext(function($ctx1) {
  54966. var $1;
  54967. $1=$recv($globals.Dictionary)._new();
  54968. $recv($1)._at_put_((1),(1));
  54969. $ctx1.sendIdx["at:put:"]=1;
  54970. $recv($1)._at_put_("a",(2));
  54971. $ctx1.sendIdx["at:put:"]=2;
  54972. $recv($1)._at_put_(true,(3));
  54973. $ctx1.sendIdx["at:put:"]=3;
  54974. $recv($1)._at_put_((1).__at((3)),(-4));
  54975. $ctx1.sendIdx["at:put:"]=4;
  54976. $recv($1)._at_put_($self.sampleBlock,(9));
  54977. $ctx1.sendIdx["at:put:"]=5;
  54978. $recv($1)._at_put_("new","N");
  54979. return $recv($1)._yourself();
  54980. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  54981. },
  54982. args: [],
  54983. 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",
  54984. referencedClasses: ["Dictionary"],
  54985. messageSends: ["at:put:", "new", "@", "yourself"]
  54986. }),
  54987. $globals.DictionaryTest);
  54988. $core.addMethod(
  54989. $core.method({
  54990. selector: "sampleNewValueAsCollection",
  54991. protocol: "fixture",
  54992. fn: function (){
  54993. var self=this,$self=this;
  54994. return $core.withContext(function($ctx1) {
  54995. var $1;
  54996. $1=$recv($globals.Dictionary)._new();
  54997. $recv($1)._at_put_("new","N");
  54998. return $recv($1)._yourself();
  54999. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  55000. },
  55001. args: [],
  55002. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  55003. referencedClasses: ["Dictionary"],
  55004. messageSends: ["at:put:", "new", "yourself"]
  55005. }),
  55006. $globals.DictionaryTest);
  55007. $core.addMethod(
  55008. $core.method({
  55009. selector: "samplesDo:",
  55010. protocol: "fixture",
  55011. fn: function (aBlock){
  55012. var self=this,$self=this;
  55013. return $core.withContext(function($ctx1) {
  55014. (
  55015. $ctx1.supercall = true,
  55016. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55017. $ctx1.supercall = false;
  55018. $recv(aBlock)._value_value_(true,(3));
  55019. $ctx1.sendIdx["value:value:"]=1;
  55020. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  55021. $ctx1.sendIdx["value:value:"]=2;
  55022. $recv(aBlock)._value_value_($self.sampleBlock,(9));
  55023. return self;
  55024. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  55025. },
  55026. args: ["aBlock"],
  55027. 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",
  55028. referencedClasses: [],
  55029. messageSends: ["samplesDo:", "value:value:", "@"]
  55030. }),
  55031. $globals.DictionaryTest);
  55032. $core.addMethod(
  55033. $core.method({
  55034. selector: "testAccessing",
  55035. protocol: "tests",
  55036. fn: function (){
  55037. var self=this,$self=this;
  55038. var d;
  55039. return $core.withContext(function($ctx1) {
  55040. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  55041. d=$recv($globals.Dictionary)._new();
  55042. $recv(d)._at_put_("hello","world");
  55043. $ctx1.sendIdx["at:put:"]=1;
  55044. $1=$recv(d)._at_("hello");
  55045. $ctx1.sendIdx["at:"]=1;
  55046. $self._assert_equals_($1,"world");
  55047. $ctx1.sendIdx["assert:equals:"]=1;
  55048. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  55049. return nil;
  55050. }));
  55051. $ctx1.sendIdx["at:ifAbsent:"]=1;
  55052. $self._assert_equals_($2,"world");
  55053. $ctx1.sendIdx["assert:equals:"]=2;
  55054. $self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  55055. return nil;
  55056. }))).__eq("world"));
  55057. $ctx1.sendIdx["deny:"]=1;
  55058. $3=$recv(d)._includesKey_("hello");
  55059. $ctx1.sendIdx["includesKey:"]=1;
  55060. $self._assert_($3);
  55061. $ctx1.sendIdx["assert:"]=1;
  55062. $4=$recv(d)._includesKey_("foo");
  55063. $ctx1.sendIdx["includesKey:"]=2;
  55064. $self._deny_($4);
  55065. $ctx1.sendIdx["deny:"]=2;
  55066. $recv(d)._at_put_((1),(2));
  55067. $ctx1.sendIdx["at:put:"]=2;
  55068. $5=$recv(d)._at_((1));
  55069. $ctx1.sendIdx["at:"]=2;
  55070. $self._assert_equals_($5,(2));
  55071. $ctx1.sendIdx["assert:equals:"]=3;
  55072. $6=d;
  55073. $7=(1).__at((3));
  55074. $ctx1.sendIdx["@"]=1;
  55075. $recv($6)._at_put_($7,(3));
  55076. $9=d;
  55077. $10=(1).__at((3));
  55078. $ctx1.sendIdx["@"]=2;
  55079. $8=$recv($9)._at_($10);
  55080. $self._assert_equals_($8,(3));
  55081. $12=d;
  55082. $13=(1).__at((3));
  55083. $ctx1.sendIdx["@"]=3;
  55084. $11=$recv($12)._includesKey_($13);
  55085. $ctx1.sendIdx["includesKey:"]=3;
  55086. $self._assert_($11);
  55087. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  55088. return self;
  55089. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  55090. },
  55091. args: [],
  55092. 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)",
  55093. referencedClasses: ["Dictionary"],
  55094. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  55095. }),
  55096. $globals.DictionaryTest);
  55097. $core.addMethod(
  55098. $core.method({
  55099. selector: "testDynamicDictionaries",
  55100. protocol: "tests",
  55101. fn: function (){
  55102. var self=this,$self=this;
  55103. return $core.withContext(function($ctx1) {
  55104. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  55105. return self;
  55106. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  55107. },
  55108. args: [],
  55109. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  55110. referencedClasses: ["Dictionary"],
  55111. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  55112. }),
  55113. $globals.DictionaryTest);
  55114. $core.addMethod(
  55115. $core.method({
  55116. selector: "collectionClass",
  55117. protocol: "fixture",
  55118. fn: function (){
  55119. var self=this,$self=this;
  55120. return $globals.Dictionary;
  55121. },
  55122. args: [],
  55123. source: "collectionClass\x0a\x09^ Dictionary",
  55124. referencedClasses: ["Dictionary"],
  55125. messageSends: []
  55126. }),
  55127. $globals.DictionaryTest.a$cls);
  55128. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  55129. $core.addMethod(
  55130. $core.method({
  55131. selector: "collection",
  55132. protocol: "fixture",
  55133. fn: function (){
  55134. var self=this,$self=this;
  55135. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  55136. },
  55137. args: [],
  55138. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  55139. referencedClasses: [],
  55140. messageSends: []
  55141. }),
  55142. $globals.HashedCollectionTest);
  55143. $core.addMethod(
  55144. $core.method({
  55145. selector: "collectionKeys",
  55146. protocol: "fixture",
  55147. fn: function (){
  55148. var self=this,$self=this;
  55149. return ["b","a","c","d"];
  55150. },
  55151. args: [],
  55152. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  55153. referencedClasses: [],
  55154. messageSends: []
  55155. }),
  55156. $globals.HashedCollectionTest);
  55157. $core.addMethod(
  55158. $core.method({
  55159. selector: "collectionOfPrintStrings",
  55160. protocol: "fixture",
  55161. fn: function (){
  55162. var self=this,$self=this;
  55163. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  55164. },
  55165. args: [],
  55166. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  55167. referencedClasses: [],
  55168. messageSends: []
  55169. }),
  55170. $globals.HashedCollectionTest);
  55171. $core.addMethod(
  55172. $core.method({
  55173. selector: "collectionSize",
  55174. protocol: "fixture",
  55175. fn: function (){
  55176. var self=this,$self=this;
  55177. return (4);
  55178. },
  55179. args: [],
  55180. source: "collectionSize\x0a\x09^ 4",
  55181. referencedClasses: [],
  55182. messageSends: []
  55183. }),
  55184. $globals.HashedCollectionTest);
  55185. $core.addMethod(
  55186. $core.method({
  55187. selector: "collectionValues",
  55188. protocol: "fixture",
  55189. fn: function (){
  55190. var self=this,$self=this;
  55191. return [(1),(2),(3),(-4)];
  55192. },
  55193. args: [],
  55194. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  55195. referencedClasses: [],
  55196. messageSends: []
  55197. }),
  55198. $globals.HashedCollectionTest);
  55199. $core.addMethod(
  55200. $core.method({
  55201. selector: "collectionWithDuplicates",
  55202. protocol: "fixture",
  55203. fn: function (){
  55204. var self=this,$self=this;
  55205. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  55206. },
  55207. args: [],
  55208. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  55209. referencedClasses: [],
  55210. messageSends: []
  55211. }),
  55212. $globals.HashedCollectionTest);
  55213. $core.addMethod(
  55214. $core.method({
  55215. selector: "collectionWithNewValue",
  55216. protocol: "fixture",
  55217. fn: function (){
  55218. var self=this,$self=this;
  55219. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  55220. },
  55221. args: [],
  55222. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  55223. referencedClasses: [],
  55224. messageSends: []
  55225. }),
  55226. $globals.HashedCollectionTest);
  55227. $core.addMethod(
  55228. $core.method({
  55229. selector: "sampleNewValueAsCollection",
  55230. protocol: "fixture",
  55231. fn: function (){
  55232. var self=this,$self=this;
  55233. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  55234. },
  55235. args: [],
  55236. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  55237. referencedClasses: [],
  55238. messageSends: []
  55239. }),
  55240. $globals.HashedCollectionTest);
  55241. $core.addMethod(
  55242. $core.method({
  55243. selector: "testDynamicDictionaries",
  55244. protocol: "tests",
  55245. fn: function (){
  55246. var self=this,$self=this;
  55247. return $core.withContext(function($ctx1) {
  55248. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  55249. return self;
  55250. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  55251. },
  55252. args: [],
  55253. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  55254. referencedClasses: ["HashedCollection"],
  55255. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  55256. }),
  55257. $globals.HashedCollectionTest);
  55258. $core.addMethod(
  55259. $core.method({
  55260. selector: "collectionClass",
  55261. protocol: "fixture",
  55262. fn: function (){
  55263. var self=this,$self=this;
  55264. return $globals.HashedCollection;
  55265. },
  55266. args: [],
  55267. source: "collectionClass\x0a\x09^ HashedCollection",
  55268. referencedClasses: ["HashedCollection"],
  55269. messageSends: []
  55270. }),
  55271. $globals.HashedCollectionTest.a$cls);
  55272. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  55273. $core.addMethod(
  55274. $core.method({
  55275. selector: "collectionFirst",
  55276. protocol: "fixture",
  55277. fn: function (){
  55278. var self=this,$self=this;
  55279. return $core.withContext(function($ctx1) {
  55280. $self._subclassResponsibility();
  55281. return self;
  55282. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  55283. },
  55284. args: [],
  55285. source: "collectionFirst\x0a\x09self subclassResponsibility",
  55286. referencedClasses: [],
  55287. messageSends: ["subclassResponsibility"]
  55288. }),
  55289. $globals.SequenceableCollectionTest);
  55290. $core.addMethod(
  55291. $core.method({
  55292. selector: "collectionFirstTwo",
  55293. protocol: "fixture",
  55294. fn: function (){
  55295. var self=this,$self=this;
  55296. return $core.withContext(function($ctx1) {
  55297. $self._subclassResponsibility();
  55298. return self;
  55299. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  55300. },
  55301. args: [],
  55302. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  55303. referencedClasses: [],
  55304. messageSends: ["subclassResponsibility"]
  55305. }),
  55306. $globals.SequenceableCollectionTest);
  55307. $core.addMethod(
  55308. $core.method({
  55309. selector: "collectionLast",
  55310. protocol: "fixture",
  55311. fn: function (){
  55312. var self=this,$self=this;
  55313. return $core.withContext(function($ctx1) {
  55314. $self._subclassResponsibility();
  55315. return self;
  55316. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  55317. },
  55318. args: [],
  55319. source: "collectionLast\x0a\x09self subclassResponsibility",
  55320. referencedClasses: [],
  55321. messageSends: ["subclassResponsibility"]
  55322. }),
  55323. $globals.SequenceableCollectionTest);
  55324. $core.addMethod(
  55325. $core.method({
  55326. selector: "collectionLastTwo",
  55327. protocol: "fixture",
  55328. fn: function (){
  55329. var self=this,$self=this;
  55330. return $core.withContext(function($ctx1) {
  55331. $self._subclassResponsibility();
  55332. return self;
  55333. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  55334. },
  55335. args: [],
  55336. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  55337. referencedClasses: [],
  55338. messageSends: ["subclassResponsibility"]
  55339. }),
  55340. $globals.SequenceableCollectionTest);
  55341. $core.addMethod(
  55342. $core.method({
  55343. selector: "nonIndexesDo:",
  55344. protocol: "fixture",
  55345. fn: function (aBlock){
  55346. var self=this,$self=this;
  55347. return $core.withContext(function($ctx1) {
  55348. $recv(aBlock)._value_((0));
  55349. $ctx1.sendIdx["value:"]=1;
  55350. $recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)));
  55351. $ctx1.sendIdx["value:"]=2;
  55352. $recv(aBlock)._value_("z");
  55353. return self;
  55354. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55355. },
  55356. args: ["aBlock"],
  55357. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  55358. referencedClasses: [],
  55359. messageSends: ["value:", "+", "collectionSize"]
  55360. }),
  55361. $globals.SequenceableCollectionTest);
  55362. $core.addMethod(
  55363. $core.method({
  55364. selector: "samplesDo:",
  55365. protocol: "fixture",
  55366. fn: function (aBlock){
  55367. var self=this,$self=this;
  55368. return $core.withContext(function($ctx1) {
  55369. $recv(aBlock)._value_value_((1),$self._collectionFirst());
  55370. $ctx1.sendIdx["value:value:"]=1;
  55371. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  55372. return self;
  55373. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55374. },
  55375. args: ["aBlock"],
  55376. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  55377. referencedClasses: [],
  55378. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  55379. }),
  55380. $globals.SequenceableCollectionTest);
  55381. $core.addMethod(
  55382. $core.method({
  55383. selector: "testBeginsWith",
  55384. protocol: "tests",
  55385. fn: function (){
  55386. var self=this,$self=this;
  55387. return $core.withContext(function($ctx1) {
  55388. var $2,$1,$4,$5,$3,$7,$6;
  55389. $2=$self._collection();
  55390. $ctx1.sendIdx["collection"]=1;
  55391. $1=$recv($2)._beginsWith_($recv($self._collectionClass())._new());
  55392. $ctx1.sendIdx["beginsWith:"]=1;
  55393. $self._assert_($1);
  55394. $ctx1.sendIdx["assert:"]=1;
  55395. $4=$self._collection();
  55396. $ctx1.sendIdx["collection"]=2;
  55397. $5=$self._collection();
  55398. $ctx1.sendIdx["collection"]=3;
  55399. $3=$recv($4)._beginsWith_($5);
  55400. $ctx1.sendIdx["beginsWith:"]=2;
  55401. $self._assert_($3);
  55402. $ctx1.sendIdx["assert:"]=2;
  55403. $7=$self._collection();
  55404. $ctx1.sendIdx["collection"]=4;
  55405. $6=$recv($7)._beginsWith_($self._collectionFirstTwo());
  55406. $ctx1.sendIdx["beginsWith:"]=3;
  55407. $self._assert_($6);
  55408. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  55409. return self;
  55410. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  55411. },
  55412. args: [],
  55413. 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)",
  55414. referencedClasses: [],
  55415. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  55416. }),
  55417. $globals.SequenceableCollectionTest);
  55418. $core.addMethod(
  55419. $core.method({
  55420. selector: "testEndsWith",
  55421. protocol: "tests",
  55422. fn: function (){
  55423. var self=this,$self=this;
  55424. return $core.withContext(function($ctx1) {
  55425. var $2,$1,$4,$5,$3,$7,$6;
  55426. $2=$self._collection();
  55427. $ctx1.sendIdx["collection"]=1;
  55428. $1=$recv($2)._endsWith_($recv($self._collectionClass())._new());
  55429. $ctx1.sendIdx["endsWith:"]=1;
  55430. $self._assert_($1);
  55431. $ctx1.sendIdx["assert:"]=1;
  55432. $4=$self._collection();
  55433. $ctx1.sendIdx["collection"]=2;
  55434. $5=$self._collection();
  55435. $ctx1.sendIdx["collection"]=3;
  55436. $3=$recv($4)._endsWith_($5);
  55437. $ctx1.sendIdx["endsWith:"]=2;
  55438. $self._assert_($3);
  55439. $ctx1.sendIdx["assert:"]=2;
  55440. $7=$self._collection();
  55441. $ctx1.sendIdx["collection"]=4;
  55442. $6=$recv($7)._endsWith_($self._collectionLastTwo());
  55443. $ctx1.sendIdx["endsWith:"]=3;
  55444. $self._assert_($6);
  55445. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  55446. return self;
  55447. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  55448. },
  55449. args: [],
  55450. 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)",
  55451. referencedClasses: [],
  55452. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  55453. }),
  55454. $globals.SequenceableCollectionTest);
  55455. $core.addMethod(
  55456. $core.method({
  55457. selector: "testFirst",
  55458. protocol: "tests",
  55459. fn: function (){
  55460. var self=this,$self=this;
  55461. return $core.withContext(function($ctx1) {
  55462. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  55463. return self;
  55464. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  55465. },
  55466. args: [],
  55467. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  55468. referencedClasses: [],
  55469. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  55470. }),
  55471. $globals.SequenceableCollectionTest);
  55472. $core.addMethod(
  55473. $core.method({
  55474. selector: "testFirstN",
  55475. protocol: "tests",
  55476. fn: function (){
  55477. var self=this,$self=this;
  55478. return $core.withContext(function($ctx1) {
  55479. var $2,$1,$4,$3,$6,$5,$7;
  55480. $2=$self._collection();
  55481. $ctx1.sendIdx["collection"]=1;
  55482. $1=$recv($2)._first_((2));
  55483. $ctx1.sendIdx["first:"]=1;
  55484. $self._assert_equals_($1,$self._collectionFirstTwo());
  55485. $ctx1.sendIdx["assert:equals:"]=1;
  55486. $4=$self._collection();
  55487. $ctx1.sendIdx["collection"]=2;
  55488. $3=$recv($4)._first_((0));
  55489. $ctx1.sendIdx["first:"]=2;
  55490. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55491. $ctx1.sendIdx["assert:equals:"]=2;
  55492. $6=$self._collection();
  55493. $ctx1.sendIdx["collection"]=3;
  55494. $5=$recv($6)._first_($self._collectionSize());
  55495. $ctx1.sendIdx["first:"]=3;
  55496. $7=$self._collection();
  55497. $ctx1.sendIdx["collection"]=4;
  55498. $self._assert_equals_($5,$7);
  55499. $self._should_raise_((function(){
  55500. return $core.withContext(function($ctx2) {
  55501. return $recv($self._collection())._first_((33));
  55502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55503. }),$globals.Error);
  55504. return self;
  55505. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  55506. },
  55507. args: [],
  55508. 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",
  55509. referencedClasses: ["Error"],
  55510. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55511. }),
  55512. $globals.SequenceableCollectionTest);
  55513. $core.addMethod(
  55514. $core.method({
  55515. selector: "testFourth",
  55516. protocol: "tests",
  55517. fn: function (){
  55518. var self=this,$self=this;
  55519. return $core.withContext(function($ctx1) {
  55520. var $2,$1;
  55521. $2=$self._collection();
  55522. $ctx1.sendIdx["collection"]=1;
  55523. $1=$recv($2)._fourth();
  55524. $self._assert_equals_($1,$recv($self._collection())._at_((4)));
  55525. return self;
  55526. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  55527. },
  55528. args: [],
  55529. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  55530. referencedClasses: [],
  55531. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  55532. }),
  55533. $globals.SequenceableCollectionTest);
  55534. $core.addMethod(
  55535. $core.method({
  55536. selector: "testIndexOfStartingAt",
  55537. protocol: "tests",
  55538. fn: function (){
  55539. var self=this,$self=this;
  55540. var jsNull;
  55541. return $core.withContext(function($ctx1) {
  55542. var $2,$1,$4,$3;
  55543. jsNull=$recv($globals.JSON)._parse_("null");
  55544. $self._samplesDo_((function(index,value){
  55545. return $core.withContext(function($ctx2) {
  55546. $2=$self._collection();
  55547. $ctx2.sendIdx["collection"]=1;
  55548. $1=$recv($2)._indexOf_startingAt_(value,(1));
  55549. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55550. $self._assert_equals_($1,index);
  55551. $ctx2.sendIdx["assert:equals:"]=1;
  55552. $4=$self._collection();
  55553. $ctx2.sendIdx["collection"]=2;
  55554. $3=$recv($4)._indexOf_startingAt_(value,index);
  55555. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55556. $self._assert_equals_($3,index);
  55557. $ctx2.sendIdx["assert:equals:"]=2;
  55558. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  55559. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  55560. }));
  55561. return self;
  55562. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55563. },
  55564. args: [],
  55565. 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 ]",
  55566. referencedClasses: ["JSON"],
  55567. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  55568. }),
  55569. $globals.SequenceableCollectionTest);
  55570. $core.addMethod(
  55571. $core.method({
  55572. selector: "testIndexOfStartingAtWithNull",
  55573. protocol: "tests",
  55574. fn: function (){
  55575. var self=this,$self=this;
  55576. var jsNull;
  55577. return $core.withContext(function($ctx1) {
  55578. var $1,$2;
  55579. jsNull=$recv($globals.JSON)._parse_("null");
  55580. $self._samplesDo_((function(index,value){
  55581. var collection;
  55582. return $core.withContext(function($ctx2) {
  55583. collection=$self._collection();
  55584. $recv(collection)._at_put_(index,jsNull);
  55585. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  55586. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55587. $self._assert_equals_($1,index);
  55588. $ctx2.sendIdx["assert:equals:"]=1;
  55589. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  55590. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55591. $self._assert_equals_($2,index);
  55592. $ctx2.sendIdx["assert:equals:"]=2;
  55593. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  55594. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  55595. }));
  55596. return self;
  55597. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55598. },
  55599. args: [],
  55600. 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 ]",
  55601. referencedClasses: ["JSON"],
  55602. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  55603. }),
  55604. $globals.SequenceableCollectionTest);
  55605. $core.addMethod(
  55606. $core.method({
  55607. selector: "testLast",
  55608. protocol: "tests",
  55609. fn: function (){
  55610. var self=this,$self=this;
  55611. return $core.withContext(function($ctx1) {
  55612. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  55613. return self;
  55614. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  55615. },
  55616. args: [],
  55617. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  55618. referencedClasses: [],
  55619. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  55620. }),
  55621. $globals.SequenceableCollectionTest);
  55622. $core.addMethod(
  55623. $core.method({
  55624. selector: "testLastN",
  55625. protocol: "tests",
  55626. fn: function (){
  55627. var self=this,$self=this;
  55628. return $core.withContext(function($ctx1) {
  55629. var $2,$1,$4,$3,$6,$5,$7;
  55630. $2=$self._collection();
  55631. $ctx1.sendIdx["collection"]=1;
  55632. $1=$recv($2)._last_((2));
  55633. $ctx1.sendIdx["last:"]=1;
  55634. $self._assert_equals_($1,$self._collectionLastTwo());
  55635. $ctx1.sendIdx["assert:equals:"]=1;
  55636. $4=$self._collection();
  55637. $ctx1.sendIdx["collection"]=2;
  55638. $3=$recv($4)._last_((0));
  55639. $ctx1.sendIdx["last:"]=2;
  55640. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55641. $ctx1.sendIdx["assert:equals:"]=2;
  55642. $6=$self._collection();
  55643. $ctx1.sendIdx["collection"]=3;
  55644. $5=$recv($6)._last_($self._collectionSize());
  55645. $ctx1.sendIdx["last:"]=3;
  55646. $7=$self._collection();
  55647. $ctx1.sendIdx["collection"]=4;
  55648. $self._assert_equals_($5,$7);
  55649. $self._should_raise_((function(){
  55650. return $core.withContext(function($ctx2) {
  55651. return $recv($self._collection())._last_((33));
  55652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55653. }),$globals.Error);
  55654. return self;
  55655. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  55656. },
  55657. args: [],
  55658. 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",
  55659. referencedClasses: ["Error"],
  55660. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55661. }),
  55662. $globals.SequenceableCollectionTest);
  55663. $core.addMethod(
  55664. $core.method({
  55665. selector: "testSecond",
  55666. protocol: "tests",
  55667. fn: function (){
  55668. var self=this,$self=this;
  55669. return $core.withContext(function($ctx1) {
  55670. var $2,$1;
  55671. $2=$self._collection();
  55672. $ctx1.sendIdx["collection"]=1;
  55673. $1=$recv($2)._second();
  55674. $self._assert_equals_($1,$recv($self._collection())._at_((2)));
  55675. return self;
  55676. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  55677. },
  55678. args: [],
  55679. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  55680. referencedClasses: [],
  55681. messageSends: ["assert:equals:", "second", "collection", "at:"]
  55682. }),
  55683. $globals.SequenceableCollectionTest);
  55684. $core.addMethod(
  55685. $core.method({
  55686. selector: "testThird",
  55687. protocol: "tests",
  55688. fn: function (){
  55689. var self=this,$self=this;
  55690. return $core.withContext(function($ctx1) {
  55691. var $2,$1;
  55692. $2=$self._collection();
  55693. $ctx1.sendIdx["collection"]=1;
  55694. $1=$recv($2)._third();
  55695. $self._assert_equals_($1,$recv($self._collection())._at_((3)));
  55696. return self;
  55697. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  55698. },
  55699. args: [],
  55700. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  55701. referencedClasses: [],
  55702. messageSends: ["assert:equals:", "third", "collection", "at:"]
  55703. }),
  55704. $globals.SequenceableCollectionTest);
  55705. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55706. $core.addMethod(
  55707. $core.method({
  55708. selector: "collection",
  55709. protocol: "fixture",
  55710. fn: function (){
  55711. var self=this,$self=this;
  55712. return [(1), (2), (3), (-4)];
  55713. },
  55714. args: [],
  55715. source: "collection\x0a\x09^ #(1 2 3 -4)",
  55716. referencedClasses: [],
  55717. messageSends: []
  55718. }),
  55719. $globals.ArrayTest);
  55720. $core.addMethod(
  55721. $core.method({
  55722. selector: "collectionFirst",
  55723. protocol: "fixture",
  55724. fn: function (){
  55725. var self=this,$self=this;
  55726. return (1);
  55727. },
  55728. args: [],
  55729. source: "collectionFirst\x0a\x09^ 1",
  55730. referencedClasses: [],
  55731. messageSends: []
  55732. }),
  55733. $globals.ArrayTest);
  55734. $core.addMethod(
  55735. $core.method({
  55736. selector: "collectionFirstTwo",
  55737. protocol: "fixture",
  55738. fn: function (){
  55739. var self=this,$self=this;
  55740. return [(1), (2)];
  55741. },
  55742. args: [],
  55743. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  55744. referencedClasses: [],
  55745. messageSends: []
  55746. }),
  55747. $globals.ArrayTest);
  55748. $core.addMethod(
  55749. $core.method({
  55750. selector: "collectionLast",
  55751. protocol: "fixture",
  55752. fn: function (){
  55753. var self=this,$self=this;
  55754. return (-4);
  55755. },
  55756. args: [],
  55757. source: "collectionLast\x0a\x09^ -4",
  55758. referencedClasses: [],
  55759. messageSends: []
  55760. }),
  55761. $globals.ArrayTest);
  55762. $core.addMethod(
  55763. $core.method({
  55764. selector: "collectionLastTwo",
  55765. protocol: "fixture",
  55766. fn: function (){
  55767. var self=this,$self=this;
  55768. return [(3), (-4)];
  55769. },
  55770. args: [],
  55771. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  55772. referencedClasses: [],
  55773. messageSends: []
  55774. }),
  55775. $globals.ArrayTest);
  55776. $core.addMethod(
  55777. $core.method({
  55778. selector: "collectionOfPrintStrings",
  55779. protocol: "fixture",
  55780. fn: function (){
  55781. var self=this,$self=this;
  55782. return ["1", "2", "3", "-4"];
  55783. },
  55784. args: [],
  55785. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  55786. referencedClasses: [],
  55787. messageSends: []
  55788. }),
  55789. $globals.ArrayTest);
  55790. $core.addMethod(
  55791. $core.method({
  55792. selector: "collectionSize",
  55793. protocol: "fixture",
  55794. fn: function (){
  55795. var self=this,$self=this;
  55796. return (4);
  55797. },
  55798. args: [],
  55799. source: "collectionSize\x0a\x09^ 4",
  55800. referencedClasses: [],
  55801. messageSends: []
  55802. }),
  55803. $globals.ArrayTest);
  55804. $core.addMethod(
  55805. $core.method({
  55806. selector: "collectionWithDuplicates",
  55807. protocol: "fixture",
  55808. fn: function (){
  55809. var self=this,$self=this;
  55810. return ["a", "b", "c", (1), (2), (1), "a", []];
  55811. },
  55812. args: [],
  55813. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  55814. referencedClasses: [],
  55815. messageSends: []
  55816. }),
  55817. $globals.ArrayTest);
  55818. $core.addMethod(
  55819. $core.method({
  55820. selector: "collectionWithNewValue",
  55821. protocol: "fixture",
  55822. fn: function (){
  55823. var self=this,$self=this;
  55824. return [(1), (2), (3), (-4), "N"];
  55825. },
  55826. args: [],
  55827. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  55828. referencedClasses: [],
  55829. messageSends: []
  55830. }),
  55831. $globals.ArrayTest);
  55832. $core.addMethod(
  55833. $core.method({
  55834. selector: "sampleNewIndex",
  55835. protocol: "fixture",
  55836. fn: function (){
  55837. var self=this,$self=this;
  55838. return (5);
  55839. },
  55840. args: [],
  55841. source: "sampleNewIndex\x0a\x09^ 5",
  55842. referencedClasses: [],
  55843. messageSends: []
  55844. }),
  55845. $globals.ArrayTest);
  55846. $core.addMethod(
  55847. $core.method({
  55848. selector: "samplesDo:",
  55849. protocol: "fixture",
  55850. fn: function (aBlock){
  55851. var self=this,$self=this;
  55852. return $core.withContext(function($ctx1) {
  55853. (
  55854. $ctx1.supercall = true,
  55855. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55856. $ctx1.supercall = false;
  55857. $recv(aBlock)._value_value_((3),(3));
  55858. return self;
  55859. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  55860. },
  55861. args: ["aBlock"],
  55862. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  55863. referencedClasses: [],
  55864. messageSends: ["samplesDo:", "value:value:"]
  55865. }),
  55866. $globals.ArrayTest);
  55867. $core.addMethod(
  55868. $core.method({
  55869. selector: "testAdd",
  55870. protocol: "tests",
  55871. fn: function (){
  55872. var self=this,$self=this;
  55873. var array;
  55874. return $core.withContext(function($ctx1) {
  55875. array=$self._collection();
  55876. $recv(array)._add_((6));
  55877. $self._assert_equals_($recv(array)._last(),(6));
  55878. return self;
  55879. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  55880. },
  55881. args: [],
  55882. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  55883. referencedClasses: [],
  55884. messageSends: ["collection", "add:", "assert:equals:", "last"]
  55885. }),
  55886. $globals.ArrayTest);
  55887. $core.addMethod(
  55888. $core.method({
  55889. selector: "testAddFirst",
  55890. protocol: "tests",
  55891. fn: function (){
  55892. var self=this,$self=this;
  55893. return $core.withContext(function($ctx1) {
  55894. var $3,$2,$1;
  55895. $3=$self._collection();
  55896. $recv($3)._addFirst_((0));
  55897. $2=$recv($3)._yourself();
  55898. $1=$recv($2)._first();
  55899. $self._assert_equals_($1,(0));
  55900. return self;
  55901. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  55902. },
  55903. args: [],
  55904. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  55905. referencedClasses: [],
  55906. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  55907. }),
  55908. $globals.ArrayTest);
  55909. $core.addMethod(
  55910. $core.method({
  55911. selector: "testPrintString",
  55912. protocol: "tests",
  55913. fn: function (){
  55914. var self=this,$self=this;
  55915. var array;
  55916. return $core.withContext(function($ctx1) {
  55917. var $1,$2,$3,$4,$5,$6,$7,$8;
  55918. array=$recv($globals.Array)._new();
  55919. $1=$recv(array)._printString();
  55920. $ctx1.sendIdx["printString"]=1;
  55921. $self._assert_equals_($1,"an Array ()");
  55922. $ctx1.sendIdx["assert:equals:"]=1;
  55923. $2=array;
  55924. $recv($2)._add_((1));
  55925. $ctx1.sendIdx["add:"]=1;
  55926. $3=$recv($2)._add_((3));
  55927. $ctx1.sendIdx["add:"]=2;
  55928. $4=$recv(array)._printString();
  55929. $ctx1.sendIdx["printString"]=2;
  55930. $self._assert_equals_($4,"an Array (1 3)");
  55931. $ctx1.sendIdx["assert:equals:"]=2;
  55932. $recv(array)._add_("foo");
  55933. $5=$recv(array)._printString();
  55934. $ctx1.sendIdx["printString"]=3;
  55935. $self._assert_equals_($5,"an Array (1 3 'foo')");
  55936. $ctx1.sendIdx["assert:equals:"]=3;
  55937. $6=array;
  55938. $recv($6)._remove_((1));
  55939. $ctx1.sendIdx["remove:"]=1;
  55940. $recv($6)._remove_((3));
  55941. $7=$recv(array)._printString();
  55942. $ctx1.sendIdx["printString"]=4;
  55943. $self._assert_equals_($7,"an Array ('foo')");
  55944. $ctx1.sendIdx["assert:equals:"]=4;
  55945. $recv(array)._addLast_((3));
  55946. $ctx1.sendIdx["addLast:"]=1;
  55947. $8=$recv(array)._printString();
  55948. $ctx1.sendIdx["printString"]=5;
  55949. $self._assert_equals_($8,"an Array ('foo' 3)");
  55950. $ctx1.sendIdx["assert:equals:"]=5;
  55951. $recv(array)._addLast_((3));
  55952. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  55953. return self;
  55954. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  55955. },
  55956. args: [],
  55957. 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)'.",
  55958. referencedClasses: ["Array"],
  55959. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  55960. }),
  55961. $globals.ArrayTest);
  55962. $core.addMethod(
  55963. $core.method({
  55964. selector: "testRemove",
  55965. protocol: "tests",
  55966. fn: function (){
  55967. var self=this,$self=this;
  55968. var array;
  55969. return $core.withContext(function($ctx1) {
  55970. array=[(1), (2), (3), (4), (5)];
  55971. $recv(array)._remove_((3));
  55972. $ctx1.sendIdx["remove:"]=1;
  55973. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  55974. $self._should_raise_((function(){
  55975. return $core.withContext(function($ctx2) {
  55976. return $recv(array)._remove_((3));
  55977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55978. }),$globals.Error);
  55979. return self;
  55980. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  55981. },
  55982. args: [],
  55983. 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",
  55984. referencedClasses: ["Error"],
  55985. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  55986. }),
  55987. $globals.ArrayTest);
  55988. $core.addMethod(
  55989. $core.method({
  55990. selector: "testRemoveFromTo",
  55991. protocol: "tests",
  55992. fn: function (){
  55993. var self=this,$self=this;
  55994. return $core.withContext(function($ctx1) {
  55995. var $1,$2;
  55996. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  55997. $ctx1.sendIdx["removeFrom:to:"]=1;
  55998. $self._assert_equals_($1,[(4)]);
  55999. $ctx1.sendIdx["assert:equals:"]=1;
  56000. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  56001. $ctx1.sendIdx["removeFrom:to:"]=2;
  56002. $self._assert_equals_($2,[(1), (4)]);
  56003. $ctx1.sendIdx["assert:equals:"]=2;
  56004. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  56005. return self;
  56006. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  56007. },
  56008. args: [],
  56009. 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)",
  56010. referencedClasses: [],
  56011. messageSends: ["assert:equals:", "removeFrom:to:"]
  56012. }),
  56013. $globals.ArrayTest);
  56014. $core.addMethod(
  56015. $core.method({
  56016. selector: "testRemoveIndex",
  56017. protocol: "tests",
  56018. fn: function (){
  56019. var self=this,$self=this;
  56020. return $core.withContext(function($ctx1) {
  56021. var $1,$2;
  56022. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  56023. $ctx1.sendIdx["removeIndex:"]=1;
  56024. $self._assert_equals_($1,[(1), (3), (4)]);
  56025. $ctx1.sendIdx["assert:equals:"]=1;
  56026. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  56027. $ctx1.sendIdx["removeIndex:"]=2;
  56028. $self._assert_equals_($2,[(2), (3), (4)]);
  56029. $ctx1.sendIdx["assert:equals:"]=2;
  56030. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  56031. return self;
  56032. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  56033. },
  56034. args: [],
  56035. 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: #()",
  56036. referencedClasses: [],
  56037. messageSends: ["assert:equals:", "removeIndex:"]
  56038. }),
  56039. $globals.ArrayTest);
  56040. $core.addMethod(
  56041. $core.method({
  56042. selector: "testRemoveLast",
  56043. protocol: "tests",
  56044. fn: function (){
  56045. var self=this,$self=this;
  56046. var array;
  56047. return $core.withContext(function($ctx1) {
  56048. array=[(1), (2)];
  56049. $recv(array)._removeLast();
  56050. $self._assert_equals_($recv(array)._last(),(1));
  56051. return self;
  56052. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  56053. },
  56054. args: [],
  56055. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  56056. referencedClasses: [],
  56057. messageSends: ["removeLast", "assert:equals:", "last"]
  56058. }),
  56059. $globals.ArrayTest);
  56060. $core.addMethod(
  56061. $core.method({
  56062. selector: "testReversed",
  56063. protocol: "tests",
  56064. fn: function (){
  56065. var self=this,$self=this;
  56066. var array;
  56067. return $core.withContext(function($ctx1) {
  56068. array=[(5), (4), (3), (2), (1)];
  56069. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  56070. return self;
  56071. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  56072. },
  56073. args: [],
  56074. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  56075. referencedClasses: [],
  56076. messageSends: ["assert:equals:", "reversed"]
  56077. }),
  56078. $globals.ArrayTest);
  56079. $core.addMethod(
  56080. $core.method({
  56081. selector: "testSort",
  56082. protocol: "tests",
  56083. fn: function (){
  56084. var self=this,$self=this;
  56085. var array;
  56086. return $core.withContext(function($ctx1) {
  56087. array=[(10), (1), (5)];
  56088. $recv(array)._sort();
  56089. $self._assert_equals_(array,[(1), (5), (10)]);
  56090. return self;
  56091. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  56092. },
  56093. args: [],
  56094. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  56095. referencedClasses: [],
  56096. messageSends: ["sort", "assert:equals:"]
  56097. }),
  56098. $globals.ArrayTest);
  56099. $core.addMethod(
  56100. $core.method({
  56101. selector: "collectionClass",
  56102. protocol: "fixture",
  56103. fn: function (){
  56104. var self=this,$self=this;
  56105. return $globals.Array;
  56106. },
  56107. args: [],
  56108. source: "collectionClass\x0a\x09^ Array",
  56109. referencedClasses: ["Array"],
  56110. messageSends: []
  56111. }),
  56112. $globals.ArrayTest.a$cls);
  56113. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  56114. $core.addMethod(
  56115. $core.method({
  56116. selector: "collection",
  56117. protocol: "fixture",
  56118. fn: function (){
  56119. var self=this,$self=this;
  56120. return "helLo";
  56121. },
  56122. args: [],
  56123. source: "collection\x0a\x09^ 'helLo'",
  56124. referencedClasses: [],
  56125. messageSends: []
  56126. }),
  56127. $globals.StringTest);
  56128. $core.addMethod(
  56129. $core.method({
  56130. selector: "collectionFirst",
  56131. protocol: "fixture",
  56132. fn: function (){
  56133. var self=this,$self=this;
  56134. return "h";
  56135. },
  56136. args: [],
  56137. source: "collectionFirst\x0a\x09^ 'h'",
  56138. referencedClasses: [],
  56139. messageSends: []
  56140. }),
  56141. $globals.StringTest);
  56142. $core.addMethod(
  56143. $core.method({
  56144. selector: "collectionFirstTwo",
  56145. protocol: "fixture",
  56146. fn: function (){
  56147. var self=this,$self=this;
  56148. return "he";
  56149. },
  56150. args: [],
  56151. source: "collectionFirstTwo\x0a\x09^ 'he'",
  56152. referencedClasses: [],
  56153. messageSends: []
  56154. }),
  56155. $globals.StringTest);
  56156. $core.addMethod(
  56157. $core.method({
  56158. selector: "collectionLast",
  56159. protocol: "fixture",
  56160. fn: function (){
  56161. var self=this,$self=this;
  56162. return "o";
  56163. },
  56164. args: [],
  56165. source: "collectionLast\x0a\x09^ 'o'",
  56166. referencedClasses: [],
  56167. messageSends: []
  56168. }),
  56169. $globals.StringTest);
  56170. $core.addMethod(
  56171. $core.method({
  56172. selector: "collectionLastTwo",
  56173. protocol: "fixture",
  56174. fn: function (){
  56175. var self=this,$self=this;
  56176. return "Lo";
  56177. },
  56178. args: [],
  56179. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  56180. referencedClasses: [],
  56181. messageSends: []
  56182. }),
  56183. $globals.StringTest);
  56184. $core.addMethod(
  56185. $core.method({
  56186. selector: "collectionOfPrintStrings",
  56187. protocol: "fixture",
  56188. fn: function (){
  56189. var self=this,$self=this;
  56190. return "'h''e''l''L''o'";
  56191. },
  56192. args: [],
  56193. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  56194. referencedClasses: [],
  56195. messageSends: []
  56196. }),
  56197. $globals.StringTest);
  56198. $core.addMethod(
  56199. $core.method({
  56200. selector: "collectionSize",
  56201. protocol: "fixture",
  56202. fn: function (){
  56203. var self=this,$self=this;
  56204. return (5);
  56205. },
  56206. args: [],
  56207. source: "collectionSize\x0a\x09^ 5",
  56208. referencedClasses: [],
  56209. messageSends: []
  56210. }),
  56211. $globals.StringTest);
  56212. $core.addMethod(
  56213. $core.method({
  56214. selector: "collectionWithDuplicates",
  56215. protocol: "fixture",
  56216. fn: function (){
  56217. var self=this,$self=this;
  56218. return "abbaerten";
  56219. },
  56220. args: [],
  56221. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  56222. referencedClasses: [],
  56223. messageSends: []
  56224. }),
  56225. $globals.StringTest);
  56226. $core.addMethod(
  56227. $core.method({
  56228. selector: "collectionWithNewValue",
  56229. protocol: "fixture",
  56230. fn: function (){
  56231. var self=this,$self=this;
  56232. return "helLoN";
  56233. },
  56234. args: [],
  56235. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  56236. referencedClasses: [],
  56237. messageSends: []
  56238. }),
  56239. $globals.StringTest);
  56240. $core.addMethod(
  56241. $core.method({
  56242. selector: "sampleNewValueAsCollection",
  56243. protocol: "fixture",
  56244. fn: function (){
  56245. var self=this,$self=this;
  56246. return "N";
  56247. },
  56248. args: [],
  56249. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  56250. referencedClasses: [],
  56251. messageSends: []
  56252. }),
  56253. $globals.StringTest);
  56254. $core.addMethod(
  56255. $core.method({
  56256. selector: "samplesDo:",
  56257. protocol: "fixture",
  56258. fn: function (aBlock){
  56259. var self=this,$self=this;
  56260. return $core.withContext(function($ctx1) {
  56261. (
  56262. $ctx1.supercall = true,
  56263. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  56264. $ctx1.supercall = false;
  56265. $recv(aBlock)._value_value_((3),"l");
  56266. return self;
  56267. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  56268. },
  56269. args: ["aBlock"],
  56270. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  56271. referencedClasses: [],
  56272. messageSends: ["samplesDo:", "value:value:"]
  56273. }),
  56274. $globals.StringTest);
  56275. $core.addMethod(
  56276. $core.method({
  56277. selector: "testAddAll",
  56278. protocol: "tests",
  56279. fn: function (){
  56280. var self=this,$self=this;
  56281. return $core.withContext(function($ctx1) {
  56282. var $1;
  56283. $self._should_raise_((function(){
  56284. return $core.withContext(function($ctx2) {
  56285. $1=$self._collection();
  56286. $ctx2.sendIdx["collection"]=1;
  56287. return $recv($1)._addAll_($self._collection());
  56288. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56289. }),$globals.Error);
  56290. return self;
  56291. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  56292. },
  56293. args: [],
  56294. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  56295. referencedClasses: ["Error"],
  56296. messageSends: ["should:raise:", "addAll:", "collection"]
  56297. }),
  56298. $globals.StringTest);
  56299. $core.addMethod(
  56300. $core.method({
  56301. selector: "testAddRemove",
  56302. protocol: "tests",
  56303. fn: function (){
  56304. var self=this,$self=this;
  56305. return $core.withContext(function($ctx1) {
  56306. $self._should_raise_((function(){
  56307. return $core.withContext(function($ctx2) {
  56308. return "hello"._add_("a");
  56309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56310. }),$globals.Error);
  56311. $ctx1.sendIdx["should:raise:"]=1;
  56312. $self._should_raise_((function(){
  56313. return $core.withContext(function($ctx2) {
  56314. return "hello"._remove_("h");
  56315. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56316. }),$globals.Error);
  56317. return self;
  56318. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  56319. },
  56320. args: [],
  56321. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  56322. referencedClasses: ["Error"],
  56323. messageSends: ["should:raise:", "add:", "remove:"]
  56324. }),
  56325. $globals.StringTest);
  56326. $core.addMethod(
  56327. $core.method({
  56328. selector: "testAsArray",
  56329. protocol: "tests",
  56330. fn: function (){
  56331. var self=this,$self=this;
  56332. return $core.withContext(function($ctx1) {
  56333. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  56334. return self;
  56335. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  56336. },
  56337. args: [],
  56338. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  56339. referencedClasses: [],
  56340. messageSends: ["assert:equals:", "asArray"]
  56341. }),
  56342. $globals.StringTest);
  56343. $core.addMethod(
  56344. $core.method({
  56345. selector: "testAsLowerCase",
  56346. protocol: "tests",
  56347. fn: function (){
  56348. var self=this,$self=this;
  56349. return $core.withContext(function($ctx1) {
  56350. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  56351. return self;
  56352. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  56353. },
  56354. args: [],
  56355. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  56356. referencedClasses: [],
  56357. messageSends: ["assert:equals:", "asLowercase"]
  56358. }),
  56359. $globals.StringTest);
  56360. $core.addMethod(
  56361. $core.method({
  56362. selector: "testAsNumber",
  56363. protocol: "tests",
  56364. fn: function (){
  56365. var self=this,$self=this;
  56366. return $core.withContext(function($ctx1) {
  56367. var $1,$2;
  56368. $1="3"._asNumber();
  56369. $ctx1.sendIdx["asNumber"]=1;
  56370. $self._assert_equals_($1,(3));
  56371. $ctx1.sendIdx["assert:equals:"]=1;
  56372. $2="-3"._asNumber();
  56373. $ctx1.sendIdx["asNumber"]=2;
  56374. $self._assert_equals_($2,(-3));
  56375. $ctx1.sendIdx["assert:equals:"]=2;
  56376. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  56377. return self;
  56378. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  56379. },
  56380. args: [],
  56381. 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.",
  56382. referencedClasses: [],
  56383. messageSends: ["assert:equals:", "asNumber"]
  56384. }),
  56385. $globals.StringTest);
  56386. $core.addMethod(
  56387. $core.method({
  56388. selector: "testAsUpperCase",
  56389. protocol: "tests",
  56390. fn: function (){
  56391. var self=this,$self=this;
  56392. return $core.withContext(function($ctx1) {
  56393. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  56394. return self;
  56395. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  56396. },
  56397. args: [],
  56398. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  56399. referencedClasses: [],
  56400. messageSends: ["assert:equals:", "asUppercase"]
  56401. }),
  56402. $globals.StringTest);
  56403. $core.addMethod(
  56404. $core.method({
  56405. selector: "testAsciiValue",
  56406. protocol: "tests",
  56407. fn: function (){
  56408. var self=this,$self=this;
  56409. var characterA,characterU;
  56410. return $core.withContext(function($ctx1) {
  56411. var $1;
  56412. characterA="A";
  56413. characterU="U";
  56414. $1=$recv(characterA)._asciiValue();
  56415. $ctx1.sendIdx["asciiValue"]=1;
  56416. $self._assert_equals_($1,(65));
  56417. $ctx1.sendIdx["assert:equals:"]=1;
  56418. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  56419. return self;
  56420. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  56421. },
  56422. args: [],
  56423. 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",
  56424. referencedClasses: [],
  56425. messageSends: ["assert:equals:", "asciiValue"]
  56426. }),
  56427. $globals.StringTest);
  56428. $core.addMethod(
  56429. $core.method({
  56430. selector: "testAtIfAbsentPut",
  56431. protocol: "tests",
  56432. fn: function (){
  56433. var self=this,$self=this;
  56434. return $core.withContext(function($ctx1) {
  56435. $self._should_raise_((function(){
  56436. return $core.withContext(function($ctx2) {
  56437. return "hello"._at_ifAbsentPut_((6),(function(){
  56438. return "a";
  56439. }));
  56440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56441. }),$globals.Error);
  56442. return self;
  56443. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  56444. },
  56445. args: [],
  56446. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  56447. referencedClasses: ["Error"],
  56448. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  56449. }),
  56450. $globals.StringTest);
  56451. $core.addMethod(
  56452. $core.method({
  56453. selector: "testAtPut",
  56454. protocol: "tests",
  56455. fn: function (){
  56456. var self=this,$self=this;
  56457. return $core.withContext(function($ctx1) {
  56458. $self._should_raise_((function(){
  56459. return $core.withContext(function($ctx2) {
  56460. return "hello"._at_put_((1),"a");
  56461. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56462. }),$globals.Error);
  56463. return self;
  56464. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  56465. },
  56466. args: [],
  56467. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  56468. referencedClasses: ["Error"],
  56469. messageSends: ["should:raise:", "at:put:"]
  56470. }),
  56471. $globals.StringTest);
  56472. $core.addMethod(
  56473. $core.method({
  56474. selector: "testCapitalized",
  56475. protocol: "tests",
  56476. fn: function (){
  56477. var self=this,$self=this;
  56478. return $core.withContext(function($ctx1) {
  56479. var $1,$2,$3;
  56480. $1="test"._capitalized();
  56481. $ctx1.sendIdx["capitalized"]=1;
  56482. $self._assert_equals_($1,"Test");
  56483. $ctx1.sendIdx["assert:equals:"]=1;
  56484. $2="Test"._capitalized();
  56485. $ctx1.sendIdx["capitalized"]=2;
  56486. $self._assert_equals_($2,"Test");
  56487. $ctx1.sendIdx["assert:equals:"]=2;
  56488. $self._assert_equals_(""._capitalized(),"");
  56489. $ctx1.sendIdx["assert:equals:"]=3;
  56490. $3="Test"._isCapitalized();
  56491. $ctx1.sendIdx["isCapitalized"]=1;
  56492. $self._assert_equals_($3,true);
  56493. $ctx1.sendIdx["assert:equals:"]=4;
  56494. $self._assert_equals_("test"._isCapitalized(),false);
  56495. return self;
  56496. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  56497. },
  56498. args: [],
  56499. 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.",
  56500. referencedClasses: [],
  56501. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  56502. }),
  56503. $globals.StringTest);
  56504. $core.addMethod(
  56505. $core.method({
  56506. selector: "testCharCodeAt",
  56507. protocol: "tests",
  56508. fn: function (){
  56509. var self=this,$self=this;
  56510. return $core.withContext(function($ctx1) {
  56511. var $1,$2,$3,$4,$5;
  56512. $1="jackie"._charCodeAt_((1));
  56513. $ctx1.sendIdx["charCodeAt:"]=1;
  56514. $self._assert_equals_($1,(106));
  56515. $ctx1.sendIdx["assert:equals:"]=1;
  56516. $2="jackie"._charCodeAt_((2));
  56517. $ctx1.sendIdx["charCodeAt:"]=2;
  56518. $self._assert_equals_($2,(97));
  56519. $ctx1.sendIdx["assert:equals:"]=2;
  56520. $3="jackie"._charCodeAt_((3));
  56521. $ctx1.sendIdx["charCodeAt:"]=3;
  56522. $self._assert_equals_($3,(99));
  56523. $ctx1.sendIdx["assert:equals:"]=3;
  56524. $4="jackie"._charCodeAt_((4));
  56525. $ctx1.sendIdx["charCodeAt:"]=4;
  56526. $self._assert_equals_($4,(107));
  56527. $ctx1.sendIdx["assert:equals:"]=4;
  56528. $5="jackie"._charCodeAt_((5));
  56529. $ctx1.sendIdx["charCodeAt:"]=5;
  56530. $self._assert_equals_($5,(105));
  56531. $ctx1.sendIdx["assert:equals:"]=5;
  56532. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  56533. return self;
  56534. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  56535. },
  56536. args: [],
  56537. 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",
  56538. referencedClasses: [],
  56539. messageSends: ["assert:equals:", "charCodeAt:"]
  56540. }),
  56541. $globals.StringTest);
  56542. $core.addMethod(
  56543. $core.method({
  56544. selector: "testCopyFromTo",
  56545. protocol: "tests",
  56546. fn: function (){
  56547. var self=this,$self=this;
  56548. return $core.withContext(function($ctx1) {
  56549. var $1;
  56550. $1="jackie"._copyFrom_to_((1),(3));
  56551. $ctx1.sendIdx["copyFrom:to:"]=1;
  56552. $self._assert_equals_($1,"jac");
  56553. $ctx1.sendIdx["assert:equals:"]=1;
  56554. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  56555. return self;
  56556. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  56557. },
  56558. args: [],
  56559. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  56560. referencedClasses: [],
  56561. messageSends: ["assert:equals:", "copyFrom:to:"]
  56562. }),
  56563. $globals.StringTest);
  56564. $core.addMethod(
  56565. $core.method({
  56566. selector: "testCopySeparates",
  56567. protocol: "tests",
  56568. fn: function (){
  56569. var self=this,$self=this;
  56570. return $core.withContext(function($ctx1) {
  56571. var $3,$2,$1;
  56572. $3=$self._collection();
  56573. $ctx1.sendIdx["collection"]=1;
  56574. $2=$recv($3)._copy();
  56575. $1=$recv($2).__eq_eq($self._collection());
  56576. $self._assert_($1);
  56577. return self;
  56578. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  56579. },
  56580. args: [],
  56581. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  56582. referencedClasses: [],
  56583. messageSends: ["assert:", "==", "copy", "collection"]
  56584. }),
  56585. $globals.StringTest);
  56586. $core.addMethod(
  56587. $core.method({
  56588. selector: "testCopyWithoutAll",
  56589. protocol: "tests",
  56590. fn: function (){
  56591. var self=this,$self=this;
  56592. return $core.withContext(function($ctx1) {
  56593. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  56594. return self;
  56595. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  56596. },
  56597. args: [],
  56598. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  56599. referencedClasses: [],
  56600. messageSends: ["assert:equals:", "copyWithoutAll:"]
  56601. }),
  56602. $globals.StringTest);
  56603. $core.addMethod(
  56604. $core.method({
  56605. selector: "testEquality",
  56606. protocol: "tests",
  56607. fn: function (){
  56608. var self=this,$self=this;
  56609. return $core.withContext(function($ctx1) {
  56610. var $1,$2,$3;
  56611. $self._assert_equals_("hello","hello");
  56612. $ctx1.sendIdx["assert:equals:"]=1;
  56613. $1="hello".__eq("world");
  56614. $ctx1.sendIdx["="]=1;
  56615. $self._deny_($1);
  56616. $ctx1.sendIdx["deny:"]=1;
  56617. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  56618. })));
  56619. $ctx1.sendIdx["="]=2;
  56620. $self._deny_($2);
  56621. $ctx1.sendIdx["deny:"]=2;
  56622. $3="hello"._yourself();
  56623. $ctx1.sendIdx["yourself"]=1;
  56624. $self._assert_equals_("hello",$3);
  56625. $ctx1.sendIdx["assert:equals:"]=2;
  56626. $self._assert_equals_("hello"._yourself(),"hello");
  56627. $self._deny_("".__eq((0)));
  56628. return self;
  56629. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  56630. },
  56631. args: [],
  56632. 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",
  56633. referencedClasses: [],
  56634. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  56635. }),
  56636. $globals.StringTest);
  56637. $core.addMethod(
  56638. $core.method({
  56639. selector: "testIdentity",
  56640. protocol: "tests",
  56641. fn: function (){
  56642. var self=this,$self=this;
  56643. return $core.withContext(function($ctx1) {
  56644. var $1,$2,$4,$3,$5;
  56645. $1="hello".__eq_eq("hello");
  56646. $ctx1.sendIdx["=="]=1;
  56647. $self._assert_($1);
  56648. $ctx1.sendIdx["assert:"]=1;
  56649. $2="hello".__eq_eq("world");
  56650. $ctx1.sendIdx["=="]=2;
  56651. $self._deny_($2);
  56652. $ctx1.sendIdx["deny:"]=1;
  56653. $4="hello"._yourself();
  56654. $ctx1.sendIdx["yourself"]=1;
  56655. $3="hello".__eq_eq($4);
  56656. $ctx1.sendIdx["=="]=3;
  56657. $self._assert_($3);
  56658. $ctx1.sendIdx["assert:"]=2;
  56659. $5=$recv("hello"._yourself()).__eq_eq("hello");
  56660. $ctx1.sendIdx["=="]=4;
  56661. $self._assert_($5);
  56662. $self._deny_("".__eq_eq((0)));
  56663. return self;
  56664. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  56665. },
  56666. args: [],
  56667. 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",
  56668. referencedClasses: [],
  56669. messageSends: ["assert:", "==", "deny:", "yourself"]
  56670. }),
  56671. $globals.StringTest);
  56672. $core.addMethod(
  56673. $core.method({
  56674. selector: "testIncludesSubString",
  56675. protocol: "tests",
  56676. fn: function (){
  56677. var self=this,$self=this;
  56678. return $core.withContext(function($ctx1) {
  56679. var $1;
  56680. $1="amber"._includesSubString_("ber");
  56681. $ctx1.sendIdx["includesSubString:"]=1;
  56682. $self._assert_($1);
  56683. $self._deny_("amber"._includesSubString_("zork"));
  56684. return self;
  56685. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  56686. },
  56687. args: [],
  56688. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  56689. referencedClasses: [],
  56690. messageSends: ["assert:", "includesSubString:", "deny:"]
  56691. }),
  56692. $globals.StringTest);
  56693. $core.addMethod(
  56694. $core.method({
  56695. selector: "testIndexOfStartingAtWithNull",
  56696. protocol: "tests",
  56697. fn: function (){
  56698. var self=this,$self=this;
  56699. return self;
  56700. },
  56701. args: [],
  56702. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56703. referencedClasses: [],
  56704. messageSends: []
  56705. }),
  56706. $globals.StringTest);
  56707. $core.addMethod(
  56708. $core.method({
  56709. selector: "testIndexOfWithNull",
  56710. protocol: "tests",
  56711. fn: function (){
  56712. var self=this,$self=this;
  56713. return self;
  56714. },
  56715. args: [],
  56716. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56717. referencedClasses: [],
  56718. messageSends: []
  56719. }),
  56720. $globals.StringTest);
  56721. $core.addMethod(
  56722. $core.method({
  56723. selector: "testIsVowel",
  56724. protocol: "tests",
  56725. fn: function (){
  56726. var self=this,$self=this;
  56727. var vowel,consonant;
  56728. return $core.withContext(function($ctx1) {
  56729. var $1;
  56730. vowel="u";
  56731. consonant="z";
  56732. $1=$recv(vowel)._isVowel();
  56733. $ctx1.sendIdx["isVowel"]=1;
  56734. $self._assert_equals_($1,true);
  56735. $ctx1.sendIdx["assert:equals:"]=1;
  56736. $self._assert_equals_($recv(consonant)._isVowel(),false);
  56737. return self;
  56738. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  56739. },
  56740. args: [],
  56741. 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",
  56742. referencedClasses: [],
  56743. messageSends: ["assert:equals:", "isVowel"]
  56744. }),
  56745. $globals.StringTest);
  56746. $core.addMethod(
  56747. $core.method({
  56748. selector: "testJoin",
  56749. protocol: "tests",
  56750. fn: function (){
  56751. var self=this,$self=this;
  56752. return $core.withContext(function($ctx1) {
  56753. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  56754. return self;
  56755. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  56756. },
  56757. args: [],
  56758. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  56759. referencedClasses: [],
  56760. messageSends: ["assert:equals:", "join:"]
  56761. }),
  56762. $globals.StringTest);
  56763. $core.addMethod(
  56764. $core.method({
  56765. selector: "testRegression1224",
  56766. protocol: "tests",
  56767. fn: function (){
  56768. var self=this,$self=this;
  56769. return $core.withContext(function($ctx1) {
  56770. var $2,$1;
  56771. $self._should_raise_((function(){
  56772. return $core.withContext(function($ctx2) {
  56773. $2=$recv($self._collectionClass())._new();
  56774. $recv($2)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  56775. }));
  56776. $1=$recv($2)._yourself();
  56777. return $recv($1)._size();
  56778. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56779. }),$globals.Error);
  56780. return self;
  56781. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.StringTest)});
  56782. },
  56783. args: [],
  56784. 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",
  56785. referencedClasses: ["Error"],
  56786. messageSends: ["should:raise:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  56787. }),
  56788. $globals.StringTest);
  56789. $core.addMethod(
  56790. $core.method({
  56791. selector: "testRemoveAll",
  56792. protocol: "tests",
  56793. fn: function (){
  56794. var self=this,$self=this;
  56795. return $core.withContext(function($ctx1) {
  56796. $self._should_raise_((function(){
  56797. return $core.withContext(function($ctx2) {
  56798. return $recv($self._collection())._removeAll();
  56799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56800. }),$globals.Error);
  56801. return self;
  56802. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  56803. },
  56804. args: [],
  56805. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  56806. referencedClasses: ["Error"],
  56807. messageSends: ["should:raise:", "removeAll", "collection"]
  56808. }),
  56809. $globals.StringTest);
  56810. $core.addMethod(
  56811. $core.method({
  56812. selector: "testReversed",
  56813. protocol: "tests",
  56814. fn: function (){
  56815. var self=this,$self=this;
  56816. return $core.withContext(function($ctx1) {
  56817. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  56818. return self;
  56819. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  56820. },
  56821. args: [],
  56822. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  56823. referencedClasses: [],
  56824. messageSends: ["assert:equals:", "reversed"]
  56825. }),
  56826. $globals.StringTest);
  56827. $core.addMethod(
  56828. $core.method({
  56829. selector: "testStreamContents",
  56830. protocol: "tests",
  56831. fn: function (){
  56832. var self=this,$self=this;
  56833. return $core.withContext(function($ctx1) {
  56834. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  56835. return $core.withContext(function($ctx2) {
  56836. $recv(aStream)._nextPutAll_("hello");
  56837. $ctx2.sendIdx["nextPutAll:"]=1;
  56838. $recv(aStream)._space();
  56839. return $recv(aStream)._nextPutAll_("world");
  56840. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  56841. })),"hello world");
  56842. return self;
  56843. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  56844. },
  56845. args: [],
  56846. 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'",
  56847. referencedClasses: ["String"],
  56848. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  56849. }),
  56850. $globals.StringTest);
  56851. $core.addMethod(
  56852. $core.method({
  56853. selector: "testSubStrings",
  56854. protocol: "tests",
  56855. fn: function (){
  56856. var self=this,$self=this;
  56857. return $core.withContext(function($ctx1) {
  56858. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  56859. return self;
  56860. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  56861. },
  56862. args: [],
  56863. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  56864. referencedClasses: [],
  56865. messageSends: ["assert:equals:", "subStrings:"]
  56866. }),
  56867. $globals.StringTest);
  56868. $core.addMethod(
  56869. $core.method({
  56870. selector: "testTrim",
  56871. protocol: "tests",
  56872. fn: function (){
  56873. var self=this,$self=this;
  56874. return $core.withContext(function($ctx1) {
  56875. $self._assert_equals_(" jackie"._trimLeft(),"jackie");
  56876. $ctx1.sendIdx["assert:equals:"]=1;
  56877. $self._assert_equals_("jackie "._trimRight(),"jackie");
  56878. return self;
  56879. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  56880. },
  56881. args: [],
  56882. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  56883. referencedClasses: [],
  56884. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  56885. }),
  56886. $globals.StringTest);
  56887. $core.addMethod(
  56888. $core.method({
  56889. selector: "testValue",
  56890. protocol: "tests",
  56891. fn: function (){
  56892. var self=this,$self=this;
  56893. return $core.withContext(function($ctx1) {
  56894. $self._assert_equals_("asString"._value_((1)),"1");
  56895. $ctx1.sendIdx["assert:equals:"]=1;
  56896. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  56897. return self;
  56898. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  56899. },
  56900. args: [],
  56901. 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')",
  56902. referencedClasses: [],
  56903. messageSends: ["assert:equals:", "value:", "collect:"]
  56904. }),
  56905. $globals.StringTest);
  56906. $core.addMethod(
  56907. $core.method({
  56908. selector: "collectionClass",
  56909. protocol: "fixture",
  56910. fn: function (){
  56911. var self=this,$self=this;
  56912. return $globals.String;
  56913. },
  56914. args: [],
  56915. source: "collectionClass\x0a\x09^ String",
  56916. referencedClasses: ["String"],
  56917. messageSends: []
  56918. }),
  56919. $globals.StringTest.a$cls);
  56920. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  56921. $core.addMethod(
  56922. $core.method({
  56923. selector: "collection",
  56924. protocol: "fixture",
  56925. fn: function (){
  56926. var self=this,$self=this;
  56927. return $core.withContext(function($ctx1) {
  56928. var $1;
  56929. $1=$recv($globals.Set)._new();
  56930. $recv($1)._add_($globals.Smalltalk);
  56931. $ctx1.sendIdx["add:"]=1;
  56932. $recv($1)._add_(nil);
  56933. $ctx1.sendIdx["add:"]=2;
  56934. $recv($1)._add_((3).__at((3)));
  56935. $ctx1.sendIdx["add:"]=3;
  56936. $recv($1)._add_(false);
  56937. $ctx1.sendIdx["add:"]=4;
  56938. $recv($1)._add_($self.sampleBlock);
  56939. return $recv($1)._yourself();
  56940. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  56941. },
  56942. args: [],
  56943. 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",
  56944. referencedClasses: ["Set", "Smalltalk"],
  56945. messageSends: ["add:", "new", "@", "yourself"]
  56946. }),
  56947. $globals.SetTest);
  56948. $core.addMethod(
  56949. $core.method({
  56950. selector: "collectionOfPrintStrings",
  56951. protocol: "fixture",
  56952. fn: function (){
  56953. var self=this,$self=this;
  56954. return $core.withContext(function($ctx1) {
  56955. var $1;
  56956. $1=$recv($globals.Set)._new();
  56957. $recv($1)._add_("a SmalltalkImage");
  56958. $ctx1.sendIdx["add:"]=1;
  56959. $recv($1)._add_("nil");
  56960. $ctx1.sendIdx["add:"]=2;
  56961. $recv($1)._add_("3@3");
  56962. $ctx1.sendIdx["add:"]=3;
  56963. $recv($1)._add_("false");
  56964. $ctx1.sendIdx["add:"]=4;
  56965. $recv($1)._add_("a BlockClosure");
  56966. return $recv($1)._yourself();
  56967. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  56968. },
  56969. args: [],
  56970. 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",
  56971. referencedClasses: ["Set"],
  56972. messageSends: ["add:", "new", "yourself"]
  56973. }),
  56974. $globals.SetTest);
  56975. $core.addMethod(
  56976. $core.method({
  56977. selector: "collectionSize",
  56978. protocol: "fixture",
  56979. fn: function (){
  56980. var self=this,$self=this;
  56981. return (5);
  56982. },
  56983. args: [],
  56984. source: "collectionSize\x0a\x09^ 5",
  56985. referencedClasses: [],
  56986. messageSends: []
  56987. }),
  56988. $globals.SetTest);
  56989. $core.addMethod(
  56990. $core.method({
  56991. selector: "collectionWithDuplicates",
  56992. protocol: "fixture",
  56993. fn: function (){
  56994. var self=this,$self=this;
  56995. return $core.withContext(function($ctx1) {
  56996. var $1;
  56997. $1=$self._collection();
  56998. $recv($1)._add_((0));
  56999. return $recv($1)._yourself();
  57000. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  57001. },
  57002. args: [],
  57003. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  57004. referencedClasses: [],
  57005. messageSends: ["add:", "collection", "yourself"]
  57006. }),
  57007. $globals.SetTest);
  57008. $core.addMethod(
  57009. $core.method({
  57010. selector: "collectionWithNewValue",
  57011. protocol: "fixture",
  57012. fn: function (){
  57013. var self=this,$self=this;
  57014. return $core.withContext(function($ctx1) {
  57015. var $1;
  57016. $1=$recv($globals.Set)._new();
  57017. $recv($1)._add_($globals.Smalltalk);
  57018. $ctx1.sendIdx["add:"]=1;
  57019. $recv($1)._add_(nil);
  57020. $ctx1.sendIdx["add:"]=2;
  57021. $recv($1)._add_((3).__at((3)));
  57022. $ctx1.sendIdx["add:"]=3;
  57023. $recv($1)._add_("N");
  57024. $ctx1.sendIdx["add:"]=4;
  57025. $recv($1)._add_(false);
  57026. $ctx1.sendIdx["add:"]=5;
  57027. $recv($1)._add_($self.sampleBlock);
  57028. return $recv($1)._yourself();
  57029. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  57030. },
  57031. args: [],
  57032. 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",
  57033. referencedClasses: ["Set", "Smalltalk"],
  57034. messageSends: ["add:", "new", "@", "yourself"]
  57035. }),
  57036. $globals.SetTest);
  57037. $core.addMethod(
  57038. $core.method({
  57039. selector: "testAddAll",
  57040. protocol: "tests",
  57041. fn: function (){
  57042. var self=this,$self=this;
  57043. return $core.withContext(function($ctx1) {
  57044. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  57045. (
  57046. $ctx1.supercall = true,
  57047. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  57048. $ctx1.supercall = false;
  57049. $2=$self._collection();
  57050. $ctx1.sendIdx["collection"]=1;
  57051. $3=$self._collection();
  57052. $ctx1.sendIdx["collection"]=2;
  57053. $recv($2)._addAll_($3);
  57054. $ctx1.sendIdx["addAll:"]=1;
  57055. $4=$recv($2)._yourself();
  57056. $ctx1.sendIdx["yourself"]=1;
  57057. $1=$4;
  57058. $5=$self._collection();
  57059. $ctx1.sendIdx["collection"]=3;
  57060. $self._assert_equals_($1,$5);
  57061. $ctx1.sendIdx["assert:equals:"]=1;
  57062. $7=$self._collection();
  57063. $ctx1.sendIdx["collection"]=4;
  57064. $8=$self._collectionWithNewValue();
  57065. $ctx1.sendIdx["collectionWithNewValue"]=1;
  57066. $recv($7)._addAll_($8);
  57067. $ctx1.sendIdx["addAll:"]=2;
  57068. $9=$recv($7)._yourself();
  57069. $ctx1.sendIdx["yourself"]=2;
  57070. $6=$9;
  57071. $10=$self._collectionWithNewValue();
  57072. $ctx1.sendIdx["collectionWithNewValue"]=2;
  57073. $self._assert_equals_($6,$10);
  57074. $ctx1.sendIdx["assert:equals:"]=2;
  57075. $12=$self._collectionWithNewValue();
  57076. $ctx1.sendIdx["collectionWithNewValue"]=3;
  57077. $recv($12)._addAll_($self._collection());
  57078. $11=$recv($12)._yourself();
  57079. $self._assert_equals_($11,$self._collectionWithNewValue());
  57080. return self;
  57081. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  57082. },
  57083. args: [],
  57084. 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",
  57085. referencedClasses: [],
  57086. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  57087. }),
  57088. $globals.SetTest);
  57089. $core.addMethod(
  57090. $core.method({
  57091. selector: "testAddRemove",
  57092. protocol: "tests",
  57093. fn: function (){
  57094. var self=this,$self=this;
  57095. var set;
  57096. return $core.withContext(function($ctx1) {
  57097. var $1,$2;
  57098. set=$recv($globals.Set)._new();
  57099. $self._assert_($recv(set)._isEmpty());
  57100. $ctx1.sendIdx["assert:"]=1;
  57101. $recv(set)._add_((3));
  57102. $ctx1.sendIdx["add:"]=1;
  57103. $1=$recv(set)._includes_((3));
  57104. $ctx1.sendIdx["includes:"]=1;
  57105. $self._assert_($1);
  57106. $ctx1.sendIdx["assert:"]=2;
  57107. $recv(set)._add_((5));
  57108. $2=$recv(set)._includes_((5));
  57109. $ctx1.sendIdx["includes:"]=2;
  57110. $self._assert_($2);
  57111. $recv(set)._remove_((3));
  57112. $self._deny_($recv(set)._includes_((3)));
  57113. return self;
  57114. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  57115. },
  57116. args: [],
  57117. 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)",
  57118. referencedClasses: ["Set"],
  57119. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  57120. }),
  57121. $globals.SetTest);
  57122. $core.addMethod(
  57123. $core.method({
  57124. selector: "testAt",
  57125. protocol: "tests",
  57126. fn: function (){
  57127. var self=this,$self=this;
  57128. return $core.withContext(function($ctx1) {
  57129. $self._should_raise_((function(){
  57130. return $core.withContext(function($ctx2) {
  57131. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  57132. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57133. }),$globals.Error);
  57134. return self;
  57135. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  57136. },
  57137. args: [],
  57138. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  57139. referencedClasses: ["Set", "Error"],
  57140. messageSends: ["should:raise:", "at:put:", "new"]
  57141. }),
  57142. $globals.SetTest);
  57143. $core.addMethod(
  57144. $core.method({
  57145. selector: "testCollect",
  57146. protocol: "tests",
  57147. fn: function (){
  57148. var self=this,$self=this;
  57149. return $core.withContext(function($ctx1) {
  57150. var $2,$1;
  57151. (
  57152. $ctx1.supercall = true,
  57153. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($self, []));
  57154. $ctx1.supercall = false;
  57155. $2=[(5), (6), (8)]._asSet();
  57156. $ctx1.sendIdx["asSet"]=1;
  57157. $1=$recv($2)._collect_((function(x){
  57158. return $core.withContext(function($ctx2) {
  57159. return $recv(x).__backslash_backslash((3));
  57160. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57161. }));
  57162. $self._assert_equals_($1,[(0), (2)]._asSet());
  57163. return self;
  57164. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  57165. },
  57166. args: [],
  57167. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  57168. referencedClasses: [],
  57169. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  57170. }),
  57171. $globals.SetTest);
  57172. $core.addMethod(
  57173. $core.method({
  57174. selector: "testComma",
  57175. protocol: "tests",
  57176. fn: function (){
  57177. var self=this,$self=this;
  57178. return $core.withContext(function($ctx1) {
  57179. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  57180. (
  57181. $ctx1.supercall = true,
  57182. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  57183. $ctx1.supercall = false;
  57184. $2=$self._collection();
  57185. $ctx1.sendIdx["collection"]=1;
  57186. $3=$self._collection();
  57187. $ctx1.sendIdx["collection"]=2;
  57188. $1=$recv($2).__comma($3);
  57189. $ctx1.sendIdx[","]=1;
  57190. $4=$self._collection();
  57191. $ctx1.sendIdx["collection"]=3;
  57192. $self._assert_equals_($1,$4);
  57193. $ctx1.sendIdx["assert:equals:"]=1;
  57194. $6=$self._collection();
  57195. $ctx1.sendIdx["collection"]=4;
  57196. $7=$self._collectionWithNewValue();
  57197. $ctx1.sendIdx["collectionWithNewValue"]=1;
  57198. $5=$recv($6).__comma($7);
  57199. $ctx1.sendIdx[","]=2;
  57200. $8=$self._collectionWithNewValue();
  57201. $ctx1.sendIdx["collectionWithNewValue"]=2;
  57202. $self._assert_equals_($5,$8);
  57203. $ctx1.sendIdx["assert:equals:"]=2;
  57204. $10=$self._collectionWithNewValue();
  57205. $ctx1.sendIdx["collectionWithNewValue"]=3;
  57206. $9=$recv($10).__comma($self._collection());
  57207. $self._assert_equals_($9,$self._collectionWithNewValue());
  57208. return self;
  57209. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  57210. },
  57211. args: [],
  57212. 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",
  57213. referencedClasses: [],
  57214. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  57215. }),
  57216. $globals.SetTest);
  57217. $core.addMethod(
  57218. $core.method({
  57219. selector: "testComparing",
  57220. protocol: "tests",
  57221. fn: function (){
  57222. var self=this,$self=this;
  57223. return $core.withContext(function($ctx1) {
  57224. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  57225. $1=[(0), (2)]._asSet();
  57226. $ctx1.sendIdx["asSet"]=1;
  57227. $2=[(0), (2)]._asSet();
  57228. $ctx1.sendIdx["asSet"]=2;
  57229. $self._assert_equals_($1,$2);
  57230. $ctx1.sendIdx["assert:equals:"]=1;
  57231. $3=[(2), (0)]._asSet();
  57232. $ctx1.sendIdx["asSet"]=3;
  57233. $4=[(0), (2)]._asSet();
  57234. $ctx1.sendIdx["asSet"]=4;
  57235. $self._assert_equals_($3,$4);
  57236. $6=[(0), (2), (3)]._asSet();
  57237. $ctx1.sendIdx["asSet"]=5;
  57238. $7=[(0), (2)]._asSet();
  57239. $ctx1.sendIdx["asSet"]=6;
  57240. $5=$recv($6).__eq($7);
  57241. $ctx1.sendIdx["="]=1;
  57242. $self._deny_($5);
  57243. $ctx1.sendIdx["deny:"]=1;
  57244. $9=[(1), (2)]._asSet();
  57245. $ctx1.sendIdx["asSet"]=7;
  57246. $8=$recv($9).__eq([(0), (2)]._asSet());
  57247. $self._deny_($8);
  57248. return self;
  57249. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  57250. },
  57251. args: [],
  57252. 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",
  57253. referencedClasses: [],
  57254. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  57255. }),
  57256. $globals.SetTest);
  57257. $core.addMethod(
  57258. $core.method({
  57259. selector: "testPrintString",
  57260. protocol: "tests",
  57261. fn: function (){
  57262. var self=this,$self=this;
  57263. var set;
  57264. return $core.withContext(function($ctx1) {
  57265. var $1,$2,$3,$4,$5,$6,$7,$8;
  57266. set=$recv($globals.Set)._new();
  57267. $1=$recv(set)._printString();
  57268. $ctx1.sendIdx["printString"]=1;
  57269. $self._assert_equals_($1,"a Set ()");
  57270. $ctx1.sendIdx["assert:equals:"]=1;
  57271. $2=set;
  57272. $recv($2)._add_((1));
  57273. $ctx1.sendIdx["add:"]=1;
  57274. $3=$recv($2)._add_((3));
  57275. $ctx1.sendIdx["add:"]=2;
  57276. $4=$recv(set)._printString();
  57277. $ctx1.sendIdx["printString"]=2;
  57278. $self._assert_equals_($4,"a Set (1 3)");
  57279. $ctx1.sendIdx["assert:equals:"]=2;
  57280. $recv(set)._add_("foo");
  57281. $ctx1.sendIdx["add:"]=3;
  57282. $5=$recv(set)._printString();
  57283. $ctx1.sendIdx["printString"]=3;
  57284. $self._assert_equals_($5,"a Set (1 3 'foo')");
  57285. $ctx1.sendIdx["assert:equals:"]=3;
  57286. $6=set;
  57287. $recv($6)._remove_((1));
  57288. $ctx1.sendIdx["remove:"]=1;
  57289. $recv($6)._remove_((3));
  57290. $7=$recv(set)._printString();
  57291. $ctx1.sendIdx["printString"]=4;
  57292. $self._assert_equals_($7,"a Set ('foo')");
  57293. $ctx1.sendIdx["assert:equals:"]=4;
  57294. $recv(set)._add_((3));
  57295. $ctx1.sendIdx["add:"]=4;
  57296. $8=$recv(set)._printString();
  57297. $ctx1.sendIdx["printString"]=5;
  57298. $self._assert_equals_($8,"a Set (3 'foo')");
  57299. $ctx1.sendIdx["assert:equals:"]=5;
  57300. $recv(set)._add_((3));
  57301. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  57302. return self;
  57303. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  57304. },
  57305. args: [],
  57306. 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'')'",
  57307. referencedClasses: ["Set"],
  57308. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  57309. }),
  57310. $globals.SetTest);
  57311. $core.addMethod(
  57312. $core.method({
  57313. selector: "testRegression1225",
  57314. protocol: "tests",
  57315. fn: function (){
  57316. var self=this,$self=this;
  57317. return $core.withContext(function($ctx1) {
  57318. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._add_((3)),(3));
  57319. return self;
  57320. }, function($ctx1) {$ctx1.fill(self,"testRegression1225",{},$globals.SetTest)});
  57321. },
  57322. args: [],
  57323. source: "testRegression1225\x0a\x09self assert: (#(1 2 3) asSet add: 3) equals: 3",
  57324. referencedClasses: [],
  57325. messageSends: ["assert:equals:", "add:", "asSet"]
  57326. }),
  57327. $globals.SetTest);
  57328. $core.addMethod(
  57329. $core.method({
  57330. selector: "testRegression1226",
  57331. protocol: "tests",
  57332. fn: function (){
  57333. var self=this,$self=this;
  57334. return $core.withContext(function($ctx1) {
  57335. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._remove_((3)),(3));
  57336. return self;
  57337. }, function($ctx1) {$ctx1.fill(self,"testRegression1226",{},$globals.SetTest)});
  57338. },
  57339. args: [],
  57340. source: "testRegression1226\x0a\x09self assert: (#(1 2 3) asSet remove: 3) equals: 3",
  57341. referencedClasses: [],
  57342. messageSends: ["assert:equals:", "remove:", "asSet"]
  57343. }),
  57344. $globals.SetTest);
  57345. $core.addMethod(
  57346. $core.method({
  57347. selector: "testRegression1227",
  57348. protocol: "tests",
  57349. fn: function (){
  57350. var self=this,$self=this;
  57351. return $core.withContext(function($ctx1) {
  57352. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._remove_ifAbsent_((4),(function(){
  57353. return (5);
  57354. })),(5));
  57355. return self;
  57356. }, function($ctx1) {$ctx1.fill(self,"testRegression1227",{},$globals.SetTest)});
  57357. },
  57358. args: [],
  57359. source: "testRegression1227\x0a\x09self assert: (#(1 2 3) asSet remove: 4 ifAbsent: [5]) equals: 5",
  57360. referencedClasses: [],
  57361. messageSends: ["assert:equals:", "remove:ifAbsent:", "asSet"]
  57362. }),
  57363. $globals.SetTest);
  57364. $core.addMethod(
  57365. $core.method({
  57366. selector: "testRegression1228",
  57367. protocol: "tests",
  57368. fn: function (){
  57369. var self=this,$self=this;
  57370. return $core.withContext(function($ctx1) {
  57371. $self._should_raise_((function(){
  57372. return $core.withContext(function($ctx2) {
  57373. return $recv([(1), (2), (3)]._asSet())._remove_((4));
  57374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57375. }),$globals.Error);
  57376. return self;
  57377. }, function($ctx1) {$ctx1.fill(self,"testRegression1228",{},$globals.SetTest)});
  57378. },
  57379. args: [],
  57380. source: "testRegression1228\x0a\x09self should: [#(1 2 3) asSet remove: 4] raise: Error",
  57381. referencedClasses: ["Error"],
  57382. messageSends: ["should:raise:", "remove:", "asSet"]
  57383. }),
  57384. $globals.SetTest);
  57385. $core.addMethod(
  57386. $core.method({
  57387. selector: "testUnboxedObjects",
  57388. protocol: "tests",
  57389. fn: function (){
  57390. var self=this,$self=this;
  57391. return $core.withContext(function($ctx1) {
  57392. var $4,$3,$2,$1;
  57393. $4="foo"._yourself();
  57394. $ctx1.sendIdx["yourself"]=1;
  57395. $3=[$4,"foo"._yourself()];
  57396. $2=$recv($3)._asSet();
  57397. $1=$recv($2)._asArray();
  57398. $self._assert_equals_($1,["foo"]);
  57399. return self;
  57400. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  57401. },
  57402. args: [],
  57403. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  57404. referencedClasses: [],
  57405. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  57406. }),
  57407. $globals.SetTest);
  57408. $core.addMethod(
  57409. $core.method({
  57410. selector: "testUnicity",
  57411. protocol: "tests",
  57412. fn: function (){
  57413. var self=this,$self=this;
  57414. var set;
  57415. return $core.withContext(function($ctx1) {
  57416. var $1;
  57417. set=$recv($globals.Set)._new();
  57418. $recv(set)._add_((21));
  57419. $ctx1.sendIdx["add:"]=1;
  57420. $recv(set)._add_("hello");
  57421. $ctx1.sendIdx["add:"]=2;
  57422. $recv(set)._add_((21));
  57423. $ctx1.sendIdx["add:"]=3;
  57424. $1=$recv(set)._size();
  57425. $ctx1.sendIdx["size"]=1;
  57426. $self._assert_equals_($1,(2));
  57427. $ctx1.sendIdx["assert:equals:"]=1;
  57428. $recv(set)._add_("hello");
  57429. $self._assert_equals_($recv(set)._size(),(2));
  57430. $ctx1.sendIdx["assert:equals:"]=2;
  57431. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  57432. return self;
  57433. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  57434. },
  57435. args: [],
  57436. 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')",
  57437. referencedClasses: ["Set"],
  57438. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  57439. }),
  57440. $globals.SetTest);
  57441. $core.addMethod(
  57442. $core.method({
  57443. selector: "collectionClass",
  57444. protocol: "fixture",
  57445. fn: function (){
  57446. var self=this,$self=this;
  57447. return $globals.Set;
  57448. },
  57449. args: [],
  57450. source: "collectionClass\x0a\x09^ Set",
  57451. referencedClasses: ["Set"],
  57452. messageSends: []
  57453. }),
  57454. $globals.SetTest.a$cls);
  57455. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  57456. $core.addMethod(
  57457. $core.method({
  57458. selector: "testShow",
  57459. protocol: "tests",
  57460. fn: function (){
  57461. var self=this,$self=this;
  57462. var originalTranscript;
  57463. return $core.withContext(function($ctx1) {
  57464. originalTranscript=$recv($globals.Transcript)._current();
  57465. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  57466. $ctx1.sendIdx["register:"]=1;
  57467. $self._shouldnt_raise_((function(){
  57468. return $core.withContext(function($ctx2) {
  57469. return $recv($globals.Transcript)._show_("Hello console!");
  57470. $ctx2.sendIdx["show:"]=1;
  57471. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57472. }),$globals.Error);
  57473. $ctx1.sendIdx["shouldnt:raise:"]=1;
  57474. $self._shouldnt_raise_((function(){
  57475. return $core.withContext(function($ctx2) {
  57476. return $recv($globals.Transcript)._show_(console);
  57477. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57478. }),$globals.Error);
  57479. $recv($globals.Transcript)._register_(originalTranscript);
  57480. return self;
  57481. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  57482. },
  57483. args: [],
  57484. 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.",
  57485. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  57486. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  57487. }),
  57488. $globals.ConsoleTranscriptTest);
  57489. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  57490. $core.addMethod(
  57491. $core.method({
  57492. selector: "testEquality",
  57493. protocol: "tests",
  57494. fn: function (){
  57495. var self=this,$self=this;
  57496. var now;
  57497. return $core.withContext(function($ctx1) {
  57498. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57499. now=$recv($globals.Date)._new();
  57500. $1=$recv(now).__eq(now);
  57501. $ctx1.sendIdx["="]=1;
  57502. $self._assert_($1);
  57503. $ctx1.sendIdx["assert:"]=1;
  57504. $3=now;
  57505. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57506. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57507. $2=$recv($3).__eq($4);
  57508. $ctx1.sendIdx["="]=2;
  57509. $self._deny_($2);
  57510. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57511. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57512. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57513. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57514. $5=$recv($6).__eq($7);
  57515. $ctx1.sendIdx["="]=3;
  57516. $self._assert_($5);
  57517. $ctx1.sendIdx["assert:"]=2;
  57518. $9=now;
  57519. $11=$recv(now)._asMilliseconds();
  57520. $ctx1.sendIdx["asMilliseconds"]=1;
  57521. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57522. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57523. $8=$recv($9).__eq($10);
  57524. $ctx1.sendIdx["="]=4;
  57525. $self._assert_($8);
  57526. $ctx1.sendIdx["assert:"]=3;
  57527. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  57528. return self;
  57529. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  57530. },
  57531. args: [],
  57532. 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",
  57533. referencedClasses: ["Date"],
  57534. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57535. }),
  57536. $globals.DateTest);
  57537. $core.addMethod(
  57538. $core.method({
  57539. selector: "testIdentity",
  57540. protocol: "tests",
  57541. fn: function (){
  57542. var self=this,$self=this;
  57543. var now;
  57544. return $core.withContext(function($ctx1) {
  57545. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57546. now=$recv($globals.Date)._new();
  57547. $1=$recv(now).__eq_eq(now);
  57548. $ctx1.sendIdx["=="]=1;
  57549. $self._assert_($1);
  57550. $3=now;
  57551. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57552. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57553. $2=$recv($3).__eq_eq($4);
  57554. $ctx1.sendIdx["=="]=2;
  57555. $self._deny_($2);
  57556. $ctx1.sendIdx["deny:"]=1;
  57557. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57558. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57559. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57560. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57561. $5=$recv($6).__eq_eq($7);
  57562. $ctx1.sendIdx["=="]=3;
  57563. $self._deny_($5);
  57564. $ctx1.sendIdx["deny:"]=2;
  57565. $9=now;
  57566. $11=$recv(now)._asMilliseconds();
  57567. $ctx1.sendIdx["asMilliseconds"]=1;
  57568. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57569. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57570. $8=$recv($9).__eq_eq($10);
  57571. $ctx1.sendIdx["=="]=4;
  57572. $self._deny_($8);
  57573. $ctx1.sendIdx["deny:"]=3;
  57574. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  57575. return self;
  57576. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  57577. },
  57578. args: [],
  57579. 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",
  57580. referencedClasses: ["Date"],
  57581. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57582. }),
  57583. $globals.DateTest);
  57584. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  57585. $core.addMethod(
  57586. $core.method({
  57587. selector: "jsObject",
  57588. protocol: "accessing",
  57589. fn: function (){
  57590. var self=this,$self=this;
  57591. return $core.withContext(function($ctx1) {
  57592. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  57593. return self;
  57594. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  57595. },
  57596. args: [],
  57597. 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}'>",
  57598. referencedClasses: [],
  57599. messageSends: []
  57600. }),
  57601. $globals.JSObjectProxyTest);
  57602. $core.addMethod(
  57603. $core.method({
  57604. selector: "jsUndefined",
  57605. protocol: "accessing",
  57606. fn: function (){
  57607. var self=this,$self=this;
  57608. return $core.withContext(function($ctx1) {
  57609. return;
  57610. return self;
  57611. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  57612. },
  57613. args: [],
  57614. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  57615. referencedClasses: [],
  57616. messageSends: []
  57617. }),
  57618. $globals.JSObjectProxyTest);
  57619. $core.addMethod(
  57620. $core.method({
  57621. selector: "testAtIfAbsent",
  57622. protocol: "tests",
  57623. fn: function (){
  57624. var self=this,$self=this;
  57625. var testObject;
  57626. return $core.withContext(function($ctx1) {
  57627. var $1,$2,$3;
  57628. testObject=$self._jsObject();
  57629. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  57630. return "Property does not exist";
  57631. }));
  57632. $ctx1.sendIdx["at:ifAbsent:"]=1;
  57633. $self._assert_equals_($1,"Property does not exist");
  57634. $ctx1.sendIdx["assert:equals:"]=1;
  57635. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  57636. return "Property does not exist";
  57637. }));
  57638. $ctx1.sendIdx["at:ifAbsent:"]=2;
  57639. $self._assert_equals_($2,nil);
  57640. $ctx1.sendIdx["assert:equals:"]=2;
  57641. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  57642. return "Property does not exist";
  57643. }));
  57644. $ctx1.sendIdx["at:ifAbsent:"]=3;
  57645. $self._assert_equals_($3,(1));
  57646. $ctx1.sendIdx["assert:equals:"]=3;
  57647. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  57648. return "Property does not exist";
  57649. })),nil);
  57650. return self;
  57651. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57652. },
  57653. args: [],
  57654. 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.",
  57655. referencedClasses: [],
  57656. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  57657. }),
  57658. $globals.JSObjectProxyTest);
  57659. $core.addMethod(
  57660. $core.method({
  57661. selector: "testAtIfPresent",
  57662. protocol: "tests",
  57663. fn: function (){
  57664. var self=this,$self=this;
  57665. var testObject;
  57666. return $core.withContext(function($ctx1) {
  57667. var $2,$1,$4,$3,$6,$5;
  57668. testObject=$self._jsObject();
  57669. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  57670. return $core.withContext(function($ctx2) {
  57671. $2=$recv(x)._asString();
  57672. $ctx2.sendIdx["asString"]=1;
  57673. return "hello ".__comma($2);
  57674. $ctx2.sendIdx[","]=1;
  57675. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57676. }));
  57677. $ctx1.sendIdx["at:ifPresent:"]=1;
  57678. $self._assert_equals_($1,nil);
  57679. $ctx1.sendIdx["assert:equals:"]=1;
  57680. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  57681. return $core.withContext(function($ctx2) {
  57682. $4=$recv(x)._asString();
  57683. $ctx2.sendIdx["asString"]=2;
  57684. return "hello ".__comma($4);
  57685. $ctx2.sendIdx[","]=2;
  57686. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  57687. }));
  57688. $ctx1.sendIdx["at:ifPresent:"]=2;
  57689. $self._assert_equals_($3,"hello nil");
  57690. $ctx1.sendIdx["assert:equals:"]=2;
  57691. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  57692. return $core.withContext(function($ctx2) {
  57693. $6=$recv(x)._asString();
  57694. $ctx2.sendIdx["asString"]=3;
  57695. return "hello ".__comma($6);
  57696. $ctx2.sendIdx[","]=3;
  57697. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57698. }));
  57699. $ctx1.sendIdx["at:ifPresent:"]=3;
  57700. $self._assert_equals_($5,"hello 1");
  57701. $ctx1.sendIdx["assert:equals:"]=3;
  57702. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  57703. return $core.withContext(function($ctx2) {
  57704. return "hello ".__comma($recv(x)._asString());
  57705. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  57706. })),"hello nil");
  57707. return self;
  57708. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57709. },
  57710. args: [],
  57711. 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'.",
  57712. referencedClasses: [],
  57713. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  57714. }),
  57715. $globals.JSObjectProxyTest);
  57716. $core.addMethod(
  57717. $core.method({
  57718. selector: "testAtIfPresentIfAbsent",
  57719. protocol: "tests",
  57720. fn: function (){
  57721. var self=this,$self=this;
  57722. var testObject;
  57723. return $core.withContext(function($ctx1) {
  57724. var $2,$1,$4,$3,$6,$5;
  57725. testObject=$self._jsObject();
  57726. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  57727. return $core.withContext(function($ctx2) {
  57728. $2=$recv(x)._asString();
  57729. $ctx2.sendIdx["asString"]=1;
  57730. return "hello ".__comma($2);
  57731. $ctx2.sendIdx[","]=1;
  57732. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57733. }),(function(){
  57734. return "not present";
  57735. }));
  57736. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  57737. $self._assert_equals_($1,"not present");
  57738. $ctx1.sendIdx["assert:equals:"]=1;
  57739. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  57740. return $core.withContext(function($ctx2) {
  57741. $4=$recv(x)._asString();
  57742. $ctx2.sendIdx["asString"]=2;
  57743. return "hello ".__comma($4);
  57744. $ctx2.sendIdx[","]=2;
  57745. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57746. }),(function(){
  57747. return "not present";
  57748. }));
  57749. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  57750. $self._assert_equals_($3,"hello nil");
  57751. $ctx1.sendIdx["assert:equals:"]=2;
  57752. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  57753. return $core.withContext(function($ctx2) {
  57754. $6=$recv(x)._asString();
  57755. $ctx2.sendIdx["asString"]=3;
  57756. return "hello ".__comma($6);
  57757. $ctx2.sendIdx[","]=3;
  57758. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  57759. }),(function(){
  57760. return "not present";
  57761. }));
  57762. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  57763. $self._assert_equals_($5,"hello 1");
  57764. $ctx1.sendIdx["assert:equals:"]=3;
  57765. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  57766. return $core.withContext(function($ctx2) {
  57767. return "hello ".__comma($recv(x)._asString());
  57768. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  57769. }),(function(){
  57770. return "not present";
  57771. })),"hello nil");
  57772. return self;
  57773. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57774. },
  57775. args: [],
  57776. 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'.",
  57777. referencedClasses: [],
  57778. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  57779. }),
  57780. $globals.JSObjectProxyTest);
  57781. $core.addMethod(
  57782. $core.method({
  57783. selector: "testAtPut",
  57784. protocol: "tests",
  57785. fn: function (){
  57786. var self=this,$self=this;
  57787. var testObject;
  57788. return $core.withContext(function($ctx1) {
  57789. var $2,$1;
  57790. testObject=$self._jsObject();
  57791. $2=$recv(testObject)._at_("abc");
  57792. $ctx1.sendIdx["at:"]=1;
  57793. $1=$recv($2).__tild_eq("xyz");
  57794. $self._assert_($1);
  57795. $self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  57796. $ctx1.sendIdx["assert:equals:"]=1;
  57797. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  57798. return self;
  57799. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  57800. },
  57801. args: [],
  57802. 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'",
  57803. referencedClasses: [],
  57804. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  57805. }),
  57806. $globals.JSObjectProxyTest);
  57807. $core.addMethod(
  57808. $core.method({
  57809. selector: "testComparison",
  57810. protocol: "tests",
  57811. fn: function (){
  57812. var self=this,$self=this;
  57813. return $core.withContext(function($ctx1) {
  57814. var $1,$2;
  57815. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  57816. $1=$recv(console).__eq(console);
  57817. $ctx1.sendIdx["="]=1;
  57818. $self._assert_($1);
  57819. $2=$recv(console).__eq($recv($globals.Object)._new());
  57820. $ctx1.sendIdx["="]=2;
  57821. $self._deny_($2);
  57822. $ctx1.sendIdx["deny:"]=1;
  57823. $self._deny_($recv(console).__eq($self._jsObject()));
  57824. return self;
  57825. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  57826. },
  57827. args: [],
  57828. 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",
  57829. referencedClasses: ["Object"],
  57830. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  57831. }),
  57832. $globals.JSObjectProxyTest);
  57833. $core.addMethod(
  57834. $core.method({
  57835. selector: "testDNU",
  57836. protocol: "tests",
  57837. fn: function (){
  57838. var self=this,$self=this;
  57839. return $core.withContext(function($ctx1) {
  57840. $self._should_raise_((function(){
  57841. return $core.withContext(function($ctx2) {
  57842. return $recv($self._jsObject())._foo();
  57843. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57844. }),$globals.MessageNotUnderstood);
  57845. return self;
  57846. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  57847. },
  57848. args: [],
  57849. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  57850. referencedClasses: ["MessageNotUnderstood"],
  57851. messageSends: ["should:raise:", "foo", "jsObject"]
  57852. }),
  57853. $globals.JSObjectProxyTest);
  57854. $core.addMethod(
  57855. $core.method({
  57856. selector: "testDNUWithAllowJavaScriptCalls",
  57857. protocol: "tests",
  57858. fn: function (){
  57859. var self=this,$self=this;
  57860. var jsObject;
  57861. return $core.withContext(function($ctx1) {
  57862. jsObject=[];
  57863. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  57864. $self._should_raise_((function(){
  57865. return $core.withContext(function($ctx2) {
  57866. return $recv(jsObject)._foo();
  57867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57868. }),$globals.MessageNotUnderstood);
  57869. return self;
  57870. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57871. },
  57872. args: [],
  57873. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  57874. referencedClasses: ["MessageNotUnderstood"],
  57875. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  57876. }),
  57877. $globals.JSObjectProxyTest);
  57878. $core.addMethod(
  57879. $core.method({
  57880. selector: "testMessageSend",
  57881. protocol: "tests",
  57882. fn: function (){
  57883. var self=this,$self=this;
  57884. return $core.withContext(function($ctx1) {
  57885. var $2,$1,$4,$3;
  57886. $2=$self._jsObject();
  57887. $ctx1.sendIdx["jsObject"]=1;
  57888. $1=$recv($2)._a();
  57889. $self._assert_equals_($1,(1));
  57890. $ctx1.sendIdx["assert:equals:"]=1;
  57891. $4=$self._jsObject();
  57892. $ctx1.sendIdx["jsObject"]=2;
  57893. $3=$recv($4)._b();
  57894. $self._assert_equals_($3,(2));
  57895. $ctx1.sendIdx["assert:equals:"]=2;
  57896. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  57897. return self;
  57898. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  57899. },
  57900. args: [],
  57901. 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",
  57902. referencedClasses: [],
  57903. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  57904. }),
  57905. $globals.JSObjectProxyTest);
  57906. $core.addMethod(
  57907. $core.method({
  57908. selector: "testMethodWithArguments",
  57909. protocol: "tests",
  57910. fn: function (){
  57911. var self=this,$self=this;
  57912. return $core.withContext(function($ctx1) {
  57913. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  57914. return self;
  57915. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  57916. },
  57917. args: [],
  57918. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  57919. referencedClasses: [],
  57920. messageSends: ["assert:equals:", "c:", "jsObject"]
  57921. }),
  57922. $globals.JSObjectProxyTest);
  57923. $core.addMethod(
  57924. $core.method({
  57925. selector: "testNull",
  57926. protocol: "tests",
  57927. fn: function (){
  57928. var self=this,$self=this;
  57929. return $core.withContext(function($ctx1) {
  57930. var $2,$1;
  57931. $2=$recv($globals.JSObjectProxy)._null();
  57932. $ctx1.sendIdx["null"]=1;
  57933. $1=$recv($2)._isNil();
  57934. $self._assert_($1);
  57935. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._null()])),"{\x22foo\x22:null}");
  57936. return self;
  57937. }, function($ctx1) {$ctx1.fill(self,"testNull",{},$globals.JSObjectProxyTest)});
  57938. },
  57939. args: [],
  57940. source: "testNull\x0a\x09self assert: JSObjectProxy null isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy null})\x0a\x09\x09equals: '{\x22foo\x22:null}'",
  57941. referencedClasses: ["JSObjectProxy", "JSON"],
  57942. messageSends: ["assert:", "isNil", "null", "assert:equals:", "stringify:"]
  57943. }),
  57944. $globals.JSObjectProxyTest);
  57945. $core.addMethod(
  57946. $core.method({
  57947. selector: "testPrinting",
  57948. protocol: "tests",
  57949. fn: function (){
  57950. var self=this,$self=this;
  57951. return $core.withContext(function($ctx1) {
  57952. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  57953. return self;
  57954. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  57955. },
  57956. args: [],
  57957. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  57958. referencedClasses: [],
  57959. messageSends: ["assert:equals:", "printString", "jsObject"]
  57960. }),
  57961. $globals.JSObjectProxyTest);
  57962. $core.addMethod(
  57963. $core.method({
  57964. selector: "testPropertyThatReturnsEmptyString",
  57965. protocol: "tests",
  57966. fn: function (){
  57967. var self=this,$self=this;
  57968. var object;
  57969. return $core.withContext(function($ctx1) {
  57970. var $1;
  57971. object=$self._jsObject();
  57972. $1=$recv(object)._d();
  57973. $ctx1.sendIdx["d"]=1;
  57974. $self._assert_equals_($1,"");
  57975. $ctx1.sendIdx["assert:equals:"]=1;
  57976. $recv(object)._d_("hello");
  57977. $self._assert_equals_($recv(object)._d(),"hello");
  57978. return self;
  57979. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  57980. },
  57981. args: [],
  57982. 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'",
  57983. referencedClasses: [],
  57984. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  57985. }),
  57986. $globals.JSObjectProxyTest);
  57987. $core.addMethod(
  57988. $core.method({
  57989. selector: "testPropertyThatReturnsUndefined",
  57990. protocol: "tests",
  57991. fn: function (){
  57992. var self=this,$self=this;
  57993. var object;
  57994. return $core.withContext(function($ctx1) {
  57995. object=$self._jsObject();
  57996. $self._shouldnt_raise_((function(){
  57997. return $core.withContext(function($ctx2) {
  57998. return $recv(object)._e();
  57999. $ctx2.sendIdx["e"]=1;
  58000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58001. }),$globals.MessageNotUnderstood);
  58002. $self._assert_($recv($recv(object)._e())._isNil());
  58003. return self;
  58004. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  58005. },
  58006. args: [],
  58007. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  58008. referencedClasses: ["MessageNotUnderstood"],
  58009. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  58010. }),
  58011. $globals.JSObjectProxyTest);
  58012. $core.addMethod(
  58013. $core.method({
  58014. selector: "testSetPropertyWithFalsyValue",
  58015. protocol: "tests",
  58016. fn: function (){
  58017. var self=this,$self=this;
  58018. var jsObject;
  58019. return $core.withContext(function($ctx1) {
  58020. var $1,$2,$3,$4,$5;
  58021. jsObject=$self._jsObject();
  58022. $1=$recv(jsObject)._a();
  58023. $ctx1.sendIdx["a"]=1;
  58024. $self._assert_equals_($1,(1));
  58025. $ctx1.sendIdx["assert:equals:"]=1;
  58026. $recv(jsObject)._a_($recv($globals.JSObjectProxy)._null());
  58027. $ctx1.sendIdx["a:"]=1;
  58028. $2=$recv(jsObject)._a();
  58029. $ctx1.sendIdx["a"]=2;
  58030. $self._assert_equals_($2,nil);
  58031. $ctx1.sendIdx["assert:equals:"]=2;
  58032. $recv(jsObject)._a_((0));
  58033. $ctx1.sendIdx["a:"]=2;
  58034. $3=$recv(jsObject)._a();
  58035. $ctx1.sendIdx["a"]=3;
  58036. $self._assert_equals_($3,(0));
  58037. $ctx1.sendIdx["assert:equals:"]=3;
  58038. $recv(jsObject)._a_($self._jsUndefined());
  58039. $ctx1.sendIdx["a:"]=3;
  58040. $4=$recv(jsObject)._a();
  58041. $ctx1.sendIdx["a"]=4;
  58042. $self._assert_equals_($4,nil);
  58043. $ctx1.sendIdx["assert:equals:"]=4;
  58044. $recv(jsObject)._a_("");
  58045. $ctx1.sendIdx["a:"]=4;
  58046. $5=$recv(jsObject)._a();
  58047. $ctx1.sendIdx["a"]=5;
  58048. $self._assert_equals_($5,"");
  58049. $ctx1.sendIdx["assert:equals:"]=5;
  58050. $recv(jsObject)._a_(false);
  58051. $self._assert_equals_($recv(jsObject)._a(),false);
  58052. return self;
  58053. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  58054. },
  58055. args: [],
  58056. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: JSObjectProxy null.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  58057. referencedClasses: ["JSObjectProxy"],
  58058. messageSends: ["jsObject", "assert:equals:", "a", "a:", "null", "jsUndefined"]
  58059. }),
  58060. $globals.JSObjectProxyTest);
  58061. $core.addMethod(
  58062. $core.method({
  58063. selector: "testUndefined",
  58064. protocol: "tests",
  58065. fn: function (){
  58066. var self=this,$self=this;
  58067. return $core.withContext(function($ctx1) {
  58068. var $2,$1;
  58069. $2=$recv($globals.JSObjectProxy)._undefined();
  58070. $ctx1.sendIdx["undefined"]=1;
  58071. $1=$recv($2)._isNil();
  58072. $self._assert_($1);
  58073. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._undefined()])),"{}");
  58074. return self;
  58075. }, function($ctx1) {$ctx1.fill(self,"testUndefined",{},$globals.JSObjectProxyTest)});
  58076. },
  58077. args: [],
  58078. source: "testUndefined\x0a\x09self assert: JSObjectProxy undefined isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy undefined})\x0a\x09\x09equals: '{}'",
  58079. referencedClasses: ["JSObjectProxy", "JSON"],
  58080. messageSends: ["assert:", "isNil", "undefined", "assert:equals:", "stringify:"]
  58081. }),
  58082. $globals.JSObjectProxyTest);
  58083. $core.addMethod(
  58084. $core.method({
  58085. selector: "testValue",
  58086. protocol: "tests",
  58087. fn: function (){
  58088. var self=this,$self=this;
  58089. var testObject;
  58090. return $core.withContext(function($ctx1) {
  58091. testObject=$self._jsObject();
  58092. $recv(testObject)._at_put_("value","aValue");
  58093. $self._assert_equals_($recv(testObject)._value(),"aValue");
  58094. return self;
  58095. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  58096. },
  58097. args: [],
  58098. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  58099. referencedClasses: [],
  58100. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  58101. }),
  58102. $globals.JSObjectProxyTest);
  58103. $core.addMethod(
  58104. $core.method({
  58105. selector: "testYourself",
  58106. protocol: "tests",
  58107. fn: function (){
  58108. var self=this,$self=this;
  58109. var object;
  58110. return $core.withContext(function($ctx1) {
  58111. var $1;
  58112. $1=$self._jsObject();
  58113. $recv($1)._d_("test");
  58114. object=$recv($1)._yourself();
  58115. $self._assert_equals_($recv(object)._d(),"test");
  58116. return self;
  58117. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  58118. },
  58119. args: [],
  58120. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  58121. referencedClasses: [],
  58122. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  58123. }),
  58124. $globals.JSObjectProxyTest);
  58125. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  58126. $core.addMethod(
  58127. $core.method({
  58128. selector: "testCatchingException",
  58129. protocol: "tests",
  58130. fn: function (){
  58131. var self=this,$self=this;
  58132. return $core.withContext(function($ctx1) {
  58133. $recv((function(){
  58134. return $core.withContext(function($ctx2) {
  58135. return $self._throwException();
  58136. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58137. }))._on_do_($globals.Error,(function(error){
  58138. return $core.withContext(function($ctx2) {
  58139. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  58140. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  58141. }));
  58142. return self;
  58143. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  58144. },
  58145. args: [],
  58146. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  58147. referencedClasses: ["Error"],
  58148. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  58149. }),
  58150. $globals.JavaScriptExceptionTest);
  58151. $core.addMethod(
  58152. $core.method({
  58153. selector: "testRaisingException",
  58154. protocol: "tests",
  58155. fn: function (){
  58156. var self=this,$self=this;
  58157. return $core.withContext(function($ctx1) {
  58158. $self._should_raise_((function(){
  58159. return $core.withContext(function($ctx2) {
  58160. return $self._throwException();
  58161. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58162. }),$globals.JavaScriptException);
  58163. return self;
  58164. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  58165. },
  58166. args: [],
  58167. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  58168. referencedClasses: ["JavaScriptException"],
  58169. messageSends: ["should:raise:", "throwException"]
  58170. }),
  58171. $globals.JavaScriptExceptionTest);
  58172. $core.addMethod(
  58173. $core.method({
  58174. selector: "throwException",
  58175. protocol: "helpers",
  58176. fn: function (){
  58177. var self=this,$self=this;
  58178. return $core.withContext(function($ctx1) {
  58179. throw "test";
  58180. return self;
  58181. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  58182. },
  58183. args: [],
  58184. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  58185. referencedClasses: [],
  58186. messageSends: []
  58187. }),
  58188. $globals.JavaScriptExceptionTest);
  58189. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  58190. $core.addMethod(
  58191. $core.method({
  58192. selector: "testValue",
  58193. protocol: "tests",
  58194. fn: function (){
  58195. var self=this,$self=this;
  58196. var messageSend;
  58197. return $core.withContext(function($ctx1) {
  58198. var $1;
  58199. $1=$recv($globals.MessageSend)._new();
  58200. $ctx1.sendIdx["new"]=1;
  58201. $recv($1)._receiver_($recv($globals.Object)._new());
  58202. $recv($1)._selector_("asString");
  58203. messageSend=$recv($1)._yourself();
  58204. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  58205. return self;
  58206. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  58207. },
  58208. args: [],
  58209. 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'",
  58210. referencedClasses: ["MessageSend", "Object"],
  58211. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  58212. }),
  58213. $globals.MessageSendTest);
  58214. $core.addMethod(
  58215. $core.method({
  58216. selector: "testValueWithArguments",
  58217. protocol: "tests",
  58218. fn: function (){
  58219. var self=this,$self=this;
  58220. var messageSend;
  58221. return $core.withContext(function($ctx1) {
  58222. var $1;
  58223. $1=$recv($globals.MessageSend)._new();
  58224. $recv($1)._receiver_((2));
  58225. $recv($1)._selector_("+");
  58226. messageSend=$recv($1)._yourself();
  58227. $self._assert_equals_($recv(messageSend)._value_((3)),(5));
  58228. $ctx1.sendIdx["assert:equals:"]=1;
  58229. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  58230. return self;
  58231. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  58232. },
  58233. args: [],
  58234. 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",
  58235. referencedClasses: ["MessageSend"],
  58236. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  58237. }),
  58238. $globals.MessageSendTest);
  58239. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  58240. $core.addMethod(
  58241. $core.method({
  58242. selector: "codeGeneratorClass",
  58243. protocol: "accessing",
  58244. fn: function (){
  58245. var self=this,$self=this;
  58246. return $globals.CodeGenerator;
  58247. },
  58248. args: [],
  58249. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  58250. referencedClasses: ["CodeGenerator"],
  58251. messageSends: []
  58252. }),
  58253. $globals.MethodInheritanceTest);
  58254. $core.addMethod(
  58255. $core.method({
  58256. selector: "compiler",
  58257. protocol: "factory",
  58258. fn: function (){
  58259. var self=this,$self=this;
  58260. return $core.withContext(function($ctx1) {
  58261. var $1;
  58262. $1=$recv($globals.Compiler)._new();
  58263. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  58264. return $recv($1)._yourself();
  58265. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  58266. },
  58267. args: [],
  58268. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  58269. referencedClasses: ["Compiler"],
  58270. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  58271. }),
  58272. $globals.MethodInheritanceTest);
  58273. $core.addMethod(
  58274. $core.method({
  58275. selector: "deinstallBottom",
  58276. protocol: "testing",
  58277. fn: function (){
  58278. var self=this,$self=this;
  58279. return $core.withContext(function($ctx1) {
  58280. $recv($self._targetClassBottom())._removeCompiledMethod_($self.method);
  58281. return self;
  58282. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  58283. },
  58284. args: [],
  58285. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  58286. referencedClasses: [],
  58287. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  58288. }),
  58289. $globals.MethodInheritanceTest);
  58290. $core.addMethod(
  58291. $core.method({
  58292. selector: "deinstallMiddle",
  58293. protocol: "testing",
  58294. fn: function (){
  58295. var self=this,$self=this;
  58296. return $core.withContext(function($ctx1) {
  58297. $recv($self._targetClassMiddle())._removeCompiledMethod_($self.method);
  58298. return self;
  58299. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  58300. },
  58301. args: [],
  58302. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  58303. referencedClasses: [],
  58304. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  58305. }),
  58306. $globals.MethodInheritanceTest);
  58307. $core.addMethod(
  58308. $core.method({
  58309. selector: "deinstallTop",
  58310. protocol: "testing",
  58311. fn: function (){
  58312. var self=this,$self=this;
  58313. return $core.withContext(function($ctx1) {
  58314. $recv($self._targetClassTop())._removeCompiledMethod_($self.method);
  58315. return self;
  58316. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  58317. },
  58318. args: [],
  58319. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  58320. referencedClasses: [],
  58321. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  58322. }),
  58323. $globals.MethodInheritanceTest);
  58324. $core.addMethod(
  58325. $core.method({
  58326. selector: "installBottom:",
  58327. protocol: "testing",
  58328. fn: function (aString){
  58329. var self=this,$self=this;
  58330. return $core.withContext(function($ctx1) {
  58331. $self.method=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  58332. return self;
  58333. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  58334. },
  58335. args: ["aString"],
  58336. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  58337. referencedClasses: [],
  58338. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  58339. }),
  58340. $globals.MethodInheritanceTest);
  58341. $core.addMethod(
  58342. $core.method({
  58343. selector: "installMiddle:",
  58344. protocol: "testing",
  58345. fn: function (aString){
  58346. var self=this,$self=this;
  58347. return $core.withContext(function($ctx1) {
  58348. $self.method=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  58349. return self;
  58350. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  58351. },
  58352. args: ["aString"],
  58353. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  58354. referencedClasses: [],
  58355. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  58356. }),
  58357. $globals.MethodInheritanceTest);
  58358. $core.addMethod(
  58359. $core.method({
  58360. selector: "installTop:",
  58361. protocol: "testing",
  58362. fn: function (aString){
  58363. var self=this,$self=this;
  58364. return $core.withContext(function($ctx1) {
  58365. $self.method=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  58366. return self;
  58367. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  58368. },
  58369. args: ["aString"],
  58370. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  58371. referencedClasses: [],
  58372. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  58373. }),
  58374. $globals.MethodInheritanceTest);
  58375. $core.addMethod(
  58376. $core.method({
  58377. selector: "setUp",
  58378. protocol: "initialization",
  58379. fn: function (){
  58380. var self=this,$self=this;
  58381. return $core.withContext(function($ctx1) {
  58382. $self.receiverTop=$recv($self._targetClassTop())._new();
  58383. $ctx1.sendIdx["new"]=1;
  58384. $self.receiverMiddle=$recv($self._targetClassMiddle())._new();
  58385. $ctx1.sendIdx["new"]=2;
  58386. $self.receiverBottom=$recv($self._targetClassBottom())._new();
  58387. $self.method=nil;
  58388. $self.performBlock=(function(){
  58389. return $core.withContext(function($ctx2) {
  58390. return $self._error_("performBlock not initialized");
  58391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58392. });
  58393. return self;
  58394. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  58395. },
  58396. args: [],
  58397. 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' ]",
  58398. referencedClasses: [],
  58399. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  58400. }),
  58401. $globals.MethodInheritanceTest);
  58402. $core.addMethod(
  58403. $core.method({
  58404. selector: "shouldMNU",
  58405. protocol: "testing",
  58406. fn: function (){
  58407. var self=this,$self=this;
  58408. return $core.withContext(function($ctx1) {
  58409. $self._shouldMNUTop();
  58410. $self._shouldMNUMiddle();
  58411. $self._shouldMNUBottom();
  58412. return self;
  58413. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  58414. },
  58415. args: [],
  58416. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  58417. referencedClasses: [],
  58418. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  58419. }),
  58420. $globals.MethodInheritanceTest);
  58421. $core.addMethod(
  58422. $core.method({
  58423. selector: "shouldMNUBottom",
  58424. protocol: "testing",
  58425. fn: function (){
  58426. var self=this,$self=this;
  58427. return $core.withContext(function($ctx1) {
  58428. $self._should_raise_((function(){
  58429. return $core.withContext(function($ctx2) {
  58430. return $recv($self.performBlock)._value_($self.receiverBottom);
  58431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58432. }),$globals.MessageNotUnderstood);
  58433. return self;
  58434. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  58435. },
  58436. args: [],
  58437. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  58438. referencedClasses: ["MessageNotUnderstood"],
  58439. messageSends: ["should:raise:", "value:"]
  58440. }),
  58441. $globals.MethodInheritanceTest);
  58442. $core.addMethod(
  58443. $core.method({
  58444. selector: "shouldMNUMiddle",
  58445. protocol: "testing",
  58446. fn: function (){
  58447. var self=this,$self=this;
  58448. return $core.withContext(function($ctx1) {
  58449. $self._should_raise_((function(){
  58450. return $core.withContext(function($ctx2) {
  58451. return $recv($self.performBlock)._value_($self.receiverMiddle);
  58452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58453. }),$globals.MessageNotUnderstood);
  58454. return self;
  58455. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  58456. },
  58457. args: [],
  58458. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  58459. referencedClasses: ["MessageNotUnderstood"],
  58460. messageSends: ["should:raise:", "value:"]
  58461. }),
  58462. $globals.MethodInheritanceTest);
  58463. $core.addMethod(
  58464. $core.method({
  58465. selector: "shouldMNUTop",
  58466. protocol: "testing",
  58467. fn: function (){
  58468. var self=this,$self=this;
  58469. return $core.withContext(function($ctx1) {
  58470. $self._should_raise_((function(){
  58471. return $core.withContext(function($ctx2) {
  58472. return $recv($self.performBlock)._value_($self.receiverTop);
  58473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58474. }),$globals.MessageNotUnderstood);
  58475. return self;
  58476. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  58477. },
  58478. args: [],
  58479. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  58480. referencedClasses: ["MessageNotUnderstood"],
  58481. messageSends: ["should:raise:", "value:"]
  58482. }),
  58483. $globals.MethodInheritanceTest);
  58484. $core.addMethod(
  58485. $core.method({
  58486. selector: "shouldReturn:",
  58487. protocol: "testing",
  58488. fn: function (anObject){
  58489. var self=this,$self=this;
  58490. var result;
  58491. return $core.withContext(function($ctx1) {
  58492. result=$recv($self.performBlock)._value_($self.receiverTop);
  58493. $ctx1.sendIdx["value:"]=1;
  58494. $self._assert_equals_(["top",anObject],["top",result]);
  58495. $ctx1.sendIdx["assert:equals:"]=1;
  58496. result=$recv($self.performBlock)._value_($self.receiverMiddle);
  58497. $ctx1.sendIdx["value:"]=2;
  58498. $self._assert_equals_(["middle",anObject],["middle",result]);
  58499. $ctx1.sendIdx["assert:equals:"]=2;
  58500. result=$recv($self.performBlock)._value_($self.receiverBottom);
  58501. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  58502. return self;
  58503. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  58504. },
  58505. args: ["anObject"],
  58506. 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 }",
  58507. referencedClasses: [],
  58508. messageSends: ["value:", "assert:equals:"]
  58509. }),
  58510. $globals.MethodInheritanceTest);
  58511. $core.addMethod(
  58512. $core.method({
  58513. selector: "shouldReturn:and:and:",
  58514. protocol: "testing",
  58515. fn: function (anObject,anObject2,anObject3){
  58516. var self=this,$self=this;
  58517. var result;
  58518. return $core.withContext(function($ctx1) {
  58519. result=$recv($self.performBlock)._value_($self.receiverTop);
  58520. $ctx1.sendIdx["value:"]=1;
  58521. $self._assert_equals_(["top",anObject],["top",result]);
  58522. $ctx1.sendIdx["assert:equals:"]=1;
  58523. result=$recv($self.performBlock)._value_($self.receiverMiddle);
  58524. $ctx1.sendIdx["value:"]=2;
  58525. $self._assert_equals_(["middle",anObject2],["middle",result]);
  58526. $ctx1.sendIdx["assert:equals:"]=2;
  58527. result=$recv($self.performBlock)._value_($self.receiverBottom);
  58528. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  58529. return self;
  58530. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  58531. },
  58532. args: ["anObject", "anObject2", "anObject3"],
  58533. 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 }",
  58534. referencedClasses: [],
  58535. messageSends: ["value:", "assert:equals:"]
  58536. }),
  58537. $globals.MethodInheritanceTest);
  58538. $core.addMethod(
  58539. $core.method({
  58540. selector: "targetClassBottom",
  58541. protocol: "accessing",
  58542. fn: function (){
  58543. var self=this,$self=this;
  58544. return $globals.JavaScriptException;
  58545. },
  58546. args: [],
  58547. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  58548. referencedClasses: ["JavaScriptException"],
  58549. messageSends: []
  58550. }),
  58551. $globals.MethodInheritanceTest);
  58552. $core.addMethod(
  58553. $core.method({
  58554. selector: "targetClassMiddle",
  58555. protocol: "accessing",
  58556. fn: function (){
  58557. var self=this,$self=this;
  58558. return $globals.Error;
  58559. },
  58560. args: [],
  58561. source: "targetClassMiddle\x0a\x09^ Error",
  58562. referencedClasses: ["Error"],
  58563. messageSends: []
  58564. }),
  58565. $globals.MethodInheritanceTest);
  58566. $core.addMethod(
  58567. $core.method({
  58568. selector: "targetClassTop",
  58569. protocol: "accessing",
  58570. fn: function (){
  58571. var self=this,$self=this;
  58572. return $globals.Object;
  58573. },
  58574. args: [],
  58575. source: "targetClassTop\x0a\x09^ Object",
  58576. referencedClasses: ["Object"],
  58577. messageSends: []
  58578. }),
  58579. $globals.MethodInheritanceTest);
  58580. $core.addMethod(
  58581. $core.method({
  58582. selector: "tearDown",
  58583. protocol: "initialization",
  58584. fn: function (){
  58585. var self=this,$self=this;
  58586. return $core.withContext(function($ctx1) {
  58587. $recv((function(){
  58588. return $core.withContext(function($ctx2) {
  58589. return $self._deinstallTop();
  58590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58591. }))._on_do_($globals.Error,(function(){
  58592. }));
  58593. $ctx1.sendIdx["on:do:"]=1;
  58594. $recv((function(){
  58595. return $core.withContext(function($ctx2) {
  58596. return $self._deinstallMiddle();
  58597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58598. }))._on_do_($globals.Error,(function(){
  58599. }));
  58600. $ctx1.sendIdx["on:do:"]=2;
  58601. $recv((function(){
  58602. return $core.withContext(function($ctx2) {
  58603. return $self._deinstallBottom();
  58604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58605. }))._on_do_($globals.Error,(function(){
  58606. }));
  58607. return self;
  58608. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  58609. },
  58610. args: [],
  58611. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  58612. referencedClasses: ["Error"],
  58613. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  58614. }),
  58615. $globals.MethodInheritanceTest);
  58616. $core.addMethod(
  58617. $core.method({
  58618. selector: "testMNU11",
  58619. protocol: "tests",
  58620. fn: function (){
  58621. var self=this,$self=this;
  58622. return $core.withContext(function($ctx1) {
  58623. $self.performBlock=(function(x){
  58624. return $core.withContext(function($ctx2) {
  58625. return $recv(x)._foo();
  58626. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58627. });
  58628. $self._shouldMNU();
  58629. $ctx1.sendIdx["shouldMNU"]=1;
  58630. $self._installTop_("foo ^ false");
  58631. $ctx1.sendIdx["installTop:"]=1;
  58632. $self._installTop_("foo ^ true");
  58633. $self._deinstallTop();
  58634. $self._shouldMNU();
  58635. return self;
  58636. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  58637. },
  58638. args: [],
  58639. 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",
  58640. referencedClasses: [],
  58641. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  58642. }),
  58643. $globals.MethodInheritanceTest);
  58644. $core.addMethod(
  58645. $core.method({
  58646. selector: "testMNU22",
  58647. protocol: "tests",
  58648. fn: function (){
  58649. var self=this,$self=this;
  58650. return $core.withContext(function($ctx1) {
  58651. $self.performBlock=(function(x){
  58652. return $core.withContext(function($ctx2) {
  58653. return $recv(x)._foo();
  58654. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58655. });
  58656. $self._shouldMNU();
  58657. $ctx1.sendIdx["shouldMNU"]=1;
  58658. $self._installMiddle_("foo ^ false");
  58659. $ctx1.sendIdx["installMiddle:"]=1;
  58660. $self._installMiddle_("foo ^ true");
  58661. $self._deinstallMiddle();
  58662. $self._shouldMNU();
  58663. return self;
  58664. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  58665. },
  58666. args: [],
  58667. 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",
  58668. referencedClasses: [],
  58669. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  58670. }),
  58671. $globals.MethodInheritanceTest);
  58672. $core.addMethod(
  58673. $core.method({
  58674. selector: "testReturns1",
  58675. protocol: "tests",
  58676. fn: function (){
  58677. var self=this,$self=this;
  58678. return $core.withContext(function($ctx1) {
  58679. $self.performBlock=(function(x){
  58680. return $core.withContext(function($ctx2) {
  58681. return $recv(x)._foo();
  58682. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58683. });
  58684. $self._installTop_("foo ^ false");
  58685. $ctx1.sendIdx["installTop:"]=1;
  58686. $self._shouldReturn_(false);
  58687. $ctx1.sendIdx["shouldReturn:"]=1;
  58688. $self._installTop_("foo ^ true");
  58689. $self._shouldReturn_(true);
  58690. return self;
  58691. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  58692. },
  58693. args: [],
  58694. 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",
  58695. referencedClasses: [],
  58696. messageSends: ["foo", "installTop:", "shouldReturn:"]
  58697. }),
  58698. $globals.MethodInheritanceTest);
  58699. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  58700. $core.addMethod(
  58701. $core.method({
  58702. selector: "testAbs",
  58703. protocol: "tests",
  58704. fn: function (){
  58705. var self=this,$self=this;
  58706. return $core.withContext(function($ctx1) {
  58707. var $1;
  58708. $1=(4)._abs();
  58709. $ctx1.sendIdx["abs"]=1;
  58710. $self._assert_equals_($1,(4));
  58711. $ctx1.sendIdx["assert:equals:"]=1;
  58712. $self._assert_equals_((-4)._abs(),(4));
  58713. return self;
  58714. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  58715. },
  58716. args: [],
  58717. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  58718. referencedClasses: [],
  58719. messageSends: ["assert:equals:", "abs"]
  58720. }),
  58721. $globals.NumberTest);
  58722. $core.addMethod(
  58723. $core.method({
  58724. selector: "testArithmetic",
  58725. protocol: "tests",
  58726. fn: function (){
  58727. var self=this,$self=this;
  58728. return $core.withContext(function($ctx1) {
  58729. var $1,$2,$3,$5,$4;
  58730. $1=(1.5).__plus((1));
  58731. $ctx1.sendIdx["+"]=1;
  58732. $self._assert_equals_($1,(2.5));
  58733. $ctx1.sendIdx["assert:equals:"]=1;
  58734. $2=(2).__minus((1));
  58735. $ctx1.sendIdx["-"]=1;
  58736. $self._assert_equals_($2,(1));
  58737. $ctx1.sendIdx["assert:equals:"]=2;
  58738. $self._assert_equals_((-2).__minus((1)),(-3));
  58739. $ctx1.sendIdx["assert:equals:"]=3;
  58740. $self._assert_equals_((12).__slash((2)),(6));
  58741. $ctx1.sendIdx["assert:equals:"]=4;
  58742. $3=(3).__star((4));
  58743. $ctx1.sendIdx["*"]=1;
  58744. $self._assert_equals_($3,(12));
  58745. $ctx1.sendIdx["assert:equals:"]=5;
  58746. $self._assert_equals_((7).__slash_slash((2)),(3));
  58747. $ctx1.sendIdx["assert:equals:"]=6;
  58748. $self._assert_equals_((7).__backslash_backslash((2)),(1));
  58749. $ctx1.sendIdx["assert:equals:"]=7;
  58750. $5=(1).__plus((2));
  58751. $ctx1.sendIdx["+"]=2;
  58752. $4=$recv($5).__star((3));
  58753. $ctx1.sendIdx["*"]=2;
  58754. $self._assert_equals_($4,(9));
  58755. $ctx1.sendIdx["assert:equals:"]=8;
  58756. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  58757. return self;
  58758. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  58759. },
  58760. args: [],
  58761. 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",
  58762. referencedClasses: [],
  58763. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  58764. }),
  58765. $globals.NumberTest);
  58766. $core.addMethod(
  58767. $core.method({
  58768. selector: "testAsNumber",
  58769. protocol: "tests",
  58770. fn: function (){
  58771. var self=this,$self=this;
  58772. return $core.withContext(function($ctx1) {
  58773. $self._assert_equals_((3)._asNumber(),(3));
  58774. return self;
  58775. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  58776. },
  58777. args: [],
  58778. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  58779. referencedClasses: [],
  58780. messageSends: ["assert:equals:", "asNumber"]
  58781. }),
  58782. $globals.NumberTest);
  58783. $core.addMethod(
  58784. $core.method({
  58785. selector: "testBetweenAnd",
  58786. protocol: "tests",
  58787. fn: function (){
  58788. var self=this,$self=this;
  58789. return $core.withContext(function($ctx1) {
  58790. var $1,$3,$2,$5,$4;
  58791. $1=(4)._between_and_((3),(5));
  58792. $ctx1.sendIdx["between:and:"]=1;
  58793. $self._assert_($1);
  58794. $ctx1.sendIdx["assert:"]=1;
  58795. $3=(1)._between_and_((5),(6));
  58796. $ctx1.sendIdx["between:and:"]=2;
  58797. $2=$recv($3)._not();
  58798. $ctx1.sendIdx["not"]=1;
  58799. $self._assert_($2);
  58800. $ctx1.sendIdx["assert:"]=2;
  58801. $5=(90)._between_and_((67),(87));
  58802. $ctx1.sendIdx["between:and:"]=3;
  58803. $4=$recv($5)._not();
  58804. $self._assert_($4);
  58805. $ctx1.sendIdx["assert:"]=3;
  58806. $self._assert_((1)._between_and_((1),(1)));
  58807. return self;
  58808. }, function($ctx1) {$ctx1.fill(self,"testBetweenAnd",{},$globals.NumberTest)});
  58809. },
  58810. args: [],
  58811. 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).",
  58812. referencedClasses: [],
  58813. messageSends: ["assert:", "between:and:", "not"]
  58814. }),
  58815. $globals.NumberTest);
  58816. $core.addMethod(
  58817. $core.method({
  58818. selector: "testBitAnd",
  58819. protocol: "tests",
  58820. fn: function (){
  58821. var self=this,$self=this;
  58822. return $core.withContext(function($ctx1) {
  58823. var $1,$2;
  58824. $1=(15)._bitAnd_((2));
  58825. $ctx1.sendIdx["bitAnd:"]=1;
  58826. $self._assert_equals_($1,(2));
  58827. $ctx1.sendIdx["assert:equals:"]=1;
  58828. $2=(15)._bitAnd_((15));
  58829. $ctx1.sendIdx["bitAnd:"]=2;
  58830. $self._assert_equals_($2,(15));
  58831. $ctx1.sendIdx["assert:equals:"]=2;
  58832. $self._assert_equals_((-1)._bitAnd_((1021)),(1021));
  58833. return self;
  58834. }, function($ctx1) {$ctx1.fill(self,"testBitAnd",{},$globals.NumberTest)});
  58835. },
  58836. args: [],
  58837. 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",
  58838. referencedClasses: [],
  58839. messageSends: ["assert:equals:", "bitAnd:"]
  58840. }),
  58841. $globals.NumberTest);
  58842. $core.addMethod(
  58843. $core.method({
  58844. selector: "testBitNot",
  58845. protocol: "tests",
  58846. fn: function (){
  58847. var self=this,$self=this;
  58848. return $core.withContext(function($ctx1) {
  58849. var $1,$2;
  58850. $1=(2)._bitNot();
  58851. $ctx1.sendIdx["bitNot"]=1;
  58852. $self._assert_equals_($1,(-3));
  58853. $ctx1.sendIdx["assert:equals:"]=1;
  58854. $2=(-1)._bitNot();
  58855. $ctx1.sendIdx["bitNot"]=2;
  58856. $self._assert_equals_($2,(0));
  58857. $ctx1.sendIdx["assert:equals:"]=2;
  58858. $self._assert_equals_((-1022)._bitNot(),(1021));
  58859. return self;
  58860. }, function($ctx1) {$ctx1.fill(self,"testBitNot",{},$globals.NumberTest)});
  58861. },
  58862. args: [],
  58863. source: "testBitNot\x0a\x09self assert: 2 bitNot equals: -3.\x0a\x09self assert: -1 bitNot equals: 0.\x0a\x09self assert: -1022 bitNot equals: 1021",
  58864. referencedClasses: [],
  58865. messageSends: ["assert:equals:", "bitNot"]
  58866. }),
  58867. $globals.NumberTest);
  58868. $core.addMethod(
  58869. $core.method({
  58870. selector: "testBitOr",
  58871. protocol: "tests",
  58872. fn: function (){
  58873. var self=this,$self=this;
  58874. return $core.withContext(function($ctx1) {
  58875. var $1,$2;
  58876. $1=(2)._bitOr_((4));
  58877. $ctx1.sendIdx["bitOr:"]=1;
  58878. $self._assert_equals_($1,(6));
  58879. $ctx1.sendIdx["assert:equals:"]=1;
  58880. $2=(7)._bitOr_((2));
  58881. $ctx1.sendIdx["bitOr:"]=2;
  58882. $self._assert_equals_($2,(7));
  58883. $ctx1.sendIdx["assert:equals:"]=2;
  58884. $self._assert_equals_((-1)._bitOr_((1021)),(-1));
  58885. return self;
  58886. }, function($ctx1) {$ctx1.fill(self,"testBitOr",{},$globals.NumberTest)});
  58887. },
  58888. args: [],
  58889. 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",
  58890. referencedClasses: [],
  58891. messageSends: ["assert:equals:", "bitOr:"]
  58892. }),
  58893. $globals.NumberTest);
  58894. $core.addMethod(
  58895. $core.method({
  58896. selector: "testBitXor",
  58897. protocol: "tests",
  58898. fn: function (){
  58899. var self=this,$self=this;
  58900. return $core.withContext(function($ctx1) {
  58901. var $1,$2,$3;
  58902. $1=(2)._bitXor_((4));
  58903. $ctx1.sendIdx["bitXor:"]=1;
  58904. $self._assert_equals_($1,(6));
  58905. $ctx1.sendIdx["assert:equals:"]=1;
  58906. $2=(7)._bitXor_((2));
  58907. $ctx1.sendIdx["bitXor:"]=2;
  58908. $self._assert_equals_($2,(5));
  58909. $ctx1.sendIdx["assert:equals:"]=2;
  58910. $3=(-1)._bitXor_((1021));
  58911. $ctx1.sendIdx["bitXor:"]=3;
  58912. $self._assert_equals_($3,(-1022));
  58913. $ctx1.sendIdx["assert:equals:"]=3;
  58914. $self._assert_equals_((91)._bitXor_((91)),(0));
  58915. return self;
  58916. }, function($ctx1) {$ctx1.fill(self,"testBitXor",{},$globals.NumberTest)});
  58917. },
  58918. args: [],
  58919. 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",
  58920. referencedClasses: [],
  58921. messageSends: ["assert:equals:", "bitXor:"]
  58922. }),
  58923. $globals.NumberTest);
  58924. $core.addMethod(
  58925. $core.method({
  58926. selector: "testCeiling",
  58927. protocol: "tests",
  58928. fn: function (){
  58929. var self=this,$self=this;
  58930. return $core.withContext(function($ctx1) {
  58931. var $1,$2;
  58932. $1=(1.2)._ceiling();
  58933. $ctx1.sendIdx["ceiling"]=1;
  58934. $self._assert_equals_($1,(2));
  58935. $ctx1.sendIdx["assert:equals:"]=1;
  58936. $2=(-1.2)._ceiling();
  58937. $ctx1.sendIdx["ceiling"]=2;
  58938. $self._assert_equals_($2,(-1));
  58939. $ctx1.sendIdx["assert:equals:"]=2;
  58940. $self._assert_equals_((1)._ceiling(),(1));
  58941. return self;
  58942. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  58943. },
  58944. args: [],
  58945. 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.",
  58946. referencedClasses: [],
  58947. messageSends: ["assert:equals:", "ceiling"]
  58948. }),
  58949. $globals.NumberTest);
  58950. $core.addMethod(
  58951. $core.method({
  58952. selector: "testComparison",
  58953. protocol: "tests",
  58954. fn: function (){
  58955. var self=this,$self=this;
  58956. return $core.withContext(function($ctx1) {
  58957. var $1,$2,$3,$4;
  58958. $1=(3).__gt((2));
  58959. $ctx1.sendIdx[">"]=1;
  58960. $self._assert_($1);
  58961. $ctx1.sendIdx["assert:"]=1;
  58962. $2=(2).__lt((3));
  58963. $ctx1.sendIdx["<"]=1;
  58964. $self._assert_($2);
  58965. $ctx1.sendIdx["assert:"]=2;
  58966. $self._deny_((3).__lt((2)));
  58967. $ctx1.sendIdx["deny:"]=1;
  58968. $self._deny_((2).__gt((3)));
  58969. $3=(3).__gt_eq((3));
  58970. $ctx1.sendIdx[">="]=1;
  58971. $self._assert_($3);
  58972. $ctx1.sendIdx["assert:"]=3;
  58973. $self._assert_((3.1).__gt_eq((3)));
  58974. $ctx1.sendIdx["assert:"]=4;
  58975. $4=(3).__lt_eq((3));
  58976. $ctx1.sendIdx["<="]=1;
  58977. $self._assert_($4);
  58978. $ctx1.sendIdx["assert:"]=5;
  58979. $self._assert_((3).__lt_eq((3.1)));
  58980. return self;
  58981. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  58982. },
  58983. args: [],
  58984. 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",
  58985. referencedClasses: [],
  58986. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  58987. }),
  58988. $globals.NumberTest);
  58989. $core.addMethod(
  58990. $core.method({
  58991. selector: "testCopying",
  58992. protocol: "tests",
  58993. fn: function (){
  58994. var self=this,$self=this;
  58995. return $core.withContext(function($ctx1) {
  58996. var $1;
  58997. $1=$recv((1)._copy()).__eq_eq((1));
  58998. $ctx1.sendIdx["=="]=1;
  58999. $self._assert_($1);
  59000. $ctx1.sendIdx["assert:"]=1;
  59001. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  59002. return self;
  59003. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  59004. },
  59005. args: [],
  59006. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  59007. referencedClasses: [],
  59008. messageSends: ["assert:", "==", "copy", "deepCopy"]
  59009. }),
  59010. $globals.NumberTest);
  59011. $core.addMethod(
  59012. $core.method({
  59013. selector: "testDegreesToRadians",
  59014. protocol: "tests",
  59015. fn: function (){
  59016. var self=this,$self=this;
  59017. return $core.withContext(function($ctx1) {
  59018. $self._assert_($recv($recv($recv((180)._degreesToRadians()).__minus($recv($globals.Number)._pi()))._abs()).__lt_eq((0.01)));
  59019. return self;
  59020. }, function($ctx1) {$ctx1.fill(self,"testDegreesToRadians",{},$globals.NumberTest)});
  59021. },
  59022. args: [],
  59023. source: "testDegreesToRadians\x0a\x09self assert: (180 degreesToRadians - Number pi) abs <= 0.01.",
  59024. referencedClasses: ["Number"],
  59025. messageSends: ["assert:", "<=", "abs", "-", "degreesToRadians", "pi"]
  59026. }),
  59027. $globals.NumberTest);
  59028. $core.addMethod(
  59029. $core.method({
  59030. selector: "testEquality",
  59031. protocol: "tests",
  59032. fn: function (){
  59033. var self=this,$self=this;
  59034. return $core.withContext(function($ctx1) {
  59035. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  59036. $1=(1).__eq((1));
  59037. $ctx1.sendIdx["="]=1;
  59038. $self._assert_($1);
  59039. $ctx1.sendIdx["assert:"]=1;
  59040. $2=(0).__eq((0));
  59041. $ctx1.sendIdx["="]=2;
  59042. $self._assert_($2);
  59043. $ctx1.sendIdx["assert:"]=2;
  59044. $3=(1).__eq((0));
  59045. $ctx1.sendIdx["="]=3;
  59046. $self._deny_($3);
  59047. $ctx1.sendIdx["deny:"]=1;
  59048. $5=(1)._yourself();
  59049. $ctx1.sendIdx["yourself"]=1;
  59050. $4=$recv($5).__eq((1));
  59051. $ctx1.sendIdx["="]=4;
  59052. $self._assert_($4);
  59053. $ctx1.sendIdx["assert:"]=3;
  59054. $7=(1)._yourself();
  59055. $ctx1.sendIdx["yourself"]=2;
  59056. $6=(1).__eq($7);
  59057. $ctx1.sendIdx["="]=5;
  59058. $self._assert_($6);
  59059. $ctx1.sendIdx["assert:"]=4;
  59060. $9=(1)._yourself();
  59061. $ctx1.sendIdx["yourself"]=3;
  59062. $8=$recv($9).__eq((1)._yourself());
  59063. $ctx1.sendIdx["="]=6;
  59064. $self._assert_($8);
  59065. $10=(0).__eq(false);
  59066. $ctx1.sendIdx["="]=7;
  59067. $self._deny_($10);
  59068. $ctx1.sendIdx["deny:"]=2;
  59069. $11=false.__eq((0));
  59070. $ctx1.sendIdx["="]=8;
  59071. $self._deny_($11);
  59072. $ctx1.sendIdx["deny:"]=3;
  59073. $12="".__eq((0));
  59074. $ctx1.sendIdx["="]=9;
  59075. $self._deny_($12);
  59076. $ctx1.sendIdx["deny:"]=4;
  59077. $self._deny_((0).__eq(""));
  59078. return self;
  59079. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  59080. },
  59081. args: [],
  59082. 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 = ''",
  59083. referencedClasses: [],
  59084. messageSends: ["assert:", "=", "deny:", "yourself"]
  59085. }),
  59086. $globals.NumberTest);
  59087. $core.addMethod(
  59088. $core.method({
  59089. selector: "testFloor",
  59090. protocol: "tests",
  59091. fn: function (){
  59092. var self=this,$self=this;
  59093. return $core.withContext(function($ctx1) {
  59094. var $1,$2;
  59095. $1=(1.2)._floor();
  59096. $ctx1.sendIdx["floor"]=1;
  59097. $self._assert_equals_($1,(1));
  59098. $ctx1.sendIdx["assert:equals:"]=1;
  59099. $2=(-1.2)._floor();
  59100. $ctx1.sendIdx["floor"]=2;
  59101. $self._assert_equals_($2,(-2));
  59102. $ctx1.sendIdx["assert:equals:"]=2;
  59103. $self._assert_equals_((1)._floor(),(1));
  59104. return self;
  59105. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  59106. },
  59107. args: [],
  59108. 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.",
  59109. referencedClasses: [],
  59110. messageSends: ["assert:equals:", "floor"]
  59111. }),
  59112. $globals.NumberTest);
  59113. $core.addMethod(
  59114. $core.method({
  59115. selector: "testHexNumbers",
  59116. protocol: "tests",
  59117. fn: function (){
  59118. var self=this,$self=this;
  59119. return $core.withContext(function($ctx1) {
  59120. var $1,$2,$3,$4,$5;
  59121. $self._assert_equals_((9),(9));
  59122. $ctx1.sendIdx["assert:equals:"]=1;
  59123. $1=(10)._truncated();
  59124. $ctx1.sendIdx["truncated"]=1;
  59125. $self._assert_equals_($1,(10));
  59126. $ctx1.sendIdx["assert:equals:"]=2;
  59127. $2=(11)._truncated();
  59128. $ctx1.sendIdx["truncated"]=2;
  59129. $self._assert_equals_($2,(11));
  59130. $ctx1.sendIdx["assert:equals:"]=3;
  59131. $3=(12)._truncated();
  59132. $ctx1.sendIdx["truncated"]=3;
  59133. $self._assert_equals_($3,(12));
  59134. $ctx1.sendIdx["assert:equals:"]=4;
  59135. $4=(13)._truncated();
  59136. $ctx1.sendIdx["truncated"]=4;
  59137. $self._assert_equals_($4,(13));
  59138. $ctx1.sendIdx["assert:equals:"]=5;
  59139. $5=(14)._truncated();
  59140. $ctx1.sendIdx["truncated"]=5;
  59141. $self._assert_equals_($5,(14));
  59142. $ctx1.sendIdx["assert:equals:"]=6;
  59143. $self._assert_equals_((15)._truncated(),(15));
  59144. return self;
  59145. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  59146. },
  59147. args: [],
  59148. 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",
  59149. referencedClasses: [],
  59150. messageSends: ["assert:equals:", "truncated"]
  59151. }),
  59152. $globals.NumberTest);
  59153. $core.addMethod(
  59154. $core.method({
  59155. selector: "testIdentity",
  59156. protocol: "tests",
  59157. fn: function (){
  59158. var self=this,$self=this;
  59159. return $core.withContext(function($ctx1) {
  59160. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  59161. $1=(1).__eq_eq((1));
  59162. $ctx1.sendIdx["=="]=1;
  59163. $self._assert_($1);
  59164. $ctx1.sendIdx["assert:"]=1;
  59165. $2=(0).__eq_eq((0));
  59166. $ctx1.sendIdx["=="]=2;
  59167. $self._assert_($2);
  59168. $ctx1.sendIdx["assert:"]=2;
  59169. $3=(1).__eq_eq((0));
  59170. $ctx1.sendIdx["=="]=3;
  59171. $self._deny_($3);
  59172. $ctx1.sendIdx["deny:"]=1;
  59173. $5=(1)._yourself();
  59174. $ctx1.sendIdx["yourself"]=1;
  59175. $4=$recv($5).__eq_eq((1));
  59176. $ctx1.sendIdx["=="]=4;
  59177. $self._assert_($4);
  59178. $ctx1.sendIdx["assert:"]=3;
  59179. $7=(1)._yourself();
  59180. $ctx1.sendIdx["yourself"]=2;
  59181. $6=(1).__eq_eq($7);
  59182. $ctx1.sendIdx["=="]=5;
  59183. $self._assert_($6);
  59184. $ctx1.sendIdx["assert:"]=4;
  59185. $9=(1)._yourself();
  59186. $ctx1.sendIdx["yourself"]=3;
  59187. $8=$recv($9).__eq_eq((1)._yourself());
  59188. $ctx1.sendIdx["=="]=6;
  59189. $self._assert_($8);
  59190. $self._deny_((1).__eq_eq((2)));
  59191. return self;
  59192. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  59193. },
  59194. args: [],
  59195. 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",
  59196. referencedClasses: [],
  59197. messageSends: ["assert:", "==", "deny:", "yourself"]
  59198. }),
  59199. $globals.NumberTest);
  59200. $core.addMethod(
  59201. $core.method({
  59202. selector: "testInvalidHexNumbers",
  59203. protocol: "tests",
  59204. fn: function (){
  59205. var self=this,$self=this;
  59206. return $core.withContext(function($ctx1) {
  59207. $self._should_raise_((function(){
  59208. return $core.withContext(function($ctx2) {
  59209. return (16)._rG();
  59210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59211. }),$globals.MessageNotUnderstood);
  59212. $ctx1.sendIdx["should:raise:"]=1;
  59213. $self._should_raise_((function(){
  59214. return $core.withContext(function($ctx2) {
  59215. return (16)._rg();
  59216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59217. }),$globals.MessageNotUnderstood);
  59218. $ctx1.sendIdx["should:raise:"]=2;
  59219. $self._should_raise_((function(){
  59220. return $core.withContext(function($ctx2) {
  59221. return (16)._rH();
  59222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59223. }),$globals.MessageNotUnderstood);
  59224. $ctx1.sendIdx["should:raise:"]=3;
  59225. $self._should_raise_((function(){
  59226. return $core.withContext(function($ctx2) {
  59227. return (16)._rh();
  59228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  59229. }),$globals.MessageNotUnderstood);
  59230. $ctx1.sendIdx["should:raise:"]=4;
  59231. $self._should_raise_((function(){
  59232. return $core.withContext(function($ctx2) {
  59233. return (16)._rI();
  59234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  59235. }),$globals.MessageNotUnderstood);
  59236. $ctx1.sendIdx["should:raise:"]=5;
  59237. $self._should_raise_((function(){
  59238. return $core.withContext(function($ctx2) {
  59239. return (16)._ri();
  59240. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  59241. }),$globals.MessageNotUnderstood);
  59242. $ctx1.sendIdx["should:raise:"]=6;
  59243. $self._should_raise_((function(){
  59244. return $core.withContext(function($ctx2) {
  59245. return (16)._rJ();
  59246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  59247. }),$globals.MessageNotUnderstood);
  59248. $ctx1.sendIdx["should:raise:"]=7;
  59249. $self._should_raise_((function(){
  59250. return $core.withContext(function($ctx2) {
  59251. return (16)._rj();
  59252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  59253. }),$globals.MessageNotUnderstood);
  59254. $ctx1.sendIdx["should:raise:"]=8;
  59255. $self._should_raise_((function(){
  59256. return $core.withContext(function($ctx2) {
  59257. return (16)._rK();
  59258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  59259. }),$globals.MessageNotUnderstood);
  59260. $ctx1.sendIdx["should:raise:"]=9;
  59261. $self._should_raise_((function(){
  59262. return $core.withContext(function($ctx2) {
  59263. return (16)._rk();
  59264. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  59265. }),$globals.MessageNotUnderstood);
  59266. $ctx1.sendIdx["should:raise:"]=10;
  59267. $self._should_raise_((function(){
  59268. return $core.withContext(function($ctx2) {
  59269. return (16)._rL();
  59270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  59271. }),$globals.MessageNotUnderstood);
  59272. $ctx1.sendIdx["should:raise:"]=11;
  59273. $self._should_raise_((function(){
  59274. return $core.withContext(function($ctx2) {
  59275. return (16)._rl();
  59276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  59277. }),$globals.MessageNotUnderstood);
  59278. $ctx1.sendIdx["should:raise:"]=12;
  59279. $self._should_raise_((function(){
  59280. return $core.withContext(function($ctx2) {
  59281. return (16)._rM();
  59282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  59283. }),$globals.MessageNotUnderstood);
  59284. $ctx1.sendIdx["should:raise:"]=13;
  59285. $self._should_raise_((function(){
  59286. return $core.withContext(function($ctx2) {
  59287. return (16)._rm();
  59288. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  59289. }),$globals.MessageNotUnderstood);
  59290. $ctx1.sendIdx["should:raise:"]=14;
  59291. $self._should_raise_((function(){
  59292. return $core.withContext(function($ctx2) {
  59293. return (16)._rN();
  59294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  59295. }),$globals.MessageNotUnderstood);
  59296. $ctx1.sendIdx["should:raise:"]=15;
  59297. $self._should_raise_((function(){
  59298. return $core.withContext(function($ctx2) {
  59299. return (16)._rn();
  59300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  59301. }),$globals.MessageNotUnderstood);
  59302. $ctx1.sendIdx["should:raise:"]=16;
  59303. $self._should_raise_((function(){
  59304. return $core.withContext(function($ctx2) {
  59305. return (16)._rO();
  59306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  59307. }),$globals.MessageNotUnderstood);
  59308. $ctx1.sendIdx["should:raise:"]=17;
  59309. $self._should_raise_((function(){
  59310. return $core.withContext(function($ctx2) {
  59311. return (16)._ro();
  59312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  59313. }),$globals.MessageNotUnderstood);
  59314. $ctx1.sendIdx["should:raise:"]=18;
  59315. $self._should_raise_((function(){
  59316. return $core.withContext(function($ctx2) {
  59317. return (16)._rP();
  59318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  59319. }),$globals.MessageNotUnderstood);
  59320. $ctx1.sendIdx["should:raise:"]=19;
  59321. $self._should_raise_((function(){
  59322. return $core.withContext(function($ctx2) {
  59323. return (16)._rp();
  59324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  59325. }),$globals.MessageNotUnderstood);
  59326. $ctx1.sendIdx["should:raise:"]=20;
  59327. $self._should_raise_((function(){
  59328. return $core.withContext(function($ctx2) {
  59329. return (16)._rQ();
  59330. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  59331. }),$globals.MessageNotUnderstood);
  59332. $ctx1.sendIdx["should:raise:"]=21;
  59333. $self._should_raise_((function(){
  59334. return $core.withContext(function($ctx2) {
  59335. return (16)._rq();
  59336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  59337. }),$globals.MessageNotUnderstood);
  59338. $ctx1.sendIdx["should:raise:"]=22;
  59339. $self._should_raise_((function(){
  59340. return $core.withContext(function($ctx2) {
  59341. return (16)._rR();
  59342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  59343. }),$globals.MessageNotUnderstood);
  59344. $ctx1.sendIdx["should:raise:"]=23;
  59345. $self._should_raise_((function(){
  59346. return $core.withContext(function($ctx2) {
  59347. return (16)._rr();
  59348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  59349. }),$globals.MessageNotUnderstood);
  59350. $ctx1.sendIdx["should:raise:"]=24;
  59351. $self._should_raise_((function(){
  59352. return $core.withContext(function($ctx2) {
  59353. return (16)._rS();
  59354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  59355. }),$globals.MessageNotUnderstood);
  59356. $ctx1.sendIdx["should:raise:"]=25;
  59357. $self._should_raise_((function(){
  59358. return $core.withContext(function($ctx2) {
  59359. return (16)._rs();
  59360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  59361. }),$globals.MessageNotUnderstood);
  59362. $ctx1.sendIdx["should:raise:"]=26;
  59363. $self._should_raise_((function(){
  59364. return $core.withContext(function($ctx2) {
  59365. return (16)._rT();
  59366. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  59367. }),$globals.MessageNotUnderstood);
  59368. $ctx1.sendIdx["should:raise:"]=27;
  59369. $self._should_raise_((function(){
  59370. return $core.withContext(function($ctx2) {
  59371. return (16)._rt();
  59372. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  59373. }),$globals.MessageNotUnderstood);
  59374. $ctx1.sendIdx["should:raise:"]=28;
  59375. $self._should_raise_((function(){
  59376. return $core.withContext(function($ctx2) {
  59377. return (16)._rU();
  59378. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  59379. }),$globals.MessageNotUnderstood);
  59380. $ctx1.sendIdx["should:raise:"]=29;
  59381. $self._should_raise_((function(){
  59382. return $core.withContext(function($ctx2) {
  59383. return (16)._ru();
  59384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  59385. }),$globals.MessageNotUnderstood);
  59386. $ctx1.sendIdx["should:raise:"]=30;
  59387. $self._should_raise_((function(){
  59388. return $core.withContext(function($ctx2) {
  59389. return (16)._rV();
  59390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  59391. }),$globals.MessageNotUnderstood);
  59392. $ctx1.sendIdx["should:raise:"]=31;
  59393. $self._should_raise_((function(){
  59394. return $core.withContext(function($ctx2) {
  59395. return (16)._rv();
  59396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  59397. }),$globals.MessageNotUnderstood);
  59398. $ctx1.sendIdx["should:raise:"]=32;
  59399. $self._should_raise_((function(){
  59400. return $core.withContext(function($ctx2) {
  59401. return (16)._rW();
  59402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  59403. }),$globals.MessageNotUnderstood);
  59404. $ctx1.sendIdx["should:raise:"]=33;
  59405. $self._should_raise_((function(){
  59406. return $core.withContext(function($ctx2) {
  59407. return (16)._rw();
  59408. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  59409. }),$globals.MessageNotUnderstood);
  59410. $ctx1.sendIdx["should:raise:"]=34;
  59411. $self._should_raise_((function(){
  59412. return $core.withContext(function($ctx2) {
  59413. return (16)._rX();
  59414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  59415. }),$globals.MessageNotUnderstood);
  59416. $ctx1.sendIdx["should:raise:"]=35;
  59417. $self._should_raise_((function(){
  59418. return $core.withContext(function($ctx2) {
  59419. return (16)._rx();
  59420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  59421. }),$globals.MessageNotUnderstood);
  59422. $ctx1.sendIdx["should:raise:"]=36;
  59423. $self._should_raise_((function(){
  59424. return $core.withContext(function($ctx2) {
  59425. return (16)._rY();
  59426. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  59427. }),$globals.MessageNotUnderstood);
  59428. $ctx1.sendIdx["should:raise:"]=37;
  59429. $self._should_raise_((function(){
  59430. return $core.withContext(function($ctx2) {
  59431. return (16)._ry();
  59432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  59433. }),$globals.MessageNotUnderstood);
  59434. $ctx1.sendIdx["should:raise:"]=38;
  59435. $self._should_raise_((function(){
  59436. return $core.withContext(function($ctx2) {
  59437. return (16)._rZ();
  59438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  59439. }),$globals.MessageNotUnderstood);
  59440. $ctx1.sendIdx["should:raise:"]=39;
  59441. $self._should_raise_((function(){
  59442. return $core.withContext(function($ctx2) {
  59443. return (16)._rz();
  59444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  59445. }),$globals.MessageNotUnderstood);
  59446. $ctx1.sendIdx["should:raise:"]=40;
  59447. $self._should_raise_((function(){
  59448. return $core.withContext(function($ctx2) {
  59449. return (11259375)._Z();
  59450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  59451. }),$globals.MessageNotUnderstood);
  59452. return self;
  59453. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  59454. },
  59455. args: [],
  59456. 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.",
  59457. referencedClasses: ["MessageNotUnderstood"],
  59458. 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"]
  59459. }),
  59460. $globals.NumberTest);
  59461. $core.addMethod(
  59462. $core.method({
  59463. selector: "testLog",
  59464. protocol: "tests",
  59465. fn: function (){
  59466. var self=this,$self=this;
  59467. return $core.withContext(function($ctx1) {
  59468. $self._assert_equals_((10000)._log(),(4));
  59469. $ctx1.sendIdx["assert:equals:"]=1;
  59470. $self._assert_equals_((512)._log_((2)),(9));
  59471. $ctx1.sendIdx["assert:equals:"]=2;
  59472. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  59473. return self;
  59474. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  59475. },
  59476. args: [],
  59477. 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.",
  59478. referencedClasses: ["Number"],
  59479. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  59480. }),
  59481. $globals.NumberTest);
  59482. $core.addMethod(
  59483. $core.method({
  59484. selector: "testMinMax",
  59485. protocol: "tests",
  59486. fn: function (){
  59487. var self=this,$self=this;
  59488. return $core.withContext(function($ctx1) {
  59489. var $1,$2;
  59490. $self._assert_equals_((2)._max_((5)),(5));
  59491. $ctx1.sendIdx["assert:equals:"]=1;
  59492. $self._assert_equals_((2)._min_((5)),(2));
  59493. $ctx1.sendIdx["assert:equals:"]=2;
  59494. $1=(2)._min_max_((5),(3));
  59495. $ctx1.sendIdx["min:max:"]=1;
  59496. $self._assert_equals_($1,(3));
  59497. $ctx1.sendIdx["assert:equals:"]=3;
  59498. $2=(7)._min_max_((5),(3));
  59499. $ctx1.sendIdx["min:max:"]=2;
  59500. $self._assert_equals_($2,(5));
  59501. $ctx1.sendIdx["assert:equals:"]=4;
  59502. $self._assert_equals_((4)._min_max_((5),(3)),(4));
  59503. return self;
  59504. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  59505. },
  59506. args: [],
  59507. 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.",
  59508. referencedClasses: [],
  59509. messageSends: ["assert:equals:", "max:", "min:", "min:max:"]
  59510. }),
  59511. $globals.NumberTest);
  59512. $core.addMethod(
  59513. $core.method({
  59514. selector: "testNegated",
  59515. protocol: "tests",
  59516. fn: function (){
  59517. var self=this,$self=this;
  59518. return $core.withContext(function($ctx1) {
  59519. var $1;
  59520. $1=(3)._negated();
  59521. $ctx1.sendIdx["negated"]=1;
  59522. $self._assert_equals_($1,(-3));
  59523. $ctx1.sendIdx["assert:equals:"]=1;
  59524. $self._assert_equals_((-3)._negated(),(3));
  59525. return self;
  59526. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  59527. },
  59528. args: [],
  59529. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  59530. referencedClasses: [],
  59531. messageSends: ["assert:equals:", "negated"]
  59532. }),
  59533. $globals.NumberTest);
  59534. $core.addMethod(
  59535. $core.method({
  59536. selector: "testPrintShowingDecimalPlaces",
  59537. protocol: "tests",
  59538. fn: function (){
  59539. var self=this,$self=this;
  59540. return $core.withContext(function($ctx1) {
  59541. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  59542. $1=(23)._printShowingDecimalPlaces_((2));
  59543. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  59544. $self._assert_equals_($1,"23.00");
  59545. $ctx1.sendIdx["assert:equals:"]=1;
  59546. $2=(23.5698)._printShowingDecimalPlaces_((2));
  59547. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  59548. $self._assert_equals_($2,"23.57");
  59549. $ctx1.sendIdx["assert:equals:"]=2;
  59550. $4=(234.567)._negated();
  59551. $ctx1.sendIdx["negated"]=1;
  59552. $3=$recv($4)._printShowingDecimalPlaces_((5));
  59553. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  59554. $self._assert_equals_($3,"-234.56700");
  59555. $ctx1.sendIdx["assert:equals:"]=3;
  59556. $5=(23.4567)._printShowingDecimalPlaces_((0));
  59557. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  59558. $self._assert_equals_($5,"23");
  59559. $ctx1.sendIdx["assert:equals:"]=4;
  59560. $6=(23.5567)._printShowingDecimalPlaces_((0));
  59561. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  59562. $self._assert_equals_($6,"24");
  59563. $ctx1.sendIdx["assert:equals:"]=5;
  59564. $8=(23.4567)._negated();
  59565. $ctx1.sendIdx["negated"]=2;
  59566. $7=$recv($8)._printShowingDecimalPlaces_((0));
  59567. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  59568. $self._assert_equals_($7,"-23");
  59569. $ctx1.sendIdx["assert:equals:"]=6;
  59570. $10=(23.5567)._negated();
  59571. $ctx1.sendIdx["negated"]=3;
  59572. $9=$recv($10)._printShowingDecimalPlaces_((0));
  59573. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  59574. $self._assert_equals_($9,"-24");
  59575. $ctx1.sendIdx["assert:equals:"]=7;
  59576. $11=(100000000)._printShowingDecimalPlaces_((1));
  59577. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  59578. $self._assert_equals_($11,"100000000.0");
  59579. $ctx1.sendIdx["assert:equals:"]=8;
  59580. $12=(0.98)._printShowingDecimalPlaces_((5));
  59581. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  59582. $self._assert_equals_($12,"0.98000");
  59583. $ctx1.sendIdx["assert:equals:"]=9;
  59584. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  59585. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  59586. $self._assert_equals_($13,"-0.98");
  59587. $ctx1.sendIdx["assert:equals:"]=10;
  59588. $14=(2.567)._printShowingDecimalPlaces_((2));
  59589. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  59590. $self._assert_equals_($14,"2.57");
  59591. $ctx1.sendIdx["assert:equals:"]=11;
  59592. $15=(-2.567)._printShowingDecimalPlaces_((2));
  59593. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  59594. $self._assert_equals_($15,"-2.57");
  59595. $ctx1.sendIdx["assert:equals:"]=12;
  59596. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  59597. return self;
  59598. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  59599. },
  59600. args: [],
  59601. 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'.",
  59602. referencedClasses: [],
  59603. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  59604. }),
  59605. $globals.NumberTest);
  59606. $core.addMethod(
  59607. $core.method({
  59608. selector: "testPrintStringBase",
  59609. protocol: "tests",
  59610. fn: function (){
  59611. var self=this,$self=this;
  59612. return $core.withContext(function($ctx1) {
  59613. var $1,$2,$3;
  59614. $1=(15)._printStringBase_((2));
  59615. $ctx1.sendIdx["printStringBase:"]=1;
  59616. $self._assert_equals_($1,"1111");
  59617. $ctx1.sendIdx["assert:equals:"]=1;
  59618. $2=(15)._printStringBase_((16));
  59619. $ctx1.sendIdx["printStringBase:"]=2;
  59620. $self._assert_equals_($2,"f");
  59621. $ctx1.sendIdx["assert:equals:"]=2;
  59622. $3=(256)._printStringBase_((16));
  59623. $ctx1.sendIdx["printStringBase:"]=3;
  59624. $self._assert_equals_($3,"100");
  59625. $ctx1.sendIdx["assert:equals:"]=3;
  59626. $self._assert_equals_((256)._printStringBase_((2)),"100000000");
  59627. return self;
  59628. }, function($ctx1) {$ctx1.fill(self,"testPrintStringBase",{},$globals.NumberTest)});
  59629. },
  59630. args: [],
  59631. 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'",
  59632. referencedClasses: [],
  59633. messageSends: ["assert:equals:", "printStringBase:"]
  59634. }),
  59635. $globals.NumberTest);
  59636. $core.addMethod(
  59637. $core.method({
  59638. selector: "testRadiansToDegrees",
  59639. protocol: "tests",
  59640. fn: function (){
  59641. var self=this,$self=this;
  59642. return $core.withContext(function($ctx1) {
  59643. $self._assert_($recv($recv($recv($recv($recv($globals.Number)._pi())._radiansToDegrees()).__minus((180)))._abs()).__lt_eq((0.01)));
  59644. return self;
  59645. }, function($ctx1) {$ctx1.fill(self,"testRadiansToDegrees",{},$globals.NumberTest)});
  59646. },
  59647. args: [],
  59648. source: "testRadiansToDegrees\x0a\x09self assert: (Number pi radiansToDegrees - 180) abs <= 0.01.",
  59649. referencedClasses: ["Number"],
  59650. messageSends: ["assert:", "<=", "abs", "-", "radiansToDegrees", "pi"]
  59651. }),
  59652. $globals.NumberTest);
  59653. $core.addMethod(
  59654. $core.method({
  59655. selector: "testRaisedTo",
  59656. protocol: "tests",
  59657. fn: function (){
  59658. var self=this,$self=this;
  59659. return $core.withContext(function($ctx1) {
  59660. var $1,$2,$3;
  59661. $1=(2)._raisedTo_((4));
  59662. $ctx1.sendIdx["raisedTo:"]=1;
  59663. $self._assert_equals_($1,(16));
  59664. $ctx1.sendIdx["assert:equals:"]=1;
  59665. $2=(2)._raisedTo_((0));
  59666. $ctx1.sendIdx["raisedTo:"]=2;
  59667. $self._assert_equals_($2,(1));
  59668. $ctx1.sendIdx["assert:equals:"]=2;
  59669. $3=(2)._raisedTo_((-3));
  59670. $ctx1.sendIdx["raisedTo:"]=3;
  59671. $self._assert_equals_($3,(0.125));
  59672. $ctx1.sendIdx["assert:equals:"]=3;
  59673. $self._assert_equals_((4)._raisedTo_((0.5)),(2));
  59674. $ctx1.sendIdx["assert:equals:"]=4;
  59675. $self._assert_equals_((2).__star_star((4)),(16));
  59676. return self;
  59677. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  59678. },
  59679. args: [],
  59680. 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.",
  59681. referencedClasses: [],
  59682. messageSends: ["assert:equals:", "raisedTo:", "**"]
  59683. }),
  59684. $globals.NumberTest);
  59685. $core.addMethod(
  59686. $core.method({
  59687. selector: "testRounded",
  59688. protocol: "tests",
  59689. fn: function (){
  59690. var self=this,$self=this;
  59691. return $core.withContext(function($ctx1) {
  59692. var $1,$2;
  59693. $1=(3)._rounded();
  59694. $ctx1.sendIdx["rounded"]=1;
  59695. $self._assert_equals_($1,(3));
  59696. $ctx1.sendIdx["assert:equals:"]=1;
  59697. $2=(3.212)._rounded();
  59698. $ctx1.sendIdx["rounded"]=2;
  59699. $self._assert_equals_($2,(3));
  59700. $ctx1.sendIdx["assert:equals:"]=2;
  59701. $self._assert_equals_((3.51)._rounded(),(4));
  59702. return self;
  59703. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  59704. },
  59705. args: [],
  59706. 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",
  59707. referencedClasses: [],
  59708. messageSends: ["assert:equals:", "rounded"]
  59709. }),
  59710. $globals.NumberTest);
  59711. $core.addMethod(
  59712. $core.method({
  59713. selector: "testSign",
  59714. protocol: "tests",
  59715. fn: function (){
  59716. var self=this,$self=this;
  59717. return $core.withContext(function($ctx1) {
  59718. var $1,$2;
  59719. $1=(5)._sign();
  59720. $ctx1.sendIdx["sign"]=1;
  59721. $self._assert_equals_($1,(1));
  59722. $ctx1.sendIdx["assert:equals:"]=1;
  59723. $2=(0)._sign();
  59724. $ctx1.sendIdx["sign"]=2;
  59725. $self._assert_equals_($2,(0));
  59726. $ctx1.sendIdx["assert:equals:"]=2;
  59727. $self._assert_equals_((-1.4)._sign(),(-1));
  59728. return self;
  59729. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  59730. },
  59731. args: [],
  59732. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  59733. referencedClasses: [],
  59734. messageSends: ["assert:equals:", "sign"]
  59735. }),
  59736. $globals.NumberTest);
  59737. $core.addMethod(
  59738. $core.method({
  59739. selector: "testSqrt",
  59740. protocol: "tests",
  59741. fn: function (){
  59742. var self=this,$self=this;
  59743. return $core.withContext(function($ctx1) {
  59744. var $1;
  59745. $1=(4)._sqrt();
  59746. $ctx1.sendIdx["sqrt"]=1;
  59747. $self._assert_equals_($1,(2));
  59748. $ctx1.sendIdx["assert:equals:"]=1;
  59749. $self._assert_equals_((16)._sqrt(),(4));
  59750. return self;
  59751. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  59752. },
  59753. args: [],
  59754. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  59755. referencedClasses: [],
  59756. messageSends: ["assert:equals:", "sqrt"]
  59757. }),
  59758. $globals.NumberTest);
  59759. $core.addMethod(
  59760. $core.method({
  59761. selector: "testSquared",
  59762. protocol: "tests",
  59763. fn: function (){
  59764. var self=this,$self=this;
  59765. return $core.withContext(function($ctx1) {
  59766. $self._assert_equals_((4)._squared(),(16));
  59767. return self;
  59768. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  59769. },
  59770. args: [],
  59771. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  59772. referencedClasses: [],
  59773. messageSends: ["assert:equals:", "squared"]
  59774. }),
  59775. $globals.NumberTest);
  59776. $core.addMethod(
  59777. $core.method({
  59778. selector: "testTimesRepeat",
  59779. protocol: "tests",
  59780. fn: function (){
  59781. var self=this,$self=this;
  59782. var i;
  59783. return $core.withContext(function($ctx1) {
  59784. i=(0);
  59785. (0)._timesRepeat_((function(){
  59786. return $core.withContext(function($ctx2) {
  59787. i=$recv(i).__plus((1));
  59788. $ctx2.sendIdx["+"]=1;
  59789. return i;
  59790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59791. }));
  59792. $ctx1.sendIdx["timesRepeat:"]=1;
  59793. $self._assert_equals_(i,(0));
  59794. $ctx1.sendIdx["assert:equals:"]=1;
  59795. (5)._timesRepeat_((function(){
  59796. return $core.withContext(function($ctx2) {
  59797. i=$recv(i).__plus((1));
  59798. return i;
  59799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59800. }));
  59801. $self._assert_equals_(i,(5));
  59802. return self;
  59803. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  59804. },
  59805. args: [],
  59806. 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",
  59807. referencedClasses: [],
  59808. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  59809. }),
  59810. $globals.NumberTest);
  59811. $core.addMethod(
  59812. $core.method({
  59813. selector: "testTo",
  59814. protocol: "tests",
  59815. fn: function (){
  59816. var self=this,$self=this;
  59817. return $core.withContext(function($ctx1) {
  59818. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  59819. return self;
  59820. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  59821. },
  59822. args: [],
  59823. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  59824. referencedClasses: [],
  59825. messageSends: ["assert:equals:", "to:"]
  59826. }),
  59827. $globals.NumberTest);
  59828. $core.addMethod(
  59829. $core.method({
  59830. selector: "testToBy",
  59831. protocol: "tests",
  59832. fn: function (){
  59833. var self=this,$self=this;
  59834. return $core.withContext(function($ctx1) {
  59835. var $1;
  59836. $1=(0)._to_by_((6),(2));
  59837. $ctx1.sendIdx["to:by:"]=1;
  59838. $self._assert_equals_($1,[(0), (2), (4), (6)]);
  59839. $self._should_raise_((function(){
  59840. return $core.withContext(function($ctx2) {
  59841. return (1)._to_by_((4),(0));
  59842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59843. }),$globals.Error);
  59844. return self;
  59845. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  59846. },
  59847. args: [],
  59848. 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",
  59849. referencedClasses: ["Error"],
  59850. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  59851. }),
  59852. $globals.NumberTest);
  59853. $core.addMethod(
  59854. $core.method({
  59855. selector: "testTrigonometry",
  59856. protocol: "tests",
  59857. fn: function (){
  59858. var self=this,$self=this;
  59859. return $core.withContext(function($ctx1) {
  59860. var $1;
  59861. $self._assert_equals_((0)._cos(),(1));
  59862. $ctx1.sendIdx["assert:equals:"]=1;
  59863. $self._assert_equals_((0)._sin(),(0));
  59864. $ctx1.sendIdx["assert:equals:"]=2;
  59865. $self._assert_equals_((0)._tan(),(0));
  59866. $ctx1.sendIdx["assert:equals:"]=3;
  59867. $self._assert_equals_((1)._arcCos(),(0));
  59868. $ctx1.sendIdx["assert:equals:"]=4;
  59869. $self._assert_equals_((0)._arcSin(),(0));
  59870. $ctx1.sendIdx["assert:equals:"]=5;
  59871. $self._assert_equals_((0)._arcTan(),(0));
  59872. $ctx1.sendIdx["assert:equals:"]=6;
  59873. $1=(0)._arcTan_((1));
  59874. $ctx1.sendIdx["arcTan:"]=1;
  59875. $self._assert_equals_($1,(0));
  59876. $ctx1.sendIdx["assert:equals:"]=7;
  59877. $self._assert_equals_((1)._arcTan_((0)),$recv($recv($globals.Number)._pi()).__slash((2)));
  59878. return self;
  59879. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  59880. },
  59881. args: [],
  59882. 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)",
  59883. referencedClasses: ["Number"],
  59884. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan", "arcTan:", "/", "pi"]
  59885. }),
  59886. $globals.NumberTest);
  59887. $core.addMethod(
  59888. $core.method({
  59889. selector: "testTruncated",
  59890. protocol: "tests",
  59891. fn: function (){
  59892. var self=this,$self=this;
  59893. return $core.withContext(function($ctx1) {
  59894. var $1,$2;
  59895. $1=(3)._truncated();
  59896. $ctx1.sendIdx["truncated"]=1;
  59897. $self._assert_equals_($1,(3));
  59898. $ctx1.sendIdx["assert:equals:"]=1;
  59899. $2=(3.212)._truncated();
  59900. $ctx1.sendIdx["truncated"]=2;
  59901. $self._assert_equals_($2,(3));
  59902. $ctx1.sendIdx["assert:equals:"]=2;
  59903. $self._assert_equals_((3.51)._truncated(),(3));
  59904. return self;
  59905. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  59906. },
  59907. args: [],
  59908. 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",
  59909. referencedClasses: [],
  59910. messageSends: ["assert:equals:", "truncated"]
  59911. }),
  59912. $globals.NumberTest);
  59913. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  59914. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  59915. $core.addMethod(
  59916. $core.method({
  59917. selector: "foo",
  59918. protocol: "not yet classified",
  59919. fn: function (){
  59920. var self=this,$self=this;
  59921. return $self.foo;
  59922. },
  59923. args: [],
  59924. source: "foo\x0a\x09^ foo",
  59925. referencedClasses: [],
  59926. messageSends: []
  59927. }),
  59928. $globals.ObjectMock);
  59929. $core.addMethod(
  59930. $core.method({
  59931. selector: "foo:",
  59932. protocol: "not yet classified",
  59933. fn: function (anObject){
  59934. var self=this,$self=this;
  59935. $self.foo=anObject;
  59936. return self;
  59937. },
  59938. args: ["anObject"],
  59939. source: "foo: anObject\x0a\x09foo := anObject",
  59940. referencedClasses: [],
  59941. messageSends: []
  59942. }),
  59943. $globals.ObjectMock);
  59944. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  59945. $core.addMethod(
  59946. $core.method({
  59947. selector: "notDefined",
  59948. protocol: "tests",
  59949. fn: function (){
  59950. var self=this,$self=this;
  59951. return $core.withContext(function($ctx1) {
  59952. return void 0;;
  59953. return self;
  59954. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  59955. },
  59956. args: [],
  59957. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  59958. referencedClasses: [],
  59959. messageSends: []
  59960. }),
  59961. $globals.ObjectTest);
  59962. $core.addMethod(
  59963. $core.method({
  59964. selector: "testBasicAccess",
  59965. protocol: "tests",
  59966. fn: function (){
  59967. var self=this,$self=this;
  59968. var o;
  59969. return $core.withContext(function($ctx1) {
  59970. var $1;
  59971. o=$recv($globals.Object)._new();
  59972. $recv(o)._basicAt_put_("a",(1));
  59973. $1=$recv(o)._basicAt_("a");
  59974. $ctx1.sendIdx["basicAt:"]=1;
  59975. $self._assert_equals_($1,(1));
  59976. $ctx1.sendIdx["assert:equals:"]=1;
  59977. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  59978. return self;
  59979. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  59980. },
  59981. args: [],
  59982. 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",
  59983. referencedClasses: ["Object"],
  59984. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  59985. }),
  59986. $globals.ObjectTest);
  59987. $core.addMethod(
  59988. $core.method({
  59989. selector: "testBasicPerform",
  59990. protocol: "tests",
  59991. fn: function (){
  59992. var self=this,$self=this;
  59993. var o;
  59994. return $core.withContext(function($ctx1) {
  59995. o=$recv($globals.Object)._new();
  59996. $recv(o)._basicAt_put_("func",(function(){
  59997. return "hello";
  59998. }));
  59999. $ctx1.sendIdx["basicAt:put:"]=1;
  60000. $recv(o)._basicAt_put_("func2",(function(a){
  60001. return $core.withContext(function($ctx2) {
  60002. return $recv(a).__plus((1));
  60003. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  60004. }));
  60005. $self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  60006. $ctx1.sendIdx["assert:equals:"]=1;
  60007. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  60008. return self;
  60009. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  60010. },
  60011. args: [],
  60012. 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",
  60013. referencedClasses: ["Object"],
  60014. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  60015. }),
  60016. $globals.ObjectTest);
  60017. $core.addMethod(
  60018. $core.method({
  60019. selector: "testDNU",
  60020. protocol: "tests",
  60021. fn: function (){
  60022. var self=this,$self=this;
  60023. return $core.withContext(function($ctx1) {
  60024. $self._should_raise_((function(){
  60025. return $core.withContext(function($ctx2) {
  60026. return $recv($recv($globals.Object)._new())._foo();
  60027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60028. }),$globals.MessageNotUnderstood);
  60029. return self;
  60030. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  60031. },
  60032. args: [],
  60033. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  60034. referencedClasses: ["Object", "MessageNotUnderstood"],
  60035. messageSends: ["should:raise:", "foo", "new"]
  60036. }),
  60037. $globals.ObjectTest);
  60038. $core.addMethod(
  60039. $core.method({
  60040. selector: "testEquality",
  60041. protocol: "tests",
  60042. fn: function (){
  60043. var self=this,$self=this;
  60044. var o;
  60045. return $core.withContext(function($ctx1) {
  60046. var $1,$2,$4,$3;
  60047. o=$recv($globals.Object)._new();
  60048. $ctx1.sendIdx["new"]=1;
  60049. $1=$recv(o).__eq($recv($globals.Object)._new());
  60050. $ctx1.sendIdx["="]=1;
  60051. $self._deny_($1);
  60052. $2=$recv(o).__eq(o);
  60053. $ctx1.sendIdx["="]=2;
  60054. $self._assert_($2);
  60055. $ctx1.sendIdx["assert:"]=1;
  60056. $4=$recv(o)._yourself();
  60057. $ctx1.sendIdx["yourself"]=1;
  60058. $3=$recv($4).__eq(o);
  60059. $ctx1.sendIdx["="]=3;
  60060. $self._assert_($3);
  60061. $ctx1.sendIdx["assert:"]=2;
  60062. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  60063. return self;
  60064. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  60065. },
  60066. args: [],
  60067. 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)",
  60068. referencedClasses: ["Object"],
  60069. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  60070. }),
  60071. $globals.ObjectTest);
  60072. $core.addMethod(
  60073. $core.method({
  60074. selector: "testHalt",
  60075. protocol: "tests",
  60076. fn: function (){
  60077. var self=this,$self=this;
  60078. return $core.withContext(function($ctx1) {
  60079. $self._should_raise_((function(){
  60080. return $core.withContext(function($ctx2) {
  60081. return $recv($recv($globals.Object)._new())._halt();
  60082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60083. }),$globals.Error);
  60084. return self;
  60085. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  60086. },
  60087. args: [],
  60088. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  60089. referencedClasses: ["Object", "Error"],
  60090. messageSends: ["should:raise:", "halt", "new"]
  60091. }),
  60092. $globals.ObjectTest);
  60093. $core.addMethod(
  60094. $core.method({
  60095. selector: "testIdentity",
  60096. protocol: "tests",
  60097. fn: function (){
  60098. var self=this,$self=this;
  60099. var o;
  60100. return $core.withContext(function($ctx1) {
  60101. var $1,$2,$4,$3;
  60102. o=$recv($globals.Object)._new();
  60103. $ctx1.sendIdx["new"]=1;
  60104. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  60105. $ctx1.sendIdx["=="]=1;
  60106. $self._deny_($1);
  60107. $2=$recv(o).__eq_eq(o);
  60108. $ctx1.sendIdx["=="]=2;
  60109. $self._assert_($2);
  60110. $ctx1.sendIdx["assert:"]=1;
  60111. $4=$recv(o)._yourself();
  60112. $ctx1.sendIdx["yourself"]=1;
  60113. $3=$recv($4).__eq_eq(o);
  60114. $ctx1.sendIdx["=="]=3;
  60115. $self._assert_($3);
  60116. $ctx1.sendIdx["assert:"]=2;
  60117. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  60118. return self;
  60119. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  60120. },
  60121. args: [],
  60122. 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",
  60123. referencedClasses: ["Object"],
  60124. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  60125. }),
  60126. $globals.ObjectTest);
  60127. $core.addMethod(
  60128. $core.method({
  60129. selector: "testIfNil",
  60130. protocol: "tests",
  60131. fn: function (){
  60132. var self=this,$self=this;
  60133. return $core.withContext(function($ctx1) {
  60134. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  60135. $2=$recv($globals.Object)._new();
  60136. $ctx1.sendIdx["new"]=1;
  60137. $1=$recv($2)._isNil();
  60138. $self._deny_($1);
  60139. $ctx1.sendIdx["deny:"]=1;
  60140. $5=$recv($globals.Object)._new();
  60141. $ctx1.sendIdx["new"]=2;
  60142. if(($receiver = $5) == null || $receiver.a$nil){
  60143. $4=true;
  60144. } else {
  60145. $4=$5;
  60146. }
  60147. $3=$recv($4).__eq(true);
  60148. $self._deny_($3);
  60149. $7=$recv($globals.Object)._new();
  60150. $ctx1.sendIdx["new"]=3;
  60151. if(($receiver = $7) == null || $receiver.a$nil){
  60152. $6=$7;
  60153. } else {
  60154. $6=true;
  60155. }
  60156. $self._assert_equals_($6,true);
  60157. $ctx1.sendIdx["assert:equals:"]=1;
  60158. $9=$recv($globals.Object)._new();
  60159. $ctx1.sendIdx["new"]=4;
  60160. if(($receiver = $9) == null || $receiver.a$nil){
  60161. $8=false;
  60162. } else {
  60163. $8=true;
  60164. }
  60165. $self._assert_equals_($8,true);
  60166. $ctx1.sendIdx["assert:equals:"]=2;
  60167. $11=$recv($globals.Object)._new();
  60168. if(($receiver = $11) == null || $receiver.a$nil){
  60169. $10=false;
  60170. } else {
  60171. $10=true;
  60172. }
  60173. $self._assert_equals_($10,true);
  60174. return self;
  60175. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  60176. },
  60177. args: [],
  60178. 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",
  60179. referencedClasses: ["Object"],
  60180. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  60181. }),
  60182. $globals.ObjectTest);
  60183. $core.addMethod(
  60184. $core.method({
  60185. selector: "testInstVars",
  60186. protocol: "tests",
  60187. fn: function (){
  60188. var self=this,$self=this;
  60189. var o;
  60190. return $core.withContext(function($ctx1) {
  60191. var $1,$2;
  60192. o=$recv($globals.ObjectMock)._new();
  60193. $1=$recv(o)._instVarAt_("foo");
  60194. $ctx1.sendIdx["instVarAt:"]=1;
  60195. $self._assert_equals_($1,nil);
  60196. $ctx1.sendIdx["assert:equals:"]=1;
  60197. $recv(o)._instVarAt_put_("foo",(1));
  60198. $2=$recv(o)._instVarAt_("foo");
  60199. $ctx1.sendIdx["instVarAt:"]=2;
  60200. $self._assert_equals_($2,(1));
  60201. $ctx1.sendIdx["assert:equals:"]=2;
  60202. $self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  60203. return self;
  60204. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  60205. },
  60206. args: [],
  60207. 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",
  60208. referencedClasses: ["ObjectMock"],
  60209. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  60210. }),
  60211. $globals.ObjectTest);
  60212. $core.addMethod(
  60213. $core.method({
  60214. selector: "testNilUndefined",
  60215. protocol: "tests",
  60216. fn: function (){
  60217. var self=this,$self=this;
  60218. return $core.withContext(function($ctx1) {
  60219. $self._assert_equals_($self._notDefined(),nil);
  60220. return self;
  60221. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  60222. },
  60223. args: [],
  60224. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  60225. referencedClasses: [],
  60226. messageSends: ["assert:equals:", "notDefined"]
  60227. }),
  60228. $globals.ObjectTest);
  60229. $core.addMethod(
  60230. $core.method({
  60231. selector: "testYourself",
  60232. protocol: "tests",
  60233. fn: function (){
  60234. var self=this,$self=this;
  60235. var o;
  60236. return $core.withContext(function($ctx1) {
  60237. o=$recv($globals.ObjectMock)._new();
  60238. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  60239. return self;
  60240. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  60241. },
  60242. args: [],
  60243. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  60244. referencedClasses: ["ObjectMock"],
  60245. messageSends: ["new", "assert:", "==", "yourself"]
  60246. }),
  60247. $globals.ObjectTest);
  60248. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  60249. $core.addMethod(
  60250. $core.method({
  60251. selector: "testAccessing",
  60252. protocol: "tests",
  60253. fn: function (){
  60254. var self=this,$self=this;
  60255. return $core.withContext(function($ctx1) {
  60256. var $2,$1,$3,$6,$5,$4;
  60257. $2=$recv($globals.Point)._x_y_((3),(4));
  60258. $ctx1.sendIdx["x:y:"]=1;
  60259. $1=$recv($2)._x();
  60260. $ctx1.sendIdx["x"]=1;
  60261. $self._assert_equals_($1,(3));
  60262. $ctx1.sendIdx["assert:equals:"]=1;
  60263. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  60264. $ctx1.sendIdx["y"]=1;
  60265. $self._assert_equals_($3,(4));
  60266. $ctx1.sendIdx["assert:equals:"]=2;
  60267. $6=$recv($globals.Point)._new();
  60268. $ctx1.sendIdx["new"]=1;
  60269. $5=$recv($6)._x_((3));
  60270. $4=$recv($5)._x();
  60271. $self._assert_equals_($4,(3));
  60272. $ctx1.sendIdx["assert:equals:"]=3;
  60273. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  60274. return self;
  60275. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  60276. },
  60277. args: [],
  60278. 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",
  60279. referencedClasses: ["Point"],
  60280. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  60281. }),
  60282. $globals.PointTest);
  60283. $core.addMethod(
  60284. $core.method({
  60285. selector: "testAngle",
  60286. protocol: "tests",
  60287. fn: function (){
  60288. var self=this,$self=this;
  60289. return $core.withContext(function($ctx1) {
  60290. $self._assert_equals_($recv((-1).__at((0)))._angle(),$recv($globals.Number)._pi());
  60291. return self;
  60292. }, function($ctx1) {$ctx1.fill(self,"testAngle",{},$globals.PointTest)});
  60293. },
  60294. args: [],
  60295. source: "testAngle\x0a\x09self assert: (-1@0) angle equals: Number pi",
  60296. referencedClasses: ["Number"],
  60297. messageSends: ["assert:equals:", "angle", "@", "pi"]
  60298. }),
  60299. $globals.PointTest);
  60300. $core.addMethod(
  60301. $core.method({
  60302. selector: "testArithmetic",
  60303. protocol: "tests",
  60304. fn: function (){
  60305. var self=this,$self=this;
  60306. return $core.withContext(function($ctx1) {
  60307. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  60308. $2=(3).__at((4));
  60309. $ctx1.sendIdx["@"]=1;
  60310. $3=(3).__at((4));
  60311. $ctx1.sendIdx["@"]=2;
  60312. $1=$recv($2).__star($3);
  60313. $4=$recv($globals.Point)._x_y_((9),(16));
  60314. $ctx1.sendIdx["x:y:"]=1;
  60315. $self._assert_equals_($1,$4);
  60316. $ctx1.sendIdx["assert:equals:"]=1;
  60317. $6=(3).__at((4));
  60318. $ctx1.sendIdx["@"]=3;
  60319. $7=(3).__at((4));
  60320. $ctx1.sendIdx["@"]=4;
  60321. $5=$recv($6).__plus($7);
  60322. $8=$recv($globals.Point)._x_y_((6),(8));
  60323. $ctx1.sendIdx["x:y:"]=2;
  60324. $self._assert_equals_($5,$8);
  60325. $ctx1.sendIdx["assert:equals:"]=2;
  60326. $10=(3).__at((4));
  60327. $ctx1.sendIdx["@"]=5;
  60328. $11=(3).__at((4));
  60329. $ctx1.sendIdx["@"]=6;
  60330. $9=$recv($10).__minus($11);
  60331. $12=$recv($globals.Point)._x_y_((0),(0));
  60332. $ctx1.sendIdx["x:y:"]=3;
  60333. $self._assert_equals_($9,$12);
  60334. $ctx1.sendIdx["assert:equals:"]=3;
  60335. $14=(6).__at((8));
  60336. $ctx1.sendIdx["@"]=7;
  60337. $13=$recv($14).__slash((3).__at((4)));
  60338. $self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  60339. return self;
  60340. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  60341. },
  60342. args: [],
  60343. 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)",
  60344. referencedClasses: ["Point"],
  60345. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  60346. }),
  60347. $globals.PointTest);
  60348. $core.addMethod(
  60349. $core.method({
  60350. selector: "testAt",
  60351. protocol: "tests",
  60352. fn: function (){
  60353. var self=this,$self=this;
  60354. return $core.withContext(function($ctx1) {
  60355. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  60356. return self;
  60357. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  60358. },
  60359. args: [],
  60360. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  60361. referencedClasses: ["Point"],
  60362. messageSends: ["assert:equals:", "@", "x:y:"]
  60363. }),
  60364. $globals.PointTest);
  60365. $core.addMethod(
  60366. $core.method({
  60367. selector: "testComparison",
  60368. protocol: "tests",
  60369. fn: function (){
  60370. var self=this,$self=this;
  60371. return $core.withContext(function($ctx1) {
  60372. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  60373. $2=(3).__at((4));
  60374. $ctx1.sendIdx["@"]=1;
  60375. $3=(4).__at((5));
  60376. $ctx1.sendIdx["@"]=2;
  60377. $1=$recv($2).__lt($3);
  60378. $ctx1.sendIdx["<"]=1;
  60379. $self._assert_($1);
  60380. $ctx1.sendIdx["assert:"]=1;
  60381. $5=(3).__at((4));
  60382. $ctx1.sendIdx["@"]=3;
  60383. $6=(4).__at((4));
  60384. $ctx1.sendIdx["@"]=4;
  60385. $4=$recv($5).__lt($6);
  60386. $self._deny_($4);
  60387. $ctx1.sendIdx["deny:"]=1;
  60388. $8=(4).__at((5));
  60389. $ctx1.sendIdx["@"]=5;
  60390. $9=(4).__at((5));
  60391. $ctx1.sendIdx["@"]=6;
  60392. $7=$recv($8).__lt_eq($9);
  60393. $ctx1.sendIdx["<="]=1;
  60394. $self._assert_($7);
  60395. $ctx1.sendIdx["assert:"]=2;
  60396. $11=(4).__at((5));
  60397. $ctx1.sendIdx["@"]=7;
  60398. $12=(3).__at((5));
  60399. $ctx1.sendIdx["@"]=8;
  60400. $10=$recv($11).__lt_eq($12);
  60401. $self._deny_($10);
  60402. $ctx1.sendIdx["deny:"]=2;
  60403. $14=(5).__at((6));
  60404. $ctx1.sendIdx["@"]=9;
  60405. $15=(4).__at((5));
  60406. $ctx1.sendIdx["@"]=10;
  60407. $13=$recv($14).__gt($15);
  60408. $ctx1.sendIdx[">"]=1;
  60409. $self._assert_($13);
  60410. $ctx1.sendIdx["assert:"]=3;
  60411. $17=(5).__at((6));
  60412. $ctx1.sendIdx["@"]=11;
  60413. $18=(6).__at((6));
  60414. $ctx1.sendIdx["@"]=12;
  60415. $16=$recv($17).__gt($18);
  60416. $self._deny_($16);
  60417. $ctx1.sendIdx["deny:"]=3;
  60418. $20=(4).__at((5));
  60419. $ctx1.sendIdx["@"]=13;
  60420. $21=(4).__at((5));
  60421. $ctx1.sendIdx["@"]=14;
  60422. $19=$recv($20).__gt_eq($21);
  60423. $ctx1.sendIdx[">="]=1;
  60424. $self._assert_($19);
  60425. $23=(4).__at((5));
  60426. $ctx1.sendIdx["@"]=15;
  60427. $22=$recv($23).__gt_eq((5).__at((5)));
  60428. $self._deny_($22);
  60429. return self;
  60430. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  60431. },
  60432. args: [],
  60433. 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)",
  60434. referencedClasses: [],
  60435. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  60436. }),
  60437. $globals.PointTest);
  60438. $core.addMethod(
  60439. $core.method({
  60440. selector: "testDotProduct",
  60441. protocol: "tests",
  60442. fn: function (){
  60443. var self=this,$self=this;
  60444. return $core.withContext(function($ctx1) {
  60445. var $2,$1;
  60446. $2=(2).__at((3));
  60447. $ctx1.sendIdx["@"]=1;
  60448. $1=$recv($2)._dotProduct_((3).__at((7)));
  60449. $self._assert_equals_($1,(27));
  60450. return self;
  60451. }, function($ctx1) {$ctx1.fill(self,"testDotProduct",{},$globals.PointTest)});
  60452. },
  60453. args: [],
  60454. source: "testDotProduct\x0a\x09self assert: (2@3 dotProduct: 3@7) equals: 27",
  60455. referencedClasses: [],
  60456. messageSends: ["assert:equals:", "dotProduct:", "@"]
  60457. }),
  60458. $globals.PointTest);
  60459. $core.addMethod(
  60460. $core.method({
  60461. selector: "testEgality",
  60462. protocol: "tests",
  60463. fn: function (){
  60464. var self=this,$self=this;
  60465. return $core.withContext(function($ctx1) {
  60466. var $2,$3,$1,$5,$4;
  60467. $2=(3).__at((4));
  60468. $ctx1.sendIdx["@"]=1;
  60469. $3=(3).__at((4));
  60470. $ctx1.sendIdx["@"]=2;
  60471. $1=$recv($2).__eq($3);
  60472. $ctx1.sendIdx["="]=1;
  60473. $self._assert_($1);
  60474. $5=(3).__at((5));
  60475. $ctx1.sendIdx["@"]=3;
  60476. $4=$recv($5).__eq((3).__at((6)));
  60477. $self._deny_($4);
  60478. return self;
  60479. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  60480. },
  60481. args: [],
  60482. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  60483. referencedClasses: [],
  60484. messageSends: ["assert:", "=", "@", "deny:"]
  60485. }),
  60486. $globals.PointTest);
  60487. $core.addMethod(
  60488. $core.method({
  60489. selector: "testNew",
  60490. protocol: "tests",
  60491. fn: function (){
  60492. var self=this,$self=this;
  60493. return $core.withContext(function($ctx1) {
  60494. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  60495. $3=$recv($globals.Point)._new();
  60496. $ctx1.sendIdx["new"]=1;
  60497. $2=$recv($3)._x_((3));
  60498. $ctx1.sendIdx["x:"]=1;
  60499. $1=$recv($2)._y();
  60500. $ctx1.sendIdx["y"]=1;
  60501. $self._assert_equals_($1,nil);
  60502. $ctx1.sendIdx["assert:equals:"]=1;
  60503. $7=$recv($globals.Point)._new();
  60504. $ctx1.sendIdx["new"]=2;
  60505. $6=$recv($7)._x_((3));
  60506. $5=$recv($6)._x();
  60507. $ctx1.sendIdx["x"]=1;
  60508. $4=$recv($5).__eq((0));
  60509. $ctx1.sendIdx["="]=1;
  60510. $self._deny_($4);
  60511. $ctx1.sendIdx["deny:"]=1;
  60512. $10=$recv($globals.Point)._new();
  60513. $ctx1.sendIdx["new"]=3;
  60514. $9=$recv($10)._y_((4));
  60515. $ctx1.sendIdx["y:"]=1;
  60516. $8=$recv($9)._x();
  60517. $self._assert_equals_($8,nil);
  60518. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  60519. return self;
  60520. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  60521. },
  60522. args: [],
  60523. 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",
  60524. referencedClasses: ["Point"],
  60525. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  60526. }),
  60527. $globals.PointTest);
  60528. $core.addMethod(
  60529. $core.method({
  60530. selector: "testNormal",
  60531. protocol: "tests",
  60532. fn: function (){
  60533. var self=this,$self=this;
  60534. return $core.withContext(function($ctx1) {
  60535. var $2,$1;
  60536. $2=(1).__at((0));
  60537. $ctx1.sendIdx["@"]=1;
  60538. $1=$recv($2)._normal();
  60539. $self._assert_equals_($1,(0).__at((1)));
  60540. return self;
  60541. }, function($ctx1) {$ctx1.fill(self,"testNormal",{},$globals.PointTest)});
  60542. },
  60543. args: [],
  60544. source: "testNormal\x0a\x09self assert: (1@0) normal equals: 0@1",
  60545. referencedClasses: [],
  60546. messageSends: ["assert:equals:", "normal", "@"]
  60547. }),
  60548. $globals.PointTest);
  60549. $core.addMethod(
  60550. $core.method({
  60551. selector: "testNormalized",
  60552. protocol: "tests",
  60553. fn: function (){
  60554. var self=this,$self=this;
  60555. return $core.withContext(function($ctx1) {
  60556. var $2,$1,$3,$5,$4;
  60557. $2=(0).__at((2));
  60558. $ctx1.sendIdx["@"]=1;
  60559. $1=$recv($2)._normalized();
  60560. $ctx1.sendIdx["normalized"]=1;
  60561. $3=(0).__at((1));
  60562. $ctx1.sendIdx["@"]=2;
  60563. $self._assert_equals_($1,$3);
  60564. $ctx1.sendIdx["assert:equals:"]=1;
  60565. $5=(0).__at((0));
  60566. $ctx1.sendIdx["@"]=3;
  60567. $4=$recv($5)._normalized();
  60568. $self._assert_equals_($4,(0).__at((0)));
  60569. return self;
  60570. }, function($ctx1) {$ctx1.fill(self,"testNormalized",{},$globals.PointTest)});
  60571. },
  60572. args: [],
  60573. source: "testNormalized\x0a\x09self assert: (0@2) normalized equals: 0@1.\x0a\x09self assert: (0@0) normalized equals: 0@0.",
  60574. referencedClasses: [],
  60575. messageSends: ["assert:equals:", "normalized", "@"]
  60576. }),
  60577. $globals.PointTest);
  60578. $core.addMethod(
  60579. $core.method({
  60580. selector: "testPolarCoordinates",
  60581. protocol: "tests",
  60582. fn: function (){
  60583. var self=this,$self=this;
  60584. return $core.withContext(function($ctx1) {
  60585. var $2,$1;
  60586. $2=(1).__at((0));
  60587. $ctx1.sendIdx["@"]=1;
  60588. $1=$recv($2)._r();
  60589. $ctx1.sendIdx["r"]=1;
  60590. $self._assert_equals_($1,(1));
  60591. $ctx1.sendIdx["assert:equals:"]=1;
  60592. $self._assert_equals_($recv((0).__at((0)))._r(),(0));
  60593. return self;
  60594. }, function($ctx1) {$ctx1.fill(self,"testPolarCoordinates",{},$globals.PointTest)});
  60595. },
  60596. args: [],
  60597. source: "testPolarCoordinates\x0a\x09self assert: (1@0) r equals: 1.\x0a\x09self assert: (0@0) r equals: 0.",
  60598. referencedClasses: [],
  60599. messageSends: ["assert:equals:", "r", "@"]
  60600. }),
  60601. $globals.PointTest);
  60602. $core.addMethod(
  60603. $core.method({
  60604. selector: "testRectangleCreation",
  60605. protocol: "tests",
  60606. fn: function (){
  60607. var self=this,$self=this;
  60608. return $core.withContext(function($ctx1) {
  60609. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$16;
  60610. $2=(1).__at((1));
  60611. $ctx1.sendIdx["@"]=1;
  60612. $3=(2).__at((2));
  60613. $ctx1.sendIdx["@"]=2;
  60614. $1=$recv($2)._corner_($3);
  60615. $5=(1).__at((1));
  60616. $ctx1.sendIdx["@"]=3;
  60617. $6=(2).__at((2));
  60618. $ctx1.sendIdx["@"]=4;
  60619. $4=$recv($globals.Rectangle)._origin_corner_($5,$6);
  60620. $self._assert_equals_($1,$4);
  60621. $ctx1.sendIdx["assert:equals:"]=1;
  60622. $8=(1).__at((1));
  60623. $ctx1.sendIdx["@"]=5;
  60624. $9=(2).__at((2));
  60625. $ctx1.sendIdx["@"]=6;
  60626. $7=$recv($8)._rectangle_($9);
  60627. $11=(1).__at((1));
  60628. $ctx1.sendIdx["@"]=7;
  60629. $12=(2).__at((2));
  60630. $ctx1.sendIdx["@"]=8;
  60631. $10=$recv($globals.Rectangle)._point_point_($11,$12);
  60632. $self._assert_equals_($7,$10);
  60633. $ctx1.sendIdx["assert:equals:"]=2;
  60634. $14=(1).__at((1));
  60635. $ctx1.sendIdx["@"]=9;
  60636. $15=(2).__at((2));
  60637. $ctx1.sendIdx["@"]=10;
  60638. $13=$recv($14)._extent_($15);
  60639. $17=(1).__at((1));
  60640. $ctx1.sendIdx["@"]=11;
  60641. $16=$recv($globals.Rectangle)._origin_extent_($17,(2).__at((2)));
  60642. $self._assert_equals_($13,$16);
  60643. return self;
  60644. }, function($ctx1) {$ctx1.fill(self,"testRectangleCreation",{},$globals.PointTest)});
  60645. },
  60646. args: [],
  60647. 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)",
  60648. referencedClasses: ["Rectangle"],
  60649. messageSends: ["assert:equals:", "corner:", "@", "origin:corner:", "rectangle:", "point:point:", "extent:", "origin:extent:"]
  60650. }),
  60651. $globals.PointTest);
  60652. $core.addMethod(
  60653. $core.method({
  60654. selector: "testTranslateBy",
  60655. protocol: "tests",
  60656. fn: function (){
  60657. var self=this,$self=this;
  60658. return $core.withContext(function($ctx1) {
  60659. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  60660. $2=(3).__at((3));
  60661. $ctx1.sendIdx["@"]=1;
  60662. $3=(0).__at((1));
  60663. $ctx1.sendIdx["@"]=2;
  60664. $1=$recv($2)._translateBy_($3);
  60665. $ctx1.sendIdx["translateBy:"]=1;
  60666. $4=(3).__at((4));
  60667. $ctx1.sendIdx["@"]=3;
  60668. $self._assert_equals_($1,$4);
  60669. $ctx1.sendIdx["assert:equals:"]=1;
  60670. $6=(3).__at((3));
  60671. $ctx1.sendIdx["@"]=4;
  60672. $8=(1)._negated();
  60673. $ctx1.sendIdx["negated"]=1;
  60674. $7=(0).__at($8);
  60675. $ctx1.sendIdx["@"]=5;
  60676. $5=$recv($6)._translateBy_($7);
  60677. $ctx1.sendIdx["translateBy:"]=2;
  60678. $9=(3).__at((2));
  60679. $ctx1.sendIdx["@"]=6;
  60680. $self._assert_equals_($5,$9);
  60681. $ctx1.sendIdx["assert:equals:"]=2;
  60682. $11=(3).__at((3));
  60683. $ctx1.sendIdx["@"]=7;
  60684. $12=(2).__at((3));
  60685. $ctx1.sendIdx["@"]=8;
  60686. $10=$recv($11)._translateBy_($12);
  60687. $ctx1.sendIdx["translateBy:"]=3;
  60688. $13=(5).__at((6));
  60689. $ctx1.sendIdx["@"]=9;
  60690. $self._assert_equals_($10,$13);
  60691. $ctx1.sendIdx["assert:equals:"]=3;
  60692. $15=(3).__at((3));
  60693. $ctx1.sendIdx["@"]=10;
  60694. $16=$recv((3)._negated()).__at((0));
  60695. $ctx1.sendIdx["@"]=11;
  60696. $14=$recv($15)._translateBy_($16);
  60697. $self._assert_equals_($14,(0).__at((3)));
  60698. return self;
  60699. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  60700. },
  60701. args: [],
  60702. 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.",
  60703. referencedClasses: [],
  60704. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  60705. }),
  60706. $globals.PointTest);
  60707. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  60708. $core.addMethod(
  60709. $core.method({
  60710. selector: "testNextIfAbsent",
  60711. protocol: "tests",
  60712. fn: function (){
  60713. var self=this,$self=this;
  60714. var queue;
  60715. return $core.withContext(function($ctx1) {
  60716. var $2,$1;
  60717. queue=$recv($globals.Queue)._new();
  60718. $recv(queue)._nextPut_("index1");
  60719. $2=$recv(queue)._nextIfAbsent_("empty");
  60720. $ctx1.sendIdx["nextIfAbsent:"]=1;
  60721. $1=$recv($2).__eq("index1");
  60722. $ctx1.sendIdx["="]=1;
  60723. $self._assert_($1);
  60724. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  60725. return self;
  60726. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  60727. },
  60728. args: [],
  60729. 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'",
  60730. referencedClasses: ["Queue"],
  60731. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  60732. }),
  60733. $globals.QueueTest);
  60734. $core.addMethod(
  60735. $core.method({
  60736. selector: "testQueueNext",
  60737. protocol: "tests",
  60738. fn: function (){
  60739. var self=this,$self=this;
  60740. var queue;
  60741. return $core.withContext(function($ctx1) {
  60742. var $1,$3,$2,$5,$4;
  60743. queue=$recv($globals.Queue)._new();
  60744. $1=queue;
  60745. $recv($1)._nextPut_("index1");
  60746. $ctx1.sendIdx["nextPut:"]=1;
  60747. $recv($1)._nextPut_("index2");
  60748. $3=$recv(queue)._next();
  60749. $ctx1.sendIdx["next"]=1;
  60750. $2=$recv($3).__eq("index1");
  60751. $ctx1.sendIdx["="]=1;
  60752. $self._assert_($2);
  60753. $5=$recv(queue)._next();
  60754. $ctx1.sendIdx["next"]=2;
  60755. $4=$recv($5).__eq("index");
  60756. $self._deny_($4);
  60757. $self._should_raise_((function(){
  60758. return $core.withContext(function($ctx2) {
  60759. return $recv(queue)._next();
  60760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60761. }),$globals.Error);
  60762. return self;
  60763. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  60764. },
  60765. args: [],
  60766. 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",
  60767. referencedClasses: ["Queue", "Error"],
  60768. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  60769. }),
  60770. $globals.QueueTest);
  60771. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  60772. $core.addMethod(
  60773. $core.method({
  60774. selector: "testAtRandomNumber",
  60775. protocol: "tests",
  60776. fn: function (){
  60777. var self=this,$self=this;
  60778. var val;
  60779. return $core.withContext(function($ctx1) {
  60780. (100)._timesRepeat_((function(){
  60781. return $core.withContext(function($ctx2) {
  60782. val=(10)._atRandom();
  60783. $self._assert_($recv(val).__gt((0)));
  60784. $ctx2.sendIdx["assert:"]=1;
  60785. return $self._assert_($recv(val).__lt((11)));
  60786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60787. }));
  60788. return self;
  60789. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  60790. },
  60791. args: [],
  60792. 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]",
  60793. referencedClasses: [],
  60794. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  60795. }),
  60796. $globals.RandomTest);
  60797. $core.addMethod(
  60798. $core.method({
  60799. selector: "testAtRandomSequenceableCollection",
  60800. protocol: "tests",
  60801. fn: function (){
  60802. var self=this,$self=this;
  60803. var val;
  60804. return $core.withContext(function($ctx1) {
  60805. var $3,$4,$2,$1;
  60806. (100)._timesRepeat_((function(){
  60807. return $core.withContext(function($ctx2) {
  60808. val="abc"._atRandom();
  60809. $3=$recv(val).__eq("a");
  60810. $ctx2.sendIdx["="]=1;
  60811. $4=$recv(val).__eq("b");
  60812. $ctx2.sendIdx["="]=2;
  60813. $2=$recv($3).__or($4);
  60814. $1=$recv($2).__or($recv(val).__eq("c"));
  60815. $ctx2.sendIdx["|"]=1;
  60816. return $self._assert_($1);
  60817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60818. }));
  60819. return self;
  60820. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  60821. },
  60822. args: [],
  60823. 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].",
  60824. referencedClasses: [],
  60825. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  60826. }),
  60827. $globals.RandomTest);
  60828. $core.addMethod(
  60829. $core.method({
  60830. selector: "textNext",
  60831. protocol: "tests",
  60832. fn: function (){
  60833. var self=this,$self=this;
  60834. return $core.withContext(function($ctx1) {
  60835. var $1;
  60836. (10000)._timesRepeat_((function(){
  60837. var current,next;
  60838. return $core.withContext(function($ctx2) {
  60839. next=$recv($recv($globals.Random)._new())._next();
  60840. $self._assert_($recv(next).__gt_eq((0)));
  60841. $ctx2.sendIdx["assert:"]=1;
  60842. $self._assert_($recv(next).__lt((1)));
  60843. $1=$recv(current).__eq(next);
  60844. $ctx2.sendIdx["="]=1;
  60845. $self._deny_($1);
  60846. return $recv(next).__eq(current);
  60847. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  60848. }));
  60849. return self;
  60850. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  60851. },
  60852. args: [],
  60853. 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 ]",
  60854. referencedClasses: ["Random"],
  60855. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  60856. }),
  60857. $globals.RandomTest);
  60858. $core.addClass("RectangleTest", $globals.TestCase, [], "Kernel-Tests");
  60859. $core.addMethod(
  60860. $core.method({
  60861. selector: "testContainsPoint",
  60862. protocol: "tests",
  60863. fn: function (){
  60864. var self=this,$self=this;
  60865. var rect;
  60866. return $core.withContext(function($ctx1) {
  60867. var $1,$2,$4,$5,$3;
  60868. $1=(0).__at((0));
  60869. $ctx1.sendIdx["@"]=1;
  60870. $2=(4).__at((4));
  60871. $ctx1.sendIdx["@"]=2;
  60872. rect=$recv($globals.Rectangle)._origin_corner_($1,$2);
  60873. $4=rect;
  60874. $5=(1).__at((2));
  60875. $ctx1.sendIdx["@"]=3;
  60876. $3=$recv($4)._containsPoint_($5);
  60877. $ctx1.sendIdx["containsPoint:"]=1;
  60878. $self._assert_($3);
  60879. $ctx1.sendIdx["assert:"]=1;
  60880. $self._assert_($recv($recv(rect)._containsPoint_((5).__at((4))))._not());
  60881. return self;
  60882. }, function($ctx1) {$ctx1.fill(self,"testContainsPoint",{rect:rect},$globals.RectangleTest)});
  60883. },
  60884. args: [],
  60885. 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.",
  60886. referencedClasses: ["Rectangle"],
  60887. messageSends: ["origin:corner:", "@", "assert:", "containsPoint:", "not"]
  60888. }),
  60889. $globals.RectangleTest);
  60890. $core.addMethod(
  60891. $core.method({
  60892. selector: "testContainsRect",
  60893. protocol: "tests",
  60894. fn: function (){
  60895. var self=this,$self=this;
  60896. return $core.withContext(function($ctx1) {
  60897. var $3,$4,$2,$6,$7,$5,$1,$11,$12,$10,$14,$13,$9,$8;
  60898. $3=(0).__at((0));
  60899. $ctx1.sendIdx["@"]=1;
  60900. $4=(6).__at((6));
  60901. $ctx1.sendIdx["@"]=2;
  60902. $2=$recv($globals.Rectangle)._origin_corner_($3,$4);
  60903. $ctx1.sendIdx["origin:corner:"]=1;
  60904. $6=(1).__at((1));
  60905. $ctx1.sendIdx["@"]=3;
  60906. $7=(5).__at((5));
  60907. $ctx1.sendIdx["@"]=4;
  60908. $5=$recv($globals.Rectangle)._origin_corner_($6,$7);
  60909. $ctx1.sendIdx["origin:corner:"]=2;
  60910. $1=$recv($2)._containsRect_($5);
  60911. $ctx1.sendIdx["containsRect:"]=1;
  60912. $self._assert_($1);
  60913. $ctx1.sendIdx["assert:"]=1;
  60914. $11=(0).__at((0));
  60915. $ctx1.sendIdx["@"]=5;
  60916. $12=(6).__at((6));
  60917. $ctx1.sendIdx["@"]=6;
  60918. $10=$recv($globals.Rectangle)._origin_corner_($11,$12);
  60919. $ctx1.sendIdx["origin:corner:"]=3;
  60920. $14=(1).__at((-1));
  60921. $ctx1.sendIdx["@"]=7;
  60922. $13=$recv($globals.Rectangle)._origin_corner_($14,(5).__at((5)));
  60923. $9=$recv($10)._containsRect_($13);
  60924. $8=$recv($9)._not();
  60925. $self._assert_($8);
  60926. return self;
  60927. }, function($ctx1) {$ctx1.fill(self,"testContainsRect",{},$globals.RectangleTest)});
  60928. },
  60929. args: [],
  60930. 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.",
  60931. referencedClasses: ["Rectangle"],
  60932. messageSends: ["assert:", "containsRect:", "origin:corner:", "@", "not"]
  60933. }),
  60934. $globals.RectangleTest);
  60935. $core.addMethod(
  60936. $core.method({
  60937. selector: "testOriginExtent",
  60938. protocol: "tests",
  60939. fn: function (){
  60940. var self=this,$self=this;
  60941. var rectangle;
  60942. return $core.withContext(function($ctx1) {
  60943. var $1,$2,$3,$4;
  60944. $1=(3).__at((4));
  60945. $ctx1.sendIdx["@"]=1;
  60946. $2=(7).__at((8));
  60947. $ctx1.sendIdx["@"]=2;
  60948. rectangle=$recv($globals.Rectangle)._origin_extent_($1,$2);
  60949. $3=$recv(rectangle)._origin();
  60950. $4=(3).__at((4));
  60951. $ctx1.sendIdx["@"]=3;
  60952. $self._assert_equals_($3,$4);
  60953. $ctx1.sendIdx["assert:equals:"]=1;
  60954. $self._assert_equals_($recv(rectangle)._corner(),(10).__at((12)));
  60955. return self;
  60956. }, function($ctx1) {$ctx1.fill(self,"testOriginExtent",{rectangle:rectangle},$globals.RectangleTest)});
  60957. },
  60958. args: [],
  60959. 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.",
  60960. referencedClasses: ["Rectangle"],
  60961. messageSends: ["origin:extent:", "@", "assert:equals:", "origin", "corner"]
  60962. }),
  60963. $globals.RectangleTest);
  60964. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  60965. $core.addMethod(
  60966. $core.method({
  60967. selector: "collectionClass",
  60968. protocol: "accessing",
  60969. fn: function (){
  60970. var self=this,$self=this;
  60971. return $core.withContext(function($ctx1) {
  60972. return $recv($self._class())._collectionClass();
  60973. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  60974. },
  60975. args: [],
  60976. source: "collectionClass\x0a\x09^ self class collectionClass",
  60977. referencedClasses: [],
  60978. messageSends: ["collectionClass", "class"]
  60979. }),
  60980. $globals.StreamTest);
  60981. $core.addMethod(
  60982. $core.method({
  60983. selector: "newCollection",
  60984. protocol: "accessing",
  60985. fn: function (){
  60986. var self=this,$self=this;
  60987. return $core.withContext(function($ctx1) {
  60988. return $recv($self._collectionClass())._new();
  60989. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  60990. },
  60991. args: [],
  60992. source: "newCollection\x0a\x09^ self collectionClass new",
  60993. referencedClasses: [],
  60994. messageSends: ["new", "collectionClass"]
  60995. }),
  60996. $globals.StreamTest);
  60997. $core.addMethod(
  60998. $core.method({
  60999. selector: "newStream",
  61000. protocol: "accessing",
  61001. fn: function (){
  61002. var self=this,$self=this;
  61003. return $core.withContext(function($ctx1) {
  61004. return $recv($recv($self._collectionClass())._new())._stream();
  61005. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  61006. },
  61007. args: [],
  61008. source: "newStream\x0a\x09^ self collectionClass new stream",
  61009. referencedClasses: [],
  61010. messageSends: ["stream", "new", "collectionClass"]
  61011. }),
  61012. $globals.StreamTest);
  61013. $core.addMethod(
  61014. $core.method({
  61015. selector: "testAtStartAtEnd",
  61016. protocol: "tests",
  61017. fn: function (){
  61018. var self=this,$self=this;
  61019. var stream;
  61020. return $core.withContext(function($ctx1) {
  61021. var $1,$2,$3,$4;
  61022. stream=$self._newStream();
  61023. $1=$recv(stream)._atStart();
  61024. $ctx1.sendIdx["atStart"]=1;
  61025. $self._assert_($1);
  61026. $ctx1.sendIdx["assert:"]=1;
  61027. $2=$recv(stream)._atEnd();
  61028. $ctx1.sendIdx["atEnd"]=1;
  61029. $self._assert_($2);
  61030. $ctx1.sendIdx["assert:"]=2;
  61031. $recv(stream)._nextPutAll_($self._newCollection());
  61032. $3=$recv(stream)._atEnd();
  61033. $ctx1.sendIdx["atEnd"]=2;
  61034. $self._assert_($3);
  61035. $4=$recv(stream)._atStart();
  61036. $ctx1.sendIdx["atStart"]=2;
  61037. $self._deny_($4);
  61038. $ctx1.sendIdx["deny:"]=1;
  61039. $recv(stream)._position_((1));
  61040. $self._deny_($recv(stream)._atEnd());
  61041. $ctx1.sendIdx["deny:"]=2;
  61042. $self._deny_($recv(stream)._atStart());
  61043. return self;
  61044. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  61045. },
  61046. args: [],
  61047. 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",
  61048. referencedClasses: [],
  61049. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  61050. }),
  61051. $globals.StreamTest);
  61052. $core.addMethod(
  61053. $core.method({
  61054. selector: "testContents",
  61055. protocol: "tests",
  61056. fn: function (){
  61057. var self=this,$self=this;
  61058. var stream;
  61059. return $core.withContext(function($ctx1) {
  61060. var $1,$2;
  61061. stream=$self._newStream();
  61062. $1=stream;
  61063. $2=$self._newCollection();
  61064. $ctx1.sendIdx["newCollection"]=1;
  61065. $recv($1)._nextPutAll_($2);
  61066. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  61067. return self;
  61068. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  61069. },
  61070. args: [],
  61071. 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",
  61072. referencedClasses: [],
  61073. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  61074. }),
  61075. $globals.StreamTest);
  61076. $core.addMethod(
  61077. $core.method({
  61078. selector: "testIsEmpty",
  61079. protocol: "tests",
  61080. fn: function (){
  61081. var self=this,$self=this;
  61082. var stream;
  61083. return $core.withContext(function($ctx1) {
  61084. var $1;
  61085. stream=$self._newStream();
  61086. $1=$recv(stream)._isEmpty();
  61087. $ctx1.sendIdx["isEmpty"]=1;
  61088. $self._assert_($1);
  61089. $recv(stream)._nextPutAll_($self._newCollection());
  61090. $self._deny_($recv(stream)._isEmpty());
  61091. return self;
  61092. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  61093. },
  61094. args: [],
  61095. 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",
  61096. referencedClasses: [],
  61097. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  61098. }),
  61099. $globals.StreamTest);
  61100. $core.addMethod(
  61101. $core.method({
  61102. selector: "testPosition",
  61103. protocol: "tests",
  61104. fn: function (){
  61105. var self=this,$self=this;
  61106. var collection,stream;
  61107. return $core.withContext(function($ctx1) {
  61108. var $1,$2,$3;
  61109. collection=$self._newCollection();
  61110. stream=$self._newStream();
  61111. $recv(stream)._nextPutAll_(collection);
  61112. $1=$recv(stream)._position();
  61113. $ctx1.sendIdx["position"]=1;
  61114. $self._assert_equals_($1,$recv(collection)._size());
  61115. $ctx1.sendIdx["assert:equals:"]=1;
  61116. $recv(stream)._position_((0));
  61117. $2=$recv(stream)._position();
  61118. $ctx1.sendIdx["position"]=2;
  61119. $self._assert_equals_($2,(0));
  61120. $ctx1.sendIdx["assert:equals:"]=2;
  61121. $recv(stream)._next();
  61122. $ctx1.sendIdx["next"]=1;
  61123. $3=$recv(stream)._position();
  61124. $ctx1.sendIdx["position"]=3;
  61125. $self._assert_equals_($3,(1));
  61126. $ctx1.sendIdx["assert:equals:"]=3;
  61127. $recv(stream)._next();
  61128. $self._assert_equals_($recv(stream)._position(),(2));
  61129. return self;
  61130. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  61131. },
  61132. args: [],
  61133. 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",
  61134. referencedClasses: [],
  61135. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  61136. }),
  61137. $globals.StreamTest);
  61138. $core.addMethod(
  61139. $core.method({
  61140. selector: "testReading",
  61141. protocol: "tests",
  61142. fn: function (){
  61143. var self=this,$self=this;
  61144. var stream,collection;
  61145. return $core.withContext(function($ctx1) {
  61146. var $1,$2;
  61147. collection=$self._newCollection();
  61148. stream=$self._newStream();
  61149. $1=stream;
  61150. $recv($1)._nextPutAll_(collection);
  61151. $recv($1)._position_((0));
  61152. $recv(collection)._do_((function(each){
  61153. return $core.withContext(function($ctx2) {
  61154. $2=$recv(stream)._next();
  61155. $ctx2.sendIdx["next"]=1;
  61156. return $self._assert_equals_($2,each);
  61157. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61158. }));
  61159. $self._assert_($recv($recv(stream)._next())._isNil());
  61160. return self;
  61161. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  61162. },
  61163. args: [],
  61164. 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",
  61165. referencedClasses: [],
  61166. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  61167. }),
  61168. $globals.StreamTest);
  61169. $core.addMethod(
  61170. $core.method({
  61171. selector: "testStreamContents",
  61172. protocol: "tests",
  61173. fn: function (){
  61174. var self=this,$self=this;
  61175. return self;
  61176. },
  61177. args: [],
  61178. source: "testStreamContents",
  61179. referencedClasses: [],
  61180. messageSends: []
  61181. }),
  61182. $globals.StreamTest);
  61183. $core.addMethod(
  61184. $core.method({
  61185. selector: "testWrite",
  61186. protocol: "tests",
  61187. fn: function (){
  61188. var self=this,$self=this;
  61189. var stream,collection;
  61190. return $core.withContext(function($ctx1) {
  61191. collection=$self._newCollection();
  61192. stream=$self._newStream();
  61193. $recv(collection)._do_((function(each){
  61194. return $core.withContext(function($ctx2) {
  61195. return $recv(stream).__lt_lt(each);
  61196. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61197. }));
  61198. $self._assert_equals_($recv(stream)._contents(),collection);
  61199. return self;
  61200. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  61201. },
  61202. args: [],
  61203. 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",
  61204. referencedClasses: [],
  61205. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  61206. }),
  61207. $globals.StreamTest);
  61208. $core.addMethod(
  61209. $core.method({
  61210. selector: "testWriting",
  61211. protocol: "tests",
  61212. fn: function (){
  61213. var self=this,$self=this;
  61214. var stream,collection;
  61215. return $core.withContext(function($ctx1) {
  61216. var $1;
  61217. collection=$self._newCollection();
  61218. stream=$self._newStream();
  61219. $ctx1.sendIdx["newStream"]=1;
  61220. $recv(collection)._do_((function(each){
  61221. return $core.withContext(function($ctx2) {
  61222. return $recv(stream)._nextPut_(each);
  61223. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61224. }));
  61225. $1=$recv(stream)._contents();
  61226. $ctx1.sendIdx["contents"]=1;
  61227. $self._assert_equals_($1,collection);
  61228. $ctx1.sendIdx["assert:equals:"]=1;
  61229. stream=$self._newStream();
  61230. $recv(stream)._nextPutAll_(collection);
  61231. $self._assert_equals_($recv(stream)._contents(),collection);
  61232. return self;
  61233. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  61234. },
  61235. args: [],
  61236. 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",
  61237. referencedClasses: [],
  61238. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  61239. }),
  61240. $globals.StreamTest);
  61241. $core.addMethod(
  61242. $core.method({
  61243. selector: "collectionClass",
  61244. protocol: "accessing",
  61245. fn: function (){
  61246. var self=this,$self=this;
  61247. return nil;
  61248. },
  61249. args: [],
  61250. source: "collectionClass\x0a\x09^ nil",
  61251. referencedClasses: [],
  61252. messageSends: []
  61253. }),
  61254. $globals.StreamTest.a$cls);
  61255. $core.addMethod(
  61256. $core.method({
  61257. selector: "isAbstract",
  61258. protocol: "testing",
  61259. fn: function (){
  61260. var self=this,$self=this;
  61261. return $core.withContext(function($ctx1) {
  61262. return $recv($self._collectionClass())._isNil();
  61263. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.a$cls)});
  61264. },
  61265. args: [],
  61266. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  61267. referencedClasses: [],
  61268. messageSends: ["isNil", "collectionClass"]
  61269. }),
  61270. $globals.StreamTest.a$cls);
  61271. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  61272. $core.addMethod(
  61273. $core.method({
  61274. selector: "newCollection",
  61275. protocol: "accessing",
  61276. fn: function (){
  61277. var self=this,$self=this;
  61278. return $core.withContext(function($ctx1) {
  61279. return [true,(1),(3).__at((4)),"foo"];
  61280. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  61281. },
  61282. args: [],
  61283. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  61284. referencedClasses: [],
  61285. messageSends: ["@"]
  61286. }),
  61287. $globals.ArrayStreamTest);
  61288. $core.addMethod(
  61289. $core.method({
  61290. selector: "collectionClass",
  61291. protocol: "accessing",
  61292. fn: function (){
  61293. var self=this,$self=this;
  61294. return $globals.Array;
  61295. },
  61296. args: [],
  61297. source: "collectionClass\x0a\x09^ Array",
  61298. referencedClasses: ["Array"],
  61299. messageSends: []
  61300. }),
  61301. $globals.ArrayStreamTest.a$cls);
  61302. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  61303. $core.addMethod(
  61304. $core.method({
  61305. selector: "newCollection",
  61306. protocol: "accessing",
  61307. fn: function (){
  61308. var self=this,$self=this;
  61309. return "hello world";
  61310. },
  61311. args: [],
  61312. source: "newCollection\x0a\x09^ 'hello world'",
  61313. referencedClasses: [],
  61314. messageSends: []
  61315. }),
  61316. $globals.StringStreamTest);
  61317. $core.addMethod(
  61318. $core.method({
  61319. selector: "collectionClass",
  61320. protocol: "accessing",
  61321. fn: function (){
  61322. var self=this,$self=this;
  61323. return $globals.String;
  61324. },
  61325. args: [],
  61326. source: "collectionClass\x0a\x09^ String",
  61327. referencedClasses: ["String"],
  61328. messageSends: []
  61329. }),
  61330. $globals.StringStreamTest.a$cls);
  61331. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  61332. $core.addMethod(
  61333. $core.method({
  61334. selector: "testCopying",
  61335. protocol: "tests",
  61336. fn: function (){
  61337. var self=this,$self=this;
  61338. return $core.withContext(function($ctx1) {
  61339. $self._assert_equals_(nil._copy(),nil);
  61340. return self;
  61341. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  61342. },
  61343. args: [],
  61344. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  61345. referencedClasses: [],
  61346. messageSends: ["assert:equals:", "copy"]
  61347. }),
  61348. $globals.UndefinedTest);
  61349. $core.addMethod(
  61350. $core.method({
  61351. selector: "testDeepCopy",
  61352. protocol: "tests",
  61353. fn: function (){
  61354. var self=this,$self=this;
  61355. return $core.withContext(function($ctx1) {
  61356. $self._assert_($recv(nil._deepCopy()).__eq(nil));
  61357. return self;
  61358. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  61359. },
  61360. args: [],
  61361. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  61362. referencedClasses: [],
  61363. messageSends: ["assert:", "=", "deepCopy"]
  61364. }),
  61365. $globals.UndefinedTest);
  61366. $core.addMethod(
  61367. $core.method({
  61368. selector: "testIfNil",
  61369. protocol: "tests",
  61370. fn: function (){
  61371. var self=this,$self=this;
  61372. return $core.withContext(function($ctx1) {
  61373. var $1,$3,$2,$4,$6,$5,$receiver;
  61374. if(($receiver = nil) == null || $receiver.a$nil){
  61375. $1=true;
  61376. } else {
  61377. $1=nil;
  61378. }
  61379. $self._assert_equals_($1,true);
  61380. $ctx1.sendIdx["assert:equals:"]=1;
  61381. if(($receiver = nil) == null || $receiver.a$nil){
  61382. $3=nil;
  61383. } else {
  61384. $3=true;
  61385. }
  61386. $2=$recv($3).__eq(true);
  61387. $ctx1.sendIdx["="]=1;
  61388. $self._deny_($2);
  61389. $ctx1.sendIdx["deny:"]=1;
  61390. if(($receiver = nil) == null || $receiver.a$nil){
  61391. $4=true;
  61392. } else {
  61393. $4=false;
  61394. }
  61395. $self._assert_equals_($4,true);
  61396. if(($receiver = nil) == null || $receiver.a$nil){
  61397. $6=false;
  61398. } else {
  61399. $6=true;
  61400. }
  61401. $5=$recv($6).__eq(true);
  61402. $self._deny_($5);
  61403. return self;
  61404. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  61405. },
  61406. args: [],
  61407. 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",
  61408. referencedClasses: [],
  61409. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  61410. }),
  61411. $globals.UndefinedTest);
  61412. $core.addMethod(
  61413. $core.method({
  61414. selector: "testIsNil",
  61415. protocol: "tests",
  61416. fn: function (){
  61417. var self=this,$self=this;
  61418. return $core.withContext(function($ctx1) {
  61419. $self._assert_(nil._isNil());
  61420. $self._deny_(nil._notNil());
  61421. return self;
  61422. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  61423. },
  61424. args: [],
  61425. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  61426. referencedClasses: [],
  61427. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  61428. }),
  61429. $globals.UndefinedTest);
  61430. });
  61431. define('amber/core/Platform-DOM-Tests',["amber/boot", "require", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  61432. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61433. var $pkg = $core.addPackage("Platform-DOM-Tests");
  61434. $pkg.innerEval = function (expr) { return eval(expr); };
  61435. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  61436. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  61437. $core.addMethod(
  61438. $core.method({
  61439. selector: "testEntityConversion",
  61440. protocol: "testing",
  61441. fn: function (){
  61442. var self=this,$self=this;
  61443. return $core.withContext(function($ctx1) {
  61444. var $1;
  61445. $1=$recv($globals.PlatformDom)._isFeasible();
  61446. if($core.assert($1)){
  61447. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  61448. }
  61449. return self;
  61450. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  61451. },
  61452. args: [],
  61453. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  61454. referencedClasses: ["PlatformDom"],
  61455. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  61456. }),
  61457. $globals.PlatformDomTest);
  61458. $core.addMethod(
  61459. $core.method({
  61460. selector: "testTextContentDoesNotRunScript",
  61461. protocol: "testing",
  61462. fn: function (){
  61463. var self=this,$self=this;
  61464. return $core.withContext(function($ctx1) {
  61465. var $1;
  61466. $1=$recv($globals.PlatformDom)._isFeasible();
  61467. if($core.assert($1)){
  61468. $self._shouldnt_raise_((function(){
  61469. return $core.withContext(function($ctx2) {
  61470. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  61471. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61472. }),$globals.Error);
  61473. }
  61474. return self;
  61475. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  61476. },
  61477. args: [],
  61478. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  61479. referencedClasses: ["PlatformDom", "Error"],
  61480. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  61481. }),
  61482. $globals.PlatformDomTest);
  61483. });
  61484. define('amber/core/SUnit-Tests',["amber/boot", "require", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  61485. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61486. var $pkg = $core.addPackage("SUnit-Tests");
  61487. $pkg.innerEval = function (expr) { return eval(expr); };
  61488. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  61489. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  61490. $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.";
  61491. $core.addMethod(
  61492. $core.method({
  61493. selector: "setUp",
  61494. protocol: "running",
  61495. fn: function (){
  61496. var self=this,$self=this;
  61497. return $core.withContext(function($ctx1) {
  61498. $self.empty=$recv($globals.Set)._new();
  61499. $self.full=$recv($globals.Set)._with_with_((5),"abc");
  61500. return self;
  61501. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  61502. },
  61503. args: [],
  61504. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  61505. referencedClasses: ["Set"],
  61506. messageSends: ["new", "with:with:"]
  61507. }),
  61508. $globals.ExampleSetTest);
  61509. $core.addMethod(
  61510. $core.method({
  61511. selector: "testAdd",
  61512. protocol: "tests",
  61513. fn: function (){
  61514. var self=this,$self=this;
  61515. return $core.withContext(function($ctx1) {
  61516. $recv($self.empty)._add_((5));
  61517. $self._assert_($recv($self.empty)._includes_((5)));
  61518. return self;
  61519. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  61520. },
  61521. args: [],
  61522. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  61523. referencedClasses: [],
  61524. messageSends: ["add:", "assert:", "includes:"]
  61525. }),
  61526. $globals.ExampleSetTest);
  61527. $core.addMethod(
  61528. $core.method({
  61529. selector: "testGrow",
  61530. protocol: "tests",
  61531. fn: function (){
  61532. var self=this,$self=this;
  61533. return $core.withContext(function($ctx1) {
  61534. $recv($self.empty)._addAll_((1)._to_((100)));
  61535. $self._assert_equals_($recv($self.empty)._size(),(100));
  61536. return self;
  61537. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  61538. },
  61539. args: [],
  61540. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  61541. referencedClasses: [],
  61542. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  61543. }),
  61544. $globals.ExampleSetTest);
  61545. $core.addMethod(
  61546. $core.method({
  61547. selector: "testIllegal",
  61548. protocol: "tests",
  61549. fn: function (){
  61550. var self=this,$self=this;
  61551. return $core.withContext(function($ctx1) {
  61552. $self._should_raise_((function(){
  61553. return $core.withContext(function($ctx2) {
  61554. return $recv($self.empty)._at_((5));
  61555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61556. }),$globals.Error);
  61557. $ctx1.sendIdx["should:raise:"]=1;
  61558. $self._should_raise_((function(){
  61559. return $core.withContext(function($ctx2) {
  61560. return $recv($self.empty)._at_put_((5),"abc");
  61561. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61562. }),$globals.Error);
  61563. return self;
  61564. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  61565. },
  61566. args: [],
  61567. 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",
  61568. referencedClasses: ["Error"],
  61569. messageSends: ["should:raise:", "at:", "at:put:"]
  61570. }),
  61571. $globals.ExampleSetTest);
  61572. $core.addMethod(
  61573. $core.method({
  61574. selector: "testIncludes",
  61575. protocol: "tests",
  61576. fn: function (){
  61577. var self=this,$self=this;
  61578. return $core.withContext(function($ctx1) {
  61579. var $1;
  61580. $1=$recv($self.full)._includes_((5));
  61581. $ctx1.sendIdx["includes:"]=1;
  61582. $self._assert_($1);
  61583. $ctx1.sendIdx["assert:"]=1;
  61584. $self._assert_($recv($self.full)._includes_("abc"));
  61585. return self;
  61586. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  61587. },
  61588. args: [],
  61589. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  61590. referencedClasses: [],
  61591. messageSends: ["assert:", "includes:"]
  61592. }),
  61593. $globals.ExampleSetTest);
  61594. $core.addMethod(
  61595. $core.method({
  61596. selector: "testOccurrences",
  61597. protocol: "tests",
  61598. fn: function (){
  61599. var self=this,$self=this;
  61600. return $core.withContext(function($ctx1) {
  61601. var $1,$2;
  61602. $1=$recv($self.empty)._occurrencesOf_((0));
  61603. $ctx1.sendIdx["occurrencesOf:"]=1;
  61604. $self._assert_equals_($1,(0));
  61605. $ctx1.sendIdx["assert:equals:"]=1;
  61606. $2=$recv($self.full)._occurrencesOf_((5));
  61607. $ctx1.sendIdx["occurrencesOf:"]=2;
  61608. $self._assert_equals_($2,(1));
  61609. $ctx1.sendIdx["assert:equals:"]=2;
  61610. $recv($self.full)._add_((5));
  61611. $self._assert_equals_($recv($self.full)._occurrencesOf_((5)),(1));
  61612. return self;
  61613. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  61614. },
  61615. args: [],
  61616. 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",
  61617. referencedClasses: [],
  61618. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  61619. }),
  61620. $globals.ExampleSetTest);
  61621. $core.addMethod(
  61622. $core.method({
  61623. selector: "testRemove",
  61624. protocol: "tests",
  61625. fn: function (){
  61626. var self=this,$self=this;
  61627. return $core.withContext(function($ctx1) {
  61628. var $1;
  61629. $recv($self.full)._remove_((5));
  61630. $1=$recv($self.full)._includes_("abc");
  61631. $ctx1.sendIdx["includes:"]=1;
  61632. $self._assert_($1);
  61633. $self._deny_($recv($self.full)._includes_((5)));
  61634. return self;
  61635. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  61636. },
  61637. args: [],
  61638. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  61639. referencedClasses: [],
  61640. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  61641. }),
  61642. $globals.ExampleSetTest);
  61643. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  61644. $core.addMethod(
  61645. $core.method({
  61646. selector: "fakeError",
  61647. protocol: "helpers",
  61648. fn: function (){
  61649. var self=this,$self=this;
  61650. return $core.withContext(function($ctx1) {
  61651. $self.flag="bad";
  61652. $self._timeout_((30));
  61653. $self.flag=$recv($self._async_((function(){
  61654. return $core.withContext(function($ctx2) {
  61655. $self.flag="ok";
  61656. return $self._error_("Intentional");
  61657. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61658. })))._valueWithTimeout_((20));
  61659. return self;
  61660. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  61661. },
  61662. args: [],
  61663. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  61664. referencedClasses: [],
  61665. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61666. }),
  61667. $globals.SUnitAsyncTest);
  61668. $core.addMethod(
  61669. $core.method({
  61670. selector: "fakeErrorFailingInTearDown",
  61671. protocol: "helpers",
  61672. fn: function (){
  61673. var self=this,$self=this;
  61674. return $core.withContext(function($ctx1) {
  61675. $self.flag="bad";
  61676. $self._timeout_((30));
  61677. $self.flag=$recv($self._async_((function(){
  61678. return $core.withContext(function($ctx2) {
  61679. return $self._error_("Intentional");
  61680. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61681. })))._valueWithTimeout_((20));
  61682. return self;
  61683. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  61684. },
  61685. args: [],
  61686. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  61687. referencedClasses: [],
  61688. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61689. }),
  61690. $globals.SUnitAsyncTest);
  61691. $core.addMethod(
  61692. $core.method({
  61693. selector: "fakeFailure",
  61694. protocol: "helpers",
  61695. fn: function (){
  61696. var self=this,$self=this;
  61697. return $core.withContext(function($ctx1) {
  61698. $self.flag="bad";
  61699. $self._timeout_((30));
  61700. $self.flag=$recv($self._async_((function(){
  61701. return $core.withContext(function($ctx2) {
  61702. $self.flag="ok";
  61703. return $self._assert_(false);
  61704. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61705. })))._valueWithTimeout_((20));
  61706. return self;
  61707. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  61708. },
  61709. args: [],
  61710. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  61711. referencedClasses: [],
  61712. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  61713. }),
  61714. $globals.SUnitAsyncTest);
  61715. $core.addMethod(
  61716. $core.method({
  61717. selector: "fakeMultipleTimeoutFailing",
  61718. protocol: "helpers",
  61719. fn: function (){
  61720. var self=this,$self=this;
  61721. return $core.withContext(function($ctx1) {
  61722. var $1;
  61723. $self._timeout_((100));
  61724. $ctx1.sendIdx["timeout:"]=1;
  61725. $1=$self._async_((function(){
  61726. return $core.withContext(function($ctx2) {
  61727. $self._timeout_((20));
  61728. return $recv($self._async_((function(){
  61729. return $core.withContext(function($ctx3) {
  61730. return $self._finished();
  61731. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61732. })))._valueWithTimeout_((30));
  61733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61734. }));
  61735. $ctx1.sendIdx["async:"]=1;
  61736. $recv($1)._valueWithTimeout_((20));
  61737. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61738. return self;
  61739. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  61740. },
  61741. args: [],
  61742. 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",
  61743. referencedClasses: [],
  61744. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61745. }),
  61746. $globals.SUnitAsyncTest);
  61747. $core.addMethod(
  61748. $core.method({
  61749. selector: "fakeMultipleTimeoutPassing",
  61750. protocol: "helpers",
  61751. fn: function (){
  61752. var self=this,$self=this;
  61753. return $core.withContext(function($ctx1) {
  61754. var $1;
  61755. $self._timeout_((20));
  61756. $ctx1.sendIdx["timeout:"]=1;
  61757. $1=$self._async_((function(){
  61758. return $core.withContext(function($ctx2) {
  61759. $self._timeout_((40));
  61760. return $recv($self._async_((function(){
  61761. return $core.withContext(function($ctx3) {
  61762. return $self._finished();
  61763. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61764. })))._valueWithTimeout_((20));
  61765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61766. }));
  61767. $ctx1.sendIdx["async:"]=1;
  61768. $recv($1)._valueWithTimeout_((10));
  61769. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61770. return self;
  61771. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  61772. },
  61773. args: [],
  61774. 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",
  61775. referencedClasses: [],
  61776. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61777. }),
  61778. $globals.SUnitAsyncTest);
  61779. $core.addMethod(
  61780. $core.method({
  61781. selector: "fakeTimeout",
  61782. protocol: "helpers",
  61783. fn: function (){
  61784. var self=this,$self=this;
  61785. return $core.withContext(function($ctx1) {
  61786. $self._timeout_((10));
  61787. $recv($self._async_((function(){
  61788. return $core.withContext(function($ctx2) {
  61789. return $self._finished();
  61790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61791. })))._valueWithTimeout_((20));
  61792. return self;
  61793. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  61794. },
  61795. args: [],
  61796. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  61797. referencedClasses: [],
  61798. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61799. }),
  61800. $globals.SUnitAsyncTest);
  61801. $core.addMethod(
  61802. $core.method({
  61803. selector: "selectorSetOf:",
  61804. protocol: "private",
  61805. fn: function (aCollection){
  61806. var self=this,$self=this;
  61807. return $core.withContext(function($ctx1) {
  61808. return $recv($recv(aCollection)._collect_((function(each){
  61809. return $core.withContext(function($ctx2) {
  61810. return $recv(each)._selector();
  61811. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61812. })))._asSet();
  61813. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  61814. },
  61815. args: ["aCollection"],
  61816. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  61817. referencedClasses: [],
  61818. messageSends: ["asSet", "collect:", "selector"]
  61819. }),
  61820. $globals.SUnitAsyncTest);
  61821. $core.addMethod(
  61822. $core.method({
  61823. selector: "setUp",
  61824. protocol: "running",
  61825. fn: function (){
  61826. var self=this,$self=this;
  61827. $self.flag="ok";
  61828. return self;
  61829. },
  61830. args: [],
  61831. source: "setUp\x0a\x09flag := 'ok'",
  61832. referencedClasses: [],
  61833. messageSends: []
  61834. }),
  61835. $globals.SUnitAsyncTest);
  61836. $core.addMethod(
  61837. $core.method({
  61838. selector: "tearDown",
  61839. protocol: "running",
  61840. fn: function (){
  61841. var self=this,$self=this;
  61842. return $core.withContext(function($ctx1) {
  61843. $self._assert_equals_("ok",$self.flag);
  61844. return self;
  61845. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  61846. },
  61847. args: [],
  61848. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  61849. referencedClasses: [],
  61850. messageSends: ["assert:equals:"]
  61851. }),
  61852. $globals.SUnitAsyncTest);
  61853. $core.addMethod(
  61854. $core.method({
  61855. selector: "testAsyncErrorsAndFailures",
  61856. protocol: "tests",
  61857. fn: function (){
  61858. var self=this,$self=this;
  61859. var suite,runner,result,assertBlock;
  61860. return $core.withContext(function($ctx1) {
  61861. var $1,$2,$3,$4;
  61862. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  61863. return $core.withContext(function($ctx2) {
  61864. return $recv($self._class())._selector_(each);
  61865. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61866. }));
  61867. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61868. $self._timeout_((200));
  61869. result=$recv(runner)._result();
  61870. $ctx1.sendIdx["result"]=1;
  61871. assertBlock=$self._async_((function(){
  61872. return $core.withContext(function($ctx2) {
  61873. $1=$self._selectorSetOf_($recv(result)._errors());
  61874. $ctx2.sendIdx["selectorSetOf:"]=1;
  61875. $2=["fakeError"]._asSet();
  61876. $ctx2.sendIdx["asSet"]=1;
  61877. $self._assert_equals_($1,$2);
  61878. $ctx2.sendIdx["assert:equals:"]=1;
  61879. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  61880. return $self._finished();
  61881. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61882. }));
  61883. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61884. return $core.withContext(function($ctx2) {
  61885. $3=$recv($recv(ann)._result()).__eq_eq(result);
  61886. if($core.assert($3)){
  61887. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61888. return $recv($4)._ifTrue_(assertBlock);
  61889. }
  61890. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61891. }));
  61892. $recv(runner)._run();
  61893. return self;
  61894. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61895. },
  61896. args: [],
  61897. 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",
  61898. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  61899. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61900. }),
  61901. $globals.SUnitAsyncTest);
  61902. $core.addMethod(
  61903. $core.method({
  61904. selector: "testAsyncNeedsTimeout",
  61905. protocol: "tests",
  61906. fn: function (){
  61907. var self=this,$self=this;
  61908. return $core.withContext(function($ctx1) {
  61909. $self._should_raise_((function(){
  61910. return $core.withContext(function($ctx2) {
  61911. return $self._async_((function(){
  61912. }));
  61913. $ctx2.sendIdx["async:"]=1;
  61914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61915. }),$globals.Error);
  61916. $self._timeout_((0));
  61917. $self._shouldnt_raise_((function(){
  61918. return $core.withContext(function($ctx2) {
  61919. return $self._async_((function(){
  61920. }));
  61921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61922. }),$globals.Error);
  61923. $self._finished();
  61924. return self;
  61925. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61926. },
  61927. args: [],
  61928. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  61929. referencedClasses: ["Error"],
  61930. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  61931. }),
  61932. $globals.SUnitAsyncTest);
  61933. $core.addMethod(
  61934. $core.method({
  61935. selector: "testFinishedNeedsTimeout",
  61936. protocol: "tests",
  61937. fn: function (){
  61938. var self=this,$self=this;
  61939. return $core.withContext(function($ctx1) {
  61940. $self._should_raise_((function(){
  61941. return $core.withContext(function($ctx2) {
  61942. return $self._finished();
  61943. $ctx2.sendIdx["finished"]=1;
  61944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61945. }),$globals.Error);
  61946. $self._timeout_((0));
  61947. $self._shouldnt_raise_((function(){
  61948. return $core.withContext(function($ctx2) {
  61949. return $self._finished();
  61950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61951. }),$globals.Error);
  61952. return self;
  61953. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61954. },
  61955. args: [],
  61956. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  61957. referencedClasses: ["Error"],
  61958. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  61959. }),
  61960. $globals.SUnitAsyncTest);
  61961. $core.addMethod(
  61962. $core.method({
  61963. selector: "testIsAsyncReturnsCorrectValues",
  61964. protocol: "tests",
  61965. fn: function (){
  61966. var self=this,$self=this;
  61967. return $core.withContext(function($ctx1) {
  61968. var $1,$2;
  61969. $1=$self._isAsync();
  61970. $ctx1.sendIdx["isAsync"]=1;
  61971. $self._deny_($1);
  61972. $ctx1.sendIdx["deny:"]=1;
  61973. $self._timeout_((0));
  61974. $2=$self._isAsync();
  61975. $ctx1.sendIdx["isAsync"]=2;
  61976. $self._assert_($2);
  61977. $self._finished();
  61978. $self._deny_($self._isAsync());
  61979. return self;
  61980. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  61981. },
  61982. args: [],
  61983. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  61984. referencedClasses: [],
  61985. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  61986. }),
  61987. $globals.SUnitAsyncTest);
  61988. $core.addMethod(
  61989. $core.method({
  61990. selector: "testPass",
  61991. protocol: "tests",
  61992. fn: function (){
  61993. var self=this,$self=this;
  61994. return $core.withContext(function($ctx1) {
  61995. $self.flag="bad";
  61996. $self._timeout_((10));
  61997. $self.flag=$recv($self._async_((function(){
  61998. return $core.withContext(function($ctx2) {
  61999. $self._assert_(true);
  62000. $self._finished();
  62001. $self.flag="ok";
  62002. return $self.flag;
  62003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62004. })))._valueWithTimeout_((5));
  62005. return self;
  62006. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  62007. },
  62008. args: [],
  62009. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  62010. referencedClasses: [],
  62011. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  62012. }),
  62013. $globals.SUnitAsyncTest);
  62014. $core.addMethod(
  62015. $core.method({
  62016. selector: "testTimeouts",
  62017. protocol: "tests",
  62018. fn: function (){
  62019. var self=this,$self=this;
  62020. var suite,runner,result,assertBlock;
  62021. return $core.withContext(function($ctx1) {
  62022. var $1,$2,$3;
  62023. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  62024. return $core.withContext(function($ctx2) {
  62025. return $recv($self._class())._selector_(each);
  62026. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62027. }));
  62028. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  62029. $self._timeout_((200));
  62030. result=$recv(runner)._result();
  62031. $ctx1.sendIdx["result"]=1;
  62032. assertBlock=$self._async_((function(){
  62033. return $core.withContext(function($ctx2) {
  62034. $1=$self._selectorSetOf_($recv(result)._errors());
  62035. $ctx2.sendIdx["selectorSetOf:"]=1;
  62036. $self._assert_equals_($1,$recv($globals.Set)._new());
  62037. $ctx2.sendIdx["assert:equals:"]=1;
  62038. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  62039. return $self._finished();
  62040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  62041. }));
  62042. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  62043. return $core.withContext(function($ctx2) {
  62044. $2=$recv($recv(ann)._result()).__eq_eq(result);
  62045. if($core.assert($2)){
  62046. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  62047. return $recv($3)._ifTrue_(assertBlock);
  62048. }
  62049. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  62050. }));
  62051. $recv(runner)._run();
  62052. return self;
  62053. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  62054. },
  62055. args: [],
  62056. 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",
  62057. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  62058. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  62059. }),
  62060. $globals.SUnitAsyncTest);
  62061. $core.addMethod(
  62062. $core.method({
  62063. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  62064. protocol: "tests",
  62065. fn: function (){
  62066. var self=this,$self=this;
  62067. var x;
  62068. return $core.withContext(function($ctx1) {
  62069. var $1;
  62070. $self.flag="bad";
  62071. $self._timeout_((10));
  62072. x=(0);
  62073. $1=$self._async_((function(){
  62074. return $core.withContext(function($ctx2) {
  62075. $self._finished();
  62076. $ctx2.sendIdx["finished"]=1;
  62077. $self.flag="ok";
  62078. x=$recv(x).__plus((1));
  62079. $ctx2.sendIdx["+"]=1;
  62080. return $self._assert_equals_(x,(1));
  62081. $ctx2.sendIdx["assert:equals:"]=1;
  62082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62083. }));
  62084. $ctx1.sendIdx["async:"]=1;
  62085. $self.flag=$recv($1)._valueWithTimeout_((0));
  62086. $ctx1.sendIdx["valueWithTimeout:"]=1;
  62087. $self.flag=$recv($self._async_((function(){
  62088. return $core.withContext(function($ctx2) {
  62089. $self._finished();
  62090. $self.flag="ok";
  62091. x=$recv(x).__plus((1));
  62092. return $self._assert_equals_(x,(1));
  62093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  62094. })))._valueWithTimeout_((0));
  62095. return self;
  62096. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  62097. },
  62098. args: [],
  62099. 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.",
  62100. referencedClasses: [],
  62101. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  62102. }),
  62103. $globals.SUnitAsyncTest);
  62104. });
  62105. define('amber/devel',[
  62106. './lang',
  62107. './brikz', // pre-fetch, dep of ./boot
  62108. './kernel-checks', // pre-fetch, dep of ./boot
  62109. './kernel-fundamentals', // pre-fetch, dep of ./boot
  62110. './kernel-language', // pre-fetch, dep of ./boot
  62111. './boot', // pre-fetch, class loader
  62112. './deploy', // pre-fetch, dep of ./lang
  62113. // --- packages of the development only Amber begin here ---
  62114. 'amber/core/Platform-DOM',
  62115. 'amber/core/SUnit',
  62116. 'amber/core/Compiler-Tests',
  62117. 'amber/core/Kernel-Tests',
  62118. 'amber/core/Platform-DOM-Tests',
  62119. 'amber/core/SUnit-Tests'
  62120. // --- packages of the development only Amber end here ---
  62121. ], function (amber) {
  62122. return amber;
  62123. });
  62124. define('amber/core/Platform-Node',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  62125. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  62126. var $pkg = $core.addPackage("Platform-Node");
  62127. $pkg.innerEval = function (expr) { return eval(expr); };
  62128. $pkg.imports = ["amber/core/Platform-Services"];
  62129. $pkg.isReady = new Promise(function (resolve, reject) { requirejs(["amber/core/Platform-Services"], function () {resolve();}, reject); });
  62130. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  62131. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  62132. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  62133. $core.addMethod(
  62134. $core.method({
  62135. selector: "globals",
  62136. protocol: "accessing",
  62137. fn: function (){
  62138. var self=this,$self=this;
  62139. return global;
  62140. },
  62141. args: [],
  62142. source: "globals\x0a\x09^ global",
  62143. referencedClasses: [],
  62144. messageSends: []
  62145. }),
  62146. $globals.NodePlatform);
  62147. $core.addMethod(
  62148. $core.method({
  62149. selector: "newXhr",
  62150. protocol: "accessing",
  62151. fn: function (){
  62152. var self=this,$self=this;
  62153. return $core.withContext(function($ctx1) {
  62154. var $receiver;
  62155. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.a$nil){
  62156. $self._error_("XMLHttpRequest not available.");
  62157. } else {
  62158. return $recv($globals.XMLHttpRequest)._new();
  62159. }
  62160. return self;
  62161. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  62162. },
  62163. args: [],
  62164. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  62165. referencedClasses: ["XMLHttpRequest"],
  62166. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  62167. }),
  62168. $globals.NodePlatform);
  62169. $core.addMethod(
  62170. $core.method({
  62171. selector: "initialize",
  62172. protocol: "testing",
  62173. fn: function (){
  62174. var self=this,$self=this;
  62175. return $core.withContext(function($ctx1) {
  62176. var $1;
  62177. $1=$self._isFeasible();
  62178. if($core.assert($1)){
  62179. $recv($globals.Platform)._registerIfNone_($self._new());
  62180. }
  62181. return self;
  62182. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.a$cls)});
  62183. },
  62184. args: [],
  62185. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  62186. referencedClasses: ["Platform"],
  62187. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  62188. }),
  62189. $globals.NodePlatform.a$cls);
  62190. $core.addMethod(
  62191. $core.method({
  62192. selector: "isFeasible",
  62193. protocol: "testing",
  62194. fn: function (){
  62195. var self=this,$self=this;
  62196. return $core.withContext(function($ctx1) {
  62197. return typeof process !== "undefined" && process && process.versions && process.versions.node != null;
  62198. return self;
  62199. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.a$cls)});
  62200. },
  62201. args: [],
  62202. source: "isFeasible\x0a<inlineJS: 'return typeof process !== \x22undefined\x22 && process && process.versions && process.versions.node != null'>",
  62203. referencedClasses: [],
  62204. messageSends: []
  62205. }),
  62206. $globals.NodePlatform.a$cls);
  62207. });
  62208. define('amber_cli/AmberCli',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  62209. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  62210. var $pkg = $core.addPackage("AmberCli");
  62211. $pkg.innerEval = function (expr) { return eval(expr); };
  62212. $pkg.transport = {"type":"amd","amdNamespace":"amber_cli"};
  62213. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  62214. $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.";
  62215. $core.addMethod(
  62216. $core.method({
  62217. selector: "commandLineSwitches",
  62218. protocol: "commandline",
  62219. fn: function (){
  62220. var self=this,$self=this;
  62221. var switches;
  62222. return $core.withContext(function($ctx1) {
  62223. switches=$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  62224. return $core.withContext(function($ctx2) {
  62225. return $recv(each)._selector();
  62226. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62227. }));
  62228. $ctx1.sendIdx["collect:"]=1;
  62229. switches=$recv(switches)._select_((function(each){
  62230. return $core.withContext(function($ctx2) {
  62231. return $recv(each)._match_("^[^:]*:$");
  62232. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  62233. }));
  62234. switches=$recv(switches)._collect_((function(each){
  62235. return $core.withContext(function($ctx2) {
  62236. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  62237. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  62238. }));
  62239. return switches;
  62240. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.a$cls)});
  62241. },
  62242. args: [],
  62243. 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",
  62244. referencedClasses: [],
  62245. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  62246. }),
  62247. $globals.AmberCli.a$cls);
  62248. $core.addMethod(
  62249. $core.method({
  62250. selector: "config:",
  62251. protocol: "commands",
  62252. fn: function (args){
  62253. var self=this,$self=this;
  62254. return $core.withContext(function($ctx1) {
  62255. $recv($recv($globals.Configurator)._new())._start();
  62256. return self;
  62257. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.a$cls)});
  62258. },
  62259. args: ["args"],
  62260. source: "config: args\x0a\x09Configurator new start",
  62261. referencedClasses: ["Configurator"],
  62262. messageSends: ["start", "new"]
  62263. }),
  62264. $globals.AmberCli.a$cls);
  62265. $core.addMethod(
  62266. $core.method({
  62267. selector: "handleArguments:",
  62268. protocol: "commandline",
  62269. fn: function (args){
  62270. var self=this,$self=this;
  62271. var selector;
  62272. return $core.withContext(function($ctx1) {
  62273. var $1;
  62274. $1=$recv(args)._first();
  62275. $ctx1.sendIdx["first"]=1;
  62276. selector=$self._selectorForCommandLineSwitch_($1);
  62277. $recv(args)._remove_($recv(args)._first());
  62278. $self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  62279. return self;
  62280. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.a$cls)});
  62281. },
  62282. args: ["args"],
  62283. 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)",
  62284. referencedClasses: ["Array"],
  62285. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  62286. }),
  62287. $globals.AmberCli.a$cls);
  62288. $core.addMethod(
  62289. $core.method({
  62290. selector: "help:",
  62291. protocol: "commands",
  62292. fn: function (args){
  62293. var self=this,$self=this;
  62294. return $core.withContext(function($ctx1) {
  62295. $recv($globals.Transcript)._show_("Available commands");
  62296. $recv($self._commandLineSwitches())._do_((function(each){
  62297. return $core.withContext(function($ctx2) {
  62298. return $recv(console)._log_(each);
  62299. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62300. }));
  62301. return self;
  62302. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.a$cls)});
  62303. },
  62304. args: ["args"],
  62305. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  62306. referencedClasses: ["Transcript"],
  62307. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  62308. }),
  62309. $globals.AmberCli.a$cls);
  62310. $core.addMethod(
  62311. $core.method({
  62312. selector: "init:",
  62313. protocol: "commands",
  62314. fn: function (args){
  62315. var self=this,$self=this;
  62316. return $core.withContext(function($ctx1) {
  62317. $recv($recv($globals.Initer)._new())._start();
  62318. return self;
  62319. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.a$cls)});
  62320. },
  62321. args: ["args"],
  62322. source: "init: args\x0a\x09Initer new start",
  62323. referencedClasses: ["Initer"],
  62324. messageSends: ["start", "new"]
  62325. }),
  62326. $globals.AmberCli.a$cls);
  62327. $core.addMethod(
  62328. $core.method({
  62329. selector: "main",
  62330. protocol: "startup",
  62331. fn: function (){
  62332. var self=this,$self=this;
  62333. var args,packageJSON;
  62334. return $core.withContext(function($ctx1) {
  62335. var $7,$6,$5,$4,$3,$2,$1;
  62336. var $early={};
  62337. try {
  62338. packageJSON=$recv(require)._value_("../package.json");
  62339. $7=$recv(packageJSON)._version();
  62340. $ctx1.sendIdx["version"]=1;
  62341. $6="Welcome to Amber CLI version ".__comma($7);
  62342. $5=$recv($6).__comma(" (Amber ");
  62343. $ctx1.sendIdx[","]=5;
  62344. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  62345. $ctx1.sendIdx[","]=4;
  62346. $3=$recv($4).__comma(", NodeJS ");
  62347. $ctx1.sendIdx[","]=3;
  62348. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  62349. $ctx1.sendIdx[","]=2;
  62350. $1=$recv($2).__comma(").");
  62351. $ctx1.sendIdx[","]=1;
  62352. $recv($globals.Transcript)._show_($1);
  62353. args=$recv(process)._argv();
  62354. $recv(args)._removeFrom_to_((1),(2));
  62355. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  62356. return $core.withContext(function($ctx2) {
  62357. return $self._help_(nil);
  62358. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62359. }),(function(){
  62360. return $core.withContext(function($ctx2) {
  62361. throw $early=[$self._handleArguments_(args)];
  62362. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  62363. }));
  62364. return self;
  62365. }
  62366. catch(e) {if(e===$early)return e[0]; throw e}
  62367. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.a$cls)});
  62368. },
  62369. args: [],
  62370. 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]",
  62371. referencedClasses: ["Transcript", "Smalltalk"],
  62372. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  62373. }),
  62374. $globals.AmberCli.a$cls);
  62375. $core.addMethod(
  62376. $core.method({
  62377. selector: "repl:",
  62378. protocol: "commands",
  62379. fn: function (args){
  62380. var self=this,$self=this;
  62381. return $core.withContext(function($ctx1) {
  62382. return $recv($recv($globals.Repl)._new())._createInterface();
  62383. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.a$cls)});
  62384. },
  62385. args: ["args"],
  62386. source: "repl: args\x0a\x09^ Repl new createInterface",
  62387. referencedClasses: ["Repl"],
  62388. messageSends: ["createInterface", "new"]
  62389. }),
  62390. $globals.AmberCli.a$cls);
  62391. $core.addMethod(
  62392. $core.method({
  62393. selector: "selectorForCommandLineSwitch:",
  62394. protocol: "commandline",
  62395. fn: function (aSwitch){
  62396. var self=this,$self=this;
  62397. var command,selector;
  62398. return $core.withContext(function($ctx1) {
  62399. var $1;
  62400. $1=$recv($self._commandLineSwitches())._includes_(aSwitch);
  62401. if($core.assert($1)){
  62402. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  62403. return $core.withContext(function($ctx2) {
  62404. return $recv($recv(each)._second())._asUppercase();
  62405. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  62406. }))).__comma(":");
  62407. selector;
  62408. } else {
  62409. selector="help:";
  62410. selector;
  62411. }
  62412. return selector;
  62413. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.a$cls)});
  62414. },
  62415. args: ["aSwitch"],
  62416. 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",
  62417. referencedClasses: [],
  62418. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  62419. }),
  62420. $globals.AmberCli.a$cls);
  62421. $core.addMethod(
  62422. $core.method({
  62423. selector: "serve:",
  62424. protocol: "commands",
  62425. fn: function (args){
  62426. var self=this,$self=this;
  62427. return $core.withContext(function($ctx1) {
  62428. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  62429. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.a$cls)});
  62430. },
  62431. args: ["args"],
  62432. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  62433. referencedClasses: ["FileServer"],
  62434. messageSends: ["start", "createServerWithArguments:"]
  62435. }),
  62436. $globals.AmberCli.a$cls);
  62437. $core.addMethod(
  62438. $core.method({
  62439. selector: "version:",
  62440. protocol: "commands",
  62441. fn: function (arguments_){
  62442. var self=this,$self=this;
  62443. return self;
  62444. },
  62445. args: ["arguments"],
  62446. source: "version: arguments",
  62447. referencedClasses: [],
  62448. messageSends: []
  62449. }),
  62450. $globals.AmberCli.a$cls);
  62451. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  62452. $core.addMethod(
  62453. $core.method({
  62454. selector: "dirname",
  62455. protocol: "private",
  62456. fn: function (){
  62457. var self=this,$self=this;
  62458. return $core.withContext(function($ctx1) {
  62459. return __dirname;
  62460. return self;
  62461. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  62462. },
  62463. args: [],
  62464. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  62465. referencedClasses: [],
  62466. messageSends: []
  62467. }),
  62468. $globals.BaseFileManipulator);
  62469. $core.addMethod(
  62470. $core.method({
  62471. selector: "initialize",
  62472. protocol: "initialization",
  62473. fn: function (){
  62474. var self=this,$self=this;
  62475. return $core.withContext(function($ctx1) {
  62476. (
  62477. $ctx1.supercall = true,
  62478. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62479. $ctx1.supercall = false;
  62480. $self.path=$recv(require)._value_("path");
  62481. $ctx1.sendIdx["value:"]=1;
  62482. $self.fs=$recv(require)._value_("fs");
  62483. return self;
  62484. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  62485. },
  62486. args: [],
  62487. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  62488. referencedClasses: [],
  62489. messageSends: ["initialize", "value:"]
  62490. }),
  62491. $globals.BaseFileManipulator);
  62492. $core.addMethod(
  62493. $core.method({
  62494. selector: "rootDirname",
  62495. protocol: "private",
  62496. fn: function (){
  62497. var self=this,$self=this;
  62498. return $core.withContext(function($ctx1) {
  62499. return $recv($self.path)._join_with_($self._dirname(),"..");
  62500. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  62501. },
  62502. args: [],
  62503. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  62504. referencedClasses: [],
  62505. messageSends: ["join:with:", "dirname"]
  62506. }),
  62507. $globals.BaseFileManipulator);
  62508. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  62509. $core.addMethod(
  62510. $core.method({
  62511. selector: "initialize",
  62512. protocol: "initialization",
  62513. fn: function (){
  62514. var self=this,$self=this;
  62515. return $core.withContext(function($ctx1) {
  62516. (
  62517. $ctx1.supercall = true,
  62518. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62519. $ctx1.supercall = false;
  62520. return self;
  62521. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  62522. },
  62523. args: [],
  62524. source: "initialize\x0a\x09super initialize",
  62525. referencedClasses: [],
  62526. messageSends: ["initialize"]
  62527. }),
  62528. $globals.Configurator);
  62529. $core.addMethod(
  62530. $core.method({
  62531. selector: "start",
  62532. protocol: "action",
  62533. fn: function (){
  62534. var self=this,$self=this;
  62535. return $core.withContext(function($ctx1) {
  62536. var $receiver;
  62537. $self._writeConfigThenDo_((function(err){
  62538. return $core.withContext(function($ctx2) {
  62539. if(($receiver = err) == null || $receiver.a$nil){
  62540. return $recv(process)._exit();
  62541. } else {
  62542. return $recv(process)._exit_((111));
  62543. }
  62544. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  62545. }));
  62546. return self;
  62547. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  62548. },
  62549. args: [],
  62550. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  62551. referencedClasses: [],
  62552. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  62553. }),
  62554. $globals.Configurator);
  62555. $core.addMethod(
  62556. $core.method({
  62557. selector: "writeConfigThenDo:",
  62558. protocol: "action",
  62559. fn: function (aBlock){
  62560. var self=this,$self=this;
  62561. return $core.withContext(function($ctx1) {
  62562. $recv($recv($recv(require)._value_("@ambers/sdk"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  62563. return self;
  62564. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  62565. },
  62566. args: ["aBlock"],
  62567. source: "writeConfigThenDo: aBlock\x0a\x09(require value: '@ambers/sdk') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  62568. referencedClasses: [],
  62569. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  62570. }),
  62571. $globals.Configurator);
  62572. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  62573. $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.";
  62574. $core.addMethod(
  62575. $core.method({
  62576. selector: "base64Decode:",
  62577. protocol: "private",
  62578. fn: function (aString){
  62579. var self=this,$self=this;
  62580. return $core.withContext(function($ctx1) {
  62581. return (new Buffer(aString, "base64").toString());
  62582. return self;
  62583. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  62584. },
  62585. args: ["aString"],
  62586. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  62587. referencedClasses: [],
  62588. messageSends: []
  62589. }),
  62590. $globals.FileServer);
  62591. $core.addMethod(
  62592. $core.method({
  62593. selector: "basePath",
  62594. protocol: "accessing",
  62595. fn: function (){
  62596. var self=this,$self=this;
  62597. return $core.withContext(function($ctx1) {
  62598. var $1,$receiver;
  62599. $1=$self.basePath;
  62600. if(($receiver = $1) == null || $receiver.a$nil){
  62601. return $recv($self._class())._defaultBasePath();
  62602. } else {
  62603. return $1;
  62604. }
  62605. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  62606. },
  62607. args: [],
  62608. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  62609. referencedClasses: [],
  62610. messageSends: ["ifNil:", "defaultBasePath", "class"]
  62611. }),
  62612. $globals.FileServer);
  62613. $core.addMethod(
  62614. $core.method({
  62615. selector: "basePath:",
  62616. protocol: "accessing",
  62617. fn: function (aString){
  62618. var self=this,$self=this;
  62619. return $core.withContext(function($ctx1) {
  62620. $self.basePath=aString;
  62621. $self._validateBasePath();
  62622. return self;
  62623. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  62624. },
  62625. args: ["aString"],
  62626. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  62627. referencedClasses: [],
  62628. messageSends: ["validateBasePath"]
  62629. }),
  62630. $globals.FileServer);
  62631. $core.addMethod(
  62632. $core.method({
  62633. selector: "checkDirectoryLayout",
  62634. protocol: "initialization",
  62635. fn: function (){
  62636. var self=this,$self=this;
  62637. return $core.withContext(function($ctx1) {
  62638. var $1;
  62639. $1=$recv($self.fs)._existsSync_($self._withBasePath_("index.html"));
  62640. if(!$core.assert($1)){
  62641. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  62642. $ctx1.sendIdx["warn:"]=1;
  62643. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  62644. $ctx1.sendIdx["warn:"]=2;
  62645. $recv(console)._warn_(" You can also specify a page to be served by default,");
  62646. $ctx1.sendIdx["warn:"]=3;
  62647. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  62648. }
  62649. return self;
  62650. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  62651. },
  62652. args: [],
  62653. 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.'].",
  62654. referencedClasses: [],
  62655. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  62656. }),
  62657. $globals.FileServer);
  62658. $core.addMethod(
  62659. $core.method({
  62660. selector: "fallbackPage",
  62661. protocol: "accessing",
  62662. fn: function (){
  62663. var self=this,$self=this;
  62664. return $self.fallbackPage;
  62665. },
  62666. args: [],
  62667. source: "fallbackPage\x0a\x09^ fallbackPage",
  62668. referencedClasses: [],
  62669. messageSends: []
  62670. }),
  62671. $globals.FileServer);
  62672. $core.addMethod(
  62673. $core.method({
  62674. selector: "fallbackPage:",
  62675. protocol: "accessing",
  62676. fn: function (aString){
  62677. var self=this,$self=this;
  62678. $self.fallbackPage=aString;
  62679. return self;
  62680. },
  62681. args: ["aString"],
  62682. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  62683. referencedClasses: [],
  62684. messageSends: []
  62685. }),
  62686. $globals.FileServer);
  62687. $core.addMethod(
  62688. $core.method({
  62689. selector: "handleGETRequest:respondTo:",
  62690. protocol: "request handling",
  62691. fn: function (aRequest,aResponse){
  62692. var self=this,$self=this;
  62693. var uri,filename;
  62694. return $core.withContext(function($ctx1) {
  62695. var $1;
  62696. uri=$recv($self.url)._parse_($recv(aRequest)._url());
  62697. filename=$recv($self.path)._join_with_($self._basePath(),$recv(uri)._pathname());
  62698. $recv($self.fs)._exists_do_(filename,(function(aBoolean){
  62699. return $core.withContext(function($ctx2) {
  62700. if($core.assert(aBoolean)){
  62701. $1=$recv($recv($self.fs)._statSync_(filename))._isDirectory();
  62702. if($core.assert($1)){
  62703. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  62704. } else {
  62705. return $self._respondFileNamed_to_(filename,aResponse);
  62706. }
  62707. } else {
  62708. return $self._respondNotFoundTo_(aResponse);
  62709. }
  62710. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  62711. }));
  62712. return self;
  62713. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  62714. },
  62715. args: ["aRequest", "aResponse"],
  62716. 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]]]",
  62717. referencedClasses: [],
  62718. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  62719. }),
  62720. $globals.FileServer);
  62721. $core.addMethod(
  62722. $core.method({
  62723. selector: "handleOPTIONSRequest:respondTo:",
  62724. protocol: "request handling",
  62725. fn: function (aRequest,aResponse){
  62726. var self=this,$self=this;
  62727. return $core.withContext(function($ctx1) {
  62728. $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)]));
  62729. $recv(aResponse)._end();
  62730. return self;
  62731. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62732. },
  62733. args: ["aRequest", "aResponse"],
  62734. 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",
  62735. referencedClasses: [],
  62736. messageSends: ["writeHead:options:", "end"]
  62737. }),
  62738. $globals.FileServer);
  62739. $core.addMethod(
  62740. $core.method({
  62741. selector: "handlePUTRequest:respondTo:",
  62742. protocol: "request handling",
  62743. fn: function (aRequest,aResponse){
  62744. var self=this,$self=this;
  62745. var file,stream;
  62746. return $core.withContext(function($ctx1) {
  62747. var $1,$2,$3,$4;
  62748. $1=$self._isAuthenticated_(aRequest);
  62749. if(!$core.assert($1)){
  62750. $self._respondAuthenticationRequiredTo_(aResponse);
  62751. return nil;
  62752. }
  62753. file=".".__comma($recv(aRequest)._url());
  62754. $ctx1.sendIdx[","]=1;
  62755. stream=$recv($self.fs)._createWriteStream_(file);
  62756. $recv(stream)._on_do_("error",(function(error){
  62757. return $core.withContext(function($ctx2) {
  62758. $2=console;
  62759. $3="Error creating WriteStream for file ".__comma(file);
  62760. $ctx2.sendIdx[","]=2;
  62761. $recv($2)._warn_($3);
  62762. $ctx2.sendIdx["warn:"]=1;
  62763. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  62764. $ctx2.sendIdx["warn:"]=2;
  62765. $recv(console)._warn_(" The exact error is: ".__comma(error));
  62766. return $self._respondNotCreatedTo_(aResponse);
  62767. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62768. }));
  62769. $ctx1.sendIdx["on:do:"]=1;
  62770. $recv(stream)._on_do_("close",(function(){
  62771. return $core.withContext(function($ctx2) {
  62772. return $self._respondCreatedTo_(aResponse);
  62773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62774. }));
  62775. $ctx1.sendIdx["on:do:"]=2;
  62776. $recv(aRequest)._setEncoding_("utf8");
  62777. $recv(aRequest)._on_do_("data",(function(data){
  62778. return $core.withContext(function($ctx2) {
  62779. return $recv(stream)._write_(data);
  62780. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  62781. }));
  62782. $ctx1.sendIdx["on:do:"]=3;
  62783. $recv(aRequest)._on_do_("end",(function(){
  62784. return $core.withContext(function($ctx2) {
  62785. $4=$recv(stream)._writable();
  62786. if($core.assert($4)){
  62787. return $recv(stream)._end();
  62788. }
  62789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62790. }));
  62791. return self;
  62792. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  62793. },
  62794. args: ["aRequest", "aResponse"],
  62795. 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]]",
  62796. referencedClasses: [],
  62797. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  62798. }),
  62799. $globals.FileServer);
  62800. $core.addMethod(
  62801. $core.method({
  62802. selector: "handleRequest:respondTo:",
  62803. protocol: "request handling",
  62804. fn: function (aRequest,aResponse){
  62805. var self=this,$self=this;
  62806. return $core.withContext(function($ctx1) {
  62807. var $2,$1,$4,$3,$5;
  62808. $2=$recv(aRequest)._method();
  62809. $ctx1.sendIdx["method"]=1;
  62810. $1=$recv($2).__eq("PUT");
  62811. $ctx1.sendIdx["="]=1;
  62812. if($core.assert($1)){
  62813. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  62814. }
  62815. $4=$recv(aRequest)._method();
  62816. $ctx1.sendIdx["method"]=2;
  62817. $3=$recv($4).__eq("GET");
  62818. $ctx1.sendIdx["="]=2;
  62819. if($core.assert($3)){
  62820. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  62821. }
  62822. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  62823. if($core.assert($5)){
  62824. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  62825. }
  62826. return self;
  62827. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62828. },
  62829. args: ["aRequest", "aResponse"],
  62830. 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]",
  62831. referencedClasses: [],
  62832. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  62833. }),
  62834. $globals.FileServer);
  62835. $core.addMethod(
  62836. $core.method({
  62837. selector: "host",
  62838. protocol: "accessing",
  62839. fn: function (){
  62840. var self=this,$self=this;
  62841. return $self.host;
  62842. },
  62843. args: [],
  62844. source: "host\x0a\x09^ host",
  62845. referencedClasses: [],
  62846. messageSends: []
  62847. }),
  62848. $globals.FileServer);
  62849. $core.addMethod(
  62850. $core.method({
  62851. selector: "host:",
  62852. protocol: "accessing",
  62853. fn: function (hostname){
  62854. var self=this,$self=this;
  62855. $self.host=hostname;
  62856. return self;
  62857. },
  62858. args: ["hostname"],
  62859. source: "host: hostname\x0a\x09host := hostname",
  62860. referencedClasses: [],
  62861. messageSends: []
  62862. }),
  62863. $globals.FileServer);
  62864. $core.addMethod(
  62865. $core.method({
  62866. selector: "initialize",
  62867. protocol: "initialization",
  62868. fn: function (){
  62869. var self=this,$self=this;
  62870. return $core.withContext(function($ctx1) {
  62871. var $1;
  62872. (
  62873. $ctx1.supercall = true,
  62874. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62875. $ctx1.supercall = false;
  62876. $self.http=$self._require_("http");
  62877. $ctx1.sendIdx["require:"]=1;
  62878. $self.util=$self._require_("util");
  62879. $ctx1.sendIdx["require:"]=2;
  62880. $self.url=$self._require_("url");
  62881. $1=$self._class();
  62882. $ctx1.sendIdx["class"]=1;
  62883. $self.host=$recv($1)._defaultHost();
  62884. $self.port=$recv($self._class())._defaultPort();
  62885. $self.username=nil;
  62886. $self.password=nil;
  62887. $self.fallbackPage=nil;
  62888. return self;
  62889. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  62890. },
  62891. args: [],
  62892. 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.",
  62893. referencedClasses: [],
  62894. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  62895. }),
  62896. $globals.FileServer);
  62897. $core.addMethod(
  62898. $core.method({
  62899. selector: "isAuthenticated:",
  62900. protocol: "private",
  62901. fn: function (aRequest){
  62902. var self=this,$self=this;
  62903. var header,token,auth,parts;
  62904. return $core.withContext(function($ctx1) {
  62905. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  62906. var $early={};
  62907. try {
  62908. $2=$recv($self.username)._isNil();
  62909. $ctx1.sendIdx["isNil"]=1;
  62910. $1=$recv($2)._and_((function(){
  62911. return $core.withContext(function($ctx2) {
  62912. return $recv($self.password)._isNil();
  62913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62914. }));
  62915. $ctx1.sendIdx["and:"]=1;
  62916. if($core.assert($1)){
  62917. return true;
  62918. }
  62919. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  62920. $ctx1.sendIdx["at:"]=1;
  62921. if(($receiver = $3) == null || $receiver.a$nil){
  62922. header="";
  62923. } else {
  62924. header=$3;
  62925. }
  62926. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  62927. throw $early=[false];
  62928. }),(function(){
  62929. return $core.withContext(function($ctx2) {
  62930. $4=$recv(header)._tokenize_(" ");
  62931. $ctx2.sendIdx["tokenize:"]=1;
  62932. if(($receiver = $4) == null || $receiver.a$nil){
  62933. token="";
  62934. } else {
  62935. token=$4;
  62936. }
  62937. $5=$recv(token)._at_((2));
  62938. $ctx2.sendIdx["at:"]=2;
  62939. auth=$self._base64Decode_($5);
  62940. parts=$recv(auth)._tokenize_(":");
  62941. $8=$self.username;
  62942. $9=$recv(parts)._at_((1));
  62943. $ctx2.sendIdx["at:"]=3;
  62944. $7=$recv($8).__eq($9);
  62945. $ctx2.sendIdx["="]=1;
  62946. $6=$recv($7)._and_((function(){
  62947. return $core.withContext(function($ctx3) {
  62948. return $recv($self.password).__eq($recv(parts)._at_((2)));
  62949. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  62950. }));
  62951. if($core.assert($6)){
  62952. throw $early=[true];
  62953. } else {
  62954. throw $early=[false];
  62955. }
  62956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62957. }));
  62958. return self;
  62959. }
  62960. catch(e) {if(e===$early)return e[0]; throw e}
  62961. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  62962. },
  62963. args: ["aRequest"],
  62964. 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].",
  62965. referencedClasses: [],
  62966. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  62967. }),
  62968. $globals.FileServer);
  62969. $core.addMethod(
  62970. $core.method({
  62971. selector: "password:",
  62972. protocol: "accessing",
  62973. fn: function (aPassword){
  62974. var self=this,$self=this;
  62975. $self.password=aPassword;
  62976. return self;
  62977. },
  62978. args: ["aPassword"],
  62979. source: "password: aPassword\x0a\x09password := aPassword.",
  62980. referencedClasses: [],
  62981. messageSends: []
  62982. }),
  62983. $globals.FileServer);
  62984. $core.addMethod(
  62985. $core.method({
  62986. selector: "port",
  62987. protocol: "accessing",
  62988. fn: function (){
  62989. var self=this,$self=this;
  62990. return $self.port;
  62991. },
  62992. args: [],
  62993. source: "port\x0a\x09^ port",
  62994. referencedClasses: [],
  62995. messageSends: []
  62996. }),
  62997. $globals.FileServer);
  62998. $core.addMethod(
  62999. $core.method({
  63000. selector: "port:",
  63001. protocol: "accessing",
  63002. fn: function (aNumber){
  63003. var self=this,$self=this;
  63004. $self.port=aNumber;
  63005. return self;
  63006. },
  63007. args: ["aNumber"],
  63008. source: "port: aNumber\x0a\x09port := aNumber",
  63009. referencedClasses: [],
  63010. messageSends: []
  63011. }),
  63012. $globals.FileServer);
  63013. $core.addMethod(
  63014. $core.method({
  63015. selector: "require:",
  63016. protocol: "private",
  63017. fn: function (aModuleString){
  63018. var self=this,$self=this;
  63019. return $core.withContext(function($ctx1) {
  63020. return $recv(require)._value_(aModuleString);
  63021. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  63022. },
  63023. args: ["aModuleString"],
  63024. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  63025. referencedClasses: [],
  63026. messageSends: ["value:"]
  63027. }),
  63028. $globals.FileServer);
  63029. $core.addMethod(
  63030. $core.method({
  63031. selector: "respondAuthenticationRequiredTo:",
  63032. protocol: "request handling",
  63033. fn: function (aResponse){
  63034. var self=this,$self=this;
  63035. return $core.withContext(function($ctx1) {
  63036. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  63037. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  63038. $recv(aResponse)._end();
  63039. return self;
  63040. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  63041. },
  63042. args: ["aResponse"],
  63043. 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.",
  63044. referencedClasses: [],
  63045. messageSends: ["writeHead:options:", "write:", "end"]
  63046. }),
  63047. $globals.FileServer);
  63048. $core.addMethod(
  63049. $core.method({
  63050. selector: "respondCreatedTo:",
  63051. protocol: "request handling",
  63052. fn: function (aResponse){
  63053. var self=this,$self=this;
  63054. return $core.withContext(function($ctx1) {
  63055. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  63056. $recv(aResponse)._end();
  63057. return self;
  63058. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  63059. },
  63060. args: ["aResponse"],
  63061. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  63062. referencedClasses: [],
  63063. messageSends: ["writeHead:options:", "end"]
  63064. }),
  63065. $globals.FileServer);
  63066. $core.addMethod(
  63067. $core.method({
  63068. selector: "respondDirectoryNamed:from:to:",
  63069. protocol: "request handling",
  63070. fn: function (aDirname,aUrl,aResponse){
  63071. var self=this,$self=this;
  63072. return $core.withContext(function($ctx1) {
  63073. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  63074. $2=$recv(aUrl)._pathname();
  63075. $ctx1.sendIdx["pathname"]=1;
  63076. $1=$recv($2)._endsWith_("/");
  63077. if($core.assert($1)){
  63078. $3=$recv(aDirname).__comma("index.html");
  63079. $ctx1.sendIdx[","]=1;
  63080. $self._respondFileNamed_to_($3,aResponse);
  63081. } else {
  63082. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  63083. $7=$recv(aUrl)._search();
  63084. if(($receiver = $7) == null || $receiver.a$nil){
  63085. $6="";
  63086. } else {
  63087. $6=$7;
  63088. }
  63089. $4=$recv($5).__comma($6);
  63090. $ctx1.sendIdx[","]=2;
  63091. $self._respondRedirect_to_($4,aResponse);
  63092. }
  63093. return self;
  63094. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  63095. },
  63096. args: ["aDirname", "aUrl", "aResponse"],
  63097. 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]",
  63098. referencedClasses: [],
  63099. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  63100. }),
  63101. $globals.FileServer);
  63102. $core.addMethod(
  63103. $core.method({
  63104. selector: "respondFileNamed:to:",
  63105. protocol: "request handling",
  63106. fn: function (aFilename,aResponse){
  63107. var self=this,$self=this;
  63108. var type,filename;
  63109. return $core.withContext(function($ctx1) {
  63110. var $1,$2,$3,$4;
  63111. filename=aFilename;
  63112. $recv($self.fs)._readFile_do_(filename,(function(ex,file){
  63113. return $core.withContext(function($ctx2) {
  63114. $1=$recv(ex)._notNil();
  63115. if($core.assert($1)){
  63116. $2=console;
  63117. $3=$recv(filename).__comma(" does not exist");
  63118. $ctx2.sendIdx[","]=1;
  63119. $recv($2)._log_($3);
  63120. return $self._respondNotFoundTo_(aResponse);
  63121. } else {
  63122. type=$recv($self._class())._mimeTypeFor_(filename);
  63123. $4=$recv(type).__eq("application/javascript");
  63124. if($core.assert($4)){
  63125. type=$recv(type).__comma(";charset=utf-8");
  63126. type;
  63127. }
  63128. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  63129. $recv(aResponse)._write_encoding_(file,"binary");
  63130. return $recv(aResponse)._end();
  63131. }
  63132. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  63133. }));
  63134. return self;
  63135. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  63136. },
  63137. args: ["aFilename", "aResponse"],
  63138. 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]]",
  63139. referencedClasses: [],
  63140. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  63141. }),
  63142. $globals.FileServer);
  63143. $core.addMethod(
  63144. $core.method({
  63145. selector: "respondInternalErrorTo:",
  63146. protocol: "request handling",
  63147. fn: function (aResponse){
  63148. var self=this,$self=this;
  63149. return $core.withContext(function($ctx1) {
  63150. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  63151. $recv(aResponse)._write_("500 Internal server error");
  63152. $recv(aResponse)._end();
  63153. return self;
  63154. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  63155. },
  63156. args: ["aResponse"],
  63157. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  63158. referencedClasses: [],
  63159. messageSends: ["writeHead:options:", "write:", "end"]
  63160. }),
  63161. $globals.FileServer);
  63162. $core.addMethod(
  63163. $core.method({
  63164. selector: "respondNotCreatedTo:",
  63165. protocol: "request handling",
  63166. fn: function (aResponse){
  63167. var self=this,$self=this;
  63168. return $core.withContext(function($ctx1) {
  63169. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  63170. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  63171. $recv(aResponse)._end();
  63172. return self;
  63173. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  63174. },
  63175. args: ["aResponse"],
  63176. 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.",
  63177. referencedClasses: [],
  63178. messageSends: ["writeHead:options:", "write:", "end"]
  63179. }),
  63180. $globals.FileServer);
  63181. $core.addMethod(
  63182. $core.method({
  63183. selector: "respondNotFoundTo:",
  63184. protocol: "request handling",
  63185. fn: function (aResponse){
  63186. var self=this,$self=this;
  63187. return $core.withContext(function($ctx1) {
  63188. var $2,$1;
  63189. $2=$self._fallbackPage();
  63190. $ctx1.sendIdx["fallbackPage"]=1;
  63191. $1=$recv($2)._isNil();
  63192. if(!$core.assert($1)){
  63193. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  63194. }
  63195. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  63196. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  63197. $ctx1.sendIdx["write:"]=1;
  63198. $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>");
  63199. $ctx1.sendIdx["write:"]=2;
  63200. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  63201. $ctx1.sendIdx["write:"]=3;
  63202. $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>");
  63203. $ctx1.sendIdx["write:"]=4;
  63204. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  63205. $ctx1.sendIdx["write:"]=5;
  63206. $recv(aResponse)._write_("</ul></p></body></html>");
  63207. $recv(aResponse)._end();
  63208. return self;
  63209. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  63210. },
  63211. args: ["aResponse"],
  63212. 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",
  63213. referencedClasses: [],
  63214. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  63215. }),
  63216. $globals.FileServer);
  63217. $core.addMethod(
  63218. $core.method({
  63219. selector: "respondOKTo:",
  63220. protocol: "request handling",
  63221. fn: function (aResponse){
  63222. var self=this,$self=this;
  63223. return $core.withContext(function($ctx1) {
  63224. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  63225. $recv(aResponse)._end();
  63226. return self;
  63227. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  63228. },
  63229. args: ["aResponse"],
  63230. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  63231. referencedClasses: [],
  63232. messageSends: ["writeHead:options:", "end"]
  63233. }),
  63234. $globals.FileServer);
  63235. $core.addMethod(
  63236. $core.method({
  63237. selector: "respondRedirect:to:",
  63238. protocol: "request handling",
  63239. fn: function (aString,aResponse){
  63240. var self=this,$self=this;
  63241. return $core.withContext(function($ctx1) {
  63242. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  63243. $recv(aResponse)._end();
  63244. return self;
  63245. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  63246. },
  63247. args: ["aString", "aResponse"],
  63248. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  63249. referencedClasses: [],
  63250. messageSends: ["writeHead:options:", "end"]
  63251. }),
  63252. $globals.FileServer);
  63253. $core.addMethod(
  63254. $core.method({
  63255. selector: "start",
  63256. protocol: "starting",
  63257. fn: function (){
  63258. var self=this,$self=this;
  63259. return $core.withContext(function($ctx1) {
  63260. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  63261. $self._checkDirectoryLayout();
  63262. $1=$recv($self.http)._createServer_((function(request,response){
  63263. return $core.withContext(function($ctx2) {
  63264. return $self._handleRequest_respondTo_(request,response);
  63265. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  63266. }));
  63267. $recv($1)._on_do_("error",(function(error){
  63268. return $core.withContext(function($ctx2) {
  63269. $2=console;
  63270. $3="Error starting server: ".__comma(error);
  63271. $ctx2.sendIdx[","]=1;
  63272. return $recv($2)._log_($3);
  63273. $ctx2.sendIdx["log:"]=1;
  63274. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  63275. }));
  63276. $ctx1.sendIdx["on:do:"]=1;
  63277. $recv($1)._on_do_("listening",(function(){
  63278. return $core.withContext(function($ctx2) {
  63279. $4=console;
  63280. $8=$self._host();
  63281. $ctx2.sendIdx["host"]=1;
  63282. $7="Starting file server on http://".__comma($8);
  63283. $6=$recv($7).__comma(":");
  63284. $ctx2.sendIdx[","]=3;
  63285. $10=$self._port();
  63286. $ctx2.sendIdx["port"]=1;
  63287. $9=$recv($10)._asString();
  63288. $5=$recv($6).__comma($9);
  63289. $ctx2.sendIdx[","]=2;
  63290. return $recv($4)._log_($5);
  63291. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63292. }));
  63293. $recv($1)._listen_host_($self._port(),$self._host());
  63294. return self;
  63295. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  63296. },
  63297. args: [],
  63298. 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.",
  63299. referencedClasses: [],
  63300. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  63301. }),
  63302. $globals.FileServer);
  63303. $core.addMethod(
  63304. $core.method({
  63305. selector: "startOn:",
  63306. protocol: "starting",
  63307. fn: function (aPort){
  63308. var self=this,$self=this;
  63309. return $core.withContext(function($ctx1) {
  63310. $self._port_(aPort);
  63311. $self._start();
  63312. return self;
  63313. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  63314. },
  63315. args: ["aPort"],
  63316. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  63317. referencedClasses: [],
  63318. messageSends: ["port:", "start"]
  63319. }),
  63320. $globals.FileServer);
  63321. $core.addMethod(
  63322. $core.method({
  63323. selector: "username:",
  63324. protocol: "accessing",
  63325. fn: function (aUsername){
  63326. var self=this,$self=this;
  63327. $self.username=aUsername;
  63328. return self;
  63329. },
  63330. args: ["aUsername"],
  63331. source: "username: aUsername\x0a\x09username := aUsername.",
  63332. referencedClasses: [],
  63333. messageSends: []
  63334. }),
  63335. $globals.FileServer);
  63336. $core.addMethod(
  63337. $core.method({
  63338. selector: "validateBasePath",
  63339. protocol: "private",
  63340. fn: function (){
  63341. var self=this,$self=this;
  63342. return $core.withContext(function($ctx1) {
  63343. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  63344. $1=$self.fs;
  63345. $2=$self._basePath();
  63346. $ctx1.sendIdx["basePath"]=1;
  63347. $recv($1)._stat_then_($2,(function(err,stat){
  63348. return $core.withContext(function($ctx2) {
  63349. if(($receiver = err) == null || $receiver.a$nil){
  63350. $3=$recv(stat)._isDirectory();
  63351. if(!$core.assert($3)){
  63352. $4=console;
  63353. $7=$self._basePath();
  63354. $ctx2.sendIdx["basePath"]=2;
  63355. $6="Warning: --base-path parameter ".__comma($7);
  63356. $ctx2.sendIdx[","]=2;
  63357. $5=$recv($6).__comma(" is not a directory.");
  63358. $ctx2.sendIdx[","]=1;
  63359. return $recv($4)._warn_($5);
  63360. $ctx2.sendIdx["warn:"]=1;
  63361. }
  63362. } else {
  63363. $8=console;
  63364. $9=$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.");
  63365. $ctx2.sendIdx[","]=3;
  63366. return $recv($8)._warn_($9);
  63367. }
  63368. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  63369. }));
  63370. return self;
  63371. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  63372. },
  63373. args: [],
  63374. 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.' ]].",
  63375. referencedClasses: [],
  63376. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  63377. }),
  63378. $globals.FileServer);
  63379. $core.addMethod(
  63380. $core.method({
  63381. selector: "withBasePath:",
  63382. protocol: "private",
  63383. fn: function (aBaseRelativePath){
  63384. var self=this,$self=this;
  63385. return $core.withContext(function($ctx1) {
  63386. return $recv($self.path)._join_with_($self._basePath(),aBaseRelativePath);
  63387. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  63388. },
  63389. args: ["aBaseRelativePath"],
  63390. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  63391. referencedClasses: [],
  63392. messageSends: ["join:with:", "basePath"]
  63393. }),
  63394. $globals.FileServer);
  63395. $core.addMethod(
  63396. $core.method({
  63397. selector: "writeData:toFileNamed:",
  63398. protocol: "private",
  63399. fn: function (data,aFilename){
  63400. var self=this,$self=this;
  63401. return $core.withContext(function($ctx1) {
  63402. $recv(console)._log_(aFilename);
  63403. return self;
  63404. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  63405. },
  63406. args: ["data", "aFilename"],
  63407. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  63408. referencedClasses: [],
  63409. messageSends: ["log:"]
  63410. }),
  63411. $globals.FileServer);
  63412. $core.setSlots($globals.FileServer.a$cls, ["mimeTypes"]);
  63413. $core.addMethod(
  63414. $core.method({
  63415. selector: "commandLineSwitches",
  63416. protocol: "accessing",
  63417. fn: function (){
  63418. var self=this,$self=this;
  63419. var switches;
  63420. return $core.withContext(function($ctx1) {
  63421. switches=$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  63422. return $core.withContext(function($ctx2) {
  63423. return $recv(each)._selector();
  63424. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63425. }));
  63426. $ctx1.sendIdx["collect:"]=1;
  63427. switches=$recv(switches)._select_((function(each){
  63428. return $core.withContext(function($ctx2) {
  63429. return $recv(each)._match_("^[^:]*:$");
  63430. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  63431. }));
  63432. switches=$recv(switches)._collect_((function(each){
  63433. return $core.withContext(function($ctx2) {
  63434. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  63435. $ctx2.sendIdx["replace:with:"]=1;
  63436. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  63437. }));
  63438. return switches;
  63439. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.a$cls)});
  63440. },
  63441. args: [],
  63442. 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",
  63443. referencedClasses: [],
  63444. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  63445. }),
  63446. $globals.FileServer.a$cls);
  63447. $core.addMethod(
  63448. $core.method({
  63449. selector: "createServerWithArguments:",
  63450. protocol: "initialization",
  63451. fn: function (options){
  63452. var self=this,$self=this;
  63453. var server,popFront,front,optionName,optionValue,switches;
  63454. return $core.withContext(function($ctx1) {
  63455. var $1,$2,$3,$4,$5,$6,$7,$8;
  63456. var $early={};
  63457. try {
  63458. switches=$self._commandLineSwitches();
  63459. server=$self._new();
  63460. $recv(options)._ifEmpty_((function(){
  63461. throw $early=[server];
  63462. }));
  63463. $1=$recv($recv(options)._size())._even();
  63464. if(!$core.assert($1)){
  63465. $recv(console)._log_("Using default parameters.");
  63466. $ctx1.sendIdx["log:"]=1;
  63467. $2=console;
  63468. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  63469. $ctx1.sendIdx[","]=1;
  63470. $recv($2)._log_($3);
  63471. $ctx1.sendIdx["log:"]=2;
  63472. $4=console;
  63473. $5="Use any of the following ones: ".__comma(switches);
  63474. $ctx1.sendIdx[","]=2;
  63475. $recv($4)._log_($5);
  63476. $ctx1.sendIdx["log:"]=3;
  63477. return server;
  63478. }
  63479. popFront=(function(args){
  63480. return $core.withContext(function($ctx2) {
  63481. front=$recv(args)._first();
  63482. $recv(args)._remove_(front);
  63483. return front;
  63484. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  63485. });
  63486. $recv((function(){
  63487. return $core.withContext(function($ctx2) {
  63488. return $recv(options)._notEmpty();
  63489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  63490. }))._whileTrue_((function(){
  63491. return $core.withContext(function($ctx2) {
  63492. optionName=$recv(popFront)._value_(options);
  63493. $ctx2.sendIdx["value:"]=1;
  63494. optionValue=$recv(popFront)._value_(options);
  63495. $6=$recv(switches)._includes_(optionName);
  63496. if($core.assert($6)){
  63497. optionName=$self._selectorForCommandLineSwitch_(optionName);
  63498. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  63499. } else {
  63500. $7=console;
  63501. $8=$recv(optionName).__comma(" is not a valid commandline option");
  63502. $ctx2.sendIdx[","]=3;
  63503. $recv($7)._log_($8);
  63504. $ctx2.sendIdx["log:"]=4;
  63505. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  63506. }
  63507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  63508. }));
  63509. return server;
  63510. }
  63511. catch(e) {if(e===$early)return e[0]; throw e}
  63512. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.a$cls)});
  63513. },
  63514. args: ["options"],
  63515. 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.",
  63516. referencedClasses: ["Array"],
  63517. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  63518. }),
  63519. $globals.FileServer.a$cls);
  63520. $core.addMethod(
  63521. $core.method({
  63522. selector: "defaultBasePath",
  63523. protocol: "accessing",
  63524. fn: function (){
  63525. var self=this,$self=this;
  63526. return "./";
  63527. },
  63528. args: [],
  63529. source: "defaultBasePath\x0a\x09^ './'",
  63530. referencedClasses: [],
  63531. messageSends: []
  63532. }),
  63533. $globals.FileServer.a$cls);
  63534. $core.addMethod(
  63535. $core.method({
  63536. selector: "defaultHost",
  63537. protocol: "accessing",
  63538. fn: function (){
  63539. var self=this,$self=this;
  63540. return "127.0.0.1";
  63541. },
  63542. args: [],
  63543. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  63544. referencedClasses: [],
  63545. messageSends: []
  63546. }),
  63547. $globals.FileServer.a$cls);
  63548. $core.addMethod(
  63549. $core.method({
  63550. selector: "defaultMimeTypes",
  63551. protocol: "accessing",
  63552. fn: function (){
  63553. var self=this,$self=this;
  63554. 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"]);
  63555. },
  63556. args: [],
  63557. 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}",
  63558. referencedClasses: [],
  63559. messageSends: []
  63560. }),
  63561. $globals.FileServer.a$cls);
  63562. $core.addMethod(
  63563. $core.method({
  63564. selector: "defaultPort",
  63565. protocol: "accessing",
  63566. fn: function (){
  63567. var self=this,$self=this;
  63568. return (4000);
  63569. },
  63570. args: [],
  63571. source: "defaultPort\x0a\x09^ 4000",
  63572. referencedClasses: [],
  63573. messageSends: []
  63574. }),
  63575. $globals.FileServer.a$cls);
  63576. $core.addMethod(
  63577. $core.method({
  63578. selector: "main",
  63579. protocol: "initialization",
  63580. fn: function (){
  63581. var self=this,$self=this;
  63582. var fileServer,args;
  63583. return $core.withContext(function($ctx1) {
  63584. var $1;
  63585. var $early={};
  63586. try {
  63587. args=$recv(process)._argv();
  63588. $recv(args)._removeFrom_to_((1),(3));
  63589. $recv(args)._detect_ifNone_((function(each){
  63590. return $core.withContext(function($ctx2) {
  63591. $1=$recv(each).__eq("--help");
  63592. if($core.assert($1)){
  63593. return $recv($globals.FileServer)._printHelp();
  63594. }
  63595. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63596. }),(function(){
  63597. return $core.withContext(function($ctx2) {
  63598. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  63599. throw $early=[$recv(fileServer)._start()];
  63600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63601. }));
  63602. return self;
  63603. }
  63604. catch(e) {if(e===$early)return e[0]; throw e}
  63605. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.a$cls)});
  63606. },
  63607. args: [],
  63608. 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]",
  63609. referencedClasses: ["FileServer"],
  63610. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  63611. }),
  63612. $globals.FileServer.a$cls);
  63613. $core.addMethod(
  63614. $core.method({
  63615. selector: "mimeTypeFor:",
  63616. protocol: "accessing",
  63617. fn: function (aString){
  63618. var self=this,$self=this;
  63619. return $core.withContext(function($ctx1) {
  63620. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  63621. return "text/plain";
  63622. }));
  63623. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.a$cls)});
  63624. },
  63625. args: ["aString"],
  63626. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  63627. referencedClasses: [],
  63628. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  63629. }),
  63630. $globals.FileServer.a$cls);
  63631. $core.addMethod(
  63632. $core.method({
  63633. selector: "mimeTypes",
  63634. protocol: "accessing",
  63635. fn: function (){
  63636. var self=this,$self=this;
  63637. return $core.withContext(function($ctx1) {
  63638. var $1,$receiver;
  63639. $1=$self.mimeTypes;
  63640. if(($receiver = $1) == null || $receiver.a$nil){
  63641. $self.mimeTypes=$self._defaultMimeTypes();
  63642. return $self.mimeTypes;
  63643. } else {
  63644. return $1;
  63645. }
  63646. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.a$cls)});
  63647. },
  63648. args: [],
  63649. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  63650. referencedClasses: [],
  63651. messageSends: ["ifNil:", "defaultMimeTypes"]
  63652. }),
  63653. $globals.FileServer.a$cls);
  63654. $core.addMethod(
  63655. $core.method({
  63656. selector: "printHelp",
  63657. protocol: "accessing",
  63658. fn: function (){
  63659. var self=this,$self=this;
  63660. return $core.withContext(function($ctx1) {
  63661. $recv(console)._log_("Available commandline options are:");
  63662. $ctx1.sendIdx["log:"]=1;
  63663. $recv(console)._log_("--help");
  63664. $ctx1.sendIdx["log:"]=2;
  63665. $recv($self._commandLineSwitches())._do_((function(each){
  63666. return $core.withContext(function($ctx2) {
  63667. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  63668. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63669. }));
  63670. return self;
  63671. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.a$cls)});
  63672. },
  63673. args: [],
  63674. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  63675. referencedClasses: [],
  63676. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  63677. }),
  63678. $globals.FileServer.a$cls);
  63679. $core.addMethod(
  63680. $core.method({
  63681. selector: "selectorForCommandLineSwitch:",
  63682. protocol: "accessing",
  63683. fn: function (aSwitch){
  63684. var self=this,$self=this;
  63685. return $core.withContext(function($ctx1) {
  63686. var $1;
  63687. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  63688. return $core.withContext(function($ctx2) {
  63689. return $recv($recv(each)._second())._asUppercase();
  63690. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63691. }));
  63692. $ctx1.sendIdx["replace:with:"]=1;
  63693. return $recv($1).__comma(":");
  63694. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.a$cls)});
  63695. },
  63696. args: ["aSwitch"],
  63697. 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 ]), ':'",
  63698. referencedClasses: [],
  63699. messageSends: [",", "replace:with:", "asUppercase", "second"]
  63700. }),
  63701. $globals.FileServer.a$cls);
  63702. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  63703. $core.addMethod(
  63704. $core.method({
  63705. selector: "finishMessage",
  63706. protocol: "action",
  63707. fn: function (){
  63708. var self=this,$self=this;
  63709. return $core.withContext(function($ctx1) {
  63710. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  63711. $recv((function(){
  63712. }))._valueWithTimeout_((600));
  63713. return self;
  63714. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  63715. },
  63716. args: [],
  63717. 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",
  63718. referencedClasses: ["String"],
  63719. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  63720. }),
  63721. $globals.Initer);
  63722. $core.addMethod(
  63723. $core.method({
  63724. selector: "gruntInitThenDo:",
  63725. protocol: "action",
  63726. fn: function (aBlock){
  63727. var self=this,$self=this;
  63728. var child,sanitizedTemplatePath;
  63729. return $core.withContext(function($ctx1) {
  63730. var $1,$3,$2;
  63731. sanitizedTemplatePath=$recv($recv($recv($self.path)._join_with_($self.nmPath,"@ambers/grunt-init-amber-project"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  63732. $ctx1.sendIdx["replace:with:"]=1;
  63733. child=$recv($self.childProcess)._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  63734. $1=child;
  63735. $recv($1)._on_do_("error",aBlock);
  63736. $ctx1.sendIdx["on:do:"]=1;
  63737. $recv($1)._on_do_("close",(function(code){
  63738. return $core.withContext(function($ctx2) {
  63739. $3=$recv(code).__eq((0));
  63740. if($core.assert($3)){
  63741. $2=nil;
  63742. } else {
  63743. $2=code;
  63744. }
  63745. return $recv(aBlock)._value_($2);
  63746. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63747. }));
  63748. return self;
  63749. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  63750. },
  63751. args: ["aBlock"],
  63752. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: '@ambers/grunt-init-amber-project')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  63753. referencedClasses: [],
  63754. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63755. }),
  63756. $globals.Initer);
  63757. $core.addMethod(
  63758. $core.method({
  63759. selector: "initProjectThenDo:",
  63760. protocol: "action",
  63761. fn: function (aBlock){
  63762. var self=this,$self=this;
  63763. var child;
  63764. return $core.withContext(function($ctx1) {
  63765. var $1;
  63766. child=$recv($self.childProcess)._exec_thenDo_("npm run init",aBlock);
  63767. $1=$recv(child)._stdout();
  63768. $ctx1.sendIdx["stdout"]=1;
  63769. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  63770. return self;
  63771. }, function($ctx1) {$ctx1.fill(self,"initProjectThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63772. },
  63773. args: ["aBlock"],
  63774. source: "initProjectThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: 'npm run init'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  63775. referencedClasses: [],
  63776. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  63777. }),
  63778. $globals.Initer);
  63779. $core.addMethod(
  63780. $core.method({
  63781. selector: "initialize",
  63782. protocol: "initialization",
  63783. fn: function (){
  63784. var self=this,$self=this;
  63785. return $core.withContext(function($ctx1) {
  63786. (
  63787. $ctx1.supercall = true,
  63788. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63789. $ctx1.supercall = false;
  63790. $self.childProcess=$recv(require)._value_("child_process");
  63791. $self.nmPath=$recv($self.path)._join_with_($self._rootDirname(),"node_modules");
  63792. return self;
  63793. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  63794. },
  63795. args: [],
  63796. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  63797. referencedClasses: [],
  63798. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  63799. }),
  63800. $globals.Initer);
  63801. $core.addMethod(
  63802. $core.method({
  63803. selector: "npmScriptForModule:named:",
  63804. protocol: "npm",
  63805. fn: function (aString,anotherString){
  63806. var self=this,$self=this;
  63807. var modulePath,packageJson,binSection,scriptPath;
  63808. return $core.withContext(function($ctx1) {
  63809. var $1,$3,$4,$2,$5;
  63810. $1=$self.path;
  63811. $3=$recv(require)._provided();
  63812. $4=$recv(aString).__comma("/package.json");
  63813. $ctx1.sendIdx[","]=1;
  63814. $2=$recv($3)._resolve_($4);
  63815. modulePath=$recv($1)._dirname_($2);
  63816. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  63817. binSection=$recv(packageJson)._at_("bin");
  63818. $ctx1.sendIdx["at:"]=1;
  63819. $5=$recv(binSection)._isString();
  63820. if($core.assert($5)){
  63821. scriptPath=binSection;
  63822. } else {
  63823. scriptPath=$recv(binSection)._at_(anotherString);
  63824. }
  63825. return $recv($self.path)._join_with_(modulePath,scriptPath);
  63826. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  63827. },
  63828. args: ["aString", "anotherString"],
  63829. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09require provided resolve: 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",
  63830. referencedClasses: ["Smalltalk"],
  63831. messageSends: ["dirname:", "resolve:", "provided", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  63832. }),
  63833. $globals.Initer);
  63834. $core.addMethod(
  63835. $core.method({
  63836. selector: "start",
  63837. protocol: "action",
  63838. fn: function (){
  63839. var self=this,$self=this;
  63840. return $core.withContext(function($ctx1) {
  63841. var $1,$2,$3,$receiver;
  63842. $self._gruntInitThenDo_((function(error){
  63843. return $core.withContext(function($ctx2) {
  63844. if(($receiver = error) == null || $receiver.a$nil){
  63845. return $self._initProjectThenDo_((function(error2){
  63846. return $core.withContext(function($ctx3) {
  63847. if(($receiver = error2) == null || $receiver.a$nil){
  63848. $self._finishMessage();
  63849. return $recv(process)._exit();
  63850. } else {
  63851. $3=console;
  63852. $recv($3)._log_("npm run init exec error:");
  63853. $ctx3.sendIdx["log:"]=3;
  63854. $recv($3)._log_(error2);
  63855. return $recv(process)._exit_((105));
  63856. }
  63857. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  63858. }));
  63859. } else {
  63860. $1=console;
  63861. $recv($1)._log_("grunt-init exec error:");
  63862. $ctx2.sendIdx["log:"]=1;
  63863. $2=$recv($1)._log_(error);
  63864. $ctx2.sendIdx["log:"]=2;
  63865. return $recv(process)._exit_((101));
  63866. $ctx2.sendIdx["exit:"]=1;
  63867. }
  63868. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  63869. }));
  63870. return self;
  63871. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  63872. },
  63873. args: [],
  63874. 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 initProjectThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm run init exec error:'; log: error2.\x0a\x09\x09process exit: 105 ]\x0a\x09ifNil: [\x0a\x0a\x09self finishMessage.\x0a\x09process exit ]]]]",
  63875. referencedClasses: [],
  63876. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "initProjectThenDo:", "finishMessage", "exit"]
  63877. }),
  63878. $globals.Initer);
  63879. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  63880. $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.";
  63881. $core.addMethod(
  63882. $core.method({
  63883. selector: "addVariableNamed:to:",
  63884. protocol: "private",
  63885. fn: function (aString,anObject){
  63886. var self=this,$self=this;
  63887. var newClass,newObject;
  63888. return $core.withContext(function($ctx1) {
  63889. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  63890. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  63891. newObject=$recv(newClass)._new();
  63892. $self._setPreviousVariablesFor_from_(newObject,anObject);
  63893. return newObject;
  63894. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  63895. },
  63896. args: ["aString", "anObject"],
  63897. 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",
  63898. referencedClasses: [],
  63899. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  63900. }),
  63901. $globals.Repl);
  63902. $core.addMethod(
  63903. $core.method({
  63904. selector: "assignNewVariable:do:",
  63905. protocol: "private",
  63906. fn: function (buffer,aBlock){
  63907. var self=this,$self=this;
  63908. return $core.withContext(function($ctx1) {
  63909. var $2,$3,$1,$receiver;
  63910. return $self._parseAssignment_do_(buffer,(function(name,expr){
  63911. var varName,value;
  63912. return $core.withContext(function($ctx2) {
  63913. if(($receiver = name) == null || $receiver.a$nil){
  63914. varName=$self._nextResultName();
  63915. } else {
  63916. varName=name;
  63917. }
  63918. $self.session=$self._addVariableNamed_to_(varName,$self.session);
  63919. $recv((function(){
  63920. return $core.withContext(function($ctx3) {
  63921. $2=$recv(varName).__comma(" := ");
  63922. if(($receiver = expr) == null || $receiver.a$nil){
  63923. $3=buffer;
  63924. } else {
  63925. $3=expr;
  63926. }
  63927. $1=$recv($2).__comma($3);
  63928. $ctx3.sendIdx[","]=1;
  63929. value=$self._eval_on_($1,$self.session);
  63930. return value;
  63931. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63932. }))._on_do_($globals.Error,(function(e){
  63933. return $core.withContext(function($ctx3) {
  63934. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  63935. value=nil;
  63936. return value;
  63937. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  63938. }));
  63939. return $recv(aBlock)._value_value_(varName,value);
  63940. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  63941. }));
  63942. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  63943. },
  63944. args: ["buffer", "aBlock"],
  63945. 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]",
  63946. referencedClasses: ["Error", "ConsoleErrorHandler"],
  63947. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  63948. }),
  63949. $globals.Repl);
  63950. $core.addMethod(
  63951. $core.method({
  63952. selector: "clearScreen",
  63953. protocol: "actions",
  63954. fn: function (){
  63955. var self=this,$self=this;
  63956. var esc,cls;
  63957. return $core.withContext(function($ctx1) {
  63958. var $1;
  63959. esc=$recv($globals.String)._fromCharCode_((27));
  63960. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  63961. $ctx1.sendIdx[","]=2;
  63962. cls=$recv($1).__comma("[0;0f");
  63963. $ctx1.sendIdx[","]=1;
  63964. $recv($recv(process)._stdout())._write_(cls);
  63965. $recv($self.interface)._prompt();
  63966. return self;
  63967. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  63968. },
  63969. args: [],
  63970. 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",
  63971. referencedClasses: ["String"],
  63972. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  63973. }),
  63974. $globals.Repl);
  63975. $core.addMethod(
  63976. $core.method({
  63977. selector: "close",
  63978. protocol: "actions",
  63979. fn: function (){
  63980. var self=this,$self=this;
  63981. return $core.withContext(function($ctx1) {
  63982. $recv($recv(process)._stdin())._destroy();
  63983. return self;
  63984. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  63985. },
  63986. args: [],
  63987. source: "close\x0a\x09process stdin destroy",
  63988. referencedClasses: [],
  63989. messageSends: ["destroy", "stdin"]
  63990. }),
  63991. $globals.Repl);
  63992. $core.addMethod(
  63993. $core.method({
  63994. selector: "commands",
  63995. protocol: "accessing",
  63996. fn: function (){
  63997. var self=this,$self=this;
  63998. return $self.commands;
  63999. },
  64000. args: [],
  64001. source: "commands\x0a\x09^ commands",
  64002. referencedClasses: [],
  64003. messageSends: []
  64004. }),
  64005. $globals.Repl);
  64006. $core.addMethod(
  64007. $core.method({
  64008. selector: "createInterface",
  64009. protocol: "actions",
  64010. fn: function (){
  64011. var self=this,$self=this;
  64012. return $core.withContext(function($ctx1) {
  64013. $self.interface=$recv($self.readline)._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  64014. $recv($self.interface)._on_do_("line",(function(buffer){
  64015. return $core.withContext(function($ctx2) {
  64016. return $self._processLine_(buffer);
  64017. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  64018. }));
  64019. $ctx1.sendIdx["on:do:"]=1;
  64020. $recv($self.interface)._on_do_("close",(function(){
  64021. return $core.withContext(function($ctx2) {
  64022. return $self._close();
  64023. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64024. }));
  64025. $self._printWelcome();
  64026. $self._setupHotkeys();
  64027. $self._setPrompt();
  64028. $recv($self.interface)._prompt();
  64029. return self;
  64030. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  64031. },
  64032. args: [],
  64033. 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",
  64034. referencedClasses: [],
  64035. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  64036. }),
  64037. $globals.Repl);
  64038. $core.addMethod(
  64039. $core.method({
  64040. selector: "encapsulateVariable:withValue:in:",
  64041. protocol: "private",
  64042. fn: function (aString,anObject,aClass){
  64043. var self=this,$self=this;
  64044. var compiler;
  64045. return $core.withContext(function($ctx1) {
  64046. var $1,$4,$3,$2,$5,$6;
  64047. compiler=$recv($globals.Compiler)._new();
  64048. $1=compiler;
  64049. $4=$recv(aString).__comma(": anObject ^ ");
  64050. $ctx1.sendIdx[","]=3;
  64051. $3=$recv($4).__comma(aString);
  64052. $ctx1.sendIdx[","]=2;
  64053. $2=$recv($3).__comma(" := anObject");
  64054. $ctx1.sendIdx[","]=1;
  64055. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  64056. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  64057. $5=compiler;
  64058. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  64059. $ctx1.sendIdx[","]=4;
  64060. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  64061. return self;
  64062. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  64063. },
  64064. args: ["aString", "anObject", "aClass"],
  64065. 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'.",
  64066. referencedClasses: ["Compiler"],
  64067. messageSends: ["new", "install:forClass:protocol:", ","]
  64068. }),
  64069. $globals.Repl);
  64070. $core.addMethod(
  64071. $core.method({
  64072. selector: "eval:",
  64073. protocol: "actions",
  64074. fn: function (buffer){
  64075. var self=this,$self=this;
  64076. return $core.withContext(function($ctx1) {
  64077. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  64078. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  64079. },
  64080. args: ["buffer"],
  64081. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  64082. referencedClasses: ["DoIt"],
  64083. messageSends: ["eval:on:", "new"]
  64084. }),
  64085. $globals.Repl);
  64086. $core.addMethod(
  64087. $core.method({
  64088. selector: "eval:on:",
  64089. protocol: "actions",
  64090. fn: function (buffer,anObject){
  64091. var self=this,$self=this;
  64092. var result;
  64093. return $core.withContext(function($ctx1) {
  64094. var $1;
  64095. $recv(buffer)._ifNotEmpty_((function(){
  64096. return $core.withContext(function($ctx2) {
  64097. return $recv((function(){
  64098. return $core.withContext(function($ctx3) {
  64099. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  64100. return result;
  64101. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  64102. }))._tryCatch_((function(e){
  64103. return $core.withContext(function($ctx3) {
  64104. $1=$recv(e)._isSmalltalkError();
  64105. if($core.assert($1)){
  64106. return $recv(e)._pass();
  64107. } else {
  64108. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  64109. }
  64110. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  64111. }));
  64112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64113. }));
  64114. return result;
  64115. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  64116. },
  64117. args: ["buffer", "anObject"],
  64118. 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 pass ]\x0a\x09\x09\x09\x09\x09ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  64119. referencedClasses: ["Compiler"],
  64120. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "pass", "write:", "stdout", "jsStack"]
  64121. }),
  64122. $globals.Repl);
  64123. $core.addMethod(
  64124. $core.method({
  64125. selector: "executeCommand:",
  64126. protocol: "private",
  64127. fn: function (aString){
  64128. var self=this,$self=this;
  64129. return $core.withContext(function($ctx1) {
  64130. var $1;
  64131. var $early={};
  64132. try {
  64133. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  64134. return $core.withContext(function($ctx2) {
  64135. $1=$recv(names)._includes_(aString);
  64136. if($core.assert($1)){
  64137. $recv(cmd)._value();
  64138. throw $early=[true];
  64139. }
  64140. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  64141. }));
  64142. return false;
  64143. }
  64144. catch(e) {if(e===$early)return e[0]; throw e}
  64145. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  64146. },
  64147. args: ["aString"],
  64148. 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",
  64149. referencedClasses: [],
  64150. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  64151. }),
  64152. $globals.Repl);
  64153. $core.addMethod(
  64154. $core.method({
  64155. selector: "initialize",
  64156. protocol: "initialization",
  64157. fn: function (){
  64158. var self=this,$self=this;
  64159. return $core.withContext(function($ctx1) {
  64160. (
  64161. $ctx1.supercall = true,
  64162. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  64163. $ctx1.supercall = false;
  64164. $self.session=$recv($globals.DoIt)._new();
  64165. $self.readline=$recv(require)._value_("readline");
  64166. $ctx1.sendIdx["value:"]=1;
  64167. $self.util=$recv(require)._value_("util");
  64168. $self._setupCommands();
  64169. return self;
  64170. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  64171. },
  64172. args: [],
  64173. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  64174. referencedClasses: ["DoIt"],
  64175. messageSends: ["initialize", "new", "value:", "setupCommands"]
  64176. }),
  64177. $globals.Repl);
  64178. $core.addMethod(
  64179. $core.method({
  64180. selector: "instanceVariableNamesFor:",
  64181. protocol: "private",
  64182. fn: function (aClass){
  64183. var self=this,$self=this;
  64184. return $core.withContext(function($ctx1) {
  64185. var $1,$2,$receiver;
  64186. $1=$recv(aClass)._superclass();
  64187. $ctx1.sendIdx["superclass"]=1;
  64188. if(($receiver = $1) == null || $receiver.a$nil){
  64189. return $recv(aClass)._instanceVariableNames();
  64190. } else {
  64191. $2=$recv(aClass)._instanceVariableNames();
  64192. $ctx1.sendIdx["instanceVariableNames"]=1;
  64193. return $recv($2)._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  64194. }
  64195. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  64196. },
  64197. args: ["aClass"],
  64198. 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]",
  64199. referencedClasses: [],
  64200. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  64201. }),
  64202. $globals.Repl);
  64203. $core.addMethod(
  64204. $core.method({
  64205. selector: "isIdentifier:",
  64206. protocol: "private",
  64207. fn: function (aString){
  64208. var self=this,$self=this;
  64209. return $core.withContext(function($ctx1) {
  64210. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  64211. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  64212. },
  64213. args: ["aString"],
  64214. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  64215. referencedClasses: [],
  64216. messageSends: ["match:", "asRegexp"]
  64217. }),
  64218. $globals.Repl);
  64219. $core.addMethod(
  64220. $core.method({
  64221. selector: "isVariableDefined:",
  64222. protocol: "private",
  64223. fn: function (aString){
  64224. var self=this,$self=this;
  64225. return $core.withContext(function($ctx1) {
  64226. return $recv($self._instanceVariableNamesFor_($recv($self.session)._class()))._includes_(aString);
  64227. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  64228. },
  64229. args: ["aString"],
  64230. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  64231. referencedClasses: [],
  64232. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  64233. }),
  64234. $globals.Repl);
  64235. $core.addMethod(
  64236. $core.method({
  64237. selector: "nextResultName",
  64238. protocol: "private",
  64239. fn: function (){
  64240. var self=this,$self=this;
  64241. return $core.withContext(function($ctx1) {
  64242. var $1,$receiver;
  64243. $1=$self.resultCount;
  64244. if(($receiver = $1) == null || $receiver.a$nil){
  64245. $self.resultCount=(1);
  64246. } else {
  64247. $self.resultCount=$recv($self.resultCount).__plus((1));
  64248. }
  64249. return "res".__comma($recv($self.resultCount)._asString());
  64250. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  64251. },
  64252. args: [],
  64253. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  64254. referencedClasses: [],
  64255. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  64256. }),
  64257. $globals.Repl);
  64258. $core.addMethod(
  64259. $core.method({
  64260. selector: "onKeyPress:",
  64261. protocol: "private",
  64262. fn: function (key){
  64263. var self=this,$self=this;
  64264. return $core.withContext(function($ctx1) {
  64265. var $1;
  64266. $1=$recv($recv(key)._ctrl())._and_((function(){
  64267. return $core.withContext(function($ctx2) {
  64268. return $recv($recv(key)._name()).__eq("l");
  64269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64270. }));
  64271. if($core.assert($1)){
  64272. $self._clearScreen();
  64273. }
  64274. return self;
  64275. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  64276. },
  64277. args: ["key"],
  64278. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  64279. referencedClasses: [],
  64280. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  64281. }),
  64282. $globals.Repl);
  64283. $core.addMethod(
  64284. $core.method({
  64285. selector: "parseAssignment:do:",
  64286. protocol: "private",
  64287. fn: function (aString,aBlock){
  64288. var self=this,$self=this;
  64289. var assignment;
  64290. return $core.withContext(function($ctx1) {
  64291. var $2,$1;
  64292. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  64293. return $core.withContext(function($ctx2) {
  64294. return $recv(s)._trimBoth();
  64295. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  64296. }));
  64297. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  64298. return $core.withContext(function($ctx2) {
  64299. $2=$recv(assignment)._first();
  64300. $ctx2.sendIdx["first"]=1;
  64301. return $self._isIdentifier_($2);
  64302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64303. }));
  64304. if($core.assert($1)){
  64305. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  64306. $ctx1.sendIdx["value:value:"]=1;
  64307. } else {
  64308. return $recv(aBlock)._value_value_(nil,nil);
  64309. }
  64310. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  64311. },
  64312. args: ["aString", "aBlock"],
  64313. 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 ]",
  64314. referencedClasses: [],
  64315. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  64316. }),
  64317. $globals.Repl);
  64318. $core.addMethod(
  64319. $core.method({
  64320. selector: "presentResultNamed:withValue:",
  64321. protocol: "private",
  64322. fn: function (varName,value){
  64323. var self=this,$self=this;
  64324. return $core.withContext(function($ctx1) {
  64325. var $3,$2,$1;
  64326. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  64327. $ctx1.sendIdx[","]=3;
  64328. $2=$recv($3).__comma(" = ");
  64329. $ctx1.sendIdx[","]=2;
  64330. $1=$recv($2).__comma($recv(value)._asString());
  64331. $ctx1.sendIdx[","]=1;
  64332. $recv($globals.Transcript)._show_($1);
  64333. $recv($globals.Transcript)._cr();
  64334. $recv($self.interface)._prompt();
  64335. return self;
  64336. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  64337. },
  64338. args: ["varName", "value"],
  64339. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  64340. referencedClasses: ["Transcript"],
  64341. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  64342. }),
  64343. $globals.Repl);
  64344. $core.addMethod(
  64345. $core.method({
  64346. selector: "printWelcome",
  64347. protocol: "actions",
  64348. fn: function (){
  64349. var self=this,$self=this;
  64350. return $core.withContext(function($ctx1) {
  64351. $recv($globals.Transcript)._show_("Type :q to exit.");
  64352. $recv($globals.Transcript)._cr();
  64353. return self;
  64354. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  64355. },
  64356. args: [],
  64357. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  64358. referencedClasses: ["Transcript"],
  64359. messageSends: ["show:", "cr"]
  64360. }),
  64361. $globals.Repl);
  64362. $core.addMethod(
  64363. $core.method({
  64364. selector: "processLine:",
  64365. protocol: "private",
  64366. fn: function (buffer){
  64367. var self=this,$self=this;
  64368. var show;
  64369. return $core.withContext(function($ctx1) {
  64370. var $1,$2;
  64371. show=(function(varName,value){
  64372. return $core.withContext(function($ctx2) {
  64373. return $self._presentResultNamed_withValue_(varName,value);
  64374. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  64375. });
  64376. $1=$self._executeCommand_(buffer);
  64377. if(!$core.assert($1)){
  64378. $2=$self._isVariableDefined_(buffer);
  64379. if($core.assert($2)){
  64380. $recv(show)._value_value_(buffer,$recv($self.session)._perform_(buffer));
  64381. } else {
  64382. $self._assignNewVariable_do_(buffer,show);
  64383. }
  64384. }
  64385. return self;
  64386. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  64387. },
  64388. args: ["buffer"],
  64389. 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]]",
  64390. referencedClasses: [],
  64391. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  64392. }),
  64393. $globals.Repl);
  64394. $core.addMethod(
  64395. $core.method({
  64396. selector: "prompt",
  64397. protocol: "accessing",
  64398. fn: function (){
  64399. var self=this,$self=this;
  64400. return "amber >> ";
  64401. },
  64402. args: [],
  64403. source: "prompt\x0a\x09^ 'amber >> '",
  64404. referencedClasses: [],
  64405. messageSends: []
  64406. }),
  64407. $globals.Repl);
  64408. $core.addMethod(
  64409. $core.method({
  64410. selector: "setPreviousVariablesFor:from:",
  64411. protocol: "private",
  64412. fn: function (newObject,oldObject){
  64413. var self=this,$self=this;
  64414. return $core.withContext(function($ctx1) {
  64415. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  64416. return $core.withContext(function($ctx2) {
  64417. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  64418. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64419. }));
  64420. return self;
  64421. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  64422. },
  64423. args: ["newObject", "oldObject"],
  64424. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  64425. referencedClasses: [],
  64426. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  64427. }),
  64428. $globals.Repl);
  64429. $core.addMethod(
  64430. $core.method({
  64431. selector: "setPrompt",
  64432. protocol: "actions",
  64433. fn: function (){
  64434. var self=this,$self=this;
  64435. return $core.withContext(function($ctx1) {
  64436. $recv($self.interface)._setPrompt_($self._prompt());
  64437. return self;
  64438. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  64439. },
  64440. args: [],
  64441. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  64442. referencedClasses: [],
  64443. messageSends: ["setPrompt:", "prompt"]
  64444. }),
  64445. $globals.Repl);
  64446. $core.addMethod(
  64447. $core.method({
  64448. selector: "setupCommands",
  64449. protocol: "initialization",
  64450. fn: function (){
  64451. var self=this,$self=this;
  64452. return $core.withContext(function($ctx1) {
  64453. var $2,$1;
  64454. $2=$recv([":q"]).__minus_gt((function(){
  64455. return $core.withContext(function($ctx2) {
  64456. return $recv(process)._exit();
  64457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64458. }));
  64459. $ctx1.sendIdx["->"]=1;
  64460. $1=[$2,$recv([""]).__minus_gt((function(){
  64461. return $core.withContext(function($ctx2) {
  64462. return $recv($self.interface)._prompt();
  64463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64464. }))];
  64465. $self.commands=$recv($globals.Dictionary)._from_($1);
  64466. return self;
  64467. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  64468. },
  64469. args: [],
  64470. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  64471. referencedClasses: ["Dictionary"],
  64472. messageSends: ["from:", "->", "exit", "prompt"]
  64473. }),
  64474. $globals.Repl);
  64475. $core.addMethod(
  64476. $core.method({
  64477. selector: "setupHotkeys",
  64478. protocol: "initialization",
  64479. fn: function (){
  64480. var self=this,$self=this;
  64481. return $core.withContext(function($ctx1) {
  64482. var $receiver;
  64483. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  64484. return $core.withContext(function($ctx2) {
  64485. if(($receiver = key) == null || $receiver.a$nil){
  64486. return key;
  64487. } else {
  64488. return $self._onKeyPress_(key);
  64489. }
  64490. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  64491. }));
  64492. return self;
  64493. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  64494. },
  64495. args: [],
  64496. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  64497. referencedClasses: [],
  64498. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  64499. }),
  64500. $globals.Repl);
  64501. $core.addMethod(
  64502. $core.method({
  64503. selector: "subclass:withVariable:",
  64504. protocol: "private",
  64505. fn: function (aClass,varName){
  64506. var self=this,$self=this;
  64507. return $core.withContext(function($ctx1) {
  64508. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  64509. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  64510. },
  64511. args: ["aClass", "varName"],
  64512. 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'",
  64513. referencedClasses: ["ClassBuilder"],
  64514. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  64515. }),
  64516. $globals.Repl);
  64517. $core.addMethod(
  64518. $core.method({
  64519. selector: "subclassNameFor:",
  64520. protocol: "private",
  64521. fn: function (aClass){
  64522. var self=this,$self=this;
  64523. return $core.withContext(function($ctx1) {
  64524. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  64525. $2=$recv(aClass)._name();
  64526. $ctx1.sendIdx["name"]=1;
  64527. $1=$recv($2)._matchesOf_("\x5cd+$");
  64528. $ctx1.sendIdx["matchesOf:"]=1;
  64529. if(($receiver = $1) == null || $receiver.a$nil){
  64530. return $recv($recv(aClass)._name()).__comma("2");
  64531. } else {
  64532. var counter;
  64533. $6=$recv(aClass)._name();
  64534. $ctx1.sendIdx["name"]=2;
  64535. $5=$recv($6)._matchesOf_("\x5cd+$");
  64536. $4=$recv($5)._first();
  64537. $3=$recv($4)._asNumber();
  64538. counter=$recv($3).__plus((1));
  64539. $7=$recv(aClass)._name();
  64540. $ctx1.sendIdx["name"]=3;
  64541. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  64542. }
  64543. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  64544. },
  64545. args: ["aClass"],
  64546. 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'].",
  64547. referencedClasses: [],
  64548. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  64549. }),
  64550. $globals.Repl);
  64551. $core.addMethod(
  64552. $core.method({
  64553. selector: "main",
  64554. protocol: "initialization",
  64555. fn: function (){
  64556. var self=this,$self=this;
  64557. return $core.withContext(function($ctx1) {
  64558. $recv($self._new())._createInterface();
  64559. return self;
  64560. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.a$cls)});
  64561. },
  64562. args: [],
  64563. source: "main\x0a\x09self new createInterface",
  64564. referencedClasses: [],
  64565. messageSends: ["createInterface", "new"]
  64566. }),
  64567. $globals.Repl.a$cls);
  64568. });
  64569. (function () {
  64570. define('__app__',["amber/devel", "amber/core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
  64571. amber.initialize().then(function () {
  64572. amber.globals.AmberCli._main();
  64573. });
  64574. });
  64575. }());
  64576. (function () {
  64577. define('app',["require", "amber/es6-promise"], function (require, promiseLib) {
  64578. promiseLib.polyfill();
  64579. return new Promise(function (resolve, reject) {
  64580. require(["__app__"], resolve, reject);
  64581. });
  64582. });
  64583. }());
  64584. require(["app"]);
  64585. });
  64586. define.require('__wrap__');
  64587. }((function amdefine(module, requireFn) {
  64588. 'use strict';
  64589. var defineCache = {},
  64590. loaderCache = {},
  64591. alreadyCalled = false,
  64592. path = require('path'),
  64593. makeRequire, stringRequire;
  64594. /**
  64595. * Trims the . and .. from an array of path segments.
  64596. * It will keep a leading path segment if a .. will become
  64597. * the first path segment, to help with module name lookups,
  64598. * which act like paths, but can be remapped. But the end result,
  64599. * all paths that use this function should look normalized.
  64600. * NOTE: this method MODIFIES the input array.
  64601. * @param {Array} ary the array of path segments.
  64602. */
  64603. function trimDots(ary) {
  64604. var i, part;
  64605. for (i = 0; ary[i]; i+= 1) {
  64606. part = ary[i];
  64607. if (part === '.') {
  64608. ary.splice(i, 1);
  64609. i -= 1;
  64610. } else if (part === '..') {
  64611. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  64612. //End of the line. Keep at least one non-dot
  64613. //path segment at the front so it can be mapped
  64614. //correctly to disk. Otherwise, there is likely
  64615. //no path mapping for a path starting with '..'.
  64616. //This can still fail, but catches the most reasonable
  64617. //uses of ..
  64618. break;
  64619. } else if (i > 0) {
  64620. ary.splice(i - 1, 2);
  64621. i -= 2;
  64622. }
  64623. }
  64624. }
  64625. }
  64626. function normalize(name, baseName) {
  64627. var baseParts;
  64628. //Adjust any relative paths.
  64629. if (name && name.charAt(0) === '.') {
  64630. //If have a base name, try to normalize against it,
  64631. //otherwise, assume it is a top-level require that will
  64632. //be relative to baseUrl in the end.
  64633. if (baseName) {
  64634. baseParts = baseName.split('/');
  64635. baseParts = baseParts.slice(0, baseParts.length - 1);
  64636. baseParts = baseParts.concat(name.split('/'));
  64637. trimDots(baseParts);
  64638. name = baseParts.join('/');
  64639. }
  64640. }
  64641. return name;
  64642. }
  64643. /**
  64644. * Create the normalize() function passed to a loader plugin's
  64645. * normalize method.
  64646. */
  64647. function makeNormalize(relName) {
  64648. return function (name) {
  64649. return normalize(name, relName);
  64650. };
  64651. }
  64652. function makeLoad(id) {
  64653. function load(value) {
  64654. loaderCache[id] = value;
  64655. }
  64656. load.fromText = function (id, text) {
  64657. //This one is difficult because the text can/probably uses
  64658. //define, and any relative paths and requires should be relative
  64659. //to that id was it would be found on disk. But this would require
  64660. //bootstrapping a module/require fairly deeply from node core.
  64661. //Not sure how best to go about that yet.
  64662. throw new Error('amdefine does not implement load.fromText');
  64663. };
  64664. return load;
  64665. }
  64666. makeRequire = function (systemRequire, exports, module, relId) {
  64667. function amdRequire(deps, callback) {
  64668. if (typeof deps === 'string') {
  64669. //Synchronous, single module require('')
  64670. return stringRequire(systemRequire, exports, module, deps, relId);
  64671. } else {
  64672. //Array of dependencies with a callback.
  64673. //Convert the dependencies to modules.
  64674. deps = deps.map(function (depName) {
  64675. return stringRequire(systemRequire, exports, module, depName, relId);
  64676. });
  64677. //Wait for next tick to call back the require call.
  64678. if (callback) {
  64679. process.nextTick(function () {
  64680. callback.apply(null, deps);
  64681. });
  64682. }
  64683. }
  64684. }
  64685. amdRequire.toUrl = function (filePath) {
  64686. if (filePath.indexOf('.') === 0) {
  64687. return normalize(filePath, path.dirname(module.filename));
  64688. } else {
  64689. return filePath;
  64690. }
  64691. };
  64692. return amdRequire;
  64693. };
  64694. //Favor explicit value, passed in if the module wants to support Node 0.4.
  64695. requireFn = requireFn || function req() {
  64696. return module.require.apply(module, arguments);
  64697. };
  64698. function runFactory(id, deps, factory) {
  64699. var r, e, m, result;
  64700. if (id) {
  64701. e = loaderCache[id] = {};
  64702. m = {
  64703. id: id,
  64704. uri: __filename,
  64705. exports: e
  64706. };
  64707. r = makeRequire(requireFn, e, m, id);
  64708. } else {
  64709. //Only support one define call per file
  64710. if (alreadyCalled) {
  64711. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  64712. }
  64713. alreadyCalled = true;
  64714. //Use the real variables from node
  64715. //Use module.exports for exports, since
  64716. //the exports in here is amdefine exports.
  64717. e = module.exports;
  64718. m = module;
  64719. r = makeRequire(requireFn, e, m, module.id);
  64720. }
  64721. //If there are dependencies, they are strings, so need
  64722. //to convert them to dependency values.
  64723. if (deps) {
  64724. deps = deps.map(function (depName) {
  64725. return r(depName);
  64726. });
  64727. }
  64728. //Call the factory with the right dependencies.
  64729. if (typeof factory === 'function') {
  64730. result = factory.apply(m.exports, deps);
  64731. } else {
  64732. result = factory;
  64733. }
  64734. if (result !== undefined) {
  64735. m.exports = result;
  64736. if (id) {
  64737. loaderCache[id] = m.exports;
  64738. }
  64739. }
  64740. }
  64741. stringRequire = function (systemRequire, exports, module, id, relId) {
  64742. //Split the ID by a ! so that
  64743. var index = id.indexOf('!'),
  64744. originalId = id,
  64745. prefix, plugin;
  64746. if (index === -1) {
  64747. id = normalize(id, relId);
  64748. //Straight module lookup. If it is one of the special dependencies,
  64749. //deal with it, otherwise, delegate to node.
  64750. if (id === 'require') {
  64751. return makeRequire(systemRequire, exports, module, relId);
  64752. } else if (id === 'exports') {
  64753. return exports;
  64754. } else if (id === 'module') {
  64755. return module;
  64756. } else if (loaderCache.hasOwnProperty(id)) {
  64757. return loaderCache[id];
  64758. } else if (defineCache[id]) {
  64759. runFactory.apply(null, defineCache[id]);
  64760. return loaderCache[id];
  64761. } else {
  64762. if(systemRequire) {
  64763. return systemRequire(originalId);
  64764. } else {
  64765. throw new Error('No module with ID: ' + id);
  64766. }
  64767. }
  64768. } else {
  64769. //There is a plugin in play.
  64770. prefix = id.substring(0, index);
  64771. id = id.substring(index + 1, id.length);
  64772. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  64773. if (plugin.normalize) {
  64774. id = plugin.normalize(id, makeNormalize(relId));
  64775. } else {
  64776. //Normalize the ID normally.
  64777. id = normalize(id, relId);
  64778. }
  64779. if (loaderCache[id]) {
  64780. return loaderCache[id];
  64781. } else {
  64782. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  64783. return loaderCache[id];
  64784. }
  64785. }
  64786. };
  64787. //Create a define function specific to the module asking for amdefine.
  64788. function define(id, deps, factory) {
  64789. if (Array.isArray(id)) {
  64790. factory = deps;
  64791. deps = id;
  64792. id = undefined;
  64793. } else if (typeof id !== 'string') {
  64794. factory = id;
  64795. id = deps = undefined;
  64796. }
  64797. if (deps && !Array.isArray(deps)) {
  64798. factory = deps;
  64799. deps = undefined;
  64800. }
  64801. if (!deps) {
  64802. deps = ['require', 'exports', 'module'];
  64803. }
  64804. //Set up properties for this module. If an ID, then use
  64805. //internal cache. If no ID, then use the external variables
  64806. //for this node module.
  64807. if (id) {
  64808. //Put the module in deep freeze until there is a
  64809. //require call for it.
  64810. defineCache[id] = [id, deps, factory];
  64811. } else {
  64812. runFactory(id, deps, factory);
  64813. }
  64814. }
  64815. //define.require, which has access to all the values in the
  64816. //cache. Useful for AMD modules that all have IDs in the file,
  64817. //but need to finally export a value to node based on one of those
  64818. //IDs.
  64819. define.require = function (id) {
  64820. if (loaderCache[id]) {
  64821. return loaderCache[id];
  64822. }
  64823. if (defineCache[id]) {
  64824. runFactory.apply(null, defineCache[id]);
  64825. return loaderCache[id];
  64826. }
  64827. };
  64828. define.amd = {};
  64829. return define;
  64830. }(module)), require));