1
0

amber-cli.js 2.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392
  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. // This file is used to make additional changes
  8. // when building an app to run in node.js.
  9. // Free to edit. You can break tests (cli test runner uses
  10. // this to build itself - it is a node executable).
  11. define("amber/Platform", ["amber_core/Platform-Node"], {});
  12. define("amber/compatibility", ["amber/node-compatibility"], {});
  13. define("jquery", {});
  14. define("config-node", function(){});
  15. define('amber/brikz',[], function () {
  16. return function Brikz(api, apiKey, initKey) {
  17. "use strict";
  18. //jshint eqnull:true
  19. var brikz = this,
  20. backup = {};
  21. apiKey = apiKey || 'exports';
  22. initKey = initKey || '__init__';
  23. function mixin(src, target, what) {
  24. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  25. if (src == null) {
  26. target[keys[i]] = undefined;
  27. } else {
  28. var value = src[keys[i]];
  29. if (typeof value !== "undefined") {
  30. target[keys[i]] = value;
  31. }
  32. }
  33. }
  34. return target;
  35. }
  36. Object.defineProperties(this, {
  37. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  38. });
  39. var exclude = mixin(this, {});
  40. this.rebuild = function () {
  41. Object.keys(backup).forEach(function (key) {
  42. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  43. });
  44. var oapi = mixin(api, {}),
  45. order = [],
  46. chk = {};
  47. function ensure(key) {
  48. if (key in exclude) {
  49. return null;
  50. }
  51. var b = brikz[key],
  52. bak = backup[key];
  53. mixin(null, api, api);
  54. while (typeof b === "function") {
  55. (b.deps || []).forEach(ensure);
  56. b = new b(brikz, api, bak);
  57. }
  58. brikz[key] = b;
  59. if (b && !chk[key]) {
  60. chk[key] = true;
  61. order.push(b);
  62. }
  63. if (b && !b[apiKey]) {
  64. b[apiKey] = mixin(api, {});
  65. }
  66. }
  67. Object.keys(brikz).forEach(ensure);
  68. mixin(oapi, mixin(null, api, api));
  69. order.forEach(function (brik) {
  70. mixin(brik[apiKey] || {}, api);
  71. });
  72. order.forEach(function (brik) {
  73. if (brik[initKey]) {
  74. brik[initKey]();
  75. if (brik[initKey].once) {
  76. delete brik[initKey];
  77. }
  78. }
  79. });
  80. backup = mixin(brikz, {});
  81. };
  82. };
  83. });
  84. /*!
  85. * @overview es6-promise - a tiny implementation of Promises/A+.
  86. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  87. * @license Licensed under MIT license
  88. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  89. * @version 3.3.1
  90. */
  91. (function (global, factory) {
  92. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  93. typeof define === 'function' && define.amd ? define('amber/es6-promise',factory) :
  94. (global.ES6Promise = factory());
  95. }(this, (function () { 'use strict';
  96. function objectOrFunction(x) {
  97. return typeof x === 'function' || typeof x === 'object' && x !== null;
  98. }
  99. function isFunction(x) {
  100. return typeof x === 'function';
  101. }
  102. var _isArray = undefined;
  103. if (!Array.isArray) {
  104. _isArray = function (x) {
  105. return Object.prototype.toString.call(x) === '[object Array]';
  106. };
  107. } else {
  108. _isArray = Array.isArray;
  109. }
  110. var isArray = _isArray;
  111. var len = 0;
  112. var vertxNext = undefined;
  113. var customSchedulerFn = undefined;
  114. var asap = function asap(callback, arg) {
  115. queue[len] = callback;
  116. queue[len + 1] = arg;
  117. len += 2;
  118. if (len === 2) {
  119. // If len is 2, that means that we need to schedule an async flush.
  120. // If additional callbacks are queued before the queue is flushed, they
  121. // will be processed by this flush that we are scheduling.
  122. if (customSchedulerFn) {
  123. customSchedulerFn(flush);
  124. } else {
  125. scheduleFlush();
  126. }
  127. }
  128. };
  129. function setScheduler(scheduleFn) {
  130. customSchedulerFn = scheduleFn;
  131. }
  132. function setAsap(asapFn) {
  133. asap = asapFn;
  134. }
  135. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  136. var browserGlobal = browserWindow || {};
  137. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  138. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
  139. // test for web worker but not in IE10
  140. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  141. // node
  142. function useNextTick() {
  143. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  144. // see https://github.com/cujojs/when/issues/410 for details
  145. return function () {
  146. return process.nextTick(flush);
  147. };
  148. }
  149. // vertx
  150. function useVertxTimer() {
  151. return function () {
  152. vertxNext(flush);
  153. };
  154. }
  155. function useMutationObserver() {
  156. var iterations = 0;
  157. var observer = new BrowserMutationObserver(flush);
  158. var node = document.createTextNode('');
  159. observer.observe(node, { characterData: true });
  160. return function () {
  161. node.data = iterations = ++iterations % 2;
  162. };
  163. }
  164. // web worker
  165. function useMessageChannel() {
  166. var channel = new MessageChannel();
  167. channel.port1.onmessage = flush;
  168. return function () {
  169. return channel.port2.postMessage(0);
  170. };
  171. }
  172. function useSetTimeout() {
  173. // Store setTimeout reference so es6-promise will be unaffected by
  174. // other code modifying setTimeout (like sinon.useFakeTimers())
  175. var globalSetTimeout = setTimeout;
  176. return function () {
  177. return globalSetTimeout(flush, 1);
  178. };
  179. }
  180. var queue = new Array(1000);
  181. function flush() {
  182. for (var i = 0; i < len; i += 2) {
  183. var callback = queue[i];
  184. var arg = queue[i + 1];
  185. callback(arg);
  186. queue[i] = undefined;
  187. queue[i + 1] = undefined;
  188. }
  189. len = 0;
  190. }
  191. function attemptVertx() {
  192. try {
  193. var r = require;
  194. var vertx = r('vertx');
  195. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  196. return useVertxTimer();
  197. } catch (e) {
  198. return useSetTimeout();
  199. }
  200. }
  201. var scheduleFlush = undefined;
  202. // Decide what async method to use to triggering processing of queued callbacks:
  203. if (isNode) {
  204. scheduleFlush = useNextTick();
  205. } else if (BrowserMutationObserver) {
  206. scheduleFlush = useMutationObserver();
  207. } else if (isWorker) {
  208. scheduleFlush = useMessageChannel();
  209. } else if (browserWindow === undefined && typeof require === 'function') {
  210. scheduleFlush = attemptVertx();
  211. } else {
  212. scheduleFlush = useSetTimeout();
  213. }
  214. function then(onFulfillment, onRejection) {
  215. var _arguments = arguments;
  216. var parent = this;
  217. var child = new this.constructor(noop);
  218. if (child[PROMISE_ID] === undefined) {
  219. makePromise(child);
  220. }
  221. var _state = parent._state;
  222. if (_state) {
  223. (function () {
  224. var callback = _arguments[_state - 1];
  225. asap(function () {
  226. return invokeCallback(_state, child, callback, parent._result);
  227. });
  228. })();
  229. } else {
  230. subscribe(parent, child, onFulfillment, onRejection);
  231. }
  232. return child;
  233. }
  234. /**
  235. `Promise.resolve` returns a promise that will become resolved with the
  236. passed `value`. It is shorthand for the following:
  237. ```javascript
  238. let promise = new Promise(function(resolve, reject){
  239. resolve(1);
  240. });
  241. promise.then(function(value){
  242. // value === 1
  243. });
  244. ```
  245. Instead of writing the above, your code now simply becomes the following:
  246. ```javascript
  247. let promise = Promise.resolve(1);
  248. promise.then(function(value){
  249. // value === 1
  250. });
  251. ```
  252. @method resolve
  253. @static
  254. @param {Any} value value that the returned promise will be resolved with
  255. Useful for tooling.
  256. @return {Promise} a promise that will become fulfilled with the given
  257. `value`
  258. */
  259. function resolve(object) {
  260. /*jshint validthis:true */
  261. var Constructor = this;
  262. if (object && typeof object === 'object' && object.constructor === Constructor) {
  263. return object;
  264. }
  265. var promise = new Constructor(noop);
  266. _resolve(promise, object);
  267. return promise;
  268. }
  269. var PROMISE_ID = Math.random().toString(36).substring(16);
  270. function noop() {}
  271. var PENDING = void 0;
  272. var FULFILLED = 1;
  273. var REJECTED = 2;
  274. var GET_THEN_ERROR = new ErrorObject();
  275. function selfFulfillment() {
  276. return new TypeError("You cannot resolve a promise with itself");
  277. }
  278. function cannotReturnOwn() {
  279. return new TypeError('A promises callback cannot return that same promise.');
  280. }
  281. function getThen(promise) {
  282. try {
  283. return promise.then;
  284. } catch (error) {
  285. GET_THEN_ERROR.error = error;
  286. return GET_THEN_ERROR;
  287. }
  288. }
  289. function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  290. try {
  291. then.call(value, fulfillmentHandler, rejectionHandler);
  292. } catch (e) {
  293. return e;
  294. }
  295. }
  296. function handleForeignThenable(promise, thenable, then) {
  297. asap(function (promise) {
  298. var sealed = false;
  299. var error = tryThen(then, thenable, function (value) {
  300. if (sealed) {
  301. return;
  302. }
  303. sealed = true;
  304. if (thenable !== value) {
  305. _resolve(promise, value);
  306. } else {
  307. fulfill(promise, value);
  308. }
  309. }, function (reason) {
  310. if (sealed) {
  311. return;
  312. }
  313. sealed = true;
  314. _reject(promise, reason);
  315. }, 'Settle: ' + (promise._label || ' unknown promise'));
  316. if (!sealed && error) {
  317. sealed = true;
  318. _reject(promise, error);
  319. }
  320. }, promise);
  321. }
  322. function handleOwnThenable(promise, thenable) {
  323. if (thenable._state === FULFILLED) {
  324. fulfill(promise, thenable._result);
  325. } else if (thenable._state === REJECTED) {
  326. _reject(promise, thenable._result);
  327. } else {
  328. subscribe(thenable, undefined, function (value) {
  329. return _resolve(promise, value);
  330. }, function (reason) {
  331. return _reject(promise, reason);
  332. });
  333. }
  334. }
  335. function handleMaybeThenable(promise, maybeThenable, then$$) {
  336. if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
  337. handleOwnThenable(promise, maybeThenable);
  338. } else {
  339. if (then$$ === GET_THEN_ERROR) {
  340. _reject(promise, GET_THEN_ERROR.error);
  341. } else if (then$$ === undefined) {
  342. fulfill(promise, maybeThenable);
  343. } else if (isFunction(then$$)) {
  344. handleForeignThenable(promise, maybeThenable, then$$);
  345. } else {
  346. fulfill(promise, maybeThenable);
  347. }
  348. }
  349. }
  350. function _resolve(promise, value) {
  351. if (promise === value) {
  352. _reject(promise, selfFulfillment());
  353. } else if (objectOrFunction(value)) {
  354. handleMaybeThenable(promise, value, getThen(value));
  355. } else {
  356. fulfill(promise, value);
  357. }
  358. }
  359. function publishRejection(promise) {
  360. if (promise._onerror) {
  361. promise._onerror(promise._result);
  362. }
  363. publish(promise);
  364. }
  365. function fulfill(promise, value) {
  366. if (promise._state !== PENDING) {
  367. return;
  368. }
  369. promise._result = value;
  370. promise._state = FULFILLED;
  371. if (promise._subscribers.length !== 0) {
  372. asap(publish, promise);
  373. }
  374. }
  375. function _reject(promise, reason) {
  376. if (promise._state !== PENDING) {
  377. return;
  378. }
  379. promise._state = REJECTED;
  380. promise._result = reason;
  381. asap(publishRejection, promise);
  382. }
  383. function subscribe(parent, child, onFulfillment, onRejection) {
  384. var _subscribers = parent._subscribers;
  385. var length = _subscribers.length;
  386. parent._onerror = null;
  387. _subscribers[length] = child;
  388. _subscribers[length + FULFILLED] = onFulfillment;
  389. _subscribers[length + REJECTED] = onRejection;
  390. if (length === 0 && parent._state) {
  391. asap(publish, parent);
  392. }
  393. }
  394. function publish(promise) {
  395. var subscribers = promise._subscribers;
  396. var settled = promise._state;
  397. if (subscribers.length === 0) {
  398. return;
  399. }
  400. var child = undefined,
  401. callback = undefined,
  402. detail = promise._result;
  403. for (var i = 0; i < subscribers.length; i += 3) {
  404. child = subscribers[i];
  405. callback = subscribers[i + settled];
  406. if (child) {
  407. invokeCallback(settled, child, callback, detail);
  408. } else {
  409. callback(detail);
  410. }
  411. }
  412. promise._subscribers.length = 0;
  413. }
  414. function ErrorObject() {
  415. this.error = null;
  416. }
  417. var TRY_CATCH_ERROR = new ErrorObject();
  418. function tryCatch(callback, detail) {
  419. try {
  420. return callback(detail);
  421. } catch (e) {
  422. TRY_CATCH_ERROR.error = e;
  423. return TRY_CATCH_ERROR;
  424. }
  425. }
  426. function invokeCallback(settled, promise, callback, detail) {
  427. var hasCallback = isFunction(callback),
  428. value = undefined,
  429. error = undefined,
  430. succeeded = undefined,
  431. failed = undefined;
  432. if (hasCallback) {
  433. value = tryCatch(callback, detail);
  434. if (value === TRY_CATCH_ERROR) {
  435. failed = true;
  436. error = value.error;
  437. value = null;
  438. } else {
  439. succeeded = true;
  440. }
  441. if (promise === value) {
  442. _reject(promise, cannotReturnOwn());
  443. return;
  444. }
  445. } else {
  446. value = detail;
  447. succeeded = true;
  448. }
  449. if (promise._state !== PENDING) {
  450. // noop
  451. } else if (hasCallback && succeeded) {
  452. _resolve(promise, value);
  453. } else if (failed) {
  454. _reject(promise, error);
  455. } else if (settled === FULFILLED) {
  456. fulfill(promise, value);
  457. } else if (settled === REJECTED) {
  458. _reject(promise, value);
  459. }
  460. }
  461. function initializePromise(promise, resolver) {
  462. try {
  463. resolver(function resolvePromise(value) {
  464. _resolve(promise, value);
  465. }, function rejectPromise(reason) {
  466. _reject(promise, reason);
  467. });
  468. } catch (e) {
  469. _reject(promise, e);
  470. }
  471. }
  472. var id = 0;
  473. function nextId() {
  474. return id++;
  475. }
  476. function makePromise(promise) {
  477. promise[PROMISE_ID] = id++;
  478. promise._state = undefined;
  479. promise._result = undefined;
  480. promise._subscribers = [];
  481. }
  482. function Enumerator(Constructor, input) {
  483. this._instanceConstructor = Constructor;
  484. this.promise = new Constructor(noop);
  485. if (!this.promise[PROMISE_ID]) {
  486. makePromise(this.promise);
  487. }
  488. if (isArray(input)) {
  489. this._input = input;
  490. this.length = input.length;
  491. this._remaining = input.length;
  492. this._result = new Array(this.length);
  493. if (this.length === 0) {
  494. fulfill(this.promise, this._result);
  495. } else {
  496. this.length = this.length || 0;
  497. this._enumerate();
  498. if (this._remaining === 0) {
  499. fulfill(this.promise, this._result);
  500. }
  501. }
  502. } else {
  503. _reject(this.promise, validationError());
  504. }
  505. }
  506. function validationError() {
  507. return new Error('Array Methods must be provided an Array');
  508. };
  509. Enumerator.prototype._enumerate = function () {
  510. var length = this.length;
  511. var _input = this._input;
  512. for (var i = 0; this._state === PENDING && i < length; i++) {
  513. this._eachEntry(_input[i], i);
  514. }
  515. };
  516. Enumerator.prototype._eachEntry = function (entry, i) {
  517. var c = this._instanceConstructor;
  518. var resolve$$ = c.resolve;
  519. if (resolve$$ === resolve) {
  520. var _then = getThen(entry);
  521. if (_then === then && entry._state !== PENDING) {
  522. this._settledAt(entry._state, i, entry._result);
  523. } else if (typeof _then !== 'function') {
  524. this._remaining--;
  525. this._result[i] = entry;
  526. } else if (c === Promise) {
  527. var promise = new c(noop);
  528. handleMaybeThenable(promise, entry, _then);
  529. this._willSettleAt(promise, i);
  530. } else {
  531. this._willSettleAt(new c(function (resolve$$) {
  532. return resolve$$(entry);
  533. }), i);
  534. }
  535. } else {
  536. this._willSettleAt(resolve$$(entry), i);
  537. }
  538. };
  539. Enumerator.prototype._settledAt = function (state, i, value) {
  540. var promise = this.promise;
  541. if (promise._state === PENDING) {
  542. this._remaining--;
  543. if (state === REJECTED) {
  544. _reject(promise, value);
  545. } else {
  546. this._result[i] = value;
  547. }
  548. }
  549. if (this._remaining === 0) {
  550. fulfill(promise, this._result);
  551. }
  552. };
  553. Enumerator.prototype._willSettleAt = function (promise, i) {
  554. var enumerator = this;
  555. subscribe(promise, undefined, function (value) {
  556. return enumerator._settledAt(FULFILLED, i, value);
  557. }, function (reason) {
  558. return enumerator._settledAt(REJECTED, i, reason);
  559. });
  560. };
  561. /**
  562. `Promise.all` accepts an array of promises, and returns a new promise which
  563. is fulfilled with an array of fulfillment values for the passed promises, or
  564. rejected with the reason of the first passed promise to be rejected. It casts all
  565. elements of the passed iterable to promises as it runs this algorithm.
  566. Example:
  567. ```javascript
  568. let promise1 = resolve(1);
  569. let promise2 = resolve(2);
  570. let promise3 = resolve(3);
  571. let promises = [ promise1, promise2, promise3 ];
  572. Promise.all(promises).then(function(array){
  573. // The array here would be [ 1, 2, 3 ];
  574. });
  575. ```
  576. If any of the `promises` given to `all` are rejected, the first promise
  577. that is rejected will be given as an argument to the returned promises's
  578. rejection handler. For example:
  579. Example:
  580. ```javascript
  581. let promise1 = resolve(1);
  582. let promise2 = reject(new Error("2"));
  583. let promise3 = reject(new Error("3"));
  584. let promises = [ promise1, promise2, promise3 ];
  585. Promise.all(promises).then(function(array){
  586. // Code here never runs because there are rejected promises!
  587. }, function(error) {
  588. // error.message === "2"
  589. });
  590. ```
  591. @method all
  592. @static
  593. @param {Array} entries array of promises
  594. @param {String} label optional string for labeling the promise.
  595. Useful for tooling.
  596. @return {Promise} promise that is fulfilled when all `promises` have been
  597. fulfilled, or rejected if any of them become rejected.
  598. @static
  599. */
  600. function all(entries) {
  601. return new Enumerator(this, entries).promise;
  602. }
  603. /**
  604. `Promise.race` returns a new promise which is settled in the same way as the
  605. first passed promise to settle.
  606. Example:
  607. ```javascript
  608. let promise1 = new Promise(function(resolve, reject){
  609. setTimeout(function(){
  610. resolve('promise 1');
  611. }, 200);
  612. });
  613. let promise2 = new Promise(function(resolve, reject){
  614. setTimeout(function(){
  615. resolve('promise 2');
  616. }, 100);
  617. });
  618. Promise.race([promise1, promise2]).then(function(result){
  619. // result === 'promise 2' because it was resolved before promise1
  620. // was resolved.
  621. });
  622. ```
  623. `Promise.race` is deterministic in that only the state of the first
  624. settled promise matters. For example, even if other promises given to the
  625. `promises` array argument are resolved, but the first settled promise has
  626. become rejected before the other promises became fulfilled, the returned
  627. promise will become rejected:
  628. ```javascript
  629. let promise1 = new Promise(function(resolve, reject){
  630. setTimeout(function(){
  631. resolve('promise 1');
  632. }, 200);
  633. });
  634. let promise2 = new Promise(function(resolve, reject){
  635. setTimeout(function(){
  636. reject(new Error('promise 2'));
  637. }, 100);
  638. });
  639. Promise.race([promise1, promise2]).then(function(result){
  640. // Code here never runs
  641. }, function(reason){
  642. // reason.message === 'promise 2' because promise 2 became rejected before
  643. // promise 1 became fulfilled
  644. });
  645. ```
  646. An example real-world use case is implementing timeouts:
  647. ```javascript
  648. Promise.race([ajax('foo.json'), timeout(5000)])
  649. ```
  650. @method race
  651. @static
  652. @param {Array} promises array of promises to observe
  653. Useful for tooling.
  654. @return {Promise} a promise which settles in the same way as the first passed
  655. promise to settle.
  656. */
  657. function race(entries) {
  658. /*jshint validthis:true */
  659. var Constructor = this;
  660. if (!isArray(entries)) {
  661. return new Constructor(function (_, reject) {
  662. return reject(new TypeError('You must pass an array to race.'));
  663. });
  664. } else {
  665. return new Constructor(function (resolve, reject) {
  666. var length = entries.length;
  667. for (var i = 0; i < length; i++) {
  668. Constructor.resolve(entries[i]).then(resolve, reject);
  669. }
  670. });
  671. }
  672. }
  673. /**
  674. `Promise.reject` returns a promise rejected with the passed `reason`.
  675. It is shorthand for the following:
  676. ```javascript
  677. let promise = new Promise(function(resolve, reject){
  678. reject(new Error('WHOOPS'));
  679. });
  680. promise.then(function(value){
  681. // Code here doesn't run because the promise is rejected!
  682. }, function(reason){
  683. // reason.message === 'WHOOPS'
  684. });
  685. ```
  686. Instead of writing the above, your code now simply becomes the following:
  687. ```javascript
  688. let promise = Promise.reject(new Error('WHOOPS'));
  689. promise.then(function(value){
  690. // Code here doesn't run because the promise is rejected!
  691. }, function(reason){
  692. // reason.message === 'WHOOPS'
  693. });
  694. ```
  695. @method reject
  696. @static
  697. @param {Any} reason value that the returned promise will be rejected with.
  698. Useful for tooling.
  699. @return {Promise} a promise rejected with the given `reason`.
  700. */
  701. function reject(reason) {
  702. /*jshint validthis:true */
  703. var Constructor = this;
  704. var promise = new Constructor(noop);
  705. _reject(promise, reason);
  706. return promise;
  707. }
  708. function needsResolver() {
  709. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  710. }
  711. function needsNew() {
  712. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  713. }
  714. /**
  715. Promise objects represent the eventual result of an asynchronous operation. The
  716. primary way of interacting with a promise is through its `then` method, which
  717. registers callbacks to receive either a promise's eventual value or the reason
  718. why the promise cannot be fulfilled.
  719. Terminology
  720. -----------
  721. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  722. - `thenable` is an object or function that defines a `then` method.
  723. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  724. - `exception` is a value that is thrown using the throw statement.
  725. - `reason` is a value that indicates why a promise was rejected.
  726. - `settled` the final resting state of a promise, fulfilled or rejected.
  727. A promise can be in one of three states: pending, fulfilled, or rejected.
  728. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  729. state. Promises that are rejected have a rejection reason and are in the
  730. rejected state. A fulfillment value is never a thenable.
  731. Promises can also be said to *resolve* a value. If this value is also a
  732. promise, then the original promise's settled state will match the value's
  733. settled state. So a promise that *resolves* a promise that rejects will
  734. itself reject, and a promise that *resolves* a promise that fulfills will
  735. itself fulfill.
  736. Basic Usage:
  737. ------------
  738. ```js
  739. let promise = new Promise(function(resolve, reject) {
  740. // on success
  741. resolve(value);
  742. // on failure
  743. reject(reason);
  744. });
  745. promise.then(function(value) {
  746. // on fulfillment
  747. }, function(reason) {
  748. // on rejection
  749. });
  750. ```
  751. Advanced Usage:
  752. ---------------
  753. Promises shine when abstracting away asynchronous interactions such as
  754. `XMLHttpRequest`s.
  755. ```js
  756. function getJSON(url) {
  757. return new Promise(function(resolve, reject){
  758. let xhr = new XMLHttpRequest();
  759. xhr.open('GET', url);
  760. xhr.onreadystatechange = handler;
  761. xhr.responseType = 'json';
  762. xhr.setRequestHeader('Accept', 'application/json');
  763. xhr.send();
  764. function handler() {
  765. if (this.readyState === this.DONE) {
  766. if (this.status === 200) {
  767. resolve(this.response);
  768. } else {
  769. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  770. }
  771. }
  772. };
  773. });
  774. }
  775. getJSON('/posts.json').then(function(json) {
  776. // on fulfillment
  777. }, function(reason) {
  778. // on rejection
  779. });
  780. ```
  781. Unlike callbacks, promises are great composable primitives.
  782. ```js
  783. Promise.all([
  784. getJSON('/posts'),
  785. getJSON('/comments')
  786. ]).then(function(values){
  787. values[0] // => postsJSON
  788. values[1] // => commentsJSON
  789. return values;
  790. });
  791. ```
  792. @class Promise
  793. @param {function} resolver
  794. Useful for tooling.
  795. @constructor
  796. */
  797. function Promise(resolver) {
  798. this[PROMISE_ID] = nextId();
  799. this._result = this._state = undefined;
  800. this._subscribers = [];
  801. if (noop !== resolver) {
  802. typeof resolver !== 'function' && needsResolver();
  803. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  804. }
  805. }
  806. Promise.all = all;
  807. Promise.race = race;
  808. Promise.resolve = resolve;
  809. Promise.reject = reject;
  810. Promise._setScheduler = setScheduler;
  811. Promise._setAsap = setAsap;
  812. Promise._asap = asap;
  813. Promise.prototype = {
  814. constructor: Promise,
  815. /**
  816. The primary way of interacting with a promise is through its `then` method,
  817. which registers callbacks to receive either a promise's eventual value or the
  818. reason why the promise cannot be fulfilled.
  819. ```js
  820. findUser().then(function(user){
  821. // user is available
  822. }, function(reason){
  823. // user is unavailable, and you are given the reason why
  824. });
  825. ```
  826. Chaining
  827. --------
  828. The return value of `then` is itself a promise. This second, 'downstream'
  829. promise is resolved with the return value of the first promise's fulfillment
  830. or rejection handler, or rejected if the handler throws an exception.
  831. ```js
  832. findUser().then(function (user) {
  833. return user.name;
  834. }, function (reason) {
  835. return 'default name';
  836. }).then(function (userName) {
  837. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  838. // will be `'default name'`
  839. });
  840. findUser().then(function (user) {
  841. throw new Error('Found user, but still unhappy');
  842. }, function (reason) {
  843. throw new Error('`findUser` rejected and we're unhappy');
  844. }).then(function (value) {
  845. // never reached
  846. }, function (reason) {
  847. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  848. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  849. });
  850. ```
  851. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  852. ```js
  853. findUser().then(function (user) {
  854. throw new PedagogicalException('Upstream error');
  855. }).then(function (value) {
  856. // never reached
  857. }).then(function (value) {
  858. // never reached
  859. }, function (reason) {
  860. // The `PedgagocialException` is propagated all the way down to here
  861. });
  862. ```
  863. Assimilation
  864. ------------
  865. Sometimes the value you want to propagate to a downstream promise can only be
  866. retrieved asynchronously. This can be achieved by returning a promise in the
  867. fulfillment or rejection handler. The downstream promise will then be pending
  868. until the returned promise is settled. This is called *assimilation*.
  869. ```js
  870. findUser().then(function (user) {
  871. return findCommentsByAuthor(user);
  872. }).then(function (comments) {
  873. // The user's comments are now available
  874. });
  875. ```
  876. If the assimliated promise rejects, then the downstream promise will also reject.
  877. ```js
  878. findUser().then(function (user) {
  879. return findCommentsByAuthor(user);
  880. }).then(function (comments) {
  881. // If `findCommentsByAuthor` fulfills, we'll have the value here
  882. }, function (reason) {
  883. // If `findCommentsByAuthor` rejects, we'll have the reason here
  884. });
  885. ```
  886. Simple Example
  887. --------------
  888. Synchronous Example
  889. ```javascript
  890. let result;
  891. try {
  892. result = findResult();
  893. // success
  894. } catch(reason) {
  895. // failure
  896. }
  897. ```
  898. Errback Example
  899. ```js
  900. findResult(function(result, err){
  901. if (err) {
  902. // failure
  903. } else {
  904. // success
  905. }
  906. });
  907. ```
  908. Promise Example;
  909. ```javascript
  910. findResult().then(function(result){
  911. // success
  912. }, function(reason){
  913. // failure
  914. });
  915. ```
  916. Advanced Example
  917. --------------
  918. Synchronous Example
  919. ```javascript
  920. let author, books;
  921. try {
  922. author = findAuthor();
  923. books = findBooksByAuthor(author);
  924. // success
  925. } catch(reason) {
  926. // failure
  927. }
  928. ```
  929. Errback Example
  930. ```js
  931. function foundBooks(books) {
  932. }
  933. function failure(reason) {
  934. }
  935. findAuthor(function(author, err){
  936. if (err) {
  937. failure(err);
  938. // failure
  939. } else {
  940. try {
  941. findBoooksByAuthor(author, function(books, err) {
  942. if (err) {
  943. failure(err);
  944. } else {
  945. try {
  946. foundBooks(books);
  947. } catch(reason) {
  948. failure(reason);
  949. }
  950. }
  951. });
  952. } catch(error) {
  953. failure(err);
  954. }
  955. // success
  956. }
  957. });
  958. ```
  959. Promise Example;
  960. ```javascript
  961. findAuthor().
  962. then(findBooksByAuthor).
  963. then(function(books){
  964. // found books
  965. }).catch(function(reason){
  966. // something went wrong
  967. });
  968. ```
  969. @method then
  970. @param {Function} onFulfilled
  971. @param {Function} onRejected
  972. Useful for tooling.
  973. @return {Promise}
  974. */
  975. then: then,
  976. /**
  977. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  978. as the catch block of a try/catch statement.
  979. ```js
  980. function findAuthor(){
  981. throw new Error('couldn't find that author');
  982. }
  983. // synchronous
  984. try {
  985. findAuthor();
  986. } catch(reason) {
  987. // something went wrong
  988. }
  989. // async with promises
  990. findAuthor().catch(function(reason){
  991. // something went wrong
  992. });
  993. ```
  994. @method catch
  995. @param {Function} onRejection
  996. Useful for tooling.
  997. @return {Promise}
  998. */
  999. 'catch': function _catch(onRejection) {
  1000. return this.then(null, onRejection);
  1001. }
  1002. };
  1003. function polyfill() {
  1004. var local = undefined;
  1005. if (typeof global !== 'undefined') {
  1006. local = global;
  1007. } else if (typeof self !== 'undefined') {
  1008. local = self;
  1009. } else {
  1010. try {
  1011. local = Function('return this')();
  1012. } catch (e) {
  1013. throw new Error('polyfill failed because global object is unavailable in this environment');
  1014. }
  1015. }
  1016. var P = local.Promise;
  1017. if (P) {
  1018. var promiseToString = null;
  1019. try {
  1020. promiseToString = Object.prototype.toString.call(P.resolve());
  1021. } catch (e) {
  1022. // silently ignored
  1023. }
  1024. if (promiseToString === '[object Promise]' && !P.cast) {
  1025. return;
  1026. }
  1027. }
  1028. local.Promise = Promise;
  1029. }
  1030. polyfill();
  1031. // Strange compat..
  1032. Promise.polyfill = polyfill;
  1033. Promise.Promise = Promise;
  1034. return Promise;
  1035. })));
  1036. //# sourceMappingURL=es6-promise.map;
  1037. define('amber/es2015-polyfills',['amber/es6-promise'], function (promiseLib) {
  1038. promiseLib.polyfill();
  1039. });
  1040. // This file is injected dependencies by amber-compat-xxx modules.
  1041. // Therefore it is important that it _does_not_have_ define call.
  1042. ;
  1043. define("amber/node-compatibility", ["./es2015-polyfills"], function(){});
  1044. /* ====================================================================
  1045. |
  1046. | Amber Smalltalk
  1047. | http://amber-lang.net
  1048. |
  1049. ======================================================================
  1050. ======================================================================
  1051. |
  1052. | Copyright (c) 2010-2014
  1053. | Nicolas Petton <petton.nicolas@gmail.com>
  1054. |
  1055. | Copyright (c) 2012-2016
  1056. | The Amber team https://lolg.it/org/amber/members
  1057. | Amber contributors (see /CONTRIBUTORS)
  1058. |
  1059. | Amber is released under the MIT license
  1060. |
  1061. | Permission is hereby granted, free of charge, to any person obtaining
  1062. | a copy of this software and associated documentation files (the
  1063. | 'Software'), to deal in the Software without restriction, including
  1064. | without limitation the rights to use, copy, modify, merge, publish,
  1065. | distribute, sublicense, and/or sell copies of the Software, and to
  1066. | permit persons to whom the Software is furnished to do so, subject to
  1067. | the following conditions:
  1068. |
  1069. | The above copyright notice and this permission notice shall be
  1070. | included in all copies or substantial portions of the Software.
  1071. |
  1072. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1073. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1074. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1075. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1076. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1077. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1078. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1079. |
  1080. ==================================================================== */
  1081. //jshint eqnull:true
  1082. define('amber/boot',['require', './brikz', './compatibility'], function (require, Brikz) {
  1083. "use strict";
  1084. function inherits(child, parent) {
  1085. child.prototype = Object.create(parent.prototype, {
  1086. constructor: {
  1087. value: child,
  1088. enumerable: false, configurable: true, writable: true
  1089. }
  1090. });
  1091. return child;
  1092. }
  1093. function SmalltalkGlobalsBrik(brikz, st) {
  1094. // jshint evil:true
  1095. var jsGlobals = new Function("return this")();
  1096. var globals = Object.create(jsGlobals);
  1097. globals.SmalltalkSettings = {};
  1098. this.globals = globals;
  1099. }
  1100. function RootBrik(brikz, st) {
  1101. /* Smalltalk foundational objects */
  1102. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1103. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1104. Detached roots (eg. wrapped JS classes like Number or Date)
  1105. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1106. function SmalltalkRoot() {
  1107. }
  1108. function SmalltalkProtoObject() {
  1109. }
  1110. function SmalltalkObject() {
  1111. }
  1112. function SmalltalkNil() {
  1113. }
  1114. inherits(SmalltalkProtoObject, SmalltalkRoot);
  1115. inherits(SmalltalkObject, SmalltalkProtoObject);
  1116. inherits(SmalltalkNil, SmalltalkObject);
  1117. this.Object = SmalltalkObject;
  1118. this.nilAsReceiver = new SmalltalkNil();
  1119. // Adds an `isNil` property to the `nil` object. When sending
  1120. // nil objects from one environment to another, doing
  1121. // `anObject == nil` (in JavaScript) does not always answer
  1122. // true as the referenced nil object might come from the other
  1123. // environment.
  1124. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1125. value: true,
  1126. enumerable: false, configurable: false, writable: false
  1127. });
  1128. // Fake root class of the system.
  1129. // Effective superclass of all classes created with `nil subclass: ...`.
  1130. this.nilAsClass = {fn: SmalltalkRoot};
  1131. this.__init__ = function () {
  1132. var globals = brikz.smalltalkGlobals.globals;
  1133. var addCoupledClass = brikz.classes.addCoupledClass;
  1134. st.addPackage("Kernel-Objects");
  1135. addCoupledClass("ProtoObject", undefined, "Kernel-Objects", SmalltalkProtoObject);
  1136. addCoupledClass("Object", globals.ProtoObject, "Kernel-Objects", SmalltalkObject);
  1137. addCoupledClass("UndefinedObject", globals.Object, "Kernel-Objects", SmalltalkNil);
  1138. };
  1139. this.__init__.once = true;
  1140. }
  1141. OrganizeBrik.deps = ["augments", "root"];
  1142. function OrganizeBrik(brikz, st) {
  1143. var SmalltalkObject = brikz.root.Object;
  1144. function SmalltalkOrganizer() {
  1145. }
  1146. function SmalltalkPackageOrganizer() {
  1147. this.elements = [];
  1148. }
  1149. function SmalltalkClassOrganizer() {
  1150. this.elements = [];
  1151. }
  1152. inherits(SmalltalkOrganizer, SmalltalkObject);
  1153. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  1154. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  1155. this.__init__ = function () {
  1156. var globals = brikz.smalltalkGlobals.globals;
  1157. var addCoupledClass = brikz.classes.addCoupledClass;
  1158. st.addPackage("Kernel-Infrastructure");
  1159. addCoupledClass("Organizer", globals.Object, "Kernel-Infrastructure", SmalltalkOrganizer);
  1160. addCoupledClass("PackageOrganizer", globals.Organizer, "Kernel-Infrastructure", SmalltalkPackageOrganizer);
  1161. addCoupledClass("ClassOrganizer", globals.Organizer, "Kernel-Infrastructure", SmalltalkClassOrganizer);
  1162. };
  1163. this.__init__.once = true;
  1164. this.setupClassOrganization = function (klass) {
  1165. klass.organization = new SmalltalkClassOrganizer();
  1166. klass.organization.theClass = klass;
  1167. };
  1168. this.setupPackageOrganization = function (pkg) {
  1169. pkg.organization = new SmalltalkPackageOrganizer();
  1170. };
  1171. this.addOrganizationElement = function (owner, element) {
  1172. owner.organization.elements.addElement(element);
  1173. };
  1174. this.removeOrganizationElement = function (owner, element) {
  1175. owner.organization.elements.removeElement(element);
  1176. };
  1177. }
  1178. SelectorsBrik.deps = ["selectorConversion"];
  1179. function SelectorsBrik(brikz, st) {
  1180. var selectorSet = Object.create(null);
  1181. var selectors = this.selectors = [];
  1182. var selectorPairs = this.selectorPairs = [];
  1183. this.registerSelector = function (stSelector) {
  1184. if (selectorSet[stSelector]) return null;
  1185. var jsSelector = st.st2js(stSelector);
  1186. selectorSet[stSelector] = true;
  1187. selectors.push(stSelector);
  1188. var pair = {st: stSelector, js: jsSelector};
  1189. selectorPairs.push(pair);
  1190. return pair;
  1191. };
  1192. st.allSelectors = function () {
  1193. return selectors;
  1194. };
  1195. }
  1196. PackagesBrik.deps = ["organize", "root"];
  1197. function PackagesBrik(brikz, st) {
  1198. var setupPackageOrganization = brikz.organize.setupPackageOrganization;
  1199. var SmalltalkObject = brikz.root.Object;
  1200. function SmalltalkPackage() {
  1201. }
  1202. inherits(SmalltalkPackage, SmalltalkObject);
  1203. this.__init__ = function () {
  1204. var globals = brikz.smalltalkGlobals.globals;
  1205. var addCoupledClass = brikz.classes.addCoupledClass;
  1206. st.addPackage("Kernel-Infrastructure");
  1207. addCoupledClass("Package", globals.Object, "Kernel-Infrastructure", SmalltalkPackage);
  1208. };
  1209. this.__init__.once = true;
  1210. st.packages = {};
  1211. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  1212. function pkg(spec) {
  1213. var that = new SmalltalkPackage();
  1214. that.pkgName = spec.pkgName;
  1215. setupPackageOrganization(that);
  1216. that.properties = spec.properties || {};
  1217. return that;
  1218. }
  1219. /* Add a package to the system, creating a new one if needed.
  1220. If pkgName is null or empty we return nil.
  1221. If package already exists we still update the properties of it. */
  1222. st.addPackage = function (pkgName, properties) {
  1223. if (!pkgName) {
  1224. return null;
  1225. }
  1226. if (!(st.packages[pkgName])) {
  1227. st.packages[pkgName] = pkg({
  1228. pkgName: pkgName,
  1229. properties: properties
  1230. });
  1231. } else {
  1232. if (properties) {
  1233. st.packages[pkgName].properties = properties;
  1234. }
  1235. }
  1236. return st.packages[pkgName];
  1237. };
  1238. }
  1239. ClassesBrik.deps = ["organize", "root", "smalltalkGlobals"];
  1240. function ClassesBrik(brikz, st) {
  1241. var setupClassOrganization = brikz.organize.setupClassOrganization;
  1242. var addOrganizationElement = brikz.organize.addOrganizationElement;
  1243. var removeOrganizationElement = brikz.organize.removeOrganizationElement;
  1244. var globals = brikz.smalltalkGlobals.globals;
  1245. var nilAsClass = brikz.root.nilAsClass;
  1246. var SmalltalkObject = brikz.root.Object;
  1247. nilAsClass.klass = {fn: SmalltalkClass};
  1248. function SmalltalkBehavior() {
  1249. }
  1250. function SmalltalkClass() {
  1251. }
  1252. function SmalltalkMetaclass() {
  1253. }
  1254. inherits(SmalltalkBehavior, SmalltalkObject);
  1255. inherits(SmalltalkClass, SmalltalkBehavior);
  1256. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  1257. SmalltalkBehavior.prototype.toString = function () {
  1258. return 'Smalltalk ' + this.className;
  1259. };
  1260. SmalltalkMetaclass.prototype.meta = true;
  1261. this.__init__ = function () {
  1262. var globals = brikz.smalltalkGlobals.globals;
  1263. var addCoupledClass = brikz.classes.addCoupledClass;
  1264. st.addPackage("Kernel-Classes");
  1265. addCoupledClass("Behavior", globals.Object, "Kernel-Classes", SmalltalkBehavior);
  1266. addCoupledClass("Metaclass", globals.Behavior, "Kernel-Classes", SmalltalkMetaclass);
  1267. addCoupledClass("Class", globals.Behavior, "Kernel-Classes", SmalltalkClass);
  1268. // Manually bootstrap the metaclass hierarchy
  1269. globals.ProtoObject.klass.superclass = nilAsClass.klass = globals.Class;
  1270. addSubclass(globals.ProtoObject.klass);
  1271. };
  1272. this.__init__.once = true;
  1273. /* Smalltalk classes */
  1274. var classes = [];
  1275. /* Smalltalk class creation. A class is an instance of an automatically
  1276. created metaclass object. Newly created classes (not their metaclass)
  1277. should be added to the system, see smalltalk.addClass().
  1278. Superclass linking is *not* handled here, see api.initialize() */
  1279. function klass(spec) {
  1280. var setSuperClass = spec.superclass;
  1281. if (!spec.superclass) {
  1282. spec.superclass = nilAsClass;
  1283. }
  1284. var meta = metaclass(spec);
  1285. var that = meta.instanceClass;
  1286. that.superclass = setSuperClass;
  1287. that.fn = spec.fn || inherits(function () {
  1288. }, spec.superclass.fn);
  1289. that.subclasses = [];
  1290. setupClass(that, spec);
  1291. that.className = spec.className;
  1292. meta.className = spec.className + ' class';
  1293. meta.superclass = spec.superclass.klass;
  1294. return that;
  1295. }
  1296. function metaclass(spec) {
  1297. var that = new SmalltalkMetaclass();
  1298. that.fn = inherits(function () {
  1299. }, spec.superclass.klass.fn);
  1300. wireKlass(that);
  1301. that.instanceClass = new that.fn();
  1302. setupClass(that, {});
  1303. return that;
  1304. }
  1305. function setupClass(klass, spec) {
  1306. klass.iVarNames = spec.iVarNames || [];
  1307. if (spec.pkg) {
  1308. klass.pkg = spec.pkg;
  1309. }
  1310. setupClassOrganization(klass);
  1311. Object.defineProperty(klass, "methods", {
  1312. value: Object.create(null),
  1313. enumerable: false, configurable: true, writable: true
  1314. });
  1315. }
  1316. function wireKlass(klass) {
  1317. Object.defineProperty(klass.fn.prototype, "klass", {
  1318. value: klass,
  1319. enumerable: false, configurable: true, writable: true
  1320. });
  1321. }
  1322. this.wireKlass = wireKlass;
  1323. /* Add a class to the system, creating a new one if needed.
  1324. A Package is lazily created if one with given name does not exist. */
  1325. st.addClass = function (className, superclass, iVarNames, pkgName) {
  1326. // While subclassing nil is allowed, it might be an error, so
  1327. // warn about it.
  1328. if (typeof superclass == 'undefined' || superclass && superclass.isNil) {
  1329. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  1330. }
  1331. return rawAddClass(pkgName, className, superclass, iVarNames, null);
  1332. };
  1333. function rawAddClass(pkgName, className, superclass, iVarNames, fn) {
  1334. var pkg = st.packages[pkgName];
  1335. if (!pkg) {
  1336. throw new Error("Missing package " + pkgName);
  1337. }
  1338. if (superclass == null || superclass.isNil) {
  1339. superclass = null;
  1340. }
  1341. var theClass = globals.hasOwnProperty(className) && globals[className];
  1342. if (theClass && theClass.superclass == superclass && !fn) {
  1343. if (iVarNames) theClass.iVarNames = iVarNames;
  1344. if (pkg) theClass.pkg = pkg;
  1345. } else {
  1346. if (theClass) {
  1347. iVarNames = iVarNames || theClass.iVarNames;
  1348. st.removeClass(theClass);
  1349. }
  1350. theClass = globals[className] = klass({
  1351. className: className,
  1352. superclass: superclass,
  1353. pkg: pkg,
  1354. iVarNames: iVarNames,
  1355. fn: fn
  1356. });
  1357. addSubclass(theClass);
  1358. }
  1359. classes.addElement(theClass);
  1360. addOrganizationElement(pkg, theClass);
  1361. if (st._classAdded) st._classAdded(theClass);
  1362. return theClass;
  1363. }
  1364. st.removeClass = function (klass) {
  1365. removeOrganizationElement(klass.pkg, klass);
  1366. classes.removeElement(klass);
  1367. removeSubclass(klass);
  1368. delete globals[klass.className];
  1369. };
  1370. function addSubclass(klass) {
  1371. if (klass.superclass) {
  1372. klass.superclass.subclasses.addElement(klass);
  1373. }
  1374. }
  1375. function removeSubclass(klass) {
  1376. if (klass.superclass) {
  1377. klass.superclass.subclasses.removeElement(klass);
  1378. }
  1379. }
  1380. /* Create a new class coupling with a JavaScript constructor,
  1381. and add it to the system.*/
  1382. this.addCoupledClass = function (className, superclass, pkgName, fn) {
  1383. return rawAddClass(pkgName, className, superclass, null, fn);
  1384. };
  1385. /* Create an alias for an existing class */
  1386. st.alias = function (klass, alias) {
  1387. globals[alias] = klass;
  1388. };
  1389. /* Answer all registered Smalltalk classes */
  1390. //TODO: remove the function and make smalltalk.classes an array
  1391. st.classes = this.classes = function () {
  1392. return classes;
  1393. };
  1394. function metaSubclasses(metaclass) {
  1395. return metaclass.instanceClass.subclasses
  1396. .filter(function (each) {
  1397. return !each.meta;
  1398. })
  1399. .map(function (each) {
  1400. return each.klass;
  1401. });
  1402. }
  1403. st.metaSubclasses = metaSubclasses;
  1404. st.traverseClassTree = function (klass, fn) {
  1405. var queue = [klass];
  1406. for (var i = 0; i < queue.length; ++i) {
  1407. var item = queue[i];
  1408. fn(item);
  1409. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  1410. queue.push.apply(queue, subclasses);
  1411. }
  1412. };
  1413. }
  1414. MethodsBrik.deps = ["organize", "selectors", "root", "selectorConversion"];
  1415. function MethodsBrik(brikz, st) {
  1416. var addOrganizationElement = brikz.organize.addOrganizationElement;
  1417. var registerSelector = brikz.selectors.registerSelector;
  1418. var SmalltalkObject = brikz.root.Object;
  1419. function SmalltalkMethod() {
  1420. }
  1421. inherits(SmalltalkMethod, SmalltalkObject);
  1422. this.__init__ = function () {
  1423. var globals = brikz.smalltalkGlobals.globals;
  1424. var addCoupledClass = brikz.classes.addCoupledClass;
  1425. st.addPackage("Kernel-Methods");
  1426. addCoupledClass("CompiledMethod", globals.Object, "Kernel-Methods", SmalltalkMethod);
  1427. };
  1428. this.__init__.once = true;
  1429. /* Smalltalk method object. To add a method to a class,
  1430. use api.addMethod() */
  1431. st.method = function (spec) {
  1432. var that = new SmalltalkMethod();
  1433. var selector = spec.selector;
  1434. that.selector = selector;
  1435. that.jsSelector = st.st2js(selector);
  1436. that.args = spec.args || {};
  1437. that.protocol = spec.protocol;
  1438. that.source = spec.source;
  1439. that.messageSends = spec.messageSends || [];
  1440. that.referencedClasses = spec.referencedClasses || [];
  1441. that.fn = spec.fn;
  1442. return that;
  1443. };
  1444. /* Add/remove a method to/from a class */
  1445. st.addMethod = function (method, klass) {
  1446. klass.methods[method.selector] = method;
  1447. method.methodClass = klass;
  1448. // During the bootstrap, #addCompiledMethod is not used.
  1449. // Therefore we populate the organizer here too
  1450. addOrganizationElement(klass, method.protocol);
  1451. var newSelectors = [];
  1452. function selectorInUse(stSelector) {
  1453. var pair = registerSelector(stSelector);
  1454. if (pair) {
  1455. newSelectors.push(pair);
  1456. }
  1457. }
  1458. selectorInUse(method.selector);
  1459. method.messageSends.forEach(selectorInUse);
  1460. if (st._methodAdded) st._methodAdded(method, klass);
  1461. if (st._selectorsAdded) st._selectorsAdded(newSelectors);
  1462. };
  1463. st.removeMethod = function (method, klass) {
  1464. if (klass !== method.methodClass) {
  1465. throw new Error(
  1466. "Refusing to remove method " +
  1467. method.methodClass.className + ">>" + method.selector +
  1468. " from different class " +
  1469. klass.className);
  1470. }
  1471. delete klass.methods[method.selector];
  1472. if (st._methodRemoved) st._methodRemoved(method, klass);
  1473. // Do *not* delete protocols from here.
  1474. // This is handled by #removeCompiledMethod
  1475. };
  1476. }
  1477. function AugmentsBrik(brikz, st) {
  1478. /* Array extensions */
  1479. Array.prototype.addElement = function (el) {
  1480. if (typeof el === 'undefined') {
  1481. return;
  1482. }
  1483. if (this.indexOf(el) == -1) {
  1484. this.push(el);
  1485. }
  1486. };
  1487. Array.prototype.removeElement = function (el) {
  1488. var i = this.indexOf(el);
  1489. if (i !== -1) {
  1490. this.splice(i, 1);
  1491. }
  1492. };
  1493. }
  1494. SmalltalkInitBrik.deps = ["globals", "classes"];
  1495. function SmalltalkInitBrik(brikz, st) {
  1496. var globals = brikz.smalltalkGlobals.globals;
  1497. var initialized = false;
  1498. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  1499. require(['./kernel-runtime'], resolve, reject);
  1500. });
  1501. /* Smalltalk initialization. Called on page load */
  1502. st.initialize = function () {
  1503. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  1504. if (initialized) {
  1505. return;
  1506. }
  1507. configureWithRuntime(brikz);
  1508. st.alias(globals.Array, "OrderedCollection");
  1509. st.alias(globals.Date, "Time");
  1510. st.classes().forEach(function (klass) {
  1511. klass._initialize();
  1512. });
  1513. initialized = true;
  1514. });
  1515. };
  1516. }
  1517. function SelectorConversionBrik(brikz, st) {
  1518. /* Convert a Smalltalk selector into a JS selector */
  1519. st.st2js = function (string) {
  1520. return '_' + string
  1521. .replace(/:/g, '_')
  1522. .replace(/[\&]/g, '_and')
  1523. .replace(/[\|]/g, '_or')
  1524. .replace(/[+]/g, '_plus')
  1525. .replace(/-/g, '_minus')
  1526. .replace(/[*]/g, '_star')
  1527. .replace(/[\/]/g, '_slash')
  1528. .replace(/[\\]/g, '_backslash')
  1529. .replace(/[\~]/g, '_tild')
  1530. .replace(/>/g, '_gt')
  1531. .replace(/</g, '_lt')
  1532. .replace(/=/g, '_eq')
  1533. .replace(/,/g, '_comma')
  1534. .replace(/[@]/g, '_at');
  1535. };
  1536. /* Convert a string to a valid smalltalk selector.
  1537. if you modify the following functions, also change st2js
  1538. accordingly */
  1539. st.js2st = function (selector) {
  1540. if (selector.match(/^__/)) {
  1541. return binaryJsToSt(selector);
  1542. } else {
  1543. return keywordJsToSt(selector);
  1544. }
  1545. };
  1546. function keywordJsToSt(selector) {
  1547. return selector.replace(/^_/, '').replace(/_/g, ':');
  1548. }
  1549. function binaryJsToSt(selector) {
  1550. return selector
  1551. .replace(/^_/, '')
  1552. .replace(/_and/g, '&')
  1553. .replace(/_or/g, '|')
  1554. .replace(/_plus/g, '+')
  1555. .replace(/_minus/g, '-')
  1556. .replace(/_star/g, '*')
  1557. .replace(/_slash/g, '/')
  1558. .replace(/_backslash/g, '\\')
  1559. .replace(/_tild/g, '~')
  1560. .replace(/_gt/g, '>')
  1561. .replace(/_lt/g, '<')
  1562. .replace(/_eq/g, '=')
  1563. .replace(/_comma/g, ',')
  1564. .replace(/_at/g, '@');
  1565. }
  1566. st.st2prop = function (stSelector) {
  1567. var colonPosition = stSelector.indexOf(':');
  1568. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1569. };
  1570. }
  1571. /* Adds AMD and requirejs related methods to the api */
  1572. function AMDBrik(brikz, st) {
  1573. st.amdRequire = require;
  1574. st.defaultTransportType = st.defaultTransportType || "amd";
  1575. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  1576. }
  1577. /* Defines asReceiver to be present at load time */
  1578. /* (logically it belongs more to PrimitiveBrik) */
  1579. AsReceiverBrik.deps = ["smalltalkGlobals", "root"];
  1580. function AsReceiverBrik(brikz, st) {
  1581. var globals = brikz.smalltalkGlobals.globals;
  1582. var nilAsReceiver = brikz.root.nilAsReceiver;
  1583. /**
  1584. * This function is used all over the compiled amber code.
  1585. * It takes any value (JavaScript or Smalltalk)
  1586. * and returns a proper Amber Smalltalk receiver.
  1587. *
  1588. * null or undefined -> nilAsReceiver,
  1589. * object having Smalltalk signature -> unchanged,
  1590. * otherwise wrapped foreign (JS) object
  1591. */
  1592. this.asReceiver = function (o) {
  1593. if (o == null) return nilAsReceiver;
  1594. else if (o.klass != null) return o;
  1595. else return globals.JSObjectProxy._on_(o);
  1596. };
  1597. }
  1598. var api = {};
  1599. var brikz = new Brikz(api);
  1600. /* Making smalltalk that can load */
  1601. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1602. brikz.root = RootBrik;
  1603. brikz.selectors = SelectorsBrik;
  1604. brikz.organize = OrganizeBrik;
  1605. brikz.selectorConversion = SelectorConversionBrik;
  1606. brikz.packages = PackagesBrik;
  1607. brikz.classes = ClassesBrik;
  1608. brikz.methods = MethodsBrik;
  1609. brikz.stInit = SmalltalkInitBrik;
  1610. brikz.augments = AugmentsBrik;
  1611. brikz.asReceiver = AsReceiverBrik;
  1612. brikz.amd = AMDBrik;
  1613. brikz.rebuild();
  1614. return {
  1615. api: api,
  1616. nil/* TODO deprecate */: brikz.root.nilAsReceiver,
  1617. nilAsReceiver: brikz.root.nilAsReceiver,
  1618. dnu/* TODO deprecate */: brikz.root.nilAsClass,
  1619. nilAsClass: brikz.root.nilAsClass,
  1620. globals: brikz.smalltalkGlobals.globals,
  1621. asReceiver: brikz.asReceiver.asReceiver
  1622. };
  1623. });
  1624. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  1625. var globals = boot.globals,
  1626. exports = {},
  1627. api = boot.api,
  1628. nil = boot.nilAsReceiver;
  1629. // API
  1630. exports.popupHelios = function () {
  1631. require(['helios/index'], function (helios) {
  1632. helios.popup();
  1633. }, function (err) {
  1634. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  1635. });
  1636. };
  1637. Object.defineProperty(exports, "api", {
  1638. value: api,
  1639. enumerable: true, configurable: true, writable: false
  1640. });
  1641. Object.defineProperty(exports, "globals", {
  1642. value: globals,
  1643. enumerable: true, configurable: true, writable: false
  1644. });
  1645. Object.defineProperty(exports, "nil", {
  1646. value: nil,
  1647. enumerable: true, configurable: true, writable: false
  1648. });
  1649. function mixinToSettings(source) {
  1650. var settings = globals.SmalltalkSettings;
  1651. Object.keys(source).forEach(function (key) {
  1652. settings[key] = source[key];
  1653. });
  1654. }
  1655. function settingsInLocalStorage() {
  1656. //jshint evil:true
  1657. var global = new Function('return this')(),
  1658. storage = 'localStorage' in global && global.localStorage;
  1659. if (storage) {
  1660. var fromStorage;
  1661. try {
  1662. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  1663. } catch (ex) {
  1664. // pass
  1665. }
  1666. mixinToSettings(fromStorage || {});
  1667. if (typeof window !== "undefined") {
  1668. requirejs(['jquery'], function ($) {
  1669. $(window).on('beforeunload', function () {
  1670. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  1671. });
  1672. });
  1673. }
  1674. }
  1675. }
  1676. exports.initialize = function (options) {
  1677. return Promise.resolve()
  1678. .then(function () {
  1679. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  1680. })
  1681. .then(settingsInLocalStorage)
  1682. .then(function () {
  1683. return options || {};
  1684. })
  1685. .then(mixinToSettings)
  1686. .then(function () {
  1687. return api.initialize();
  1688. });
  1689. };
  1690. // Exports
  1691. return exports;
  1692. });
  1693. define('amber_core/Kernel-Objects',["amber/boot"], function($boot){"use strict";
  1694. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  1695. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  1696. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  1697. $core.addPackage('Kernel-Objects');
  1698. $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  1699. $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  1700. $core.addClass('ProtoObject', null, [], 'Kernel-Objects');
  1701. $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.";
  1702. $core.addMethod(
  1703. $core.method({
  1704. selector: "=",
  1705. protocol: 'comparing',
  1706. fn: function (anObject){
  1707. var self=this;
  1708. return $core.withContext(function($ctx1) {
  1709. return self.__eq_eq(anObject);
  1710. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  1711. },
  1712. args: ["anObject"],
  1713. source: "= anObject\x0a\x09^ self == anObject",
  1714. referencedClasses: [],
  1715. messageSends: ["=="]
  1716. }),
  1717. $globals.ProtoObject);
  1718. $core.addMethod(
  1719. $core.method({
  1720. selector: "==",
  1721. protocol: 'comparing',
  1722. fn: function (anObject){
  1723. var self=this;
  1724. return $core.withContext(function($ctx1) {
  1725. return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject);
  1726. return self;
  1727. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  1728. },
  1729. args: ["anObject"],
  1730. source: "== anObject\x0a<inlineJS:\x0a\x09'return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject)'>",
  1731. referencedClasses: [],
  1732. messageSends: []
  1733. }),
  1734. $globals.ProtoObject);
  1735. $core.addMethod(
  1736. $core.method({
  1737. selector: "asString",
  1738. protocol: 'converting',
  1739. fn: function (){
  1740. var self=this;
  1741. return $core.withContext(function($ctx1) {
  1742. return self._printString();
  1743. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  1744. },
  1745. args: [],
  1746. source: "asString\x0a\x09^ self printString",
  1747. referencedClasses: [],
  1748. messageSends: ["printString"]
  1749. }),
  1750. $globals.ProtoObject);
  1751. $core.addMethod(
  1752. $core.method({
  1753. selector: "class",
  1754. protocol: 'accessing',
  1755. fn: function (){
  1756. var self=this;
  1757. return $core.withContext(function($ctx1) {
  1758. return self.klass;
  1759. return self;
  1760. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  1761. },
  1762. args: [],
  1763. source: "class\x0a\x09<inlineJS: 'return self.klass'>",
  1764. referencedClasses: [],
  1765. messageSends: []
  1766. }),
  1767. $globals.ProtoObject);
  1768. $core.addMethod(
  1769. $core.method({
  1770. selector: "doesNotUnderstand:",
  1771. protocol: 'error handling',
  1772. fn: function (aMessage){
  1773. var self=this;
  1774. return $core.withContext(function($ctx1) {
  1775. var $1;
  1776. $1=$recv($globals.MessageNotUnderstood)._new();
  1777. $recv($1)._receiver_(self);
  1778. $recv($1)._message_(aMessage);
  1779. $recv($1)._signal();
  1780. return self;
  1781. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  1782. },
  1783. args: ["aMessage"],
  1784. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1785. referencedClasses: ["MessageNotUnderstood"],
  1786. messageSends: ["receiver:", "new", "message:", "signal"]
  1787. }),
  1788. $globals.ProtoObject);
  1789. $core.addMethod(
  1790. $core.method({
  1791. selector: "evaluate:on:",
  1792. protocol: 'evaluating',
  1793. fn: function (aString,anEvaluator){
  1794. var self=this;
  1795. return $core.withContext(function($ctx1) {
  1796. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  1797. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  1798. },
  1799. args: ["aString", "anEvaluator"],
  1800. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  1801. referencedClasses: [],
  1802. messageSends: ["evaluate:receiver:"]
  1803. }),
  1804. $globals.ProtoObject);
  1805. $core.addMethod(
  1806. $core.method({
  1807. selector: "identityHash",
  1808. protocol: 'accessing',
  1809. fn: function (){
  1810. var self=this;
  1811. return $core.withContext(function($ctx1) {
  1812. var hash=self.identityHash;
  1813. if (hash) return hash;
  1814. hash=$core.nextId();
  1815. Object.defineProperty(self, 'identityHash', {value:hash});
  1816. return hash;
  1817. ;
  1818. return self;
  1819. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  1820. },
  1821. args: [],
  1822. source: "identityHash\x0a\x09<inlineJS: '\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'>",
  1823. referencedClasses: [],
  1824. messageSends: []
  1825. }),
  1826. $globals.ProtoObject);
  1827. $core.addMethod(
  1828. $core.method({
  1829. selector: "ifNil:",
  1830. protocol: 'testing',
  1831. fn: function (aBlock){
  1832. var self=this;
  1833. return self;
  1834. },
  1835. args: ["aBlock"],
  1836. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  1837. referencedClasses: [],
  1838. messageSends: []
  1839. }),
  1840. $globals.ProtoObject);
  1841. $core.addMethod(
  1842. $core.method({
  1843. selector: "ifNil:ifNotNil:",
  1844. protocol: 'testing',
  1845. fn: function (aBlock,anotherBlock){
  1846. var self=this;
  1847. return $core.withContext(function($ctx1) {
  1848. return $recv(anotherBlock)._value_(self);
  1849. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1850. },
  1851. args: ["aBlock", "anotherBlock"],
  1852. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  1853. referencedClasses: [],
  1854. messageSends: ["value:"]
  1855. }),
  1856. $globals.ProtoObject);
  1857. $core.addMethod(
  1858. $core.method({
  1859. selector: "ifNotNil:",
  1860. protocol: 'testing',
  1861. fn: function (aBlock){
  1862. var self=this;
  1863. return $core.withContext(function($ctx1) {
  1864. return $recv(aBlock)._value_(self);
  1865. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  1866. },
  1867. args: ["aBlock"],
  1868. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1869. referencedClasses: [],
  1870. messageSends: ["value:"]
  1871. }),
  1872. $globals.ProtoObject);
  1873. $core.addMethod(
  1874. $core.method({
  1875. selector: "ifNotNil:ifNil:",
  1876. protocol: 'testing',
  1877. fn: function (aBlock,anotherBlock){
  1878. var self=this;
  1879. return $core.withContext(function($ctx1) {
  1880. return $recv(aBlock)._value_(self);
  1881. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1882. },
  1883. args: ["aBlock", "anotherBlock"],
  1884. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1885. referencedClasses: [],
  1886. messageSends: ["value:"]
  1887. }),
  1888. $globals.ProtoObject);
  1889. $core.addMethod(
  1890. $core.method({
  1891. selector: "initialize",
  1892. protocol: 'initialization',
  1893. fn: function (){
  1894. var self=this;
  1895. return self;
  1896. },
  1897. args: [],
  1898. source: "initialize",
  1899. referencedClasses: [],
  1900. messageSends: []
  1901. }),
  1902. $globals.ProtoObject);
  1903. $core.addMethod(
  1904. $core.method({
  1905. selector: "inspect",
  1906. protocol: 'inspecting',
  1907. fn: function (){
  1908. var self=this;
  1909. return $core.withContext(function($ctx1) {
  1910. $recv($globals.Inspector)._inspect_(self);
  1911. return self;
  1912. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  1913. },
  1914. args: [],
  1915. source: "inspect\x0a\x09Inspector inspect: self",
  1916. referencedClasses: ["Inspector"],
  1917. messageSends: ["inspect:"]
  1918. }),
  1919. $globals.ProtoObject);
  1920. $core.addMethod(
  1921. $core.method({
  1922. selector: "inspectOn:",
  1923. protocol: 'inspecting',
  1924. fn: function (anInspector){
  1925. var self=this;
  1926. return self;
  1927. },
  1928. args: ["anInspector"],
  1929. source: "inspectOn: anInspector",
  1930. referencedClasses: [],
  1931. messageSends: []
  1932. }),
  1933. $globals.ProtoObject);
  1934. $core.addMethod(
  1935. $core.method({
  1936. selector: "instVarAt:",
  1937. protocol: 'accessing',
  1938. fn: function (aString){
  1939. var self=this;
  1940. return $core.withContext(function($ctx1) {
  1941. return self['@'+aString];
  1942. return self;
  1943. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  1944. },
  1945. args: ["aString"],
  1946. source: "instVarAt: aString\x0a\x09<inlineJS: 'return self[''@''+aString]'>",
  1947. referencedClasses: [],
  1948. messageSends: []
  1949. }),
  1950. $globals.ProtoObject);
  1951. $core.addMethod(
  1952. $core.method({
  1953. selector: "instVarAt:put:",
  1954. protocol: 'accessing',
  1955. fn: function (aString,anObject){
  1956. var self=this;
  1957. return $core.withContext(function($ctx1) {
  1958. self['@' + aString] = anObject;
  1959. return self;
  1960. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  1961. },
  1962. args: ["aString", "anObject"],
  1963. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: 'self[''@'' + aString] = anObject'>",
  1964. referencedClasses: [],
  1965. messageSends: []
  1966. }),
  1967. $globals.ProtoObject);
  1968. $core.addMethod(
  1969. $core.method({
  1970. selector: "isKindOf:",
  1971. protocol: 'testing',
  1972. fn: function (aClass){
  1973. var self=this;
  1974. return $core.withContext(function($ctx1) {
  1975. var $1;
  1976. $1=self._isMemberOf_(aClass);
  1977. if($core.assert($1)){
  1978. return true;
  1979. } else {
  1980. return $recv(self._class())._inheritsFrom_(aClass);
  1981. };
  1982. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  1983. },
  1984. args: ["aClass"],
  1985. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  1986. referencedClasses: [],
  1987. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  1988. }),
  1989. $globals.ProtoObject);
  1990. $core.addMethod(
  1991. $core.method({
  1992. selector: "isNil",
  1993. protocol: 'testing',
  1994. fn: function (){
  1995. var self=this;
  1996. return false;
  1997. },
  1998. args: [],
  1999. source: "isNil\x0a\x09^ false",
  2000. referencedClasses: [],
  2001. messageSends: []
  2002. }),
  2003. $globals.ProtoObject);
  2004. $core.addMethod(
  2005. $core.method({
  2006. selector: "isSameInstanceAs:",
  2007. protocol: 'comparing',
  2008. fn: function (anObject){
  2009. var self=this;
  2010. return $core.withContext(function($ctx1) {
  2011. var $1;
  2012. $1=self._identityHash();
  2013. $ctx1.sendIdx["identityHash"]=1;
  2014. return $recv($1).__eq($recv(anObject)._identityHash());
  2015. }, function($ctx1) {$ctx1.fill(self,"isSameInstanceAs:",{anObject:anObject},$globals.ProtoObject)});
  2016. },
  2017. args: ["anObject"],
  2018. source: "isSameInstanceAs: anObject\x0a\x09^ self identityHash = anObject identityHash",
  2019. referencedClasses: [],
  2020. messageSends: ["=", "identityHash"]
  2021. }),
  2022. $globals.ProtoObject);
  2023. $core.addMethod(
  2024. $core.method({
  2025. selector: "notNil",
  2026. protocol: 'testing',
  2027. fn: function (){
  2028. var self=this;
  2029. return $core.withContext(function($ctx1) {
  2030. return $recv(self._isNil())._not();
  2031. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2032. },
  2033. args: [],
  2034. source: "notNil\x0a\x09^ self isNil not",
  2035. referencedClasses: [],
  2036. messageSends: ["not", "isNil"]
  2037. }),
  2038. $globals.ProtoObject);
  2039. $core.addMethod(
  2040. $core.method({
  2041. selector: "perform:",
  2042. protocol: 'message handling',
  2043. fn: function (aString){
  2044. var self=this;
  2045. return $core.withContext(function($ctx1) {
  2046. return self._perform_withArguments_(aString,[]);
  2047. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2048. },
  2049. args: ["aString"],
  2050. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2051. referencedClasses: [],
  2052. messageSends: ["perform:withArguments:"]
  2053. }),
  2054. $globals.ProtoObject);
  2055. $core.addMethod(
  2056. $core.method({
  2057. selector: "perform:withArguments:",
  2058. protocol: 'message handling',
  2059. fn: function (aString,aCollection){
  2060. var self=this;
  2061. return $core.withContext(function($ctx1) {
  2062. return $core.send2(self, aString, aCollection);
  2063. return self;
  2064. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2065. },
  2066. args: ["aString", "aCollection"],
  2067. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  2068. referencedClasses: [],
  2069. messageSends: []
  2070. }),
  2071. $globals.ProtoObject);
  2072. $core.addMethod(
  2073. $core.method({
  2074. selector: "printOn:",
  2075. protocol: 'printing',
  2076. fn: function (aStream){
  2077. var self=this;
  2078. return $core.withContext(function($ctx1) {
  2079. var $5,$4,$3,$2,$1;
  2080. $5=self._class();
  2081. $ctx1.sendIdx["class"]=1;
  2082. $4=$recv($5)._name();
  2083. $ctx1.sendIdx["name"]=1;
  2084. $3=$recv($4)._first();
  2085. $2=$recv($3)._isVowel();
  2086. if($core.assert($2)){
  2087. $1="an ";
  2088. } else {
  2089. $1="a ";
  2090. };
  2091. $recv(aStream)._nextPutAll_($1);
  2092. $ctx1.sendIdx["nextPutAll:"]=1;
  2093. $recv(aStream)._nextPutAll_($recv(self._class())._name());
  2094. return self;
  2095. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  2096. },
  2097. args: ["aStream"],
  2098. 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",
  2099. referencedClasses: [],
  2100. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  2101. }),
  2102. $globals.ProtoObject);
  2103. $core.addMethod(
  2104. $core.method({
  2105. selector: "printString",
  2106. protocol: 'printing',
  2107. fn: function (){
  2108. var self=this;
  2109. return $core.withContext(function($ctx1) {
  2110. return $recv($globals.String)._streamContents_((function(str){
  2111. return $core.withContext(function($ctx2) {
  2112. return self._printOn_(str);
  2113. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  2114. }));
  2115. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  2116. },
  2117. args: [],
  2118. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  2119. referencedClasses: ["String"],
  2120. messageSends: ["streamContents:", "printOn:"]
  2121. }),
  2122. $globals.ProtoObject);
  2123. $core.addMethod(
  2124. $core.method({
  2125. selector: "yourself",
  2126. protocol: 'accessing',
  2127. fn: function (){
  2128. var self=this;
  2129. return self;
  2130. },
  2131. args: [],
  2132. source: "yourself\x0a\x09^ self",
  2133. referencedClasses: [],
  2134. messageSends: []
  2135. }),
  2136. $globals.ProtoObject);
  2137. $core.addMethod(
  2138. $core.method({
  2139. selector: "~=",
  2140. protocol: 'comparing',
  2141. fn: function (anObject){
  2142. var self=this;
  2143. return $core.withContext(function($ctx1) {
  2144. var $1;
  2145. $1=$recv(self.__eq(anObject)).__eq(false);
  2146. $ctx1.sendIdx["="]=1;
  2147. return $1;
  2148. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  2149. },
  2150. args: ["anObject"],
  2151. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  2152. referencedClasses: [],
  2153. messageSends: ["="]
  2154. }),
  2155. $globals.ProtoObject);
  2156. $core.addMethod(
  2157. $core.method({
  2158. selector: "~~",
  2159. protocol: 'comparing',
  2160. fn: function (anObject){
  2161. var self=this;
  2162. return $core.withContext(function($ctx1) {
  2163. return $recv(self.__eq_eq(anObject)).__eq(false);
  2164. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  2165. },
  2166. args: ["anObject"],
  2167. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  2168. referencedClasses: [],
  2169. messageSends: ["=", "=="]
  2170. }),
  2171. $globals.ProtoObject);
  2172. $core.addMethod(
  2173. $core.method({
  2174. selector: "initialize",
  2175. protocol: 'initialization',
  2176. fn: function (){
  2177. var self=this;
  2178. return self;
  2179. },
  2180. args: [],
  2181. source: "initialize",
  2182. referencedClasses: [],
  2183. messageSends: []
  2184. }),
  2185. $globals.ProtoObject.klass);
  2186. $core.addClass('Object', $globals.ProtoObject, [], 'Kernel-Objects');
  2187. $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.";
  2188. $core.addMethod(
  2189. $core.method({
  2190. selector: "->",
  2191. protocol: 'converting',
  2192. fn: function (anObject){
  2193. var self=this;
  2194. return $core.withContext(function($ctx1) {
  2195. return $recv($globals.Association)._key_value_(self,anObject);
  2196. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  2197. },
  2198. args: ["anObject"],
  2199. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  2200. referencedClasses: ["Association"],
  2201. messageSends: ["key:value:"]
  2202. }),
  2203. $globals.Object);
  2204. $core.addMethod(
  2205. $core.method({
  2206. selector: "asJSON",
  2207. protocol: 'converting',
  2208. fn: function (){
  2209. var self=this;
  2210. var variables;
  2211. return $core.withContext(function($ctx1) {
  2212. variables=$recv($globals.HashedCollection)._new();
  2213. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  2214. return $core.withContext(function($ctx2) {
  2215. return $recv(variables)._at_put_(each,$recv(self._instVarAt_(each))._asJSON());
  2216. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2217. }));
  2218. return variables;
  2219. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},$globals.Object)});
  2220. },
  2221. args: [],
  2222. source: "asJSON\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) asJSON ].\x0a\x09^ variables",
  2223. referencedClasses: ["HashedCollection"],
  2224. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"]
  2225. }),
  2226. $globals.Object);
  2227. $core.addMethod(
  2228. $core.method({
  2229. selector: "asJSONString",
  2230. protocol: 'converting',
  2231. fn: function (){
  2232. var self=this;
  2233. return $core.withContext(function($ctx1) {
  2234. return $recv($globals.JSON)._stringify_(self._asJSON());
  2235. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  2236. },
  2237. args: [],
  2238. source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
  2239. referencedClasses: ["JSON"],
  2240. messageSends: ["stringify:", "asJSON"]
  2241. }),
  2242. $globals.Object);
  2243. $core.addMethod(
  2244. $core.method({
  2245. selector: "asJavascript",
  2246. protocol: 'converting',
  2247. fn: function (){
  2248. var self=this;
  2249. return $core.withContext(function($ctx1) {
  2250. return self._asString();
  2251. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Object)});
  2252. },
  2253. args: [],
  2254. source: "asJavascript\x0a\x09^ self asString",
  2255. referencedClasses: [],
  2256. messageSends: ["asString"]
  2257. }),
  2258. $globals.Object);
  2259. $core.addMethod(
  2260. $core.method({
  2261. selector: "basicAt:",
  2262. protocol: 'accessing',
  2263. fn: function (aString){
  2264. var self=this;
  2265. return $core.withContext(function($ctx1) {
  2266. return self[aString];
  2267. return self;
  2268. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  2269. },
  2270. args: ["aString"],
  2271. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  2272. referencedClasses: [],
  2273. messageSends: []
  2274. }),
  2275. $globals.Object);
  2276. $core.addMethod(
  2277. $core.method({
  2278. selector: "basicAt:put:",
  2279. protocol: 'accessing',
  2280. fn: function (aString,anObject){
  2281. var self=this;
  2282. return $core.withContext(function($ctx1) {
  2283. return self[aString] = anObject;
  2284. return self;
  2285. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  2286. },
  2287. args: ["aString", "anObject"],
  2288. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  2289. referencedClasses: [],
  2290. messageSends: []
  2291. }),
  2292. $globals.Object);
  2293. $core.addMethod(
  2294. $core.method({
  2295. selector: "basicDelete:",
  2296. protocol: 'accessing',
  2297. fn: function (aString){
  2298. var self=this;
  2299. return $core.withContext(function($ctx1) {
  2300. delete self[aString]; return aString;
  2301. return self;
  2302. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  2303. },
  2304. args: ["aString"],
  2305. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  2306. referencedClasses: [],
  2307. messageSends: []
  2308. }),
  2309. $globals.Object);
  2310. $core.addMethod(
  2311. $core.method({
  2312. selector: "basicPerform:",
  2313. protocol: 'message handling',
  2314. fn: function (aString){
  2315. var self=this;
  2316. return $core.withContext(function($ctx1) {
  2317. return self._basicPerform_withArguments_(aString,[]);
  2318. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  2319. },
  2320. args: ["aString"],
  2321. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  2322. referencedClasses: [],
  2323. messageSends: ["basicPerform:withArguments:"]
  2324. }),
  2325. $globals.Object);
  2326. $core.addMethod(
  2327. $core.method({
  2328. selector: "basicPerform:withArguments:",
  2329. protocol: 'message handling',
  2330. fn: function (aString,aCollection){
  2331. var self=this;
  2332. return $core.withContext(function($ctx1) {
  2333. return self[aString].apply(self, aCollection);;
  2334. return self;
  2335. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  2336. },
  2337. args: ["aString", "aCollection"],
  2338. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  2339. referencedClasses: [],
  2340. messageSends: []
  2341. }),
  2342. $globals.Object);
  2343. $core.addMethod(
  2344. $core.method({
  2345. selector: "browse",
  2346. protocol: 'browsing',
  2347. fn: function (){
  2348. var self=this;
  2349. return $core.withContext(function($ctx1) {
  2350. $recv($globals.Finder)._findClass_(self._class());
  2351. return self;
  2352. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  2353. },
  2354. args: [],
  2355. source: "browse\x0a\x09Finder findClass: self class",
  2356. referencedClasses: ["Finder"],
  2357. messageSends: ["findClass:", "class"]
  2358. }),
  2359. $globals.Object);
  2360. $core.addMethod(
  2361. $core.method({
  2362. selector: "copy",
  2363. protocol: 'copying',
  2364. fn: function (){
  2365. var self=this;
  2366. return $core.withContext(function($ctx1) {
  2367. return $recv(self._shallowCopy())._postCopy();
  2368. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  2369. },
  2370. args: [],
  2371. source: "copy\x0a\x09^ self shallowCopy postCopy",
  2372. referencedClasses: [],
  2373. messageSends: ["postCopy", "shallowCopy"]
  2374. }),
  2375. $globals.Object);
  2376. $core.addMethod(
  2377. $core.method({
  2378. selector: "deepCopy",
  2379. protocol: 'copying',
  2380. fn: function (){
  2381. var self=this;
  2382. return $core.withContext(function($ctx1) {
  2383. var copy = self.klass._new();
  2384. Object.keys(self).forEach(function (i) {
  2385. if(/^@.+/.test(i)) {
  2386. copy[i] = self[i]._deepCopy();
  2387. }
  2388. });
  2389. return copy;
  2390. ;
  2391. return self;
  2392. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  2393. },
  2394. args: [],
  2395. source: "deepCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i]._deepCopy();\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  2396. referencedClasses: [],
  2397. messageSends: []
  2398. }),
  2399. $globals.Object);
  2400. $core.addMethod(
  2401. $core.method({
  2402. selector: "deprecatedAPI",
  2403. protocol: 'error handling',
  2404. fn: function (){
  2405. var self=this;
  2406. return $core.withContext(function($ctx1) {
  2407. var $1,$6,$5,$4,$8,$7,$3,$2;
  2408. $1=console;
  2409. $6=$core.getThisContext()._home();
  2410. $ctx1.sendIdx["home"]=1;
  2411. $5=$recv($6)._asString();
  2412. $ctx1.sendIdx["asString"]=1;
  2413. $4=$recv($5).__comma(" is deprecated! (in ");
  2414. $8=$recv($core.getThisContext()._home())._home();
  2415. $ctx1.sendIdx["home"]=2;
  2416. $7=$recv($8)._asString();
  2417. $3=$recv($4).__comma($7);
  2418. $ctx1.sendIdx[","]=2;
  2419. $2=$recv($3).__comma(")");
  2420. $ctx1.sendIdx[","]=1;
  2421. $recv($1)._warn_($2);
  2422. return self;
  2423. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  2424. },
  2425. args: [],
  2426. 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, ')'.",
  2427. referencedClasses: [],
  2428. messageSends: ["warn:", ",", "asString", "home"]
  2429. }),
  2430. $globals.Object);
  2431. $core.addMethod(
  2432. $core.method({
  2433. selector: "deprecatedAPI:",
  2434. protocol: 'error handling',
  2435. fn: function (aString){
  2436. var self=this;
  2437. return $core.withContext(function($ctx1) {
  2438. var $1,$6,$5,$4,$8,$7,$3,$2;
  2439. $1=console;
  2440. $6=$core.getThisContext()._home();
  2441. $ctx1.sendIdx["home"]=1;
  2442. $5=$recv($6)._asString();
  2443. $ctx1.sendIdx["asString"]=1;
  2444. $4=$recv($5).__comma(" is deprecated! (in ");
  2445. $8=$recv($core.getThisContext()._home())._home();
  2446. $ctx1.sendIdx["home"]=2;
  2447. $7=$recv($8)._asString();
  2448. $3=$recv($4).__comma($7);
  2449. $ctx1.sendIdx[","]=2;
  2450. $2=$recv($3).__comma(")");
  2451. $ctx1.sendIdx[","]=1;
  2452. $recv($1)._warn_($2);
  2453. $ctx1.sendIdx["warn:"]=1;
  2454. $recv(console)._warn_(aString);
  2455. return self;
  2456. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  2457. },
  2458. args: ["aString"],
  2459. 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",
  2460. referencedClasses: [],
  2461. messageSends: ["warn:", ",", "asString", "home"]
  2462. }),
  2463. $globals.Object);
  2464. $core.addMethod(
  2465. $core.method({
  2466. selector: "error:",
  2467. protocol: 'error handling',
  2468. fn: function (aString){
  2469. var self=this;
  2470. return $core.withContext(function($ctx1) {
  2471. $recv($globals.Error)._signal_(aString);
  2472. return self;
  2473. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  2474. },
  2475. args: ["aString"],
  2476. source: "error: aString\x0a\x09Error signal: aString",
  2477. referencedClasses: ["Error"],
  2478. messageSends: ["signal:"]
  2479. }),
  2480. $globals.Object);
  2481. $core.addMethod(
  2482. $core.method({
  2483. selector: "halt",
  2484. protocol: 'error handling',
  2485. fn: function (){
  2486. var self=this;
  2487. return $core.withContext(function($ctx1) {
  2488. $recv($globals.Halt)._signal();
  2489. return self;
  2490. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  2491. },
  2492. args: [],
  2493. source: "halt\x0a\x09Halt signal",
  2494. referencedClasses: ["Halt"],
  2495. messageSends: ["signal"]
  2496. }),
  2497. $globals.Object);
  2498. $core.addMethod(
  2499. $core.method({
  2500. selector: "in:",
  2501. protocol: 'evaluating',
  2502. fn: function (aValuable){
  2503. var self=this;
  2504. return $core.withContext(function($ctx1) {
  2505. return $recv(aValuable)._value_(self);
  2506. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  2507. },
  2508. args: ["aValuable"],
  2509. source: "in: aValuable\x0a\x09^ aValuable value: self",
  2510. referencedClasses: [],
  2511. messageSends: ["value:"]
  2512. }),
  2513. $globals.Object);
  2514. $core.addMethod(
  2515. $core.method({
  2516. selector: "isBehavior",
  2517. protocol: 'testing',
  2518. fn: function (){
  2519. var self=this;
  2520. return false;
  2521. },
  2522. args: [],
  2523. source: "isBehavior\x0a\x09^ false",
  2524. referencedClasses: [],
  2525. messageSends: []
  2526. }),
  2527. $globals.Object);
  2528. $core.addMethod(
  2529. $core.method({
  2530. selector: "isBoolean",
  2531. protocol: 'testing',
  2532. fn: function (){
  2533. var self=this;
  2534. return false;
  2535. },
  2536. args: [],
  2537. source: "isBoolean\x0a\x09^ false",
  2538. referencedClasses: [],
  2539. messageSends: []
  2540. }),
  2541. $globals.Object);
  2542. $core.addMethod(
  2543. $core.method({
  2544. selector: "isClass",
  2545. protocol: 'testing',
  2546. fn: function (){
  2547. var self=this;
  2548. return false;
  2549. },
  2550. args: [],
  2551. source: "isClass\x0a\x09^ false",
  2552. referencedClasses: [],
  2553. messageSends: []
  2554. }),
  2555. $globals.Object);
  2556. $core.addMethod(
  2557. $core.method({
  2558. selector: "isCompiledMethod",
  2559. protocol: 'testing',
  2560. fn: function (){
  2561. var self=this;
  2562. return false;
  2563. },
  2564. args: [],
  2565. source: "isCompiledMethod\x0a\x09^ false",
  2566. referencedClasses: [],
  2567. messageSends: []
  2568. }),
  2569. $globals.Object);
  2570. $core.addMethod(
  2571. $core.method({
  2572. selector: "isImmutable",
  2573. protocol: 'testing',
  2574. fn: function (){
  2575. var self=this;
  2576. return false;
  2577. },
  2578. args: [],
  2579. source: "isImmutable\x0a\x09^ false",
  2580. referencedClasses: [],
  2581. messageSends: []
  2582. }),
  2583. $globals.Object);
  2584. $core.addMethod(
  2585. $core.method({
  2586. selector: "isMemberOf:",
  2587. protocol: 'testing',
  2588. fn: function (aClass){
  2589. var self=this;
  2590. return $core.withContext(function($ctx1) {
  2591. return $recv(self._class()).__eq(aClass);
  2592. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  2593. },
  2594. args: ["aClass"],
  2595. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  2596. referencedClasses: [],
  2597. messageSends: ["=", "class"]
  2598. }),
  2599. $globals.Object);
  2600. $core.addMethod(
  2601. $core.method({
  2602. selector: "isMetaclass",
  2603. protocol: 'testing',
  2604. fn: function (){
  2605. var self=this;
  2606. return false;
  2607. },
  2608. args: [],
  2609. source: "isMetaclass\x0a\x09^ false",
  2610. referencedClasses: [],
  2611. messageSends: []
  2612. }),
  2613. $globals.Object);
  2614. $core.addMethod(
  2615. $core.method({
  2616. selector: "isNumber",
  2617. protocol: 'testing',
  2618. fn: function (){
  2619. var self=this;
  2620. return false;
  2621. },
  2622. args: [],
  2623. source: "isNumber\x0a\x09^ false",
  2624. referencedClasses: [],
  2625. messageSends: []
  2626. }),
  2627. $globals.Object);
  2628. $core.addMethod(
  2629. $core.method({
  2630. selector: "isPackage",
  2631. protocol: 'testing',
  2632. fn: function (){
  2633. var self=this;
  2634. return false;
  2635. },
  2636. args: [],
  2637. source: "isPackage\x0a\x09^ false",
  2638. referencedClasses: [],
  2639. messageSends: []
  2640. }),
  2641. $globals.Object);
  2642. $core.addMethod(
  2643. $core.method({
  2644. selector: "isParseFailure",
  2645. protocol: 'testing',
  2646. fn: function (){
  2647. var self=this;
  2648. return false;
  2649. },
  2650. args: [],
  2651. source: "isParseFailure\x0a\x09^ false",
  2652. referencedClasses: [],
  2653. messageSends: []
  2654. }),
  2655. $globals.Object);
  2656. $core.addMethod(
  2657. $core.method({
  2658. selector: "isString",
  2659. protocol: 'testing',
  2660. fn: function (){
  2661. var self=this;
  2662. return false;
  2663. },
  2664. args: [],
  2665. source: "isString\x0a\x09^ false",
  2666. referencedClasses: [],
  2667. messageSends: []
  2668. }),
  2669. $globals.Object);
  2670. $core.addMethod(
  2671. $core.method({
  2672. selector: "isSymbol",
  2673. protocol: 'testing',
  2674. fn: function (){
  2675. var self=this;
  2676. return false;
  2677. },
  2678. args: [],
  2679. source: "isSymbol\x0a\x09^ false",
  2680. referencedClasses: [],
  2681. messageSends: []
  2682. }),
  2683. $globals.Object);
  2684. $core.addMethod(
  2685. $core.method({
  2686. selector: "postCopy",
  2687. protocol: 'copying',
  2688. fn: function (){
  2689. var self=this;
  2690. return self;
  2691. },
  2692. args: [],
  2693. source: "postCopy",
  2694. referencedClasses: [],
  2695. messageSends: []
  2696. }),
  2697. $globals.Object);
  2698. $core.addMethod(
  2699. $core.method({
  2700. selector: "putOn:",
  2701. protocol: 'streaming',
  2702. fn: function (aStream){
  2703. var self=this;
  2704. return $core.withContext(function($ctx1) {
  2705. $recv(aStream)._nextPut_(self);
  2706. return self;
  2707. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  2708. },
  2709. args: ["aStream"],
  2710. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  2711. referencedClasses: [],
  2712. messageSends: ["nextPut:"]
  2713. }),
  2714. $globals.Object);
  2715. $core.addMethod(
  2716. $core.method({
  2717. selector: "respondsTo:",
  2718. protocol: 'testing',
  2719. fn: function (aSelector){
  2720. var self=this;
  2721. return $core.withContext(function($ctx1) {
  2722. return $recv(self._class())._canUnderstand_(aSelector);
  2723. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  2724. },
  2725. args: ["aSelector"],
  2726. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  2727. referencedClasses: [],
  2728. messageSends: ["canUnderstand:", "class"]
  2729. }),
  2730. $globals.Object);
  2731. $core.addMethod(
  2732. $core.method({
  2733. selector: "shallowCopy",
  2734. protocol: 'copying',
  2735. fn: function (){
  2736. var self=this;
  2737. return $core.withContext(function($ctx1) {
  2738. var copy = self.klass._new();
  2739. Object.keys(self).forEach(function(i) {
  2740. if(/^@.+/.test(i)) {
  2741. copy[i] = self[i];
  2742. }
  2743. });
  2744. return copy;
  2745. ;
  2746. return self;
  2747. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  2748. },
  2749. args: [],
  2750. source: "shallowCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  2751. referencedClasses: [],
  2752. messageSends: []
  2753. }),
  2754. $globals.Object);
  2755. $core.addMethod(
  2756. $core.method({
  2757. selector: "shouldNotImplement",
  2758. protocol: 'error handling',
  2759. fn: function (){
  2760. var self=this;
  2761. return $core.withContext(function($ctx1) {
  2762. self._error_("This method should not be implemented in ".__comma($recv(self._class())._name()));
  2763. return self;
  2764. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  2765. },
  2766. args: [],
  2767. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  2768. referencedClasses: [],
  2769. messageSends: ["error:", ",", "name", "class"]
  2770. }),
  2771. $globals.Object);
  2772. $core.addMethod(
  2773. $core.method({
  2774. selector: "size",
  2775. protocol: 'accessing',
  2776. fn: function (){
  2777. var self=this;
  2778. return $core.withContext(function($ctx1) {
  2779. self._error_("Object not indexable");
  2780. return self;
  2781. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  2782. },
  2783. args: [],
  2784. source: "size\x0a\x09self error: 'Object not indexable'",
  2785. referencedClasses: [],
  2786. messageSends: ["error:"]
  2787. }),
  2788. $globals.Object);
  2789. $core.addMethod(
  2790. $core.method({
  2791. selector: "subclassResponsibility",
  2792. protocol: 'error handling',
  2793. fn: function (){
  2794. var self=this;
  2795. return $core.withContext(function($ctx1) {
  2796. self._error_("This method is a responsibility of a subclass");
  2797. return self;
  2798. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  2799. },
  2800. args: [],
  2801. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  2802. referencedClasses: [],
  2803. messageSends: ["error:"]
  2804. }),
  2805. $globals.Object);
  2806. $core.addMethod(
  2807. $core.method({
  2808. selector: "value",
  2809. protocol: 'evaluating',
  2810. fn: function (){
  2811. var self=this;
  2812. return $core.withContext(function($ctx1) {
  2813. return self.valueOf();
  2814. return self;
  2815. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  2816. },
  2817. args: [],
  2818. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  2819. referencedClasses: [],
  2820. messageSends: []
  2821. }),
  2822. $globals.Object);
  2823. $core.addMethod(
  2824. $core.method({
  2825. selector: "accessorProtocolWith:",
  2826. protocol: 'helios',
  2827. fn: function (aGenerator){
  2828. var self=this;
  2829. return $core.withContext(function($ctx1) {
  2830. $recv(aGenerator)._accessorProtocolForObject();
  2831. return self;
  2832. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2833. },
  2834. args: ["aGenerator"],
  2835. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  2836. referencedClasses: [],
  2837. messageSends: ["accessorProtocolForObject"]
  2838. }),
  2839. $globals.Object.klass);
  2840. $core.addMethod(
  2841. $core.method({
  2842. selector: "accessorsSourceCodesWith:",
  2843. protocol: 'helios',
  2844. fn: function (aGenerator){
  2845. var self=this;
  2846. return $core.withContext(function($ctx1) {
  2847. $recv(aGenerator)._accessorsForObject();
  2848. return self;
  2849. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2850. },
  2851. args: ["aGenerator"],
  2852. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  2853. referencedClasses: [],
  2854. messageSends: ["accessorsForObject"]
  2855. }),
  2856. $globals.Object.klass);
  2857. $core.addMethod(
  2858. $core.method({
  2859. selector: "initialize",
  2860. protocol: 'initialization',
  2861. fn: function (){
  2862. var self=this;
  2863. return self;
  2864. },
  2865. args: [],
  2866. source: "initialize\x0a\x09\x22no op\x22",
  2867. referencedClasses: [],
  2868. messageSends: []
  2869. }),
  2870. $globals.Object.klass);
  2871. $core.addMethod(
  2872. $core.method({
  2873. selector: "initializeProtocolWith:",
  2874. protocol: 'helios',
  2875. fn: function (aGenerator){
  2876. var self=this;
  2877. return $core.withContext(function($ctx1) {
  2878. $recv(aGenerator)._initializeProtocolForObject();
  2879. return self;
  2880. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2881. },
  2882. args: ["aGenerator"],
  2883. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  2884. referencedClasses: [],
  2885. messageSends: ["initializeProtocolForObject"]
  2886. }),
  2887. $globals.Object.klass);
  2888. $core.addMethod(
  2889. $core.method({
  2890. selector: "initializeSourceCodesWith:",
  2891. protocol: 'helios',
  2892. fn: function (aGenerator){
  2893. var self=this;
  2894. return $core.withContext(function($ctx1) {
  2895. $recv(aGenerator)._initializeForObject();
  2896. return self;
  2897. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2898. },
  2899. args: ["aGenerator"],
  2900. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  2901. referencedClasses: [],
  2902. messageSends: ["initializeForObject"]
  2903. }),
  2904. $globals.Object.klass);
  2905. $core.addClass('Boolean', $globals.Object, [], 'Kernel-Objects');
  2906. $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: [ ... ]";
  2907. $core.addMethod(
  2908. $core.method({
  2909. selector: "&",
  2910. protocol: 'controlling',
  2911. fn: function (aBoolean){
  2912. var self=this;
  2913. return $core.withContext(function($ctx1) {
  2914. if(self == true) {
  2915. return aBoolean;
  2916. } else {
  2917. return false;
  2918. }
  2919. ;
  2920. return self;
  2921. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  2922. },
  2923. args: ["aBoolean"],
  2924. 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'>",
  2925. referencedClasses: [],
  2926. messageSends: []
  2927. }),
  2928. $globals.Boolean);
  2929. $core.addMethod(
  2930. $core.method({
  2931. selector: "==",
  2932. protocol: 'comparing',
  2933. fn: function (aBoolean){
  2934. var self=this;
  2935. return $core.withContext(function($ctx1) {
  2936. if (typeof aBoolean === "boolean") return self.valueOf() === aBoolean;
  2937. else if (aBoolean != null && typeof aBoolean === "object") return self.valueOf() === aBoolean.valueOf();
  2938. else return false;;
  2939. return self;
  2940. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  2941. },
  2942. args: ["aBoolean"],
  2943. source: "== aBoolean\x0a<inlineJS: '\x0a\x09if (typeof aBoolean === \x22boolean\x22) return self.valueOf() === aBoolean;\x0a\x09else if (aBoolean != null && typeof aBoolean === \x22object\x22) return self.valueOf() === aBoolean.valueOf();\x0a\x09else return false;\x0a'>",
  2944. referencedClasses: [],
  2945. messageSends: []
  2946. }),
  2947. $globals.Boolean);
  2948. $core.addMethod(
  2949. $core.method({
  2950. selector: "and:",
  2951. protocol: 'controlling',
  2952. fn: function (aBlock){
  2953. var self=this;
  2954. return $core.withContext(function($ctx1) {
  2955. if($core.assert(self)){
  2956. return $recv(aBlock)._value();
  2957. } else {
  2958. return false;
  2959. };
  2960. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  2961. },
  2962. args: ["aBlock"],
  2963. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  2964. referencedClasses: [],
  2965. messageSends: ["ifTrue:ifFalse:", "value"]
  2966. }),
  2967. $globals.Boolean);
  2968. $core.addMethod(
  2969. $core.method({
  2970. selector: "asBit",
  2971. protocol: 'converting',
  2972. fn: function (){
  2973. var self=this;
  2974. return $core.withContext(function($ctx1) {
  2975. if($core.assert(self)){
  2976. return (1);
  2977. } else {
  2978. return (0);
  2979. };
  2980. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  2981. },
  2982. args: [],
  2983. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  2984. referencedClasses: [],
  2985. messageSends: ["ifTrue:ifFalse:"]
  2986. }),
  2987. $globals.Boolean);
  2988. $core.addMethod(
  2989. $core.method({
  2990. selector: "asJSON",
  2991. protocol: 'converting',
  2992. fn: function (){
  2993. var self=this;
  2994. return self;
  2995. },
  2996. args: [],
  2997. source: "asJSON\x0a\x09^ self",
  2998. referencedClasses: [],
  2999. messageSends: []
  3000. }),
  3001. $globals.Boolean);
  3002. $core.addMethod(
  3003. $core.method({
  3004. selector: "asString",
  3005. protocol: 'converting',
  3006. fn: function (){
  3007. var self=this;
  3008. return $core.withContext(function($ctx1) {
  3009. return self.toString();
  3010. return self;
  3011. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3012. },
  3013. args: [],
  3014. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3015. referencedClasses: [],
  3016. messageSends: []
  3017. }),
  3018. $globals.Boolean);
  3019. $core.addMethod(
  3020. $core.method({
  3021. selector: "deepCopy",
  3022. protocol: 'copying',
  3023. fn: function (){
  3024. var self=this;
  3025. return self;
  3026. },
  3027. args: [],
  3028. source: "deepCopy\x0a\x09^ self",
  3029. referencedClasses: [],
  3030. messageSends: []
  3031. }),
  3032. $globals.Boolean);
  3033. $core.addMethod(
  3034. $core.method({
  3035. selector: "ifFalse:",
  3036. protocol: 'controlling',
  3037. fn: function (aBlock){
  3038. var self=this;
  3039. return $core.withContext(function($ctx1) {
  3040. return self._ifTrue_ifFalse_((function(){
  3041. }),aBlock);
  3042. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3043. },
  3044. args: ["aBlock"],
  3045. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3046. referencedClasses: [],
  3047. messageSends: ["ifTrue:ifFalse:"]
  3048. }),
  3049. $globals.Boolean);
  3050. $core.addMethod(
  3051. $core.method({
  3052. selector: "ifFalse:ifTrue:",
  3053. protocol: 'controlling',
  3054. fn: function (aBlock,anotherBlock){
  3055. var self=this;
  3056. return $core.withContext(function($ctx1) {
  3057. return self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3058. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3059. },
  3060. args: ["aBlock", "anotherBlock"],
  3061. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3062. referencedClasses: [],
  3063. messageSends: ["ifTrue:ifFalse:"]
  3064. }),
  3065. $globals.Boolean);
  3066. $core.addMethod(
  3067. $core.method({
  3068. selector: "ifTrue:",
  3069. protocol: 'controlling',
  3070. fn: function (aBlock){
  3071. var self=this;
  3072. return $core.withContext(function($ctx1) {
  3073. return self._ifTrue_ifFalse_(aBlock,(function(){
  3074. }));
  3075. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3076. },
  3077. args: ["aBlock"],
  3078. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3079. referencedClasses: [],
  3080. messageSends: ["ifTrue:ifFalse:"]
  3081. }),
  3082. $globals.Boolean);
  3083. $core.addMethod(
  3084. $core.method({
  3085. selector: "ifTrue:ifFalse:",
  3086. protocol: 'controlling',
  3087. fn: function (aBlock,anotherBlock){
  3088. var self=this;
  3089. return $core.withContext(function($ctx1) {
  3090. if(self == true) {
  3091. return aBlock._value();
  3092. } else {
  3093. return anotherBlock._value();
  3094. }
  3095. ;
  3096. return self;
  3097. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3098. },
  3099. args: ["aBlock", "anotherBlock"],
  3100. 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'>",
  3101. referencedClasses: [],
  3102. messageSends: []
  3103. }),
  3104. $globals.Boolean);
  3105. $core.addMethod(
  3106. $core.method({
  3107. selector: "isBoolean",
  3108. protocol: 'testing',
  3109. fn: function (){
  3110. var self=this;
  3111. return true;
  3112. },
  3113. args: [],
  3114. source: "isBoolean\x0a\x09^ true",
  3115. referencedClasses: [],
  3116. messageSends: []
  3117. }),
  3118. $globals.Boolean);
  3119. $core.addMethod(
  3120. $core.method({
  3121. selector: "isImmutable",
  3122. protocol: 'testing',
  3123. fn: function (){
  3124. var self=this;
  3125. return true;
  3126. },
  3127. args: [],
  3128. source: "isImmutable\x0a\x09^ true",
  3129. referencedClasses: [],
  3130. messageSends: []
  3131. }),
  3132. $globals.Boolean);
  3133. $core.addMethod(
  3134. $core.method({
  3135. selector: "not",
  3136. protocol: 'controlling',
  3137. fn: function (){
  3138. var self=this;
  3139. return $core.withContext(function($ctx1) {
  3140. return self.__eq(false);
  3141. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  3142. },
  3143. args: [],
  3144. source: "not\x0a\x09^ self = false",
  3145. referencedClasses: [],
  3146. messageSends: ["="]
  3147. }),
  3148. $globals.Boolean);
  3149. $core.addMethod(
  3150. $core.method({
  3151. selector: "or:",
  3152. protocol: 'controlling',
  3153. fn: function (aBlock){
  3154. var self=this;
  3155. return $core.withContext(function($ctx1) {
  3156. if($core.assert(self)){
  3157. return true;
  3158. } else {
  3159. return $recv(aBlock)._value();
  3160. };
  3161. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  3162. },
  3163. args: ["aBlock"],
  3164. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  3165. referencedClasses: [],
  3166. messageSends: ["ifTrue:ifFalse:", "value"]
  3167. }),
  3168. $globals.Boolean);
  3169. $core.addMethod(
  3170. $core.method({
  3171. selector: "printOn:",
  3172. protocol: 'printing',
  3173. fn: function (aStream){
  3174. var self=this;
  3175. return $core.withContext(function($ctx1) {
  3176. $recv(aStream)._nextPutAll_(self._asString());
  3177. return self;
  3178. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  3179. },
  3180. args: ["aStream"],
  3181. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3182. referencedClasses: [],
  3183. messageSends: ["nextPutAll:", "asString"]
  3184. }),
  3185. $globals.Boolean);
  3186. $core.addMethod(
  3187. $core.method({
  3188. selector: "shallowCopy",
  3189. protocol: 'copying',
  3190. fn: function (){
  3191. var self=this;
  3192. return self;
  3193. },
  3194. args: [],
  3195. source: "shallowCopy\x0a\x09^ self",
  3196. referencedClasses: [],
  3197. messageSends: []
  3198. }),
  3199. $globals.Boolean);
  3200. $core.addMethod(
  3201. $core.method({
  3202. selector: "|",
  3203. protocol: 'controlling',
  3204. fn: function (aBoolean){
  3205. var self=this;
  3206. return $core.withContext(function($ctx1) {
  3207. if(self == true) {
  3208. return true;
  3209. } else {
  3210. return aBoolean;
  3211. }
  3212. ;
  3213. return self;
  3214. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  3215. },
  3216. args: ["aBoolean"],
  3217. 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'>",
  3218. referencedClasses: [],
  3219. messageSends: []
  3220. }),
  3221. $globals.Boolean);
  3222. $core.addClass('Date', $globals.Object, [], 'Kernel-Objects');
  3223. $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.).";
  3224. $core.addMethod(
  3225. $core.method({
  3226. selector: "+",
  3227. protocol: 'arithmetic',
  3228. fn: function (aDate){
  3229. var self=this;
  3230. return $core.withContext(function($ctx1) {
  3231. return self + aDate;
  3232. return self;
  3233. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  3234. },
  3235. args: ["aDate"],
  3236. source: "+ aDate\x0a\x09<inlineJS: 'return self + aDate'>",
  3237. referencedClasses: [],
  3238. messageSends: []
  3239. }),
  3240. $globals.Date);
  3241. $core.addMethod(
  3242. $core.method({
  3243. selector: "-",
  3244. protocol: 'arithmetic',
  3245. fn: function (aDate){
  3246. var self=this;
  3247. return $core.withContext(function($ctx1) {
  3248. return self - aDate;
  3249. return self;
  3250. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  3251. },
  3252. args: ["aDate"],
  3253. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  3254. referencedClasses: [],
  3255. messageSends: []
  3256. }),
  3257. $globals.Date);
  3258. $core.addMethod(
  3259. $core.method({
  3260. selector: "<",
  3261. protocol: 'comparing',
  3262. fn: function (aDate){
  3263. var self=this;
  3264. return $core.withContext(function($ctx1) {
  3265. return self < aDate;
  3266. return self;
  3267. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  3268. },
  3269. args: ["aDate"],
  3270. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  3271. referencedClasses: [],
  3272. messageSends: []
  3273. }),
  3274. $globals.Date);
  3275. $core.addMethod(
  3276. $core.method({
  3277. selector: "<=",
  3278. protocol: 'comparing',
  3279. fn: function (aDate){
  3280. var self=this;
  3281. return $core.withContext(function($ctx1) {
  3282. return self <= aDate;
  3283. return self;
  3284. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  3285. },
  3286. args: ["aDate"],
  3287. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  3288. referencedClasses: [],
  3289. messageSends: []
  3290. }),
  3291. $globals.Date);
  3292. $core.addMethod(
  3293. $core.method({
  3294. selector: "=",
  3295. protocol: 'comparing',
  3296. fn: function (aDate){
  3297. var self=this;
  3298. return $core.withContext(function($ctx1) {
  3299. var $2,$1,$3;
  3300. $2=$recv(aDate)._class();
  3301. $ctx1.sendIdx["class"]=1;
  3302. $1=$recv($2).__eq_eq(self._class());
  3303. $ctx1.sendIdx["=="]=1;
  3304. return $recv($1)._and_((function(){
  3305. return $core.withContext(function($ctx2) {
  3306. $3=self._asMilliseconds();
  3307. $ctx2.sendIdx["asMilliseconds"]=1;
  3308. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  3309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3310. }));
  3311. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  3312. },
  3313. args: ["aDate"],
  3314. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  3315. referencedClasses: [],
  3316. messageSends: ["and:", "==", "class", "asMilliseconds"]
  3317. }),
  3318. $globals.Date);
  3319. $core.addMethod(
  3320. $core.method({
  3321. selector: ">",
  3322. protocol: 'comparing',
  3323. fn: function (aDate){
  3324. var self=this;
  3325. return $core.withContext(function($ctx1) {
  3326. return self > aDate;
  3327. return self;
  3328. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  3329. },
  3330. args: ["aDate"],
  3331. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  3332. referencedClasses: [],
  3333. messageSends: []
  3334. }),
  3335. $globals.Date);
  3336. $core.addMethod(
  3337. $core.method({
  3338. selector: ">=",
  3339. protocol: 'comparing',
  3340. fn: function (aDate){
  3341. var self=this;
  3342. return $core.withContext(function($ctx1) {
  3343. return self >= aDate;
  3344. return self;
  3345. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  3346. },
  3347. args: ["aDate"],
  3348. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  3349. referencedClasses: [],
  3350. messageSends: []
  3351. }),
  3352. $globals.Date);
  3353. $core.addMethod(
  3354. $core.method({
  3355. selector: "asDateString",
  3356. protocol: 'converting',
  3357. fn: function (){
  3358. var self=this;
  3359. return $core.withContext(function($ctx1) {
  3360. return self.toDateString();
  3361. return self;
  3362. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  3363. },
  3364. args: [],
  3365. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  3366. referencedClasses: [],
  3367. messageSends: []
  3368. }),
  3369. $globals.Date);
  3370. $core.addMethod(
  3371. $core.method({
  3372. selector: "asLocaleString",
  3373. protocol: 'converting',
  3374. fn: function (){
  3375. var self=this;
  3376. return $core.withContext(function($ctx1) {
  3377. return self.toLocaleString();
  3378. return self;
  3379. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  3380. },
  3381. args: [],
  3382. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  3383. referencedClasses: [],
  3384. messageSends: []
  3385. }),
  3386. $globals.Date);
  3387. $core.addMethod(
  3388. $core.method({
  3389. selector: "asMilliseconds",
  3390. protocol: 'converting',
  3391. fn: function (){
  3392. var self=this;
  3393. return $core.withContext(function($ctx1) {
  3394. return self._time();
  3395. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  3396. },
  3397. args: [],
  3398. source: "asMilliseconds\x0a\x09^ self time",
  3399. referencedClasses: [],
  3400. messageSends: ["time"]
  3401. }),
  3402. $globals.Date);
  3403. $core.addMethod(
  3404. $core.method({
  3405. selector: "asNumber",
  3406. protocol: 'converting',
  3407. fn: function (){
  3408. var self=this;
  3409. return $core.withContext(function($ctx1) {
  3410. return self._asMilliseconds();
  3411. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  3412. },
  3413. args: [],
  3414. source: "asNumber\x0a\x09^ self asMilliseconds",
  3415. referencedClasses: [],
  3416. messageSends: ["asMilliseconds"]
  3417. }),
  3418. $globals.Date);
  3419. $core.addMethod(
  3420. $core.method({
  3421. selector: "asString",
  3422. protocol: 'converting',
  3423. fn: function (){
  3424. var self=this;
  3425. return $core.withContext(function($ctx1) {
  3426. return self.toString();
  3427. return self;
  3428. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  3429. },
  3430. args: [],
  3431. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3432. referencedClasses: [],
  3433. messageSends: []
  3434. }),
  3435. $globals.Date);
  3436. $core.addMethod(
  3437. $core.method({
  3438. selector: "asTimeString",
  3439. protocol: 'converting',
  3440. fn: function (){
  3441. var self=this;
  3442. return $core.withContext(function($ctx1) {
  3443. return self.toTimeString();
  3444. return self;
  3445. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  3446. },
  3447. args: [],
  3448. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  3449. referencedClasses: [],
  3450. messageSends: []
  3451. }),
  3452. $globals.Date);
  3453. $core.addMethod(
  3454. $core.method({
  3455. selector: "day",
  3456. protocol: 'accessing',
  3457. fn: function (){
  3458. var self=this;
  3459. return $core.withContext(function($ctx1) {
  3460. return self._dayOfWeek();
  3461. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  3462. },
  3463. args: [],
  3464. source: "day\x0a\x09^ self dayOfWeek",
  3465. referencedClasses: [],
  3466. messageSends: ["dayOfWeek"]
  3467. }),
  3468. $globals.Date);
  3469. $core.addMethod(
  3470. $core.method({
  3471. selector: "day:",
  3472. protocol: 'accessing',
  3473. fn: function (aNumber){
  3474. var self=this;
  3475. return $core.withContext(function($ctx1) {
  3476. self._dayOfWeek_(aNumber);
  3477. return self;
  3478. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  3479. },
  3480. args: ["aNumber"],
  3481. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  3482. referencedClasses: [],
  3483. messageSends: ["dayOfWeek:"]
  3484. }),
  3485. $globals.Date);
  3486. $core.addMethod(
  3487. $core.method({
  3488. selector: "dayOfMonth",
  3489. protocol: 'accessing',
  3490. fn: function (){
  3491. var self=this;
  3492. return $core.withContext(function($ctx1) {
  3493. return self.getDate();
  3494. return self;
  3495. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  3496. },
  3497. args: [],
  3498. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  3499. referencedClasses: [],
  3500. messageSends: []
  3501. }),
  3502. $globals.Date);
  3503. $core.addMethod(
  3504. $core.method({
  3505. selector: "dayOfMonth:",
  3506. protocol: 'accessing',
  3507. fn: function (aNumber){
  3508. var self=this;
  3509. return $core.withContext(function($ctx1) {
  3510. self.setDate(aNumber);
  3511. return self;
  3512. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  3513. },
  3514. args: ["aNumber"],
  3515. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  3516. referencedClasses: [],
  3517. messageSends: []
  3518. }),
  3519. $globals.Date);
  3520. $core.addMethod(
  3521. $core.method({
  3522. selector: "dayOfWeek",
  3523. protocol: 'accessing',
  3524. fn: function (){
  3525. var self=this;
  3526. return $core.withContext(function($ctx1) {
  3527. return self.getDay() + 1;
  3528. return self;
  3529. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  3530. },
  3531. args: [],
  3532. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  3533. referencedClasses: [],
  3534. messageSends: []
  3535. }),
  3536. $globals.Date);
  3537. $core.addMethod(
  3538. $core.method({
  3539. selector: "dayOfWeek:",
  3540. protocol: 'accessing',
  3541. fn: function (aNumber){
  3542. var self=this;
  3543. return $core.withContext(function($ctx1) {
  3544. return self.setDay(aNumber - 1);
  3545. return self;
  3546. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  3547. },
  3548. args: ["aNumber"],
  3549. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  3550. referencedClasses: [],
  3551. messageSends: []
  3552. }),
  3553. $globals.Date);
  3554. $core.addMethod(
  3555. $core.method({
  3556. selector: "hours",
  3557. protocol: 'accessing',
  3558. fn: function (){
  3559. var self=this;
  3560. return $core.withContext(function($ctx1) {
  3561. return self.getHours();
  3562. return self;
  3563. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  3564. },
  3565. args: [],
  3566. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  3567. referencedClasses: [],
  3568. messageSends: []
  3569. }),
  3570. $globals.Date);
  3571. $core.addMethod(
  3572. $core.method({
  3573. selector: "hours:",
  3574. protocol: 'accessing',
  3575. fn: function (aNumber){
  3576. var self=this;
  3577. return $core.withContext(function($ctx1) {
  3578. self.setHours(aNumber);
  3579. return self;
  3580. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  3581. },
  3582. args: ["aNumber"],
  3583. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  3584. referencedClasses: [],
  3585. messageSends: []
  3586. }),
  3587. $globals.Date);
  3588. $core.addMethod(
  3589. $core.method({
  3590. selector: "milliseconds",
  3591. protocol: 'accessing',
  3592. fn: function (){
  3593. var self=this;
  3594. return $core.withContext(function($ctx1) {
  3595. return self.getMilliseconds();
  3596. return self;
  3597. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  3598. },
  3599. args: [],
  3600. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  3601. referencedClasses: [],
  3602. messageSends: []
  3603. }),
  3604. $globals.Date);
  3605. $core.addMethod(
  3606. $core.method({
  3607. selector: "milliseconds:",
  3608. protocol: 'accessing',
  3609. fn: function (aNumber){
  3610. var self=this;
  3611. return $core.withContext(function($ctx1) {
  3612. self.setMilliseconds(aNumber);
  3613. return self;
  3614. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  3615. },
  3616. args: ["aNumber"],
  3617. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  3618. referencedClasses: [],
  3619. messageSends: []
  3620. }),
  3621. $globals.Date);
  3622. $core.addMethod(
  3623. $core.method({
  3624. selector: "minutes",
  3625. protocol: 'accessing',
  3626. fn: function (){
  3627. var self=this;
  3628. return $core.withContext(function($ctx1) {
  3629. return self.getMinutes();
  3630. return self;
  3631. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  3632. },
  3633. args: [],
  3634. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  3635. referencedClasses: [],
  3636. messageSends: []
  3637. }),
  3638. $globals.Date);
  3639. $core.addMethod(
  3640. $core.method({
  3641. selector: "minutes:",
  3642. protocol: 'accessing',
  3643. fn: function (aNumber){
  3644. var self=this;
  3645. return $core.withContext(function($ctx1) {
  3646. self.setMinutes(aNumber);
  3647. return self;
  3648. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  3649. },
  3650. args: ["aNumber"],
  3651. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  3652. referencedClasses: [],
  3653. messageSends: []
  3654. }),
  3655. $globals.Date);
  3656. $core.addMethod(
  3657. $core.method({
  3658. selector: "month",
  3659. protocol: 'accessing',
  3660. fn: function (){
  3661. var self=this;
  3662. return $core.withContext(function($ctx1) {
  3663. return self.getMonth() + 1;
  3664. return self;
  3665. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  3666. },
  3667. args: [],
  3668. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  3669. referencedClasses: [],
  3670. messageSends: []
  3671. }),
  3672. $globals.Date);
  3673. $core.addMethod(
  3674. $core.method({
  3675. selector: "month:",
  3676. protocol: 'accessing',
  3677. fn: function (aNumber){
  3678. var self=this;
  3679. return $core.withContext(function($ctx1) {
  3680. self.setMonth(aNumber - 1);
  3681. return self;
  3682. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  3683. },
  3684. args: ["aNumber"],
  3685. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  3686. referencedClasses: [],
  3687. messageSends: []
  3688. }),
  3689. $globals.Date);
  3690. $core.addMethod(
  3691. $core.method({
  3692. selector: "printOn:",
  3693. protocol: 'printing',
  3694. fn: function (aStream){
  3695. var self=this;
  3696. return $core.withContext(function($ctx1) {
  3697. $recv(aStream)._nextPutAll_(self._asString());
  3698. return self;
  3699. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  3700. },
  3701. args: ["aStream"],
  3702. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3703. referencedClasses: [],
  3704. messageSends: ["nextPutAll:", "asString"]
  3705. }),
  3706. $globals.Date);
  3707. $core.addMethod(
  3708. $core.method({
  3709. selector: "seconds",
  3710. protocol: 'accessing',
  3711. fn: function (){
  3712. var self=this;
  3713. return $core.withContext(function($ctx1) {
  3714. return self.getSeconds();
  3715. return self;
  3716. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  3717. },
  3718. args: [],
  3719. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  3720. referencedClasses: [],
  3721. messageSends: []
  3722. }),
  3723. $globals.Date);
  3724. $core.addMethod(
  3725. $core.method({
  3726. selector: "seconds:",
  3727. protocol: 'accessing',
  3728. fn: function (aNumber){
  3729. var self=this;
  3730. return $core.withContext(function($ctx1) {
  3731. self.setSeconds(aNumber);
  3732. return self;
  3733. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  3734. },
  3735. args: ["aNumber"],
  3736. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  3737. referencedClasses: [],
  3738. messageSends: []
  3739. }),
  3740. $globals.Date);
  3741. $core.addMethod(
  3742. $core.method({
  3743. selector: "time",
  3744. protocol: 'accessing',
  3745. fn: function (){
  3746. var self=this;
  3747. return $core.withContext(function($ctx1) {
  3748. return self.getTime();
  3749. return self;
  3750. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  3751. },
  3752. args: [],
  3753. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  3754. referencedClasses: [],
  3755. messageSends: []
  3756. }),
  3757. $globals.Date);
  3758. $core.addMethod(
  3759. $core.method({
  3760. selector: "time:",
  3761. protocol: 'accessing',
  3762. fn: function (aNumber){
  3763. var self=this;
  3764. return $core.withContext(function($ctx1) {
  3765. self.setTime(aNumber);
  3766. return self;
  3767. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  3768. },
  3769. args: ["aNumber"],
  3770. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  3771. referencedClasses: [],
  3772. messageSends: []
  3773. }),
  3774. $globals.Date);
  3775. $core.addMethod(
  3776. $core.method({
  3777. selector: "year",
  3778. protocol: 'accessing',
  3779. fn: function (){
  3780. var self=this;
  3781. return $core.withContext(function($ctx1) {
  3782. return self.getFullYear();
  3783. return self;
  3784. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  3785. },
  3786. args: [],
  3787. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  3788. referencedClasses: [],
  3789. messageSends: []
  3790. }),
  3791. $globals.Date);
  3792. $core.addMethod(
  3793. $core.method({
  3794. selector: "year:",
  3795. protocol: 'accessing',
  3796. fn: function (aNumber){
  3797. var self=this;
  3798. return $core.withContext(function($ctx1) {
  3799. self.setFullYear(aNumber);
  3800. return self;
  3801. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  3802. },
  3803. args: ["aNumber"],
  3804. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  3805. referencedClasses: [],
  3806. messageSends: []
  3807. }),
  3808. $globals.Date);
  3809. $core.addMethod(
  3810. $core.method({
  3811. selector: "classTag",
  3812. protocol: 'accessing',
  3813. fn: function (){
  3814. var self=this;
  3815. return "magnitude";
  3816. },
  3817. args: [],
  3818. 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'",
  3819. referencedClasses: [],
  3820. messageSends: []
  3821. }),
  3822. $globals.Date.klass);
  3823. $core.addMethod(
  3824. $core.method({
  3825. selector: "fromMilliseconds:",
  3826. protocol: 'instance creation',
  3827. fn: function (aNumber){
  3828. var self=this;
  3829. return $core.withContext(function($ctx1) {
  3830. return self._new_(aNumber);
  3831. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.klass)});
  3832. },
  3833. args: ["aNumber"],
  3834. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  3835. referencedClasses: [],
  3836. messageSends: ["new:"]
  3837. }),
  3838. $globals.Date.klass);
  3839. $core.addMethod(
  3840. $core.method({
  3841. selector: "fromSeconds:",
  3842. protocol: 'instance creation',
  3843. fn: function (aNumber){
  3844. var self=this;
  3845. return $core.withContext(function($ctx1) {
  3846. return self._fromMilliseconds_($recv(aNumber).__star((1000)));
  3847. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.klass)});
  3848. },
  3849. args: ["aNumber"],
  3850. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  3851. referencedClasses: [],
  3852. messageSends: ["fromMilliseconds:", "*"]
  3853. }),
  3854. $globals.Date.klass);
  3855. $core.addMethod(
  3856. $core.method({
  3857. selector: "fromString:",
  3858. protocol: 'instance creation',
  3859. fn: function (aString){
  3860. var self=this;
  3861. return $core.withContext(function($ctx1) {
  3862. return self._new_(aString);
  3863. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.klass)});
  3864. },
  3865. args: ["aString"],
  3866. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  3867. referencedClasses: [],
  3868. messageSends: ["new:"]
  3869. }),
  3870. $globals.Date.klass);
  3871. $core.addMethod(
  3872. $core.method({
  3873. selector: "millisecondsToRun:",
  3874. protocol: 'instance creation',
  3875. fn: function (aBlock){
  3876. var self=this;
  3877. var t;
  3878. return $core.withContext(function($ctx1) {
  3879. t=$recv($globals.Date)._now();
  3880. $ctx1.sendIdx["now"]=1;
  3881. $recv(aBlock)._value();
  3882. return $recv($recv($globals.Date)._now()).__minus(t);
  3883. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.klass)});
  3884. },
  3885. args: ["aBlock"],
  3886. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  3887. referencedClasses: ["Date"],
  3888. messageSends: ["now", "value", "-"]
  3889. }),
  3890. $globals.Date.klass);
  3891. $core.addMethod(
  3892. $core.method({
  3893. selector: "new:",
  3894. protocol: 'instance creation',
  3895. fn: function (anObject){
  3896. var self=this;
  3897. return $core.withContext(function($ctx1) {
  3898. return new Date(anObject);
  3899. return self;
  3900. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.klass)});
  3901. },
  3902. args: ["anObject"],
  3903. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  3904. referencedClasses: [],
  3905. messageSends: []
  3906. }),
  3907. $globals.Date.klass);
  3908. $core.addMethod(
  3909. $core.method({
  3910. selector: "now",
  3911. protocol: 'instance creation',
  3912. fn: function (){
  3913. var self=this;
  3914. return $core.withContext(function($ctx1) {
  3915. return self._today();
  3916. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.klass)});
  3917. },
  3918. args: [],
  3919. source: "now\x0a\x09^ self today",
  3920. referencedClasses: [],
  3921. messageSends: ["today"]
  3922. }),
  3923. $globals.Date.klass);
  3924. $core.addMethod(
  3925. $core.method({
  3926. selector: "today",
  3927. protocol: 'instance creation',
  3928. fn: function (){
  3929. var self=this;
  3930. return $core.withContext(function($ctx1) {
  3931. return self._new();
  3932. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.klass)});
  3933. },
  3934. args: [],
  3935. source: "today\x0a\x09^ self new",
  3936. referencedClasses: [],
  3937. messageSends: ["new"]
  3938. }),
  3939. $globals.Date.klass);
  3940. $core.addClass('Number', $globals.Object, [], 'Kernel-Objects');
  3941. $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 ].";
  3942. $core.addMethod(
  3943. $core.method({
  3944. selector: "&",
  3945. protocol: 'converting',
  3946. fn: function (aNumber){
  3947. var self=this;
  3948. return $core.withContext(function($ctx1) {
  3949. return self & aNumber;
  3950. return self;
  3951. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  3952. },
  3953. args: ["aNumber"],
  3954. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  3955. referencedClasses: [],
  3956. messageSends: []
  3957. }),
  3958. $globals.Number);
  3959. $core.addMethod(
  3960. $core.method({
  3961. selector: "*",
  3962. protocol: 'arithmetic',
  3963. fn: function (aNumber){
  3964. var self=this;
  3965. return $core.withContext(function($ctx1) {
  3966. return self * aNumber;
  3967. return self;
  3968. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  3969. },
  3970. args: ["aNumber"],
  3971. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self * aNumber'>",
  3972. referencedClasses: [],
  3973. messageSends: []
  3974. }),
  3975. $globals.Number);
  3976. $core.addMethod(
  3977. $core.method({
  3978. selector: "**",
  3979. protocol: 'mathematical functions',
  3980. fn: function (exponent){
  3981. var self=this;
  3982. return $core.withContext(function($ctx1) {
  3983. return self._raisedTo_(exponent);
  3984. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  3985. },
  3986. args: ["exponent"],
  3987. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  3988. referencedClasses: [],
  3989. messageSends: ["raisedTo:"]
  3990. }),
  3991. $globals.Number);
  3992. $core.addMethod(
  3993. $core.method({
  3994. selector: "+",
  3995. protocol: 'arithmetic',
  3996. fn: function (aNumber){
  3997. var self=this;
  3998. return $core.withContext(function($ctx1) {
  3999. return self + aNumber;
  4000. return self;
  4001. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4002. },
  4003. args: ["aNumber"],
  4004. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self + aNumber'>",
  4005. referencedClasses: [],
  4006. messageSends: []
  4007. }),
  4008. $globals.Number);
  4009. $core.addMethod(
  4010. $core.method({
  4011. selector: "-",
  4012. protocol: 'arithmetic',
  4013. fn: function (aNumber){
  4014. var self=this;
  4015. return $core.withContext(function($ctx1) {
  4016. return self - aNumber;
  4017. return self;
  4018. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4019. },
  4020. args: ["aNumber"],
  4021. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self - aNumber'>",
  4022. referencedClasses: [],
  4023. messageSends: []
  4024. }),
  4025. $globals.Number);
  4026. $core.addMethod(
  4027. $core.method({
  4028. selector: "/",
  4029. protocol: 'arithmetic',
  4030. fn: function (aNumber){
  4031. var self=this;
  4032. return $core.withContext(function($ctx1) {
  4033. return self / aNumber;
  4034. return self;
  4035. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4036. },
  4037. args: ["aNumber"],
  4038. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self / aNumber'>",
  4039. referencedClasses: [],
  4040. messageSends: []
  4041. }),
  4042. $globals.Number);
  4043. $core.addMethod(
  4044. $core.method({
  4045. selector: "//",
  4046. protocol: 'arithmetic',
  4047. fn: function (aNumber){
  4048. var self=this;
  4049. return $core.withContext(function($ctx1) {
  4050. return $recv(self.__slash(aNumber))._floor();
  4051. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4052. },
  4053. args: ["aNumber"],
  4054. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4055. referencedClasses: [],
  4056. messageSends: ["floor", "/"]
  4057. }),
  4058. $globals.Number);
  4059. $core.addMethod(
  4060. $core.method({
  4061. selector: "<",
  4062. protocol: 'comparing',
  4063. fn: function (aNumber){
  4064. var self=this;
  4065. return $core.withContext(function($ctx1) {
  4066. return self < aNumber;
  4067. return self;
  4068. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4069. },
  4070. args: ["aNumber"],
  4071. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self < aNumber'>",
  4072. referencedClasses: [],
  4073. messageSends: []
  4074. }),
  4075. $globals.Number);
  4076. $core.addMethod(
  4077. $core.method({
  4078. selector: "<=",
  4079. protocol: 'comparing',
  4080. fn: function (aNumber){
  4081. var self=this;
  4082. return $core.withContext(function($ctx1) {
  4083. return self <= aNumber;
  4084. return self;
  4085. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  4086. },
  4087. args: ["aNumber"],
  4088. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self <= aNumber'>",
  4089. referencedClasses: [],
  4090. messageSends: []
  4091. }),
  4092. $globals.Number);
  4093. $core.addMethod(
  4094. $core.method({
  4095. selector: "==",
  4096. protocol: 'comparing',
  4097. fn: function (aNumber){
  4098. var self=this;
  4099. return $core.withContext(function($ctx1) {
  4100. if (typeof aNumber === "number") return Number(self) === aNumber;
  4101. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  4102. else return false;;
  4103. return self;
  4104. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  4105. },
  4106. args: ["aNumber"],
  4107. 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'>",
  4108. referencedClasses: [],
  4109. messageSends: []
  4110. }),
  4111. $globals.Number);
  4112. $core.addMethod(
  4113. $core.method({
  4114. selector: ">",
  4115. protocol: 'comparing',
  4116. fn: function (aNumber){
  4117. var self=this;
  4118. return $core.withContext(function($ctx1) {
  4119. return self > aNumber;
  4120. return self;
  4121. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  4122. },
  4123. args: ["aNumber"],
  4124. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self > aNumber'>",
  4125. referencedClasses: [],
  4126. messageSends: []
  4127. }),
  4128. $globals.Number);
  4129. $core.addMethod(
  4130. $core.method({
  4131. selector: ">=",
  4132. protocol: 'comparing',
  4133. fn: function (aNumber){
  4134. var self=this;
  4135. return $core.withContext(function($ctx1) {
  4136. return self >= aNumber;
  4137. return self;
  4138. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  4139. },
  4140. args: ["aNumber"],
  4141. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self >= aNumber'>",
  4142. referencedClasses: [],
  4143. messageSends: []
  4144. }),
  4145. $globals.Number);
  4146. $core.addMethod(
  4147. $core.method({
  4148. selector: "@",
  4149. protocol: 'converting',
  4150. fn: function (aNumber){
  4151. var self=this;
  4152. return $core.withContext(function($ctx1) {
  4153. return $recv($globals.Point)._x_y_(self,aNumber);
  4154. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  4155. },
  4156. args: ["aNumber"],
  4157. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  4158. referencedClasses: ["Point"],
  4159. messageSends: ["x:y:"]
  4160. }),
  4161. $globals.Number);
  4162. $core.addMethod(
  4163. $core.method({
  4164. selector: "\x5c\x5c",
  4165. protocol: 'arithmetic',
  4166. fn: function (aNumber){
  4167. var self=this;
  4168. return $core.withContext(function($ctx1) {
  4169. return self % aNumber;
  4170. return self;
  4171. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  4172. },
  4173. args: ["aNumber"],
  4174. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  4175. referencedClasses: [],
  4176. messageSends: []
  4177. }),
  4178. $globals.Number);
  4179. $core.addMethod(
  4180. $core.method({
  4181. selector: "abs",
  4182. protocol: 'arithmetic',
  4183. fn: function (){
  4184. var self=this;
  4185. return $core.withContext(function($ctx1) {
  4186. return Math.abs(self);;
  4187. return self;
  4188. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  4189. },
  4190. args: [],
  4191. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  4192. referencedClasses: [],
  4193. messageSends: []
  4194. }),
  4195. $globals.Number);
  4196. $core.addMethod(
  4197. $core.method({
  4198. selector: "arcCos",
  4199. protocol: 'mathematical functions',
  4200. fn: function (){
  4201. var self=this;
  4202. return $core.withContext(function($ctx1) {
  4203. return Math.acos(self);;
  4204. return self;
  4205. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  4206. },
  4207. args: [],
  4208. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  4209. referencedClasses: [],
  4210. messageSends: []
  4211. }),
  4212. $globals.Number);
  4213. $core.addMethod(
  4214. $core.method({
  4215. selector: "arcSin",
  4216. protocol: 'mathematical functions',
  4217. fn: function (){
  4218. var self=this;
  4219. return $core.withContext(function($ctx1) {
  4220. return Math.asin(self);;
  4221. return self;
  4222. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  4223. },
  4224. args: [],
  4225. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  4226. referencedClasses: [],
  4227. messageSends: []
  4228. }),
  4229. $globals.Number);
  4230. $core.addMethod(
  4231. $core.method({
  4232. selector: "arcTan",
  4233. protocol: 'mathematical functions',
  4234. fn: function (){
  4235. var self=this;
  4236. return $core.withContext(function($ctx1) {
  4237. return Math.atan(self);;
  4238. return self;
  4239. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  4240. },
  4241. args: [],
  4242. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  4243. referencedClasses: [],
  4244. messageSends: []
  4245. }),
  4246. $globals.Number);
  4247. $core.addMethod(
  4248. $core.method({
  4249. selector: "asJSON",
  4250. protocol: 'converting',
  4251. fn: function (){
  4252. var self=this;
  4253. return self;
  4254. },
  4255. args: [],
  4256. source: "asJSON\x0a\x09^ self",
  4257. referencedClasses: [],
  4258. messageSends: []
  4259. }),
  4260. $globals.Number);
  4261. $core.addMethod(
  4262. $core.method({
  4263. selector: "asJavascript",
  4264. protocol: 'converting',
  4265. fn: function (){
  4266. var self=this;
  4267. return $core.withContext(function($ctx1) {
  4268. var $1;
  4269. $1=$recv("(".__comma(self._printString())).__comma(")");
  4270. $ctx1.sendIdx[","]=1;
  4271. return $1;
  4272. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Number)});
  4273. },
  4274. args: [],
  4275. source: "asJavascript\x0a\x09^ '(', self printString, ')'",
  4276. referencedClasses: [],
  4277. messageSends: [",", "printString"]
  4278. }),
  4279. $globals.Number);
  4280. $core.addMethod(
  4281. $core.method({
  4282. selector: "asNumber",
  4283. protocol: 'converting',
  4284. fn: function (){
  4285. var self=this;
  4286. return self;
  4287. },
  4288. args: [],
  4289. source: "asNumber\x0a\x09^ self",
  4290. referencedClasses: [],
  4291. messageSends: []
  4292. }),
  4293. $globals.Number);
  4294. $core.addMethod(
  4295. $core.method({
  4296. selector: "asPoint",
  4297. protocol: 'converting',
  4298. fn: function (){
  4299. var self=this;
  4300. return $core.withContext(function($ctx1) {
  4301. return $recv($globals.Point)._x_y_(self,self);
  4302. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  4303. },
  4304. args: [],
  4305. source: "asPoint\x0a\x09^ Point x: self y: self",
  4306. referencedClasses: ["Point"],
  4307. messageSends: ["x:y:"]
  4308. }),
  4309. $globals.Number);
  4310. $core.addMethod(
  4311. $core.method({
  4312. selector: "asString",
  4313. protocol: 'converting',
  4314. fn: function (){
  4315. var self=this;
  4316. return $core.withContext(function($ctx1) {
  4317. return String(self);
  4318. return self;
  4319. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  4320. },
  4321. args: [],
  4322. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  4323. referencedClasses: [],
  4324. messageSends: []
  4325. }),
  4326. $globals.Number);
  4327. $core.addMethod(
  4328. $core.method({
  4329. selector: "atRandom",
  4330. protocol: 'converting',
  4331. fn: function (){
  4332. var self=this;
  4333. return $core.withContext(function($ctx1) {
  4334. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  4335. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  4336. },
  4337. args: [],
  4338. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  4339. referencedClasses: ["Random"],
  4340. messageSends: ["+", "truncated", "*", "next", "new"]
  4341. }),
  4342. $globals.Number);
  4343. $core.addMethod(
  4344. $core.method({
  4345. selector: "ceiling",
  4346. protocol: 'converting',
  4347. fn: function (){
  4348. var self=this;
  4349. return $core.withContext(function($ctx1) {
  4350. return Math.ceil(self);;
  4351. return self;
  4352. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  4353. },
  4354. args: [],
  4355. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  4356. referencedClasses: [],
  4357. messageSends: []
  4358. }),
  4359. $globals.Number);
  4360. $core.addMethod(
  4361. $core.method({
  4362. selector: "copy",
  4363. protocol: 'copying',
  4364. fn: function (){
  4365. var self=this;
  4366. return self;
  4367. },
  4368. args: [],
  4369. source: "copy\x0a\x09^ self",
  4370. referencedClasses: [],
  4371. messageSends: []
  4372. }),
  4373. $globals.Number);
  4374. $core.addMethod(
  4375. $core.method({
  4376. selector: "cos",
  4377. protocol: 'mathematical functions',
  4378. fn: function (){
  4379. var self=this;
  4380. return $core.withContext(function($ctx1) {
  4381. return Math.cos(self);;
  4382. return self;
  4383. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  4384. },
  4385. args: [],
  4386. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  4387. referencedClasses: [],
  4388. messageSends: []
  4389. }),
  4390. $globals.Number);
  4391. $core.addMethod(
  4392. $core.method({
  4393. selector: "deepCopy",
  4394. protocol: 'copying',
  4395. fn: function (){
  4396. var self=this;
  4397. return $core.withContext(function($ctx1) {
  4398. return self._copy();
  4399. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  4400. },
  4401. args: [],
  4402. source: "deepCopy\x0a\x09^ self copy",
  4403. referencedClasses: [],
  4404. messageSends: ["copy"]
  4405. }),
  4406. $globals.Number);
  4407. $core.addMethod(
  4408. $core.method({
  4409. selector: "even",
  4410. protocol: 'testing',
  4411. fn: function (){
  4412. var self=this;
  4413. return $core.withContext(function($ctx1) {
  4414. return (0).__eq(self.__backslash_backslash((2)));
  4415. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  4416. },
  4417. args: [],
  4418. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  4419. referencedClasses: [],
  4420. messageSends: ["=", "\x5c\x5c"]
  4421. }),
  4422. $globals.Number);
  4423. $core.addMethod(
  4424. $core.method({
  4425. selector: "floor",
  4426. protocol: 'converting',
  4427. fn: function (){
  4428. var self=this;
  4429. return $core.withContext(function($ctx1) {
  4430. return Math.floor(self);;
  4431. return self;
  4432. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  4433. },
  4434. args: [],
  4435. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  4436. referencedClasses: [],
  4437. messageSends: []
  4438. }),
  4439. $globals.Number);
  4440. $core.addMethod(
  4441. $core.method({
  4442. selector: "isImmutable",
  4443. protocol: 'testing',
  4444. fn: function (){
  4445. var self=this;
  4446. return true;
  4447. },
  4448. args: [],
  4449. source: "isImmutable\x0a\x09^ true",
  4450. referencedClasses: [],
  4451. messageSends: []
  4452. }),
  4453. $globals.Number);
  4454. $core.addMethod(
  4455. $core.method({
  4456. selector: "isNumber",
  4457. protocol: 'testing',
  4458. fn: function (){
  4459. var self=this;
  4460. return true;
  4461. },
  4462. args: [],
  4463. source: "isNumber\x0a\x09^ true",
  4464. referencedClasses: [],
  4465. messageSends: []
  4466. }),
  4467. $globals.Number);
  4468. $core.addMethod(
  4469. $core.method({
  4470. selector: "isZero",
  4471. protocol: 'testing',
  4472. fn: function (){
  4473. var self=this;
  4474. return $core.withContext(function($ctx1) {
  4475. return self.__eq((0));
  4476. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  4477. },
  4478. args: [],
  4479. source: "isZero\x0a\x09^ self = 0",
  4480. referencedClasses: [],
  4481. messageSends: ["="]
  4482. }),
  4483. $globals.Number);
  4484. $core.addMethod(
  4485. $core.method({
  4486. selector: "ln",
  4487. protocol: 'mathematical functions',
  4488. fn: function (){
  4489. var self=this;
  4490. return $core.withContext(function($ctx1) {
  4491. return Math.log(self);;
  4492. return self;
  4493. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  4494. },
  4495. args: [],
  4496. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  4497. referencedClasses: [],
  4498. messageSends: []
  4499. }),
  4500. $globals.Number);
  4501. $core.addMethod(
  4502. $core.method({
  4503. selector: "log",
  4504. protocol: 'mathematical functions',
  4505. fn: function (){
  4506. var self=this;
  4507. return $core.withContext(function($ctx1) {
  4508. return Math.log(self) / Math.LN10;;
  4509. return self;
  4510. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  4511. },
  4512. args: [],
  4513. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  4514. referencedClasses: [],
  4515. messageSends: []
  4516. }),
  4517. $globals.Number);
  4518. $core.addMethod(
  4519. $core.method({
  4520. selector: "log:",
  4521. protocol: 'mathematical functions',
  4522. fn: function (aNumber){
  4523. var self=this;
  4524. return $core.withContext(function($ctx1) {
  4525. return Math.log(self) / Math.log(aNumber);;
  4526. return self;
  4527. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  4528. },
  4529. args: ["aNumber"],
  4530. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  4531. referencedClasses: [],
  4532. messageSends: []
  4533. }),
  4534. $globals.Number);
  4535. $core.addMethod(
  4536. $core.method({
  4537. selector: "max:",
  4538. protocol: 'arithmetic',
  4539. fn: function (aNumber){
  4540. var self=this;
  4541. return $core.withContext(function($ctx1) {
  4542. return Math.max(self, aNumber);;
  4543. return self;
  4544. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  4545. },
  4546. args: ["aNumber"],
  4547. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  4548. referencedClasses: [],
  4549. messageSends: []
  4550. }),
  4551. $globals.Number);
  4552. $core.addMethod(
  4553. $core.method({
  4554. selector: "min:",
  4555. protocol: 'arithmetic',
  4556. fn: function (aNumber){
  4557. var self=this;
  4558. return $core.withContext(function($ctx1) {
  4559. return Math.min(self, aNumber);;
  4560. return self;
  4561. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  4562. },
  4563. args: ["aNumber"],
  4564. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  4565. referencedClasses: [],
  4566. messageSends: []
  4567. }),
  4568. $globals.Number);
  4569. $core.addMethod(
  4570. $core.method({
  4571. selector: "negated",
  4572. protocol: 'arithmetic',
  4573. fn: function (){
  4574. var self=this;
  4575. return $core.withContext(function($ctx1) {
  4576. return (0).__minus(self);
  4577. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  4578. },
  4579. args: [],
  4580. source: "negated\x0a\x09^ 0 - self",
  4581. referencedClasses: [],
  4582. messageSends: ["-"]
  4583. }),
  4584. $globals.Number);
  4585. $core.addMethod(
  4586. $core.method({
  4587. selector: "negative",
  4588. protocol: 'testing',
  4589. fn: function (){
  4590. var self=this;
  4591. return $core.withContext(function($ctx1) {
  4592. return self.__lt((0));
  4593. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  4594. },
  4595. args: [],
  4596. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  4597. referencedClasses: [],
  4598. messageSends: ["<"]
  4599. }),
  4600. $globals.Number);
  4601. $core.addMethod(
  4602. $core.method({
  4603. selector: "odd",
  4604. protocol: 'testing',
  4605. fn: function (){
  4606. var self=this;
  4607. return $core.withContext(function($ctx1) {
  4608. return $recv(self._even())._not();
  4609. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  4610. },
  4611. args: [],
  4612. source: "odd\x0a\x09^ self even not",
  4613. referencedClasses: [],
  4614. messageSends: ["not", "even"]
  4615. }),
  4616. $globals.Number);
  4617. $core.addMethod(
  4618. $core.method({
  4619. selector: "positive",
  4620. protocol: 'testing',
  4621. fn: function (){
  4622. var self=this;
  4623. return $core.withContext(function($ctx1) {
  4624. return self.__gt_eq((0));
  4625. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  4626. },
  4627. args: [],
  4628. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4629. referencedClasses: [],
  4630. messageSends: [">="]
  4631. }),
  4632. $globals.Number);
  4633. $core.addMethod(
  4634. $core.method({
  4635. selector: "printOn:",
  4636. protocol: 'printing',
  4637. fn: function (aStream){
  4638. var self=this;
  4639. return $core.withContext(function($ctx1) {
  4640. $recv(aStream)._nextPutAll_(self._asString());
  4641. return self;
  4642. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  4643. },
  4644. args: ["aStream"],
  4645. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4646. referencedClasses: [],
  4647. messageSends: ["nextPutAll:", "asString"]
  4648. }),
  4649. $globals.Number);
  4650. $core.addMethod(
  4651. $core.method({
  4652. selector: "printShowingDecimalPlaces:",
  4653. protocol: 'printing',
  4654. fn: function (placesDesired){
  4655. var self=this;
  4656. return $core.withContext(function($ctx1) {
  4657. return self.toFixed(placesDesired);
  4658. return self;
  4659. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  4660. },
  4661. args: ["placesDesired"],
  4662. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  4663. referencedClasses: [],
  4664. messageSends: []
  4665. }),
  4666. $globals.Number);
  4667. $core.addMethod(
  4668. $core.method({
  4669. selector: "raisedTo:",
  4670. protocol: 'mathematical functions',
  4671. fn: function (exponent){
  4672. var self=this;
  4673. return $core.withContext(function($ctx1) {
  4674. return Math.pow(self, exponent);;
  4675. return self;
  4676. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  4677. },
  4678. args: ["exponent"],
  4679. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  4680. referencedClasses: [],
  4681. messageSends: []
  4682. }),
  4683. $globals.Number);
  4684. $core.addMethod(
  4685. $core.method({
  4686. selector: "rounded",
  4687. protocol: 'converting',
  4688. fn: function (){
  4689. var self=this;
  4690. return $core.withContext(function($ctx1) {
  4691. return Math.round(self);;
  4692. return self;
  4693. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  4694. },
  4695. args: [],
  4696. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  4697. referencedClasses: [],
  4698. messageSends: []
  4699. }),
  4700. $globals.Number);
  4701. $core.addMethod(
  4702. $core.method({
  4703. selector: "sign",
  4704. protocol: 'mathematical functions',
  4705. fn: function (){
  4706. var self=this;
  4707. return $core.withContext(function($ctx1) {
  4708. var $1,$2;
  4709. $1=self._isZero();
  4710. if($core.assert($1)){
  4711. return (0);
  4712. };
  4713. $2=self._positive();
  4714. if($core.assert($2)){
  4715. return (1);
  4716. } else {
  4717. return (-1);
  4718. };
  4719. return self;
  4720. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  4721. },
  4722. args: [],
  4723. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  4724. referencedClasses: [],
  4725. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  4726. }),
  4727. $globals.Number);
  4728. $core.addMethod(
  4729. $core.method({
  4730. selector: "sin",
  4731. protocol: 'mathematical functions',
  4732. fn: function (){
  4733. var self=this;
  4734. return $core.withContext(function($ctx1) {
  4735. return Math.sin(self);;
  4736. return self;
  4737. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  4738. },
  4739. args: [],
  4740. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  4741. referencedClasses: [],
  4742. messageSends: []
  4743. }),
  4744. $globals.Number);
  4745. $core.addMethod(
  4746. $core.method({
  4747. selector: "sqrt",
  4748. protocol: 'mathematical functions',
  4749. fn: function (){
  4750. var self=this;
  4751. return $core.withContext(function($ctx1) {
  4752. return Math.sqrt(self);
  4753. return self;
  4754. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  4755. },
  4756. args: [],
  4757. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  4758. referencedClasses: [],
  4759. messageSends: []
  4760. }),
  4761. $globals.Number);
  4762. $core.addMethod(
  4763. $core.method({
  4764. selector: "squared",
  4765. protocol: 'mathematical functions',
  4766. fn: function (){
  4767. var self=this;
  4768. return $core.withContext(function($ctx1) {
  4769. return self.__star(self);
  4770. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  4771. },
  4772. args: [],
  4773. source: "squared\x0a\x09^ self * self",
  4774. referencedClasses: [],
  4775. messageSends: ["*"]
  4776. }),
  4777. $globals.Number);
  4778. $core.addMethod(
  4779. $core.method({
  4780. selector: "tan",
  4781. protocol: 'mathematical functions',
  4782. fn: function (){
  4783. var self=this;
  4784. return $core.withContext(function($ctx1) {
  4785. return Math.tan(self);;
  4786. return self;
  4787. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  4788. },
  4789. args: [],
  4790. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  4791. referencedClasses: [],
  4792. messageSends: []
  4793. }),
  4794. $globals.Number);
  4795. $core.addMethod(
  4796. $core.method({
  4797. selector: "timesRepeat:",
  4798. protocol: 'enumerating',
  4799. fn: function (aBlock){
  4800. var self=this;
  4801. var count;
  4802. return $core.withContext(function($ctx1) {
  4803. count=(1);
  4804. $recv((function(){
  4805. return $core.withContext(function($ctx2) {
  4806. return $recv(count).__gt(self);
  4807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4808. }))._whileFalse_((function(){
  4809. return $core.withContext(function($ctx2) {
  4810. $recv(aBlock)._value();
  4811. count=$recv(count).__plus((1));
  4812. return count;
  4813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4814. }));
  4815. return self;
  4816. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  4817. },
  4818. args: ["aBlock"],
  4819. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  4820. referencedClasses: [],
  4821. messageSends: ["whileFalse:", ">", "value", "+"]
  4822. }),
  4823. $globals.Number);
  4824. $core.addMethod(
  4825. $core.method({
  4826. selector: "to:",
  4827. protocol: 'converting',
  4828. fn: function (aNumber){
  4829. var self=this;
  4830. var array,first,last,count;
  4831. return $core.withContext(function($ctx1) {
  4832. first=self._truncated();
  4833. $ctx1.sendIdx["truncated"]=1;
  4834. last=$recv($recv(aNumber)._truncated()).__plus((1));
  4835. $ctx1.sendIdx["+"]=1;
  4836. count=(1);
  4837. array=$recv($globals.Array)._new();
  4838. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  4839. return $core.withContext(function($ctx2) {
  4840. $recv(array)._at_put_(count,first);
  4841. count=$recv(count).__plus((1));
  4842. $ctx2.sendIdx["+"]=2;
  4843. count;
  4844. first=$recv(first).__plus((1));
  4845. return first;
  4846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4847. }));
  4848. return array;
  4849. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  4850. },
  4851. args: ["aNumber"],
  4852. 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",
  4853. referencedClasses: ["Array"],
  4854. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  4855. }),
  4856. $globals.Number);
  4857. $core.addMethod(
  4858. $core.method({
  4859. selector: "to:by:",
  4860. protocol: 'converting',
  4861. fn: function (stop,step){
  4862. var self=this;
  4863. var array,value,pos;
  4864. return $core.withContext(function($ctx1) {
  4865. var $1,$2;
  4866. value=self;
  4867. array=$recv($globals.Array)._new();
  4868. pos=(1);
  4869. $1=$recv(step).__eq((0));
  4870. if($core.assert($1)){
  4871. self._error_("step must be non-zero");
  4872. };
  4873. $2=$recv(step).__lt((0));
  4874. if($core.assert($2)){
  4875. $recv((function(){
  4876. return $core.withContext(function($ctx2) {
  4877. return $recv(value).__gt_eq(stop);
  4878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4879. }))._whileTrue_((function(){
  4880. return $core.withContext(function($ctx2) {
  4881. $recv(array)._at_put_(pos,value);
  4882. $ctx2.sendIdx["at:put:"]=1;
  4883. pos=$recv(pos).__plus((1));
  4884. $ctx2.sendIdx["+"]=1;
  4885. pos;
  4886. value=$recv(value).__plus(step);
  4887. $ctx2.sendIdx["+"]=2;
  4888. return value;
  4889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4890. }));
  4891. $ctx1.sendIdx["whileTrue:"]=1;
  4892. } else {
  4893. $recv((function(){
  4894. return $core.withContext(function($ctx2) {
  4895. return $recv(value).__lt_eq(stop);
  4896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4897. }))._whileTrue_((function(){
  4898. return $core.withContext(function($ctx2) {
  4899. $recv(array)._at_put_(pos,value);
  4900. pos=$recv(pos).__plus((1));
  4901. $ctx2.sendIdx["+"]=3;
  4902. pos;
  4903. value=$recv(value).__plus(step);
  4904. return value;
  4905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4906. }));
  4907. };
  4908. return array;
  4909. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  4910. },
  4911. args: ["stop", "step"],
  4912. 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",
  4913. referencedClasses: ["Array"],
  4914. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  4915. }),
  4916. $globals.Number);
  4917. $core.addMethod(
  4918. $core.method({
  4919. selector: "to:by:do:",
  4920. protocol: 'enumerating',
  4921. fn: function (stop,step,aBlock){
  4922. var self=this;
  4923. var value;
  4924. return $core.withContext(function($ctx1) {
  4925. var $1,$2;
  4926. value=self;
  4927. $1=$recv(step).__eq((0));
  4928. if($core.assert($1)){
  4929. self._error_("step must be non-zero");
  4930. };
  4931. $2=$recv(step).__lt((0));
  4932. if($core.assert($2)){
  4933. $recv((function(){
  4934. return $core.withContext(function($ctx2) {
  4935. return $recv(value).__gt_eq(stop);
  4936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4937. }))._whileTrue_((function(){
  4938. return $core.withContext(function($ctx2) {
  4939. $recv(aBlock)._value_(value);
  4940. $ctx2.sendIdx["value:"]=1;
  4941. value=$recv(value).__plus(step);
  4942. $ctx2.sendIdx["+"]=1;
  4943. return value;
  4944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4945. }));
  4946. $ctx1.sendIdx["whileTrue:"]=1;
  4947. } else {
  4948. $recv((function(){
  4949. return $core.withContext(function($ctx2) {
  4950. return $recv(value).__lt_eq(stop);
  4951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4952. }))._whileTrue_((function(){
  4953. return $core.withContext(function($ctx2) {
  4954. $recv(aBlock)._value_(value);
  4955. value=$recv(value).__plus(step);
  4956. return value;
  4957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4958. }));
  4959. };
  4960. return self;
  4961. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  4962. },
  4963. args: ["stop", "step", "aBlock"],
  4964. 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 ]]",
  4965. referencedClasses: [],
  4966. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  4967. }),
  4968. $globals.Number);
  4969. $core.addMethod(
  4970. $core.method({
  4971. selector: "to:do:",
  4972. protocol: 'enumerating',
  4973. fn: function (stop,aBlock){
  4974. var self=this;
  4975. var nextValue;
  4976. return $core.withContext(function($ctx1) {
  4977. nextValue=self;
  4978. $recv((function(){
  4979. return $core.withContext(function($ctx2) {
  4980. return $recv(nextValue).__lt_eq(stop);
  4981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4982. }))._whileTrue_((function(){
  4983. return $core.withContext(function($ctx2) {
  4984. $recv(aBlock)._value_(nextValue);
  4985. nextValue=$recv(nextValue).__plus((1));
  4986. return nextValue;
  4987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4988. }));
  4989. return self;
  4990. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  4991. },
  4992. args: ["stop", "aBlock"],
  4993. 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 ]",
  4994. referencedClasses: [],
  4995. messageSends: ["whileTrue:", "<=", "value:", "+"]
  4996. }),
  4997. $globals.Number);
  4998. $core.addMethod(
  4999. $core.method({
  5000. selector: "truncated",
  5001. protocol: 'converting',
  5002. fn: function (){
  5003. var self=this;
  5004. return $core.withContext(function($ctx1) {
  5005. if(self >= 0) {
  5006. return Math.floor(self);
  5007. } else {
  5008. return Math.floor(self * (-1)) * (-1);
  5009. };
  5010. ;
  5011. return self;
  5012. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  5013. },
  5014. args: [],
  5015. 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'>",
  5016. referencedClasses: [],
  5017. messageSends: []
  5018. }),
  5019. $globals.Number);
  5020. $core.addMethod(
  5021. $core.method({
  5022. selector: "|",
  5023. protocol: 'converting',
  5024. fn: function (aNumber){
  5025. var self=this;
  5026. return $core.withContext(function($ctx1) {
  5027. return self | aNumber;
  5028. return self;
  5029. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  5030. },
  5031. args: ["aNumber"],
  5032. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5033. referencedClasses: [],
  5034. messageSends: []
  5035. }),
  5036. $globals.Number);
  5037. $core.addMethod(
  5038. $core.method({
  5039. selector: "classTag",
  5040. protocol: 'accessing',
  5041. fn: function (){
  5042. var self=this;
  5043. return "magnitude";
  5044. },
  5045. args: [],
  5046. 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'",
  5047. referencedClasses: [],
  5048. messageSends: []
  5049. }),
  5050. $globals.Number.klass);
  5051. $core.addMethod(
  5052. $core.method({
  5053. selector: "e",
  5054. protocol: 'instance creation',
  5055. fn: function (){
  5056. var self=this;
  5057. return $core.withContext(function($ctx1) {
  5058. return Math.E;;
  5059. return self;
  5060. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.klass)});
  5061. },
  5062. args: [],
  5063. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  5064. referencedClasses: [],
  5065. messageSends: []
  5066. }),
  5067. $globals.Number.klass);
  5068. $core.addMethod(
  5069. $core.method({
  5070. selector: "pi",
  5071. protocol: 'instance creation',
  5072. fn: function (){
  5073. var self=this;
  5074. return $core.withContext(function($ctx1) {
  5075. return Math.PI;
  5076. return self;
  5077. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.klass)});
  5078. },
  5079. args: [],
  5080. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  5081. referencedClasses: [],
  5082. messageSends: []
  5083. }),
  5084. $globals.Number.klass);
  5085. $core.addClass('Point', $globals.Object, ['x', 'y'], 'Kernel-Objects');
  5086. $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";
  5087. $core.addMethod(
  5088. $core.method({
  5089. selector: "*",
  5090. protocol: 'arithmetic',
  5091. fn: function (aPoint){
  5092. var self=this;
  5093. return $core.withContext(function($ctx1) {
  5094. var $2,$4,$3,$1,$6,$5;
  5095. $2=self._x();
  5096. $ctx1.sendIdx["x"]=1;
  5097. $4=$recv(aPoint)._asPoint();
  5098. $ctx1.sendIdx["asPoint"]=1;
  5099. $3=$recv($4)._x();
  5100. $1=$recv($2).__star($3);
  5101. $ctx1.sendIdx["*"]=1;
  5102. $6=self._y();
  5103. $ctx1.sendIdx["y"]=1;
  5104. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  5105. return $recv($globals.Point)._x_y_($1,$5);
  5106. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  5107. },
  5108. args: ["aPoint"],
  5109. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  5110. referencedClasses: ["Point"],
  5111. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  5112. }),
  5113. $globals.Point);
  5114. $core.addMethod(
  5115. $core.method({
  5116. selector: "+",
  5117. protocol: 'arithmetic',
  5118. fn: function (aPoint){
  5119. var self=this;
  5120. return $core.withContext(function($ctx1) {
  5121. var $2,$4,$3,$1,$6,$5;
  5122. $2=self._x();
  5123. $ctx1.sendIdx["x"]=1;
  5124. $4=$recv(aPoint)._asPoint();
  5125. $ctx1.sendIdx["asPoint"]=1;
  5126. $3=$recv($4)._x();
  5127. $1=$recv($2).__plus($3);
  5128. $ctx1.sendIdx["+"]=1;
  5129. $6=self._y();
  5130. $ctx1.sendIdx["y"]=1;
  5131. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  5132. return $recv($globals.Point)._x_y_($1,$5);
  5133. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  5134. },
  5135. args: ["aPoint"],
  5136. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  5137. referencedClasses: ["Point"],
  5138. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  5139. }),
  5140. $globals.Point);
  5141. $core.addMethod(
  5142. $core.method({
  5143. selector: "-",
  5144. protocol: 'arithmetic',
  5145. fn: function (aPoint){
  5146. var self=this;
  5147. return $core.withContext(function($ctx1) {
  5148. var $2,$4,$3,$1,$6,$5;
  5149. $2=self._x();
  5150. $ctx1.sendIdx["x"]=1;
  5151. $4=$recv(aPoint)._asPoint();
  5152. $ctx1.sendIdx["asPoint"]=1;
  5153. $3=$recv($4)._x();
  5154. $1=$recv($2).__minus($3);
  5155. $ctx1.sendIdx["-"]=1;
  5156. $6=self._y();
  5157. $ctx1.sendIdx["y"]=1;
  5158. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  5159. return $recv($globals.Point)._x_y_($1,$5);
  5160. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  5161. },
  5162. args: ["aPoint"],
  5163. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  5164. referencedClasses: ["Point"],
  5165. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  5166. }),
  5167. $globals.Point);
  5168. $core.addMethod(
  5169. $core.method({
  5170. selector: "/",
  5171. protocol: 'arithmetic',
  5172. fn: function (aPoint){
  5173. var self=this;
  5174. return $core.withContext(function($ctx1) {
  5175. var $2,$4,$3,$1,$6,$5;
  5176. $2=self._x();
  5177. $ctx1.sendIdx["x"]=1;
  5178. $4=$recv(aPoint)._asPoint();
  5179. $ctx1.sendIdx["asPoint"]=1;
  5180. $3=$recv($4)._x();
  5181. $1=$recv($2).__slash($3);
  5182. $ctx1.sendIdx["/"]=1;
  5183. $6=self._y();
  5184. $ctx1.sendIdx["y"]=1;
  5185. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  5186. return $recv($globals.Point)._x_y_($1,$5);
  5187. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  5188. },
  5189. args: ["aPoint"],
  5190. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  5191. referencedClasses: ["Point"],
  5192. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  5193. }),
  5194. $globals.Point);
  5195. $core.addMethod(
  5196. $core.method({
  5197. selector: "<",
  5198. protocol: 'comparing',
  5199. fn: function (aPoint){
  5200. var self=this;
  5201. return $core.withContext(function($ctx1) {
  5202. var $2,$1,$3;
  5203. $2=self._x();
  5204. $ctx1.sendIdx["x"]=1;
  5205. $1=$recv($2).__lt($recv(aPoint)._x());
  5206. $ctx1.sendIdx["<"]=1;
  5207. return $recv($1)._and_((function(){
  5208. return $core.withContext(function($ctx2) {
  5209. $3=self._y();
  5210. $ctx2.sendIdx["y"]=1;
  5211. return $recv($3).__lt($recv(aPoint)._y());
  5212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5213. }));
  5214. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  5215. },
  5216. args: ["aPoint"],
  5217. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  5218. referencedClasses: [],
  5219. messageSends: ["and:", "<", "x", "y"]
  5220. }),
  5221. $globals.Point);
  5222. $core.addMethod(
  5223. $core.method({
  5224. selector: "<=",
  5225. protocol: 'comparing',
  5226. fn: function (aPoint){
  5227. var self=this;
  5228. return $core.withContext(function($ctx1) {
  5229. var $2,$1,$3;
  5230. $2=self._x();
  5231. $ctx1.sendIdx["x"]=1;
  5232. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  5233. $ctx1.sendIdx["<="]=1;
  5234. return $recv($1)._and_((function(){
  5235. return $core.withContext(function($ctx2) {
  5236. $3=self._y();
  5237. $ctx2.sendIdx["y"]=1;
  5238. return $recv($3).__lt_eq($recv(aPoint)._y());
  5239. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5240. }));
  5241. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  5242. },
  5243. args: ["aPoint"],
  5244. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  5245. referencedClasses: [],
  5246. messageSends: ["and:", "<=", "x", "y"]
  5247. }),
  5248. $globals.Point);
  5249. $core.addMethod(
  5250. $core.method({
  5251. selector: "=",
  5252. protocol: 'comparing',
  5253. fn: function (aPoint){
  5254. var self=this;
  5255. return $core.withContext(function($ctx1) {
  5256. var $2,$1,$4,$3,$6,$5;
  5257. $2=$recv(aPoint)._class();
  5258. $ctx1.sendIdx["class"]=1;
  5259. $1=$recv($2).__eq(self._class());
  5260. $ctx1.sendIdx["="]=1;
  5261. return $recv($1)._and_((function(){
  5262. return $core.withContext(function($ctx2) {
  5263. $4=$recv(aPoint)._x();
  5264. $ctx2.sendIdx["x"]=1;
  5265. $3=$recv($4).__eq(self._x());
  5266. $ctx2.sendIdx["="]=2;
  5267. $6=$recv(aPoint)._y();
  5268. $ctx2.sendIdx["y"]=1;
  5269. $5=$recv($6).__eq(self._y());
  5270. return $recv($3).__and($5);
  5271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5272. }));
  5273. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  5274. },
  5275. args: ["aPoint"],
  5276. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  5277. referencedClasses: [],
  5278. messageSends: ["and:", "=", "class", "&", "x", "y"]
  5279. }),
  5280. $globals.Point);
  5281. $core.addMethod(
  5282. $core.method({
  5283. selector: ">",
  5284. protocol: 'comparing',
  5285. fn: function (aPoint){
  5286. var self=this;
  5287. return $core.withContext(function($ctx1) {
  5288. var $2,$1,$3;
  5289. $2=self._x();
  5290. $ctx1.sendIdx["x"]=1;
  5291. $1=$recv($2).__gt($recv(aPoint)._x());
  5292. $ctx1.sendIdx[">"]=1;
  5293. return $recv($1)._and_((function(){
  5294. return $core.withContext(function($ctx2) {
  5295. $3=self._y();
  5296. $ctx2.sendIdx["y"]=1;
  5297. return $recv($3).__gt($recv(aPoint)._y());
  5298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5299. }));
  5300. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  5301. },
  5302. args: ["aPoint"],
  5303. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  5304. referencedClasses: [],
  5305. messageSends: ["and:", ">", "x", "y"]
  5306. }),
  5307. $globals.Point);
  5308. $core.addMethod(
  5309. $core.method({
  5310. selector: ">=",
  5311. protocol: 'comparing',
  5312. fn: function (aPoint){
  5313. var self=this;
  5314. return $core.withContext(function($ctx1) {
  5315. var $2,$1,$3;
  5316. $2=self._x();
  5317. $ctx1.sendIdx["x"]=1;
  5318. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  5319. $ctx1.sendIdx[">="]=1;
  5320. return $recv($1)._and_((function(){
  5321. return $core.withContext(function($ctx2) {
  5322. $3=self._y();
  5323. $ctx2.sendIdx["y"]=1;
  5324. return $recv($3).__gt_eq($recv(aPoint)._y());
  5325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5326. }));
  5327. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  5328. },
  5329. args: ["aPoint"],
  5330. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  5331. referencedClasses: [],
  5332. messageSends: ["and:", ">=", "x", "y"]
  5333. }),
  5334. $globals.Point);
  5335. $core.addMethod(
  5336. $core.method({
  5337. selector: "asPoint",
  5338. protocol: 'converting',
  5339. fn: function (){
  5340. var self=this;
  5341. return self;
  5342. },
  5343. args: [],
  5344. source: "asPoint\x0a\x09^ self",
  5345. referencedClasses: [],
  5346. messageSends: []
  5347. }),
  5348. $globals.Point);
  5349. $core.addMethod(
  5350. $core.method({
  5351. selector: "dist:",
  5352. protocol: 'transforming',
  5353. fn: function (aPoint){
  5354. var self=this;
  5355. var dx,dy;
  5356. return $core.withContext(function($ctx1) {
  5357. var $2,$1;
  5358. dx=$recv($recv(aPoint)._x()).__minus(self["@x"]);
  5359. $ctx1.sendIdx["-"]=1;
  5360. dy=$recv($recv(aPoint)._y()).__minus(self["@y"]);
  5361. $2=$recv(dx).__star(dx);
  5362. $ctx1.sendIdx["*"]=1;
  5363. $1=$recv($2).__plus($recv(dy).__star(dy));
  5364. return $recv($1)._sqrt();
  5365. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  5366. },
  5367. args: ["aPoint"],
  5368. 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",
  5369. referencedClasses: [],
  5370. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  5371. }),
  5372. $globals.Point);
  5373. $core.addMethod(
  5374. $core.method({
  5375. selector: "printOn:",
  5376. protocol: 'printing',
  5377. fn: function (aStream){
  5378. var self=this;
  5379. return $core.withContext(function($ctx1) {
  5380. var $1;
  5381. $recv(self["@x"])._printOn_(aStream);
  5382. $ctx1.sendIdx["printOn:"]=1;
  5383. $recv(aStream)._nextPutAll_("@");
  5384. $1=$recv($recv(self["@y"])._notNil())._and_((function(){
  5385. return $core.withContext(function($ctx2) {
  5386. return $recv(self["@y"])._negative();
  5387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5388. }));
  5389. if($core.assert($1)){
  5390. $recv(aStream)._space();
  5391. };
  5392. $recv(self["@y"])._printOn_(aStream);
  5393. return self;
  5394. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  5395. },
  5396. args: ["aStream"],
  5397. 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",
  5398. referencedClasses: [],
  5399. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  5400. }),
  5401. $globals.Point);
  5402. $core.addMethod(
  5403. $core.method({
  5404. selector: "translateBy:",
  5405. protocol: 'transforming',
  5406. fn: function (delta){
  5407. var self=this;
  5408. return $core.withContext(function($ctx1) {
  5409. var $1;
  5410. $1=$recv($recv(delta)._x()).__plus(self["@x"]);
  5411. $ctx1.sendIdx["+"]=1;
  5412. return $recv($1).__at($recv($recv(delta)._y()).__plus(self["@y"]));
  5413. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  5414. },
  5415. args: ["delta"],
  5416. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  5417. referencedClasses: [],
  5418. messageSends: ["@", "+", "x", "y"]
  5419. }),
  5420. $globals.Point);
  5421. $core.addMethod(
  5422. $core.method({
  5423. selector: "x",
  5424. protocol: 'accessing',
  5425. fn: function (){
  5426. var self=this;
  5427. return self["@x"];
  5428. },
  5429. args: [],
  5430. source: "x\x0a\x09^ x",
  5431. referencedClasses: [],
  5432. messageSends: []
  5433. }),
  5434. $globals.Point);
  5435. $core.addMethod(
  5436. $core.method({
  5437. selector: "x:",
  5438. protocol: 'accessing',
  5439. fn: function (aNumber){
  5440. var self=this;
  5441. self["@x"]=aNumber;
  5442. return self;
  5443. },
  5444. args: ["aNumber"],
  5445. source: "x: aNumber\x0a\x09x := aNumber",
  5446. referencedClasses: [],
  5447. messageSends: []
  5448. }),
  5449. $globals.Point);
  5450. $core.addMethod(
  5451. $core.method({
  5452. selector: "y",
  5453. protocol: 'accessing',
  5454. fn: function (){
  5455. var self=this;
  5456. return self["@y"];
  5457. },
  5458. args: [],
  5459. source: "y\x0a\x09^ y",
  5460. referencedClasses: [],
  5461. messageSends: []
  5462. }),
  5463. $globals.Point);
  5464. $core.addMethod(
  5465. $core.method({
  5466. selector: "y:",
  5467. protocol: 'accessing',
  5468. fn: function (aNumber){
  5469. var self=this;
  5470. self["@y"]=aNumber;
  5471. return self;
  5472. },
  5473. args: ["aNumber"],
  5474. source: "y: aNumber\x0a\x09y := aNumber",
  5475. referencedClasses: [],
  5476. messageSends: []
  5477. }),
  5478. $globals.Point);
  5479. $core.addMethod(
  5480. $core.method({
  5481. selector: "classTag",
  5482. protocol: 'accessing',
  5483. fn: function (){
  5484. var self=this;
  5485. return "magnitude";
  5486. },
  5487. args: [],
  5488. 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'",
  5489. referencedClasses: [],
  5490. messageSends: []
  5491. }),
  5492. $globals.Point.klass);
  5493. $core.addMethod(
  5494. $core.method({
  5495. selector: "x:y:",
  5496. protocol: 'instance creation',
  5497. fn: function (aNumber,anotherNumber){
  5498. var self=this;
  5499. return $core.withContext(function($ctx1) {
  5500. var $1;
  5501. $1=self._new();
  5502. $recv($1)._x_(aNumber);
  5503. $recv($1)._y_(anotherNumber);
  5504. return $recv($1)._yourself();
  5505. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.klass)});
  5506. },
  5507. args: ["aNumber", "anotherNumber"],
  5508. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  5509. referencedClasses: [],
  5510. messageSends: ["x:", "new", "y:", "yourself"]
  5511. }),
  5512. $globals.Point.klass);
  5513. $core.addClass('Random', $globals.Object, [], 'Kernel-Objects');
  5514. $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'`.";
  5515. $core.addMethod(
  5516. $core.method({
  5517. selector: "next",
  5518. protocol: 'accessing',
  5519. fn: function (){
  5520. var self=this;
  5521. return $core.withContext(function($ctx1) {
  5522. return Math.random();
  5523. return self;
  5524. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  5525. },
  5526. args: [],
  5527. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  5528. referencedClasses: [],
  5529. messageSends: []
  5530. }),
  5531. $globals.Random);
  5532. $core.addMethod(
  5533. $core.method({
  5534. selector: "next:",
  5535. protocol: 'accessing',
  5536. fn: function (anInteger){
  5537. var self=this;
  5538. return $core.withContext(function($ctx1) {
  5539. return $recv((1)._to_(anInteger))._collect_((function(each){
  5540. return $core.withContext(function($ctx2) {
  5541. return self._next();
  5542. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5543. }));
  5544. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  5545. },
  5546. args: ["anInteger"],
  5547. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  5548. referencedClasses: [],
  5549. messageSends: ["collect:", "to:", "next"]
  5550. }),
  5551. $globals.Random);
  5552. $core.addClass('UndefinedObject', $globals.Object, [], 'Kernel-Objects');
  5553. $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`.";
  5554. $core.addMethod(
  5555. $core.method({
  5556. selector: "asJSON",
  5557. protocol: 'converting',
  5558. fn: function (){
  5559. var self=this;
  5560. return null;
  5561. },
  5562. args: [],
  5563. source: "asJSON\x0a\x09^ null",
  5564. referencedClasses: [],
  5565. messageSends: []
  5566. }),
  5567. $globals.UndefinedObject);
  5568. $core.addMethod(
  5569. $core.method({
  5570. selector: "deepCopy",
  5571. protocol: 'copying',
  5572. fn: function (){
  5573. var self=this;
  5574. return self;
  5575. },
  5576. args: [],
  5577. source: "deepCopy\x0a\x09^ self",
  5578. referencedClasses: [],
  5579. messageSends: []
  5580. }),
  5581. $globals.UndefinedObject);
  5582. $core.addMethod(
  5583. $core.method({
  5584. selector: "ifNil:",
  5585. protocol: 'testing',
  5586. fn: function (aBlock){
  5587. var self=this;
  5588. return $core.withContext(function($ctx1) {
  5589. return self._ifNil_ifNotNil_(aBlock,(function(){
  5590. }));
  5591. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  5592. },
  5593. args: ["aBlock"],
  5594. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  5595. referencedClasses: [],
  5596. messageSends: ["ifNil:ifNotNil:"]
  5597. }),
  5598. $globals.UndefinedObject);
  5599. $core.addMethod(
  5600. $core.method({
  5601. selector: "ifNil:ifNotNil:",
  5602. protocol: 'testing',
  5603. fn: function (aBlock,anotherBlock){
  5604. var self=this;
  5605. return $core.withContext(function($ctx1) {
  5606. return $recv(aBlock)._value();
  5607. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5608. },
  5609. args: ["aBlock", "anotherBlock"],
  5610. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  5611. referencedClasses: [],
  5612. messageSends: ["value"]
  5613. }),
  5614. $globals.UndefinedObject);
  5615. $core.addMethod(
  5616. $core.method({
  5617. selector: "ifNotNil:",
  5618. protocol: 'testing',
  5619. fn: function (aBlock){
  5620. var self=this;
  5621. return self;
  5622. },
  5623. args: ["aBlock"],
  5624. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  5625. referencedClasses: [],
  5626. messageSends: []
  5627. }),
  5628. $globals.UndefinedObject);
  5629. $core.addMethod(
  5630. $core.method({
  5631. selector: "ifNotNil:ifNil:",
  5632. protocol: 'testing',
  5633. fn: function (aBlock,anotherBlock){
  5634. var self=this;
  5635. return $core.withContext(function($ctx1) {
  5636. return $recv(anotherBlock)._value();
  5637. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5638. },
  5639. args: ["aBlock", "anotherBlock"],
  5640. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  5641. referencedClasses: [],
  5642. messageSends: ["value"]
  5643. }),
  5644. $globals.UndefinedObject);
  5645. $core.addMethod(
  5646. $core.method({
  5647. selector: "isImmutable",
  5648. protocol: 'testing',
  5649. fn: function (){
  5650. var self=this;
  5651. return true;
  5652. },
  5653. args: [],
  5654. source: "isImmutable\x0a\x09^ true",
  5655. referencedClasses: [],
  5656. messageSends: []
  5657. }),
  5658. $globals.UndefinedObject);
  5659. $core.addMethod(
  5660. $core.method({
  5661. selector: "isNil",
  5662. protocol: 'testing',
  5663. fn: function (){
  5664. var self=this;
  5665. return true;
  5666. },
  5667. args: [],
  5668. source: "isNil\x0a\x09^ true",
  5669. referencedClasses: [],
  5670. messageSends: []
  5671. }),
  5672. $globals.UndefinedObject);
  5673. $core.addMethod(
  5674. $core.method({
  5675. selector: "notNil",
  5676. protocol: 'testing',
  5677. fn: function (){
  5678. var self=this;
  5679. return false;
  5680. },
  5681. args: [],
  5682. source: "notNil\x0a\x09^ false",
  5683. referencedClasses: [],
  5684. messageSends: []
  5685. }),
  5686. $globals.UndefinedObject);
  5687. $core.addMethod(
  5688. $core.method({
  5689. selector: "printOn:",
  5690. protocol: 'printing',
  5691. fn: function (aStream){
  5692. var self=this;
  5693. return $core.withContext(function($ctx1) {
  5694. $recv(aStream)._nextPutAll_("nil");
  5695. return self;
  5696. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  5697. },
  5698. args: ["aStream"],
  5699. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  5700. referencedClasses: [],
  5701. messageSends: ["nextPutAll:"]
  5702. }),
  5703. $globals.UndefinedObject);
  5704. $core.addMethod(
  5705. $core.method({
  5706. selector: "shallowCopy",
  5707. protocol: 'copying',
  5708. fn: function (){
  5709. var self=this;
  5710. return self;
  5711. },
  5712. args: [],
  5713. source: "shallowCopy\x0a\x09^ self",
  5714. referencedClasses: [],
  5715. messageSends: []
  5716. }),
  5717. $globals.UndefinedObject);
  5718. $core.addMethod(
  5719. $core.method({
  5720. selector: "subclass:instanceVariableNames:",
  5721. protocol: 'class creation',
  5722. fn: function (aString,anotherString){
  5723. var self=this;
  5724. return $core.withContext(function($ctx1) {
  5725. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5726. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.UndefinedObject)});
  5727. },
  5728. args: ["aString", "anotherString"],
  5729. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  5730. referencedClasses: [],
  5731. messageSends: ["subclass:instanceVariableNames:package:"]
  5732. }),
  5733. $globals.UndefinedObject);
  5734. $core.addMethod(
  5735. $core.method({
  5736. selector: "subclass:instanceVariableNames:category:",
  5737. protocol: 'class creation',
  5738. fn: function (aString,aString2,aString3){
  5739. var self=this;
  5740. return $core.withContext(function($ctx1) {
  5741. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5742. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5743. },
  5744. args: ["aString", "aString2", "aString3"],
  5745. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  5746. referencedClasses: [],
  5747. messageSends: ["subclass:instanceVariableNames:package:"]
  5748. }),
  5749. $globals.UndefinedObject);
  5750. $core.addMethod(
  5751. $core.method({
  5752. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  5753. protocol: 'class creation',
  5754. fn: function (aString,aString2,classVars,pools,aString3){
  5755. var self=this;
  5756. return $core.withContext(function($ctx1) {
  5757. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5758. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
  5759. },
  5760. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  5761. 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",
  5762. referencedClasses: [],
  5763. messageSends: ["subclass:instanceVariableNames:package:"]
  5764. }),
  5765. $globals.UndefinedObject);
  5766. $core.addMethod(
  5767. $core.method({
  5768. selector: "subclass:instanceVariableNames:package:",
  5769. protocol: 'class creation',
  5770. fn: function (aString,aString2,aString3){
  5771. var self=this;
  5772. return $core.withContext(function($ctx1) {
  5773. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  5774. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5775. },
  5776. args: ["aString", "aString2", "aString3"],
  5777. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5778. referencedClasses: ["ClassBuilder"],
  5779. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  5780. }),
  5781. $globals.UndefinedObject);
  5782. $core.addMethod(
  5783. $core.method({
  5784. selector: "new",
  5785. protocol: 'instance creation',
  5786. fn: function (){
  5787. var self=this;
  5788. return $core.withContext(function($ctx1) {
  5789. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  5790. return self;
  5791. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.klass)});
  5792. },
  5793. args: [],
  5794. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  5795. referencedClasses: [],
  5796. messageSends: ["error:"]
  5797. }),
  5798. $globals.UndefinedObject.klass);
  5799. });
  5800. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  5801. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  5802. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  5803. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  5804. $core.addPackage('Kernel-Classes');
  5805. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  5806. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5807. $core.addClass('Behavior', $globals.Object, [], 'Kernel-Classes');
  5808. $globals.Behavior.comment="I am the superclass of all class objects.\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, contain the description that instances are created from,\x0aand hold the method dictionary that's associated with each class.\x0a\x0aI also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.";
  5809. $core.addMethod(
  5810. $core.method({
  5811. selector: ">>",
  5812. protocol: 'accessing',
  5813. fn: function (aString){
  5814. var self=this;
  5815. return $core.withContext(function($ctx1) {
  5816. return self._methodAt_(aString);
  5817. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.Behavior)});
  5818. },
  5819. args: ["aString"],
  5820. source: ">> aString\x0a\x09^ self methodAt: aString",
  5821. referencedClasses: [],
  5822. messageSends: ["methodAt:"]
  5823. }),
  5824. $globals.Behavior);
  5825. $core.addMethod(
  5826. $core.method({
  5827. selector: "addCompiledMethod:",
  5828. protocol: 'compiling',
  5829. fn: function (aMethod){
  5830. var self=this;
  5831. var oldMethod,announcement;
  5832. return $core.withContext(function($ctx1) {
  5833. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$receiver;
  5834. oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  5835. return nil;
  5836. }));
  5837. $2=self._protocols();
  5838. $3=$recv(aMethod)._protocol();
  5839. $ctx1.sendIdx["protocol"]=1;
  5840. $1=$recv($2)._includes_($3);
  5841. if(!$core.assert($1)){
  5842. $4=self._organization();
  5843. $5=$recv(aMethod)._protocol();
  5844. $ctx1.sendIdx["protocol"]=2;
  5845. $recv($4)._addElement_($5);
  5846. };
  5847. self._basicAddCompiledMethod_(aMethod);
  5848. $6=oldMethod;
  5849. if(($receiver = $6) == null || $receiver.isNil){
  5850. $6;
  5851. } else {
  5852. self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  5853. };
  5854. $7=oldMethod;
  5855. if(($receiver = $7) == null || $receiver.isNil){
  5856. $8=$recv($globals.MethodAdded)._new();
  5857. $ctx1.sendIdx["new"]=1;
  5858. $recv($8)._method_(aMethod);
  5859. $ctx1.sendIdx["method:"]=1;
  5860. $9=$recv($8)._yourself();
  5861. $ctx1.sendIdx["yourself"]=1;
  5862. announcement=$9;
  5863. } else {
  5864. $10=$recv($globals.MethodModified)._new();
  5865. $recv($10)._oldMethod_(oldMethod);
  5866. $recv($10)._method_(aMethod);
  5867. announcement=$recv($10)._yourself();
  5868. };
  5869. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  5870. return self;
  5871. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.Behavior)});
  5872. },
  5873. args: ["aMethod"],
  5874. 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\x09(self protocols includes: aMethod protocol)\x0a\x09\x09ifFalse: [ self organization addElement: aMethod protocol ].\x0a\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ].\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",
  5875. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  5876. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  5877. }),
  5878. $globals.Behavior);
  5879. $core.addMethod(
  5880. $core.method({
  5881. selector: "allInstanceVariableNames",
  5882. protocol: 'accessing',
  5883. fn: function (){
  5884. var self=this;
  5885. var result;
  5886. return $core.withContext(function($ctx1) {
  5887. var $1,$receiver;
  5888. result=$recv(self._instanceVariableNames())._copy();
  5889. $1=self._superclass();
  5890. $ctx1.sendIdx["superclass"]=1;
  5891. if(($receiver = $1) == null || $receiver.isNil){
  5892. $1;
  5893. } else {
  5894. $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
  5895. };
  5896. return result;
  5897. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  5898. },
  5899. args: [],
  5900. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  5901. referencedClasses: [],
  5902. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  5903. }),
  5904. $globals.Behavior);
  5905. $core.addMethod(
  5906. $core.method({
  5907. selector: "allSelectors",
  5908. protocol: 'accessing',
  5909. fn: function (){
  5910. var self=this;
  5911. return $core.withContext(function($ctx1) {
  5912. var $1,$2;
  5913. $1=self._allSuperclasses();
  5914. $2=self._selectors();
  5915. $ctx1.sendIdx["selectors"]=1;
  5916. return $recv($1)._inject_into_($2,(function(acc,each){
  5917. return $core.withContext(function($ctx2) {
  5918. $recv(acc)._addAll_($recv(each)._selectors());
  5919. return $recv(acc)._yourself();
  5920. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  5921. }));
  5922. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  5923. },
  5924. args: [],
  5925. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  5926. referencedClasses: [],
  5927. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  5928. }),
  5929. $globals.Behavior);
  5930. $core.addMethod(
  5931. $core.method({
  5932. selector: "allSubclasses",
  5933. protocol: 'accessing',
  5934. fn: function (){
  5935. var self=this;
  5936. return $core.withContext(function($ctx1) {
  5937. return $recv($globals.Array)._streamContents_((function(str){
  5938. return $core.withContext(function($ctx2) {
  5939. return self._allSubclassesDo_((function(each){
  5940. return $core.withContext(function($ctx3) {
  5941. return $recv(str)._nextPut_(each);
  5942. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5943. }));
  5944. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  5945. }));
  5946. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  5947. },
  5948. args: [],
  5949. 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 ] ]",
  5950. referencedClasses: ["Array"],
  5951. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  5952. }),
  5953. $globals.Behavior);
  5954. $core.addMethod(
  5955. $core.method({
  5956. selector: "allSubclassesDo:",
  5957. protocol: 'enumerating',
  5958. fn: function (aBlock){
  5959. var self=this;
  5960. return $core.withContext(function($ctx1) {
  5961. $core.traverseClassTree(self, function(subclass) {
  5962. if (subclass !== self) aBlock._value_(subclass);
  5963. });
  5964. return self;
  5965. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  5966. },
  5967. args: ["aBlock"],
  5968. 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})'>",
  5969. referencedClasses: [],
  5970. messageSends: []
  5971. }),
  5972. $globals.Behavior);
  5973. $core.addMethod(
  5974. $core.method({
  5975. selector: "allSuperclasses",
  5976. protocol: 'accessing',
  5977. fn: function (){
  5978. var self=this;
  5979. return $core.withContext(function($ctx1) {
  5980. var $1,$3,$2,$receiver;
  5981. $1=self._superclass();
  5982. $ctx1.sendIdx["superclass"]=1;
  5983. if(($receiver = $1) == null || $receiver.isNil){
  5984. return [];
  5985. } else {
  5986. $1;
  5987. };
  5988. $3=self._superclass();
  5989. $ctx1.sendIdx["superclass"]=2;
  5990. $2=$recv($globals.OrderedCollection)._with_($3);
  5991. $recv($2)._addAll_($recv(self._superclass())._allSuperclasses());
  5992. return $recv($2)._yourself();
  5993. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  5994. },
  5995. args: [],
  5996. 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",
  5997. referencedClasses: ["OrderedCollection"],
  5998. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  5999. }),
  6000. $globals.Behavior);
  6001. $core.addMethod(
  6002. $core.method({
  6003. selector: "basicAddCompiledMethod:",
  6004. protocol: 'private',
  6005. fn: function (aMethod){
  6006. var self=this;
  6007. return $core.withContext(function($ctx1) {
  6008. $core.addMethod(aMethod, self);
  6009. return self;
  6010. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6011. },
  6012. args: ["aMethod"],
  6013. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  6014. referencedClasses: [],
  6015. messageSends: []
  6016. }),
  6017. $globals.Behavior);
  6018. $core.addMethod(
  6019. $core.method({
  6020. selector: "basicNew",
  6021. protocol: 'instance creation',
  6022. fn: function (){
  6023. var self=this;
  6024. return $core.withContext(function($ctx1) {
  6025. return new self.fn();
  6026. return self;
  6027. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  6028. },
  6029. args: [],
  6030. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  6031. referencedClasses: [],
  6032. messageSends: []
  6033. }),
  6034. $globals.Behavior);
  6035. $core.addMethod(
  6036. $core.method({
  6037. selector: "basicRemoveCompiledMethod:",
  6038. protocol: 'private',
  6039. fn: function (aMethod){
  6040. var self=this;
  6041. return $core.withContext(function($ctx1) {
  6042. $core.removeMethod(aMethod,self);
  6043. return self;
  6044. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6045. },
  6046. args: ["aMethod"],
  6047. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  6048. referencedClasses: [],
  6049. messageSends: []
  6050. }),
  6051. $globals.Behavior);
  6052. $core.addMethod(
  6053. $core.method({
  6054. selector: "canUnderstand:",
  6055. protocol: 'testing',
  6056. fn: function (aSelector){
  6057. var self=this;
  6058. return $core.withContext(function($ctx1) {
  6059. var $2,$1;
  6060. return $recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  6061. return $core.withContext(function($ctx2) {
  6062. $2=self._superclass();
  6063. $ctx2.sendIdx["superclass"]=1;
  6064. $1=$recv($2)._notNil();
  6065. return $recv($1)._and_((function(){
  6066. return $core.withContext(function($ctx3) {
  6067. return $recv(self._superclass())._canUnderstand_(aSelector);
  6068. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6069. }));
  6070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6071. }));
  6072. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  6073. },
  6074. args: ["aSelector"],
  6075. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  6076. referencedClasses: [],
  6077. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  6078. }),
  6079. $globals.Behavior);
  6080. $core.addMethod(
  6081. $core.method({
  6082. selector: "comment",
  6083. protocol: 'accessing',
  6084. fn: function (){
  6085. var self=this;
  6086. return $core.withContext(function($ctx1) {
  6087. var $1,$receiver;
  6088. $1=self._basicAt_("comment");
  6089. if(($receiver = $1) == null || $receiver.isNil){
  6090. return "";
  6091. } else {
  6092. return $1;
  6093. };
  6094. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.Behavior)});
  6095. },
  6096. args: [],
  6097. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  6098. referencedClasses: [],
  6099. messageSends: ["ifNil:", "basicAt:"]
  6100. }),
  6101. $globals.Behavior);
  6102. $core.addMethod(
  6103. $core.method({
  6104. selector: "comment:",
  6105. protocol: 'accessing',
  6106. fn: function (aString){
  6107. var self=this;
  6108. return $core.withContext(function($ctx1) {
  6109. var $1,$3,$2;
  6110. self._basicAt_put_("comment",aString);
  6111. $1=$recv($globals.SystemAnnouncer)._current();
  6112. $3=$recv($globals.ClassCommentChanged)._new();
  6113. $recv($3)._theClass_(self);
  6114. $2=$recv($3)._yourself();
  6115. $recv($1)._announce_($2);
  6116. return self;
  6117. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.Behavior)});
  6118. },
  6119. args: ["aString"],
  6120. 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)",
  6121. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  6122. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  6123. }),
  6124. $globals.Behavior);
  6125. $core.addMethod(
  6126. $core.method({
  6127. selector: "compile:protocol:",
  6128. protocol: 'compiling',
  6129. fn: function (aString,anotherString){
  6130. var self=this;
  6131. return $core.withContext(function($ctx1) {
  6132. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  6133. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.Behavior)});
  6134. },
  6135. args: ["aString", "anotherString"],
  6136. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  6137. referencedClasses: ["Compiler"],
  6138. messageSends: ["install:forClass:protocol:", "new"]
  6139. }),
  6140. $globals.Behavior);
  6141. $core.addMethod(
  6142. $core.method({
  6143. selector: "definition",
  6144. protocol: 'accessing',
  6145. fn: function (){
  6146. var self=this;
  6147. return "";
  6148. },
  6149. args: [],
  6150. source: "definition\x0a\x09^ ''",
  6151. referencedClasses: [],
  6152. messageSends: []
  6153. }),
  6154. $globals.Behavior);
  6155. $core.addMethod(
  6156. $core.method({
  6157. selector: "includesBehavior:",
  6158. protocol: 'testing',
  6159. fn: function (aClass){
  6160. var self=this;
  6161. return $core.withContext(function($ctx1) {
  6162. return $recv(self.__eq_eq(aClass))._or_((function(){
  6163. return $core.withContext(function($ctx2) {
  6164. return self._inheritsFrom_(aClass);
  6165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6166. }));
  6167. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  6168. },
  6169. args: ["aClass"],
  6170. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  6171. referencedClasses: [],
  6172. messageSends: ["or:", "==", "inheritsFrom:"]
  6173. }),
  6174. $globals.Behavior);
  6175. $core.addMethod(
  6176. $core.method({
  6177. selector: "includesSelector:",
  6178. protocol: 'testing',
  6179. fn: function (aString){
  6180. var self=this;
  6181. return $core.withContext(function($ctx1) {
  6182. return $recv(self._methodDictionary())._includesKey_(aString);
  6183. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.Behavior)});
  6184. },
  6185. args: ["aString"],
  6186. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  6187. referencedClasses: [],
  6188. messageSends: ["includesKey:", "methodDictionary"]
  6189. }),
  6190. $globals.Behavior);
  6191. $core.addMethod(
  6192. $core.method({
  6193. selector: "inheritsFrom:",
  6194. protocol: 'testing',
  6195. fn: function (aClass){
  6196. var self=this;
  6197. return $core.withContext(function($ctx1) {
  6198. var $1,$3,$2,$receiver;
  6199. $1=self._superclass();
  6200. $ctx1.sendIdx["superclass"]=1;
  6201. if(($receiver = $1) == null || $receiver.isNil){
  6202. return false;
  6203. } else {
  6204. $1;
  6205. };
  6206. $3=self._superclass();
  6207. $ctx1.sendIdx["superclass"]=2;
  6208. $2=$recv(aClass).__eq_eq($3);
  6209. return $recv($2)._or_((function(){
  6210. return $core.withContext(function($ctx2) {
  6211. return $recv(self._superclass())._inheritsFrom_(aClass);
  6212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6213. }));
  6214. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  6215. },
  6216. args: ["aClass"],
  6217. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  6218. referencedClasses: [],
  6219. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  6220. }),
  6221. $globals.Behavior);
  6222. $core.addMethod(
  6223. $core.method({
  6224. selector: "instanceVariableNames",
  6225. protocol: 'accessing',
  6226. fn: function (){
  6227. var self=this;
  6228. return $core.withContext(function($ctx1) {
  6229. return self.iVarNames;
  6230. return self;
  6231. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  6232. },
  6233. args: [],
  6234. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  6235. referencedClasses: [],
  6236. messageSends: []
  6237. }),
  6238. $globals.Behavior);
  6239. $core.addMethod(
  6240. $core.method({
  6241. selector: "isBehavior",
  6242. protocol: 'testing',
  6243. fn: function (){
  6244. var self=this;
  6245. return true;
  6246. },
  6247. args: [],
  6248. source: "isBehavior\x0a\x09^ true",
  6249. referencedClasses: [],
  6250. messageSends: []
  6251. }),
  6252. $globals.Behavior);
  6253. $core.addMethod(
  6254. $core.method({
  6255. selector: "javascriptConstructor",
  6256. protocol: 'accessing',
  6257. fn: function (){
  6258. var self=this;
  6259. return $core.withContext(function($ctx1) {
  6260. return self.fn;
  6261. return self;
  6262. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  6263. },
  6264. args: [],
  6265. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  6266. referencedClasses: [],
  6267. messageSends: []
  6268. }),
  6269. $globals.Behavior);
  6270. $core.addMethod(
  6271. $core.method({
  6272. selector: "javascriptConstructor:",
  6273. protocol: 'accessing',
  6274. fn: function (aJavaScriptFunction){
  6275. var self=this;
  6276. return $core.withContext(function($ctx1) {
  6277. $core.setClassConstructor(self, aJavaScriptFunction);;
  6278. return self;
  6279. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  6280. },
  6281. args: ["aJavaScriptFunction"],
  6282. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `$core.setClassConstructor'\x22\x0a\x09\x0a\x09<inlineJS: '$core.setClassConstructor(self, aJavaScriptFunction);'>",
  6283. referencedClasses: [],
  6284. messageSends: []
  6285. }),
  6286. $globals.Behavior);
  6287. $core.addMethod(
  6288. $core.method({
  6289. selector: "lookupSelector:",
  6290. protocol: 'accessing',
  6291. fn: function (selector){
  6292. var self=this;
  6293. var lookupClass;
  6294. return $core.withContext(function($ctx1) {
  6295. var $1;
  6296. var $early={};
  6297. try {
  6298. lookupClass=self;
  6299. $recv((function(){
  6300. return $core.withContext(function($ctx2) {
  6301. return $recv(lookupClass).__eq(nil);
  6302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6303. }))._whileFalse_((function(){
  6304. return $core.withContext(function($ctx2) {
  6305. $1=$recv(lookupClass)._includesSelector_(selector);
  6306. if($core.assert($1)){
  6307. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  6308. };
  6309. lookupClass=$recv(lookupClass)._superclass();
  6310. return lookupClass;
  6311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6312. }));
  6313. return nil;
  6314. }
  6315. catch(e) {if(e===$early)return e[0]; throw e}
  6316. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  6317. },
  6318. args: ["selector"],
  6319. 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",
  6320. referencedClasses: [],
  6321. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  6322. }),
  6323. $globals.Behavior);
  6324. $core.addMethod(
  6325. $core.method({
  6326. selector: "methodAt:",
  6327. protocol: 'accessing',
  6328. fn: function (aString){
  6329. var self=this;
  6330. return $core.withContext(function($ctx1) {
  6331. return $recv(self._methodDictionary())._at_(aString);
  6332. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.Behavior)});
  6333. },
  6334. args: ["aString"],
  6335. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  6336. referencedClasses: [],
  6337. messageSends: ["at:", "methodDictionary"]
  6338. }),
  6339. $globals.Behavior);
  6340. $core.addMethod(
  6341. $core.method({
  6342. selector: "methodDictionary",
  6343. protocol: 'accessing',
  6344. fn: function (){
  6345. var self=this;
  6346. return $core.withContext(function($ctx1) {
  6347. var dict = $globals.HashedCollection._new();
  6348. var methods = self.methods;
  6349. Object.keys(methods).forEach(function(i) {
  6350. if(methods[i].selector) {
  6351. dict._at_put_(methods[i].selector, methods[i]);
  6352. }
  6353. });
  6354. return dict;
  6355. return self;
  6356. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.Behavior)});
  6357. },
  6358. args: [],
  6359. 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'>",
  6360. referencedClasses: [],
  6361. messageSends: []
  6362. }),
  6363. $globals.Behavior);
  6364. $core.addMethod(
  6365. $core.method({
  6366. selector: "methodTemplate",
  6367. protocol: 'accessing',
  6368. fn: function (){
  6369. var self=this;
  6370. return $core.withContext(function($ctx1) {
  6371. var $2,$3,$1,$6,$7,$5,$8,$4;
  6372. return $recv($globals.String)._streamContents_((function(stream){
  6373. return $core.withContext(function($ctx2) {
  6374. $recv(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  6375. $ctx2.sendIdx["nextPutAll:"]=1;
  6376. $2=$recv($globals.String)._lf();
  6377. $ctx2.sendIdx["lf"]=1;
  6378. $3=$recv($globals.String)._tab();
  6379. $ctx2.sendIdx["tab"]=1;
  6380. $1=$recv($2).__comma($3);
  6381. $ctx2.sendIdx[","]=1;
  6382. $recv(stream)._nextPutAll_($1);
  6383. $ctx2.sendIdx["nextPutAll:"]=2;
  6384. $recv(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  6385. $ctx2.sendIdx["nextPutAll:"]=3;
  6386. $6=$recv($globals.String)._lf();
  6387. $ctx2.sendIdx["lf"]=2;
  6388. $7=$recv($globals.String)._lf();
  6389. $ctx2.sendIdx["lf"]=3;
  6390. $5=$recv($6).__comma($7);
  6391. $ctx2.sendIdx[","]=3;
  6392. $8=$recv($globals.String)._tab();
  6393. $ctx2.sendIdx["tab"]=2;
  6394. $4=$recv($5).__comma($8);
  6395. $ctx2.sendIdx[","]=2;
  6396. $recv(stream)._nextPutAll_($4);
  6397. $ctx2.sendIdx["nextPutAll:"]=4;
  6398. $recv(stream)._nextPutAll_("| temporary variable names |");
  6399. $ctx2.sendIdx["nextPutAll:"]=5;
  6400. $recv(stream)._nextPutAll_($recv($recv($globals.String)._lf()).__comma($recv($globals.String)._tab()));
  6401. $ctx2.sendIdx["nextPutAll:"]=6;
  6402. return $recv(stream)._nextPutAll_("statements");
  6403. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6404. }));
  6405. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.Behavior)});
  6406. },
  6407. args: [],
  6408. source: "methodTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: 'messageSelectorAndArgumentNames';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: '\x22comment stating purpose of message\x22';\x0a\x09\x09\x09nextPutAll: String lf, String lf, String tab;\x0a\x09\x09\x09nextPutAll: '| temporary variable names |';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'statements' ]",
  6409. referencedClasses: ["String"],
  6410. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
  6411. }),
  6412. $globals.Behavior);
  6413. $core.addMethod(
  6414. $core.method({
  6415. selector: "methods",
  6416. protocol: 'accessing',
  6417. fn: function (){
  6418. var self=this;
  6419. return $core.withContext(function($ctx1) {
  6420. return $recv(self._methodDictionary())._values();
  6421. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.Behavior)});
  6422. },
  6423. args: [],
  6424. source: "methods\x0a\x09^ self methodDictionary values",
  6425. referencedClasses: [],
  6426. messageSends: ["values", "methodDictionary"]
  6427. }),
  6428. $globals.Behavior);
  6429. $core.addMethod(
  6430. $core.method({
  6431. selector: "methodsInProtocol:",
  6432. protocol: 'accessing',
  6433. fn: function (aString){
  6434. var self=this;
  6435. return $core.withContext(function($ctx1) {
  6436. return $recv(self._methods())._select_((function(each){
  6437. return $core.withContext(function($ctx2) {
  6438. return $recv($recv(each)._protocol()).__eq(aString);
  6439. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6440. }));
  6441. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.Behavior)});
  6442. },
  6443. args: ["aString"],
  6444. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  6445. referencedClasses: [],
  6446. messageSends: ["select:", "methods", "=", "protocol"]
  6447. }),
  6448. $globals.Behavior);
  6449. $core.addMethod(
  6450. $core.method({
  6451. selector: "name",
  6452. protocol: 'accessing',
  6453. fn: function (){
  6454. var self=this;
  6455. return $core.withContext(function($ctx1) {
  6456. return self.className || nil;
  6457. return self;
  6458. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Behavior)});
  6459. },
  6460. args: [],
  6461. source: "name\x0a\x09<inlineJS: 'return self.className || nil'>",
  6462. referencedClasses: [],
  6463. messageSends: []
  6464. }),
  6465. $globals.Behavior);
  6466. $core.addMethod(
  6467. $core.method({
  6468. selector: "new",
  6469. protocol: 'instance creation',
  6470. fn: function (){
  6471. var self=this;
  6472. return $core.withContext(function($ctx1) {
  6473. return $recv(self._basicNew())._initialize();
  6474. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  6475. },
  6476. args: [],
  6477. source: "new\x0a\x09^ self basicNew initialize",
  6478. referencedClasses: [],
  6479. messageSends: ["initialize", "basicNew"]
  6480. }),
  6481. $globals.Behavior);
  6482. $core.addMethod(
  6483. $core.method({
  6484. selector: "organization",
  6485. protocol: 'accessing',
  6486. fn: function (){
  6487. var self=this;
  6488. return $core.withContext(function($ctx1) {
  6489. return self._basicAt_("organization");
  6490. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Behavior)});
  6491. },
  6492. args: [],
  6493. source: "organization\x0a\x09^ self basicAt: 'organization'",
  6494. referencedClasses: [],
  6495. messageSends: ["basicAt:"]
  6496. }),
  6497. $globals.Behavior);
  6498. $core.addMethod(
  6499. $core.method({
  6500. selector: "ownMethods",
  6501. protocol: 'accessing',
  6502. fn: function (){
  6503. var self=this;
  6504. return $core.withContext(function($ctx1) {
  6505. var $1;
  6506. return $recv($recv(self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  6507. return $core.withContext(function($ctx2) {
  6508. return $recv(acc).__comma(self._methodsInProtocol_(each));
  6509. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  6510. })))._sorted_((function(a,b){
  6511. return $core.withContext(function($ctx2) {
  6512. $1=$recv(a)._selector();
  6513. $ctx2.sendIdx["selector"]=1;
  6514. return $recv($1).__lt_eq($recv(b)._selector());
  6515. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  6516. }));
  6517. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.Behavior)});
  6518. },
  6519. args: [],
  6520. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self methodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  6521. referencedClasses: ["OrderedCollection"],
  6522. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
  6523. }),
  6524. $globals.Behavior);
  6525. $core.addMethod(
  6526. $core.method({
  6527. selector: "ownProtocols",
  6528. protocol: 'accessing',
  6529. fn: function (){
  6530. var self=this;
  6531. return $core.withContext(function($ctx1) {
  6532. return $recv(self._protocols())._reject_((function(each){
  6533. return $core.withContext(function($ctx2) {
  6534. return $recv(each)._match_("^\x5c*");
  6535. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6536. }));
  6537. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.Behavior)});
  6538. },
  6539. args: [],
  6540. 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*' ]",
  6541. referencedClasses: [],
  6542. messageSends: ["reject:", "protocols", "match:"]
  6543. }),
  6544. $globals.Behavior);
  6545. $core.addMethod(
  6546. $core.method({
  6547. selector: "packageOfProtocol:",
  6548. protocol: 'accessing',
  6549. fn: function (aString){
  6550. var self=this;
  6551. return $core.withContext(function($ctx1) {
  6552. var $1;
  6553. $1=$recv(aString)._beginsWith_("*");
  6554. if(!$core.assert($1)){
  6555. return self._package();
  6556. };
  6557. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  6558. return nil;
  6559. }));
  6560. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.Behavior)});
  6561. },
  6562. args: ["aString"],
  6563. 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 ]",
  6564. referencedClasses: ["Package"],
  6565. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  6566. }),
  6567. $globals.Behavior);
  6568. $core.addMethod(
  6569. $core.method({
  6570. selector: "protocols",
  6571. protocol: 'accessing',
  6572. fn: function (){
  6573. var self=this;
  6574. return $core.withContext(function($ctx1) {
  6575. return $recv($recv(self._organization())._elements())._sorted();
  6576. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.Behavior)});
  6577. },
  6578. args: [],
  6579. source: "protocols\x0a\x09^ self organization elements sorted",
  6580. referencedClasses: [],
  6581. messageSends: ["sorted", "elements", "organization"]
  6582. }),
  6583. $globals.Behavior);
  6584. $core.addMethod(
  6585. $core.method({
  6586. selector: "protocolsDo:",
  6587. protocol: 'enumerating',
  6588. fn: function (aBlock){
  6589. var self=this;
  6590. var methodsByProtocol;
  6591. return $core.withContext(function($ctx1) {
  6592. methodsByProtocol=$recv($globals.HashedCollection)._new();
  6593. $ctx1.sendIdx["new"]=1;
  6594. $recv(self._methodDictionary())._valuesDo_((function(m){
  6595. return $core.withContext(function($ctx2) {
  6596. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  6597. return $core.withContext(function($ctx3) {
  6598. return $recv($globals.Array)._new();
  6599. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6600. })))._add_(m);
  6601. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  6602. }));
  6603. $recv(self._protocols())._do_((function(protocol){
  6604. return $core.withContext(function($ctx2) {
  6605. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  6606. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  6607. }));
  6608. return self;
  6609. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.Behavior)});
  6610. },
  6611. args: ["aBlock"],
  6612. 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) ]",
  6613. referencedClasses: ["HashedCollection", "Array"],
  6614. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  6615. }),
  6616. $globals.Behavior);
  6617. $core.addMethod(
  6618. $core.method({
  6619. selector: "prototype",
  6620. protocol: 'accessing',
  6621. fn: function (){
  6622. var self=this;
  6623. return $core.withContext(function($ctx1) {
  6624. return self.fn.prototype;
  6625. return self;
  6626. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  6627. },
  6628. args: [],
  6629. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  6630. referencedClasses: [],
  6631. messageSends: []
  6632. }),
  6633. $globals.Behavior);
  6634. $core.addMethod(
  6635. $core.method({
  6636. selector: "recompile",
  6637. protocol: 'compiling',
  6638. fn: function (){
  6639. var self=this;
  6640. return $core.withContext(function($ctx1) {
  6641. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  6642. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.Behavior)});
  6643. },
  6644. args: [],
  6645. source: "recompile\x0a\x09^ Compiler new recompile: self",
  6646. referencedClasses: ["Compiler"],
  6647. messageSends: ["recompile:", "new"]
  6648. }),
  6649. $globals.Behavior);
  6650. $core.addMethod(
  6651. $core.method({
  6652. selector: "removeCompiledMethod:",
  6653. protocol: 'compiling',
  6654. fn: function (aMethod){
  6655. var self=this;
  6656. return $core.withContext(function($ctx1) {
  6657. var $1,$3,$2;
  6658. self._basicRemoveCompiledMethod_(aMethod);
  6659. self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  6660. $1=$recv($globals.SystemAnnouncer)._current();
  6661. $3=$recv($globals.MethodRemoved)._new();
  6662. $recv($3)._method_(aMethod);
  6663. $2=$recv($3)._yourself();
  6664. $recv($1)._announce_($2);
  6665. return self;
  6666. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6667. },
  6668. args: ["aMethod"],
  6669. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self removeProtocolIfEmpty: aMethod protocol.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  6670. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  6671. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  6672. }),
  6673. $globals.Behavior);
  6674. $core.addMethod(
  6675. $core.method({
  6676. selector: "removeProtocolIfEmpty:",
  6677. protocol: 'accessing',
  6678. fn: function (aString){
  6679. var self=this;
  6680. return $core.withContext(function($ctx1) {
  6681. $recv(self._methods())._detect_ifNone_((function(each){
  6682. return $core.withContext(function($ctx2) {
  6683. return $recv($recv(each)._protocol()).__eq(aString);
  6684. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6685. }),(function(){
  6686. return $core.withContext(function($ctx2) {
  6687. return $recv(self._organization())._removeElement_(aString);
  6688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6689. }));
  6690. return self;
  6691. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.Behavior)});
  6692. },
  6693. args: ["aString"],
  6694. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  6695. referencedClasses: [],
  6696. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  6697. }),
  6698. $globals.Behavior);
  6699. $core.addMethod(
  6700. $core.method({
  6701. selector: "selectors",
  6702. protocol: 'accessing',
  6703. fn: function (){
  6704. var self=this;
  6705. return $core.withContext(function($ctx1) {
  6706. return $recv(self._methodDictionary())._keys();
  6707. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.Behavior)});
  6708. },
  6709. args: [],
  6710. source: "selectors\x0a\x09^ self methodDictionary keys",
  6711. referencedClasses: [],
  6712. messageSends: ["keys", "methodDictionary"]
  6713. }),
  6714. $globals.Behavior);
  6715. $core.addMethod(
  6716. $core.method({
  6717. selector: "subclasses",
  6718. protocol: 'accessing',
  6719. fn: function (){
  6720. var self=this;
  6721. return $core.withContext(function($ctx1) {
  6722. self._subclassResponsibility();
  6723. return self;
  6724. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  6725. },
  6726. args: [],
  6727. source: "subclasses\x0a\x09self subclassResponsibility",
  6728. referencedClasses: [],
  6729. messageSends: ["subclassResponsibility"]
  6730. }),
  6731. $globals.Behavior);
  6732. $core.addMethod(
  6733. $core.method({
  6734. selector: "superclass",
  6735. protocol: 'accessing',
  6736. fn: function (){
  6737. var self=this;
  6738. return $core.withContext(function($ctx1) {
  6739. return self.superclass;
  6740. return self;
  6741. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  6742. },
  6743. args: [],
  6744. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  6745. referencedClasses: [],
  6746. messageSends: []
  6747. }),
  6748. $globals.Behavior);
  6749. $core.addMethod(
  6750. $core.method({
  6751. selector: "theMetaClass",
  6752. protocol: 'accessing',
  6753. fn: function (){
  6754. var self=this;
  6755. return $core.withContext(function($ctx1) {
  6756. self._subclassResponsibility();
  6757. return self;
  6758. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  6759. },
  6760. args: [],
  6761. source: "theMetaClass\x0a\x09self subclassResponsibility",
  6762. referencedClasses: [],
  6763. messageSends: ["subclassResponsibility"]
  6764. }),
  6765. $globals.Behavior);
  6766. $core.addMethod(
  6767. $core.method({
  6768. selector: "theNonMetaClass",
  6769. protocol: 'accessing',
  6770. fn: function (){
  6771. var self=this;
  6772. return $core.withContext(function($ctx1) {
  6773. self._subclassResponsibility();
  6774. return self;
  6775. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  6776. },
  6777. args: [],
  6778. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  6779. referencedClasses: [],
  6780. messageSends: ["subclassResponsibility"]
  6781. }),
  6782. $globals.Behavior);
  6783. $core.addMethod(
  6784. $core.method({
  6785. selector: "withAllSubclasses",
  6786. protocol: 'accessing',
  6787. fn: function (){
  6788. var self=this;
  6789. return $core.withContext(function($ctx1) {
  6790. var $1;
  6791. $1=$recv($globals.Array)._with_(self);
  6792. $recv($1)._addAll_(self._allSubclasses());
  6793. return $recv($1)._yourself();
  6794. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  6795. },
  6796. args: [],
  6797. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  6798. referencedClasses: ["Array"],
  6799. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  6800. }),
  6801. $globals.Behavior);
  6802. $core.addClass('Class', $globals.Behavior, [], 'Kernel-Classes');
  6803. $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.";
  6804. $core.addMethod(
  6805. $core.method({
  6806. selector: "asJavascript",
  6807. protocol: 'converting',
  6808. fn: function (){
  6809. var self=this;
  6810. return $core.withContext(function($ctx1) {
  6811. return "$globals.".__comma(self._name());
  6812. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Class)});
  6813. },
  6814. args: [],
  6815. source: "asJavascript\x0a\x09^ '$globals.', self name",
  6816. referencedClasses: [],
  6817. messageSends: [",", "name"]
  6818. }),
  6819. $globals.Class);
  6820. $core.addMethod(
  6821. $core.method({
  6822. selector: "browse",
  6823. protocol: 'browsing',
  6824. fn: function (){
  6825. var self=this;
  6826. return $core.withContext(function($ctx1) {
  6827. $recv($globals.Finder)._findClass_(self);
  6828. return self;
  6829. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)});
  6830. },
  6831. args: [],
  6832. source: "browse\x0a\x09Finder findClass: self",
  6833. referencedClasses: ["Finder"],
  6834. messageSends: ["findClass:"]
  6835. }),
  6836. $globals.Class);
  6837. $core.addMethod(
  6838. $core.method({
  6839. selector: "category",
  6840. protocol: 'accessing',
  6841. fn: function (){
  6842. var self=this;
  6843. return $core.withContext(function($ctx1) {
  6844. var $1,$receiver;
  6845. $1=self._package();
  6846. $ctx1.sendIdx["package"]=1;
  6847. if(($receiver = $1) == null || $receiver.isNil){
  6848. return "Unclassified";
  6849. } else {
  6850. return $recv(self._package())._name();
  6851. };
  6852. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)});
  6853. },
  6854. args: [],
  6855. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  6856. referencedClasses: [],
  6857. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  6858. }),
  6859. $globals.Class);
  6860. $core.addMethod(
  6861. $core.method({
  6862. selector: "classTag",
  6863. protocol: 'accessing',
  6864. fn: function (){
  6865. var self=this;
  6866. return "class";
  6867. },
  6868. args: [],
  6869. 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'",
  6870. referencedClasses: [],
  6871. messageSends: []
  6872. }),
  6873. $globals.Class);
  6874. $core.addMethod(
  6875. $core.method({
  6876. selector: "definition",
  6877. protocol: 'accessing',
  6878. fn: function (){
  6879. var self=this;
  6880. return $core.withContext(function($ctx1) {
  6881. var $2,$3,$1,$4,$5;
  6882. return $recv($globals.String)._streamContents_((function(stream){
  6883. return $core.withContext(function($ctx2) {
  6884. $recv(stream)._nextPutAll_($recv(self._superclass())._asString());
  6885. $ctx2.sendIdx["nextPutAll:"]=1;
  6886. $recv(stream)._nextPutAll_(" subclass: #");
  6887. $ctx2.sendIdx["nextPutAll:"]=2;
  6888. $recv(stream)._nextPutAll_(self._name());
  6889. $ctx2.sendIdx["nextPutAll:"]=3;
  6890. $2=$recv($globals.String)._lf();
  6891. $ctx2.sendIdx["lf"]=1;
  6892. $3=$recv($globals.String)._tab();
  6893. $ctx2.sendIdx["tab"]=1;
  6894. $1=$recv($2).__comma($3);
  6895. $ctx2.sendIdx[","]=1;
  6896. $recv(stream)._nextPutAll_($1);
  6897. $ctx2.sendIdx["nextPutAll:"]=4;
  6898. $4=$recv(stream)._nextPutAll_("instanceVariableNames: '");
  6899. $ctx2.sendIdx["nextPutAll:"]=5;
  6900. $4;
  6901. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6902. return $core.withContext(function($ctx3) {
  6903. return $recv(stream)._nextPutAll_(each);
  6904. $ctx3.sendIdx["nextPutAll:"]=6;
  6905. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6906. }),(function(){
  6907. return $core.withContext(function($ctx3) {
  6908. return $recv(stream)._nextPutAll_(" ");
  6909. $ctx3.sendIdx["nextPutAll:"]=7;
  6910. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6911. }));
  6912. $5=$recv("'".__comma($recv($globals.String)._lf())).__comma($recv($globals.String)._tab());
  6913. $ctx2.sendIdx[","]=2;
  6914. $recv(stream)._nextPutAll_($5);
  6915. $ctx2.sendIdx["nextPutAll:"]=8;
  6916. $recv(stream)._nextPutAll_("package: '");
  6917. $ctx2.sendIdx["nextPutAll:"]=9;
  6918. $recv(stream)._nextPutAll_(self._category());
  6919. $ctx2.sendIdx["nextPutAll:"]=10;
  6920. return $recv(stream)._nextPutAll_("'");
  6921. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6922. }));
  6923. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  6924. },
  6925. args: [],
  6926. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self superclass asString;\x0a\x09\x09\x09nextPutAll: ' subclass: #';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self category;\x0a\x09\x09\x09nextPutAll: '''' ]",
  6927. referencedClasses: ["String"],
  6928. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"]
  6929. }),
  6930. $globals.Class);
  6931. $core.addMethod(
  6932. $core.method({
  6933. selector: "isClass",
  6934. protocol: 'testing',
  6935. fn: function (){
  6936. var self=this;
  6937. return true;
  6938. },
  6939. args: [],
  6940. source: "isClass\x0a\x09^ true",
  6941. referencedClasses: [],
  6942. messageSends: []
  6943. }),
  6944. $globals.Class);
  6945. $core.addMethod(
  6946. $core.method({
  6947. selector: "package",
  6948. protocol: 'accessing',
  6949. fn: function (){
  6950. var self=this;
  6951. return $core.withContext(function($ctx1) {
  6952. return self._basicAt_("pkg");
  6953. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)});
  6954. },
  6955. args: [],
  6956. source: "package\x0a\x09^ self basicAt: 'pkg'",
  6957. referencedClasses: [],
  6958. messageSends: ["basicAt:"]
  6959. }),
  6960. $globals.Class);
  6961. $core.addMethod(
  6962. $core.method({
  6963. selector: "package:",
  6964. protocol: 'accessing',
  6965. fn: function (aPackage){
  6966. var self=this;
  6967. var oldPackage;
  6968. return $core.withContext(function($ctx1) {
  6969. var $2,$1,$3,$4,$6,$5;
  6970. $2=self._package();
  6971. $ctx1.sendIdx["package"]=1;
  6972. $1=$recv($2).__eq(aPackage);
  6973. if($core.assert($1)){
  6974. return self;
  6975. };
  6976. oldPackage=self._package();
  6977. self._basicAt_put_("pkg",aPackage);
  6978. $3=$recv(oldPackage)._organization();
  6979. $ctx1.sendIdx["organization"]=1;
  6980. $recv($3)._removeElement_(self);
  6981. $recv($recv(aPackage)._organization())._addElement_(self);
  6982. $4=$recv($globals.SystemAnnouncer)._current();
  6983. $6=$recv($globals.ClassMoved)._new();
  6984. $recv($6)._theClass_(self);
  6985. $recv($6)._oldPackage_(oldPackage);
  6986. $5=$recv($6)._yourself();
  6987. $recv($4)._announce_($5);
  6988. return self;
  6989. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)});
  6990. },
  6991. args: ["aPackage"],
  6992. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  6993. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  6994. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  6995. }),
  6996. $globals.Class);
  6997. $core.addMethod(
  6998. $core.method({
  6999. selector: "printOn:",
  7000. protocol: 'printing',
  7001. fn: function (aStream){
  7002. var self=this;
  7003. return $core.withContext(function($ctx1) {
  7004. $recv(aStream)._nextPutAll_(self._name());
  7005. return self;
  7006. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Class)});
  7007. },
  7008. args: ["aStream"],
  7009. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  7010. referencedClasses: [],
  7011. messageSends: ["nextPutAll:", "name"]
  7012. }),
  7013. $globals.Class);
  7014. $core.addMethod(
  7015. $core.method({
  7016. selector: "rename:",
  7017. protocol: 'accessing',
  7018. fn: function (aString){
  7019. var self=this;
  7020. return $core.withContext(function($ctx1) {
  7021. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  7022. return self;
  7023. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  7024. },
  7025. args: ["aString"],
  7026. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  7027. referencedClasses: ["ClassBuilder"],
  7028. messageSends: ["renameClass:to:", "new"]
  7029. }),
  7030. $globals.Class);
  7031. $core.addMethod(
  7032. $core.method({
  7033. selector: "subclass:instanceVariableNames:",
  7034. protocol: 'class creation',
  7035. fn: function (aString,anotherString){
  7036. var self=this;
  7037. return $core.withContext(function($ctx1) {
  7038. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  7039. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)});
  7040. },
  7041. args: ["aString", "anotherString"],
  7042. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  7043. referencedClasses: [],
  7044. messageSends: ["subclass:instanceVariableNames:package:"]
  7045. }),
  7046. $globals.Class);
  7047. $core.addMethod(
  7048. $core.method({
  7049. selector: "subclass:instanceVariableNames:category:",
  7050. protocol: 'class creation',
  7051. fn: function (aString,aString2,aString3){
  7052. var self=this;
  7053. return $core.withContext(function($ctx1) {
  7054. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  7055. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  7056. },
  7057. args: ["aString", "aString2", "aString3"],
  7058. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  7059. referencedClasses: [],
  7060. messageSends: ["subclass:instanceVariableNames:package:"]
  7061. }),
  7062. $globals.Class);
  7063. $core.addMethod(
  7064. $core.method({
  7065. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  7066. protocol: 'class creation',
  7067. fn: function (aString,aString2,classVars,pools,aString3){
  7068. var self=this;
  7069. return $core.withContext(function($ctx1) {
  7070. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  7071. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  7072. },
  7073. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  7074. 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",
  7075. referencedClasses: [],
  7076. messageSends: ["subclass:instanceVariableNames:package:"]
  7077. }),
  7078. $globals.Class);
  7079. $core.addMethod(
  7080. $core.method({
  7081. selector: "subclass:instanceVariableNames:package:",
  7082. protocol: 'class creation',
  7083. fn: function (aString,aString2,aString3){
  7084. var self=this;
  7085. return $core.withContext(function($ctx1) {
  7086. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  7087. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  7088. },
  7089. args: ["aString", "aString2", "aString3"],
  7090. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  7091. referencedClasses: ["ClassBuilder"],
  7092. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  7093. }),
  7094. $globals.Class);
  7095. $core.addMethod(
  7096. $core.method({
  7097. selector: "subclasses",
  7098. protocol: 'accessing',
  7099. fn: function (){
  7100. var self=this;
  7101. return $core.withContext(function($ctx1) {
  7102. return self.subclasses._copy();
  7103. return self;
  7104. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  7105. },
  7106. args: [],
  7107. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  7108. referencedClasses: [],
  7109. messageSends: []
  7110. }),
  7111. $globals.Class);
  7112. $core.addMethod(
  7113. $core.method({
  7114. selector: "theMetaClass",
  7115. protocol: 'accessing',
  7116. fn: function (){
  7117. var self=this;
  7118. return $core.withContext(function($ctx1) {
  7119. return self._class();
  7120. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  7121. },
  7122. args: [],
  7123. source: "theMetaClass\x0a\x09^ self class",
  7124. referencedClasses: [],
  7125. messageSends: ["class"]
  7126. }),
  7127. $globals.Class);
  7128. $core.addMethod(
  7129. $core.method({
  7130. selector: "theNonMetaClass",
  7131. protocol: 'accessing',
  7132. fn: function (){
  7133. var self=this;
  7134. return self;
  7135. },
  7136. args: [],
  7137. source: "theNonMetaClass\x0a\x09^ self",
  7138. referencedClasses: [],
  7139. messageSends: []
  7140. }),
  7141. $globals.Class);
  7142. $core.addClass('Metaclass', $globals.Behavior, [], 'Kernel-Classes');
  7143. $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.";
  7144. $core.addMethod(
  7145. $core.method({
  7146. selector: "asJavascript",
  7147. protocol: 'converting',
  7148. fn: function (){
  7149. var self=this;
  7150. return $core.withContext(function($ctx1) {
  7151. var $1;
  7152. $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass");
  7153. $ctx1.sendIdx[","]=1;
  7154. return $1;
  7155. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Metaclass)});
  7156. },
  7157. args: [],
  7158. source: "asJavascript\x0a\x09^ '$globals.', self instanceClass name, '.klass'",
  7159. referencedClasses: [],
  7160. messageSends: [",", "name", "instanceClass"]
  7161. }),
  7162. $globals.Metaclass);
  7163. $core.addMethod(
  7164. $core.method({
  7165. selector: "definition",
  7166. protocol: 'accessing',
  7167. fn: function (){
  7168. var self=this;
  7169. return $core.withContext(function($ctx1) {
  7170. var $1;
  7171. return $recv($globals.String)._streamContents_((function(stream){
  7172. return $core.withContext(function($ctx2) {
  7173. $recv(stream)._nextPutAll_(self._asString());
  7174. $ctx2.sendIdx["nextPutAll:"]=1;
  7175. $1=$recv(stream)._nextPutAll_(" instanceVariableNames: '");
  7176. $ctx2.sendIdx["nextPutAll:"]=2;
  7177. $1;
  7178. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  7179. return $core.withContext(function($ctx3) {
  7180. return $recv(stream)._nextPutAll_(each);
  7181. $ctx3.sendIdx["nextPutAll:"]=3;
  7182. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  7183. }),(function(){
  7184. return $core.withContext(function($ctx3) {
  7185. return $recv(stream)._nextPutAll_(" ");
  7186. $ctx3.sendIdx["nextPutAll:"]=4;
  7187. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  7188. }));
  7189. return $recv(stream)._nextPutAll_("'");
  7190. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  7191. }));
  7192. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  7193. },
  7194. args: [],
  7195. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self asString;\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]",
  7196. referencedClasses: ["String"],
  7197. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"]
  7198. }),
  7199. $globals.Metaclass);
  7200. $core.addMethod(
  7201. $core.method({
  7202. selector: "instanceClass",
  7203. protocol: 'accessing',
  7204. fn: function (){
  7205. var self=this;
  7206. return $core.withContext(function($ctx1) {
  7207. return self.instanceClass;
  7208. return self;
  7209. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  7210. },
  7211. args: [],
  7212. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  7213. referencedClasses: [],
  7214. messageSends: []
  7215. }),
  7216. $globals.Metaclass);
  7217. $core.addMethod(
  7218. $core.method({
  7219. selector: "instanceVariableNames:",
  7220. protocol: 'accessing',
  7221. fn: function (aCollection){
  7222. var self=this;
  7223. return $core.withContext(function($ctx1) {
  7224. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  7225. return self;
  7226. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  7227. },
  7228. args: ["aCollection"],
  7229. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  7230. referencedClasses: ["ClassBuilder"],
  7231. messageSends: ["class:instanceVariableNames:", "new"]
  7232. }),
  7233. $globals.Metaclass);
  7234. $core.addMethod(
  7235. $core.method({
  7236. selector: "isMetaclass",
  7237. protocol: 'testing',
  7238. fn: function (){
  7239. var self=this;
  7240. return true;
  7241. },
  7242. args: [],
  7243. source: "isMetaclass\x0a\x09^ true",
  7244. referencedClasses: [],
  7245. messageSends: []
  7246. }),
  7247. $globals.Metaclass);
  7248. $core.addMethod(
  7249. $core.method({
  7250. selector: "package",
  7251. protocol: 'accessing',
  7252. fn: function (){
  7253. var self=this;
  7254. return $core.withContext(function($ctx1) {
  7255. return $recv(self._instanceClass())._package();
  7256. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  7257. },
  7258. args: [],
  7259. source: "package\x0a\x09^ self instanceClass package",
  7260. referencedClasses: [],
  7261. messageSends: ["package", "instanceClass"]
  7262. }),
  7263. $globals.Metaclass);
  7264. $core.addMethod(
  7265. $core.method({
  7266. selector: "printOn:",
  7267. protocol: 'printing',
  7268. fn: function (aStream){
  7269. var self=this;
  7270. return $core.withContext(function($ctx1) {
  7271. $recv(aStream)._nextPutAll_($recv(self._instanceClass())._name());
  7272. $ctx1.sendIdx["nextPutAll:"]=1;
  7273. $recv(aStream)._nextPutAll_(" class");
  7274. return self;
  7275. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Metaclass)});
  7276. },
  7277. args: ["aStream"],
  7278. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  7279. referencedClasses: [],
  7280. messageSends: ["nextPutAll:", "name", "instanceClass"]
  7281. }),
  7282. $globals.Metaclass);
  7283. $core.addMethod(
  7284. $core.method({
  7285. selector: "subclasses",
  7286. protocol: 'accessing',
  7287. fn: function (){
  7288. var self=this;
  7289. return $core.withContext(function($ctx1) {
  7290. return $core.metaSubclasses(self);
  7291. return self;
  7292. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  7293. },
  7294. args: [],
  7295. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  7296. referencedClasses: [],
  7297. messageSends: []
  7298. }),
  7299. $globals.Metaclass);
  7300. $core.addMethod(
  7301. $core.method({
  7302. selector: "theMetaClass",
  7303. protocol: 'accessing',
  7304. fn: function (){
  7305. var self=this;
  7306. return self;
  7307. },
  7308. args: [],
  7309. source: "theMetaClass\x0a\x09^ self",
  7310. referencedClasses: [],
  7311. messageSends: []
  7312. }),
  7313. $globals.Metaclass);
  7314. $core.addMethod(
  7315. $core.method({
  7316. selector: "theNonMetaClass",
  7317. protocol: 'accessing',
  7318. fn: function (){
  7319. var self=this;
  7320. return $core.withContext(function($ctx1) {
  7321. return self._instanceClass();
  7322. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  7323. },
  7324. args: [],
  7325. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  7326. referencedClasses: [],
  7327. messageSends: ["instanceClass"]
  7328. }),
  7329. $globals.Metaclass);
  7330. $core.addClass('ClassBuilder', $globals.Object, [], 'Kernel-Classes');
  7331. $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:`.";
  7332. $core.addMethod(
  7333. $core.method({
  7334. selector: "addSubclassOf:named:instanceVariableNames:package:",
  7335. protocol: 'class definition',
  7336. fn: function (aClass,className,aCollection,packageName){
  7337. var self=this;
  7338. var theClass,thePackage;
  7339. return $core.withContext(function($ctx1) {
  7340. var $1,$2,$receiver;
  7341. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  7342. thePackage=$recv($globals.Package)._named_(packageName);
  7343. $1=theClass;
  7344. if(($receiver = $1) == null || $receiver.isNil){
  7345. $1;
  7346. } else {
  7347. $recv(theClass)._package_(thePackage);
  7348. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  7349. if(!$core.assert($2)){
  7350. return self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  7351. };
  7352. };
  7353. return self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  7354. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  7355. },
  7356. args: ["aClass", "className", "aCollection", "packageName"],
  7357. 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 ifFalse: [\x0a\x09\x09\x09^ 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",
  7358. referencedClasses: ["Smalltalk", "Package"],
  7359. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"]
  7360. }),
  7361. $globals.ClassBuilder);
  7362. $core.addMethod(
  7363. $core.method({
  7364. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  7365. protocol: 'private',
  7366. fn: function (aClass,aString,aCollection,packageName){
  7367. var self=this;
  7368. return $core.withContext(function($ctx1) {
  7369. return $core.addClass(aString, aClass, aCollection, packageName);
  7370. ;
  7371. return self;
  7372. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  7373. },
  7374. args: ["aClass", "aString", "aCollection", "packageName"],
  7375. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  7376. referencedClasses: [],
  7377. messageSends: []
  7378. }),
  7379. $globals.ClassBuilder);
  7380. $core.addMethod(
  7381. $core.method({
  7382. selector: "basicClass:instanceVariableNames:",
  7383. protocol: 'private',
  7384. fn: function (aClass,aString){
  7385. var self=this;
  7386. return $core.withContext(function($ctx1) {
  7387. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  7388. return self;
  7389. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7390. },
  7391. args: ["aClass", "aString"],
  7392. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  7393. referencedClasses: [],
  7394. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  7395. }),
  7396. $globals.ClassBuilder);
  7397. $core.addMethod(
  7398. $core.method({
  7399. selector: "basicClass:instanceVariables:",
  7400. protocol: 'private',
  7401. fn: function (aClass,aCollection){
  7402. var self=this;
  7403. return $core.withContext(function($ctx1) {
  7404. var $1;
  7405. $1=$recv(aClass)._isMetaclass();
  7406. if(!$core.assert($1)){
  7407. self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  7408. };
  7409. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  7410. return self;
  7411. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  7412. },
  7413. args: ["aClass", "aCollection"],
  7414. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  7415. referencedClasses: [],
  7416. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  7417. }),
  7418. $globals.ClassBuilder);
  7419. $core.addMethod(
  7420. $core.method({
  7421. selector: "basicRemoveClass:",
  7422. protocol: 'private',
  7423. fn: function (aClass){
  7424. var self=this;
  7425. return $core.withContext(function($ctx1) {
  7426. $core.removeClass(aClass);
  7427. return self;
  7428. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  7429. },
  7430. args: ["aClass"],
  7431. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  7432. referencedClasses: [],
  7433. messageSends: []
  7434. }),
  7435. $globals.ClassBuilder);
  7436. $core.addMethod(
  7437. $core.method({
  7438. selector: "basicRenameClass:to:",
  7439. protocol: 'private',
  7440. fn: function (aClass,aString){
  7441. var self=this;
  7442. return $core.withContext(function($ctx1) {
  7443. $globals[aString] = aClass;
  7444. delete $globals[aClass.className];
  7445. aClass.className = aString;
  7446. ;
  7447. return self;
  7448. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7449. },
  7450. args: ["aClass", "aString"],
  7451. source: "basicRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09'>",
  7452. referencedClasses: [],
  7453. messageSends: []
  7454. }),
  7455. $globals.ClassBuilder);
  7456. $core.addMethod(
  7457. $core.method({
  7458. selector: "basicSwapClassNames:with:",
  7459. protocol: 'private',
  7460. fn: function (aClass,anotherClass){
  7461. var self=this;
  7462. return $core.withContext(function($ctx1) {
  7463. var tmp = aClass.className;
  7464. aClass.className = anotherClass.className;
  7465. anotherClass.className = tmp;
  7466. ;
  7467. return self;
  7468. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7469. },
  7470. args: ["aClass", "anotherClass"],
  7471. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<inlineJS: '\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09'>",
  7472. referencedClasses: [],
  7473. messageSends: []
  7474. }),
  7475. $globals.ClassBuilder);
  7476. $core.addMethod(
  7477. $core.method({
  7478. selector: "class:instanceVariableNames:",
  7479. protocol: 'class definition',
  7480. fn: function (aClass,ivarNames){
  7481. var self=this;
  7482. return $core.withContext(function($ctx1) {
  7483. var $1,$3,$2;
  7484. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  7485. $1=$recv($globals.SystemAnnouncer)._current();
  7486. $3=$recv($globals.ClassDefinitionChanged)._new();
  7487. $recv($3)._theClass_(aClass);
  7488. $2=$recv($3)._yourself();
  7489. $recv($1)._announce_($2);
  7490. return self;
  7491. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  7492. },
  7493. args: ["aClass", "ivarNames"],
  7494. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  7495. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  7496. messageSends: ["basicClass:instanceVariableNames:", "announce:", "current", "theClass:", "new", "yourself"]
  7497. }),
  7498. $globals.ClassBuilder);
  7499. $core.addMethod(
  7500. $core.method({
  7501. selector: "copyClass:named:",
  7502. protocol: 'copying',
  7503. fn: function (aClass,className){
  7504. var self=this;
  7505. var newClass;
  7506. return $core.withContext(function($ctx1) {
  7507. var $1,$3,$2;
  7508. newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7509. self._copyClass_to_(aClass,newClass);
  7510. $1=$recv($globals.SystemAnnouncer)._current();
  7511. $3=$recv($globals.ClassAdded)._new();
  7512. $recv($3)._theClass_(newClass);
  7513. $2=$recv($3)._yourself();
  7514. $recv($1)._announce_($2);
  7515. return newClass;
  7516. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  7517. },
  7518. args: ["aClass", "className"],
  7519. 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",
  7520. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7521. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  7522. }),
  7523. $globals.ClassBuilder);
  7524. $core.addMethod(
  7525. $core.method({
  7526. selector: "copyClass:to:",
  7527. protocol: 'copying',
  7528. fn: function (aClass,anotherClass){
  7529. var self=this;
  7530. return $core.withContext(function($ctx1) {
  7531. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  7532. $recv(anotherClass)._comment_($recv(aClass)._comment());
  7533. $1=$recv(aClass)._methodDictionary();
  7534. $ctx1.sendIdx["methodDictionary"]=1;
  7535. $recv($1)._valuesDo_((function(each){
  7536. return $core.withContext(function($ctx2) {
  7537. $2=$recv($globals.Compiler)._new();
  7538. $ctx2.sendIdx["new"]=1;
  7539. $3=$recv(each)._source();
  7540. $ctx2.sendIdx["source"]=1;
  7541. $4=$recv(each)._protocol();
  7542. $ctx2.sendIdx["protocol"]=1;
  7543. return $recv($2)._install_forClass_protocol_($3,anotherClass,$4);
  7544. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  7545. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7546. }));
  7547. $ctx1.sendIdx["valuesDo:"]=1;
  7548. $5=$recv(anotherClass)._class();
  7549. $ctx1.sendIdx["class"]=1;
  7550. $7=$recv(aClass)._class();
  7551. $ctx1.sendIdx["class"]=2;
  7552. $6=$recv($7)._instanceVariableNames();
  7553. self._basicClass_instanceVariables_($5,$6);
  7554. $9=$recv(aClass)._class();
  7555. $ctx1.sendIdx["class"]=3;
  7556. $8=$recv($9)._methodDictionary();
  7557. $recv($8)._valuesDo_((function(each){
  7558. return $core.withContext(function($ctx2) {
  7559. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_($recv(each)._source(),$recv(anotherClass)._class(),$recv(each)._protocol());
  7560. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7561. }));
  7562. return self;
  7563. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7564. },
  7565. args: ["aClass", "anotherClass"],
  7566. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ]",
  7567. referencedClasses: ["Compiler"],
  7568. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  7569. }),
  7570. $globals.ClassBuilder);
  7571. $core.addMethod(
  7572. $core.method({
  7573. selector: "installMethod:forClass:protocol:",
  7574. protocol: 'method definition',
  7575. fn: function (aCompiledMethod,aBehavior,aString){
  7576. var self=this;
  7577. return $core.withContext(function($ctx1) {
  7578. $recv(aCompiledMethod)._protocol_(aString);
  7579. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  7580. return aCompiledMethod;
  7581. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  7582. },
  7583. args: ["aCompiledMethod", "aBehavior", "aString"],
  7584. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  7585. referencedClasses: [],
  7586. messageSends: ["protocol:", "addCompiledMethod:"]
  7587. }),
  7588. $globals.ClassBuilder);
  7589. $core.addMethod(
  7590. $core.method({
  7591. selector: "instanceVariableNamesFor:",
  7592. protocol: 'accessing',
  7593. fn: function (aString){
  7594. var self=this;
  7595. return $core.withContext(function($ctx1) {
  7596. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  7597. return $core.withContext(function($ctx2) {
  7598. return $recv(each)._isEmpty();
  7599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7600. }));
  7601. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  7602. },
  7603. args: ["aString"],
  7604. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  7605. referencedClasses: [],
  7606. messageSends: ["reject:", "tokenize:", "isEmpty"]
  7607. }),
  7608. $globals.ClassBuilder);
  7609. $core.addMethod(
  7610. $core.method({
  7611. selector: "migrateClass:superclass:",
  7612. protocol: 'class migration',
  7613. fn: function (aClass,anotherClass){
  7614. var self=this;
  7615. return $core.withContext(function($ctx1) {
  7616. var $1;
  7617. $1=$recv(aClass)._name();
  7618. $ctx1.sendIdx["name"]=1;
  7619. return self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7620. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7621. },
  7622. args: ["aClass", "anotherClass"],
  7623. 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",
  7624. referencedClasses: [],
  7625. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  7626. }),
  7627. $globals.ClassBuilder);
  7628. $core.addMethod(
  7629. $core.method({
  7630. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  7631. protocol: 'class migration',
  7632. fn: function (className,aClass,aCollection,packageName){
  7633. var self=this;
  7634. var oldClass,newClass,tmp;
  7635. return $core.withContext(function($ctx1) {
  7636. var $1,$2,$4,$3;
  7637. tmp="new*".__comma(className);
  7638. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  7639. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  7640. self._basicSwapClassNames_with_(oldClass,newClass);
  7641. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  7642. $recv((function(){
  7643. return $core.withContext(function($ctx2) {
  7644. return self._copyClass_to_(oldClass,newClass);
  7645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7646. }))._on_do_($globals.Error,(function(exception){
  7647. return $core.withContext(function($ctx2) {
  7648. self._basicSwapClassNames_with_(oldClass,newClass);
  7649. $1=self._basicRemoveClass_(newClass);
  7650. $ctx2.sendIdx["basicRemoveClass:"]=1;
  7651. $1;
  7652. return $recv(exception)._resignal();
  7653. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  7654. }));
  7655. self._rawRenameClass_to_(oldClass,tmp);
  7656. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  7657. self._rawRenameClass_to_(newClass,className);
  7658. $recv($recv(oldClass)._subclasses())._do_((function(each){
  7659. return $core.withContext(function($ctx2) {
  7660. return self._migrateClass_superclass_(each,newClass);
  7661. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7662. }));
  7663. self._basicRemoveClass_(oldClass);
  7664. $2=$recv($globals.SystemAnnouncer)._current();
  7665. $4=$recv($globals.ClassMigrated)._new();
  7666. $recv($4)._theClass_(newClass);
  7667. $recv($4)._oldClass_(oldClass);
  7668. $3=$recv($4)._yourself();
  7669. $recv($2)._announce_($3);
  7670. return newClass;
  7671. }, 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)});
  7672. },
  7673. args: ["className", "aClass", "aCollection", "packageName"],
  7674. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception resignal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  7675. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  7676. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "resignal", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  7677. }),
  7678. $globals.ClassBuilder);
  7679. $core.addMethod(
  7680. $core.method({
  7681. selector: "rawRenameClass:to:",
  7682. protocol: 'private',
  7683. fn: function (aClass,aString){
  7684. var self=this;
  7685. return $core.withContext(function($ctx1) {
  7686. $globals[aString] = aClass;
  7687. ;
  7688. return self;
  7689. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7690. },
  7691. args: ["aClass", "aString"],
  7692. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  7693. referencedClasses: [],
  7694. messageSends: []
  7695. }),
  7696. $globals.ClassBuilder);
  7697. $core.addMethod(
  7698. $core.method({
  7699. selector: "renameClass:to:",
  7700. protocol: 'class migration',
  7701. fn: function (aClass,className){
  7702. var self=this;
  7703. return $core.withContext(function($ctx1) {
  7704. var $1,$3,$2;
  7705. self._basicRenameClass_to_(aClass,className);
  7706. $recv(aClass)._recompile();
  7707. $1=$recv($globals.SystemAnnouncer)._current();
  7708. $3=$recv($globals.ClassRenamed)._new();
  7709. $recv($3)._theClass_(aClass);
  7710. $2=$recv($3)._yourself();
  7711. $recv($1)._announce_($2);
  7712. return self;
  7713. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7714. },
  7715. args: ["aClass", "className"],
  7716. 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)",
  7717. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  7718. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  7719. }),
  7720. $globals.ClassBuilder);
  7721. $core.addMethod(
  7722. $core.method({
  7723. selector: "setupClass:",
  7724. protocol: 'public',
  7725. fn: function (aClass){
  7726. var self=this;
  7727. return $core.withContext(function($ctx1) {
  7728. self._deprecatedAPI_("Classes are now auto-inited.");
  7729. return self;
  7730. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  7731. },
  7732. args: ["aClass"],
  7733. source: "setupClass: aClass\x0a\x09self deprecatedAPI: 'Classes are now auto-inited.'",
  7734. referencedClasses: [],
  7735. messageSends: ["deprecatedAPI:"]
  7736. }),
  7737. $globals.ClassBuilder);
  7738. $core.addMethod(
  7739. $core.method({
  7740. selector: "superclass:subclass:",
  7741. protocol: 'class definition',
  7742. fn: function (aClass,className){
  7743. var self=this;
  7744. return $core.withContext(function($ctx1) {
  7745. return self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  7746. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7747. },
  7748. args: ["aClass", "className"],
  7749. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  7750. referencedClasses: [],
  7751. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  7752. }),
  7753. $globals.ClassBuilder);
  7754. $core.addMethod(
  7755. $core.method({
  7756. selector: "superclass:subclass:instanceVariableNames:package:",
  7757. protocol: 'class definition',
  7758. fn: function (aClass,className,ivarNames,packageName){
  7759. var self=this;
  7760. var newClass;
  7761. return $core.withContext(function($ctx1) {
  7762. var $1,$2,$3,$5,$4,$receiver;
  7763. $1=self._instanceVariableNamesFor_(ivarNames);
  7764. if(($receiver = packageName) == null || $receiver.isNil){
  7765. $2="unclassified";
  7766. } else {
  7767. $2=packageName;
  7768. };
  7769. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  7770. $3=$recv($globals.SystemAnnouncer)._current();
  7771. $5=$recv($globals.ClassAdded)._new();
  7772. $recv($5)._theClass_(newClass);
  7773. $4=$recv($5)._yourself();
  7774. $recv($3)._announce_($4);
  7775. return newClass;
  7776. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  7777. },
  7778. args: ["aClass", "className", "ivarNames", "packageName"],
  7779. source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: [ 'unclassified' ]).\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  7780. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7781. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  7782. }),
  7783. $globals.ClassBuilder);
  7784. $core.addClass('ClassSorterNode', $globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  7785. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  7786. $core.addMethod(
  7787. $core.method({
  7788. selector: "getNodesFrom:",
  7789. protocol: 'accessing',
  7790. fn: function (aCollection){
  7791. var self=this;
  7792. var children,others;
  7793. return $core.withContext(function($ctx1) {
  7794. var $1;
  7795. children=[];
  7796. others=[];
  7797. $recv(aCollection)._do_((function(each){
  7798. return $core.withContext(function($ctx2) {
  7799. $1=$recv($recv(each)._superclass()).__eq(self._theClass());
  7800. if($core.assert($1)){
  7801. return $recv(children)._add_(each);
  7802. $ctx2.sendIdx["add:"]=1;
  7803. } else {
  7804. return $recv(others)._add_(each);
  7805. };
  7806. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7807. }));
  7808. self["@nodes"]=$recv(children)._collect_((function(each){
  7809. return $core.withContext(function($ctx2) {
  7810. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv(self._level()).__plus((1)));
  7811. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  7812. }));
  7813. return self;
  7814. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  7815. },
  7816. args: ["aCollection"],
  7817. 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 ]",
  7818. referencedClasses: ["ClassSorterNode"],
  7819. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  7820. }),
  7821. $globals.ClassSorterNode);
  7822. $core.addMethod(
  7823. $core.method({
  7824. selector: "level",
  7825. protocol: 'accessing',
  7826. fn: function (){
  7827. var self=this;
  7828. return self["@level"];
  7829. },
  7830. args: [],
  7831. source: "level\x0a\x09^ level",
  7832. referencedClasses: [],
  7833. messageSends: []
  7834. }),
  7835. $globals.ClassSorterNode);
  7836. $core.addMethod(
  7837. $core.method({
  7838. selector: "level:",
  7839. protocol: 'accessing',
  7840. fn: function (anInteger){
  7841. var self=this;
  7842. self["@level"]=anInteger;
  7843. return self;
  7844. },
  7845. args: ["anInteger"],
  7846. source: "level: anInteger\x0a\x09level := anInteger",
  7847. referencedClasses: [],
  7848. messageSends: []
  7849. }),
  7850. $globals.ClassSorterNode);
  7851. $core.addMethod(
  7852. $core.method({
  7853. selector: "nodes",
  7854. protocol: 'accessing',
  7855. fn: function (){
  7856. var self=this;
  7857. return self["@nodes"];
  7858. },
  7859. args: [],
  7860. source: "nodes\x0a\x09^ nodes",
  7861. referencedClasses: [],
  7862. messageSends: []
  7863. }),
  7864. $globals.ClassSorterNode);
  7865. $core.addMethod(
  7866. $core.method({
  7867. selector: "theClass",
  7868. protocol: 'accessing',
  7869. fn: function (){
  7870. var self=this;
  7871. return self["@theClass"];
  7872. },
  7873. args: [],
  7874. source: "theClass\x0a\x09^ theClass",
  7875. referencedClasses: [],
  7876. messageSends: []
  7877. }),
  7878. $globals.ClassSorterNode);
  7879. $core.addMethod(
  7880. $core.method({
  7881. selector: "theClass:",
  7882. protocol: 'accessing',
  7883. fn: function (aClass){
  7884. var self=this;
  7885. self["@theClass"]=aClass;
  7886. return self;
  7887. },
  7888. args: ["aClass"],
  7889. source: "theClass: aClass\x0a\x09theClass := aClass",
  7890. referencedClasses: [],
  7891. messageSends: []
  7892. }),
  7893. $globals.ClassSorterNode);
  7894. $core.addMethod(
  7895. $core.method({
  7896. selector: "traverseClassesWith:",
  7897. protocol: 'visiting',
  7898. fn: function (aCollection){
  7899. var self=this;
  7900. return $core.withContext(function($ctx1) {
  7901. var $1,$3,$2;
  7902. $1=self._theClass();
  7903. $ctx1.sendIdx["theClass"]=1;
  7904. $recv(aCollection)._add_($1);
  7905. $recv($recv(self._nodes())._sorted_((function(a,b){
  7906. return $core.withContext(function($ctx2) {
  7907. $3=$recv(a)._theClass();
  7908. $ctx2.sendIdx["theClass"]=2;
  7909. $2=$recv($3)._name();
  7910. $ctx2.sendIdx["name"]=1;
  7911. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  7912. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  7913. })))._do_((function(aNode){
  7914. return $core.withContext(function($ctx2) {
  7915. return $recv(aNode)._traverseClassesWith_(aCollection);
  7916. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  7917. }));
  7918. return self;
  7919. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  7920. },
  7921. args: ["aCollection"],
  7922. 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 ].",
  7923. referencedClasses: [],
  7924. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  7925. }),
  7926. $globals.ClassSorterNode);
  7927. $core.addMethod(
  7928. $core.method({
  7929. selector: "on:classes:level:",
  7930. protocol: 'instance creation',
  7931. fn: function (aClass,aCollection,anInteger){
  7932. var self=this;
  7933. return $core.withContext(function($ctx1) {
  7934. var $1;
  7935. $1=self._new();
  7936. $recv($1)._theClass_(aClass);
  7937. $recv($1)._level_(anInteger);
  7938. $recv($1)._getNodesFrom_(aCollection);
  7939. return $recv($1)._yourself();
  7940. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)});
  7941. },
  7942. args: ["aClass", "aCollection", "anInteger"],
  7943. 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",
  7944. referencedClasses: [],
  7945. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  7946. }),
  7947. $globals.ClassSorterNode.klass);
  7948. });
  7949. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7950. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  7951. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7952. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  7953. $core.addPackage('Kernel-Methods');
  7954. $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  7955. $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7956. $core.addClass('BlockClosure', $globals.Object, [], 'Kernel-Methods');
  7957. $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 | ... ] `";
  7958. $core.addMethod(
  7959. $core.method({
  7960. selector: "applyTo:arguments:",
  7961. protocol: 'evaluating',
  7962. fn: function (anObject,aCollection){
  7963. var self=this;
  7964. return $core.withContext(function($ctx1) {
  7965. return self.apply(anObject, aCollection);
  7966. return self;
  7967. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  7968. },
  7969. args: ["anObject", "aCollection"],
  7970. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  7971. referencedClasses: [],
  7972. messageSends: []
  7973. }),
  7974. $globals.BlockClosure);
  7975. $core.addMethod(
  7976. $core.method({
  7977. selector: "asCompiledMethod:",
  7978. protocol: 'converting',
  7979. fn: function (aString){
  7980. var self=this;
  7981. return $core.withContext(function($ctx1) {
  7982. return $core.method({selector:aString, fn:self});;
  7983. return self;
  7984. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  7985. },
  7986. args: ["aString"],
  7987. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  7988. referencedClasses: [],
  7989. messageSends: []
  7990. }),
  7991. $globals.BlockClosure);
  7992. $core.addMethod(
  7993. $core.method({
  7994. selector: "compiledSource",
  7995. protocol: 'accessing',
  7996. fn: function (){
  7997. var self=this;
  7998. return $core.withContext(function($ctx1) {
  7999. return self.toString();
  8000. return self;
  8001. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  8002. },
  8003. args: [],
  8004. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  8005. referencedClasses: [],
  8006. messageSends: []
  8007. }),
  8008. $globals.BlockClosure);
  8009. $core.addMethod(
  8010. $core.method({
  8011. selector: "currySelf",
  8012. protocol: 'converting',
  8013. fn: function (){
  8014. var self=this;
  8015. return $core.withContext(function($ctx1) {
  8016. return function () {
  8017. var args = [ this ];
  8018. args.push.apply(args, arguments);
  8019. return self.apply(null, args);
  8020. }
  8021. ;
  8022. return self;
  8023. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  8024. },
  8025. args: [],
  8026. 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'>",
  8027. referencedClasses: [],
  8028. messageSends: []
  8029. }),
  8030. $globals.BlockClosure);
  8031. $core.addMethod(
  8032. $core.method({
  8033. selector: "ensure:",
  8034. protocol: 'evaluating',
  8035. fn: function (aBlock){
  8036. var self=this;
  8037. return $core.withContext(function($ctx1) {
  8038. try{return self._value()}finally{aBlock._value()};
  8039. return self;
  8040. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  8041. },
  8042. args: ["aBlock"],
  8043. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return self._value()}finally{aBlock._value()}'>",
  8044. referencedClasses: [],
  8045. messageSends: []
  8046. }),
  8047. $globals.BlockClosure);
  8048. $core.addMethod(
  8049. $core.method({
  8050. selector: "fork",
  8051. protocol: 'timeout/interval',
  8052. fn: function (){
  8053. var self=this;
  8054. return $core.withContext(function($ctx1) {
  8055. $recv($recv($globals.ForkPool)._default())._fork_(self);
  8056. return self;
  8057. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  8058. },
  8059. args: [],
  8060. source: "fork\x0a\x09ForkPool default fork: self",
  8061. referencedClasses: ["ForkPool"],
  8062. messageSends: ["fork:", "default"]
  8063. }),
  8064. $globals.BlockClosure);
  8065. $core.addMethod(
  8066. $core.method({
  8067. selector: "new",
  8068. protocol: 'evaluating',
  8069. fn: function (){
  8070. var self=this;
  8071. return $core.withContext(function($ctx1) {
  8072. return new self();
  8073. return self;
  8074. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  8075. },
  8076. args: [],
  8077. 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()'>",
  8078. referencedClasses: [],
  8079. messageSends: []
  8080. }),
  8081. $globals.BlockClosure);
  8082. $core.addMethod(
  8083. $core.method({
  8084. selector: "newValue:",
  8085. protocol: 'evaluating',
  8086. fn: function (anObject){
  8087. var self=this;
  8088. return $core.withContext(function($ctx1) {
  8089. return self._newWithValues_([anObject]);
  8090. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  8091. },
  8092. args: ["anObject"],
  8093. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  8094. referencedClasses: [],
  8095. messageSends: ["newWithValues:"]
  8096. }),
  8097. $globals.BlockClosure);
  8098. $core.addMethod(
  8099. $core.method({
  8100. selector: "newValue:value:",
  8101. protocol: 'evaluating',
  8102. fn: function (anObject,anObject2){
  8103. var self=this;
  8104. return $core.withContext(function($ctx1) {
  8105. return self._newWithValues_([anObject,anObject2]);
  8106. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  8107. },
  8108. args: ["anObject", "anObject2"],
  8109. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  8110. referencedClasses: [],
  8111. messageSends: ["newWithValues:"]
  8112. }),
  8113. $globals.BlockClosure);
  8114. $core.addMethod(
  8115. $core.method({
  8116. selector: "newValue:value:value:",
  8117. protocol: 'evaluating',
  8118. fn: function (anObject,anObject2,anObject3){
  8119. var self=this;
  8120. return $core.withContext(function($ctx1) {
  8121. return self._newWithValues_([anObject,anObject2,anObject3]);
  8122. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  8123. },
  8124. args: ["anObject", "anObject2", "anObject3"],
  8125. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  8126. referencedClasses: [],
  8127. messageSends: ["newWithValues:"]
  8128. }),
  8129. $globals.BlockClosure);
  8130. $core.addMethod(
  8131. $core.method({
  8132. selector: "newWithValues:",
  8133. protocol: 'evaluating',
  8134. fn: function (aCollection){
  8135. var self=this;
  8136. return $core.withContext(function($ctx1) {
  8137. var object = Object.create(self.prototype);
  8138. var result = self.apply(object, aCollection);
  8139. return typeof result === "object" ? result : object;
  8140. ;
  8141. return self;
  8142. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  8143. },
  8144. args: ["aCollection"],
  8145. 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'>",
  8146. referencedClasses: [],
  8147. messageSends: []
  8148. }),
  8149. $globals.BlockClosure);
  8150. $core.addMethod(
  8151. $core.method({
  8152. selector: "numArgs",
  8153. protocol: 'accessing',
  8154. fn: function (){
  8155. var self=this;
  8156. return $core.withContext(function($ctx1) {
  8157. return self.length;
  8158. return self;
  8159. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  8160. },
  8161. args: [],
  8162. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  8163. referencedClasses: [],
  8164. messageSends: []
  8165. }),
  8166. $globals.BlockClosure);
  8167. $core.addMethod(
  8168. $core.method({
  8169. selector: "on:do:",
  8170. protocol: 'error handling',
  8171. fn: function (anErrorClass,aBlock){
  8172. var self=this;
  8173. return $core.withContext(function($ctx1) {
  8174. var $1;
  8175. return self._tryCatch_((function(error){
  8176. var smalltalkError;
  8177. return $core.withContext(function($ctx2) {
  8178. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  8179. smalltalkError;
  8180. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  8181. if($core.assert($1)){
  8182. return $recv(aBlock)._value_(smalltalkError);
  8183. } else {
  8184. return $recv(smalltalkError)._resignal();
  8185. };
  8186. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  8187. }));
  8188. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  8189. },
  8190. args: ["anErrorClass", "aBlock"],
  8191. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
  8192. referencedClasses: ["Smalltalk"],
  8193. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  8194. }),
  8195. $globals.BlockClosure);
  8196. $core.addMethod(
  8197. $core.method({
  8198. selector: "receiver",
  8199. protocol: 'accessing',
  8200. fn: function (){
  8201. var self=this;
  8202. return nil;
  8203. },
  8204. args: [],
  8205. source: "receiver\x0a\x09^ nil",
  8206. referencedClasses: [],
  8207. messageSends: []
  8208. }),
  8209. $globals.BlockClosure);
  8210. $core.addMethod(
  8211. $core.method({
  8212. selector: "timeToRun",
  8213. protocol: 'evaluating',
  8214. fn: function (){
  8215. var self=this;
  8216. return $core.withContext(function($ctx1) {
  8217. return $recv($globals.Date)._millisecondsToRun_(self);
  8218. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  8219. },
  8220. args: [],
  8221. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  8222. referencedClasses: ["Date"],
  8223. messageSends: ["millisecondsToRun:"]
  8224. }),
  8225. $globals.BlockClosure);
  8226. $core.addMethod(
  8227. $core.method({
  8228. selector: "tryCatch:",
  8229. protocol: 'error handling',
  8230. fn: function (aBlock){
  8231. var self=this;
  8232. return $core.withContext(function($ctx1) {
  8233. try {
  8234. return self._value();
  8235. } catch(error) {
  8236. // pass non-local returns undetected
  8237. if (Array.isArray(error) && error.length === 1) throw error;
  8238. return aBlock._value_(error);
  8239. }
  8240. ;
  8241. return self;
  8242. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  8243. },
  8244. args: ["aBlock"],
  8245. 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'>",
  8246. referencedClasses: [],
  8247. messageSends: []
  8248. }),
  8249. $globals.BlockClosure);
  8250. $core.addMethod(
  8251. $core.method({
  8252. selector: "value",
  8253. protocol: 'evaluating',
  8254. fn: function (){
  8255. var self=this;
  8256. return $core.withContext(function($ctx1) {
  8257. return self();;
  8258. return self;
  8259. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  8260. },
  8261. args: [],
  8262. source: "value\x0a\x09<inlineJS: 'return self();'>",
  8263. referencedClasses: [],
  8264. messageSends: []
  8265. }),
  8266. $globals.BlockClosure);
  8267. $core.addMethod(
  8268. $core.method({
  8269. selector: "value:",
  8270. protocol: 'evaluating',
  8271. fn: function (anArg){
  8272. var self=this;
  8273. return $core.withContext(function($ctx1) {
  8274. return self(anArg);;
  8275. return self;
  8276. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  8277. },
  8278. args: ["anArg"],
  8279. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  8280. referencedClasses: [],
  8281. messageSends: []
  8282. }),
  8283. $globals.BlockClosure);
  8284. $core.addMethod(
  8285. $core.method({
  8286. selector: "value:value:",
  8287. protocol: 'evaluating',
  8288. fn: function (firstArg,secondArg){
  8289. var self=this;
  8290. return $core.withContext(function($ctx1) {
  8291. return self(firstArg, secondArg);;
  8292. return self;
  8293. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  8294. },
  8295. args: ["firstArg", "secondArg"],
  8296. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  8297. referencedClasses: [],
  8298. messageSends: []
  8299. }),
  8300. $globals.BlockClosure);
  8301. $core.addMethod(
  8302. $core.method({
  8303. selector: "value:value:value:",
  8304. protocol: 'evaluating',
  8305. fn: function (firstArg,secondArg,thirdArg){
  8306. var self=this;
  8307. return $core.withContext(function($ctx1) {
  8308. return self(firstArg, secondArg, thirdArg);;
  8309. return self;
  8310. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  8311. },
  8312. args: ["firstArg", "secondArg", "thirdArg"],
  8313. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  8314. referencedClasses: [],
  8315. messageSends: []
  8316. }),
  8317. $globals.BlockClosure);
  8318. $core.addMethod(
  8319. $core.method({
  8320. selector: "valueWithInterval:",
  8321. protocol: 'timeout/interval',
  8322. fn: function (aNumber){
  8323. var self=this;
  8324. return $core.withContext(function($ctx1) {
  8325. var interval = setInterval(self, aNumber);
  8326. return $globals.Timeout._on_(interval);
  8327. ;
  8328. return self;
  8329. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  8330. },
  8331. args: ["aNumber"],
  8332. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  8333. referencedClasses: [],
  8334. messageSends: []
  8335. }),
  8336. $globals.BlockClosure);
  8337. $core.addMethod(
  8338. $core.method({
  8339. selector: "valueWithPossibleArguments:",
  8340. protocol: 'evaluating',
  8341. fn: function (aCollection){
  8342. var self=this;
  8343. return $core.withContext(function($ctx1) {
  8344. return self.apply(null, aCollection);;
  8345. return self;
  8346. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  8347. },
  8348. args: ["aCollection"],
  8349. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  8350. referencedClasses: [],
  8351. messageSends: []
  8352. }),
  8353. $globals.BlockClosure);
  8354. $core.addMethod(
  8355. $core.method({
  8356. selector: "valueWithTimeout:",
  8357. protocol: 'timeout/interval',
  8358. fn: function (aNumber){
  8359. var self=this;
  8360. return $core.withContext(function($ctx1) {
  8361. var timeout = setTimeout(self, aNumber);
  8362. return $globals.Timeout._on_(timeout);
  8363. ;
  8364. return self;
  8365. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  8366. },
  8367. args: ["aNumber"],
  8368. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  8369. referencedClasses: [],
  8370. messageSends: []
  8371. }),
  8372. $globals.BlockClosure);
  8373. $core.addMethod(
  8374. $core.method({
  8375. selector: "whileFalse",
  8376. protocol: 'controlling',
  8377. fn: function (){
  8378. var self=this;
  8379. return $core.withContext(function($ctx1) {
  8380. self._whileFalse_((function(){
  8381. }));
  8382. return self;
  8383. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  8384. },
  8385. args: [],
  8386. source: "whileFalse\x0a\x09self whileFalse: []",
  8387. referencedClasses: [],
  8388. messageSends: ["whileFalse:"]
  8389. }),
  8390. $globals.BlockClosure);
  8391. $core.addMethod(
  8392. $core.method({
  8393. selector: "whileFalse:",
  8394. protocol: 'controlling',
  8395. fn: function (aBlock){
  8396. var self=this;
  8397. return $core.withContext(function($ctx1) {
  8398. while(!$core.assert(self._value())) {aBlock._value()};
  8399. return self;
  8400. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  8401. },
  8402. args: ["aBlock"],
  8403. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert(self._value())) {aBlock._value()}'>",
  8404. referencedClasses: [],
  8405. messageSends: []
  8406. }),
  8407. $globals.BlockClosure);
  8408. $core.addMethod(
  8409. $core.method({
  8410. selector: "whileTrue",
  8411. protocol: 'controlling',
  8412. fn: function (){
  8413. var self=this;
  8414. return $core.withContext(function($ctx1) {
  8415. self._whileTrue_((function(){
  8416. }));
  8417. return self;
  8418. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  8419. },
  8420. args: [],
  8421. source: "whileTrue\x0a\x09self whileTrue: []",
  8422. referencedClasses: [],
  8423. messageSends: ["whileTrue:"]
  8424. }),
  8425. $globals.BlockClosure);
  8426. $core.addMethod(
  8427. $core.method({
  8428. selector: "whileTrue:",
  8429. protocol: 'controlling',
  8430. fn: function (aBlock){
  8431. var self=this;
  8432. return $core.withContext(function($ctx1) {
  8433. while($core.assert(self._value())) {aBlock._value()};
  8434. return self;
  8435. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  8436. },
  8437. args: ["aBlock"],
  8438. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert(self._value())) {aBlock._value()}'>",
  8439. referencedClasses: [],
  8440. messageSends: []
  8441. }),
  8442. $globals.BlockClosure);
  8443. $core.addClass('CompiledMethod', $globals.Object, [], 'Kernel-Methods');
  8444. $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";
  8445. $core.addMethod(
  8446. $core.method({
  8447. selector: "arguments",
  8448. protocol: 'accessing',
  8449. fn: function (){
  8450. var self=this;
  8451. return $core.withContext(function($ctx1) {
  8452. return self.args || [];
  8453. return self;
  8454. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  8455. },
  8456. args: [],
  8457. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  8458. referencedClasses: [],
  8459. messageSends: []
  8460. }),
  8461. $globals.CompiledMethod);
  8462. $core.addMethod(
  8463. $core.method({
  8464. selector: "browse",
  8465. protocol: 'browsing',
  8466. fn: function (){
  8467. var self=this;
  8468. return $core.withContext(function($ctx1) {
  8469. $recv($globals.Finder)._findMethod_(self);
  8470. return self;
  8471. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  8472. },
  8473. args: [],
  8474. source: "browse\x0a\x09Finder findMethod: self",
  8475. referencedClasses: ["Finder"],
  8476. messageSends: ["findMethod:"]
  8477. }),
  8478. $globals.CompiledMethod);
  8479. $core.addMethod(
  8480. $core.method({
  8481. selector: "category",
  8482. protocol: 'accessing',
  8483. fn: function (){
  8484. var self=this;
  8485. return $core.withContext(function($ctx1) {
  8486. return self._protocol();
  8487. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  8488. },
  8489. args: [],
  8490. source: "category\x0a\x09^ self protocol",
  8491. referencedClasses: [],
  8492. messageSends: ["protocol"]
  8493. }),
  8494. $globals.CompiledMethod);
  8495. $core.addMethod(
  8496. $core.method({
  8497. selector: "defaultProtocol",
  8498. protocol: 'defaults',
  8499. fn: function (){
  8500. var self=this;
  8501. return "as yet unclassified";
  8502. },
  8503. args: [],
  8504. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  8505. referencedClasses: [],
  8506. messageSends: []
  8507. }),
  8508. $globals.CompiledMethod);
  8509. $core.addMethod(
  8510. $core.method({
  8511. selector: "fn",
  8512. protocol: 'accessing',
  8513. fn: function (){
  8514. var self=this;
  8515. return $core.withContext(function($ctx1) {
  8516. return self._basicAt_("fn");
  8517. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  8518. },
  8519. args: [],
  8520. source: "fn\x0a\x09^ self basicAt: 'fn'",
  8521. referencedClasses: [],
  8522. messageSends: ["basicAt:"]
  8523. }),
  8524. $globals.CompiledMethod);
  8525. $core.addMethod(
  8526. $core.method({
  8527. selector: "fn:",
  8528. protocol: 'accessing',
  8529. fn: function (aBlock){
  8530. var self=this;
  8531. return $core.withContext(function($ctx1) {
  8532. self._basicAt_put_("fn",aBlock);
  8533. return self;
  8534. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  8535. },
  8536. args: ["aBlock"],
  8537. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  8538. referencedClasses: [],
  8539. messageSends: ["basicAt:put:"]
  8540. }),
  8541. $globals.CompiledMethod);
  8542. $core.addMethod(
  8543. $core.method({
  8544. selector: "isCompiledMethod",
  8545. protocol: 'testing',
  8546. fn: function (){
  8547. var self=this;
  8548. return true;
  8549. },
  8550. args: [],
  8551. source: "isCompiledMethod\x0a\x09^ true",
  8552. referencedClasses: [],
  8553. messageSends: []
  8554. }),
  8555. $globals.CompiledMethod);
  8556. $core.addMethod(
  8557. $core.method({
  8558. selector: "isOverridden",
  8559. protocol: 'testing',
  8560. fn: function (){
  8561. var self=this;
  8562. var selector;
  8563. return $core.withContext(function($ctx1) {
  8564. var $1;
  8565. var $early={};
  8566. try {
  8567. selector=self._selector();
  8568. $recv(self._methodClass())._allSubclassesDo_((function(each){
  8569. return $core.withContext(function($ctx2) {
  8570. $1=$recv(each)._includesSelector_(selector);
  8571. if($core.assert($1)){
  8572. throw $early=[true];
  8573. };
  8574. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8575. }));
  8576. return false;
  8577. }
  8578. catch(e) {if(e===$early)return e[0]; throw e}
  8579. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  8580. },
  8581. args: [],
  8582. source: "isOverridden\x0a\x09| selector |\x0a \x0a selector := self selector.\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
  8583. referencedClasses: [],
  8584. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  8585. }),
  8586. $globals.CompiledMethod);
  8587. $core.addMethod(
  8588. $core.method({
  8589. selector: "isOverride",
  8590. protocol: 'testing',
  8591. fn: function (){
  8592. var self=this;
  8593. var superclass;
  8594. return $core.withContext(function($ctx1) {
  8595. var $1,$2,$receiver;
  8596. $1=self._methodClass();
  8597. $ctx1.sendIdx["methodClass"]=1;
  8598. superclass=$recv($1)._superclass();
  8599. $ctx1.sendIdx["superclass"]=1;
  8600. $2=superclass;
  8601. if(($receiver = $2) == null || $receiver.isNil){
  8602. return false;
  8603. } else {
  8604. $2;
  8605. };
  8606. return $recv($recv($recv(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  8607. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  8608. },
  8609. args: [],
  8610. 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",
  8611. referencedClasses: [],
  8612. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  8613. }),
  8614. $globals.CompiledMethod);
  8615. $core.addMethod(
  8616. $core.method({
  8617. selector: "messageSends",
  8618. protocol: 'accessing',
  8619. fn: function (){
  8620. var self=this;
  8621. return $core.withContext(function($ctx1) {
  8622. return self._basicAt_("messageSends");
  8623. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  8624. },
  8625. args: [],
  8626. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  8627. referencedClasses: [],
  8628. messageSends: ["basicAt:"]
  8629. }),
  8630. $globals.CompiledMethod);
  8631. $core.addMethod(
  8632. $core.method({
  8633. selector: "methodClass",
  8634. protocol: 'accessing',
  8635. fn: function (){
  8636. var self=this;
  8637. return $core.withContext(function($ctx1) {
  8638. return self._basicAt_("methodClass");
  8639. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  8640. },
  8641. args: [],
  8642. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  8643. referencedClasses: [],
  8644. messageSends: ["basicAt:"]
  8645. }),
  8646. $globals.CompiledMethod);
  8647. $core.addMethod(
  8648. $core.method({
  8649. selector: "package",
  8650. protocol: 'accessing',
  8651. fn: function (){
  8652. var self=this;
  8653. return $core.withContext(function($ctx1) {
  8654. var $1,$receiver;
  8655. $1=self._methodClass();
  8656. if(($receiver = $1) == null || $receiver.isNil){
  8657. return $1;
  8658. } else {
  8659. var class_;
  8660. class_=$receiver;
  8661. return $recv(class_)._packageOfProtocol_(self._protocol());
  8662. };
  8663. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  8664. },
  8665. args: [],
  8666. 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 ]",
  8667. referencedClasses: [],
  8668. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  8669. }),
  8670. $globals.CompiledMethod);
  8671. $core.addMethod(
  8672. $core.method({
  8673. selector: "protocol",
  8674. protocol: 'accessing',
  8675. fn: function (){
  8676. var self=this;
  8677. return $core.withContext(function($ctx1) {
  8678. var $1,$receiver;
  8679. $1=self._basicAt_("protocol");
  8680. if(($receiver = $1) == null || $receiver.isNil){
  8681. return self._defaultProtocol();
  8682. } else {
  8683. return $1;
  8684. };
  8685. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  8686. },
  8687. args: [],
  8688. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  8689. referencedClasses: [],
  8690. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  8691. }),
  8692. $globals.CompiledMethod);
  8693. $core.addMethod(
  8694. $core.method({
  8695. selector: "protocol:",
  8696. protocol: 'accessing',
  8697. fn: function (aString){
  8698. var self=this;
  8699. var oldProtocol;
  8700. return $core.withContext(function($ctx1) {
  8701. var $1,$3,$2,$4,$receiver;
  8702. oldProtocol=self._protocol();
  8703. self._basicAt_put_("protocol",aString);
  8704. $1=$recv($globals.SystemAnnouncer)._current();
  8705. $3=$recv($globals.MethodMoved)._new();
  8706. $recv($3)._method_(self);
  8707. $recv($3)._oldProtocol_(oldProtocol);
  8708. $2=$recv($3)._yourself();
  8709. $recv($1)._announce_($2);
  8710. $4=self._methodClass();
  8711. if(($receiver = $4) == null || $receiver.isNil){
  8712. $4;
  8713. } else {
  8714. var methodClass;
  8715. methodClass=$receiver;
  8716. $recv($recv(methodClass)._organization())._addElement_(aString);
  8717. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  8718. };
  8719. return self;
  8720. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  8721. },
  8722. args: ["aString"],
  8723. source: "protocol: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'protocol' put: aString.\x0a\x0a\x09SystemAnnouncer current announce: (MethodMoved new\x0a\x09\x09method: self;\x0a\x09\x09oldProtocol: oldProtocol;\x0a\x09\x09yourself).\x0a\x0a\x09self methodClass ifNotNil: [ :methodClass |\x0a\x09\x09methodClass organization addElement: aString.\x0a\x09\x09methodClass removeProtocolIfEmpty: oldProtocol ]",
  8724. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  8725. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  8726. }),
  8727. $globals.CompiledMethod);
  8728. $core.addMethod(
  8729. $core.method({
  8730. selector: "referencedClasses",
  8731. protocol: 'accessing',
  8732. fn: function (){
  8733. var self=this;
  8734. return $core.withContext(function($ctx1) {
  8735. return self._basicAt_("referencedClasses");
  8736. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  8737. },
  8738. args: [],
  8739. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  8740. referencedClasses: [],
  8741. messageSends: ["basicAt:"]
  8742. }),
  8743. $globals.CompiledMethod);
  8744. $core.addMethod(
  8745. $core.method({
  8746. selector: "selector",
  8747. protocol: 'accessing',
  8748. fn: function (){
  8749. var self=this;
  8750. return $core.withContext(function($ctx1) {
  8751. return self._basicAt_("selector");
  8752. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  8753. },
  8754. args: [],
  8755. source: "selector\x0a\x09^ self basicAt: 'selector'",
  8756. referencedClasses: [],
  8757. messageSends: ["basicAt:"]
  8758. }),
  8759. $globals.CompiledMethod);
  8760. $core.addMethod(
  8761. $core.method({
  8762. selector: "selector:",
  8763. protocol: 'accessing',
  8764. fn: function (aString){
  8765. var self=this;
  8766. return $core.withContext(function($ctx1) {
  8767. self._basicAt_put_("selector",aString);
  8768. return self;
  8769. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  8770. },
  8771. args: ["aString"],
  8772. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  8773. referencedClasses: [],
  8774. messageSends: ["basicAt:put:"]
  8775. }),
  8776. $globals.CompiledMethod);
  8777. $core.addMethod(
  8778. $core.method({
  8779. selector: "sendTo:arguments:",
  8780. protocol: 'evaluating',
  8781. fn: function (anObject,aCollection){
  8782. var self=this;
  8783. return $core.withContext(function($ctx1) {
  8784. return $recv(self._fn())._applyTo_arguments_(anObject,aCollection);
  8785. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  8786. },
  8787. args: ["anObject", "aCollection"],
  8788. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  8789. referencedClasses: [],
  8790. messageSends: ["applyTo:arguments:", "fn"]
  8791. }),
  8792. $globals.CompiledMethod);
  8793. $core.addMethod(
  8794. $core.method({
  8795. selector: "source",
  8796. protocol: 'accessing',
  8797. fn: function (){
  8798. var self=this;
  8799. return $core.withContext(function($ctx1) {
  8800. var $1,$receiver;
  8801. $1=self._basicAt_("source");
  8802. if(($receiver = $1) == null || $receiver.isNil){
  8803. return "";
  8804. } else {
  8805. return $1;
  8806. };
  8807. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  8808. },
  8809. args: [],
  8810. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  8811. referencedClasses: [],
  8812. messageSends: ["ifNil:", "basicAt:"]
  8813. }),
  8814. $globals.CompiledMethod);
  8815. $core.addMethod(
  8816. $core.method({
  8817. selector: "source:",
  8818. protocol: 'accessing',
  8819. fn: function (aString){
  8820. var self=this;
  8821. return $core.withContext(function($ctx1) {
  8822. self._basicAt_put_("source",aString);
  8823. return self;
  8824. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  8825. },
  8826. args: ["aString"],
  8827. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  8828. referencedClasses: [],
  8829. messageSends: ["basicAt:put:"]
  8830. }),
  8831. $globals.CompiledMethod);
  8832. $core.addClass('ForkPool', $globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  8833. $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`";
  8834. $core.addMethod(
  8835. $core.method({
  8836. selector: "addWorker",
  8837. protocol: 'private',
  8838. fn: function (){
  8839. var self=this;
  8840. return $core.withContext(function($ctx1) {
  8841. $recv(self["@worker"])._valueWithTimeout_((0));
  8842. self["@poolSize"]=$recv(self["@poolSize"]).__plus((1));
  8843. return self;
  8844. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  8845. },
  8846. args: [],
  8847. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  8848. referencedClasses: [],
  8849. messageSends: ["valueWithTimeout:", "+"]
  8850. }),
  8851. $globals.ForkPool);
  8852. $core.addMethod(
  8853. $core.method({
  8854. selector: "defaultMaxPoolSize",
  8855. protocol: 'defaults',
  8856. fn: function (){
  8857. var self=this;
  8858. return $core.withContext(function($ctx1) {
  8859. return $recv(self._class())._defaultMaxPoolSize();
  8860. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  8861. },
  8862. args: [],
  8863. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  8864. referencedClasses: [],
  8865. messageSends: ["defaultMaxPoolSize", "class"]
  8866. }),
  8867. $globals.ForkPool);
  8868. $core.addMethod(
  8869. $core.method({
  8870. selector: "fork:",
  8871. protocol: 'actions',
  8872. fn: function (aBlock){
  8873. var self=this;
  8874. return $core.withContext(function($ctx1) {
  8875. var $1;
  8876. $1=$recv(self["@poolSize"]).__lt(self._maxPoolSize());
  8877. if($core.assert($1)){
  8878. self._addWorker();
  8879. };
  8880. $recv(self["@queue"])._nextPut_(aBlock);
  8881. return self;
  8882. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  8883. },
  8884. args: ["aBlock"],
  8885. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  8886. referencedClasses: [],
  8887. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  8888. }),
  8889. $globals.ForkPool);
  8890. $core.addMethod(
  8891. $core.method({
  8892. selector: "initialize",
  8893. protocol: 'initialization',
  8894. fn: function (){
  8895. var self=this;
  8896. return $core.withContext(function($ctx1) {
  8897. (
  8898. $ctx1.supercall = true,
  8899. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  8900. $ctx1.supercall = false;
  8901. self["@poolSize"]=(0);
  8902. self["@queue"]=$recv($globals.Queue)._new();
  8903. self["@worker"]=self._makeWorker();
  8904. return self;
  8905. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  8906. },
  8907. args: [],
  8908. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  8909. referencedClasses: ["Queue"],
  8910. messageSends: ["initialize", "new", "makeWorker"]
  8911. }),
  8912. $globals.ForkPool);
  8913. $core.addMethod(
  8914. $core.method({
  8915. selector: "makeWorker",
  8916. protocol: 'initialization',
  8917. fn: function (){
  8918. var self=this;
  8919. var sentinel;
  8920. return $core.withContext(function($ctx1) {
  8921. var $1;
  8922. sentinel=$recv($globals.Object)._new();
  8923. return (function(){
  8924. var block;
  8925. return $core.withContext(function($ctx2) {
  8926. self["@poolSize"]=$recv(self["@poolSize"]).__minus((1));
  8927. self["@poolSize"];
  8928. block=$recv(self["@queue"])._nextIfAbsent_((function(){
  8929. return sentinel;
  8930. }));
  8931. block;
  8932. $1=$recv(block).__eq_eq(sentinel);
  8933. if(!$core.assert($1)){
  8934. return $recv((function(){
  8935. return $core.withContext(function($ctx3) {
  8936. return $recv(block)._value();
  8937. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  8938. }))._ensure_((function(){
  8939. return $core.withContext(function($ctx3) {
  8940. return self._addWorker();
  8941. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  8942. }));
  8943. };
  8944. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  8945. });
  8946. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  8947. },
  8948. args: [],
  8949. 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 ] ]]",
  8950. referencedClasses: ["Object"],
  8951. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  8952. }),
  8953. $globals.ForkPool);
  8954. $core.addMethod(
  8955. $core.method({
  8956. selector: "maxPoolSize",
  8957. protocol: 'accessing',
  8958. fn: function (){
  8959. var self=this;
  8960. return $core.withContext(function($ctx1) {
  8961. var $1,$receiver;
  8962. $1=self["@maxPoolSize"];
  8963. if(($receiver = $1) == null || $receiver.isNil){
  8964. return self._defaultMaxPoolSize();
  8965. } else {
  8966. return $1;
  8967. };
  8968. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  8969. },
  8970. args: [],
  8971. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  8972. referencedClasses: [],
  8973. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  8974. }),
  8975. $globals.ForkPool);
  8976. $core.addMethod(
  8977. $core.method({
  8978. selector: "maxPoolSize:",
  8979. protocol: 'accessing',
  8980. fn: function (anInteger){
  8981. var self=this;
  8982. self["@maxPoolSize"]=anInteger;
  8983. return self;
  8984. },
  8985. args: ["anInteger"],
  8986. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  8987. referencedClasses: [],
  8988. messageSends: []
  8989. }),
  8990. $globals.ForkPool);
  8991. $globals.ForkPool.klass.iVarNames = ['default'];
  8992. $core.addMethod(
  8993. $core.method({
  8994. selector: "default",
  8995. protocol: 'accessing',
  8996. fn: function (){
  8997. var self=this;
  8998. return $core.withContext(function($ctx1) {
  8999. var $1,$receiver;
  9000. $1=self["@default"];
  9001. if(($receiver = $1) == null || $receiver.isNil){
  9002. self["@default"]=self._new();
  9003. return self["@default"];
  9004. } else {
  9005. return $1;
  9006. };
  9007. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.klass)});
  9008. },
  9009. args: [],
  9010. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  9011. referencedClasses: [],
  9012. messageSends: ["ifNil:", "new"]
  9013. }),
  9014. $globals.ForkPool.klass);
  9015. $core.addMethod(
  9016. $core.method({
  9017. selector: "defaultMaxPoolSize",
  9018. protocol: 'accessing',
  9019. fn: function (){
  9020. var self=this;
  9021. return (100);
  9022. },
  9023. args: [],
  9024. source: "defaultMaxPoolSize\x0a\x09^ 100",
  9025. referencedClasses: [],
  9026. messageSends: []
  9027. }),
  9028. $globals.ForkPool.klass);
  9029. $core.addMethod(
  9030. $core.method({
  9031. selector: "resetDefault",
  9032. protocol: 'accessing',
  9033. fn: function (){
  9034. var self=this;
  9035. self["@default"]=nil;
  9036. return self;
  9037. },
  9038. args: [],
  9039. source: "resetDefault\x0a\x09default := nil",
  9040. referencedClasses: [],
  9041. messageSends: []
  9042. }),
  9043. $globals.ForkPool.klass);
  9044. $core.addClass('Message', $globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
  9045. $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.";
  9046. $core.addMethod(
  9047. $core.method({
  9048. selector: "arguments",
  9049. protocol: 'accessing',
  9050. fn: function (){
  9051. var self=this;
  9052. return self["@arguments"];
  9053. },
  9054. args: [],
  9055. source: "arguments\x0a\x09^ arguments",
  9056. referencedClasses: [],
  9057. messageSends: []
  9058. }),
  9059. $globals.Message);
  9060. $core.addMethod(
  9061. $core.method({
  9062. selector: "arguments:",
  9063. protocol: 'accessing',
  9064. fn: function (anArray){
  9065. var self=this;
  9066. self["@arguments"]=anArray;
  9067. return self;
  9068. },
  9069. args: ["anArray"],
  9070. source: "arguments: anArray\x0a\x09arguments := anArray",
  9071. referencedClasses: [],
  9072. messageSends: []
  9073. }),
  9074. $globals.Message);
  9075. $core.addMethod(
  9076. $core.method({
  9077. selector: "printOn:",
  9078. protocol: 'printing',
  9079. fn: function (aStream){
  9080. var self=this;
  9081. return $core.withContext(function($ctx1) {
  9082. (
  9083. $ctx1.supercall = true,
  9084. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9085. $ctx1.supercall = false;
  9086. $recv(aStream)._nextPutAll_("(");
  9087. $ctx1.sendIdx["nextPutAll:"]=1;
  9088. $recv(aStream)._nextPutAll_(self._selector());
  9089. $ctx1.sendIdx["nextPutAll:"]=2;
  9090. $recv(aStream)._nextPutAll_(")");
  9091. return self;
  9092. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  9093. },
  9094. args: ["aStream"],
  9095. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  9096. referencedClasses: [],
  9097. messageSends: ["printOn:", "nextPutAll:", "selector"]
  9098. }),
  9099. $globals.Message);
  9100. $core.addMethod(
  9101. $core.method({
  9102. selector: "selector",
  9103. protocol: 'accessing',
  9104. fn: function (){
  9105. var self=this;
  9106. return self["@selector"];
  9107. },
  9108. args: [],
  9109. source: "selector\x0a\x09^ selector",
  9110. referencedClasses: [],
  9111. messageSends: []
  9112. }),
  9113. $globals.Message);
  9114. $core.addMethod(
  9115. $core.method({
  9116. selector: "selector:",
  9117. protocol: 'accessing',
  9118. fn: function (aString){
  9119. var self=this;
  9120. self["@selector"]=aString;
  9121. return self;
  9122. },
  9123. args: ["aString"],
  9124. source: "selector: aString\x0a\x09selector := aString",
  9125. referencedClasses: [],
  9126. messageSends: []
  9127. }),
  9128. $globals.Message);
  9129. $core.addMethod(
  9130. $core.method({
  9131. selector: "sendTo:",
  9132. protocol: 'actions',
  9133. fn: function (anObject){
  9134. var self=this;
  9135. return $core.withContext(function($ctx1) {
  9136. return $recv(anObject)._perform_withArguments_(self._selector(),self._arguments());
  9137. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  9138. },
  9139. args: ["anObject"],
  9140. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  9141. referencedClasses: [],
  9142. messageSends: ["perform:withArguments:", "selector", "arguments"]
  9143. }),
  9144. $globals.Message);
  9145. $core.addMethod(
  9146. $core.method({
  9147. selector: "selector:arguments:",
  9148. protocol: 'instance creation',
  9149. fn: function (aString,anArray){
  9150. var self=this;
  9151. return $core.withContext(function($ctx1) {
  9152. var $1;
  9153. $1=self._new();
  9154. $recv($1)._selector_(aString);
  9155. $recv($1)._arguments_(anArray);
  9156. return $recv($1)._yourself();
  9157. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.klass)});
  9158. },
  9159. args: ["aString", "anArray"],
  9160. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  9161. referencedClasses: [],
  9162. messageSends: ["selector:", "new", "arguments:", "yourself"]
  9163. }),
  9164. $globals.Message.klass);
  9165. $core.addClass('MessageSend', $globals.Object, ['receiver', 'message'], 'Kernel-Methods');
  9166. $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.";
  9167. $core.addMethod(
  9168. $core.method({
  9169. selector: "arguments",
  9170. protocol: 'accessing',
  9171. fn: function (){
  9172. var self=this;
  9173. return $core.withContext(function($ctx1) {
  9174. return $recv(self["@message"])._arguments();
  9175. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  9176. },
  9177. args: [],
  9178. source: "arguments\x0a\x09^ message arguments",
  9179. referencedClasses: [],
  9180. messageSends: ["arguments"]
  9181. }),
  9182. $globals.MessageSend);
  9183. $core.addMethod(
  9184. $core.method({
  9185. selector: "arguments:",
  9186. protocol: 'accessing',
  9187. fn: function (aCollection){
  9188. var self=this;
  9189. return $core.withContext(function($ctx1) {
  9190. $recv(self["@message"])._arguments_(aCollection);
  9191. return self;
  9192. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  9193. },
  9194. args: ["aCollection"],
  9195. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  9196. referencedClasses: [],
  9197. messageSends: ["arguments:"]
  9198. }),
  9199. $globals.MessageSend);
  9200. $core.addMethod(
  9201. $core.method({
  9202. selector: "initialize",
  9203. protocol: 'initialization',
  9204. fn: function (){
  9205. var self=this;
  9206. return $core.withContext(function($ctx1) {
  9207. (
  9208. $ctx1.supercall = true,
  9209. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  9210. $ctx1.supercall = false;
  9211. self["@message"]=$recv($globals.Message)._new();
  9212. return self;
  9213. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  9214. },
  9215. args: [],
  9216. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  9217. referencedClasses: ["Message"],
  9218. messageSends: ["initialize", "new"]
  9219. }),
  9220. $globals.MessageSend);
  9221. $core.addMethod(
  9222. $core.method({
  9223. selector: "printOn:",
  9224. protocol: 'printing',
  9225. fn: function (aStream){
  9226. var self=this;
  9227. return $core.withContext(function($ctx1) {
  9228. (
  9229. $ctx1.supercall = true,
  9230. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9231. $ctx1.supercall = false;
  9232. $recv(aStream)._nextPutAll_("(");
  9233. $ctx1.sendIdx["nextPutAll:"]=1;
  9234. $recv(aStream)._nextPutAll_(self._receiver());
  9235. $ctx1.sendIdx["nextPutAll:"]=2;
  9236. $recv(aStream)._nextPutAll_(" >> ");
  9237. $ctx1.sendIdx["nextPutAll:"]=3;
  9238. $recv(aStream)._nextPutAll_(self._selector());
  9239. $ctx1.sendIdx["nextPutAll:"]=4;
  9240. $recv(aStream)._nextPutAll_(")");
  9241. return self;
  9242. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  9243. },
  9244. args: ["aStream"],
  9245. 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: ')'",
  9246. referencedClasses: [],
  9247. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  9248. }),
  9249. $globals.MessageSend);
  9250. $core.addMethod(
  9251. $core.method({
  9252. selector: "receiver",
  9253. protocol: 'accessing',
  9254. fn: function (){
  9255. var self=this;
  9256. return self["@receiver"];
  9257. },
  9258. args: [],
  9259. source: "receiver\x0a\x09^ receiver",
  9260. referencedClasses: [],
  9261. messageSends: []
  9262. }),
  9263. $globals.MessageSend);
  9264. $core.addMethod(
  9265. $core.method({
  9266. selector: "receiver:",
  9267. protocol: 'accessing',
  9268. fn: function (anObject){
  9269. var self=this;
  9270. self["@receiver"]=anObject;
  9271. return self;
  9272. },
  9273. args: ["anObject"],
  9274. source: "receiver: anObject\x0a\x09receiver := anObject",
  9275. referencedClasses: [],
  9276. messageSends: []
  9277. }),
  9278. $globals.MessageSend);
  9279. $core.addMethod(
  9280. $core.method({
  9281. selector: "selector",
  9282. protocol: 'accessing',
  9283. fn: function (){
  9284. var self=this;
  9285. return $core.withContext(function($ctx1) {
  9286. return $recv(self["@message"])._selector();
  9287. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  9288. },
  9289. args: [],
  9290. source: "selector\x0a\x09^ message selector",
  9291. referencedClasses: [],
  9292. messageSends: ["selector"]
  9293. }),
  9294. $globals.MessageSend);
  9295. $core.addMethod(
  9296. $core.method({
  9297. selector: "selector:",
  9298. protocol: 'accessing',
  9299. fn: function (aString){
  9300. var self=this;
  9301. return $core.withContext(function($ctx1) {
  9302. $recv(self["@message"])._selector_(aString);
  9303. return self;
  9304. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  9305. },
  9306. args: ["aString"],
  9307. source: "selector: aString\x0a\x09message selector: aString",
  9308. referencedClasses: [],
  9309. messageSends: ["selector:"]
  9310. }),
  9311. $globals.MessageSend);
  9312. $core.addMethod(
  9313. $core.method({
  9314. selector: "value",
  9315. protocol: 'evaluating',
  9316. fn: function (){
  9317. var self=this;
  9318. return $core.withContext(function($ctx1) {
  9319. return $recv(self["@message"])._sendTo_(self._receiver());
  9320. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  9321. },
  9322. args: [],
  9323. source: "value\x0a\x09^ message sendTo: self receiver",
  9324. referencedClasses: [],
  9325. messageSends: ["sendTo:", "receiver"]
  9326. }),
  9327. $globals.MessageSend);
  9328. $core.addMethod(
  9329. $core.method({
  9330. selector: "value:",
  9331. protocol: 'evaluating',
  9332. fn: function (anObject){
  9333. var self=this;
  9334. return $core.withContext(function($ctx1) {
  9335. var $1;
  9336. $1=self["@message"];
  9337. $recv($1)._arguments_([anObject]);
  9338. return $recv($1)._sendTo_(self._receiver());
  9339. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  9340. },
  9341. args: ["anObject"],
  9342. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  9343. referencedClasses: [],
  9344. messageSends: ["arguments:", "sendTo:", "receiver"]
  9345. }),
  9346. $globals.MessageSend);
  9347. $core.addMethod(
  9348. $core.method({
  9349. selector: "value:value:",
  9350. protocol: 'evaluating',
  9351. fn: function (firstArgument,secondArgument){
  9352. var self=this;
  9353. return $core.withContext(function($ctx1) {
  9354. var $1;
  9355. $1=self["@message"];
  9356. $recv($1)._arguments_([firstArgument,secondArgument]);
  9357. return $recv($1)._sendTo_(self._receiver());
  9358. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  9359. },
  9360. args: ["firstArgument", "secondArgument"],
  9361. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  9362. referencedClasses: [],
  9363. messageSends: ["arguments:", "sendTo:", "receiver"]
  9364. }),
  9365. $globals.MessageSend);
  9366. $core.addMethod(
  9367. $core.method({
  9368. selector: "value:value:value:",
  9369. protocol: 'evaluating',
  9370. fn: function (firstArgument,secondArgument,thirdArgument){
  9371. var self=this;
  9372. return $core.withContext(function($ctx1) {
  9373. var $1;
  9374. $1=self["@message"];
  9375. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  9376. return $recv($1)._sendTo_(self._receiver());
  9377. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  9378. },
  9379. args: ["firstArgument", "secondArgument", "thirdArgument"],
  9380. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  9381. referencedClasses: [],
  9382. messageSends: ["arguments:", "sendTo:", "receiver"]
  9383. }),
  9384. $globals.MessageSend);
  9385. $core.addMethod(
  9386. $core.method({
  9387. selector: "valueWithPossibleArguments:",
  9388. protocol: 'evaluating',
  9389. fn: function (aCollection){
  9390. var self=this;
  9391. return $core.withContext(function($ctx1) {
  9392. self._arguments_(aCollection);
  9393. return self._value();
  9394. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  9395. },
  9396. args: ["aCollection"],
  9397. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  9398. referencedClasses: [],
  9399. messageSends: ["arguments:", "value"]
  9400. }),
  9401. $globals.MessageSend);
  9402. $core.addClass('MethodContext', $globals.Object, [], 'Kernel-Methods');
  9403. $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`.";
  9404. $core.addMethod(
  9405. $core.method({
  9406. selector: "asString",
  9407. protocol: 'converting',
  9408. fn: function (){
  9409. var self=this;
  9410. return $core.withContext(function($ctx1) {
  9411. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  9412. $2=self._isBlockContext();
  9413. if($core.assert($2)){
  9414. $3="a block (in ".__comma($recv(self._methodContext())._asString());
  9415. $ctx1.sendIdx[","]=2;
  9416. $1=$recv($3).__comma(")");
  9417. $ctx1.sendIdx[","]=1;
  9418. } else {
  9419. var methodClass;
  9420. methodClass=$recv(self._method())._methodClass();
  9421. methodClass;
  9422. $5=methodClass;
  9423. $7=self._receiver();
  9424. $ctx1.sendIdx["receiver"]=1;
  9425. $6=$recv($7)._class();
  9426. $ctx1.sendIdx["class"]=1;
  9427. $4=$recv($5).__eq($6);
  9428. if($core.assert($4)){
  9429. $11=self._receiver();
  9430. $ctx1.sendIdx["receiver"]=2;
  9431. $10=$recv($11)._class();
  9432. $ctx1.sendIdx["class"]=2;
  9433. $9=$recv($10)._name();
  9434. $ctx1.sendIdx["name"]=1;
  9435. $8=$recv($9).__comma(" >> ");
  9436. $ctx1.sendIdx[","]=4;
  9437. $12=self._selector();
  9438. $ctx1.sendIdx["selector"]=1;
  9439. $1=$recv($8).__comma($12);
  9440. $ctx1.sendIdx[","]=3;
  9441. } else {
  9442. $16=$recv($recv(self._receiver())._class())._name();
  9443. $ctx1.sendIdx["name"]=2;
  9444. $15=$recv($16).__comma("(");
  9445. $14=$recv($15).__comma($recv(methodClass)._name());
  9446. $ctx1.sendIdx[","]=7;
  9447. $13=$recv($14).__comma(") >> ");
  9448. $ctx1.sendIdx[","]=6;
  9449. $1=$recv($13).__comma(self._selector());
  9450. $ctx1.sendIdx[","]=5;
  9451. };
  9452. };
  9453. return $1;
  9454. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  9455. },
  9456. args: [],
  9457. 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 ] ]",
  9458. referencedClasses: [],
  9459. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  9460. }),
  9461. $globals.MethodContext);
  9462. $core.addMethod(
  9463. $core.method({
  9464. selector: "basicReceiver",
  9465. protocol: 'accessing',
  9466. fn: function (){
  9467. var self=this;
  9468. return $core.withContext(function($ctx1) {
  9469. return self.receiver;
  9470. return self;
  9471. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  9472. },
  9473. args: [],
  9474. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  9475. referencedClasses: [],
  9476. messageSends: []
  9477. }),
  9478. $globals.MethodContext);
  9479. $core.addMethod(
  9480. $core.method({
  9481. selector: "evaluatedSelector",
  9482. protocol: 'accessing',
  9483. fn: function (){
  9484. var self=this;
  9485. return $core.withContext(function($ctx1) {
  9486. return self.evaluatedSelector;
  9487. return self;
  9488. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  9489. },
  9490. args: [],
  9491. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  9492. referencedClasses: [],
  9493. messageSends: []
  9494. }),
  9495. $globals.MethodContext);
  9496. $core.addMethod(
  9497. $core.method({
  9498. selector: "findContextSuchThat:",
  9499. protocol: 'accessing',
  9500. fn: function (testBlock){
  9501. var self=this;
  9502. var context;
  9503. return $core.withContext(function($ctx1) {
  9504. var $1;
  9505. var $early={};
  9506. try {
  9507. context=self;
  9508. $recv((function(){
  9509. return $core.withContext(function($ctx2) {
  9510. return $recv(context)._isNil();
  9511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9512. }))._whileFalse_((function(){
  9513. return $core.withContext(function($ctx2) {
  9514. $1=$recv(testBlock)._value_(context);
  9515. if($core.assert($1)){
  9516. throw $early=[context];
  9517. };
  9518. context=$recv(context)._outerContext();
  9519. return context;
  9520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9521. }));
  9522. return nil;
  9523. }
  9524. catch(e) {if(e===$early)return e[0]; throw e}
  9525. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  9526. },
  9527. args: ["testBlock"],
  9528. 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",
  9529. referencedClasses: [],
  9530. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  9531. }),
  9532. $globals.MethodContext);
  9533. $core.addMethod(
  9534. $core.method({
  9535. selector: "home",
  9536. protocol: 'accessing',
  9537. fn: function (){
  9538. var self=this;
  9539. return $core.withContext(function($ctx1) {
  9540. return self.homeContext;
  9541. return self;
  9542. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  9543. },
  9544. args: [],
  9545. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  9546. referencedClasses: [],
  9547. messageSends: []
  9548. }),
  9549. $globals.MethodContext);
  9550. $core.addMethod(
  9551. $core.method({
  9552. selector: "index",
  9553. protocol: 'accessing',
  9554. fn: function (){
  9555. var self=this;
  9556. return $core.withContext(function($ctx1) {
  9557. return self.index || 0;
  9558. return self;
  9559. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  9560. },
  9561. args: [],
  9562. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  9563. referencedClasses: [],
  9564. messageSends: []
  9565. }),
  9566. $globals.MethodContext);
  9567. $core.addMethod(
  9568. $core.method({
  9569. selector: "isBlockContext",
  9570. protocol: 'testing',
  9571. fn: function (){
  9572. var self=this;
  9573. return $core.withContext(function($ctx1) {
  9574. return $recv(self._selector())._isNil();
  9575. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  9576. },
  9577. args: [],
  9578. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  9579. referencedClasses: [],
  9580. messageSends: ["isNil", "selector"]
  9581. }),
  9582. $globals.MethodContext);
  9583. $core.addMethod(
  9584. $core.method({
  9585. selector: "locals",
  9586. protocol: 'accessing',
  9587. fn: function (){
  9588. var self=this;
  9589. return $core.withContext(function($ctx1) {
  9590. return self.locals || {};
  9591. return self;
  9592. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  9593. },
  9594. args: [],
  9595. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  9596. referencedClasses: [],
  9597. messageSends: []
  9598. }),
  9599. $globals.MethodContext);
  9600. $core.addMethod(
  9601. $core.method({
  9602. selector: "method",
  9603. protocol: 'accessing',
  9604. fn: function (){
  9605. var self=this;
  9606. var method,lookupClass,receiverClass,supercall;
  9607. return $core.withContext(function($ctx1) {
  9608. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  9609. $1=self._methodContext();
  9610. $ctx1.sendIdx["methodContext"]=1;
  9611. if(($receiver = $1) == null || $receiver.isNil){
  9612. return nil;
  9613. } else {
  9614. $1;
  9615. };
  9616. $3=self._methodContext();
  9617. $ctx1.sendIdx["methodContext"]=2;
  9618. $2=$recv($3)._receiver();
  9619. receiverClass=$recv($2)._class();
  9620. $4=receiverClass;
  9621. $6=self._methodContext();
  9622. $ctx1.sendIdx["methodContext"]=3;
  9623. $5=$recv($6)._selector();
  9624. $ctx1.sendIdx["selector"]=1;
  9625. method=$recv($4)._lookupSelector_($5);
  9626. $ctx1.sendIdx["lookupSelector:"]=1;
  9627. $7=self._outerContext();
  9628. if(($receiver = $7) == null || $receiver.isNil){
  9629. supercall=false;
  9630. } else {
  9631. var outer;
  9632. outer=$receiver;
  9633. supercall=$recv(outer)._supercall();
  9634. };
  9635. $8=supercall;
  9636. if($core.assert($8)){
  9637. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv(self._methodContext())._selector());
  9638. } else {
  9639. return method;
  9640. };
  9641. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  9642. },
  9643. args: [],
  9644. 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 ]",
  9645. referencedClasses: [],
  9646. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  9647. }),
  9648. $globals.MethodContext);
  9649. $core.addMethod(
  9650. $core.method({
  9651. selector: "methodContext",
  9652. protocol: 'accessing',
  9653. fn: function (){
  9654. var self=this;
  9655. return $core.withContext(function($ctx1) {
  9656. var $1,$2,$receiver;
  9657. $1=self._isBlockContext();
  9658. if(!$core.assert($1)){
  9659. return self;
  9660. };
  9661. $2=self._outerContext();
  9662. if(($receiver = $2) == null || $receiver.isNil){
  9663. return $2;
  9664. } else {
  9665. var outer;
  9666. outer=$receiver;
  9667. return $recv(outer)._methodContext();
  9668. };
  9669. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  9670. },
  9671. args: [],
  9672. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  9673. referencedClasses: [],
  9674. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  9675. }),
  9676. $globals.MethodContext);
  9677. $core.addMethod(
  9678. $core.method({
  9679. selector: "outerContext",
  9680. protocol: 'accessing',
  9681. fn: function (){
  9682. var self=this;
  9683. return $core.withContext(function($ctx1) {
  9684. return self.outerContext || self.homeContext;
  9685. return self;
  9686. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  9687. },
  9688. args: [],
  9689. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  9690. referencedClasses: [],
  9691. messageSends: []
  9692. }),
  9693. $globals.MethodContext);
  9694. $core.addMethod(
  9695. $core.method({
  9696. selector: "printOn:",
  9697. protocol: 'printing',
  9698. fn: function (aStream){
  9699. var self=this;
  9700. return $core.withContext(function($ctx1) {
  9701. (
  9702. $ctx1.supercall = true,
  9703. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9704. $ctx1.supercall = false;
  9705. $recv(aStream)._nextPutAll_("(");
  9706. $ctx1.sendIdx["nextPutAll:"]=1;
  9707. $recv(aStream)._nextPutAll_(self._asString());
  9708. $ctx1.sendIdx["nextPutAll:"]=2;
  9709. $recv(aStream)._nextPutAll_(")");
  9710. return self;
  9711. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  9712. },
  9713. args: ["aStream"],
  9714. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  9715. referencedClasses: [],
  9716. messageSends: ["printOn:", "nextPutAll:", "asString"]
  9717. }),
  9718. $globals.MethodContext);
  9719. $core.addMethod(
  9720. $core.method({
  9721. selector: "receiver",
  9722. protocol: 'accessing',
  9723. fn: function (){
  9724. var self=this;
  9725. return $core.withContext(function($ctx1) {
  9726. var $2,$1;
  9727. $1=$recv(self._isBlockContext())._and_((function(){
  9728. return $core.withContext(function($ctx2) {
  9729. $2=self._outerContext();
  9730. $ctx2.sendIdx["outerContext"]=1;
  9731. return $recv($2)._notNil();
  9732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9733. }));
  9734. if($core.assert($1)){
  9735. return $recv(self._outerContext())._receiver();
  9736. } else {
  9737. return self._basicReceiver();
  9738. };
  9739. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  9740. },
  9741. args: [],
  9742. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  9743. referencedClasses: [],
  9744. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  9745. }),
  9746. $globals.MethodContext);
  9747. $core.addMethod(
  9748. $core.method({
  9749. selector: "selector",
  9750. protocol: 'accessing',
  9751. fn: function (){
  9752. var self=this;
  9753. return $core.withContext(function($ctx1) {
  9754. if(self.selector) {
  9755. return $core.js2st(self.selector);
  9756. } else {
  9757. return nil;
  9758. }
  9759. ;
  9760. return self;
  9761. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  9762. },
  9763. args: [],
  9764. source: "selector\x0a\x09<inlineJS: '\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return $core.js2st(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09'>",
  9765. referencedClasses: [],
  9766. messageSends: []
  9767. }),
  9768. $globals.MethodContext);
  9769. $core.addMethod(
  9770. $core.method({
  9771. selector: "sendIndexAt:",
  9772. protocol: 'accessing',
  9773. fn: function (aSelector){
  9774. var self=this;
  9775. return $core.withContext(function($ctx1) {
  9776. return self.sendIdx[aSelector] || 0;
  9777. return self;
  9778. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  9779. },
  9780. args: ["aSelector"],
  9781. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  9782. referencedClasses: [],
  9783. messageSends: []
  9784. }),
  9785. $globals.MethodContext);
  9786. $core.addMethod(
  9787. $core.method({
  9788. selector: "sendIndexes",
  9789. protocol: 'accessing',
  9790. fn: function (){
  9791. var self=this;
  9792. return $core.withContext(function($ctx1) {
  9793. return self.sendIdx;
  9794. return self;
  9795. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  9796. },
  9797. args: [],
  9798. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  9799. referencedClasses: [],
  9800. messageSends: []
  9801. }),
  9802. $globals.MethodContext);
  9803. $core.addMethod(
  9804. $core.method({
  9805. selector: "supercall",
  9806. protocol: 'accessing',
  9807. fn: function (){
  9808. var self=this;
  9809. return $core.withContext(function($ctx1) {
  9810. return self.supercall == true;
  9811. return self;
  9812. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  9813. },
  9814. args: [],
  9815. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  9816. referencedClasses: [],
  9817. messageSends: []
  9818. }),
  9819. $globals.MethodContext);
  9820. $core.addClass('NativeFunction', $globals.Object, [], 'Kernel-Methods');
  9821. $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' ]";
  9822. $core.addMethod(
  9823. $core.method({
  9824. selector: "constructorNamed:",
  9825. protocol: 'instance creation',
  9826. fn: function (aString){
  9827. var self=this;
  9828. return $core.withContext(function($ctx1) {
  9829. var nativeFunc=(new Function('return this'))()[aString];
  9830. return new nativeFunc();
  9831. ;
  9832. return self;
  9833. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9834. },
  9835. args: ["aString"],
  9836. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  9837. referencedClasses: [],
  9838. messageSends: []
  9839. }),
  9840. $globals.NativeFunction.klass);
  9841. $core.addMethod(
  9842. $core.method({
  9843. selector: "constructorNamed:value:",
  9844. protocol: 'instance creation',
  9845. fn: function (aString,anObject){
  9846. var self=this;
  9847. return $core.withContext(function($ctx1) {
  9848. var nativeFunc=(new Function('return this'))()[aString];
  9849. return new nativeFunc(anObject);
  9850. ;
  9851. return self;
  9852. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9853. },
  9854. args: ["aString", "anObject"],
  9855. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  9856. referencedClasses: [],
  9857. messageSends: []
  9858. }),
  9859. $globals.NativeFunction.klass);
  9860. $core.addMethod(
  9861. $core.method({
  9862. selector: "constructorNamed:value:value:",
  9863. protocol: 'instance creation',
  9864. fn: function (aString,anObject,anObject2){
  9865. var self=this;
  9866. return $core.withContext(function($ctx1) {
  9867. var nativeFunc=(new Function('return this'))()[aString];
  9868. return new nativeFunc(anObject,anObject2);
  9869. ;
  9870. return self;
  9871. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9872. },
  9873. args: ["aString", "anObject", "anObject2"],
  9874. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  9875. referencedClasses: [],
  9876. messageSends: []
  9877. }),
  9878. $globals.NativeFunction.klass);
  9879. $core.addMethod(
  9880. $core.method({
  9881. selector: "constructorNamed:value:value:value:",
  9882. protocol: 'instance creation',
  9883. fn: function (aString,anObject,anObject2,anObject3){
  9884. var self=this;
  9885. return $core.withContext(function($ctx1) {
  9886. var nativeFunc=(new Function('return this'))()[aString];
  9887. return new nativeFunc(anObject,anObject2, anObject3);
  9888. ;
  9889. return self;
  9890. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9891. },
  9892. args: ["aString", "anObject", "anObject2", "anObject3"],
  9893. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  9894. referencedClasses: [],
  9895. messageSends: []
  9896. }),
  9897. $globals.NativeFunction.klass);
  9898. $core.addMethod(
  9899. $core.method({
  9900. selector: "constructorOf:",
  9901. protocol: 'instance creation',
  9902. fn: function (nativeFunc){
  9903. var self=this;
  9904. return $core.withContext(function($ctx1) {
  9905. return new nativeFunc();
  9906. ;
  9907. return self;
  9908. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  9909. },
  9910. args: ["nativeFunc"],
  9911. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  9912. referencedClasses: [],
  9913. messageSends: []
  9914. }),
  9915. $globals.NativeFunction.klass);
  9916. $core.addMethod(
  9917. $core.method({
  9918. selector: "constructorOf:value:",
  9919. protocol: 'instance creation',
  9920. fn: function (nativeFunc,anObject){
  9921. var self=this;
  9922. return $core.withContext(function($ctx1) {
  9923. return new nativeFunc(anObject);
  9924. ;
  9925. return self;
  9926. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  9927. },
  9928. args: ["nativeFunc", "anObject"],
  9929. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  9930. referencedClasses: [],
  9931. messageSends: []
  9932. }),
  9933. $globals.NativeFunction.klass);
  9934. $core.addMethod(
  9935. $core.method({
  9936. selector: "constructorOf:value:value:",
  9937. protocol: 'instance creation',
  9938. fn: function (nativeFunc,anObject,anObject2){
  9939. var self=this;
  9940. return $core.withContext(function($ctx1) {
  9941. return new nativeFunc(anObject,anObject2);
  9942. ;
  9943. return self;
  9944. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9945. },
  9946. args: ["nativeFunc", "anObject", "anObject2"],
  9947. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  9948. referencedClasses: [],
  9949. messageSends: []
  9950. }),
  9951. $globals.NativeFunction.klass);
  9952. $core.addMethod(
  9953. $core.method({
  9954. selector: "constructorOf:value:value:value:",
  9955. protocol: 'instance creation',
  9956. fn: function (nativeFunc,anObject,anObject2,anObject3){
  9957. var self=this;
  9958. return $core.withContext(function($ctx1) {
  9959. return new nativeFunc(anObject,anObject2, anObject3);
  9960. ;
  9961. return self;
  9962. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9963. },
  9964. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  9965. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  9966. referencedClasses: [],
  9967. messageSends: []
  9968. }),
  9969. $globals.NativeFunction.klass);
  9970. $core.addMethod(
  9971. $core.method({
  9972. selector: "exists:",
  9973. protocol: 'testing',
  9974. fn: function (aString){
  9975. var self=this;
  9976. return $core.withContext(function($ctx1) {
  9977. return $recv($globals.Smalltalk)._existsJsGlobal_(aString);
  9978. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.klass)});
  9979. },
  9980. args: ["aString"],
  9981. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  9982. referencedClasses: ["Smalltalk"],
  9983. messageSends: ["existsJsGlobal:"]
  9984. }),
  9985. $globals.NativeFunction.klass);
  9986. $core.addMethod(
  9987. $core.method({
  9988. selector: "functionNamed:",
  9989. protocol: 'function calling',
  9990. fn: function (aString){
  9991. var self=this;
  9992. return $core.withContext(function($ctx1) {
  9993. var nativeFunc=(new Function('return this'))()[aString];
  9994. return nativeFunc();
  9995. ;
  9996. return self;
  9997. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9998. },
  9999. args: ["aString"],
  10000. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  10001. referencedClasses: [],
  10002. messageSends: []
  10003. }),
  10004. $globals.NativeFunction.klass);
  10005. $core.addMethod(
  10006. $core.method({
  10007. selector: "functionNamed:value:",
  10008. protocol: 'function calling',
  10009. fn: function (aString,anObject){
  10010. var self=this;
  10011. return $core.withContext(function($ctx1) {
  10012. var nativeFunc=(new Function('return this'))()[aString];
  10013. return nativeFunc(anObject);
  10014. ;
  10015. return self;
  10016. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  10017. },
  10018. args: ["aString", "anObject"],
  10019. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  10020. referencedClasses: [],
  10021. messageSends: []
  10022. }),
  10023. $globals.NativeFunction.klass);
  10024. $core.addMethod(
  10025. $core.method({
  10026. selector: "functionNamed:value:value:",
  10027. protocol: 'function calling',
  10028. fn: function (aString,anObject,anObject2){
  10029. var self=this;
  10030. return $core.withContext(function($ctx1) {
  10031. var nativeFunc=(new Function('return this'))()[aString];
  10032. return nativeFunc(anObject,anObject2);
  10033. ;
  10034. return self;
  10035. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10036. },
  10037. args: ["aString", "anObject", "anObject2"],
  10038. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  10039. referencedClasses: [],
  10040. messageSends: []
  10041. }),
  10042. $globals.NativeFunction.klass);
  10043. $core.addMethod(
  10044. $core.method({
  10045. selector: "functionNamed:value:value:value:",
  10046. protocol: 'function calling',
  10047. fn: function (aString,anObject,anObject2,anObject3){
  10048. var self=this;
  10049. return $core.withContext(function($ctx1) {
  10050. var nativeFunc=(new Function('return this'))()[aString];
  10051. return nativeFunc(anObject,anObject2, anObject3);
  10052. ;
  10053. return self;
  10054. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10055. },
  10056. args: ["aString", "anObject", "anObject2", "anObject3"],
  10057. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  10058. referencedClasses: [],
  10059. messageSends: []
  10060. }),
  10061. $globals.NativeFunction.klass);
  10062. $core.addMethod(
  10063. $core.method({
  10064. selector: "functionNamed:valueWithArgs:",
  10065. protocol: 'function calling',
  10066. fn: function (aString,args){
  10067. var self=this;
  10068. return $core.withContext(function($ctx1) {
  10069. var nativeFunc=(new Function('return this'))()[aString];
  10070. return Function.prototype.apply.call(nativeFunc, null, args);
  10071. ;
  10072. return self;
  10073. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.klass)});
  10074. },
  10075. args: ["aString", "args"],
  10076. source: "functionNamed: aString valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  10077. referencedClasses: [],
  10078. messageSends: []
  10079. }),
  10080. $globals.NativeFunction.klass);
  10081. $core.addMethod(
  10082. $core.method({
  10083. selector: "functionOf:",
  10084. protocol: 'function calling',
  10085. fn: function (nativeFunc){
  10086. var self=this;
  10087. return $core.withContext(function($ctx1) {
  10088. return nativeFunc();
  10089. ;
  10090. return self;
  10091. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  10092. },
  10093. args: ["nativeFunc"],
  10094. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  10095. referencedClasses: [],
  10096. messageSends: []
  10097. }),
  10098. $globals.NativeFunction.klass);
  10099. $core.addMethod(
  10100. $core.method({
  10101. selector: "functionOf:value:",
  10102. protocol: 'function calling',
  10103. fn: function (nativeFunc,anObject){
  10104. var self=this;
  10105. return $core.withContext(function($ctx1) {
  10106. return nativeFunc(anObject);
  10107. ;
  10108. return self;
  10109. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  10110. },
  10111. args: ["nativeFunc", "anObject"],
  10112. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  10113. referencedClasses: [],
  10114. messageSends: []
  10115. }),
  10116. $globals.NativeFunction.klass);
  10117. $core.addMethod(
  10118. $core.method({
  10119. selector: "functionOf:value:value:",
  10120. protocol: 'function calling',
  10121. fn: function (nativeFunc,anObject,anObject2){
  10122. var self=this;
  10123. return $core.withContext(function($ctx1) {
  10124. return nativeFunc(anObject,anObject2);
  10125. ;
  10126. return self;
  10127. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10128. },
  10129. args: ["nativeFunc", "anObject", "anObject2"],
  10130. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  10131. referencedClasses: [],
  10132. messageSends: []
  10133. }),
  10134. $globals.NativeFunction.klass);
  10135. $core.addMethod(
  10136. $core.method({
  10137. selector: "functionOf:value:value:value:",
  10138. protocol: 'function calling',
  10139. fn: function (nativeFunc,anObject,anObject2,anObject3){
  10140. var self=this;
  10141. return $core.withContext(function($ctx1) {
  10142. return nativeFunc(anObject,anObject2, anObject3);
  10143. ;
  10144. return self;
  10145. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10146. },
  10147. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  10148. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  10149. referencedClasses: [],
  10150. messageSends: []
  10151. }),
  10152. $globals.NativeFunction.klass);
  10153. $core.addMethod(
  10154. $core.method({
  10155. selector: "functionOf:valueWithArgs:",
  10156. protocol: 'function calling',
  10157. fn: function (nativeFunc,args){
  10158. var self=this;
  10159. return $core.withContext(function($ctx1) {
  10160. return Function.prototype.apply.call(nativeFunc, null, args);
  10161. ;
  10162. return self;
  10163. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.klass)});
  10164. },
  10165. args: ["nativeFunc", "args"],
  10166. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  10167. referencedClasses: [],
  10168. messageSends: []
  10169. }),
  10170. $globals.NativeFunction.klass);
  10171. $core.addMethod(
  10172. $core.method({
  10173. selector: "methodOf:this:",
  10174. protocol: 'method calling',
  10175. fn: function (nativeFunc,thisObject){
  10176. var self=this;
  10177. return $core.withContext(function($ctx1) {
  10178. return Function.prototype.call.call(nativeFunc, thisObject);
  10179. ;
  10180. return self;
  10181. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.klass)});
  10182. },
  10183. args: ["nativeFunc", "thisObject"],
  10184. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  10185. referencedClasses: [],
  10186. messageSends: []
  10187. }),
  10188. $globals.NativeFunction.klass);
  10189. $core.addMethod(
  10190. $core.method({
  10191. selector: "methodOf:this:value:",
  10192. protocol: 'method calling',
  10193. fn: function (nativeFunc,thisObject,anObject){
  10194. var self=this;
  10195. return $core.withContext(function($ctx1) {
  10196. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  10197. ;
  10198. return self;
  10199. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.klass)});
  10200. },
  10201. args: ["nativeFunc", "thisObject", "anObject"],
  10202. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  10203. referencedClasses: [],
  10204. messageSends: []
  10205. }),
  10206. $globals.NativeFunction.klass);
  10207. $core.addMethod(
  10208. $core.method({
  10209. selector: "methodOf:this:value:value:",
  10210. protocol: 'method calling',
  10211. fn: function (nativeFunc,thisObject,anObject,anObject2){
  10212. var self=this;
  10213. return $core.withContext(function($ctx1) {
  10214. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  10215. ;
  10216. return self;
  10217. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10218. },
  10219. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  10220. 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'>",
  10221. referencedClasses: [],
  10222. messageSends: []
  10223. }),
  10224. $globals.NativeFunction.klass);
  10225. $core.addMethod(
  10226. $core.method({
  10227. selector: "methodOf:this:value:value:value:",
  10228. protocol: 'method calling',
  10229. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  10230. var self=this;
  10231. return $core.withContext(function($ctx1) {
  10232. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  10233. ;
  10234. return self;
  10235. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10236. },
  10237. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  10238. 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'>",
  10239. referencedClasses: [],
  10240. messageSends: []
  10241. }),
  10242. $globals.NativeFunction.klass);
  10243. $core.addMethod(
  10244. $core.method({
  10245. selector: "methodOf:this:valueWithArgs:",
  10246. protocol: 'method calling',
  10247. fn: function (nativeFunc,thisObject,args){
  10248. var self=this;
  10249. return $core.withContext(function($ctx1) {
  10250. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  10251. ;
  10252. return self;
  10253. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.klass)});
  10254. },
  10255. args: ["nativeFunc", "thisObject", "args"],
  10256. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  10257. referencedClasses: [],
  10258. messageSends: []
  10259. }),
  10260. $globals.NativeFunction.klass);
  10261. $core.addClass('Timeout', $globals.Object, ['rawTimeout'], 'Kernel-Methods');
  10262. $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.";
  10263. $core.addMethod(
  10264. $core.method({
  10265. selector: "clearInterval",
  10266. protocol: 'timeout/interval',
  10267. fn: function (){
  10268. var self=this;
  10269. return $core.withContext(function($ctx1) {
  10270. var interval = self["@rawTimeout"];
  10271. clearInterval(interval);
  10272. ;
  10273. return self;
  10274. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  10275. },
  10276. args: [],
  10277. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  10278. referencedClasses: [],
  10279. messageSends: []
  10280. }),
  10281. $globals.Timeout);
  10282. $core.addMethod(
  10283. $core.method({
  10284. selector: "clearTimeout",
  10285. protocol: 'timeout/interval',
  10286. fn: function (){
  10287. var self=this;
  10288. return $core.withContext(function($ctx1) {
  10289. var timeout = self["@rawTimeout"];
  10290. clearTimeout(timeout);
  10291. ;
  10292. return self;
  10293. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  10294. },
  10295. args: [],
  10296. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  10297. referencedClasses: [],
  10298. messageSends: []
  10299. }),
  10300. $globals.Timeout);
  10301. $core.addMethod(
  10302. $core.method({
  10303. selector: "rawTimeout:",
  10304. protocol: 'accessing',
  10305. fn: function (anObject){
  10306. var self=this;
  10307. self["@rawTimeout"]=anObject;
  10308. return self;
  10309. },
  10310. args: ["anObject"],
  10311. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  10312. referencedClasses: [],
  10313. messageSends: []
  10314. }),
  10315. $globals.Timeout);
  10316. $core.addMethod(
  10317. $core.method({
  10318. selector: "on:",
  10319. protocol: 'instance creation',
  10320. fn: function (anObject){
  10321. var self=this;
  10322. return $core.withContext(function($ctx1) {
  10323. var $1;
  10324. $1=self._new();
  10325. $recv($1)._rawTimeout_(anObject);
  10326. return $recv($1)._yourself();
  10327. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.klass)});
  10328. },
  10329. args: ["anObject"],
  10330. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  10331. referencedClasses: [],
  10332. messageSends: ["rawTimeout:", "new", "yourself"]
  10333. }),
  10334. $globals.Timeout.klass);
  10335. });
  10336. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  10337. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  10338. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  10339. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  10340. $core.addPackage('Kernel-Collections');
  10341. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  10342. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  10343. $core.addClass('Association', $globals.Object, ['key', 'value'], 'Kernel-Collections');
  10344. $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:`";
  10345. $core.addMethod(
  10346. $core.method({
  10347. selector: "=",
  10348. protocol: 'comparing',
  10349. fn: function (anAssociation){
  10350. var self=this;
  10351. return $core.withContext(function($ctx1) {
  10352. var $3,$2,$5,$4,$6,$1;
  10353. $3=self._class();
  10354. $ctx1.sendIdx["class"]=1;
  10355. $2=$recv($3).__eq($recv(anAssociation)._class());
  10356. $ctx1.sendIdx["="]=1;
  10357. $1=$recv($2)._and_((function(){
  10358. return $core.withContext(function($ctx2) {
  10359. $5=self._key();
  10360. $ctx2.sendIdx["key"]=1;
  10361. $4=$recv($5).__eq($recv(anAssociation)._key());
  10362. $ctx2.sendIdx["="]=2;
  10363. return $recv($4)._and_((function(){
  10364. return $core.withContext(function($ctx3) {
  10365. $6=self._value();
  10366. $ctx3.sendIdx["value"]=1;
  10367. return $recv($6).__eq($recv(anAssociation)._value());
  10368. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  10369. }));
  10370. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10371. }));
  10372. $ctx1.sendIdx["and:"]=1;
  10373. return $1;
  10374. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  10375. },
  10376. args: ["anAssociation"],
  10377. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  10378. referencedClasses: [],
  10379. messageSends: ["and:", "=", "class", "key", "value"]
  10380. }),
  10381. $globals.Association);
  10382. $core.addMethod(
  10383. $core.method({
  10384. selector: "key",
  10385. protocol: 'accessing',
  10386. fn: function (){
  10387. var self=this;
  10388. return self["@key"];
  10389. },
  10390. args: [],
  10391. source: "key\x0a\x09^ key",
  10392. referencedClasses: [],
  10393. messageSends: []
  10394. }),
  10395. $globals.Association);
  10396. $core.addMethod(
  10397. $core.method({
  10398. selector: "key:",
  10399. protocol: 'accessing',
  10400. fn: function (aKey){
  10401. var self=this;
  10402. self["@key"]=aKey;
  10403. return self;
  10404. },
  10405. args: ["aKey"],
  10406. source: "key: aKey\x0a\x09key := aKey",
  10407. referencedClasses: [],
  10408. messageSends: []
  10409. }),
  10410. $globals.Association);
  10411. $core.addMethod(
  10412. $core.method({
  10413. selector: "printOn:",
  10414. protocol: 'printing',
  10415. fn: function (aStream){
  10416. var self=this;
  10417. return $core.withContext(function($ctx1) {
  10418. $recv(self._key())._printOn_(aStream);
  10419. $ctx1.sendIdx["printOn:"]=1;
  10420. $recv(aStream)._nextPutAll_(" -> ");
  10421. $recv(self._value())._printOn_(aStream);
  10422. return self;
  10423. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  10424. },
  10425. args: ["aStream"],
  10426. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  10427. referencedClasses: [],
  10428. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  10429. }),
  10430. $globals.Association);
  10431. $core.addMethod(
  10432. $core.method({
  10433. selector: "value",
  10434. protocol: 'accessing',
  10435. fn: function (){
  10436. var self=this;
  10437. return self["@value"];
  10438. },
  10439. args: [],
  10440. source: "value\x0a\x09^ value",
  10441. referencedClasses: [],
  10442. messageSends: []
  10443. }),
  10444. $globals.Association);
  10445. $core.addMethod(
  10446. $core.method({
  10447. selector: "value:",
  10448. protocol: 'accessing',
  10449. fn: function (aValue){
  10450. var self=this;
  10451. self["@value"]=aValue;
  10452. return self;
  10453. },
  10454. args: ["aValue"],
  10455. source: "value: aValue\x0a\x09value := aValue",
  10456. referencedClasses: [],
  10457. messageSends: []
  10458. }),
  10459. $globals.Association);
  10460. $core.addMethod(
  10461. $core.method({
  10462. selector: "key:value:",
  10463. protocol: 'instance creation',
  10464. fn: function (aKey,aValue){
  10465. var self=this;
  10466. return $core.withContext(function($ctx1) {
  10467. var $1;
  10468. $1=self._new();
  10469. $recv($1)._key_(aKey);
  10470. $recv($1)._value_(aValue);
  10471. return $recv($1)._yourself();
  10472. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  10473. },
  10474. args: ["aKey", "aValue"],
  10475. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  10476. referencedClasses: [],
  10477. messageSends: ["key:", "new", "value:", "yourself"]
  10478. }),
  10479. $globals.Association.klass);
  10480. $core.addClass('BucketStore', $globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  10481. $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`.";
  10482. $core.addMethod(
  10483. $core.method({
  10484. selector: "bucketOfElement:",
  10485. protocol: 'accessing',
  10486. fn: function (anObject){
  10487. var self=this;
  10488. return $core.withContext(function($ctx1) {
  10489. var hash = self['@hashBlock'](anObject);
  10490. if (!hash) return null;
  10491. var buckets = self['@buckets'],
  10492. bucket = buckets[hash];
  10493. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  10494. return bucket;
  10495. ;
  10496. return self;
  10497. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  10498. },
  10499. args: ["anObject"],
  10500. 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'>",
  10501. referencedClasses: [],
  10502. messageSends: []
  10503. }),
  10504. $globals.BucketStore);
  10505. $core.addMethod(
  10506. $core.method({
  10507. selector: "do:",
  10508. protocol: 'enumerating',
  10509. fn: function (aBlock){
  10510. var self=this;
  10511. return $core.withContext(function($ctx1) {
  10512. var buckets = self['@buckets'];
  10513. var keys = Object.keys(buckets);
  10514. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  10515. ;
  10516. return self;
  10517. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  10518. },
  10519. args: ["aBlock"],
  10520. 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'>",
  10521. referencedClasses: [],
  10522. messageSends: []
  10523. }),
  10524. $globals.BucketStore);
  10525. $core.addMethod(
  10526. $core.method({
  10527. selector: "hashBlock:",
  10528. protocol: 'accessing',
  10529. fn: function (aBlock){
  10530. var self=this;
  10531. self["@hashBlock"]=aBlock;
  10532. return self;
  10533. },
  10534. args: ["aBlock"],
  10535. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  10536. referencedClasses: [],
  10537. messageSends: []
  10538. }),
  10539. $globals.BucketStore);
  10540. $core.addMethod(
  10541. $core.method({
  10542. selector: "initialize",
  10543. protocol: 'initialization',
  10544. fn: function (){
  10545. var self=this;
  10546. return $core.withContext(function($ctx1) {
  10547. (
  10548. $ctx1.supercall = true,
  10549. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  10550. $ctx1.supercall = false;
  10551. self._removeAll();
  10552. return self;
  10553. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  10554. },
  10555. args: [],
  10556. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  10557. referencedClasses: [],
  10558. messageSends: ["initialize", "removeAll"]
  10559. }),
  10560. $globals.BucketStore);
  10561. $core.addMethod(
  10562. $core.method({
  10563. selector: "newBucket",
  10564. protocol: 'private',
  10565. fn: function (){
  10566. var self=this;
  10567. return $core.withContext(function($ctx1) {
  10568. self._subclassResponsibility();
  10569. return self;
  10570. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  10571. },
  10572. args: [],
  10573. source: "newBucket\x0a\x09self subclassResponsibility",
  10574. referencedClasses: [],
  10575. messageSends: ["subclassResponsibility"]
  10576. }),
  10577. $globals.BucketStore);
  10578. $core.addMethod(
  10579. $core.method({
  10580. selector: "removeAll",
  10581. protocol: 'adding/removing',
  10582. fn: function (){
  10583. var self=this;
  10584. return $core.withContext(function($ctx1) {
  10585. self['@buckets'] = Object.create(null);;
  10586. return self;
  10587. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  10588. },
  10589. args: [],
  10590. source: "removeAll\x0a\x09<inlineJS: 'self[''@buckets''] = Object.create(null);'>",
  10591. referencedClasses: [],
  10592. messageSends: []
  10593. }),
  10594. $globals.BucketStore);
  10595. $core.addMethod(
  10596. $core.method({
  10597. selector: "hashBlock:",
  10598. protocol: 'instance creation',
  10599. fn: function (aBlock){
  10600. var self=this;
  10601. return $core.withContext(function($ctx1) {
  10602. var $1;
  10603. $1=self._new();
  10604. $recv($1)._hashBlock_(aBlock);
  10605. return $recv($1)._yourself();
  10606. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  10607. },
  10608. args: ["aBlock"],
  10609. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  10610. referencedClasses: [],
  10611. messageSends: ["hashBlock:", "new", "yourself"]
  10612. }),
  10613. $globals.BucketStore.klass);
  10614. $core.addClass('ArrayBucketStore', $globals.BucketStore, [], 'Kernel-Collections');
  10615. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  10616. $core.addMethod(
  10617. $core.method({
  10618. selector: "newBucket",
  10619. protocol: 'private',
  10620. fn: function (){
  10621. var self=this;
  10622. return [];
  10623. },
  10624. args: [],
  10625. source: "newBucket\x0a\x09^ #()",
  10626. referencedClasses: [],
  10627. messageSends: []
  10628. }),
  10629. $globals.ArrayBucketStore);
  10630. $core.addClass('Collection', $globals.Object, [], 'Kernel-Collections');
  10631. $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.";
  10632. $core.addMethod(
  10633. $core.method({
  10634. selector: ",",
  10635. protocol: 'copying',
  10636. fn: function (aCollection){
  10637. var self=this;
  10638. return $core.withContext(function($ctx1) {
  10639. var $1;
  10640. $1=self._copy();
  10641. $recv($1)._addAll_(aCollection);
  10642. return $recv($1)._yourself();
  10643. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  10644. },
  10645. args: ["aCollection"],
  10646. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10647. referencedClasses: [],
  10648. messageSends: ["addAll:", "copy", "yourself"]
  10649. }),
  10650. $globals.Collection);
  10651. $core.addMethod(
  10652. $core.method({
  10653. selector: "add:",
  10654. protocol: 'adding/removing',
  10655. fn: function (anObject){
  10656. var self=this;
  10657. return $core.withContext(function($ctx1) {
  10658. self._subclassResponsibility();
  10659. return self;
  10660. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  10661. },
  10662. args: ["anObject"],
  10663. source: "add: anObject\x0a\x09self subclassResponsibility",
  10664. referencedClasses: [],
  10665. messageSends: ["subclassResponsibility"]
  10666. }),
  10667. $globals.Collection);
  10668. $core.addMethod(
  10669. $core.method({
  10670. selector: "addAll:",
  10671. protocol: 'adding/removing',
  10672. fn: function (aCollection){
  10673. var self=this;
  10674. return $core.withContext(function($ctx1) {
  10675. $recv(aCollection)._do_((function(each){
  10676. return $core.withContext(function($ctx2) {
  10677. return self._add_(each);
  10678. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10679. }));
  10680. return aCollection;
  10681. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  10682. },
  10683. args: ["aCollection"],
  10684. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  10685. referencedClasses: [],
  10686. messageSends: ["do:", "add:"]
  10687. }),
  10688. $globals.Collection);
  10689. $core.addMethod(
  10690. $core.method({
  10691. selector: "allSatisfy:",
  10692. protocol: 'enumerating',
  10693. fn: function (aBlock){
  10694. var self=this;
  10695. return $core.withContext(function($ctx1) {
  10696. var $1;
  10697. var $early={};
  10698. try {
  10699. self._do_((function(each){
  10700. return $core.withContext(function($ctx2) {
  10701. $1=$recv(aBlock)._value_(each);
  10702. if(!$core.assert($1)){
  10703. throw $early=[false];
  10704. };
  10705. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10706. }));
  10707. return true;
  10708. }
  10709. catch(e) {if(e===$early)return e[0]; throw e}
  10710. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  10711. },
  10712. args: ["aBlock"],
  10713. 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",
  10714. referencedClasses: [],
  10715. messageSends: ["do:", "ifFalse:", "value:"]
  10716. }),
  10717. $globals.Collection);
  10718. $core.addMethod(
  10719. $core.method({
  10720. selector: "anyOne",
  10721. protocol: 'accessing',
  10722. fn: function (){
  10723. var self=this;
  10724. return $core.withContext(function($ctx1) {
  10725. var $early={};
  10726. try {
  10727. self._ifEmpty_((function(){
  10728. return $core.withContext(function($ctx2) {
  10729. return self._error_("Collection is empty");
  10730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10731. }));
  10732. self._do_((function(each){
  10733. throw $early=[each];
  10734. }));
  10735. return self;
  10736. }
  10737. catch(e) {if(e===$early)return e[0]; throw e}
  10738. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  10739. },
  10740. args: [],
  10741. 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 ]",
  10742. referencedClasses: [],
  10743. messageSends: ["ifEmpty:", "error:", "do:"]
  10744. }),
  10745. $globals.Collection);
  10746. $core.addMethod(
  10747. $core.method({
  10748. selector: "anySatisfy:",
  10749. protocol: 'enumerating',
  10750. fn: function (aBlock){
  10751. var self=this;
  10752. return $core.withContext(function($ctx1) {
  10753. var $1;
  10754. var $early={};
  10755. try {
  10756. self._do_((function(each){
  10757. return $core.withContext(function($ctx2) {
  10758. $1=$recv(aBlock)._value_(each);
  10759. if($core.assert($1)){
  10760. throw $early=[true];
  10761. };
  10762. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10763. }));
  10764. return false;
  10765. }
  10766. catch(e) {if(e===$early)return e[0]; throw e}
  10767. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  10768. },
  10769. args: ["aBlock"],
  10770. 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",
  10771. referencedClasses: [],
  10772. messageSends: ["do:", "ifTrue:", "value:"]
  10773. }),
  10774. $globals.Collection);
  10775. $core.addMethod(
  10776. $core.method({
  10777. selector: "asArray",
  10778. protocol: 'converting',
  10779. fn: function (){
  10780. var self=this;
  10781. return $core.withContext(function($ctx1) {
  10782. return $recv($globals.Array)._withAll_(self);
  10783. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  10784. },
  10785. args: [],
  10786. source: "asArray\x0a\x09^ Array withAll: self",
  10787. referencedClasses: ["Array"],
  10788. messageSends: ["withAll:"]
  10789. }),
  10790. $globals.Collection);
  10791. $core.addMethod(
  10792. $core.method({
  10793. selector: "asJSON",
  10794. protocol: 'converting',
  10795. fn: function (){
  10796. var self=this;
  10797. return $core.withContext(function($ctx1) {
  10798. return $recv(self._asArray())._collect_((function(each){
  10799. return $core.withContext(function($ctx2) {
  10800. return $recv(each)._asJSON();
  10801. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10802. }));
  10803. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)});
  10804. },
  10805. args: [],
  10806. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  10807. referencedClasses: [],
  10808. messageSends: ["collect:", "asArray", "asJSON"]
  10809. }),
  10810. $globals.Collection);
  10811. $core.addMethod(
  10812. $core.method({
  10813. selector: "asOrderedCollection",
  10814. protocol: 'converting',
  10815. fn: function (){
  10816. var self=this;
  10817. return $core.withContext(function($ctx1) {
  10818. return self._asArray();
  10819. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  10820. },
  10821. args: [],
  10822. source: "asOrderedCollection\x0a\x09^ self asArray",
  10823. referencedClasses: [],
  10824. messageSends: ["asArray"]
  10825. }),
  10826. $globals.Collection);
  10827. $core.addMethod(
  10828. $core.method({
  10829. selector: "asSet",
  10830. protocol: 'converting',
  10831. fn: function (){
  10832. var self=this;
  10833. return $core.withContext(function($ctx1) {
  10834. return $recv($globals.Set)._withAll_(self);
  10835. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  10836. },
  10837. args: [],
  10838. source: "asSet\x0a\x09^ Set withAll: self",
  10839. referencedClasses: ["Set"],
  10840. messageSends: ["withAll:"]
  10841. }),
  10842. $globals.Collection);
  10843. $core.addMethod(
  10844. $core.method({
  10845. selector: "collect:",
  10846. protocol: 'enumerating',
  10847. fn: function (aBlock){
  10848. var self=this;
  10849. var stream;
  10850. return $core.withContext(function($ctx1) {
  10851. stream=$recv($recv(self._class())._new())._writeStream();
  10852. self._do_((function(each){
  10853. return $core.withContext(function($ctx2) {
  10854. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  10855. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10856. }));
  10857. return $recv(stream)._contents();
  10858. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  10859. },
  10860. args: ["aBlock"],
  10861. 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",
  10862. referencedClasses: [],
  10863. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  10864. }),
  10865. $globals.Collection);
  10866. $core.addMethod(
  10867. $core.method({
  10868. selector: "copyWith:",
  10869. protocol: 'copying',
  10870. fn: function (anObject){
  10871. var self=this;
  10872. return $core.withContext(function($ctx1) {
  10873. var $1;
  10874. $1=self._copy();
  10875. $recv($1)._add_(anObject);
  10876. return $recv($1)._yourself();
  10877. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  10878. },
  10879. args: ["anObject"],
  10880. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  10881. referencedClasses: [],
  10882. messageSends: ["add:", "copy", "yourself"]
  10883. }),
  10884. $globals.Collection);
  10885. $core.addMethod(
  10886. $core.method({
  10887. selector: "copyWithAll:",
  10888. protocol: 'copying',
  10889. fn: function (aCollection){
  10890. var self=this;
  10891. return $core.withContext(function($ctx1) {
  10892. var $1;
  10893. $1=self._copy();
  10894. $recv($1)._addAll_(aCollection);
  10895. return $recv($1)._yourself();
  10896. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  10897. },
  10898. args: ["aCollection"],
  10899. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  10900. referencedClasses: [],
  10901. messageSends: ["addAll:", "copy", "yourself"]
  10902. }),
  10903. $globals.Collection);
  10904. $core.addMethod(
  10905. $core.method({
  10906. selector: "copyWithoutAll:",
  10907. protocol: 'copying',
  10908. fn: function (aCollection){
  10909. var self=this;
  10910. return $core.withContext(function($ctx1) {
  10911. return self._reject_((function(each){
  10912. return $core.withContext(function($ctx2) {
  10913. return $recv(aCollection)._includes_(each);
  10914. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10915. }));
  10916. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  10917. },
  10918. args: ["aCollection"],
  10919. 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 ]",
  10920. referencedClasses: [],
  10921. messageSends: ["reject:", "includes:"]
  10922. }),
  10923. $globals.Collection);
  10924. $core.addMethod(
  10925. $core.method({
  10926. selector: "deepCopy",
  10927. protocol: 'copying',
  10928. fn: function (){
  10929. var self=this;
  10930. return $core.withContext(function($ctx1) {
  10931. return self._collect_((function(each){
  10932. return $core.withContext(function($ctx2) {
  10933. return $recv(each)._deepCopy();
  10934. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10935. }));
  10936. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  10937. },
  10938. args: [],
  10939. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  10940. referencedClasses: [],
  10941. messageSends: ["collect:", "deepCopy"]
  10942. }),
  10943. $globals.Collection);
  10944. $core.addMethod(
  10945. $core.method({
  10946. selector: "detect:",
  10947. protocol: 'enumerating',
  10948. fn: function (aBlock){
  10949. var self=this;
  10950. return $core.withContext(function($ctx1) {
  10951. return self._detect_ifNone_(aBlock,(function(){
  10952. return $core.withContext(function($ctx2) {
  10953. return self._errorNotFound();
  10954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10955. }));
  10956. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  10957. },
  10958. args: ["aBlock"],
  10959. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  10960. referencedClasses: [],
  10961. messageSends: ["detect:ifNone:", "errorNotFound"]
  10962. }),
  10963. $globals.Collection);
  10964. $core.addMethod(
  10965. $core.method({
  10966. selector: "detect:ifNone:",
  10967. protocol: 'enumerating',
  10968. fn: function (aBlock,anotherBlock){
  10969. var self=this;
  10970. return $core.withContext(function($ctx1) {
  10971. self._subclassResponsibility();
  10972. return self;
  10973. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10974. },
  10975. args: ["aBlock", "anotherBlock"],
  10976. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  10977. referencedClasses: [],
  10978. messageSends: ["subclassResponsibility"]
  10979. }),
  10980. $globals.Collection);
  10981. $core.addMethod(
  10982. $core.method({
  10983. selector: "do:",
  10984. protocol: 'enumerating',
  10985. fn: function (aBlock){
  10986. var self=this;
  10987. return $core.withContext(function($ctx1) {
  10988. self._subclassResponsibility();
  10989. return self;
  10990. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  10991. },
  10992. args: ["aBlock"],
  10993. source: "do: aBlock\x0a\x09self subclassResponsibility",
  10994. referencedClasses: [],
  10995. messageSends: ["subclassResponsibility"]
  10996. }),
  10997. $globals.Collection);
  10998. $core.addMethod(
  10999. $core.method({
  11000. selector: "do:separatedBy:",
  11001. protocol: 'enumerating',
  11002. fn: function (aBlock,anotherBlock){
  11003. var self=this;
  11004. var actionBeforeElement;
  11005. return $core.withContext(function($ctx1) {
  11006. actionBeforeElement=(function(){
  11007. actionBeforeElement=anotherBlock;
  11008. return actionBeforeElement;
  11009. });
  11010. self._do_((function(each){
  11011. return $core.withContext(function($ctx2) {
  11012. $recv(actionBeforeElement)._value();
  11013. return $recv(aBlock)._value_(each);
  11014. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  11015. }));
  11016. return self;
  11017. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  11018. },
  11019. args: ["aBlock", "anotherBlock"],
  11020. 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 ]",
  11021. referencedClasses: [],
  11022. messageSends: ["do:", "value", "value:"]
  11023. }),
  11024. $globals.Collection);
  11025. $core.addMethod(
  11026. $core.method({
  11027. selector: "errorNotFound",
  11028. protocol: 'error handling',
  11029. fn: function (){
  11030. var self=this;
  11031. return $core.withContext(function($ctx1) {
  11032. self._error_("Object is not in the collection");
  11033. return self;
  11034. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  11035. },
  11036. args: [],
  11037. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  11038. referencedClasses: [],
  11039. messageSends: ["error:"]
  11040. }),
  11041. $globals.Collection);
  11042. $core.addMethod(
  11043. $core.method({
  11044. selector: "ifEmpty:",
  11045. protocol: 'testing',
  11046. fn: function (aBlock){
  11047. var self=this;
  11048. return $core.withContext(function($ctx1) {
  11049. var $1;
  11050. $1=self._isEmpty();
  11051. if($core.assert($1)){
  11052. return $recv(aBlock)._value();
  11053. } else {
  11054. return self;
  11055. };
  11056. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  11057. },
  11058. args: ["aBlock"],
  11059. 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 ]",
  11060. referencedClasses: [],
  11061. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  11062. }),
  11063. $globals.Collection);
  11064. $core.addMethod(
  11065. $core.method({
  11066. selector: "ifEmpty:ifNotEmpty:",
  11067. protocol: 'testing',
  11068. fn: function (aBlock,anotherBlock){
  11069. var self=this;
  11070. return $core.withContext(function($ctx1) {
  11071. var $1;
  11072. $1=self._isEmpty();
  11073. if($core.assert($1)){
  11074. return $recv(aBlock)._value();
  11075. } else {
  11076. return $recv(anotherBlock)._value_(self);
  11077. };
  11078. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  11079. },
  11080. args: ["aBlock", "anotherBlock"],
  11081. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  11082. referencedClasses: [],
  11083. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  11084. }),
  11085. $globals.Collection);
  11086. $core.addMethod(
  11087. $core.method({
  11088. selector: "ifNotEmpty:",
  11089. protocol: 'testing',
  11090. fn: function (aBlock){
  11091. var self=this;
  11092. return $core.withContext(function($ctx1) {
  11093. var $1;
  11094. $1=self._notEmpty();
  11095. if($core.assert($1)){
  11096. return $recv(aBlock)._value_(self);
  11097. } else {
  11098. return self;
  11099. };
  11100. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  11101. },
  11102. args: ["aBlock"],
  11103. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  11104. referencedClasses: [],
  11105. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  11106. }),
  11107. $globals.Collection);
  11108. $core.addMethod(
  11109. $core.method({
  11110. selector: "ifNotEmpty:ifEmpty:",
  11111. protocol: 'testing',
  11112. fn: function (aBlock,anotherBlock){
  11113. var self=this;
  11114. return $core.withContext(function($ctx1) {
  11115. var $1;
  11116. $1=self._notEmpty();
  11117. if($core.assert($1)){
  11118. return $recv(aBlock)._value_(self);
  11119. } else {
  11120. return $recv(anotherBlock)._value();
  11121. };
  11122. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  11123. },
  11124. args: ["aBlock", "anotherBlock"],
  11125. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  11126. referencedClasses: [],
  11127. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  11128. }),
  11129. $globals.Collection);
  11130. $core.addMethod(
  11131. $core.method({
  11132. selector: "includes:",
  11133. protocol: 'testing',
  11134. fn: function (anObject){
  11135. var self=this;
  11136. return $core.withContext(function($ctx1) {
  11137. return self._anySatisfy_((function(each){
  11138. return $core.withContext(function($ctx2) {
  11139. return $recv(each).__eq(anObject);
  11140. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11141. }));
  11142. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  11143. },
  11144. args: ["anObject"],
  11145. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  11146. referencedClasses: [],
  11147. messageSends: ["anySatisfy:", "="]
  11148. }),
  11149. $globals.Collection);
  11150. $core.addMethod(
  11151. $core.method({
  11152. selector: "inject:into:",
  11153. protocol: 'enumerating',
  11154. fn: function (anObject,aBlock){
  11155. var self=this;
  11156. var result;
  11157. return $core.withContext(function($ctx1) {
  11158. result=anObject;
  11159. self._do_((function(each){
  11160. return $core.withContext(function($ctx2) {
  11161. result=$recv(aBlock)._value_value_(result,each);
  11162. return result;
  11163. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11164. }));
  11165. return result;
  11166. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  11167. },
  11168. args: ["anObject", "aBlock"],
  11169. 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",
  11170. referencedClasses: [],
  11171. messageSends: ["do:", "value:value:"]
  11172. }),
  11173. $globals.Collection);
  11174. $core.addMethod(
  11175. $core.method({
  11176. selector: "intersection:",
  11177. protocol: 'enumerating',
  11178. fn: function (aCollection){
  11179. var self=this;
  11180. var set,outputSet;
  11181. return $core.withContext(function($ctx1) {
  11182. var $2,$1;
  11183. set=self._asSet();
  11184. outputSet=$recv($globals.Set)._new();
  11185. $recv(aCollection)._do_((function(each){
  11186. return $core.withContext(function($ctx2) {
  11187. $2=$recv(set)._includes_(each);
  11188. $ctx2.sendIdx["includes:"]=1;
  11189. $1=$recv($2)._and_((function(){
  11190. return $core.withContext(function($ctx3) {
  11191. return $recv($recv(outputSet)._includes_(each))._not();
  11192. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  11193. }));
  11194. if($core.assert($1)){
  11195. return $recv(outputSet)._add_(each);
  11196. };
  11197. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11198. }));
  11199. return $recv(self._class())._withAll_($recv(outputSet)._asArray());
  11200. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  11201. },
  11202. args: ["aCollection"],
  11203. 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",
  11204. referencedClasses: ["Set"],
  11205. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  11206. }),
  11207. $globals.Collection);
  11208. $core.addMethod(
  11209. $core.method({
  11210. selector: "isEmpty",
  11211. protocol: 'testing',
  11212. fn: function (){
  11213. var self=this;
  11214. return $core.withContext(function($ctx1) {
  11215. return $recv(self._size()).__eq((0));
  11216. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  11217. },
  11218. args: [],
  11219. source: "isEmpty\x0a\x09^ self size = 0",
  11220. referencedClasses: [],
  11221. messageSends: ["=", "size"]
  11222. }),
  11223. $globals.Collection);
  11224. $core.addMethod(
  11225. $core.method({
  11226. selector: "noneSatisfy:",
  11227. protocol: 'enumerating',
  11228. fn: function (aBlock){
  11229. var self=this;
  11230. return $core.withContext(function($ctx1) {
  11231. var $1;
  11232. var $early={};
  11233. try {
  11234. self._do_((function(item){
  11235. return $core.withContext(function($ctx2) {
  11236. $1=$recv(aBlock)._value_(item);
  11237. if($core.assert($1)){
  11238. throw $early=[false];
  11239. };
  11240. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  11241. }));
  11242. return true;
  11243. }
  11244. catch(e) {if(e===$early)return e[0]; throw e}
  11245. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  11246. },
  11247. args: ["aBlock"],
  11248. 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",
  11249. referencedClasses: [],
  11250. messageSends: ["do:", "ifTrue:", "value:"]
  11251. }),
  11252. $globals.Collection);
  11253. $core.addMethod(
  11254. $core.method({
  11255. selector: "notEmpty",
  11256. protocol: 'testing',
  11257. fn: function (){
  11258. var self=this;
  11259. return $core.withContext(function($ctx1) {
  11260. return $recv(self._isEmpty())._not();
  11261. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  11262. },
  11263. args: [],
  11264. source: "notEmpty\x0a\x09^ self isEmpty not",
  11265. referencedClasses: [],
  11266. messageSends: ["not", "isEmpty"]
  11267. }),
  11268. $globals.Collection);
  11269. $core.addMethod(
  11270. $core.method({
  11271. selector: "occurrencesOf:",
  11272. protocol: 'accessing',
  11273. fn: function (anObject){
  11274. var self=this;
  11275. var tally;
  11276. return $core.withContext(function($ctx1) {
  11277. var $1;
  11278. tally=(0);
  11279. self._do_((function(each){
  11280. return $core.withContext(function($ctx2) {
  11281. $1=$recv(anObject).__eq(each);
  11282. if($core.assert($1)){
  11283. tally=$recv(tally).__plus((1));
  11284. return tally;
  11285. };
  11286. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11287. }));
  11288. return tally;
  11289. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  11290. },
  11291. args: ["anObject"],
  11292. 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",
  11293. referencedClasses: [],
  11294. messageSends: ["do:", "ifTrue:", "=", "+"]
  11295. }),
  11296. $globals.Collection);
  11297. $core.addMethod(
  11298. $core.method({
  11299. selector: "putOn:",
  11300. protocol: 'streaming',
  11301. fn: function (aStream){
  11302. var self=this;
  11303. return $core.withContext(function($ctx1) {
  11304. self._do_((function(each){
  11305. return $core.withContext(function($ctx2) {
  11306. return $recv(each)._putOn_(aStream);
  11307. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11308. }));
  11309. return self;
  11310. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  11311. },
  11312. args: ["aStream"],
  11313. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  11314. referencedClasses: [],
  11315. messageSends: ["do:", "putOn:"]
  11316. }),
  11317. $globals.Collection);
  11318. $core.addMethod(
  11319. $core.method({
  11320. selector: "reject:",
  11321. protocol: 'enumerating',
  11322. fn: function (aBlock){
  11323. var self=this;
  11324. return $core.withContext(function($ctx1) {
  11325. return self._select_((function(each){
  11326. return $core.withContext(function($ctx2) {
  11327. return $recv($recv(aBlock)._value_(each)).__eq(false);
  11328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11329. }));
  11330. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  11331. },
  11332. args: ["aBlock"],
  11333. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  11334. referencedClasses: [],
  11335. messageSends: ["select:", "=", "value:"]
  11336. }),
  11337. $globals.Collection);
  11338. $core.addMethod(
  11339. $core.method({
  11340. selector: "remove:",
  11341. protocol: 'adding/removing',
  11342. fn: function (anObject){
  11343. var self=this;
  11344. return $core.withContext(function($ctx1) {
  11345. return self._remove_ifAbsent_(anObject,(function(){
  11346. return $core.withContext(function($ctx2) {
  11347. return self._errorNotFound();
  11348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11349. }));
  11350. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  11351. },
  11352. args: ["anObject"],
  11353. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  11354. referencedClasses: [],
  11355. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  11356. }),
  11357. $globals.Collection);
  11358. $core.addMethod(
  11359. $core.method({
  11360. selector: "remove:ifAbsent:",
  11361. protocol: 'adding/removing',
  11362. fn: function (anObject,aBlock){
  11363. var self=this;
  11364. return $core.withContext(function($ctx1) {
  11365. self._subclassResponsibility();
  11366. return self;
  11367. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  11368. },
  11369. args: ["anObject", "aBlock"],
  11370. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  11371. referencedClasses: [],
  11372. messageSends: ["subclassResponsibility"]
  11373. }),
  11374. $globals.Collection);
  11375. $core.addMethod(
  11376. $core.method({
  11377. selector: "removeAll",
  11378. protocol: 'adding/removing',
  11379. fn: function (){
  11380. var self=this;
  11381. return $core.withContext(function($ctx1) {
  11382. self._subclassResponsibility();
  11383. return self;
  11384. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  11385. },
  11386. args: [],
  11387. source: "removeAll\x0a\x09self subclassResponsibility",
  11388. referencedClasses: [],
  11389. messageSends: ["subclassResponsibility"]
  11390. }),
  11391. $globals.Collection);
  11392. $core.addMethod(
  11393. $core.method({
  11394. selector: "select:",
  11395. protocol: 'enumerating',
  11396. fn: function (aBlock){
  11397. var self=this;
  11398. var stream;
  11399. return $core.withContext(function($ctx1) {
  11400. var $1;
  11401. stream=$recv($recv(self._class())._new())._writeStream();
  11402. self._do_((function(each){
  11403. return $core.withContext(function($ctx2) {
  11404. $1=$recv(aBlock)._value_(each);
  11405. if($core.assert($1)){
  11406. return $recv(stream)._nextPut_(each);
  11407. };
  11408. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11409. }));
  11410. return $recv(stream)._contents();
  11411. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  11412. },
  11413. args: ["aBlock"],
  11414. 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",
  11415. referencedClasses: [],
  11416. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11417. }),
  11418. $globals.Collection);
  11419. $core.addMethod(
  11420. $core.method({
  11421. selector: "select:thenCollect:",
  11422. protocol: 'enumerating',
  11423. fn: function (selectBlock,collectBlock){
  11424. var self=this;
  11425. var stream;
  11426. return $core.withContext(function($ctx1) {
  11427. var $1;
  11428. stream=$recv($recv(self._class())._new())._writeStream();
  11429. self._do_((function(each){
  11430. return $core.withContext(function($ctx2) {
  11431. $1=$recv(selectBlock)._value_(each);
  11432. $ctx2.sendIdx["value:"]=1;
  11433. if($core.assert($1)){
  11434. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  11435. };
  11436. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11437. }));
  11438. return $recv(stream)._contents();
  11439. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  11440. },
  11441. args: ["selectBlock", "collectBlock"],
  11442. 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",
  11443. referencedClasses: [],
  11444. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11445. }),
  11446. $globals.Collection);
  11447. $core.addMethod(
  11448. $core.method({
  11449. selector: "shallowCopy",
  11450. protocol: 'copying',
  11451. fn: function (){
  11452. var self=this;
  11453. return $core.withContext(function($ctx1) {
  11454. return self._collect_((function(each){
  11455. return each;
  11456. }));
  11457. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  11458. },
  11459. args: [],
  11460. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  11461. referencedClasses: [],
  11462. messageSends: ["collect:"]
  11463. }),
  11464. $globals.Collection);
  11465. $core.addMethod(
  11466. $core.method({
  11467. selector: "single",
  11468. protocol: 'accessing',
  11469. fn: function (){
  11470. var self=this;
  11471. return $core.withContext(function($ctx1) {
  11472. var $1;
  11473. self._ifEmpty_((function(){
  11474. return $core.withContext(function($ctx2) {
  11475. return self._error_("Collection is empty");
  11476. $ctx2.sendIdx["error:"]=1;
  11477. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11478. }));
  11479. $1=$recv(self._size()).__gt((1));
  11480. if($core.assert($1)){
  11481. self._error_("Collection holds more than one element");
  11482. };
  11483. return self._anyOne();
  11484. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  11485. },
  11486. args: [],
  11487. 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",
  11488. referencedClasses: [],
  11489. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  11490. }),
  11491. $globals.Collection);
  11492. $core.addMethod(
  11493. $core.method({
  11494. selector: "size",
  11495. protocol: 'accessing',
  11496. fn: function (){
  11497. var self=this;
  11498. return $core.withContext(function($ctx1) {
  11499. self._subclassResponsibility();
  11500. return self;
  11501. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  11502. },
  11503. args: [],
  11504. source: "size\x0a\x09self subclassResponsibility",
  11505. referencedClasses: [],
  11506. messageSends: ["subclassResponsibility"]
  11507. }),
  11508. $globals.Collection);
  11509. $core.addMethod(
  11510. $core.method({
  11511. selector: "classTag",
  11512. protocol: 'accessing',
  11513. fn: function (){
  11514. var self=this;
  11515. return "collection";
  11516. },
  11517. args: [],
  11518. 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'",
  11519. referencedClasses: [],
  11520. messageSends: []
  11521. }),
  11522. $globals.Collection.klass);
  11523. $core.addMethod(
  11524. $core.method({
  11525. selector: "new:",
  11526. protocol: 'instance creation',
  11527. fn: function (anInteger){
  11528. var self=this;
  11529. return $core.withContext(function($ctx1) {
  11530. return self._new();
  11531. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  11532. },
  11533. args: ["anInteger"],
  11534. source: "new: anInteger\x0a\x09^ self new",
  11535. referencedClasses: [],
  11536. messageSends: ["new"]
  11537. }),
  11538. $globals.Collection.klass);
  11539. $core.addMethod(
  11540. $core.method({
  11541. selector: "with:",
  11542. protocol: 'instance creation',
  11543. fn: function (anObject){
  11544. var self=this;
  11545. return $core.withContext(function($ctx1) {
  11546. var $1;
  11547. $1=self._new();
  11548. $recv($1)._add_(anObject);
  11549. return $recv($1)._yourself();
  11550. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  11551. },
  11552. args: ["anObject"],
  11553. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  11554. referencedClasses: [],
  11555. messageSends: ["add:", "new", "yourself"]
  11556. }),
  11557. $globals.Collection.klass);
  11558. $core.addMethod(
  11559. $core.method({
  11560. selector: "with:with:",
  11561. protocol: 'instance creation',
  11562. fn: function (anObject,anotherObject){
  11563. var self=this;
  11564. return $core.withContext(function($ctx1) {
  11565. var $1;
  11566. $1=self._new();
  11567. $recv($1)._add_(anObject);
  11568. $ctx1.sendIdx["add:"]=1;
  11569. $recv($1)._add_(anotherObject);
  11570. return $recv($1)._yourself();
  11571. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  11572. },
  11573. args: ["anObject", "anotherObject"],
  11574. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  11575. referencedClasses: [],
  11576. messageSends: ["add:", "new", "yourself"]
  11577. }),
  11578. $globals.Collection.klass);
  11579. $core.addMethod(
  11580. $core.method({
  11581. selector: "with:with:with:",
  11582. protocol: 'instance creation',
  11583. fn: function (firstObject,secondObject,thirdObject){
  11584. var self=this;
  11585. return $core.withContext(function($ctx1) {
  11586. var $1;
  11587. $1=self._new();
  11588. $recv($1)._add_(firstObject);
  11589. $ctx1.sendIdx["add:"]=1;
  11590. $recv($1)._add_(secondObject);
  11591. $ctx1.sendIdx["add:"]=2;
  11592. $recv($1)._add_(thirdObject);
  11593. return $recv($1)._yourself();
  11594. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  11595. },
  11596. args: ["firstObject", "secondObject", "thirdObject"],
  11597. 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",
  11598. referencedClasses: [],
  11599. messageSends: ["add:", "new", "yourself"]
  11600. }),
  11601. $globals.Collection.klass);
  11602. $core.addMethod(
  11603. $core.method({
  11604. selector: "withAll:",
  11605. protocol: 'instance creation',
  11606. fn: function (aCollection){
  11607. var self=this;
  11608. return $core.withContext(function($ctx1) {
  11609. var $1;
  11610. $1=self._new();
  11611. $recv($1)._addAll_(aCollection);
  11612. return $recv($1)._yourself();
  11613. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  11614. },
  11615. args: ["aCollection"],
  11616. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  11617. referencedClasses: [],
  11618. messageSends: ["addAll:", "new", "yourself"]
  11619. }),
  11620. $globals.Collection.klass);
  11621. $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections');
  11622. $globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
  11623. $core.addMethod(
  11624. $core.method({
  11625. selector: "at:",
  11626. protocol: 'accessing',
  11627. fn: function (anIndex){
  11628. var self=this;
  11629. return $core.withContext(function($ctx1) {
  11630. return self._at_ifAbsent_(anIndex,(function(){
  11631. return $core.withContext(function($ctx2) {
  11632. return self._errorNotFound();
  11633. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11634. }));
  11635. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  11636. },
  11637. args: ["anIndex"],
  11638. 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 ]",
  11639. referencedClasses: [],
  11640. messageSends: ["at:ifAbsent:", "errorNotFound"]
  11641. }),
  11642. $globals.IndexableCollection);
  11643. $core.addMethod(
  11644. $core.method({
  11645. selector: "at:ifAbsent:",
  11646. protocol: 'accessing',
  11647. fn: function (anIndex,aBlock){
  11648. var self=this;
  11649. return $core.withContext(function($ctx1) {
  11650. self._subclassResponsibility();
  11651. return self;
  11652. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11653. },
  11654. args: ["anIndex", "aBlock"],
  11655. 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",
  11656. referencedClasses: [],
  11657. messageSends: ["subclassResponsibility"]
  11658. }),
  11659. $globals.IndexableCollection);
  11660. $core.addMethod(
  11661. $core.method({
  11662. selector: "at:ifAbsentPut:",
  11663. protocol: 'accessing',
  11664. fn: function (aKey,aBlock){
  11665. var self=this;
  11666. return $core.withContext(function($ctx1) {
  11667. return self._at_ifAbsent_(aKey,(function(){
  11668. return $core.withContext(function($ctx2) {
  11669. return self._at_put_(aKey,$recv(aBlock)._value());
  11670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11671. }));
  11672. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  11673. },
  11674. args: ["aKey", "aBlock"],
  11675. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  11676. referencedClasses: [],
  11677. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  11678. }),
  11679. $globals.IndexableCollection);
  11680. $core.addMethod(
  11681. $core.method({
  11682. selector: "at:ifPresent:",
  11683. protocol: 'accessing',
  11684. fn: function (anIndex,aBlock){
  11685. var self=this;
  11686. return $core.withContext(function($ctx1) {
  11687. return self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  11688. return nil;
  11689. }));
  11690. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11691. },
  11692. args: ["anIndex", "aBlock"],
  11693. 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 ]",
  11694. referencedClasses: [],
  11695. messageSends: ["at:ifPresent:ifAbsent:"]
  11696. }),
  11697. $globals.IndexableCollection);
  11698. $core.addMethod(
  11699. $core.method({
  11700. selector: "at:ifPresent:ifAbsent:",
  11701. protocol: 'accessing',
  11702. fn: function (anIndex,aBlock,anotherBlock){
  11703. var self=this;
  11704. return $core.withContext(function($ctx1) {
  11705. self._subclassResponsibility();
  11706. return self;
  11707. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  11708. },
  11709. args: ["anIndex", "aBlock", "anotherBlock"],
  11710. 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",
  11711. referencedClasses: [],
  11712. messageSends: ["subclassResponsibility"]
  11713. }),
  11714. $globals.IndexableCollection);
  11715. $core.addMethod(
  11716. $core.method({
  11717. selector: "at:put:",
  11718. protocol: 'accessing',
  11719. fn: function (anIndex,anObject){
  11720. var self=this;
  11721. return $core.withContext(function($ctx1) {
  11722. self._subclassResponsibility();
  11723. return self;
  11724. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  11725. },
  11726. args: ["anIndex", "anObject"],
  11727. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  11728. referencedClasses: [],
  11729. messageSends: ["subclassResponsibility"]
  11730. }),
  11731. $globals.IndexableCollection);
  11732. $core.addMethod(
  11733. $core.method({
  11734. selector: "indexOf:",
  11735. protocol: 'accessing',
  11736. fn: function (anObject){
  11737. var self=this;
  11738. return $core.withContext(function($ctx1) {
  11739. return self._indexOf_ifAbsent_(anObject,(function(){
  11740. return $core.withContext(function($ctx2) {
  11741. return self._errorNotFound();
  11742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11743. }));
  11744. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  11745. },
  11746. args: ["anObject"],
  11747. 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 ]",
  11748. referencedClasses: [],
  11749. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  11750. }),
  11751. $globals.IndexableCollection);
  11752. $core.addMethod(
  11753. $core.method({
  11754. selector: "indexOf:ifAbsent:",
  11755. protocol: 'accessing',
  11756. fn: function (anObject,aBlock){
  11757. var self=this;
  11758. return $core.withContext(function($ctx1) {
  11759. self._subclassResponsibility();
  11760. return self;
  11761. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  11762. },
  11763. args: ["anObject", "aBlock"],
  11764. 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",
  11765. referencedClasses: [],
  11766. messageSends: ["subclassResponsibility"]
  11767. }),
  11768. $globals.IndexableCollection);
  11769. $core.addMethod(
  11770. $core.method({
  11771. selector: "with:do:",
  11772. protocol: 'enumerating',
  11773. fn: function (anotherCollection,aBlock){
  11774. var self=this;
  11775. return $core.withContext(function($ctx1) {
  11776. self._withIndexDo_((function(each,index){
  11777. return $core.withContext(function($ctx2) {
  11778. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  11779. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  11780. }));
  11781. return self;
  11782. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  11783. },
  11784. args: ["anotherCollection", "aBlock"],
  11785. 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) ]",
  11786. referencedClasses: [],
  11787. messageSends: ["withIndexDo:", "value:value:", "at:"]
  11788. }),
  11789. $globals.IndexableCollection);
  11790. $core.addMethod(
  11791. $core.method({
  11792. selector: "withIndexDo:",
  11793. protocol: 'enumerating',
  11794. fn: function (aBlock){
  11795. var self=this;
  11796. return $core.withContext(function($ctx1) {
  11797. self._subclassResponsibility();
  11798. return self;
  11799. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  11800. },
  11801. args: ["aBlock"],
  11802. 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",
  11803. referencedClasses: [],
  11804. messageSends: ["subclassResponsibility"]
  11805. }),
  11806. $globals.IndexableCollection);
  11807. $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  11808. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  11809. $core.addMethod(
  11810. $core.method({
  11811. selector: "=",
  11812. protocol: 'comparing',
  11813. fn: function (anAssocitativeCollection){
  11814. var self=this;
  11815. return $core.withContext(function($ctx1) {
  11816. var $2,$1,$4,$3,$5;
  11817. $2=self._class();
  11818. $ctx1.sendIdx["class"]=1;
  11819. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  11820. $ctx1.sendIdx["="]=1;
  11821. if(!$core.assert($1)){
  11822. return false;
  11823. };
  11824. $4=self._size();
  11825. $ctx1.sendIdx["size"]=1;
  11826. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  11827. $ctx1.sendIdx["="]=2;
  11828. if(!$core.assert($3)){
  11829. return false;
  11830. };
  11831. $5=self._associations();
  11832. $ctx1.sendIdx["associations"]=1;
  11833. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  11834. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  11835. },
  11836. args: ["anAssocitativeCollection"],
  11837. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  11838. referencedClasses: [],
  11839. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  11840. }),
  11841. $globals.AssociativeCollection);
  11842. $core.addMethod(
  11843. $core.method({
  11844. selector: "add:",
  11845. protocol: 'adding/removing',
  11846. fn: function (anAssociation){
  11847. var self=this;
  11848. return $core.withContext(function($ctx1) {
  11849. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  11850. return self;
  11851. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  11852. },
  11853. args: ["anAssociation"],
  11854. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  11855. referencedClasses: [],
  11856. messageSends: ["at:put:", "key", "value"]
  11857. }),
  11858. $globals.AssociativeCollection);
  11859. $core.addMethod(
  11860. $core.method({
  11861. selector: "addAll:",
  11862. protocol: 'adding/removing',
  11863. fn: function (anAssociativeCollection){
  11864. var self=this;
  11865. return $core.withContext(function($ctx1) {
  11866. (
  11867. $ctx1.supercall = true,
  11868. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  11869. $ctx1.supercall = false;
  11870. return anAssociativeCollection;
  11871. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  11872. },
  11873. args: ["anAssociativeCollection"],
  11874. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  11875. referencedClasses: [],
  11876. messageSends: ["addAll:", "associations"]
  11877. }),
  11878. $globals.AssociativeCollection);
  11879. $core.addMethod(
  11880. $core.method({
  11881. selector: "asDictionary",
  11882. protocol: 'converting',
  11883. fn: function (){
  11884. var self=this;
  11885. return $core.withContext(function($ctx1) {
  11886. return $recv($globals.Dictionary)._from_(self._associations());
  11887. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  11888. },
  11889. args: [],
  11890. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  11891. referencedClasses: ["Dictionary"],
  11892. messageSends: ["from:", "associations"]
  11893. }),
  11894. $globals.AssociativeCollection);
  11895. $core.addMethod(
  11896. $core.method({
  11897. selector: "asHashedCollection",
  11898. protocol: 'converting',
  11899. fn: function (){
  11900. var self=this;
  11901. return $core.withContext(function($ctx1) {
  11902. return $recv($globals.HashedCollection)._from_(self._associations());
  11903. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  11904. },
  11905. args: [],
  11906. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  11907. referencedClasses: ["HashedCollection"],
  11908. messageSends: ["from:", "associations"]
  11909. }),
  11910. $globals.AssociativeCollection);
  11911. $core.addMethod(
  11912. $core.method({
  11913. selector: "asJSON",
  11914. protocol: 'converting',
  11915. fn: function (){
  11916. var self=this;
  11917. var hash;
  11918. return $core.withContext(function($ctx1) {
  11919. hash=$recv($globals.HashedCollection)._new();
  11920. self._keysAndValuesDo_((function(key,value){
  11921. return $core.withContext(function($ctx2) {
  11922. return $recv(hash)._at_put_(key,$recv(value)._asJSON());
  11923. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11924. }));
  11925. return hash;
  11926. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
  11927. },
  11928. args: [],
  11929. source: "asJSON\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJSON ].\x0a\x09^ hash",
  11930. referencedClasses: ["HashedCollection"],
  11931. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  11932. }),
  11933. $globals.AssociativeCollection);
  11934. $core.addMethod(
  11935. $core.method({
  11936. selector: "associations",
  11937. protocol: 'accessing',
  11938. fn: function (){
  11939. var self=this;
  11940. var associations;
  11941. return $core.withContext(function($ctx1) {
  11942. associations=[];
  11943. self._associationsDo_((function(each){
  11944. return $core.withContext(function($ctx2) {
  11945. return $recv(associations)._add_(each);
  11946. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11947. }));
  11948. return associations;
  11949. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  11950. },
  11951. args: [],
  11952. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  11953. referencedClasses: [],
  11954. messageSends: ["associationsDo:", "add:"]
  11955. }),
  11956. $globals.AssociativeCollection);
  11957. $core.addMethod(
  11958. $core.method({
  11959. selector: "associationsDo:",
  11960. protocol: 'enumerating',
  11961. fn: function (aBlock){
  11962. var self=this;
  11963. return $core.withContext(function($ctx1) {
  11964. self._keysAndValuesDo_((function(key,value){
  11965. return $core.withContext(function($ctx2) {
  11966. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  11967. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11968. }));
  11969. return self;
  11970. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11971. },
  11972. args: ["aBlock"],
  11973. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  11974. referencedClasses: ["Association"],
  11975. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  11976. }),
  11977. $globals.AssociativeCollection);
  11978. $core.addMethod(
  11979. $core.method({
  11980. selector: "at:ifPresent:ifAbsent:",
  11981. protocol: 'accessing',
  11982. fn: function (aKey,aBlock,anotherBlock){
  11983. var self=this;
  11984. return $core.withContext(function($ctx1) {
  11985. var $1;
  11986. $1=self._includesKey_(aKey);
  11987. if($core.assert($1)){
  11988. return $recv(aBlock)._value_(self._at_(aKey));
  11989. } else {
  11990. return $recv(anotherBlock)._value();
  11991. };
  11992. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  11993. },
  11994. args: ["aKey", "aBlock", "anotherBlock"],
  11995. 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 ]",
  11996. referencedClasses: [],
  11997. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  11998. }),
  11999. $globals.AssociativeCollection);
  12000. $core.addMethod(
  12001. $core.method({
  12002. selector: "collect:",
  12003. protocol: 'enumerating',
  12004. fn: function (aBlock){
  12005. var self=this;
  12006. var newDict;
  12007. return $core.withContext(function($ctx1) {
  12008. newDict=$recv(self._class())._new();
  12009. self._keysAndValuesDo_((function(key,value){
  12010. return $core.withContext(function($ctx2) {
  12011. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  12012. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12013. }));
  12014. return newDict;
  12015. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12016. },
  12017. args: ["aBlock"],
  12018. 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",
  12019. referencedClasses: [],
  12020. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  12021. }),
  12022. $globals.AssociativeCollection);
  12023. $core.addMethod(
  12024. $core.method({
  12025. selector: "deepCopy",
  12026. protocol: 'copying',
  12027. fn: function (){
  12028. var self=this;
  12029. var copy;
  12030. return $core.withContext(function($ctx1) {
  12031. copy=$recv(self._class())._new();
  12032. self._keysAndValuesDo_((function(key,value){
  12033. return $core.withContext(function($ctx2) {
  12034. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  12035. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12036. }));
  12037. return copy;
  12038. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  12039. },
  12040. args: [],
  12041. 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",
  12042. referencedClasses: [],
  12043. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  12044. }),
  12045. $globals.AssociativeCollection);
  12046. $core.addMethod(
  12047. $core.method({
  12048. selector: "detect:ifNone:",
  12049. protocol: 'enumerating',
  12050. fn: function (aBlock,anotherBlock){
  12051. var self=this;
  12052. return $core.withContext(function($ctx1) {
  12053. return $recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  12054. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  12055. },
  12056. args: ["aBlock", "anotherBlock"],
  12057. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  12058. referencedClasses: [],
  12059. messageSends: ["detect:ifNone:", "values"]
  12060. }),
  12061. $globals.AssociativeCollection);
  12062. $core.addMethod(
  12063. $core.method({
  12064. selector: "do:",
  12065. protocol: 'enumerating',
  12066. fn: function (aBlock){
  12067. var self=this;
  12068. return $core.withContext(function($ctx1) {
  12069. self._valuesDo_(aBlock);
  12070. return self;
  12071. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12072. },
  12073. args: ["aBlock"],
  12074. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  12075. referencedClasses: [],
  12076. messageSends: ["valuesDo:"]
  12077. }),
  12078. $globals.AssociativeCollection);
  12079. $core.addMethod(
  12080. $core.method({
  12081. selector: "includes:",
  12082. protocol: 'enumerating',
  12083. fn: function (anObject){
  12084. var self=this;
  12085. return $core.withContext(function($ctx1) {
  12086. return $recv(self._values())._includes_(anObject);
  12087. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  12088. },
  12089. args: ["anObject"],
  12090. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  12091. referencedClasses: [],
  12092. messageSends: ["includes:", "values"]
  12093. }),
  12094. $globals.AssociativeCollection);
  12095. $core.addMethod(
  12096. $core.method({
  12097. selector: "includesKey:",
  12098. protocol: 'testing',
  12099. fn: function (aKey){
  12100. var self=this;
  12101. return $core.withContext(function($ctx1) {
  12102. self._subclassResponsibility();
  12103. return self;
  12104. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12105. },
  12106. args: ["aKey"],
  12107. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  12108. referencedClasses: [],
  12109. messageSends: ["subclassResponsibility"]
  12110. }),
  12111. $globals.AssociativeCollection);
  12112. $core.addMethod(
  12113. $core.method({
  12114. selector: "indexOf:ifAbsent:",
  12115. protocol: 'accessing',
  12116. fn: function (anObject,aBlock){
  12117. var self=this;
  12118. return $core.withContext(function($ctx1) {
  12119. return $recv(self._keys())._detect_ifNone_((function(each){
  12120. return $core.withContext(function($ctx2) {
  12121. return $recv(self._at_(each)).__eq(anObject);
  12122. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12123. }),aBlock);
  12124. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12125. },
  12126. args: ["anObject", "aBlock"],
  12127. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  12128. referencedClasses: [],
  12129. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  12130. }),
  12131. $globals.AssociativeCollection);
  12132. $core.addMethod(
  12133. $core.method({
  12134. selector: "keyAtValue:",
  12135. protocol: 'accessing',
  12136. fn: function (anObject){
  12137. var self=this;
  12138. return $core.withContext(function($ctx1) {
  12139. return self._keyAtValue_ifAbsent_(anObject,(function(){
  12140. return $core.withContext(function($ctx2) {
  12141. return self._errorNotFound();
  12142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12143. }));
  12144. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  12145. },
  12146. args: ["anObject"],
  12147. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  12148. referencedClasses: [],
  12149. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  12150. }),
  12151. $globals.AssociativeCollection);
  12152. $core.addMethod(
  12153. $core.method({
  12154. selector: "keyAtValue:ifAbsent:",
  12155. protocol: 'accessing',
  12156. fn: function (anObject,aBlock){
  12157. var self=this;
  12158. return $core.withContext(function($ctx1) {
  12159. return self._indexOf_ifAbsent_(anObject,aBlock);
  12160. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12161. },
  12162. args: ["anObject", "aBlock"],
  12163. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  12164. referencedClasses: [],
  12165. messageSends: ["indexOf:ifAbsent:"]
  12166. }),
  12167. $globals.AssociativeCollection);
  12168. $core.addMethod(
  12169. $core.method({
  12170. selector: "keys",
  12171. protocol: 'accessing',
  12172. fn: function (){
  12173. var self=this;
  12174. return $core.withContext(function($ctx1) {
  12175. self._subclassResponsibility();
  12176. return self;
  12177. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  12178. },
  12179. args: [],
  12180. source: "keys\x0a\x09self subclassResponsibility",
  12181. referencedClasses: [],
  12182. messageSends: ["subclassResponsibility"]
  12183. }),
  12184. $globals.AssociativeCollection);
  12185. $core.addMethod(
  12186. $core.method({
  12187. selector: "keysAndValuesDo:",
  12188. protocol: 'enumerating',
  12189. fn: function (aBlock){
  12190. var self=this;
  12191. return $core.withContext(function($ctx1) {
  12192. self._keysDo_((function(each){
  12193. return $core.withContext(function($ctx2) {
  12194. return $recv(aBlock)._value_value_(each,self._at_(each));
  12195. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12196. }));
  12197. return self;
  12198. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12199. },
  12200. args: ["aBlock"],
  12201. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  12202. referencedClasses: [],
  12203. messageSends: ["keysDo:", "value:value:", "at:"]
  12204. }),
  12205. $globals.AssociativeCollection);
  12206. $core.addMethod(
  12207. $core.method({
  12208. selector: "keysDo:",
  12209. protocol: 'enumerating',
  12210. fn: function (aBlock){
  12211. var self=this;
  12212. return $core.withContext(function($ctx1) {
  12213. self._subclassResponsibility();
  12214. return self;
  12215. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12216. },
  12217. args: ["aBlock"],
  12218. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  12219. referencedClasses: [],
  12220. messageSends: ["subclassResponsibility"]
  12221. }),
  12222. $globals.AssociativeCollection);
  12223. $core.addMethod(
  12224. $core.method({
  12225. selector: "printOn:",
  12226. protocol: 'printing',
  12227. fn: function (aStream){
  12228. var self=this;
  12229. return $core.withContext(function($ctx1) {
  12230. (
  12231. $ctx1.supercall = true,
  12232. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  12233. $ctx1.supercall = false;
  12234. $ctx1.sendIdx["printOn:"]=1;
  12235. $recv(aStream)._nextPutAll_(" (");
  12236. $ctx1.sendIdx["nextPutAll:"]=1;
  12237. $recv(self._associations())._do_separatedBy_((function(each){
  12238. return $core.withContext(function($ctx2) {
  12239. return $recv(each)._printOn_(aStream);
  12240. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12241. }),(function(){
  12242. return $core.withContext(function($ctx2) {
  12243. return $recv(aStream)._nextPutAll_(" , ");
  12244. $ctx2.sendIdx["nextPutAll:"]=2;
  12245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12246. }));
  12247. $recv(aStream)._nextPutAll_(")");
  12248. return self;
  12249. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  12250. },
  12251. args: ["aStream"],
  12252. 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: ')'",
  12253. referencedClasses: [],
  12254. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  12255. }),
  12256. $globals.AssociativeCollection);
  12257. $core.addMethod(
  12258. $core.method({
  12259. selector: "remove:ifAbsent:",
  12260. protocol: 'adding/removing',
  12261. fn: function (aKey,aBlock){
  12262. var self=this;
  12263. return $core.withContext(function($ctx1) {
  12264. return self._removeKey_ifAbsent_(aKey,aBlock);
  12265. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12266. },
  12267. args: ["aKey", "aBlock"],
  12268. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  12269. referencedClasses: [],
  12270. messageSends: ["removeKey:ifAbsent:"]
  12271. }),
  12272. $globals.AssociativeCollection);
  12273. $core.addMethod(
  12274. $core.method({
  12275. selector: "removeAll",
  12276. protocol: 'adding/removing',
  12277. fn: function (){
  12278. var self=this;
  12279. return $core.withContext(function($ctx1) {
  12280. return $recv(self._keys())._do_((function(each){
  12281. return $core.withContext(function($ctx2) {
  12282. return self._removeKey_(each);
  12283. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12284. }));
  12285. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  12286. },
  12287. args: [],
  12288. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  12289. referencedClasses: [],
  12290. messageSends: ["do:", "keys", "removeKey:"]
  12291. }),
  12292. $globals.AssociativeCollection);
  12293. $core.addMethod(
  12294. $core.method({
  12295. selector: "removeKey:",
  12296. protocol: 'adding/removing',
  12297. fn: function (aKey){
  12298. var self=this;
  12299. return $core.withContext(function($ctx1) {
  12300. return self._remove_(aKey);
  12301. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12302. },
  12303. args: ["aKey"],
  12304. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  12305. referencedClasses: [],
  12306. messageSends: ["remove:"]
  12307. }),
  12308. $globals.AssociativeCollection);
  12309. $core.addMethod(
  12310. $core.method({
  12311. selector: "removeKey:ifAbsent:",
  12312. protocol: 'adding/removing',
  12313. fn: function (aKey,aBlock){
  12314. var self=this;
  12315. return $core.withContext(function($ctx1) {
  12316. self._subclassResponsibility();
  12317. return self;
  12318. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12319. },
  12320. args: ["aKey", "aBlock"],
  12321. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  12322. referencedClasses: [],
  12323. messageSends: ["subclassResponsibility"]
  12324. }),
  12325. $globals.AssociativeCollection);
  12326. $core.addMethod(
  12327. $core.method({
  12328. selector: "select:",
  12329. protocol: 'enumerating',
  12330. fn: function (aBlock){
  12331. var self=this;
  12332. var newDict;
  12333. return $core.withContext(function($ctx1) {
  12334. var $1;
  12335. newDict=$recv(self._class())._new();
  12336. self._keysAndValuesDo_((function(key,value){
  12337. return $core.withContext(function($ctx2) {
  12338. $1=$recv(aBlock)._value_(value);
  12339. if($core.assert($1)){
  12340. return $recv(newDict)._at_put_(key,value);
  12341. };
  12342. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12343. }));
  12344. return newDict;
  12345. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12346. },
  12347. args: ["aBlock"],
  12348. 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",
  12349. referencedClasses: [],
  12350. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  12351. }),
  12352. $globals.AssociativeCollection);
  12353. $core.addMethod(
  12354. $core.method({
  12355. selector: "shallowCopy",
  12356. protocol: 'copying',
  12357. fn: function (){
  12358. var self=this;
  12359. var copy;
  12360. return $core.withContext(function($ctx1) {
  12361. copy=$recv(self._class())._new();
  12362. self._keysAndValuesDo_((function(key,value){
  12363. return $core.withContext(function($ctx2) {
  12364. return $recv(copy)._at_put_(key,value);
  12365. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12366. }));
  12367. return copy;
  12368. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  12369. },
  12370. args: [],
  12371. 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",
  12372. referencedClasses: [],
  12373. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  12374. }),
  12375. $globals.AssociativeCollection);
  12376. $core.addMethod(
  12377. $core.method({
  12378. selector: "size",
  12379. protocol: 'accessing',
  12380. fn: function (){
  12381. var self=this;
  12382. return $core.withContext(function($ctx1) {
  12383. return $recv(self._keys())._size();
  12384. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  12385. },
  12386. args: [],
  12387. source: "size\x0a\x09^ self keys size",
  12388. referencedClasses: [],
  12389. messageSends: ["size", "keys"]
  12390. }),
  12391. $globals.AssociativeCollection);
  12392. $core.addMethod(
  12393. $core.method({
  12394. selector: "values",
  12395. protocol: 'accessing',
  12396. fn: function (){
  12397. var self=this;
  12398. return $core.withContext(function($ctx1) {
  12399. self._subclassResponsibility();
  12400. return self;
  12401. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  12402. },
  12403. args: [],
  12404. source: "values\x0a\x09self subclassResponsibility",
  12405. referencedClasses: [],
  12406. messageSends: ["subclassResponsibility"]
  12407. }),
  12408. $globals.AssociativeCollection);
  12409. $core.addMethod(
  12410. $core.method({
  12411. selector: "valuesDo:",
  12412. protocol: 'enumerating',
  12413. fn: function (aBlock){
  12414. var self=this;
  12415. return $core.withContext(function($ctx1) {
  12416. self._subclassResponsibility();
  12417. return self;
  12418. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12419. },
  12420. args: ["aBlock"],
  12421. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  12422. referencedClasses: [],
  12423. messageSends: ["subclassResponsibility"]
  12424. }),
  12425. $globals.AssociativeCollection);
  12426. $core.addMethod(
  12427. $core.method({
  12428. selector: "withIndexDo:",
  12429. protocol: 'enumerating',
  12430. fn: function (aBlock){
  12431. var self=this;
  12432. return $core.withContext(function($ctx1) {
  12433. self._keysAndValuesDo_((function(key,value){
  12434. return $core.withContext(function($ctx2) {
  12435. return $recv(aBlock)._value_value_(value,key);
  12436. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12437. }));
  12438. return self;
  12439. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12440. },
  12441. args: ["aBlock"],
  12442. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  12443. referencedClasses: [],
  12444. messageSends: ["keysAndValuesDo:", "value:value:"]
  12445. }),
  12446. $globals.AssociativeCollection);
  12447. $core.addMethod(
  12448. $core.method({
  12449. selector: "from:",
  12450. protocol: 'instance creation',
  12451. fn: function (aCollection){
  12452. var self=this;
  12453. var newCollection;
  12454. return $core.withContext(function($ctx1) {
  12455. newCollection=self._new();
  12456. $recv(aCollection)._do_((function(each){
  12457. return $core.withContext(function($ctx2) {
  12458. return $recv(newCollection)._add_(each);
  12459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12460. }));
  12461. return newCollection;
  12462. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12463. },
  12464. args: ["aCollection"],
  12465. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  12466. referencedClasses: [],
  12467. messageSends: ["new", "do:", "add:"]
  12468. }),
  12469. $globals.AssociativeCollection.klass);
  12470. $core.addMethod(
  12471. $core.method({
  12472. selector: "fromPairs:",
  12473. protocol: 'instance creation',
  12474. fn: function (aCollection){
  12475. var self=this;
  12476. return $core.withContext(function($ctx1) {
  12477. return self._from_(aCollection);
  12478. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  12479. },
  12480. args: ["aCollection"],
  12481. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  12482. referencedClasses: [],
  12483. messageSends: ["from:"]
  12484. }),
  12485. $globals.AssociativeCollection.klass);
  12486. $core.addMethod(
  12487. $core.method({
  12488. selector: "newFromPairs:",
  12489. protocol: 'instance creation',
  12490. fn: function (aCollection){
  12491. var self=this;
  12492. var newCollection;
  12493. return $core.withContext(function($ctx1) {
  12494. var $2,$1,$3,$4;
  12495. $2=$recv(aCollection)._size();
  12496. $ctx1.sendIdx["size"]=1;
  12497. $1=$recv($2)._even();
  12498. if(!$core.assert($1)){
  12499. self._error_("#newFromPairs only accepts arrays of an even length");
  12500. };
  12501. newCollection=self._new();
  12502. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  12503. return $core.withContext(function($ctx2) {
  12504. $3=newCollection;
  12505. $4=$recv(aCollection)._at_(each);
  12506. $ctx2.sendIdx["at:"]=1;
  12507. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  12508. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  12509. }));
  12510. return newCollection;
  12511. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12512. },
  12513. args: ["aCollection"],
  12514. 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",
  12515. referencedClasses: [],
  12516. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  12517. }),
  12518. $globals.AssociativeCollection.klass);
  12519. $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  12520. $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.";
  12521. $core.addMethod(
  12522. $core.method({
  12523. selector: "at:ifAbsent:",
  12524. protocol: 'accessing',
  12525. fn: function (aKey,aBlock){
  12526. var self=this;
  12527. return $core.withContext(function($ctx1) {
  12528. var index = self._positionOfKey_(aKey);
  12529. return index >=0 ? self['@values'][index] : aBlock._value();
  12530. ;
  12531. return self;
  12532. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12533. },
  12534. args: ["aKey", "aBlock"],
  12535. 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'>",
  12536. referencedClasses: [],
  12537. messageSends: []
  12538. }),
  12539. $globals.Dictionary);
  12540. $core.addMethod(
  12541. $core.method({
  12542. selector: "at:put:",
  12543. protocol: 'accessing',
  12544. fn: function (aKey,aValue){
  12545. var self=this;
  12546. return $core.withContext(function($ctx1) {
  12547. var index = self._positionOfKey_(aKey);
  12548. if(index === -1) {
  12549. var keys = self['@keys'];
  12550. index = keys.length;
  12551. keys.push(aKey);
  12552. }
  12553. return self['@values'][index] = aValue;
  12554. ;
  12555. return self;
  12556. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  12557. },
  12558. args: ["aKey", "aValue"],
  12559. 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'>",
  12560. referencedClasses: [],
  12561. messageSends: []
  12562. }),
  12563. $globals.Dictionary);
  12564. $core.addMethod(
  12565. $core.method({
  12566. selector: "includesKey:",
  12567. protocol: 'testing',
  12568. fn: function (aKey){
  12569. var self=this;
  12570. return $core.withContext(function($ctx1) {
  12571. return self._positionOfKey_(aKey) >= 0;;
  12572. return self;
  12573. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  12574. },
  12575. args: ["aKey"],
  12576. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self._positionOfKey_(aKey) >= 0;'>",
  12577. referencedClasses: [],
  12578. messageSends: []
  12579. }),
  12580. $globals.Dictionary);
  12581. $core.addMethod(
  12582. $core.method({
  12583. selector: "indexOf:ifAbsent:",
  12584. protocol: 'accessing',
  12585. fn: function (anObject,aBlock){
  12586. var self=this;
  12587. var index;
  12588. return $core.withContext(function($ctx1) {
  12589. var $1;
  12590. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  12591. return (0);
  12592. }));
  12593. $1=$recv(index).__eq((0));
  12594. if($core.assert($1)){
  12595. return $recv(aBlock)._value();
  12596. } else {
  12597. return $recv(self["@keys"])._at_(index);
  12598. };
  12599. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  12600. },
  12601. args: ["anObject", "aBlock"],
  12602. 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 ]",
  12603. referencedClasses: [],
  12604. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  12605. }),
  12606. $globals.Dictionary);
  12607. $core.addMethod(
  12608. $core.method({
  12609. selector: "initialize",
  12610. protocol: 'initialization',
  12611. fn: function (){
  12612. var self=this;
  12613. return $core.withContext(function($ctx1) {
  12614. (
  12615. $ctx1.supercall = true,
  12616. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  12617. $ctx1.supercall = false;
  12618. self["@keys"]=[];
  12619. self["@values"]=[];
  12620. return self;
  12621. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  12622. },
  12623. args: [],
  12624. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  12625. referencedClasses: [],
  12626. messageSends: ["initialize"]
  12627. }),
  12628. $globals.Dictionary);
  12629. $core.addMethod(
  12630. $core.method({
  12631. selector: "keys",
  12632. protocol: 'accessing',
  12633. fn: function (){
  12634. var self=this;
  12635. return $core.withContext(function($ctx1) {
  12636. return $recv(self["@keys"])._copy();
  12637. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  12638. },
  12639. args: [],
  12640. source: "keys\x0a\x09^ keys copy",
  12641. referencedClasses: [],
  12642. messageSends: ["copy"]
  12643. }),
  12644. $globals.Dictionary);
  12645. $core.addMethod(
  12646. $core.method({
  12647. selector: "keysAndValuesDo:",
  12648. protocol: 'enumerating',
  12649. fn: function (aBlock){
  12650. var self=this;
  12651. return $core.withContext(function($ctx1) {
  12652. return $recv(self["@keys"])._with_do_(self["@values"],aBlock);
  12653. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12654. },
  12655. args: ["aBlock"],
  12656. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  12657. referencedClasses: [],
  12658. messageSends: ["with:do:"]
  12659. }),
  12660. $globals.Dictionary);
  12661. $core.addMethod(
  12662. $core.method({
  12663. selector: "keysDo:",
  12664. protocol: 'enumerating',
  12665. fn: function (aBlock){
  12666. var self=this;
  12667. return $core.withContext(function($ctx1) {
  12668. return $recv(self["@keys"])._do_(aBlock);
  12669. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  12670. },
  12671. args: ["aBlock"],
  12672. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  12673. referencedClasses: [],
  12674. messageSends: ["do:"]
  12675. }),
  12676. $globals.Dictionary);
  12677. $core.addMethod(
  12678. $core.method({
  12679. selector: "positionOfKey:",
  12680. protocol: 'private',
  12681. fn: function (anObject){
  12682. var self=this;
  12683. return $core.withContext(function($ctx1) {
  12684. var keys = self['@keys'];
  12685. for(var i=0;i<keys.length;i++){
  12686. if(keys[i].__eq(anObject)) { return i;}
  12687. }
  12688. return -1;
  12689. ;
  12690. return self;
  12691. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  12692. },
  12693. args: ["anObject"],
  12694. 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'>",
  12695. referencedClasses: [],
  12696. messageSends: []
  12697. }),
  12698. $globals.Dictionary);
  12699. $core.addMethod(
  12700. $core.method({
  12701. selector: "removeAll",
  12702. protocol: 'adding/removing',
  12703. fn: function (){
  12704. var self=this;
  12705. return $core.withContext(function($ctx1) {
  12706. $recv(self["@keys"])._removeAll();
  12707. $ctx1.sendIdx["removeAll"]=1;
  12708. $recv(self["@values"])._removeAll();
  12709. return self;
  12710. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  12711. },
  12712. args: [],
  12713. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  12714. referencedClasses: [],
  12715. messageSends: ["removeAll"]
  12716. }),
  12717. $globals.Dictionary);
  12718. $core.addMethod(
  12719. $core.method({
  12720. selector: "removeKey:ifAbsent:",
  12721. protocol: 'adding/removing',
  12722. fn: function (aKey,aBlock){
  12723. var self=this;
  12724. return $core.withContext(function($ctx1) {
  12725. var index = self._positionOfKey_(aKey);
  12726. if(index === -1) {
  12727. return aBlock._value()
  12728. } else {
  12729. var keys = self['@keys'], values = self['@values'];
  12730. var value = values[index], l = keys.length;
  12731. keys[index] = keys[l-1];
  12732. keys.pop();
  12733. values[index] = values[l-1];
  12734. values.pop();
  12735. return value;
  12736. }
  12737. ;
  12738. return self;
  12739. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12740. },
  12741. args: ["aKey", "aBlock"],
  12742. 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'>",
  12743. referencedClasses: [],
  12744. messageSends: []
  12745. }),
  12746. $globals.Dictionary);
  12747. $core.addMethod(
  12748. $core.method({
  12749. selector: "values",
  12750. protocol: 'accessing',
  12751. fn: function (){
  12752. var self=this;
  12753. return self["@values"];
  12754. },
  12755. args: [],
  12756. source: "values\x0a\x09^ values",
  12757. referencedClasses: [],
  12758. messageSends: []
  12759. }),
  12760. $globals.Dictionary);
  12761. $core.addMethod(
  12762. $core.method({
  12763. selector: "valuesDo:",
  12764. protocol: 'enumerating',
  12765. fn: function (aBlock){
  12766. var self=this;
  12767. return $core.withContext(function($ctx1) {
  12768. return $recv(self["@values"])._do_(aBlock);
  12769. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12770. },
  12771. args: ["aBlock"],
  12772. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  12773. referencedClasses: [],
  12774. messageSends: ["do:"]
  12775. }),
  12776. $globals.Dictionary);
  12777. $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections');
  12778. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  12779. $core.addMethod(
  12780. $core.method({
  12781. selector: "at:ifAbsent:",
  12782. protocol: 'accessing',
  12783. fn: function (aKey,aBlock){
  12784. var self=this;
  12785. return $core.withContext(function($ctx1) {
  12786. var $1;
  12787. $1=self._includesKey_(aKey);
  12788. if($core.assert($1)){
  12789. return self._basicAt_(aKey);
  12790. } else {
  12791. return $recv(aBlock)._value();
  12792. };
  12793. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12794. },
  12795. args: ["aKey", "aBlock"],
  12796. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  12797. referencedClasses: [],
  12798. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  12799. }),
  12800. $globals.HashedCollection);
  12801. $core.addMethod(
  12802. $core.method({
  12803. selector: "at:put:",
  12804. protocol: 'accessing',
  12805. fn: function (aKey,aValue){
  12806. var self=this;
  12807. return $core.withContext(function($ctx1) {
  12808. return self._basicAt_put_(aKey,aValue);
  12809. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  12810. },
  12811. args: ["aKey", "aValue"],
  12812. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  12813. referencedClasses: [],
  12814. messageSends: ["basicAt:put:"]
  12815. }),
  12816. $globals.HashedCollection);
  12817. $core.addMethod(
  12818. $core.method({
  12819. selector: "includesKey:",
  12820. protocol: 'testing',
  12821. fn: function (aKey){
  12822. var self=this;
  12823. return $core.withContext(function($ctx1) {
  12824. return self.hasOwnProperty(aKey);
  12825. return self;
  12826. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  12827. },
  12828. args: ["aKey"],
  12829. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  12830. referencedClasses: [],
  12831. messageSends: []
  12832. }),
  12833. $globals.HashedCollection);
  12834. $core.addMethod(
  12835. $core.method({
  12836. selector: "keys",
  12837. protocol: 'accessing',
  12838. fn: function (){
  12839. var self=this;
  12840. return $core.withContext(function($ctx1) {
  12841. return Object.keys(self);
  12842. return self;
  12843. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  12844. },
  12845. args: [],
  12846. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  12847. referencedClasses: [],
  12848. messageSends: []
  12849. }),
  12850. $globals.HashedCollection);
  12851. $core.addMethod(
  12852. $core.method({
  12853. selector: "keysDo:",
  12854. protocol: 'enumerating',
  12855. fn: function (aBlock){
  12856. var self=this;
  12857. return $core.withContext(function($ctx1) {
  12858. $recv(self._keys())._do_(aBlock);
  12859. return self;
  12860. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12861. },
  12862. args: ["aBlock"],
  12863. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  12864. referencedClasses: [],
  12865. messageSends: ["do:", "keys"]
  12866. }),
  12867. $globals.HashedCollection);
  12868. $core.addMethod(
  12869. $core.method({
  12870. selector: "removeKey:ifAbsent:",
  12871. protocol: 'adding/removing',
  12872. fn: function (aKey,aBlock){
  12873. var self=this;
  12874. return $core.withContext(function($ctx1) {
  12875. return self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  12876. return $core.withContext(function($ctx2) {
  12877. self._basicDelete_(aKey);
  12878. return removed;
  12879. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  12880. }),(function(){
  12881. return $core.withContext(function($ctx2) {
  12882. return $recv(aBlock)._value();
  12883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12884. }));
  12885. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12886. },
  12887. args: ["aKey", "aBlock"],
  12888. 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 ]",
  12889. referencedClasses: [],
  12890. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  12891. }),
  12892. $globals.HashedCollection);
  12893. $core.addMethod(
  12894. $core.method({
  12895. selector: "values",
  12896. protocol: 'accessing',
  12897. fn: function (){
  12898. var self=this;
  12899. return $core.withContext(function($ctx1) {
  12900. return self._keys().map(function(key){
  12901. return self._at_(key);
  12902. });
  12903. ;
  12904. return self;
  12905. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  12906. },
  12907. args: [],
  12908. 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'>",
  12909. referencedClasses: [],
  12910. messageSends: []
  12911. }),
  12912. $globals.HashedCollection);
  12913. $core.addMethod(
  12914. $core.method({
  12915. selector: "valuesDo:",
  12916. protocol: 'enumerating',
  12917. fn: function (aBlock){
  12918. var self=this;
  12919. return $core.withContext(function($ctx1) {
  12920. $recv(self._values())._do_(aBlock);
  12921. return self;
  12922. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12923. },
  12924. args: ["aBlock"],
  12925. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  12926. referencedClasses: [],
  12927. messageSends: ["do:", "values"]
  12928. }),
  12929. $globals.HashedCollection);
  12930. $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  12931. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  12932. $core.addMethod(
  12933. $core.method({
  12934. selector: "=",
  12935. protocol: 'comparing',
  12936. fn: function (aCollection){
  12937. var self=this;
  12938. return $core.withContext(function($ctx1) {
  12939. var $3,$2,$4,$1,$5;
  12940. var $early={};
  12941. try {
  12942. $3=self._class();
  12943. $ctx1.sendIdx["class"]=1;
  12944. $2=$recv($3).__eq($recv(aCollection)._class());
  12945. $ctx1.sendIdx["="]=1;
  12946. $1=$recv($2)._and_((function(){
  12947. return $core.withContext(function($ctx2) {
  12948. $4=self._size();
  12949. $ctx2.sendIdx["size"]=1;
  12950. return $recv($4).__eq($recv(aCollection)._size());
  12951. $ctx2.sendIdx["="]=2;
  12952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12953. }));
  12954. if(!$core.assert($1)){
  12955. return false;
  12956. };
  12957. self._withIndexDo_((function(each,i){
  12958. return $core.withContext(function($ctx2) {
  12959. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  12960. if(!$core.assert($5)){
  12961. throw $early=[false];
  12962. };
  12963. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  12964. }));
  12965. return true;
  12966. }
  12967. catch(e) {if(e===$early)return e[0]; throw e}
  12968. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  12969. },
  12970. args: ["aCollection"],
  12971. 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",
  12972. referencedClasses: [],
  12973. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  12974. }),
  12975. $globals.SequenceableCollection);
  12976. $core.addMethod(
  12977. $core.method({
  12978. selector: "addLast:",
  12979. protocol: 'adding/removing',
  12980. fn: function (anObject){
  12981. var self=this;
  12982. return $core.withContext(function($ctx1) {
  12983. self._add_(anObject);
  12984. return self;
  12985. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  12986. },
  12987. args: ["anObject"],
  12988. source: "addLast: anObject\x0a\x09self add: anObject",
  12989. referencedClasses: [],
  12990. messageSends: ["add:"]
  12991. }),
  12992. $globals.SequenceableCollection);
  12993. $core.addMethod(
  12994. $core.method({
  12995. selector: "allButFirst",
  12996. protocol: 'accessing',
  12997. fn: function (){
  12998. var self=this;
  12999. return $core.withContext(function($ctx1) {
  13000. return self._copyFrom_to_((2),self._size());
  13001. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  13002. },
  13003. args: [],
  13004. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  13005. referencedClasses: [],
  13006. messageSends: ["copyFrom:to:", "size"]
  13007. }),
  13008. $globals.SequenceableCollection);
  13009. $core.addMethod(
  13010. $core.method({
  13011. selector: "allButLast",
  13012. protocol: 'accessing',
  13013. fn: function (){
  13014. var self=this;
  13015. return $core.withContext(function($ctx1) {
  13016. return self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  13017. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  13018. },
  13019. args: [],
  13020. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  13021. referencedClasses: [],
  13022. messageSends: ["copyFrom:to:", "-", "size"]
  13023. }),
  13024. $globals.SequenceableCollection);
  13025. $core.addMethod(
  13026. $core.method({
  13027. selector: "anyOne",
  13028. protocol: 'accessing',
  13029. fn: function (){
  13030. var self=this;
  13031. return $core.withContext(function($ctx1) {
  13032. return self._at_((1));
  13033. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  13034. },
  13035. args: [],
  13036. source: "anyOne\x0a\x09^ self at: 1",
  13037. referencedClasses: [],
  13038. messageSends: ["at:"]
  13039. }),
  13040. $globals.SequenceableCollection);
  13041. $core.addMethod(
  13042. $core.method({
  13043. selector: "atRandom",
  13044. protocol: 'accessing',
  13045. fn: function (){
  13046. var self=this;
  13047. return $core.withContext(function($ctx1) {
  13048. return self._at_($recv(self._size())._atRandom());
  13049. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  13050. },
  13051. args: [],
  13052. source: "atRandom\x0a\x09^ self at: self size atRandom",
  13053. referencedClasses: [],
  13054. messageSends: ["at:", "atRandom", "size"]
  13055. }),
  13056. $globals.SequenceableCollection);
  13057. $core.addMethod(
  13058. $core.method({
  13059. selector: "beginsWith:",
  13060. protocol: 'testing',
  13061. fn: function (prefix){
  13062. var self=this;
  13063. return $core.withContext(function($ctx1) {
  13064. var $2,$3,$1;
  13065. $2=self._size();
  13066. $ctx1.sendIdx["size"]=1;
  13067. $3=$recv(prefix)._size();
  13068. $ctx1.sendIdx["size"]=2;
  13069. $1=$recv($2).__lt($3);
  13070. if($core.assert($1)){
  13071. return false;
  13072. };
  13073. return $recv(self._first_($recv(prefix)._size())).__eq(prefix);
  13074. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  13075. },
  13076. args: ["prefix"],
  13077. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  13078. referencedClasses: [],
  13079. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  13080. }),
  13081. $globals.SequenceableCollection);
  13082. $core.addMethod(
  13083. $core.method({
  13084. selector: "copyFrom:to:",
  13085. protocol: 'copying',
  13086. fn: function (anIndex,anotherIndex){
  13087. var self=this;
  13088. return $core.withContext(function($ctx1) {
  13089. self._subclassResponsibility();
  13090. return self;
  13091. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  13092. },
  13093. args: ["anIndex", "anotherIndex"],
  13094. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  13095. referencedClasses: [],
  13096. messageSends: ["subclassResponsibility"]
  13097. }),
  13098. $globals.SequenceableCollection);
  13099. $core.addMethod(
  13100. $core.method({
  13101. selector: "detect:ifNone:",
  13102. protocol: 'enumerating',
  13103. fn: function (aBlock,anotherBlock){
  13104. var self=this;
  13105. return $core.withContext(function($ctx1) {
  13106. self = self._numericallyIndexable();
  13107. for(var i = 0; i < self.length; i++)
  13108. if(aBlock._value_(self[i]))
  13109. return self[i];
  13110. return anotherBlock._value();
  13111. ;
  13112. return self;
  13113. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  13114. },
  13115. args: ["aBlock", "anotherBlock"],
  13116. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\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'>",
  13117. referencedClasses: [],
  13118. messageSends: []
  13119. }),
  13120. $globals.SequenceableCollection);
  13121. $core.addMethod(
  13122. $core.method({
  13123. selector: "do:",
  13124. protocol: 'enumerating',
  13125. fn: function (aBlock){
  13126. var self=this;
  13127. return $core.withContext(function($ctx1) {
  13128. self = self._numericallyIndexable();
  13129. for(var i=0; i < self.length; i++) {
  13130. aBlock._value_(self[i]);
  13131. }
  13132. ;
  13133. return self;
  13134. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13135. },
  13136. args: ["aBlock"],
  13137. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09'>",
  13138. referencedClasses: [],
  13139. messageSends: []
  13140. }),
  13141. $globals.SequenceableCollection);
  13142. $core.addMethod(
  13143. $core.method({
  13144. selector: "endsWith:",
  13145. protocol: 'testing',
  13146. fn: function (suffix){
  13147. var self=this;
  13148. return $core.withContext(function($ctx1) {
  13149. var $2,$3,$1;
  13150. $2=self._size();
  13151. $ctx1.sendIdx["size"]=1;
  13152. $3=$recv(suffix)._size();
  13153. $ctx1.sendIdx["size"]=2;
  13154. $1=$recv($2).__lt($3);
  13155. if($core.assert($1)){
  13156. return false;
  13157. };
  13158. return $recv(self._last_($recv(suffix)._size())).__eq(suffix);
  13159. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  13160. },
  13161. args: ["suffix"],
  13162. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  13163. referencedClasses: [],
  13164. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  13165. }),
  13166. $globals.SequenceableCollection);
  13167. $core.addMethod(
  13168. $core.method({
  13169. selector: "first",
  13170. protocol: 'accessing',
  13171. fn: function (){
  13172. var self=this;
  13173. return $core.withContext(function($ctx1) {
  13174. return self._at_((1));
  13175. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  13176. },
  13177. args: [],
  13178. source: "first\x0a\x09^ self at: 1",
  13179. referencedClasses: [],
  13180. messageSends: ["at:"]
  13181. }),
  13182. $globals.SequenceableCollection);
  13183. $core.addMethod(
  13184. $core.method({
  13185. selector: "first:",
  13186. protocol: 'accessing',
  13187. fn: function (aNumber){
  13188. var self=this;
  13189. return $core.withContext(function($ctx1) {
  13190. var $1;
  13191. $1=$recv(self._size()).__lt(aNumber);
  13192. if($core.assert($1)){
  13193. self._error_("Invalid number of elements");
  13194. };
  13195. return self._copyFrom_to_((1),aNumber);
  13196. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13197. },
  13198. args: ["aNumber"],
  13199. 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",
  13200. referencedClasses: [],
  13201. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  13202. }),
  13203. $globals.SequenceableCollection);
  13204. $core.addMethod(
  13205. $core.method({
  13206. selector: "fourth",
  13207. protocol: 'accessing',
  13208. fn: function (){
  13209. var self=this;
  13210. return $core.withContext(function($ctx1) {
  13211. return self._at_((4));
  13212. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  13213. },
  13214. args: [],
  13215. source: "fourth\x0a\x09^ self at: 4",
  13216. referencedClasses: [],
  13217. messageSends: ["at:"]
  13218. }),
  13219. $globals.SequenceableCollection);
  13220. $core.addMethod(
  13221. $core.method({
  13222. selector: "includes:",
  13223. protocol: 'testing',
  13224. fn: function (anObject){
  13225. var self=this;
  13226. return $core.withContext(function($ctx1) {
  13227. return $recv(self._indexOf_ifAbsent_(anObject,(function(){
  13228. return nil;
  13229. })))._notNil();
  13230. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  13231. },
  13232. args: ["anObject"],
  13233. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  13234. referencedClasses: [],
  13235. messageSends: ["notNil", "indexOf:ifAbsent:"]
  13236. }),
  13237. $globals.SequenceableCollection);
  13238. $core.addMethod(
  13239. $core.method({
  13240. selector: "indexOf:ifAbsent:",
  13241. protocol: 'accessing',
  13242. fn: function (anObject,aBlock){
  13243. var self=this;
  13244. return $core.withContext(function($ctx1) {
  13245. self = self._numericallyIndexable();
  13246. for(var i=0; i < self.length; i++) {
  13247. if($recv(self[i]).__eq(anObject)) {return i+1}
  13248. };
  13249. return aBlock._value();
  13250. ;
  13251. return self;
  13252. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  13253. },
  13254. args: ["anObject", "aBlock"],
  13255. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\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'>",
  13256. referencedClasses: [],
  13257. messageSends: []
  13258. }),
  13259. $globals.SequenceableCollection);
  13260. $core.addMethod(
  13261. $core.method({
  13262. selector: "indexOf:startingAt:",
  13263. protocol: 'accessing',
  13264. fn: function (anObject,start){
  13265. var self=this;
  13266. return $core.withContext(function($ctx1) {
  13267. return self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  13268. return (0);
  13269. }));
  13270. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  13271. },
  13272. args: ["anObject", "start"],
  13273. 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 ]",
  13274. referencedClasses: [],
  13275. messageSends: ["indexOf:startingAt:ifAbsent:"]
  13276. }),
  13277. $globals.SequenceableCollection);
  13278. $core.addMethod(
  13279. $core.method({
  13280. selector: "indexOf:startingAt:ifAbsent:",
  13281. protocol: 'accessing',
  13282. fn: function (anObject,start,aBlock){
  13283. var self=this;
  13284. return $core.withContext(function($ctx1) {
  13285. self = self._numericallyIndexable();
  13286. for(var i=start - 1; i < self.length; i++){
  13287. if($recv(self[i]).__eq(anObject)) {return i+1}
  13288. }
  13289. return aBlock._value();
  13290. ;
  13291. return self;
  13292. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  13293. },
  13294. args: ["anObject", "start", "aBlock"],
  13295. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\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'>",
  13296. referencedClasses: [],
  13297. messageSends: []
  13298. }),
  13299. $globals.SequenceableCollection);
  13300. $core.addMethod(
  13301. $core.method({
  13302. selector: "last",
  13303. protocol: 'accessing',
  13304. fn: function (){
  13305. var self=this;
  13306. return $core.withContext(function($ctx1) {
  13307. return self._at_(self._size());
  13308. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  13309. },
  13310. args: [],
  13311. source: "last\x0a\x09^ self at: self size",
  13312. referencedClasses: [],
  13313. messageSends: ["at:", "size"]
  13314. }),
  13315. $globals.SequenceableCollection);
  13316. $core.addMethod(
  13317. $core.method({
  13318. selector: "last:",
  13319. protocol: 'accessing',
  13320. fn: function (aNumber){
  13321. var self=this;
  13322. return $core.withContext(function($ctx1) {
  13323. var $2,$1,$5,$4,$3;
  13324. $2=self._size();
  13325. $ctx1.sendIdx["size"]=1;
  13326. $1=$recv($2).__lt(aNumber);
  13327. if($core.assert($1)){
  13328. self._error_("Invalid number of elements");
  13329. };
  13330. $5=self._size();
  13331. $ctx1.sendIdx["size"]=2;
  13332. $4=$recv($5).__minus(aNumber);
  13333. $3=$recv($4).__plus((1));
  13334. return self._copyFrom_to_($3,self._size());
  13335. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13336. },
  13337. args: ["aNumber"],
  13338. 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",
  13339. referencedClasses: [],
  13340. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  13341. }),
  13342. $globals.SequenceableCollection);
  13343. $core.addMethod(
  13344. $core.method({
  13345. selector: "newStream",
  13346. protocol: 'streaming',
  13347. fn: function (){
  13348. var self=this;
  13349. return $core.withContext(function($ctx1) {
  13350. return $recv(self._streamClass())._on_(self);
  13351. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  13352. },
  13353. args: [],
  13354. source: "newStream\x0a\x09^ self streamClass on: self",
  13355. referencedClasses: [],
  13356. messageSends: ["on:", "streamClass"]
  13357. }),
  13358. $globals.SequenceableCollection);
  13359. $core.addMethod(
  13360. $core.method({
  13361. selector: "numericallyIndexable",
  13362. protocol: 'private',
  13363. fn: function (){
  13364. var self=this;
  13365. return $core.withContext(function($ctx1) {
  13366. self._subclassResponsibility();
  13367. return self;
  13368. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  13369. },
  13370. args: [],
  13371. source: "numericallyIndexable\x0a\x09\x22This is an internal converting message.\x0a\x09It answeres a representation of the receiver\x0a\x09that can use foo[i] in JavaScript code.\x0a\x09\x0a\x09It fixes IE8, where boxed String is unable\x0a\x09to numerically index its characters,\x0a\x09but primitive string can.\x22\x0a\x09\x0a\x09self subclassResponsibility",
  13372. referencedClasses: [],
  13373. messageSends: ["subclassResponsibility"]
  13374. }),
  13375. $globals.SequenceableCollection);
  13376. $core.addMethod(
  13377. $core.method({
  13378. selector: "readStream",
  13379. protocol: 'streaming',
  13380. fn: function (){
  13381. var self=this;
  13382. return $core.withContext(function($ctx1) {
  13383. return self._stream();
  13384. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  13385. },
  13386. args: [],
  13387. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13388. referencedClasses: [],
  13389. messageSends: ["stream"]
  13390. }),
  13391. $globals.SequenceableCollection);
  13392. $core.addMethod(
  13393. $core.method({
  13394. selector: "removeLast",
  13395. protocol: 'adding/removing',
  13396. fn: function (){
  13397. var self=this;
  13398. return $core.withContext(function($ctx1) {
  13399. return self._remove_(self._last());
  13400. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  13401. },
  13402. args: [],
  13403. source: "removeLast\x0a\x09^ self remove: self last",
  13404. referencedClasses: [],
  13405. messageSends: ["remove:", "last"]
  13406. }),
  13407. $globals.SequenceableCollection);
  13408. $core.addMethod(
  13409. $core.method({
  13410. selector: "reversed",
  13411. protocol: 'converting',
  13412. fn: function (){
  13413. var self=this;
  13414. return $core.withContext(function($ctx1) {
  13415. self._subclassResponsibility();
  13416. return self;
  13417. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  13418. },
  13419. args: [],
  13420. source: "reversed\x0a\x09self subclassResponsibility",
  13421. referencedClasses: [],
  13422. messageSends: ["subclassResponsibility"]
  13423. }),
  13424. $globals.SequenceableCollection);
  13425. $core.addMethod(
  13426. $core.method({
  13427. selector: "second",
  13428. protocol: 'accessing',
  13429. fn: function (){
  13430. var self=this;
  13431. return $core.withContext(function($ctx1) {
  13432. return self._at_((2));
  13433. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  13434. },
  13435. args: [],
  13436. source: "second\x0a\x09^ self at: 2",
  13437. referencedClasses: [],
  13438. messageSends: ["at:"]
  13439. }),
  13440. $globals.SequenceableCollection);
  13441. $core.addMethod(
  13442. $core.method({
  13443. selector: "single",
  13444. protocol: 'accessing',
  13445. fn: function (){
  13446. var self=this;
  13447. return $core.withContext(function($ctx1) {
  13448. if (self.length == 0) throw new Error("Collection is empty");
  13449. if (self.length > 1) throw new Error("Collection holds more than one element.");
  13450. return self[0];;
  13451. return self;
  13452. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  13453. },
  13454. args: [],
  13455. 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'>",
  13456. referencedClasses: [],
  13457. messageSends: []
  13458. }),
  13459. $globals.SequenceableCollection);
  13460. $core.addMethod(
  13461. $core.method({
  13462. selector: "stream",
  13463. protocol: 'streaming',
  13464. fn: function (){
  13465. var self=this;
  13466. return $core.withContext(function($ctx1) {
  13467. return self._newStream();
  13468. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  13469. },
  13470. args: [],
  13471. source: "stream\x0a\x09^ self newStream",
  13472. referencedClasses: [],
  13473. messageSends: ["newStream"]
  13474. }),
  13475. $globals.SequenceableCollection);
  13476. $core.addMethod(
  13477. $core.method({
  13478. selector: "streamClass",
  13479. protocol: 'streaming',
  13480. fn: function (){
  13481. var self=this;
  13482. return $core.withContext(function($ctx1) {
  13483. return $recv(self._class())._streamClass();
  13484. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  13485. },
  13486. args: [],
  13487. source: "streamClass\x0a\x09^ self class streamClass",
  13488. referencedClasses: [],
  13489. messageSends: ["streamClass", "class"]
  13490. }),
  13491. $globals.SequenceableCollection);
  13492. $core.addMethod(
  13493. $core.method({
  13494. selector: "third",
  13495. protocol: 'accessing',
  13496. fn: function (){
  13497. var self=this;
  13498. return $core.withContext(function($ctx1) {
  13499. return self._at_((3));
  13500. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  13501. },
  13502. args: [],
  13503. source: "third\x0a\x09^ self at: 3",
  13504. referencedClasses: [],
  13505. messageSends: ["at:"]
  13506. }),
  13507. $globals.SequenceableCollection);
  13508. $core.addMethod(
  13509. $core.method({
  13510. selector: "with:do:",
  13511. protocol: 'enumerating',
  13512. fn: function (anotherCollection,aBlock){
  13513. var self=this;
  13514. return $core.withContext(function($ctx1) {
  13515. self = self._numericallyIndexable();
  13516. anotherCollection = anotherCollection._numericallyIndexable();
  13517. for(var i=0; i<self.length; i++) {
  13518. aBlock._value_value_(self[i], anotherCollection[i]);
  13519. }
  13520. ;
  13521. return self;
  13522. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  13523. },
  13524. args: ["anotherCollection", "aBlock"],
  13525. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09anotherCollection = anotherCollection._numericallyIndexable();\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'>",
  13526. referencedClasses: [],
  13527. messageSends: []
  13528. }),
  13529. $globals.SequenceableCollection);
  13530. $core.addMethod(
  13531. $core.method({
  13532. selector: "withIndexDo:",
  13533. protocol: 'enumerating',
  13534. fn: function (aBlock){
  13535. var self=this;
  13536. return $core.withContext(function($ctx1) {
  13537. self = self._numericallyIndexable();
  13538. for(var i=0; i < self.length; i++) {
  13539. aBlock._value_value_(self[i], i+1);
  13540. }
  13541. ;
  13542. return self;
  13543. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13544. },
  13545. args: ["aBlock"],
  13546. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\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'>",
  13547. referencedClasses: [],
  13548. messageSends: []
  13549. }),
  13550. $globals.SequenceableCollection);
  13551. $core.addMethod(
  13552. $core.method({
  13553. selector: "writeStream",
  13554. protocol: 'streaming',
  13555. fn: function (){
  13556. var self=this;
  13557. return $core.withContext(function($ctx1) {
  13558. return self._stream();
  13559. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  13560. },
  13561. args: [],
  13562. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13563. referencedClasses: [],
  13564. messageSends: ["stream"]
  13565. }),
  13566. $globals.SequenceableCollection);
  13567. $core.addMethod(
  13568. $core.method({
  13569. selector: "streamClass",
  13570. protocol: 'accessing',
  13571. fn: function (){
  13572. var self=this;
  13573. return $globals.Stream;
  13574. },
  13575. args: [],
  13576. source: "streamClass\x0a\x09\x09^ Stream",
  13577. referencedClasses: ["Stream"],
  13578. messageSends: []
  13579. }),
  13580. $globals.SequenceableCollection.klass);
  13581. $core.addMethod(
  13582. $core.method({
  13583. selector: "streamContents:",
  13584. protocol: 'streaming',
  13585. fn: function (aBlock){
  13586. var self=this;
  13587. var stream;
  13588. return $core.withContext(function($ctx1) {
  13589. stream=$recv(self._streamClass())._on_(self._new());
  13590. $recv(aBlock)._value_(stream);
  13591. return $recv(stream)._contents();
  13592. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  13593. },
  13594. args: ["aBlock"],
  13595. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  13596. referencedClasses: [],
  13597. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  13598. }),
  13599. $globals.SequenceableCollection.klass);
  13600. $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections');
  13601. $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`.";
  13602. $core.addMethod(
  13603. $core.method({
  13604. selector: "add:",
  13605. protocol: 'adding/removing',
  13606. fn: function (anObject){
  13607. var self=this;
  13608. return $core.withContext(function($ctx1) {
  13609. self.push(anObject); return anObject;;
  13610. return self;
  13611. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  13612. },
  13613. args: ["anObject"],
  13614. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  13615. referencedClasses: [],
  13616. messageSends: []
  13617. }),
  13618. $globals.Array);
  13619. $core.addMethod(
  13620. $core.method({
  13621. selector: "addAll:",
  13622. protocol: 'adding/removing',
  13623. fn: function (aCollection){
  13624. var self=this;
  13625. return $core.withContext(function($ctx1) {
  13626. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  13627. else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);
  13628. return aCollection;;
  13629. return self;
  13630. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  13631. },
  13632. args: ["aCollection"],
  13633. 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'>",
  13634. referencedClasses: [],
  13635. messageSends: []
  13636. }),
  13637. $globals.Array);
  13638. $core.addMethod(
  13639. $core.method({
  13640. selector: "addFirst:",
  13641. protocol: 'adding/removing',
  13642. fn: function (anObject){
  13643. var self=this;
  13644. return $core.withContext(function($ctx1) {
  13645. self.unshift(anObject); return anObject;;
  13646. return self;
  13647. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  13648. },
  13649. args: ["anObject"],
  13650. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  13651. referencedClasses: [],
  13652. messageSends: []
  13653. }),
  13654. $globals.Array);
  13655. $core.addMethod(
  13656. $core.method({
  13657. selector: "asJavascript",
  13658. protocol: 'converting',
  13659. fn: function (){
  13660. var self=this;
  13661. return $core.withContext(function($ctx1) {
  13662. var $1;
  13663. $1=$recv("[".__comma($recv(self._collect_((function(each){
  13664. return $core.withContext(function($ctx2) {
  13665. return $recv(each)._asJavascript();
  13666. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13667. })))._join_(", "))).__comma("]");
  13668. $ctx1.sendIdx[","]=1;
  13669. return $1;
  13670. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
  13671. },
  13672. args: [],
  13673. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  13674. referencedClasses: [],
  13675. messageSends: [",", "join:", "collect:", "asJavascript"]
  13676. }),
  13677. $globals.Array);
  13678. $core.addMethod(
  13679. $core.method({
  13680. selector: "at:ifAbsent:",
  13681. protocol: 'accessing',
  13682. fn: function (anIndex,aBlock){
  13683. var self=this;
  13684. return $core.withContext(function($ctx1) {
  13685. return anIndex >= 1 && anIndex <= self.length
  13686. ? self[anIndex - 1]
  13687. : aBlock._value()
  13688. ;
  13689. return self;
  13690. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  13691. },
  13692. args: ["anIndex", "aBlock"],
  13693. 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'>",
  13694. referencedClasses: [],
  13695. messageSends: []
  13696. }),
  13697. $globals.Array);
  13698. $core.addMethod(
  13699. $core.method({
  13700. selector: "at:ifPresent:ifAbsent:",
  13701. protocol: 'accessing',
  13702. fn: function (anIndex,aBlock,anotherBlock){
  13703. var self=this;
  13704. return $core.withContext(function($ctx1) {
  13705. return anIndex >= 1 && anIndex <= self.length
  13706. ? aBlock._value_(self[anIndex - 1])
  13707. : anotherBlock._value()
  13708. ;
  13709. return self;
  13710. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  13711. },
  13712. args: ["anIndex", "aBlock", "anotherBlock"],
  13713. 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'>",
  13714. referencedClasses: [],
  13715. messageSends: []
  13716. }),
  13717. $globals.Array);
  13718. $core.addMethod(
  13719. $core.method({
  13720. selector: "at:put:",
  13721. protocol: 'accessing',
  13722. fn: function (anIndex,anObject){
  13723. var self=this;
  13724. return $core.withContext(function($ctx1) {
  13725. return self[anIndex - 1] = anObject;
  13726. return self;
  13727. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  13728. },
  13729. args: ["anIndex", "anObject"],
  13730. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  13731. referencedClasses: [],
  13732. messageSends: []
  13733. }),
  13734. $globals.Array);
  13735. $core.addMethod(
  13736. $core.method({
  13737. selector: "collect:",
  13738. protocol: 'enumerating',
  13739. fn: function (aBlock){
  13740. var self=this;
  13741. return $core.withContext(function($ctx1) {
  13742. return self.map(function(each) {return aBlock._value_(each)});
  13743. return self;
  13744. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  13745. },
  13746. args: ["aBlock"],
  13747. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  13748. referencedClasses: [],
  13749. messageSends: []
  13750. }),
  13751. $globals.Array);
  13752. $core.addMethod(
  13753. $core.method({
  13754. selector: "copyFrom:to:",
  13755. protocol: 'copying',
  13756. fn: function (anIndex,anotherIndex){
  13757. var self=this;
  13758. return $core.withContext(function($ctx1) {
  13759. if (anIndex >= 1 && anotherIndex <= self.length) {
  13760. return self.slice(anIndex - 1, anotherIndex);
  13761. } else {
  13762. self._at_(anIndex);
  13763. self._at_(self.length + 1);
  13764. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  13765. };
  13766. return self;
  13767. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  13768. },
  13769. args: ["anIndex", "anotherIndex"],
  13770. 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'>",
  13771. referencedClasses: [],
  13772. messageSends: []
  13773. }),
  13774. $globals.Array);
  13775. $core.addMethod(
  13776. $core.method({
  13777. selector: "join:",
  13778. protocol: 'enumerating',
  13779. fn: function (aString){
  13780. var self=this;
  13781. return $core.withContext(function($ctx1) {
  13782. return self.join(aString);
  13783. return self;
  13784. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  13785. },
  13786. args: ["aString"],
  13787. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  13788. referencedClasses: [],
  13789. messageSends: []
  13790. }),
  13791. $globals.Array);
  13792. $core.addMethod(
  13793. $core.method({
  13794. selector: "numericallyIndexable",
  13795. protocol: 'private',
  13796. fn: function (){
  13797. var self=this;
  13798. return self;
  13799. },
  13800. args: [],
  13801. source: "numericallyIndexable\x0a\x09^ self",
  13802. referencedClasses: [],
  13803. messageSends: []
  13804. }),
  13805. $globals.Array);
  13806. $core.addMethod(
  13807. $core.method({
  13808. selector: "printOn:",
  13809. protocol: 'printing',
  13810. fn: function (aStream){
  13811. var self=this;
  13812. return $core.withContext(function($ctx1) {
  13813. (
  13814. $ctx1.supercall = true,
  13815. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  13816. $ctx1.supercall = false;
  13817. $ctx1.sendIdx["printOn:"]=1;
  13818. $recv(aStream)._nextPutAll_(" (");
  13819. $ctx1.sendIdx["nextPutAll:"]=1;
  13820. self._do_separatedBy_((function(each){
  13821. return $core.withContext(function($ctx2) {
  13822. return $recv(each)._printOn_(aStream);
  13823. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13824. }),(function(){
  13825. return $core.withContext(function($ctx2) {
  13826. return $recv(aStream)._nextPutAll_(" ");
  13827. $ctx2.sendIdx["nextPutAll:"]=2;
  13828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13829. }));
  13830. $recv(aStream)._nextPutAll_(")");
  13831. return self;
  13832. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  13833. },
  13834. args: ["aStream"],
  13835. 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: ')'",
  13836. referencedClasses: [],
  13837. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13838. }),
  13839. $globals.Array);
  13840. $core.addMethod(
  13841. $core.method({
  13842. selector: "remove:ifAbsent:",
  13843. protocol: 'adding/removing',
  13844. fn: function (anObject,aBlock){
  13845. var self=this;
  13846. var index;
  13847. return $core.withContext(function($ctx1) {
  13848. var $1;
  13849. index=self._indexOf_ifAbsent_(anObject,(function(){
  13850. return (0);
  13851. }));
  13852. $1=$recv(index).__eq((0));
  13853. if($core.assert($1)){
  13854. return $recv(aBlock)._value();
  13855. } else {
  13856. self._removeIndex_(index);
  13857. return anObject;
  13858. };
  13859. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  13860. },
  13861. args: ["anObject", "aBlock"],
  13862. 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 ]",
  13863. referencedClasses: [],
  13864. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  13865. }),
  13866. $globals.Array);
  13867. $core.addMethod(
  13868. $core.method({
  13869. selector: "removeAll",
  13870. protocol: 'adding/removing',
  13871. fn: function (){
  13872. var self=this;
  13873. return $core.withContext(function($ctx1) {
  13874. self.length = 0;
  13875. return self;
  13876. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  13877. },
  13878. args: [],
  13879. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  13880. referencedClasses: [],
  13881. messageSends: []
  13882. }),
  13883. $globals.Array);
  13884. $core.addMethod(
  13885. $core.method({
  13886. selector: "removeFrom:to:",
  13887. protocol: 'adding/removing',
  13888. fn: function (aNumber,anotherNumber){
  13889. var self=this;
  13890. return $core.withContext(function($ctx1) {
  13891. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  13892. return self;
  13893. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  13894. },
  13895. args: ["aNumber", "anotherNumber"],
  13896. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  13897. referencedClasses: [],
  13898. messageSends: []
  13899. }),
  13900. $globals.Array);
  13901. $core.addMethod(
  13902. $core.method({
  13903. selector: "removeIndex:",
  13904. protocol: 'adding/removing',
  13905. fn: function (anInteger){
  13906. var self=this;
  13907. return $core.withContext(function($ctx1) {
  13908. self.splice(anInteger - 1, 1);
  13909. return self;
  13910. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  13911. },
  13912. args: ["anInteger"],
  13913. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  13914. referencedClasses: [],
  13915. messageSends: []
  13916. }),
  13917. $globals.Array);
  13918. $core.addMethod(
  13919. $core.method({
  13920. selector: "removeLast",
  13921. protocol: 'adding/removing',
  13922. fn: function (){
  13923. var self=this;
  13924. return $core.withContext(function($ctx1) {
  13925. return self.pop();;
  13926. return self;
  13927. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  13928. },
  13929. args: [],
  13930. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  13931. referencedClasses: [],
  13932. messageSends: []
  13933. }),
  13934. $globals.Array);
  13935. $core.addMethod(
  13936. $core.method({
  13937. selector: "reversed",
  13938. protocol: 'converting',
  13939. fn: function (){
  13940. var self=this;
  13941. return $core.withContext(function($ctx1) {
  13942. return self.slice().reverse();
  13943. return self;
  13944. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  13945. },
  13946. args: [],
  13947. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  13948. referencedClasses: [],
  13949. messageSends: []
  13950. }),
  13951. $globals.Array);
  13952. $core.addMethod(
  13953. $core.method({
  13954. selector: "select:",
  13955. protocol: 'enumerating',
  13956. fn: function (aBlock){
  13957. var self=this;
  13958. return $core.withContext(function($ctx1) {
  13959. return self.filter(function(each) {return aBlock._value_(each)});
  13960. return self;
  13961. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  13962. },
  13963. args: ["aBlock"],
  13964. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  13965. referencedClasses: [],
  13966. messageSends: []
  13967. }),
  13968. $globals.Array);
  13969. $core.addMethod(
  13970. $core.method({
  13971. selector: "shallowCopy",
  13972. protocol: 'copying',
  13973. fn: function (){
  13974. var self=this;
  13975. return $core.withContext(function($ctx1) {
  13976. return self.slice();
  13977. return self;
  13978. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  13979. },
  13980. args: [],
  13981. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  13982. referencedClasses: [],
  13983. messageSends: []
  13984. }),
  13985. $globals.Array);
  13986. $core.addMethod(
  13987. $core.method({
  13988. selector: "size",
  13989. protocol: 'accessing',
  13990. fn: function (){
  13991. var self=this;
  13992. return $core.withContext(function($ctx1) {
  13993. return self.length;
  13994. return self;
  13995. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  13996. },
  13997. args: [],
  13998. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  13999. referencedClasses: [],
  14000. messageSends: []
  14001. }),
  14002. $globals.Array);
  14003. $core.addMethod(
  14004. $core.method({
  14005. selector: "sort",
  14006. protocol: 'enumerating',
  14007. fn: function (){
  14008. var self=this;
  14009. return $core.withContext(function($ctx1) {
  14010. return self._sort_((function(a,b){
  14011. return $core.withContext(function($ctx2) {
  14012. return $recv(a).__lt(b);
  14013. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  14014. }));
  14015. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  14016. },
  14017. args: [],
  14018. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  14019. referencedClasses: [],
  14020. messageSends: ["sort:", "<"]
  14021. }),
  14022. $globals.Array);
  14023. $core.addMethod(
  14024. $core.method({
  14025. selector: "sort:",
  14026. protocol: 'enumerating',
  14027. fn: function (aBlock){
  14028. var self=this;
  14029. return $core.withContext(function($ctx1) {
  14030. return self.sort(function(a, b) {
  14031. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  14032. })
  14033. ;
  14034. return self;
  14035. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  14036. },
  14037. args: ["aBlock"],
  14038. 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'>",
  14039. referencedClasses: [],
  14040. messageSends: []
  14041. }),
  14042. $globals.Array);
  14043. $core.addMethod(
  14044. $core.method({
  14045. selector: "sorted",
  14046. protocol: 'enumerating',
  14047. fn: function (){
  14048. var self=this;
  14049. return $core.withContext(function($ctx1) {
  14050. return $recv(self._copy())._sort();
  14051. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  14052. },
  14053. args: [],
  14054. source: "sorted\x0a\x09^ self copy sort",
  14055. referencedClasses: [],
  14056. messageSends: ["sort", "copy"]
  14057. }),
  14058. $globals.Array);
  14059. $core.addMethod(
  14060. $core.method({
  14061. selector: "sorted:",
  14062. protocol: 'enumerating',
  14063. fn: function (aBlock){
  14064. var self=this;
  14065. return $core.withContext(function($ctx1) {
  14066. return $recv(self._copy())._sort_(aBlock);
  14067. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  14068. },
  14069. args: ["aBlock"],
  14070. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  14071. referencedClasses: [],
  14072. messageSends: ["sort:", "copy"]
  14073. }),
  14074. $globals.Array);
  14075. $core.addMethod(
  14076. $core.method({
  14077. selector: "new:",
  14078. protocol: 'instance creation',
  14079. fn: function (anInteger){
  14080. var self=this;
  14081. return $core.withContext(function($ctx1) {
  14082. return new Array(anInteger);
  14083. return self;
  14084. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  14085. },
  14086. args: ["anInteger"],
  14087. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  14088. referencedClasses: [],
  14089. messageSends: []
  14090. }),
  14091. $globals.Array.klass);
  14092. $core.addMethod(
  14093. $core.method({
  14094. selector: "with:",
  14095. protocol: 'instance creation',
  14096. fn: function (anObject){
  14097. var self=this;
  14098. return $core.withContext(function($ctx1) {
  14099. var $1;
  14100. $1=self._new_((1));
  14101. $recv($1)._at_put_((1),anObject);
  14102. return $recv($1)._yourself();
  14103. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  14104. },
  14105. args: ["anObject"],
  14106. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  14107. referencedClasses: [],
  14108. messageSends: ["at:put:", "new:", "yourself"]
  14109. }),
  14110. $globals.Array.klass);
  14111. $core.addMethod(
  14112. $core.method({
  14113. selector: "with:with:",
  14114. protocol: 'instance creation',
  14115. fn: function (anObject,anObject2){
  14116. var self=this;
  14117. return $core.withContext(function($ctx1) {
  14118. var $1;
  14119. $1=self._new_((2));
  14120. $recv($1)._at_put_((1),anObject);
  14121. $ctx1.sendIdx["at:put:"]=1;
  14122. $recv($1)._at_put_((2),anObject2);
  14123. return $recv($1)._yourself();
  14124. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  14125. },
  14126. args: ["anObject", "anObject2"],
  14127. 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",
  14128. referencedClasses: [],
  14129. messageSends: ["at:put:", "new:", "yourself"]
  14130. }),
  14131. $globals.Array.klass);
  14132. $core.addMethod(
  14133. $core.method({
  14134. selector: "with:with:with:",
  14135. protocol: 'instance creation',
  14136. fn: function (anObject,anObject2,anObject3){
  14137. var self=this;
  14138. return $core.withContext(function($ctx1) {
  14139. var $1;
  14140. $1=self._new_((3));
  14141. $recv($1)._at_put_((1),anObject);
  14142. $ctx1.sendIdx["at:put:"]=1;
  14143. $recv($1)._at_put_((2),anObject2);
  14144. $ctx1.sendIdx["at:put:"]=2;
  14145. $recv($1)._at_put_((3),anObject3);
  14146. return $recv($1)._yourself();
  14147. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  14148. },
  14149. args: ["anObject", "anObject2", "anObject3"],
  14150. 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",
  14151. referencedClasses: [],
  14152. messageSends: ["at:put:", "new:", "yourself"]
  14153. }),
  14154. $globals.Array.klass);
  14155. $core.addMethod(
  14156. $core.method({
  14157. selector: "withAll:",
  14158. protocol: 'instance creation',
  14159. fn: function (aCollection){
  14160. var self=this;
  14161. var instance,index;
  14162. return $core.withContext(function($ctx1) {
  14163. index=(1);
  14164. instance=self._new_($recv(aCollection)._size());
  14165. $recv(aCollection)._do_((function(each){
  14166. return $core.withContext(function($ctx2) {
  14167. $recv(instance)._at_put_(index,each);
  14168. index=$recv(index).__plus((1));
  14169. return index;
  14170. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14171. }));
  14172. return instance;
  14173. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  14174. },
  14175. args: ["aCollection"],
  14176. 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",
  14177. referencedClasses: [],
  14178. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  14179. }),
  14180. $globals.Array.klass);
  14181. $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections');
  14182. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  14183. $core.addMethod(
  14184. $core.method({
  14185. selector: ",",
  14186. protocol: 'copying',
  14187. fn: function (aString){
  14188. var self=this;
  14189. return $core.withContext(function($ctx1) {
  14190. var $1;
  14191. $1=self._asString();
  14192. $ctx1.sendIdx["asString"]=1;
  14193. return $recv($1).__comma($recv(aString)._asString());
  14194. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  14195. },
  14196. args: ["aString"],
  14197. source: ", aString\x0a\x09^ self asString, aString asString",
  14198. referencedClasses: [],
  14199. messageSends: [",", "asString"]
  14200. }),
  14201. $globals.CharacterArray);
  14202. $core.addMethod(
  14203. $core.method({
  14204. selector: "add:",
  14205. protocol: 'adding/removing',
  14206. fn: function (anObject){
  14207. var self=this;
  14208. return $core.withContext(function($ctx1) {
  14209. self._errorReadOnly();
  14210. return self;
  14211. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  14212. },
  14213. args: ["anObject"],
  14214. source: "add: anObject\x0a\x09self errorReadOnly",
  14215. referencedClasses: [],
  14216. messageSends: ["errorReadOnly"]
  14217. }),
  14218. $globals.CharacterArray);
  14219. $core.addMethod(
  14220. $core.method({
  14221. selector: "asLowercase",
  14222. protocol: 'converting',
  14223. fn: function (){
  14224. var self=this;
  14225. return $core.withContext(function($ctx1) {
  14226. return $recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  14227. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  14228. },
  14229. args: [],
  14230. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  14231. referencedClasses: [],
  14232. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  14233. }),
  14234. $globals.CharacterArray);
  14235. $core.addMethod(
  14236. $core.method({
  14237. selector: "asNumber",
  14238. protocol: 'converting',
  14239. fn: function (){
  14240. var self=this;
  14241. return $core.withContext(function($ctx1) {
  14242. return $recv(self._asString())._asNumber();
  14243. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  14244. },
  14245. args: [],
  14246. source: "asNumber\x0a\x09^ self asString asNumber",
  14247. referencedClasses: [],
  14248. messageSends: ["asNumber", "asString"]
  14249. }),
  14250. $globals.CharacterArray);
  14251. $core.addMethod(
  14252. $core.method({
  14253. selector: "asString",
  14254. protocol: 'converting',
  14255. fn: function (){
  14256. var self=this;
  14257. return $core.withContext(function($ctx1) {
  14258. return self._subclassResponsibility();
  14259. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  14260. },
  14261. args: [],
  14262. source: "asString\x0a\x09^ self subclassResponsibility",
  14263. referencedClasses: [],
  14264. messageSends: ["subclassResponsibility"]
  14265. }),
  14266. $globals.CharacterArray);
  14267. $core.addMethod(
  14268. $core.method({
  14269. selector: "asSymbol",
  14270. protocol: 'converting',
  14271. fn: function (){
  14272. var self=this;
  14273. return $core.withContext(function($ctx1) {
  14274. return self._asString();
  14275. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  14276. },
  14277. args: [],
  14278. source: "asSymbol\x0a\x09^ self asString",
  14279. referencedClasses: [],
  14280. messageSends: ["asString"]
  14281. }),
  14282. $globals.CharacterArray);
  14283. $core.addMethod(
  14284. $core.method({
  14285. selector: "asUppercase",
  14286. protocol: 'converting',
  14287. fn: function (){
  14288. var self=this;
  14289. return $core.withContext(function($ctx1) {
  14290. return $recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  14291. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  14292. },
  14293. args: [],
  14294. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  14295. referencedClasses: [],
  14296. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  14297. }),
  14298. $globals.CharacterArray);
  14299. $core.addMethod(
  14300. $core.method({
  14301. selector: "at:put:",
  14302. protocol: 'accessing',
  14303. fn: function (anIndex,anObject){
  14304. var self=this;
  14305. return $core.withContext(function($ctx1) {
  14306. self._errorReadOnly();
  14307. return self;
  14308. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  14309. },
  14310. args: ["anIndex", "anObject"],
  14311. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  14312. referencedClasses: [],
  14313. messageSends: ["errorReadOnly"]
  14314. }),
  14315. $globals.CharacterArray);
  14316. $core.addMethod(
  14317. $core.method({
  14318. selector: "errorReadOnly",
  14319. protocol: 'error handling',
  14320. fn: function (){
  14321. var self=this;
  14322. return $core.withContext(function($ctx1) {
  14323. self._error_("Object is read-only");
  14324. return self;
  14325. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  14326. },
  14327. args: [],
  14328. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  14329. referencedClasses: [],
  14330. messageSends: ["error:"]
  14331. }),
  14332. $globals.CharacterArray);
  14333. $core.addMethod(
  14334. $core.method({
  14335. selector: "printOn:",
  14336. protocol: 'printing',
  14337. fn: function (aStream){
  14338. var self=this;
  14339. return $core.withContext(function($ctx1) {
  14340. $recv(self._asString())._printOn_(aStream);
  14341. return self;
  14342. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  14343. },
  14344. args: ["aStream"],
  14345. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  14346. referencedClasses: [],
  14347. messageSends: ["printOn:", "asString"]
  14348. }),
  14349. $globals.CharacterArray);
  14350. $core.addMethod(
  14351. $core.method({
  14352. selector: "putOn:",
  14353. protocol: 'streaming',
  14354. fn: function (aStream){
  14355. var self=this;
  14356. return $core.withContext(function($ctx1) {
  14357. $recv(aStream)._nextPutString_(self);
  14358. return self;
  14359. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  14360. },
  14361. args: ["aStream"],
  14362. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  14363. referencedClasses: [],
  14364. messageSends: ["nextPutString:"]
  14365. }),
  14366. $globals.CharacterArray);
  14367. $core.addMethod(
  14368. $core.method({
  14369. selector: "remove:",
  14370. protocol: 'adding/removing',
  14371. fn: function (anObject){
  14372. var self=this;
  14373. return $core.withContext(function($ctx1) {
  14374. self._errorReadOnly();
  14375. return self;
  14376. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  14377. },
  14378. args: ["anObject"],
  14379. source: "remove: anObject\x0a\x09self errorReadOnly",
  14380. referencedClasses: [],
  14381. messageSends: ["errorReadOnly"]
  14382. }),
  14383. $globals.CharacterArray);
  14384. $core.addMethod(
  14385. $core.method({
  14386. selector: "fromString:",
  14387. protocol: 'instance creation',
  14388. fn: function (aString){
  14389. var self=this;
  14390. return $core.withContext(function($ctx1) {
  14391. self._subclassResponsibility();
  14392. return self;
  14393. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  14394. },
  14395. args: ["aString"],
  14396. source: "fromString: aString\x0a\x09self subclassResponsibility",
  14397. referencedClasses: [],
  14398. messageSends: ["subclassResponsibility"]
  14399. }),
  14400. $globals.CharacterArray.klass);
  14401. $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections');
  14402. $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 >> #,`";
  14403. $core.addMethod(
  14404. $core.method({
  14405. selector: ",",
  14406. protocol: 'copying',
  14407. fn: function (aString){
  14408. var self=this;
  14409. return $core.withContext(function($ctx1) {
  14410. return String(self) + aString;
  14411. return self;
  14412. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  14413. },
  14414. args: ["aString"],
  14415. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  14416. referencedClasses: [],
  14417. messageSends: []
  14418. }),
  14419. $globals.String);
  14420. $core.addMethod(
  14421. $core.method({
  14422. selector: "<",
  14423. protocol: 'comparing',
  14424. fn: function (aString){
  14425. var self=this;
  14426. return $core.withContext(function($ctx1) {
  14427. return String(self) < aString._asString();
  14428. return self;
  14429. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  14430. },
  14431. args: ["aString"],
  14432. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  14433. referencedClasses: [],
  14434. messageSends: []
  14435. }),
  14436. $globals.String);
  14437. $core.addMethod(
  14438. $core.method({
  14439. selector: "<=",
  14440. protocol: 'comparing',
  14441. fn: function (aString){
  14442. var self=this;
  14443. return $core.withContext(function($ctx1) {
  14444. return String(self) <= aString._asString();
  14445. return self;
  14446. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  14447. },
  14448. args: ["aString"],
  14449. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  14450. referencedClasses: [],
  14451. messageSends: []
  14452. }),
  14453. $globals.String);
  14454. $core.addMethod(
  14455. $core.method({
  14456. selector: "=",
  14457. protocol: 'comparing',
  14458. fn: function (aString){
  14459. var self=this;
  14460. return $core.withContext(function($ctx1) {
  14461. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  14462. return self;
  14463. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  14464. },
  14465. args: ["aString"],
  14466. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  14467. referencedClasses: [],
  14468. messageSends: []
  14469. }),
  14470. $globals.String);
  14471. $core.addMethod(
  14472. $core.method({
  14473. selector: "==",
  14474. protocol: 'comparing',
  14475. fn: function (aString){
  14476. var self=this;
  14477. return $core.withContext(function($ctx1) {
  14478. if (typeof aString === "string") return String(self) === aString;
  14479. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  14480. else return false;;
  14481. return self;
  14482. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  14483. },
  14484. args: ["aString"],
  14485. 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'>",
  14486. referencedClasses: [],
  14487. messageSends: []
  14488. }),
  14489. $globals.String);
  14490. $core.addMethod(
  14491. $core.method({
  14492. selector: ">",
  14493. protocol: 'comparing',
  14494. fn: function (aString){
  14495. var self=this;
  14496. return $core.withContext(function($ctx1) {
  14497. return String(self) > aString._asString();
  14498. return self;
  14499. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  14500. },
  14501. args: ["aString"],
  14502. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  14503. referencedClasses: [],
  14504. messageSends: []
  14505. }),
  14506. $globals.String);
  14507. $core.addMethod(
  14508. $core.method({
  14509. selector: ">=",
  14510. protocol: 'comparing',
  14511. fn: function (aString){
  14512. var self=this;
  14513. return $core.withContext(function($ctx1) {
  14514. return String(self) >= aString._asString();
  14515. return self;
  14516. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  14517. },
  14518. args: ["aString"],
  14519. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  14520. referencedClasses: [],
  14521. messageSends: []
  14522. }),
  14523. $globals.String);
  14524. $core.addMethod(
  14525. $core.method({
  14526. selector: "asJSON",
  14527. protocol: 'converting',
  14528. fn: function (){
  14529. var self=this;
  14530. return self;
  14531. },
  14532. args: [],
  14533. source: "asJSON\x0a\x09^ self",
  14534. referencedClasses: [],
  14535. messageSends: []
  14536. }),
  14537. $globals.String);
  14538. $core.addMethod(
  14539. $core.method({
  14540. selector: "asJavaScriptMethodName",
  14541. protocol: 'converting',
  14542. fn: function (){
  14543. var self=this;
  14544. return $core.withContext(function($ctx1) {
  14545. return $core.st2js(self);
  14546. return self;
  14547. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  14548. },
  14549. args: [],
  14550. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  14551. referencedClasses: [],
  14552. messageSends: []
  14553. }),
  14554. $globals.String);
  14555. $core.addMethod(
  14556. $core.method({
  14557. selector: "asJavascript",
  14558. protocol: 'converting',
  14559. fn: function (){
  14560. var self=this;
  14561. return $core.withContext(function($ctx1) {
  14562. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  14563. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  14564. else
  14565. return "\"" + self + "\"";
  14566. ;
  14567. return self;
  14568. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  14569. },
  14570. args: [],
  14571. source: "asJavascript\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'>",
  14572. referencedClasses: [],
  14573. messageSends: []
  14574. }),
  14575. $globals.String);
  14576. $core.addMethod(
  14577. $core.method({
  14578. selector: "asLowercase",
  14579. protocol: 'converting',
  14580. fn: function (){
  14581. var self=this;
  14582. return $core.withContext(function($ctx1) {
  14583. return self.toLowerCase();
  14584. return self;
  14585. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  14586. },
  14587. args: [],
  14588. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  14589. referencedClasses: [],
  14590. messageSends: []
  14591. }),
  14592. $globals.String);
  14593. $core.addMethod(
  14594. $core.method({
  14595. selector: "asMutator",
  14596. protocol: 'converting',
  14597. fn: function (){
  14598. var self=this;
  14599. return $core.withContext(function($ctx1) {
  14600. var $1;
  14601. $1=$recv(self._last()).__eq(":");
  14602. if(!$core.assert($1)){
  14603. return self.__comma(":");
  14604. };
  14605. return self;
  14606. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  14607. },
  14608. args: [],
  14609. 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",
  14610. referencedClasses: [],
  14611. messageSends: ["ifFalse:", "=", "last", ","]
  14612. }),
  14613. $globals.String);
  14614. $core.addMethod(
  14615. $core.method({
  14616. selector: "asNumber",
  14617. protocol: 'converting',
  14618. fn: function (){
  14619. var self=this;
  14620. return $core.withContext(function($ctx1) {
  14621. return Number(self);
  14622. return self;
  14623. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  14624. },
  14625. args: [],
  14626. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  14627. referencedClasses: [],
  14628. messageSends: []
  14629. }),
  14630. $globals.String);
  14631. $core.addMethod(
  14632. $core.method({
  14633. selector: "asRegexp",
  14634. protocol: 'converting',
  14635. fn: function (){
  14636. var self=this;
  14637. return $core.withContext(function($ctx1) {
  14638. return $recv($globals.RegularExpression)._fromString_(self);
  14639. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  14640. },
  14641. args: [],
  14642. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  14643. referencedClasses: ["RegularExpression"],
  14644. messageSends: ["fromString:"]
  14645. }),
  14646. $globals.String);
  14647. $core.addMethod(
  14648. $core.method({
  14649. selector: "asString",
  14650. protocol: 'converting',
  14651. fn: function (){
  14652. var self=this;
  14653. return self;
  14654. },
  14655. args: [],
  14656. source: "asString\x0a\x09^ self",
  14657. referencedClasses: [],
  14658. messageSends: []
  14659. }),
  14660. $globals.String);
  14661. $core.addMethod(
  14662. $core.method({
  14663. selector: "asSymbol",
  14664. protocol: 'converting',
  14665. fn: function (){
  14666. var self=this;
  14667. return self;
  14668. },
  14669. args: [],
  14670. source: "asSymbol\x0a\x09^ self",
  14671. referencedClasses: [],
  14672. messageSends: []
  14673. }),
  14674. $globals.String);
  14675. $core.addMethod(
  14676. $core.method({
  14677. selector: "asUppercase",
  14678. protocol: 'converting',
  14679. fn: function (){
  14680. var self=this;
  14681. return $core.withContext(function($ctx1) {
  14682. return self.toUpperCase();
  14683. return self;
  14684. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  14685. },
  14686. args: [],
  14687. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  14688. referencedClasses: [],
  14689. messageSends: []
  14690. }),
  14691. $globals.String);
  14692. $core.addMethod(
  14693. $core.method({
  14694. selector: "asciiValue",
  14695. protocol: 'accessing',
  14696. fn: function (){
  14697. var self=this;
  14698. return $core.withContext(function($ctx1) {
  14699. return self.charCodeAt(0);;
  14700. return self;
  14701. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  14702. },
  14703. args: [],
  14704. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  14705. referencedClasses: [],
  14706. messageSends: []
  14707. }),
  14708. $globals.String);
  14709. $core.addMethod(
  14710. $core.method({
  14711. selector: "at:ifAbsent:",
  14712. protocol: 'accessing',
  14713. fn: function (anIndex,aBlock){
  14714. var self=this;
  14715. return $core.withContext(function($ctx1) {
  14716. return String(self)[anIndex - 1] || aBlock._value();
  14717. return self;
  14718. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  14719. },
  14720. args: ["anIndex", "aBlock"],
  14721. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  14722. referencedClasses: [],
  14723. messageSends: []
  14724. }),
  14725. $globals.String);
  14726. $core.addMethod(
  14727. $core.method({
  14728. selector: "at:ifPresent:ifAbsent:",
  14729. protocol: 'accessing',
  14730. fn: function (anIndex,aBlock,anotherBlock){
  14731. var self=this;
  14732. return $core.withContext(function($ctx1) {
  14733. var result = String(self)[anIndex - 1];
  14734. return result ? aBlock._value_(result) : anotherBlock._value();
  14735. ;
  14736. return self;
  14737. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  14738. },
  14739. args: ["anIndex", "aBlock", "anotherBlock"],
  14740. 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'>",
  14741. referencedClasses: [],
  14742. messageSends: []
  14743. }),
  14744. $globals.String);
  14745. $core.addMethod(
  14746. $core.method({
  14747. selector: "capitalized",
  14748. protocol: 'converting',
  14749. fn: function (){
  14750. var self=this;
  14751. return $core.withContext(function($ctx1) {
  14752. return self._ifNotEmpty_((function(){
  14753. return $core.withContext(function($ctx2) {
  14754. return $recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  14755. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14756. }));
  14757. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  14758. },
  14759. args: [],
  14760. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  14761. referencedClasses: [],
  14762. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  14763. }),
  14764. $globals.String);
  14765. $core.addMethod(
  14766. $core.method({
  14767. selector: "charCodeAt:",
  14768. protocol: 'accessing',
  14769. fn: function (anInteger){
  14770. var self=this;
  14771. return $core.withContext(function($ctx1) {
  14772. return self.charCodeAt(anInteger - 1);
  14773. return self;
  14774. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  14775. },
  14776. args: ["anInteger"],
  14777. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  14778. referencedClasses: [],
  14779. messageSends: []
  14780. }),
  14781. $globals.String);
  14782. $core.addMethod(
  14783. $core.method({
  14784. selector: "copyFrom:to:",
  14785. protocol: 'copying',
  14786. fn: function (anIndex,anotherIndex){
  14787. var self=this;
  14788. return $core.withContext(function($ctx1) {
  14789. return self.substring(anIndex - 1, anotherIndex);
  14790. return self;
  14791. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  14792. },
  14793. args: ["anIndex", "anotherIndex"],
  14794. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  14795. referencedClasses: [],
  14796. messageSends: []
  14797. }),
  14798. $globals.String);
  14799. $core.addMethod(
  14800. $core.method({
  14801. selector: "crlfSanitized",
  14802. protocol: 'converting',
  14803. fn: function (){
  14804. var self=this;
  14805. return $core.withContext(function($ctx1) {
  14806. return $recv(self._lines())._join_($recv($globals.String)._lf());
  14807. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  14808. },
  14809. args: [],
  14810. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  14811. referencedClasses: ["String"],
  14812. messageSends: ["join:", "lines", "lf"]
  14813. }),
  14814. $globals.String);
  14815. $core.addMethod(
  14816. $core.method({
  14817. selector: "deepCopy",
  14818. protocol: 'copying',
  14819. fn: function (){
  14820. var self=this;
  14821. return $core.withContext(function($ctx1) {
  14822. return self._shallowCopy();
  14823. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  14824. },
  14825. args: [],
  14826. source: "deepCopy\x0a\x09^ self shallowCopy",
  14827. referencedClasses: [],
  14828. messageSends: ["shallowCopy"]
  14829. }),
  14830. $globals.String);
  14831. $core.addMethod(
  14832. $core.method({
  14833. selector: "escaped",
  14834. protocol: 'converting',
  14835. fn: function (){
  14836. var self=this;
  14837. return $core.withContext(function($ctx1) {
  14838. return escape(self);
  14839. return self;
  14840. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  14841. },
  14842. args: [],
  14843. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  14844. referencedClasses: [],
  14845. messageSends: []
  14846. }),
  14847. $globals.String);
  14848. $core.addMethod(
  14849. $core.method({
  14850. selector: "includesSubString:",
  14851. protocol: 'testing',
  14852. fn: function (subString){
  14853. var self=this;
  14854. return $core.withContext(function($ctx1) {
  14855. return self.indexOf(subString) != -1;
  14856. return self;
  14857. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  14858. },
  14859. args: ["subString"],
  14860. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  14861. referencedClasses: [],
  14862. messageSends: []
  14863. }),
  14864. $globals.String);
  14865. $core.addMethod(
  14866. $core.method({
  14867. selector: "isCapitalized",
  14868. protocol: 'testing',
  14869. fn: function (){
  14870. var self=this;
  14871. return $core.withContext(function($ctx1) {
  14872. var $2,$1;
  14873. $2=self._first();
  14874. $ctx1.sendIdx["first"]=1;
  14875. $1=$recv($2)._asUppercase();
  14876. return $recv($1).__eq_eq(self._first());
  14877. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  14878. },
  14879. args: [],
  14880. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  14881. referencedClasses: [],
  14882. messageSends: ["==", "asUppercase", "first"]
  14883. }),
  14884. $globals.String);
  14885. $core.addMethod(
  14886. $core.method({
  14887. selector: "isImmutable",
  14888. protocol: 'testing',
  14889. fn: function (){
  14890. var self=this;
  14891. return true;
  14892. },
  14893. args: [],
  14894. source: "isImmutable\x0a\x09^ true",
  14895. referencedClasses: [],
  14896. messageSends: []
  14897. }),
  14898. $globals.String);
  14899. $core.addMethod(
  14900. $core.method({
  14901. selector: "isString",
  14902. protocol: 'testing',
  14903. fn: function (){
  14904. var self=this;
  14905. return true;
  14906. },
  14907. args: [],
  14908. source: "isString\x0a\x09^ true",
  14909. referencedClasses: [],
  14910. messageSends: []
  14911. }),
  14912. $globals.String);
  14913. $core.addMethod(
  14914. $core.method({
  14915. selector: "isVowel",
  14916. protocol: 'testing',
  14917. fn: function (){
  14918. var self=this;
  14919. return $core.withContext(function($ctx1) {
  14920. return $recv($recv(self._size()).__eq((1)))._and_((function(){
  14921. return $core.withContext(function($ctx2) {
  14922. return "aeiou"._includes_(self._asLowercase());
  14923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14924. }));
  14925. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  14926. },
  14927. args: [],
  14928. 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 ]",
  14929. referencedClasses: [],
  14930. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  14931. }),
  14932. $globals.String);
  14933. $core.addMethod(
  14934. $core.method({
  14935. selector: "join:",
  14936. protocol: 'split join',
  14937. fn: function (aCollection){
  14938. var self=this;
  14939. return $core.withContext(function($ctx1) {
  14940. return $recv($globals.String)._streamContents_((function(stream){
  14941. return $core.withContext(function($ctx2) {
  14942. return $recv(aCollection)._do_separatedBy_((function(each){
  14943. return $core.withContext(function($ctx3) {
  14944. return $recv(stream)._nextPutAll_($recv(each)._asString());
  14945. $ctx3.sendIdx["nextPutAll:"]=1;
  14946. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14947. }),(function(){
  14948. return $core.withContext(function($ctx3) {
  14949. return $recv(stream)._nextPutAll_(self);
  14950. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14951. }));
  14952. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14953. }));
  14954. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  14955. },
  14956. args: ["aCollection"],
  14957. 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 ]]",
  14958. referencedClasses: ["String"],
  14959. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  14960. }),
  14961. $globals.String);
  14962. $core.addMethod(
  14963. $core.method({
  14964. selector: "lineIndicesDo:",
  14965. protocol: 'split join',
  14966. fn: function (aBlock){
  14967. var self=this;
  14968. var cr,lf,start,sz,nextLF,nextCR;
  14969. return $core.withContext(function($ctx1) {
  14970. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  14971. var $early={};
  14972. try {
  14973. start=(1);
  14974. sz=self._size();
  14975. cr=$recv($globals.String)._cr();
  14976. nextCR=self._indexOf_startingAt_(cr,(1));
  14977. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  14978. lf=$recv($globals.String)._lf();
  14979. nextLF=self._indexOf_startingAt_(lf,(1));
  14980. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  14981. $recv((function(){
  14982. return $core.withContext(function($ctx2) {
  14983. return $recv(start).__lt_eq(sz);
  14984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14985. }))._whileTrue_((function(){
  14986. return $core.withContext(function($ctx2) {
  14987. $2=$recv(nextLF).__eq((0));
  14988. $ctx2.sendIdx["="]=1;
  14989. $1=$recv($2)._and_((function(){
  14990. return $core.withContext(function($ctx3) {
  14991. return $recv(nextCR).__eq((0));
  14992. $ctx3.sendIdx["="]=2;
  14993. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14994. }));
  14995. $ctx2.sendIdx["and:"]=1;
  14996. if($core.assert($1)){
  14997. $recv(aBlock)._value_value_value_(start,sz,sz);
  14998. $ctx2.sendIdx["value:value:value:"]=1;
  14999. throw $early=[self];
  15000. };
  15001. $4=$recv(nextCR).__eq((0));
  15002. $ctx2.sendIdx["="]=3;
  15003. $3=$recv($4)._or_((function(){
  15004. return $core.withContext(function($ctx3) {
  15005. $5=(0).__lt(nextLF);
  15006. $ctx3.sendIdx["<"]=1;
  15007. return $recv($5)._and_((function(){
  15008. return $core.withContext(function($ctx4) {
  15009. return $recv(nextLF).__lt(nextCR);
  15010. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  15011. }));
  15012. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  15013. }));
  15014. if($core.assert($3)){
  15015. $6=start;
  15016. $7=$recv(nextLF).__minus((1));
  15017. $ctx2.sendIdx["-"]=1;
  15018. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  15019. $ctx2.sendIdx["value:value:value:"]=2;
  15020. start=(1).__plus(nextLF);
  15021. $ctx2.sendIdx["+"]=1;
  15022. start;
  15023. nextLF=self._indexOf_startingAt_(lf,start);
  15024. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  15025. return nextLF;
  15026. } else {
  15027. $9=(1).__plus(nextCR);
  15028. $ctx2.sendIdx["+"]=2;
  15029. $8=$recv($9).__eq(nextLF);
  15030. if($core.assert($8)){
  15031. $10=start;
  15032. $11=$recv(nextCR).__minus((1));
  15033. $ctx2.sendIdx["-"]=2;
  15034. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  15035. $ctx2.sendIdx["value:value:value:"]=3;
  15036. start=(1).__plus(nextLF);
  15037. $ctx2.sendIdx["+"]=3;
  15038. start;
  15039. nextCR=self._indexOf_startingAt_(cr,start);
  15040. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  15041. nextCR;
  15042. nextLF=self._indexOf_startingAt_(lf,start);
  15043. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  15044. return nextLF;
  15045. } else {
  15046. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  15047. start=(1).__plus(nextCR);
  15048. start;
  15049. nextCR=self._indexOf_startingAt_(cr,start);
  15050. return nextCR;
  15051. };
  15052. };
  15053. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15054. }));
  15055. return self;
  15056. }
  15057. catch(e) {if(e===$early)return e[0]; throw e}
  15058. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  15059. },
  15060. args: ["aBlock"],
  15061. 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 ] ]]",
  15062. referencedClasses: ["String"],
  15063. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  15064. }),
  15065. $globals.String);
  15066. $core.addMethod(
  15067. $core.method({
  15068. selector: "lineNumber:",
  15069. protocol: 'split join',
  15070. fn: function (anIndex){
  15071. var self=this;
  15072. var lineCount;
  15073. return $core.withContext(function($ctx1) {
  15074. var $2,$1;
  15075. var $early={};
  15076. try {
  15077. lineCount=(0);
  15078. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  15079. return $core.withContext(function($ctx2) {
  15080. lineCount=$recv(lineCount).__plus((1));
  15081. $2=lineCount;
  15082. $1=$recv($2).__eq(anIndex);
  15083. if($core.assert($1)){
  15084. throw $early=[self._copyFrom_to_(start,endWithoutDelimiters)];
  15085. };
  15086. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  15087. }));
  15088. return nil;
  15089. }
  15090. catch(e) {if(e===$early)return e[0]; throw e}
  15091. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  15092. },
  15093. args: ["anIndex"],
  15094. 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",
  15095. referencedClasses: [],
  15096. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  15097. }),
  15098. $globals.String);
  15099. $core.addMethod(
  15100. $core.method({
  15101. selector: "lines",
  15102. protocol: 'split join',
  15103. fn: function (){
  15104. var self=this;
  15105. return $core.withContext(function($ctx1) {
  15106. var result = self.split(/\r\n|\r|\n/);
  15107. if (!result[result.length-1]) result.pop();
  15108. return result;;
  15109. return self;
  15110. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  15111. },
  15112. args: [],
  15113. 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'>",
  15114. referencedClasses: [],
  15115. messageSends: []
  15116. }),
  15117. $globals.String);
  15118. $core.addMethod(
  15119. $core.method({
  15120. selector: "linesDo:",
  15121. protocol: 'split join',
  15122. fn: function (aBlock){
  15123. var self=this;
  15124. return $core.withContext(function($ctx1) {
  15125. $recv(self._lines())._do_(aBlock);
  15126. return self;
  15127. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  15128. },
  15129. args: ["aBlock"],
  15130. 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",
  15131. referencedClasses: [],
  15132. messageSends: ["do:", "lines"]
  15133. }),
  15134. $globals.String);
  15135. $core.addMethod(
  15136. $core.method({
  15137. selector: "match:",
  15138. protocol: 'regular expressions',
  15139. fn: function (aRegexp){
  15140. var self=this;
  15141. return $core.withContext(function($ctx1) {
  15142. return self.search(aRegexp) != -1;
  15143. return self;
  15144. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  15145. },
  15146. args: ["aRegexp"],
  15147. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  15148. referencedClasses: [],
  15149. messageSends: []
  15150. }),
  15151. $globals.String);
  15152. $core.addMethod(
  15153. $core.method({
  15154. selector: "matchesOf:",
  15155. protocol: 'regular expressions',
  15156. fn: function (aRegularExpression){
  15157. var self=this;
  15158. return $core.withContext(function($ctx1) {
  15159. return self.match(aRegularExpression);
  15160. return self;
  15161. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  15162. },
  15163. args: ["aRegularExpression"],
  15164. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  15165. referencedClasses: [],
  15166. messageSends: []
  15167. }),
  15168. $globals.String);
  15169. $core.addMethod(
  15170. $core.method({
  15171. selector: "numericallyIndexable",
  15172. protocol: 'private',
  15173. fn: function (){
  15174. var self=this;
  15175. return $core.withContext(function($ctx1) {
  15176. return String(self);
  15177. return self;
  15178. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  15179. },
  15180. args: [],
  15181. source: "numericallyIndexable\x0a\x09<inlineJS: 'return String(self)'>",
  15182. referencedClasses: [],
  15183. messageSends: []
  15184. }),
  15185. $globals.String);
  15186. $core.addMethod(
  15187. $core.method({
  15188. selector: "printNl",
  15189. protocol: 'printing',
  15190. fn: function (){
  15191. var self=this;
  15192. return $core.withContext(function($ctx1) {
  15193. console.log(self);
  15194. return self;
  15195. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  15196. },
  15197. args: [],
  15198. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  15199. referencedClasses: [],
  15200. messageSends: []
  15201. }),
  15202. $globals.String);
  15203. $core.addMethod(
  15204. $core.method({
  15205. selector: "printOn:",
  15206. protocol: 'printing',
  15207. fn: function (aStream){
  15208. var self=this;
  15209. return $core.withContext(function($ctx1) {
  15210. $recv(aStream)._nextPutAll_("'");
  15211. $ctx1.sendIdx["nextPutAll:"]=1;
  15212. $recv(aStream)._nextPutAll_(self);
  15213. $ctx1.sendIdx["nextPutAll:"]=2;
  15214. $recv(aStream)._nextPutAll_("'");
  15215. return self;
  15216. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  15217. },
  15218. args: ["aStream"],
  15219. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  15220. referencedClasses: [],
  15221. messageSends: ["nextPutAll:"]
  15222. }),
  15223. $globals.String);
  15224. $core.addMethod(
  15225. $core.method({
  15226. selector: "replace:with:",
  15227. protocol: 'regular expressions',
  15228. fn: function (aString,anotherString){
  15229. var self=this;
  15230. return $core.withContext(function($ctx1) {
  15231. return self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  15232. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  15233. },
  15234. args: ["aString", "anotherString"],
  15235. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  15236. referencedClasses: ["RegularExpression"],
  15237. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  15238. }),
  15239. $globals.String);
  15240. $core.addMethod(
  15241. $core.method({
  15242. selector: "replaceRegexp:with:",
  15243. protocol: 'regular expressions',
  15244. fn: function (aRegexp,aString){
  15245. var self=this;
  15246. return $core.withContext(function($ctx1) {
  15247. return self.replace(aRegexp, aString);
  15248. return self;
  15249. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  15250. },
  15251. args: ["aRegexp", "aString"],
  15252. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  15253. referencedClasses: [],
  15254. messageSends: []
  15255. }),
  15256. $globals.String);
  15257. $core.addMethod(
  15258. $core.method({
  15259. selector: "reversed",
  15260. protocol: 'converting',
  15261. fn: function (){
  15262. var self=this;
  15263. return $core.withContext(function($ctx1) {
  15264. return self.split("").reverse().join("");
  15265. return self;
  15266. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  15267. },
  15268. args: [],
  15269. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  15270. referencedClasses: [],
  15271. messageSends: []
  15272. }),
  15273. $globals.String);
  15274. $core.addMethod(
  15275. $core.method({
  15276. selector: "shallowCopy",
  15277. protocol: 'copying',
  15278. fn: function (){
  15279. var self=this;
  15280. return self;
  15281. },
  15282. args: [],
  15283. source: "shallowCopy\x0a\x09^ self",
  15284. referencedClasses: [],
  15285. messageSends: []
  15286. }),
  15287. $globals.String);
  15288. $core.addMethod(
  15289. $core.method({
  15290. selector: "size",
  15291. protocol: 'accessing',
  15292. fn: function (){
  15293. var self=this;
  15294. return $core.withContext(function($ctx1) {
  15295. return self.length;
  15296. return self;
  15297. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  15298. },
  15299. args: [],
  15300. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  15301. referencedClasses: [],
  15302. messageSends: []
  15303. }),
  15304. $globals.String);
  15305. $core.addMethod(
  15306. $core.method({
  15307. selector: "subStrings:",
  15308. protocol: 'split join',
  15309. fn: function (aString){
  15310. var self=this;
  15311. return $core.withContext(function($ctx1) {
  15312. return self._tokenize_(aString);
  15313. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  15314. },
  15315. args: ["aString"],
  15316. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  15317. referencedClasses: [],
  15318. messageSends: ["tokenize:"]
  15319. }),
  15320. $globals.String);
  15321. $core.addMethod(
  15322. $core.method({
  15323. selector: "tokenize:",
  15324. protocol: 'split join',
  15325. fn: function (aString){
  15326. var self=this;
  15327. return $core.withContext(function($ctx1) {
  15328. return self.split(aString);
  15329. return self;
  15330. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  15331. },
  15332. args: ["aString"],
  15333. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  15334. referencedClasses: [],
  15335. messageSends: []
  15336. }),
  15337. $globals.String);
  15338. $core.addMethod(
  15339. $core.method({
  15340. selector: "trimBoth",
  15341. protocol: 'regular expressions',
  15342. fn: function (){
  15343. var self=this;
  15344. return $core.withContext(function($ctx1) {
  15345. return self._trimBoth_("\x5cs");
  15346. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  15347. },
  15348. args: [],
  15349. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  15350. referencedClasses: [],
  15351. messageSends: ["trimBoth:"]
  15352. }),
  15353. $globals.String);
  15354. $core.addMethod(
  15355. $core.method({
  15356. selector: "trimBoth:",
  15357. protocol: 'regular expressions',
  15358. fn: function (separators){
  15359. var self=this;
  15360. return $core.withContext(function($ctx1) {
  15361. return $recv(self._trimLeft_(separators))._trimRight_(separators);
  15362. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  15363. },
  15364. args: ["separators"],
  15365. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  15366. referencedClasses: [],
  15367. messageSends: ["trimRight:", "trimLeft:"]
  15368. }),
  15369. $globals.String);
  15370. $core.addMethod(
  15371. $core.method({
  15372. selector: "trimLeft",
  15373. protocol: 'regular expressions',
  15374. fn: function (){
  15375. var self=this;
  15376. return $core.withContext(function($ctx1) {
  15377. return self._trimLeft_("\x5cs");
  15378. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  15379. },
  15380. args: [],
  15381. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  15382. referencedClasses: [],
  15383. messageSends: ["trimLeft:"]
  15384. }),
  15385. $globals.String);
  15386. $core.addMethod(
  15387. $core.method({
  15388. selector: "trimLeft:",
  15389. protocol: 'regular expressions',
  15390. fn: function (separators){
  15391. var self=this;
  15392. return $core.withContext(function($ctx1) {
  15393. var $2,$1;
  15394. $2=$recv("^[".__comma(separators)).__comma("]+");
  15395. $ctx1.sendIdx[","]=1;
  15396. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  15397. return self._replaceRegexp_with_($1,"");
  15398. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  15399. },
  15400. args: ["separators"],
  15401. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  15402. referencedClasses: ["RegularExpression"],
  15403. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15404. }),
  15405. $globals.String);
  15406. $core.addMethod(
  15407. $core.method({
  15408. selector: "trimRight",
  15409. protocol: 'regular expressions',
  15410. fn: function (){
  15411. var self=this;
  15412. return $core.withContext(function($ctx1) {
  15413. return self._trimRight_("\x5cs");
  15414. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  15415. },
  15416. args: [],
  15417. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  15418. referencedClasses: [],
  15419. messageSends: ["trimRight:"]
  15420. }),
  15421. $globals.String);
  15422. $core.addMethod(
  15423. $core.method({
  15424. selector: "trimRight:",
  15425. protocol: 'regular expressions',
  15426. fn: function (separators){
  15427. var self=this;
  15428. return $core.withContext(function($ctx1) {
  15429. var $2,$1;
  15430. $2=$recv("[".__comma(separators)).__comma("]+$");
  15431. $ctx1.sendIdx[","]=1;
  15432. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  15433. return self._replaceRegexp_with_($1,"");
  15434. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  15435. },
  15436. args: ["separators"],
  15437. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  15438. referencedClasses: ["RegularExpression"],
  15439. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15440. }),
  15441. $globals.String);
  15442. $core.addMethod(
  15443. $core.method({
  15444. selector: "unescaped",
  15445. protocol: 'converting',
  15446. fn: function (){
  15447. var self=this;
  15448. return $core.withContext(function($ctx1) {
  15449. return unescape(self);
  15450. return self;
  15451. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  15452. },
  15453. args: [],
  15454. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  15455. referencedClasses: [],
  15456. messageSends: []
  15457. }),
  15458. $globals.String);
  15459. $core.addMethod(
  15460. $core.method({
  15461. selector: "uriComponentDecoded",
  15462. protocol: 'converting',
  15463. fn: function (){
  15464. var self=this;
  15465. return $core.withContext(function($ctx1) {
  15466. return decodeURIComponent(self);
  15467. return self;
  15468. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  15469. },
  15470. args: [],
  15471. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  15472. referencedClasses: [],
  15473. messageSends: []
  15474. }),
  15475. $globals.String);
  15476. $core.addMethod(
  15477. $core.method({
  15478. selector: "uriComponentEncoded",
  15479. protocol: 'converting',
  15480. fn: function (){
  15481. var self=this;
  15482. return $core.withContext(function($ctx1) {
  15483. return encodeURIComponent(self);
  15484. return self;
  15485. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  15486. },
  15487. args: [],
  15488. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  15489. referencedClasses: [],
  15490. messageSends: []
  15491. }),
  15492. $globals.String);
  15493. $core.addMethod(
  15494. $core.method({
  15495. selector: "uriDecoded",
  15496. protocol: 'converting',
  15497. fn: function (){
  15498. var self=this;
  15499. return $core.withContext(function($ctx1) {
  15500. return decodeURI(self);
  15501. return self;
  15502. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  15503. },
  15504. args: [],
  15505. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  15506. referencedClasses: [],
  15507. messageSends: []
  15508. }),
  15509. $globals.String);
  15510. $core.addMethod(
  15511. $core.method({
  15512. selector: "uriEncoded",
  15513. protocol: 'converting',
  15514. fn: function (){
  15515. var self=this;
  15516. return $core.withContext(function($ctx1) {
  15517. return encodeURI(self);
  15518. return self;
  15519. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  15520. },
  15521. args: [],
  15522. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  15523. referencedClasses: [],
  15524. messageSends: []
  15525. }),
  15526. $globals.String);
  15527. $core.addMethod(
  15528. $core.method({
  15529. selector: "value:",
  15530. protocol: 'evaluating',
  15531. fn: function (anObject){
  15532. var self=this;
  15533. return $core.withContext(function($ctx1) {
  15534. return $recv(anObject)._perform_(self);
  15535. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  15536. },
  15537. args: ["anObject"],
  15538. source: "value: anObject \x0a\x09^ anObject perform: self",
  15539. referencedClasses: [],
  15540. messageSends: ["perform:"]
  15541. }),
  15542. $globals.String);
  15543. $core.addMethod(
  15544. $core.method({
  15545. selector: "cr",
  15546. protocol: 'accessing',
  15547. fn: function (){
  15548. var self=this;
  15549. return $core.withContext(function($ctx1) {
  15550. return "\r";
  15551. return self;
  15552. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  15553. },
  15554. args: [],
  15555. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  15556. referencedClasses: [],
  15557. messageSends: []
  15558. }),
  15559. $globals.String.klass);
  15560. $core.addMethod(
  15561. $core.method({
  15562. selector: "crlf",
  15563. protocol: 'accessing',
  15564. fn: function (){
  15565. var self=this;
  15566. return $core.withContext(function($ctx1) {
  15567. return "\r\n";
  15568. return self;
  15569. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  15570. },
  15571. args: [],
  15572. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  15573. referencedClasses: [],
  15574. messageSends: []
  15575. }),
  15576. $globals.String.klass);
  15577. $core.addMethod(
  15578. $core.method({
  15579. selector: "esc",
  15580. protocol: 'accessing',
  15581. fn: function (){
  15582. var self=this;
  15583. return $core.withContext(function($ctx1) {
  15584. return self._fromCharCode_((27));
  15585. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  15586. },
  15587. args: [],
  15588. source: "esc\x0a\x09^ self fromCharCode: 27",
  15589. referencedClasses: [],
  15590. messageSends: ["fromCharCode:"]
  15591. }),
  15592. $globals.String.klass);
  15593. $core.addMethod(
  15594. $core.method({
  15595. selector: "fromCharCode:",
  15596. protocol: 'instance creation',
  15597. fn: function (anInteger){
  15598. var self=this;
  15599. return $core.withContext(function($ctx1) {
  15600. return String.fromCharCode(anInteger);
  15601. return self;
  15602. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  15603. },
  15604. args: ["anInteger"],
  15605. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  15606. referencedClasses: [],
  15607. messageSends: []
  15608. }),
  15609. $globals.String.klass);
  15610. $core.addMethod(
  15611. $core.method({
  15612. selector: "fromString:",
  15613. protocol: 'instance creation',
  15614. fn: function (aString){
  15615. var self=this;
  15616. return $core.withContext(function($ctx1) {
  15617. return String(aString);
  15618. return self;
  15619. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  15620. },
  15621. args: ["aString"],
  15622. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  15623. referencedClasses: [],
  15624. messageSends: []
  15625. }),
  15626. $globals.String.klass);
  15627. $core.addMethod(
  15628. $core.method({
  15629. selector: "lf",
  15630. protocol: 'accessing',
  15631. fn: function (){
  15632. var self=this;
  15633. return $core.withContext(function($ctx1) {
  15634. return "\n";
  15635. return self;
  15636. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  15637. },
  15638. args: [],
  15639. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  15640. referencedClasses: [],
  15641. messageSends: []
  15642. }),
  15643. $globals.String.klass);
  15644. $core.addMethod(
  15645. $core.method({
  15646. selector: "random",
  15647. protocol: 'random',
  15648. fn: function (){
  15649. var self=this;
  15650. return $core.withContext(function($ctx1) {
  15651. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  15652. return self;
  15653. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  15654. },
  15655. args: [],
  15656. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);'>",
  15657. referencedClasses: [],
  15658. messageSends: []
  15659. }),
  15660. $globals.String.klass);
  15661. $core.addMethod(
  15662. $core.method({
  15663. selector: "randomNotIn:",
  15664. protocol: 'random',
  15665. fn: function (aString){
  15666. var self=this;
  15667. var result;
  15668. return $core.withContext(function($ctx1) {
  15669. $recv((function(){
  15670. return $core.withContext(function($ctx2) {
  15671. result=self._random();
  15672. result;
  15673. return $recv(aString)._includesSubString_(result);
  15674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15675. }))._whileTrue();
  15676. return result;
  15677. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  15678. },
  15679. args: ["aString"],
  15680. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  15681. referencedClasses: [],
  15682. messageSends: ["whileTrue", "random", "includesSubString:"]
  15683. }),
  15684. $globals.String.klass);
  15685. $core.addMethod(
  15686. $core.method({
  15687. selector: "space",
  15688. protocol: 'accessing',
  15689. fn: function (){
  15690. var self=this;
  15691. return $core.withContext(function($ctx1) {
  15692. return " ";
  15693. return self;
  15694. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  15695. },
  15696. args: [],
  15697. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  15698. referencedClasses: [],
  15699. messageSends: []
  15700. }),
  15701. $globals.String.klass);
  15702. $core.addMethod(
  15703. $core.method({
  15704. selector: "streamClass",
  15705. protocol: 'accessing',
  15706. fn: function (){
  15707. var self=this;
  15708. return $globals.StringStream;
  15709. },
  15710. args: [],
  15711. source: "streamClass\x0a\x09\x09^ StringStream",
  15712. referencedClasses: ["StringStream"],
  15713. messageSends: []
  15714. }),
  15715. $globals.String.klass);
  15716. $core.addMethod(
  15717. $core.method({
  15718. selector: "tab",
  15719. protocol: 'accessing',
  15720. fn: function (){
  15721. var self=this;
  15722. return $core.withContext(function($ctx1) {
  15723. return "\t";
  15724. return self;
  15725. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  15726. },
  15727. args: [],
  15728. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  15729. referencedClasses: [],
  15730. messageSends: []
  15731. }),
  15732. $globals.String.klass);
  15733. $core.addMethod(
  15734. $core.method({
  15735. selector: "value:",
  15736. protocol: 'instance creation',
  15737. fn: function (aUTFCharCode){
  15738. var self=this;
  15739. return $core.withContext(function($ctx1) {
  15740. return String.fromCharCode(aUTFCharCode);;
  15741. return self;
  15742. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  15743. },
  15744. args: ["aUTFCharCode"],
  15745. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  15746. referencedClasses: [],
  15747. messageSends: []
  15748. }),
  15749. $globals.String.klass);
  15750. $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  15751. $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`.";
  15752. $core.addMethod(
  15753. $core.method({
  15754. selector: "=",
  15755. protocol: 'comparing',
  15756. fn: function (aCollection){
  15757. var self=this;
  15758. return $core.withContext(function($ctx1) {
  15759. var $2,$1,$4,$3,$5;
  15760. var $early={};
  15761. try {
  15762. $2=self._class();
  15763. $ctx1.sendIdx["class"]=1;
  15764. $1=$recv($2).__eq($recv(aCollection)._class());
  15765. $ctx1.sendIdx["="]=1;
  15766. if(!$core.assert($1)){
  15767. return false;
  15768. };
  15769. $4=self._size();
  15770. $ctx1.sendIdx["size"]=1;
  15771. $3=$recv($4).__eq($recv(aCollection)._size());
  15772. if(!$core.assert($3)){
  15773. return false;
  15774. };
  15775. self._do_((function(each){
  15776. return $core.withContext(function($ctx2) {
  15777. $5=$recv(aCollection)._includes_(each);
  15778. if(!$core.assert($5)){
  15779. throw $early=[false];
  15780. };
  15781. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15782. }));
  15783. return true;
  15784. }
  15785. catch(e) {if(e===$early)return e[0]; throw e}
  15786. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  15787. },
  15788. args: ["aCollection"],
  15789. 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",
  15790. referencedClasses: [],
  15791. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  15792. }),
  15793. $globals.Set);
  15794. $core.addMethod(
  15795. $core.method({
  15796. selector: "add:",
  15797. protocol: 'adding/removing',
  15798. fn: function (anObject){
  15799. var self=this;
  15800. var bucket;
  15801. return $core.withContext(function($ctx1) {
  15802. var $1,$receiver;
  15803. bucket=self._bucketsOfElement_(anObject);
  15804. $1=$recv(bucket)._second();
  15805. if(($receiver = $1) == null || $receiver.isNil){
  15806. var object,slowBucket;
  15807. object=$recv(bucket)._first();
  15808. $ctx1.sendIdx["first"]=1;
  15809. object;
  15810. slowBucket=$recv(bucket)._third();
  15811. slowBucket;
  15812. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  15813. return $core.withContext(function($ctx2) {
  15814. $recv(slowBucket)._add_(object);
  15815. self["@size"]=$recv(self["@size"]).__plus((1));
  15816. return self["@size"];
  15817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15818. }));
  15819. return object;
  15820. } else {
  15821. var primitiveBucket;
  15822. primitiveBucket=$receiver;
  15823. return self._add_in_($recv(bucket)._first(),primitiveBucket);
  15824. };
  15825. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  15826. },
  15827. args: ["anObject"],
  15828. 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 ]",
  15829. referencedClasses: [],
  15830. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  15831. }),
  15832. $globals.Set);
  15833. $core.addMethod(
  15834. $core.method({
  15835. selector: "add:in:",
  15836. protocol: 'private',
  15837. fn: function (anObject,anotherObject){
  15838. var self=this;
  15839. return $core.withContext(function($ctx1) {
  15840. if (anObject in anotherObject.store) { return false; }
  15841. self['@size']++;
  15842. anotherObject.store[anObject] = true;
  15843. return anObject;
  15844. ;
  15845. return self;
  15846. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  15847. },
  15848. args: ["anObject", "anotherObject"],
  15849. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self[''@size'']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  15850. referencedClasses: [],
  15851. messageSends: []
  15852. }),
  15853. $globals.Set);
  15854. $core.addMethod(
  15855. $core.method({
  15856. selector: "bucketsOfElement:",
  15857. protocol: 'private',
  15858. fn: function (anObject){
  15859. var self=this;
  15860. return $core.withContext(function($ctx1) {
  15861. // include nil to well-known objects under "boolean" fastBucket
  15862. if (anObject == null || anObject.isNil) return [ null, self['@fastBuckets'].boolean ];
  15863. var prim = anObject.valueOf();
  15864. if (typeof prim === "object" || typeof prim === "function" || !self['@fastBuckets'][typeof prim]) {
  15865. var bucket = null;
  15866. self['@slowBucketStores'].some(function (store) {
  15867. return bucket = store._bucketOfElement_(anObject);
  15868. });
  15869. return [ anObject, null, bucket || self['@defaultBucket'] ];
  15870. }
  15871. return [ prim, self['@fastBuckets'][typeof prim] ];
  15872. ;
  15873. return self;
  15874. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  15875. },
  15876. args: ["anObject"],
  15877. 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.isNil) 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\x09self[''@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'>",
  15878. referencedClasses: [],
  15879. messageSends: []
  15880. }),
  15881. $globals.Set);
  15882. $core.addMethod(
  15883. $core.method({
  15884. selector: "classNameOf:",
  15885. protocol: 'private',
  15886. fn: function (anObject){
  15887. var self=this;
  15888. return $core.withContext(function($ctx1) {
  15889. return anObject.klass != null && anObject.klass.className;
  15890. return self;
  15891. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  15892. },
  15893. args: ["anObject"],
  15894. 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.klass != null && anObject.klass.className'>",
  15895. referencedClasses: [],
  15896. messageSends: []
  15897. }),
  15898. $globals.Set);
  15899. $core.addMethod(
  15900. $core.method({
  15901. selector: "collect:",
  15902. protocol: 'enumerating',
  15903. fn: function (aBlock){
  15904. var self=this;
  15905. var collection;
  15906. return $core.withContext(function($ctx1) {
  15907. collection=$recv(self._class())._new();
  15908. self._do_((function(each){
  15909. return $core.withContext(function($ctx2) {
  15910. return $recv(collection)._add_($recv(aBlock)._value_(each));
  15911. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15912. }));
  15913. return collection;
  15914. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  15915. },
  15916. args: ["aBlock"],
  15917. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  15918. referencedClasses: [],
  15919. messageSends: ["new", "class", "do:", "add:", "value:"]
  15920. }),
  15921. $globals.Set);
  15922. $core.addMethod(
  15923. $core.method({
  15924. selector: "detect:ifNone:",
  15925. protocol: 'enumerating',
  15926. fn: function (aBlock,anotherBlock){
  15927. var self=this;
  15928. return $core.withContext(function($ctx1) {
  15929. var $1;
  15930. var $early={};
  15931. try {
  15932. self._do_((function(each){
  15933. return $core.withContext(function($ctx2) {
  15934. $1=$recv(aBlock)._value_(each);
  15935. if($core.assert($1)){
  15936. throw $early=[each];
  15937. };
  15938. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15939. }));
  15940. return $recv(anotherBlock)._value();
  15941. }
  15942. catch(e) {if(e===$early)return e[0]; throw e}
  15943. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  15944. },
  15945. args: ["aBlock", "anotherBlock"],
  15946. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  15947. referencedClasses: [],
  15948. messageSends: ["do:", "ifTrue:", "value:", "value"]
  15949. }),
  15950. $globals.Set);
  15951. $core.addMethod(
  15952. $core.method({
  15953. selector: "do:",
  15954. protocol: 'enumerating',
  15955. fn: function (aBlock){
  15956. var self=this;
  15957. return $core.withContext(function($ctx1) {
  15958. var el, keys, i;
  15959. el = self['@fastBuckets'];
  15960. keys = Object.keys(el);
  15961. for (i = 0; i < keys.length; ++i) {
  15962. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  15963. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  15964. else { store._do_(aBlock); }
  15965. }
  15966. el = self['@slowBucketStores'];
  15967. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  15968. self['@defaultBucket']._do_(aBlock);
  15969. ;
  15970. return self;
  15971. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  15972. },
  15973. args: ["aBlock"],
  15974. 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\x09self[''@defaultBucket'']._do_(aBlock);\x0a\x09'>",
  15975. referencedClasses: [],
  15976. messageSends: []
  15977. }),
  15978. $globals.Set);
  15979. $core.addMethod(
  15980. $core.method({
  15981. selector: "includes:",
  15982. protocol: 'testing',
  15983. fn: function (anObject){
  15984. var self=this;
  15985. var bucket;
  15986. return $core.withContext(function($ctx1) {
  15987. var $1,$2,$3,$receiver;
  15988. bucket=self._bucketsOfElement_(anObject);
  15989. $1=$recv(bucket)._second();
  15990. if(($receiver = $1) == null || $receiver.isNil){
  15991. $2=$recv(bucket)._third();
  15992. $3=$recv(bucket)._first();
  15993. $ctx1.sendIdx["first"]=1;
  15994. return $recv($2)._includes_($3);
  15995. } else {
  15996. var primitiveBucket;
  15997. primitiveBucket=$receiver;
  15998. return self._includes_in_($recv(bucket)._first(),primitiveBucket);
  15999. };
  16000. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  16001. },
  16002. args: ["anObject"],
  16003. 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 ]",
  16004. referencedClasses: [],
  16005. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  16006. }),
  16007. $globals.Set);
  16008. $core.addMethod(
  16009. $core.method({
  16010. selector: "includes:in:",
  16011. protocol: 'private',
  16012. fn: function (anObject,anotherObject){
  16013. var self=this;
  16014. return $core.withContext(function($ctx1) {
  16015. return anObject in anotherObject.store;
  16016. return self;
  16017. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16018. },
  16019. args: ["anObject", "anotherObject"],
  16020. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  16021. referencedClasses: [],
  16022. messageSends: []
  16023. }),
  16024. $globals.Set);
  16025. $core.addMethod(
  16026. $core.method({
  16027. selector: "initialize",
  16028. protocol: 'initialization',
  16029. fn: function (){
  16030. var self=this;
  16031. return $core.withContext(function($ctx1) {
  16032. (
  16033. $ctx1.supercall = true,
  16034. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  16035. $ctx1.supercall = false;
  16036. self["@defaultBucket"]=[];
  16037. self._initializeSlowBucketStores();
  16038. self._removeAll();
  16039. return self;
  16040. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  16041. },
  16042. args: [],
  16043. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  16044. referencedClasses: [],
  16045. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  16046. }),
  16047. $globals.Set);
  16048. $core.addMethod(
  16049. $core.method({
  16050. selector: "initializeSlowBucketStores",
  16051. protocol: 'initialization',
  16052. fn: function (){
  16053. var self=this;
  16054. return $core.withContext(function($ctx1) {
  16055. var $1;
  16056. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  16057. return $core.withContext(function($ctx2) {
  16058. return self._classNameOf_(x);
  16059. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  16060. }));
  16061. $ctx1.sendIdx["hashBlock:"]=1;
  16062. self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  16063. return $core.withContext(function($ctx2) {
  16064. return self._jsConstructorNameOf_(x);
  16065. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  16066. }))];
  16067. return self;
  16068. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  16069. },
  16070. args: [],
  16071. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  16072. referencedClasses: ["ArrayBucketStore"],
  16073. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  16074. }),
  16075. $globals.Set);
  16076. $core.addMethod(
  16077. $core.method({
  16078. selector: "jsConstructorNameOf:",
  16079. protocol: 'private',
  16080. fn: function (anObject){
  16081. var self=this;
  16082. return $core.withContext(function($ctx1) {
  16083. return anObject.constructor && anObject.constructor.name;
  16084. return self;
  16085. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  16086. },
  16087. args: ["anObject"],
  16088. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  16089. referencedClasses: [],
  16090. messageSends: []
  16091. }),
  16092. $globals.Set);
  16093. $core.addMethod(
  16094. $core.method({
  16095. selector: "printOn:",
  16096. protocol: 'printing',
  16097. fn: function (aStream){
  16098. var self=this;
  16099. return $core.withContext(function($ctx1) {
  16100. (
  16101. $ctx1.supercall = true,
  16102. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  16103. $ctx1.supercall = false;
  16104. $ctx1.sendIdx["printOn:"]=1;
  16105. $recv(aStream)._nextPutAll_(" (");
  16106. $ctx1.sendIdx["nextPutAll:"]=1;
  16107. self._do_separatedBy_((function(each){
  16108. return $core.withContext(function($ctx2) {
  16109. return $recv(each)._printOn_(aStream);
  16110. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16111. }),(function(){
  16112. return $core.withContext(function($ctx2) {
  16113. return $recv(aStream)._nextPutAll_(" ");
  16114. $ctx2.sendIdx["nextPutAll:"]=2;
  16115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16116. }));
  16117. $recv(aStream)._nextPutAll_(")");
  16118. return self;
  16119. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  16120. },
  16121. args: ["aStream"],
  16122. 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: ')'",
  16123. referencedClasses: [],
  16124. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  16125. }),
  16126. $globals.Set);
  16127. $core.addMethod(
  16128. $core.method({
  16129. selector: "remove:ifAbsent:",
  16130. protocol: 'adding/removing',
  16131. fn: function (anObject,aBlock){
  16132. var self=this;
  16133. var bucket;
  16134. return $core.withContext(function($ctx1) {
  16135. var $1,$2,$3,$receiver;
  16136. var $early={};
  16137. try {
  16138. bucket=self._bucketsOfElement_(anObject);
  16139. $1=$recv(bucket)._second();
  16140. if(($receiver = $1) == null || $receiver.isNil){
  16141. $2=$recv(bucket)._third();
  16142. $3=$recv(bucket)._first();
  16143. $ctx1.sendIdx["first"]=1;
  16144. $recv($2)._remove_ifAbsent_($3,(function(){
  16145. return $core.withContext(function($ctx2) {
  16146. throw $early=[$recv(aBlock)._value()];
  16147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16148. }));
  16149. self["@size"]=$recv(self["@size"]).__minus((1));
  16150. return self["@size"];
  16151. } else {
  16152. var primitiveBucket;
  16153. primitiveBucket=$receiver;
  16154. return self._remove_in_($recv(bucket)._first(),primitiveBucket);
  16155. };
  16156. }
  16157. catch(e) {if(e===$early)return e[0]; throw e}
  16158. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  16159. },
  16160. args: ["anObject", "aBlock"],
  16161. 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 ]",
  16162. referencedClasses: [],
  16163. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  16164. }),
  16165. $globals.Set);
  16166. $core.addMethod(
  16167. $core.method({
  16168. selector: "remove:in:",
  16169. protocol: 'private',
  16170. fn: function (anObject,anotherObject){
  16171. var self=this;
  16172. return $core.withContext(function($ctx1) {
  16173. if (delete anotherObject.store[anObject]) self['@size']--;
  16174. return self;
  16175. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16176. },
  16177. args: ["anObject", "anotherObject"],
  16178. source: "remove: anObject in: anotherObject\x0a\x09<inlineJS: 'if (delete anotherObject.store[anObject]) self[''@size'']--'>",
  16179. referencedClasses: [],
  16180. messageSends: []
  16181. }),
  16182. $globals.Set);
  16183. $core.addMethod(
  16184. $core.method({
  16185. selector: "removeAll",
  16186. protocol: 'adding/removing',
  16187. fn: function (){
  16188. var self=this;
  16189. return $core.withContext(function($ctx1) {
  16190. self['@fastBuckets'] = {
  16191. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  16192. "number": { store: Object.create(null), fn: Number },
  16193. "string": { store: Object.create(null) }
  16194. };
  16195. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  16196. self['@defaultBucket']._removeAll();
  16197. self['@size'] = 0;
  16198. ;
  16199. return self;
  16200. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  16201. },
  16202. args: [],
  16203. source: "removeAll\x0a\x09<inlineJS: '\x0a\x09\x09self[''@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\x09self[''@slowBucketStores''].forEach(function (x) { x._removeAll(); });\x0a\x09\x09self[''@defaultBucket'']._removeAll();\x0a\x09\x09self[''@size''] = 0;\x0a\x09'>",
  16204. referencedClasses: [],
  16205. messageSends: []
  16206. }),
  16207. $globals.Set);
  16208. $core.addMethod(
  16209. $core.method({
  16210. selector: "select:",
  16211. protocol: 'enumerating',
  16212. fn: function (aBlock){
  16213. var self=this;
  16214. var collection;
  16215. return $core.withContext(function($ctx1) {
  16216. var $1;
  16217. collection=$recv(self._class())._new();
  16218. self._do_((function(each){
  16219. return $core.withContext(function($ctx2) {
  16220. $1=$recv(aBlock)._value_(each);
  16221. if($core.assert($1)){
  16222. return $recv(collection)._add_(each);
  16223. };
  16224. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16225. }));
  16226. return collection;
  16227. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  16228. },
  16229. args: ["aBlock"],
  16230. 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",
  16231. referencedClasses: [],
  16232. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  16233. }),
  16234. $globals.Set);
  16235. $core.addMethod(
  16236. $core.method({
  16237. selector: "size",
  16238. protocol: 'accessing',
  16239. fn: function (){
  16240. var self=this;
  16241. return self["@size"];
  16242. },
  16243. args: [],
  16244. source: "size\x0a\x09^ size",
  16245. referencedClasses: [],
  16246. messageSends: []
  16247. }),
  16248. $globals.Set);
  16249. $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
  16250. $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.";
  16251. $core.addMethod(
  16252. $core.method({
  16253. selector: "<<",
  16254. protocol: 'writing',
  16255. fn: function (anObject){
  16256. var self=this;
  16257. return $core.withContext(function($ctx1) {
  16258. self._write_(anObject);
  16259. return self;
  16260. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  16261. },
  16262. args: ["anObject"],
  16263. source: "<< anObject\x0a\x09self write: anObject",
  16264. referencedClasses: [],
  16265. messageSends: ["write:"]
  16266. }),
  16267. $globals.ProtoStream);
  16268. $core.addMethod(
  16269. $core.method({
  16270. selector: "atEnd",
  16271. protocol: 'testing',
  16272. fn: function (){
  16273. var self=this;
  16274. return $core.withContext(function($ctx1) {
  16275. self._subclassResponsibility();
  16276. return self;
  16277. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  16278. },
  16279. args: [],
  16280. source: "atEnd\x0a\x09self subclassResponsibility",
  16281. referencedClasses: [],
  16282. messageSends: ["subclassResponsibility"]
  16283. }),
  16284. $globals.ProtoStream);
  16285. $core.addMethod(
  16286. $core.method({
  16287. selector: "atStart",
  16288. protocol: 'testing',
  16289. fn: function (){
  16290. var self=this;
  16291. return $core.withContext(function($ctx1) {
  16292. self._subclassResponsibility();
  16293. return self;
  16294. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  16295. },
  16296. args: [],
  16297. source: "atStart\x0a\x09self subclassResponsibility",
  16298. referencedClasses: [],
  16299. messageSends: ["subclassResponsibility"]
  16300. }),
  16301. $globals.ProtoStream);
  16302. $core.addMethod(
  16303. $core.method({
  16304. selector: "contents",
  16305. protocol: 'accessing',
  16306. fn: function (){
  16307. var self=this;
  16308. return $core.withContext(function($ctx1) {
  16309. self._subclassResponsibility();
  16310. return self;
  16311. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  16312. },
  16313. args: [],
  16314. source: "contents\x0a\x09self subclassResponsibility",
  16315. referencedClasses: [],
  16316. messageSends: ["subclassResponsibility"]
  16317. }),
  16318. $globals.ProtoStream);
  16319. $core.addMethod(
  16320. $core.method({
  16321. selector: "do:",
  16322. protocol: 'enumerating',
  16323. fn: function (aBlock){
  16324. var self=this;
  16325. return $core.withContext(function($ctx1) {
  16326. $recv((function(){
  16327. return $core.withContext(function($ctx2) {
  16328. return self._atEnd();
  16329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16330. }))._whileFalse_((function(){
  16331. return $core.withContext(function($ctx2) {
  16332. return $recv(aBlock)._value_(self._next());
  16333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16334. }));
  16335. return self;
  16336. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  16337. },
  16338. args: ["aBlock"],
  16339. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  16340. referencedClasses: [],
  16341. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  16342. }),
  16343. $globals.ProtoStream);
  16344. $core.addMethod(
  16345. $core.method({
  16346. selector: "isEmpty",
  16347. protocol: 'testing',
  16348. fn: function (){
  16349. var self=this;
  16350. return $core.withContext(function($ctx1) {
  16351. return $recv(self._atStart())._and_((function(){
  16352. return $core.withContext(function($ctx2) {
  16353. return self._atEnd();
  16354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16355. }));
  16356. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  16357. },
  16358. args: [],
  16359. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  16360. referencedClasses: [],
  16361. messageSends: ["and:", "atStart", "atEnd"]
  16362. }),
  16363. $globals.ProtoStream);
  16364. $core.addMethod(
  16365. $core.method({
  16366. selector: "next",
  16367. protocol: 'reading',
  16368. fn: function (){
  16369. var self=this;
  16370. return $core.withContext(function($ctx1) {
  16371. var $1;
  16372. $1=self._atEnd();
  16373. if($core.assert($1)){
  16374. return nil;
  16375. } else {
  16376. return self._subclassResponsibility();
  16377. };
  16378. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  16379. },
  16380. args: [],
  16381. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16382. referencedClasses: [],
  16383. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16384. }),
  16385. $globals.ProtoStream);
  16386. $core.addMethod(
  16387. $core.method({
  16388. selector: "nextPut:",
  16389. protocol: 'writing',
  16390. fn: function (anObject){
  16391. var self=this;
  16392. return $core.withContext(function($ctx1) {
  16393. self._subclassResponsibility();
  16394. return self;
  16395. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  16396. },
  16397. args: ["anObject"],
  16398. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  16399. referencedClasses: [],
  16400. messageSends: ["subclassResponsibility"]
  16401. }),
  16402. $globals.ProtoStream);
  16403. $core.addMethod(
  16404. $core.method({
  16405. selector: "nextPutAll:",
  16406. protocol: 'writing',
  16407. fn: function (aCollection){
  16408. var self=this;
  16409. return $core.withContext(function($ctx1) {
  16410. $recv(aCollection)._do_((function(each){
  16411. return $core.withContext(function($ctx2) {
  16412. return self._nextPut_(each);
  16413. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16414. }));
  16415. return self;
  16416. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  16417. },
  16418. args: ["aCollection"],
  16419. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  16420. referencedClasses: [],
  16421. messageSends: ["do:", "nextPut:"]
  16422. }),
  16423. $globals.ProtoStream);
  16424. $core.addMethod(
  16425. $core.method({
  16426. selector: "nextPutJSObject:",
  16427. protocol: 'writing',
  16428. fn: function (aJSObject){
  16429. var self=this;
  16430. return $core.withContext(function($ctx1) {
  16431. self._nextPut_(aJSObject);
  16432. return self;
  16433. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  16434. },
  16435. args: ["aJSObject"],
  16436. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  16437. referencedClasses: [],
  16438. messageSends: ["nextPut:"]
  16439. }),
  16440. $globals.ProtoStream);
  16441. $core.addMethod(
  16442. $core.method({
  16443. selector: "nextPutString:",
  16444. protocol: 'writing',
  16445. fn: function (aString){
  16446. var self=this;
  16447. return $core.withContext(function($ctx1) {
  16448. self._nextPut_(aString);
  16449. return self;
  16450. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  16451. },
  16452. args: ["aString"],
  16453. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  16454. referencedClasses: [],
  16455. messageSends: ["nextPut:"]
  16456. }),
  16457. $globals.ProtoStream);
  16458. $core.addMethod(
  16459. $core.method({
  16460. selector: "peek",
  16461. protocol: 'reading',
  16462. fn: function (){
  16463. var self=this;
  16464. return $core.withContext(function($ctx1) {
  16465. var $1;
  16466. $1=self._atEnd();
  16467. if($core.assert($1)){
  16468. return nil;
  16469. } else {
  16470. return self._subclassResponsibility();
  16471. };
  16472. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  16473. },
  16474. args: [],
  16475. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16476. referencedClasses: [],
  16477. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16478. }),
  16479. $globals.ProtoStream);
  16480. $core.addMethod(
  16481. $core.method({
  16482. selector: "reset",
  16483. protocol: 'actions',
  16484. fn: function (){
  16485. var self=this;
  16486. return $core.withContext(function($ctx1) {
  16487. self._subclassResponsibility();
  16488. return self;
  16489. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  16490. },
  16491. args: [],
  16492. source: "reset\x0a\x09self subclassResponsibility",
  16493. referencedClasses: [],
  16494. messageSends: ["subclassResponsibility"]
  16495. }),
  16496. $globals.ProtoStream);
  16497. $core.addMethod(
  16498. $core.method({
  16499. selector: "resetContents",
  16500. protocol: 'actions',
  16501. fn: function (){
  16502. var self=this;
  16503. return $core.withContext(function($ctx1) {
  16504. self._subclassResponsibility();
  16505. return self;
  16506. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  16507. },
  16508. args: [],
  16509. source: "resetContents\x0a\x09self subclassResponsibility",
  16510. referencedClasses: [],
  16511. messageSends: ["subclassResponsibility"]
  16512. }),
  16513. $globals.ProtoStream);
  16514. $core.addMethod(
  16515. $core.method({
  16516. selector: "setToEnd",
  16517. protocol: 'positioning',
  16518. fn: function (){
  16519. var self=this;
  16520. return $core.withContext(function($ctx1) {
  16521. self._subclassResponsibility();
  16522. return self;
  16523. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  16524. },
  16525. args: [],
  16526. source: "setToEnd\x0a\x09self subclassResponsibility",
  16527. referencedClasses: [],
  16528. messageSends: ["subclassResponsibility"]
  16529. }),
  16530. $globals.ProtoStream);
  16531. $core.addMethod(
  16532. $core.method({
  16533. selector: "setToStart",
  16534. protocol: 'positioning',
  16535. fn: function (){
  16536. var self=this;
  16537. return $core.withContext(function($ctx1) {
  16538. self._reset();
  16539. return self;
  16540. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  16541. },
  16542. args: [],
  16543. source: "setToStart\x0a\x09self reset",
  16544. referencedClasses: [],
  16545. messageSends: ["reset"]
  16546. }),
  16547. $globals.ProtoStream);
  16548. $core.addMethod(
  16549. $core.method({
  16550. selector: "write:",
  16551. protocol: 'writing',
  16552. fn: function (anObject){
  16553. var self=this;
  16554. return $core.withContext(function($ctx1) {
  16555. $recv(anObject)._putOn_(self);
  16556. return self;
  16557. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  16558. },
  16559. args: ["anObject"],
  16560. source: "write: anObject\x0a\x09anObject putOn: self",
  16561. referencedClasses: [],
  16562. messageSends: ["putOn:"]
  16563. }),
  16564. $globals.ProtoStream);
  16565. $core.addMethod(
  16566. $core.method({
  16567. selector: "on:",
  16568. protocol: 'instance creation',
  16569. fn: function (aCollection){
  16570. var self=this;
  16571. return $core.withContext(function($ctx1) {
  16572. var $1;
  16573. $1=self._new();
  16574. $recv($1)._setCollection_(aCollection);
  16575. $recv($1)._setStreamSize_($recv(aCollection)._size());
  16576. return $recv($1)._yourself();
  16577. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  16578. },
  16579. args: ["aCollection"],
  16580. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16581. referencedClasses: [],
  16582. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16583. }),
  16584. $globals.ProtoStream.klass);
  16585. $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  16586. $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.";
  16587. $core.addMethod(
  16588. $core.method({
  16589. selector: "atEnd",
  16590. protocol: 'testing',
  16591. fn: function (){
  16592. var self=this;
  16593. return $core.withContext(function($ctx1) {
  16594. return $recv(self._position()).__eq(self._size());
  16595. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  16596. },
  16597. args: [],
  16598. source: "atEnd\x0a\x09^ self position = self size",
  16599. referencedClasses: [],
  16600. messageSends: ["=", "position", "size"]
  16601. }),
  16602. $globals.Stream);
  16603. $core.addMethod(
  16604. $core.method({
  16605. selector: "atStart",
  16606. protocol: 'testing',
  16607. fn: function (){
  16608. var self=this;
  16609. return $core.withContext(function($ctx1) {
  16610. return $recv(self._position()).__eq((0));
  16611. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  16612. },
  16613. args: [],
  16614. source: "atStart\x0a\x09^ self position = 0",
  16615. referencedClasses: [],
  16616. messageSends: ["=", "position"]
  16617. }),
  16618. $globals.Stream);
  16619. $core.addMethod(
  16620. $core.method({
  16621. selector: "close",
  16622. protocol: 'actions',
  16623. fn: function (){
  16624. var self=this;
  16625. return self;
  16626. },
  16627. args: [],
  16628. source: "close",
  16629. referencedClasses: [],
  16630. messageSends: []
  16631. }),
  16632. $globals.Stream);
  16633. $core.addMethod(
  16634. $core.method({
  16635. selector: "collection",
  16636. protocol: 'accessing',
  16637. fn: function (){
  16638. var self=this;
  16639. return self["@collection"];
  16640. },
  16641. args: [],
  16642. source: "collection\x0a\x09^ collection",
  16643. referencedClasses: [],
  16644. messageSends: []
  16645. }),
  16646. $globals.Stream);
  16647. $core.addMethod(
  16648. $core.method({
  16649. selector: "contents",
  16650. protocol: 'accessing',
  16651. fn: function (){
  16652. var self=this;
  16653. return $core.withContext(function($ctx1) {
  16654. return $recv(self._collection())._copyFrom_to_((1),self._streamSize());
  16655. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  16656. },
  16657. args: [],
  16658. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  16659. referencedClasses: [],
  16660. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  16661. }),
  16662. $globals.Stream);
  16663. $core.addMethod(
  16664. $core.method({
  16665. selector: "flush",
  16666. protocol: 'actions',
  16667. fn: function (){
  16668. var self=this;
  16669. return self;
  16670. },
  16671. args: [],
  16672. source: "flush",
  16673. referencedClasses: [],
  16674. messageSends: []
  16675. }),
  16676. $globals.Stream);
  16677. $core.addMethod(
  16678. $core.method({
  16679. selector: "isEmpty",
  16680. protocol: 'testing',
  16681. fn: function (){
  16682. var self=this;
  16683. return $core.withContext(function($ctx1) {
  16684. return $recv(self._size()).__eq((0));
  16685. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  16686. },
  16687. args: [],
  16688. source: "isEmpty\x0a\x09^ self size = 0",
  16689. referencedClasses: [],
  16690. messageSends: ["=", "size"]
  16691. }),
  16692. $globals.Stream);
  16693. $core.addMethod(
  16694. $core.method({
  16695. selector: "next",
  16696. protocol: 'reading',
  16697. fn: function (){
  16698. var self=this;
  16699. return $core.withContext(function($ctx1) {
  16700. var $1,$3,$2;
  16701. $1=self._atEnd();
  16702. if($core.assert($1)){
  16703. return nil;
  16704. } else {
  16705. $3=self._position();
  16706. $ctx1.sendIdx["position"]=1;
  16707. $2=$recv($3).__plus((1));
  16708. self._position_($2);
  16709. return $recv(self["@collection"])._at_(self._position());
  16710. };
  16711. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  16712. },
  16713. args: [],
  16714. 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 ]",
  16715. referencedClasses: [],
  16716. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  16717. }),
  16718. $globals.Stream);
  16719. $core.addMethod(
  16720. $core.method({
  16721. selector: "next:",
  16722. protocol: 'reading',
  16723. fn: function (anInteger){
  16724. var self=this;
  16725. var tempCollection;
  16726. return $core.withContext(function($ctx1) {
  16727. var $1;
  16728. tempCollection=$recv($recv(self._collection())._class())._new();
  16729. $recv(anInteger)._timesRepeat_((function(){
  16730. return $core.withContext(function($ctx2) {
  16731. $1=self._atEnd();
  16732. if(!$core.assert($1)){
  16733. return $recv(tempCollection)._add_(self._next());
  16734. };
  16735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16736. }));
  16737. return tempCollection;
  16738. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  16739. },
  16740. args: ["anInteger"],
  16741. 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",
  16742. referencedClasses: [],
  16743. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  16744. }),
  16745. $globals.Stream);
  16746. $core.addMethod(
  16747. $core.method({
  16748. selector: "nextPut:",
  16749. protocol: 'writing',
  16750. fn: function (anObject){
  16751. var self=this;
  16752. return $core.withContext(function($ctx1) {
  16753. var $2,$1,$3,$4;
  16754. $2=self._position();
  16755. $ctx1.sendIdx["position"]=1;
  16756. $1=$recv($2).__plus((1));
  16757. self._position_($1);
  16758. $3=self._collection();
  16759. $4=self._position();
  16760. $ctx1.sendIdx["position"]=2;
  16761. $recv($3)._at_put_($4,anObject);
  16762. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  16763. return self;
  16764. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  16765. },
  16766. args: ["anObject"],
  16767. 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)",
  16768. referencedClasses: [],
  16769. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  16770. }),
  16771. $globals.Stream);
  16772. $core.addMethod(
  16773. $core.method({
  16774. selector: "peek",
  16775. protocol: 'reading',
  16776. fn: function (){
  16777. var self=this;
  16778. return $core.withContext(function($ctx1) {
  16779. var $1;
  16780. $1=self._atEnd();
  16781. if(!$core.assert($1)){
  16782. return $recv(self._collection())._at_($recv(self._position()).__plus((1)));
  16783. };
  16784. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  16785. },
  16786. args: [],
  16787. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  16788. referencedClasses: [],
  16789. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  16790. }),
  16791. $globals.Stream);
  16792. $core.addMethod(
  16793. $core.method({
  16794. selector: "position",
  16795. protocol: 'accessing',
  16796. fn: function (){
  16797. var self=this;
  16798. return $core.withContext(function($ctx1) {
  16799. var $1,$receiver;
  16800. $1=self["@position"];
  16801. if(($receiver = $1) == null || $receiver.isNil){
  16802. self["@position"]=(0);
  16803. return self["@position"];
  16804. } else {
  16805. return $1;
  16806. };
  16807. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  16808. },
  16809. args: [],
  16810. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  16811. referencedClasses: [],
  16812. messageSends: ["ifNil:"]
  16813. }),
  16814. $globals.Stream);
  16815. $core.addMethod(
  16816. $core.method({
  16817. selector: "position:",
  16818. protocol: 'accessing',
  16819. fn: function (anInteger){
  16820. var self=this;
  16821. self["@position"]=anInteger;
  16822. return self;
  16823. },
  16824. args: ["anInteger"],
  16825. source: "position: anInteger\x0a\x09position := anInteger",
  16826. referencedClasses: [],
  16827. messageSends: []
  16828. }),
  16829. $globals.Stream);
  16830. $core.addMethod(
  16831. $core.method({
  16832. selector: "reset",
  16833. protocol: 'actions',
  16834. fn: function (){
  16835. var self=this;
  16836. return $core.withContext(function($ctx1) {
  16837. self._position_((0));
  16838. return self;
  16839. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  16840. },
  16841. args: [],
  16842. source: "reset\x0a\x09self position: 0",
  16843. referencedClasses: [],
  16844. messageSends: ["position:"]
  16845. }),
  16846. $globals.Stream);
  16847. $core.addMethod(
  16848. $core.method({
  16849. selector: "resetContents",
  16850. protocol: 'actions',
  16851. fn: function (){
  16852. var self=this;
  16853. return $core.withContext(function($ctx1) {
  16854. self._reset();
  16855. self._setStreamSize_((0));
  16856. return self;
  16857. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  16858. },
  16859. args: [],
  16860. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  16861. referencedClasses: [],
  16862. messageSends: ["reset", "setStreamSize:"]
  16863. }),
  16864. $globals.Stream);
  16865. $core.addMethod(
  16866. $core.method({
  16867. selector: "setCollection:",
  16868. protocol: 'accessing',
  16869. fn: function (aCollection){
  16870. var self=this;
  16871. self["@collection"]=aCollection;
  16872. return self;
  16873. },
  16874. args: ["aCollection"],
  16875. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  16876. referencedClasses: [],
  16877. messageSends: []
  16878. }),
  16879. $globals.Stream);
  16880. $core.addMethod(
  16881. $core.method({
  16882. selector: "setStreamSize:",
  16883. protocol: 'accessing',
  16884. fn: function (anInteger){
  16885. var self=this;
  16886. self["@streamSize"]=anInteger;
  16887. return self;
  16888. },
  16889. args: ["anInteger"],
  16890. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  16891. referencedClasses: [],
  16892. messageSends: []
  16893. }),
  16894. $globals.Stream);
  16895. $core.addMethod(
  16896. $core.method({
  16897. selector: "setToEnd",
  16898. protocol: 'positioning',
  16899. fn: function (){
  16900. var self=this;
  16901. return $core.withContext(function($ctx1) {
  16902. self._position_(self._size());
  16903. return self;
  16904. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  16905. },
  16906. args: [],
  16907. source: "setToEnd\x0a\x09self position: self size",
  16908. referencedClasses: [],
  16909. messageSends: ["position:", "size"]
  16910. }),
  16911. $globals.Stream);
  16912. $core.addMethod(
  16913. $core.method({
  16914. selector: "size",
  16915. protocol: 'accessing',
  16916. fn: function (){
  16917. var self=this;
  16918. return $core.withContext(function($ctx1) {
  16919. return self._streamSize();
  16920. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  16921. },
  16922. args: [],
  16923. source: "size\x0a\x09^ self streamSize",
  16924. referencedClasses: [],
  16925. messageSends: ["streamSize"]
  16926. }),
  16927. $globals.Stream);
  16928. $core.addMethod(
  16929. $core.method({
  16930. selector: "skip:",
  16931. protocol: 'positioning',
  16932. fn: function (anInteger){
  16933. var self=this;
  16934. return $core.withContext(function($ctx1) {
  16935. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  16936. return self;
  16937. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  16938. },
  16939. args: ["anInteger"],
  16940. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  16941. referencedClasses: [],
  16942. messageSends: ["position:", "min:max:", "+", "position", "size"]
  16943. }),
  16944. $globals.Stream);
  16945. $core.addMethod(
  16946. $core.method({
  16947. selector: "streamSize",
  16948. protocol: 'accessing',
  16949. fn: function (){
  16950. var self=this;
  16951. return self["@streamSize"];
  16952. },
  16953. args: [],
  16954. source: "streamSize\x0a\x09^ streamSize",
  16955. referencedClasses: [],
  16956. messageSends: []
  16957. }),
  16958. $globals.Stream);
  16959. $core.addMethod(
  16960. $core.method({
  16961. selector: "on:",
  16962. protocol: 'instance creation',
  16963. fn: function (aCollection){
  16964. var self=this;
  16965. return $core.withContext(function($ctx1) {
  16966. var $1;
  16967. $1=self._new();
  16968. $recv($1)._setCollection_(aCollection);
  16969. $recv($1)._setStreamSize_($recv(aCollection)._size());
  16970. return $recv($1)._yourself();
  16971. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  16972. },
  16973. args: ["aCollection"],
  16974. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16975. referencedClasses: [],
  16976. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16977. }),
  16978. $globals.Stream.klass);
  16979. $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
  16980. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  16981. $core.addMethod(
  16982. $core.method({
  16983. selector: "cr",
  16984. protocol: 'writing',
  16985. fn: function (){
  16986. var self=this;
  16987. return $core.withContext(function($ctx1) {
  16988. return self._nextPutAll_($recv($globals.String)._cr());
  16989. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  16990. },
  16991. args: [],
  16992. source: "cr\x0a\x09^ self nextPutAll: String cr",
  16993. referencedClasses: ["String"],
  16994. messageSends: ["nextPutAll:", "cr"]
  16995. }),
  16996. $globals.StringStream);
  16997. $core.addMethod(
  16998. $core.method({
  16999. selector: "crlf",
  17000. protocol: 'writing',
  17001. fn: function (){
  17002. var self=this;
  17003. return $core.withContext(function($ctx1) {
  17004. return self._nextPutAll_($recv($globals.String)._crlf());
  17005. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  17006. },
  17007. args: [],
  17008. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  17009. referencedClasses: ["String"],
  17010. messageSends: ["nextPutAll:", "crlf"]
  17011. }),
  17012. $globals.StringStream);
  17013. $core.addMethod(
  17014. $core.method({
  17015. selector: "lf",
  17016. protocol: 'writing',
  17017. fn: function (){
  17018. var self=this;
  17019. return $core.withContext(function($ctx1) {
  17020. return self._nextPutAll_($recv($globals.String)._lf());
  17021. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  17022. },
  17023. args: [],
  17024. source: "lf\x0a\x09^ self nextPutAll: String lf",
  17025. referencedClasses: ["String"],
  17026. messageSends: ["nextPutAll:", "lf"]
  17027. }),
  17028. $globals.StringStream);
  17029. $core.addMethod(
  17030. $core.method({
  17031. selector: "next:",
  17032. protocol: 'reading',
  17033. fn: function (anInteger){
  17034. var self=this;
  17035. var tempCollection;
  17036. return $core.withContext(function($ctx1) {
  17037. var $1;
  17038. tempCollection=$recv($recv(self._collection())._class())._new();
  17039. $recv(anInteger)._timesRepeat_((function(){
  17040. return $core.withContext(function($ctx2) {
  17041. $1=self._atEnd();
  17042. if(!$core.assert($1)){
  17043. tempCollection=$recv(tempCollection).__comma(self._next());
  17044. return tempCollection;
  17045. };
  17046. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17047. }));
  17048. return tempCollection;
  17049. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  17050. },
  17051. args: ["anInteger"],
  17052. 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",
  17053. referencedClasses: [],
  17054. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  17055. }),
  17056. $globals.StringStream);
  17057. $core.addMethod(
  17058. $core.method({
  17059. selector: "nextPut:",
  17060. protocol: 'writing',
  17061. fn: function (aString){
  17062. var self=this;
  17063. return $core.withContext(function($ctx1) {
  17064. self._nextPutAll_(aString);
  17065. return self;
  17066. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  17067. },
  17068. args: ["aString"],
  17069. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  17070. referencedClasses: [],
  17071. messageSends: ["nextPutAll:"]
  17072. }),
  17073. $globals.StringStream);
  17074. $core.addMethod(
  17075. $core.method({
  17076. selector: "nextPutAll:",
  17077. protocol: 'writing',
  17078. fn: function (aString){
  17079. var self=this;
  17080. var pre,post;
  17081. return $core.withContext(function($ctx1) {
  17082. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  17083. $1=self._atEnd();
  17084. if($core.assert($1)){
  17085. $3=self._collection();
  17086. $ctx1.sendIdx["collection"]=1;
  17087. $2=$recv($3).__comma(aString);
  17088. $ctx1.sendIdx[","]=1;
  17089. self._setCollection_($2);
  17090. $ctx1.sendIdx["setCollection:"]=1;
  17091. } else {
  17092. $4=self._collection();
  17093. $ctx1.sendIdx["collection"]=2;
  17094. $5=self._position();
  17095. $ctx1.sendIdx["position"]=1;
  17096. pre=$recv($4)._copyFrom_to_((1),$5);
  17097. $ctx1.sendIdx["copyFrom:to:"]=1;
  17098. pre;
  17099. $6=self._collection();
  17100. $ctx1.sendIdx["collection"]=3;
  17101. $9=self._position();
  17102. $ctx1.sendIdx["position"]=2;
  17103. $8=$recv($9).__plus((1));
  17104. $ctx1.sendIdx["+"]=2;
  17105. $10=$recv(aString)._size();
  17106. $ctx1.sendIdx["size"]=1;
  17107. $7=$recv($8).__plus($10);
  17108. $ctx1.sendIdx["+"]=1;
  17109. $11=$recv(self._collection())._size();
  17110. $ctx1.sendIdx["size"]=2;
  17111. post=$recv($6)._copyFrom_to_($7,$11);
  17112. post;
  17113. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  17114. $ctx1.sendIdx[","]=2;
  17115. self._setCollection_($12);
  17116. };
  17117. $14=self._position();
  17118. $ctx1.sendIdx["position"]=3;
  17119. $13=$recv($14).__plus($recv(aString)._size());
  17120. self._position_($13);
  17121. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  17122. return self;
  17123. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  17124. },
  17125. args: ["aString"],
  17126. 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)",
  17127. referencedClasses: [],
  17128. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  17129. }),
  17130. $globals.StringStream);
  17131. $core.addMethod(
  17132. $core.method({
  17133. selector: "nextPutString:",
  17134. protocol: 'writing',
  17135. fn: function (aString){
  17136. var self=this;
  17137. return $core.withContext(function($ctx1) {
  17138. self._nextPutAll_(aString);
  17139. return self;
  17140. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  17141. },
  17142. args: ["aString"],
  17143. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  17144. referencedClasses: [],
  17145. messageSends: ["nextPutAll:"]
  17146. }),
  17147. $globals.StringStream);
  17148. $core.addMethod(
  17149. $core.method({
  17150. selector: "space",
  17151. protocol: 'writing',
  17152. fn: function (){
  17153. var self=this;
  17154. return $core.withContext(function($ctx1) {
  17155. self._nextPut_(" ");
  17156. return self;
  17157. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  17158. },
  17159. args: [],
  17160. source: "space\x0a\x09self nextPut: ' '",
  17161. referencedClasses: [],
  17162. messageSends: ["nextPut:"]
  17163. }),
  17164. $globals.StringStream);
  17165. $core.addMethod(
  17166. $core.method({
  17167. selector: "tab",
  17168. protocol: 'writing',
  17169. fn: function (){
  17170. var self=this;
  17171. return $core.withContext(function($ctx1) {
  17172. return self._nextPutAll_($recv($globals.String)._tab());
  17173. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  17174. },
  17175. args: [],
  17176. source: "tab\x0a\x09^ self nextPutAll: String tab",
  17177. referencedClasses: ["String"],
  17178. messageSends: ["nextPutAll:", "tab"]
  17179. }),
  17180. $globals.StringStream);
  17181. $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  17182. $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.";
  17183. $core.addMethod(
  17184. $core.method({
  17185. selector: "initialize",
  17186. protocol: 'initialization',
  17187. fn: function (){
  17188. var self=this;
  17189. return $core.withContext(function($ctx1) {
  17190. (
  17191. $ctx1.supercall = true,
  17192. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  17193. $ctx1.supercall = false;
  17194. self["@read"]=$recv($globals.OrderedCollection)._new();
  17195. $ctx1.sendIdx["new"]=1;
  17196. self["@write"]=$recv($globals.OrderedCollection)._new();
  17197. self["@readIndex"]=(1);
  17198. return self;
  17199. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  17200. },
  17201. args: [],
  17202. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  17203. referencedClasses: ["OrderedCollection"],
  17204. messageSends: ["initialize", "new"]
  17205. }),
  17206. $globals.Queue);
  17207. $core.addMethod(
  17208. $core.method({
  17209. selector: "next",
  17210. protocol: 'accessing',
  17211. fn: function (){
  17212. var self=this;
  17213. return $core.withContext(function($ctx1) {
  17214. return self._nextIfAbsent_((function(){
  17215. return $core.withContext(function($ctx2) {
  17216. return self._error_("Cannot read from empty Queue.");
  17217. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17218. }));
  17219. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  17220. },
  17221. args: [],
  17222. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  17223. referencedClasses: [],
  17224. messageSends: ["nextIfAbsent:", "error:"]
  17225. }),
  17226. $globals.Queue);
  17227. $core.addMethod(
  17228. $core.method({
  17229. selector: "nextIfAbsent:",
  17230. protocol: 'accessing',
  17231. fn: function (aBlock){
  17232. var self=this;
  17233. var result;
  17234. return $core.withContext(function($ctx1) {
  17235. var $1;
  17236. var $early={};
  17237. try {
  17238. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  17239. return $core.withContext(function($ctx2) {
  17240. $recv(self["@write"])._ifEmpty_((function(){
  17241. return $core.withContext(function($ctx3) {
  17242. $1=$recv(self["@readIndex"]).__gt((1));
  17243. if($core.assert($1)){
  17244. self["@read"]=[];
  17245. self["@read"];
  17246. self["@readIndex"]=(1);
  17247. self["@readIndex"];
  17248. };
  17249. throw $early=[$recv(aBlock)._value()];
  17250. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17251. }));
  17252. self["@read"]=self["@write"];
  17253. self["@read"];
  17254. self["@readIndex"]=(1);
  17255. self["@readIndex"];
  17256. self["@write"]=$recv($globals.OrderedCollection)._new();
  17257. self["@write"];
  17258. return $recv(self["@read"])._first();
  17259. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17260. }));
  17261. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  17262. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  17263. return result;
  17264. }
  17265. catch(e) {if(e===$early)return e[0]; throw e}
  17266. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  17267. },
  17268. args: ["aBlock"],
  17269. 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",
  17270. referencedClasses: ["OrderedCollection"],
  17271. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  17272. }),
  17273. $globals.Queue);
  17274. $core.addMethod(
  17275. $core.method({
  17276. selector: "nextPut:",
  17277. protocol: 'accessing',
  17278. fn: function (anObject){
  17279. var self=this;
  17280. return $core.withContext(function($ctx1) {
  17281. $recv(self["@write"])._add_(anObject);
  17282. return self;
  17283. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  17284. },
  17285. args: ["anObject"],
  17286. source: "nextPut: anObject\x0a\x09write add: anObject",
  17287. referencedClasses: [],
  17288. messageSends: ["add:"]
  17289. }),
  17290. $globals.Queue);
  17291. $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
  17292. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  17293. $core.addMethod(
  17294. $core.method({
  17295. selector: "compile:",
  17296. protocol: 'evaluating',
  17297. fn: function (aString){
  17298. var self=this;
  17299. return $core.withContext(function($ctx1) {
  17300. return self.compile(aString);
  17301. return self;
  17302. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  17303. },
  17304. args: ["aString"],
  17305. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  17306. referencedClasses: [],
  17307. messageSends: []
  17308. }),
  17309. $globals.RegularExpression);
  17310. $core.addMethod(
  17311. $core.method({
  17312. selector: "exec:",
  17313. protocol: 'evaluating',
  17314. fn: function (aString){
  17315. var self=this;
  17316. return $core.withContext(function($ctx1) {
  17317. return self.exec(aString) || nil;
  17318. return self;
  17319. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  17320. },
  17321. args: ["aString"],
  17322. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  17323. referencedClasses: [],
  17324. messageSends: []
  17325. }),
  17326. $globals.RegularExpression);
  17327. $core.addMethod(
  17328. $core.method({
  17329. selector: "test:",
  17330. protocol: 'evaluating',
  17331. fn: function (aString){
  17332. var self=this;
  17333. return $core.withContext(function($ctx1) {
  17334. return self.test(aString);
  17335. return self;
  17336. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  17337. },
  17338. args: ["aString"],
  17339. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  17340. referencedClasses: [],
  17341. messageSends: []
  17342. }),
  17343. $globals.RegularExpression);
  17344. $core.addMethod(
  17345. $core.method({
  17346. selector: "fromString:",
  17347. protocol: 'instance creation',
  17348. fn: function (aString){
  17349. var self=this;
  17350. return $core.withContext(function($ctx1) {
  17351. return self._fromString_flag_(aString,"");
  17352. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  17353. },
  17354. args: ["aString"],
  17355. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  17356. referencedClasses: [],
  17357. messageSends: ["fromString:flag:"]
  17358. }),
  17359. $globals.RegularExpression.klass);
  17360. $core.addMethod(
  17361. $core.method({
  17362. selector: "fromString:flag:",
  17363. protocol: 'instance creation',
  17364. fn: function (aString,anotherString){
  17365. var self=this;
  17366. return $core.withContext(function($ctx1) {
  17367. return new RegExp(aString, anotherString);
  17368. return self;
  17369. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  17370. },
  17371. args: ["aString", "anotherString"],
  17372. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  17373. referencedClasses: [],
  17374. messageSends: []
  17375. }),
  17376. $globals.RegularExpression.klass);
  17377. });
  17378. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17379. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  17380. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17381. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  17382. $core.addPackage('Kernel-Dag');
  17383. $core.packages["Kernel-Dag"].innerEval = function (expr) { return eval(expr); };
  17384. $core.packages["Kernel-Dag"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17385. $core.addClass('AbstractDagVisitor', $globals.Object, [], 'Kernel-Dag');
  17386. $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:`.";
  17387. $core.addMethod(
  17388. $core.method({
  17389. selector: "visit:",
  17390. protocol: 'visiting',
  17391. fn: function (aNode){
  17392. var self=this;
  17393. return $core.withContext(function($ctx1) {
  17394. return $recv(aNode)._acceptDagVisitor_(self);
  17395. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  17396. },
  17397. args: ["aNode"],
  17398. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  17399. referencedClasses: [],
  17400. messageSends: ["acceptDagVisitor:"]
  17401. }),
  17402. $globals.AbstractDagVisitor);
  17403. $core.addMethod(
  17404. $core.method({
  17405. selector: "visitAll:",
  17406. protocol: 'visiting',
  17407. fn: function (aCollection){
  17408. var self=this;
  17409. return $core.withContext(function($ctx1) {
  17410. return $recv(aCollection)._collect_((function(each){
  17411. return $core.withContext(function($ctx2) {
  17412. return self._visit_(each);
  17413. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17414. }));
  17415. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  17416. },
  17417. args: ["aCollection"],
  17418. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  17419. referencedClasses: [],
  17420. messageSends: ["collect:", "visit:"]
  17421. }),
  17422. $globals.AbstractDagVisitor);
  17423. $core.addMethod(
  17424. $core.method({
  17425. selector: "visitAllChildren:",
  17426. protocol: 'visiting',
  17427. fn: function (aDagNode){
  17428. var self=this;
  17429. return $core.withContext(function($ctx1) {
  17430. return self._visitAll_($recv(aDagNode)._dagChildren());
  17431. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  17432. },
  17433. args: ["aDagNode"],
  17434. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  17435. referencedClasses: [],
  17436. messageSends: ["visitAll:", "dagChildren"]
  17437. }),
  17438. $globals.AbstractDagVisitor);
  17439. $core.addMethod(
  17440. $core.method({
  17441. selector: "visitDagNode:",
  17442. protocol: 'visiting',
  17443. fn: function (aNode){
  17444. var self=this;
  17445. return $core.withContext(function($ctx1) {
  17446. self._subclassResponsibility();
  17447. return self;
  17448. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  17449. },
  17450. args: ["aNode"],
  17451. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  17452. referencedClasses: [],
  17453. messageSends: ["subclassResponsibility"]
  17454. }),
  17455. $globals.AbstractDagVisitor);
  17456. $core.addMethod(
  17457. $core.method({
  17458. selector: "visitDagNodeVariantRedux:",
  17459. protocol: 'visiting',
  17460. fn: function (aNode){
  17461. var self=this;
  17462. var newChildren,oldChildren;
  17463. return $core.withContext(function($ctx1) {
  17464. var $2,$3,$1,$4,$5;
  17465. var $early={};
  17466. try {
  17467. oldChildren=$recv(aNode)._dagChildren();
  17468. newChildren=self._visitAllChildren_(aNode);
  17469. $2=$recv(oldChildren)._size();
  17470. $ctx1.sendIdx["size"]=1;
  17471. $3=$recv(newChildren)._size();
  17472. $ctx1.sendIdx["size"]=2;
  17473. $1=$recv($2).__eq($3);
  17474. if($core.assert($1)){
  17475. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  17476. return $core.withContext(function($ctx2) {
  17477. $4=$recv(oldChildren)._at_(i);
  17478. $ctx2.sendIdx["at:"]=1;
  17479. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  17480. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  17481. }),(function(){
  17482. throw $early=[aNode];
  17483. }));
  17484. };
  17485. $5=$recv(aNode)._copy();
  17486. $recv($5)._dagChildren_(newChildren);
  17487. return $recv($5)._yourself();
  17488. }
  17489. catch(e) {if(e===$early)return e[0]; throw e}
  17490. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  17491. },
  17492. args: ["aNode"],
  17493. 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",
  17494. referencedClasses: [],
  17495. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  17496. }),
  17497. $globals.AbstractDagVisitor);
  17498. $core.addMethod(
  17499. $core.method({
  17500. selector: "visitDagNodeVariantSimple:",
  17501. protocol: 'visiting',
  17502. fn: function (aNode){
  17503. var self=this;
  17504. return $core.withContext(function($ctx1) {
  17505. self._visitAllChildren_(aNode);
  17506. return aNode;
  17507. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  17508. },
  17509. args: ["aNode"],
  17510. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  17511. referencedClasses: [],
  17512. messageSends: ["visitAllChildren:"]
  17513. }),
  17514. $globals.AbstractDagVisitor);
  17515. $core.addClass('PathDagVisitor', $globals.AbstractDagVisitor, ['path'], 'Kernel-Dag');
  17516. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  17517. $core.addMethod(
  17518. $core.method({
  17519. selector: "initialize",
  17520. protocol: 'initialization',
  17521. fn: function (){
  17522. var self=this;
  17523. return $core.withContext(function($ctx1) {
  17524. (
  17525. $ctx1.supercall = true,
  17526. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  17527. $ctx1.supercall = false;
  17528. self["@path"]=[];
  17529. return self;
  17530. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  17531. },
  17532. args: [],
  17533. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  17534. referencedClasses: [],
  17535. messageSends: ["initialize"]
  17536. }),
  17537. $globals.PathDagVisitor);
  17538. $core.addMethod(
  17539. $core.method({
  17540. selector: "path",
  17541. protocol: 'accessing',
  17542. fn: function (){
  17543. var self=this;
  17544. return self["@path"];
  17545. },
  17546. args: [],
  17547. source: "path\x0a\x09^ path",
  17548. referencedClasses: [],
  17549. messageSends: []
  17550. }),
  17551. $globals.PathDagVisitor);
  17552. $core.addMethod(
  17553. $core.method({
  17554. selector: "visit:",
  17555. protocol: 'visiting',
  17556. fn: function (aNode){
  17557. var self=this;
  17558. var oldPath,result;
  17559. return $core.withContext(function($ctx1) {
  17560. result=aNode;
  17561. oldPath=self["@path"];
  17562. $recv((function(){
  17563. return $core.withContext(function($ctx2) {
  17564. self["@path"]=$recv(self["@path"]).__comma([aNode]);
  17565. self["@path"];
  17566. result=(
  17567. $ctx2.supercall = true,
  17568. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($recv(self), [aNode]));
  17569. $ctx2.supercall = false;
  17570. return result;
  17571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17572. }))._ensure_((function(){
  17573. self["@path"]=oldPath;
  17574. return self["@path"];
  17575. }));
  17576. return result;
  17577. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  17578. },
  17579. args: ["aNode"],
  17580. 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",
  17581. referencedClasses: [],
  17582. messageSends: ["ensure:", ",", "visit:"]
  17583. }),
  17584. $globals.PathDagVisitor);
  17585. $core.addMethod(
  17586. $core.method({
  17587. selector: "visitDagNodeVariantRedux:",
  17588. protocol: 'visiting',
  17589. fn: function (aNode){
  17590. var self=this;
  17591. var newNode;
  17592. return $core.withContext(function($ctx1) {
  17593. var $1;
  17594. newNode=(
  17595. $ctx1.supercall = true,
  17596. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($recv(self), [aNode]));
  17597. $ctx1.supercall = false;
  17598. $1=$recv(aNode).__eq_eq(newNode);
  17599. if(!$core.assert($1)){
  17600. $recv(self["@path"])._at_put_($recv(self["@path"])._size(),newNode);
  17601. };
  17602. return newNode;
  17603. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  17604. },
  17605. args: ["aNode"],
  17606. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  17607. referencedClasses: [],
  17608. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  17609. }),
  17610. $globals.PathDagVisitor);
  17611. $core.addClass('DagNode', $globals.Object, [], 'Kernel-Dag');
  17612. $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).";
  17613. $core.addMethod(
  17614. $core.method({
  17615. selector: "acceptDagVisitor:",
  17616. protocol: 'visiting',
  17617. fn: function (aVisitor){
  17618. var self=this;
  17619. return $core.withContext(function($ctx1) {
  17620. return $recv(aVisitor)._visitDagNode_(self);
  17621. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  17622. },
  17623. args: ["aVisitor"],
  17624. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  17625. referencedClasses: [],
  17626. messageSends: ["visitDagNode:"]
  17627. }),
  17628. $globals.DagNode);
  17629. $core.addMethod(
  17630. $core.method({
  17631. selector: "allDagChildren",
  17632. protocol: 'accessing',
  17633. fn: function (){
  17634. var self=this;
  17635. var allNodes;
  17636. return $core.withContext(function($ctx1) {
  17637. var $1;
  17638. $1=self._dagChildren();
  17639. $ctx1.sendIdx["dagChildren"]=1;
  17640. allNodes=$recv($1)._asSet();
  17641. $recv(self._dagChildren())._do_((function(each){
  17642. return $core.withContext(function($ctx2) {
  17643. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  17644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17645. }));
  17646. return allNodes;
  17647. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  17648. },
  17649. args: [],
  17650. 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",
  17651. referencedClasses: [],
  17652. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  17653. }),
  17654. $globals.DagNode);
  17655. $core.addMethod(
  17656. $core.method({
  17657. selector: "dagChildren",
  17658. protocol: 'accessing',
  17659. fn: function (){
  17660. var self=this;
  17661. return $core.withContext(function($ctx1) {
  17662. self._subclassResponsibility();
  17663. return self;
  17664. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  17665. },
  17666. args: [],
  17667. source: "dagChildren\x0a\x09self subclassResponsibility",
  17668. referencedClasses: [],
  17669. messageSends: ["subclassResponsibility"]
  17670. }),
  17671. $globals.DagNode);
  17672. $core.addMethod(
  17673. $core.method({
  17674. selector: "dagChildren:",
  17675. protocol: 'accessing',
  17676. fn: function (aCollection){
  17677. var self=this;
  17678. return $core.withContext(function($ctx1) {
  17679. self._subclassResponsibility();
  17680. return self;
  17681. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  17682. },
  17683. args: ["aCollection"],
  17684. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  17685. referencedClasses: [],
  17686. messageSends: ["subclassResponsibility"]
  17687. }),
  17688. $globals.DagNode);
  17689. $core.addMethod(
  17690. $core.method({
  17691. selector: "isDagNode",
  17692. protocol: 'testing',
  17693. fn: function (){
  17694. var self=this;
  17695. return true;
  17696. },
  17697. args: [],
  17698. source: "isDagNode\x0a\x09^ true",
  17699. referencedClasses: [],
  17700. messageSends: []
  17701. }),
  17702. $globals.DagNode);
  17703. $core.addClass('DagParentNode', $globals.DagNode, ['nodes'], 'Kernel-Dag');
  17704. $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.";
  17705. $core.addMethod(
  17706. $core.method({
  17707. selector: "addDagChild:",
  17708. protocol: 'accessing',
  17709. fn: function (aDagNode){
  17710. var self=this;
  17711. return $core.withContext(function($ctx1) {
  17712. $recv(self._dagChildren())._add_(aDagNode);
  17713. return self;
  17714. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  17715. },
  17716. args: ["aDagNode"],
  17717. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  17718. referencedClasses: [],
  17719. messageSends: ["add:", "dagChildren"]
  17720. }),
  17721. $globals.DagParentNode);
  17722. $core.addMethod(
  17723. $core.method({
  17724. selector: "dagChildren",
  17725. protocol: 'accessing',
  17726. fn: function (){
  17727. var self=this;
  17728. return $core.withContext(function($ctx1) {
  17729. var $1,$receiver;
  17730. $1=self["@nodes"];
  17731. if(($receiver = $1) == null || $receiver.isNil){
  17732. self["@nodes"]=$recv($globals.Array)._new();
  17733. return self["@nodes"];
  17734. } else {
  17735. return $1;
  17736. };
  17737. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  17738. },
  17739. args: [],
  17740. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  17741. referencedClasses: ["Array"],
  17742. messageSends: ["ifNil:", "new"]
  17743. }),
  17744. $globals.DagParentNode);
  17745. $core.addMethod(
  17746. $core.method({
  17747. selector: "dagChildren:",
  17748. protocol: 'accessing',
  17749. fn: function (aCollection){
  17750. var self=this;
  17751. self["@nodes"]=aCollection;
  17752. return self;
  17753. },
  17754. args: ["aCollection"],
  17755. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  17756. referencedClasses: [],
  17757. messageSends: []
  17758. }),
  17759. $globals.DagParentNode);
  17760. $core.addClass('DagSink', $globals.DagNode, ['nodes'], 'Kernel-Dag');
  17761. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  17762. $core.addMethod(
  17763. $core.method({
  17764. selector: "dagChildren",
  17765. protocol: 'accessing',
  17766. fn: function (){
  17767. var self=this;
  17768. return [];
  17769. },
  17770. args: [],
  17771. source: "dagChildren\x0a\x09^ #()",
  17772. referencedClasses: [],
  17773. messageSends: []
  17774. }),
  17775. $globals.DagSink);
  17776. $core.addMethod(
  17777. $core.method({
  17778. selector: "dagChildren:",
  17779. protocol: 'accessing',
  17780. fn: function (aCollection){
  17781. var self=this;
  17782. return $core.withContext(function($ctx1) {
  17783. $recv(aCollection)._ifNotEmpty_((function(){
  17784. return $core.withContext(function($ctx2) {
  17785. return self._error_("A DagSink cannot have children.");
  17786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17787. }));
  17788. return self;
  17789. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  17790. },
  17791. args: ["aCollection"],
  17792. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  17793. referencedClasses: [],
  17794. messageSends: ["ifNotEmpty:", "error:"]
  17795. }),
  17796. $globals.DagSink);
  17797. $core.addMethod(
  17798. $core.method({
  17799. selector: "isDagNode",
  17800. protocol: '*Kernel-Dag',
  17801. fn: function (){
  17802. var self=this;
  17803. return false;
  17804. },
  17805. args: [],
  17806. source: "isDagNode\x0a\x09^ false",
  17807. referencedClasses: [],
  17808. messageSends: []
  17809. }),
  17810. $globals.Object);
  17811. });
  17812. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17813. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  17814. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17815. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  17816. $core.addPackage('Kernel-Exceptions');
  17817. $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  17818. $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17819. $core.addClass('Error', $globals.Object, ['messageText'], 'Kernel-Exceptions');
  17820. $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.";
  17821. $core.addMethod(
  17822. $core.method({
  17823. selector: "beHandled",
  17824. protocol: 'accessing',
  17825. fn: function (){
  17826. var self=this;
  17827. return $core.withContext(function($ctx1) {
  17828. self.amberHandled = true;
  17829. return self;
  17830. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  17831. },
  17832. args: [],
  17833. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  17834. referencedClasses: [],
  17835. messageSends: []
  17836. }),
  17837. $globals.Error);
  17838. $core.addMethod(
  17839. $core.method({
  17840. selector: "beUnhandled",
  17841. protocol: 'accessing',
  17842. fn: function (){
  17843. var self=this;
  17844. return $core.withContext(function($ctx1) {
  17845. self.amberHandled = false;
  17846. return self;
  17847. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  17848. },
  17849. args: [],
  17850. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  17851. referencedClasses: [],
  17852. messageSends: []
  17853. }),
  17854. $globals.Error);
  17855. $core.addMethod(
  17856. $core.method({
  17857. selector: "context",
  17858. protocol: 'accessing',
  17859. fn: function (){
  17860. var self=this;
  17861. return $core.withContext(function($ctx1) {
  17862. return self.context;
  17863. return self;
  17864. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  17865. },
  17866. args: [],
  17867. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  17868. referencedClasses: [],
  17869. messageSends: []
  17870. }),
  17871. $globals.Error);
  17872. $core.addMethod(
  17873. $core.method({
  17874. selector: "initialize",
  17875. protocol: 'initialization',
  17876. fn: function (){
  17877. var self=this;
  17878. return $core.withContext(function($ctx1) {
  17879. self._messageText_("Errorclass: ".__comma($recv(self._class())._name()));
  17880. return self;
  17881. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  17882. },
  17883. args: [],
  17884. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  17885. referencedClasses: [],
  17886. messageSends: ["messageText:", ",", "name", "class"]
  17887. }),
  17888. $globals.Error);
  17889. $core.addMethod(
  17890. $core.method({
  17891. selector: "isSmalltalkError",
  17892. protocol: 'testing',
  17893. fn: function (){
  17894. var self=this;
  17895. return $core.withContext(function($ctx1) {
  17896. return self.smalltalkError === true;
  17897. return self;
  17898. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  17899. },
  17900. args: [],
  17901. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  17902. referencedClasses: [],
  17903. messageSends: []
  17904. }),
  17905. $globals.Error);
  17906. $core.addMethod(
  17907. $core.method({
  17908. selector: "jsStack",
  17909. protocol: 'accessing',
  17910. fn: function (){
  17911. var self=this;
  17912. return $core.withContext(function($ctx1) {
  17913. return self.stack;
  17914. return self;
  17915. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  17916. },
  17917. args: [],
  17918. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  17919. referencedClasses: [],
  17920. messageSends: []
  17921. }),
  17922. $globals.Error);
  17923. $core.addMethod(
  17924. $core.method({
  17925. selector: "messageText",
  17926. protocol: 'accessing',
  17927. fn: function (){
  17928. var self=this;
  17929. return self["@messageText"];
  17930. },
  17931. args: [],
  17932. source: "messageText\x0a\x09^ messageText",
  17933. referencedClasses: [],
  17934. messageSends: []
  17935. }),
  17936. $globals.Error);
  17937. $core.addMethod(
  17938. $core.method({
  17939. selector: "messageText:",
  17940. protocol: 'accessing',
  17941. fn: function (aString){
  17942. var self=this;
  17943. self["@messageText"]=aString;
  17944. return self;
  17945. },
  17946. args: ["aString"],
  17947. source: "messageText: aString\x0a\x09messageText := aString",
  17948. referencedClasses: [],
  17949. messageSends: []
  17950. }),
  17951. $globals.Error);
  17952. $core.addMethod(
  17953. $core.method({
  17954. selector: "resignal",
  17955. protocol: 'signaling',
  17956. fn: function (){
  17957. var self=this;
  17958. return $core.withContext(function($ctx1) {
  17959. self.amberHandled = false;
  17960. throw(self);
  17961. ;
  17962. return self;
  17963. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  17964. },
  17965. args: [],
  17966. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09'>",
  17967. referencedClasses: [],
  17968. messageSends: []
  17969. }),
  17970. $globals.Error);
  17971. $core.addMethod(
  17972. $core.method({
  17973. selector: "signal",
  17974. protocol: 'signaling',
  17975. fn: function (){
  17976. var self=this;
  17977. return $core.withContext(function($ctx1) {
  17978. self.amberHandled = false;
  17979. self.context = $core.getThisContext();
  17980. self.smalltalkError = true;
  17981. throw self;
  17982. ;
  17983. return self;
  17984. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  17985. },
  17986. args: [],
  17987. source: "signal\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09self.context = $core.getThisContext(); \x0a\x09\x09self.smalltalkError = true;\x0a\x09\x09throw self;\x0a\x09'>",
  17988. referencedClasses: [],
  17989. messageSends: []
  17990. }),
  17991. $globals.Error);
  17992. $core.addMethod(
  17993. $core.method({
  17994. selector: "signal:",
  17995. protocol: 'signaling',
  17996. fn: function (aString){
  17997. var self=this;
  17998. return $core.withContext(function($ctx1) {
  17999. self._messageText_(aString);
  18000. self._signal();
  18001. return self;
  18002. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  18003. },
  18004. args: ["aString"],
  18005. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  18006. referencedClasses: [],
  18007. messageSends: ["messageText:", "signal"]
  18008. }),
  18009. $globals.Error);
  18010. $core.addMethod(
  18011. $core.method({
  18012. selector: "signalerContext",
  18013. protocol: 'accessing',
  18014. fn: function (){
  18015. var self=this;
  18016. return $core.withContext(function($ctx1) {
  18017. return self._signalerContextFrom_(self._context());
  18018. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  18019. },
  18020. args: [],
  18021. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  18022. referencedClasses: [],
  18023. messageSends: ["signalerContextFrom:", "context"]
  18024. }),
  18025. $globals.Error);
  18026. $core.addMethod(
  18027. $core.method({
  18028. selector: "signalerContextFrom:",
  18029. protocol: 'accessing',
  18030. fn: function (aContext){
  18031. var self=this;
  18032. return $core.withContext(function($ctx1) {
  18033. var $3,$2,$1;
  18034. return $recv(aContext)._findContextSuchThat_((function(context){
  18035. return $core.withContext(function($ctx2) {
  18036. $3=$recv(context)._receiver();
  18037. $ctx2.sendIdx["receiver"]=1;
  18038. $2=$recv($3).__eq_eq(self);
  18039. $ctx2.sendIdx["=="]=1;
  18040. $1=$recv($2)._or_((function(){
  18041. return $core.withContext(function($ctx3) {
  18042. return $recv($recv(context)._receiver()).__eq_eq(self._class());
  18043. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  18044. }));
  18045. return $recv($1)._not();
  18046. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  18047. }));
  18048. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  18049. },
  18050. args: ["aContext"],
  18051. source: "signalerContextFrom: aContext\x0a\x09\x22Find the first sender of signal(:), the first context which is neither \x0a\x09for an instance method nor for a class side method of Exception (or subclass).\x0a\x09This will make sure that the same context is found for both, `Error signal` \x0a\x09and `Error new signal`\x22\x0a\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ context receiver == self class ]) not ]",
  18052. referencedClasses: [],
  18053. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  18054. }),
  18055. $globals.Error);
  18056. $core.addMethod(
  18057. $core.method({
  18058. selector: "wasHandled",
  18059. protocol: 'testing',
  18060. fn: function (){
  18061. var self=this;
  18062. return $core.withContext(function($ctx1) {
  18063. return self.amberHandled || false;
  18064. return self;
  18065. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  18066. },
  18067. args: [],
  18068. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  18069. referencedClasses: [],
  18070. messageSends: []
  18071. }),
  18072. $globals.Error);
  18073. $core.addMethod(
  18074. $core.method({
  18075. selector: "classTag",
  18076. protocol: 'accessing',
  18077. fn: function (){
  18078. var self=this;
  18079. return "exception";
  18080. },
  18081. args: [],
  18082. 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'",
  18083. referencedClasses: [],
  18084. messageSends: []
  18085. }),
  18086. $globals.Error.klass);
  18087. $core.addMethod(
  18088. $core.method({
  18089. selector: "signal",
  18090. protocol: 'instance creation',
  18091. fn: function (){
  18092. var self=this;
  18093. return $core.withContext(function($ctx1) {
  18094. return $recv(self._new())._signal();
  18095. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.klass)});
  18096. },
  18097. args: [],
  18098. source: "signal\x0a\x09^ self new signal",
  18099. referencedClasses: [],
  18100. messageSends: ["signal", "new"]
  18101. }),
  18102. $globals.Error.klass);
  18103. $core.addMethod(
  18104. $core.method({
  18105. selector: "signal:",
  18106. protocol: 'instance creation',
  18107. fn: function (aString){
  18108. var self=this;
  18109. return $core.withContext(function($ctx1) {
  18110. return $recv(self._new())._signal_(aString);
  18111. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.klass)});
  18112. },
  18113. args: ["aString"],
  18114. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  18115. referencedClasses: [],
  18116. messageSends: ["signal:", "new"]
  18117. }),
  18118. $globals.Error.klass);
  18119. $core.addClass('Halt', $globals.Error, [], 'Kernel-Exceptions');
  18120. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  18121. $core.addMethod(
  18122. $core.method({
  18123. selector: "messageText",
  18124. protocol: 'accessing',
  18125. fn: function (){
  18126. var self=this;
  18127. return "Halt encountered";
  18128. },
  18129. args: [],
  18130. source: "messageText\x0a\x09^ 'Halt encountered'",
  18131. referencedClasses: [],
  18132. messageSends: []
  18133. }),
  18134. $globals.Halt);
  18135. $core.addMethod(
  18136. $core.method({
  18137. selector: "signalerContextFrom:",
  18138. protocol: 'accessing',
  18139. fn: function (aContext){
  18140. var self=this;
  18141. return $core.withContext(function($ctx1) {
  18142. var $3,$2,$1;
  18143. return $recv(aContext)._findContextSuchThat_((function(context){
  18144. return $core.withContext(function($ctx2) {
  18145. $3=$recv(context)._receiver();
  18146. $ctx2.sendIdx["receiver"]=1;
  18147. $2=$recv($3).__eq_eq(self);
  18148. $ctx2.sendIdx["=="]=1;
  18149. $1=$recv($2)._or_((function(){
  18150. return $core.withContext(function($ctx3) {
  18151. return $recv($recv($recv(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  18152. return $core.withContext(function($ctx4) {
  18153. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  18154. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  18155. }));
  18156. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  18157. }));
  18158. $ctx2.sendIdx["or:"]=1;
  18159. return $recv($1)._not();
  18160. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  18161. }));
  18162. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  18163. },
  18164. args: ["aContext"],
  18165. source: "signalerContextFrom: aContext\x0a\x09\x22specialized version to find the proper context to open the debugger on.\x0a\x09This will find the first context whose method is no longer on `Halt` or \x0a\x09`Halt class` nor is `#halt` method itself.\x22\x0a\x09\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ (context receiver == self class) \x0a\x09\x09or: [ context method selector = #halt ]]) not ]",
  18166. referencedClasses: [],
  18167. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  18168. }),
  18169. $globals.Halt);
  18170. $core.addClass('JavaScriptException', $globals.Error, ['exception'], 'Kernel-Exceptions');
  18171. $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:`";
  18172. $core.addMethod(
  18173. $core.method({
  18174. selector: "context:",
  18175. protocol: 'accessing',
  18176. fn: function (aMethodContext){
  18177. var self=this;
  18178. return $core.withContext(function($ctx1) {
  18179. self.context = aMethodContext;
  18180. return self;
  18181. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  18182. },
  18183. args: ["aMethodContext"],
  18184. source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09<inlineJS: 'self.context = aMethodContext'>",
  18185. referencedClasses: [],
  18186. messageSends: []
  18187. }),
  18188. $globals.JavaScriptException);
  18189. $core.addMethod(
  18190. $core.method({
  18191. selector: "exception",
  18192. protocol: 'accessing',
  18193. fn: function (){
  18194. var self=this;
  18195. return self["@exception"];
  18196. },
  18197. args: [],
  18198. source: "exception\x0a\x09^ exception",
  18199. referencedClasses: [],
  18200. messageSends: []
  18201. }),
  18202. $globals.JavaScriptException);
  18203. $core.addMethod(
  18204. $core.method({
  18205. selector: "exception:",
  18206. protocol: 'accessing',
  18207. fn: function (anException){
  18208. var self=this;
  18209. self["@exception"]=anException;
  18210. return self;
  18211. },
  18212. args: ["anException"],
  18213. source: "exception: anException\x0a\x09exception := anException",
  18214. referencedClasses: [],
  18215. messageSends: []
  18216. }),
  18217. $globals.JavaScriptException);
  18218. $core.addMethod(
  18219. $core.method({
  18220. selector: "messageText",
  18221. protocol: 'accessing',
  18222. fn: function (){
  18223. var self=this;
  18224. return $core.withContext(function($ctx1) {
  18225. return "JavaScript exception: " + self["@exception"].toString();
  18226. return self;
  18227. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  18228. },
  18229. args: [],
  18230. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + self[\x22@exception\x22].toString()'>",
  18231. referencedClasses: [],
  18232. messageSends: []
  18233. }),
  18234. $globals.JavaScriptException);
  18235. $core.addMethod(
  18236. $core.method({
  18237. selector: "on:",
  18238. protocol: 'instance creation',
  18239. fn: function (anException){
  18240. var self=this;
  18241. return $core.withContext(function($ctx1) {
  18242. var $1;
  18243. $1=self._new();
  18244. $recv($1)._exception_(anException);
  18245. return $recv($1)._yourself();
  18246. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.klass)});
  18247. },
  18248. args: ["anException"],
  18249. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  18250. referencedClasses: [],
  18251. messageSends: ["exception:", "new", "yourself"]
  18252. }),
  18253. $globals.JavaScriptException.klass);
  18254. $core.addMethod(
  18255. $core.method({
  18256. selector: "on:context:",
  18257. protocol: 'instance creation',
  18258. fn: function (anException,aMethodContext){
  18259. var self=this;
  18260. return $core.withContext(function($ctx1) {
  18261. var $1;
  18262. $1=self._new();
  18263. $recv($1)._exception_(anException);
  18264. $recv($1)._context_(aMethodContext);
  18265. return $recv($1)._yourself();
  18266. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.klass)});
  18267. },
  18268. args: ["anException", "aMethodContext"],
  18269. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  18270. referencedClasses: [],
  18271. messageSends: ["exception:", "new", "context:", "yourself"]
  18272. }),
  18273. $globals.JavaScriptException.klass);
  18274. $core.addClass('MessageNotUnderstood', $globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  18275. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  18276. $core.addMethod(
  18277. $core.method({
  18278. selector: "message",
  18279. protocol: 'accessing',
  18280. fn: function (){
  18281. var self=this;
  18282. return self["@message"];
  18283. },
  18284. args: [],
  18285. source: "message\x0a\x09^ message",
  18286. referencedClasses: [],
  18287. messageSends: []
  18288. }),
  18289. $globals.MessageNotUnderstood);
  18290. $core.addMethod(
  18291. $core.method({
  18292. selector: "message:",
  18293. protocol: 'accessing',
  18294. fn: function (aMessage){
  18295. var self=this;
  18296. self["@message"]=aMessage;
  18297. return self;
  18298. },
  18299. args: ["aMessage"],
  18300. source: "message: aMessage\x0a\x09message := aMessage",
  18301. referencedClasses: [],
  18302. messageSends: []
  18303. }),
  18304. $globals.MessageNotUnderstood);
  18305. $core.addMethod(
  18306. $core.method({
  18307. selector: "messageText",
  18308. protocol: 'accessing',
  18309. fn: function (){
  18310. var self=this;
  18311. return $core.withContext(function($ctx1) {
  18312. var $1;
  18313. $1=$recv($recv($recv(self._receiver())._asString()).__comma(" does not understand #")).__comma($recv(self._message())._selector());
  18314. $ctx1.sendIdx[","]=1;
  18315. return $1;
  18316. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  18317. },
  18318. args: [],
  18319. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  18320. referencedClasses: [],
  18321. messageSends: [",", "asString", "receiver", "selector", "message"]
  18322. }),
  18323. $globals.MessageNotUnderstood);
  18324. $core.addMethod(
  18325. $core.method({
  18326. selector: "receiver",
  18327. protocol: 'accessing',
  18328. fn: function (){
  18329. var self=this;
  18330. return self["@receiver"];
  18331. },
  18332. args: [],
  18333. source: "receiver\x0a\x09^ receiver",
  18334. referencedClasses: [],
  18335. messageSends: []
  18336. }),
  18337. $globals.MessageNotUnderstood);
  18338. $core.addMethod(
  18339. $core.method({
  18340. selector: "receiver:",
  18341. protocol: 'accessing',
  18342. fn: function (anObject){
  18343. var self=this;
  18344. self["@receiver"]=anObject;
  18345. return self;
  18346. },
  18347. args: ["anObject"],
  18348. source: "receiver: anObject\x0a\x09receiver := anObject",
  18349. referencedClasses: [],
  18350. messageSends: []
  18351. }),
  18352. $globals.MessageNotUnderstood);
  18353. $core.addClass('NonBooleanReceiver', $globals.Error, ['object'], 'Kernel-Exceptions');
  18354. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  18355. $core.addMethod(
  18356. $core.method({
  18357. selector: "object",
  18358. protocol: 'accessing',
  18359. fn: function (){
  18360. var self=this;
  18361. return self["@object"];
  18362. },
  18363. args: [],
  18364. source: "object\x0a\x09^ object",
  18365. referencedClasses: [],
  18366. messageSends: []
  18367. }),
  18368. $globals.NonBooleanReceiver);
  18369. $core.addMethod(
  18370. $core.method({
  18371. selector: "object:",
  18372. protocol: 'accessing',
  18373. fn: function (anObject){
  18374. var self=this;
  18375. self["@object"]=anObject;
  18376. return self;
  18377. },
  18378. args: ["anObject"],
  18379. source: "object: anObject\x0a\x09object := anObject",
  18380. referencedClasses: [],
  18381. messageSends: []
  18382. }),
  18383. $globals.NonBooleanReceiver);
  18384. });
  18385. define('amber_core/Kernel-Infrastructure',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  18386. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  18387. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  18388. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  18389. $core.addPackage('Kernel-Infrastructure');
  18390. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  18391. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  18392. $core.addClass('JSObjectProxy', $globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  18393. $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`.";
  18394. $core.addMethod(
  18395. $core.method({
  18396. selector: "=",
  18397. protocol: 'comparing',
  18398. fn: function (anObject){
  18399. var self=this;
  18400. return $core.withContext(function($ctx1) {
  18401. var $2,$1;
  18402. $2=$recv(anObject)._class();
  18403. $ctx1.sendIdx["class"]=1;
  18404. $1=$recv($2).__eq_eq(self._class());
  18405. if(!$core.assert($1)){
  18406. return false;
  18407. };
  18408. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  18409. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  18410. },
  18411. args: ["anObject"],
  18412. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  18413. referencedClasses: ["JSObjectProxy"],
  18414. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  18415. }),
  18416. $globals.JSObjectProxy);
  18417. $core.addMethod(
  18418. $core.method({
  18419. selector: "asJSON",
  18420. protocol: 'enumerating',
  18421. fn: function (){
  18422. var self=this;
  18423. return self["@jsObject"];
  18424. },
  18425. args: [],
  18426. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  18427. referencedClasses: [],
  18428. messageSends: []
  18429. }),
  18430. $globals.JSObjectProxy);
  18431. $core.addMethod(
  18432. $core.method({
  18433. selector: "at:",
  18434. protocol: 'accessing',
  18435. fn: function (aString){
  18436. var self=this;
  18437. return $core.withContext(function($ctx1) {
  18438. return self['@jsObject'][aString];
  18439. return self;
  18440. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  18441. },
  18442. args: ["aString"],
  18443. source: "at: aString\x0a\x09<inlineJS: 'return self[''@jsObject''][aString]'>",
  18444. referencedClasses: [],
  18445. messageSends: []
  18446. }),
  18447. $globals.JSObjectProxy);
  18448. $core.addMethod(
  18449. $core.method({
  18450. selector: "at:ifAbsent:",
  18451. protocol: 'accessing',
  18452. fn: function (aString,aBlock){
  18453. var self=this;
  18454. return $core.withContext(function($ctx1) {
  18455. var obj = self['@jsObject'];
  18456. return aString in obj ? obj[aString] : aBlock._value();
  18457. ;
  18458. return self;
  18459. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  18460. },
  18461. args: ["aString", "aBlock"],
  18462. 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'>",
  18463. referencedClasses: [],
  18464. messageSends: []
  18465. }),
  18466. $globals.JSObjectProxy);
  18467. $core.addMethod(
  18468. $core.method({
  18469. selector: "at:ifPresent:",
  18470. protocol: 'accessing',
  18471. fn: function (aString,aBlock){
  18472. var self=this;
  18473. return $core.withContext(function($ctx1) {
  18474. var obj = self['@jsObject'];
  18475. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  18476. ;
  18477. return self;
  18478. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  18479. },
  18480. args: ["aString", "aBlock"],
  18481. 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'>",
  18482. referencedClasses: [],
  18483. messageSends: []
  18484. }),
  18485. $globals.JSObjectProxy);
  18486. $core.addMethod(
  18487. $core.method({
  18488. selector: "at:ifPresent:ifAbsent:",
  18489. protocol: 'accessing',
  18490. fn: function (aString,aBlock,anotherBlock){
  18491. var self=this;
  18492. return $core.withContext(function($ctx1) {
  18493. var obj = self['@jsObject'];
  18494. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  18495. ;
  18496. return self;
  18497. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  18498. },
  18499. args: ["aString", "aBlock", "anotherBlock"],
  18500. 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'>",
  18501. referencedClasses: [],
  18502. messageSends: []
  18503. }),
  18504. $globals.JSObjectProxy);
  18505. $core.addMethod(
  18506. $core.method({
  18507. selector: "at:put:",
  18508. protocol: 'accessing',
  18509. fn: function (aString,anObject){
  18510. var self=this;
  18511. return $core.withContext(function($ctx1) {
  18512. return self['@jsObject'][aString] = anObject;
  18513. return self;
  18514. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  18515. },
  18516. args: ["aString", "anObject"],
  18517. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return self[''@jsObject''][aString] = anObject'>",
  18518. referencedClasses: [],
  18519. messageSends: []
  18520. }),
  18521. $globals.JSObjectProxy);
  18522. $core.addMethod(
  18523. $core.method({
  18524. selector: "doesNotUnderstand:",
  18525. protocol: 'proxy',
  18526. fn: function (aMessage){
  18527. var self=this;
  18528. return $core.withContext(function($ctx1) {
  18529. var $1,$receiver;
  18530. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  18531. if(($receiver = $1) == null || $receiver.isNil){
  18532. return (
  18533. $ctx1.supercall = true,
  18534. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
  18535. $ctx1.supercall = false;
  18536. } else {
  18537. var jsSelector;
  18538. jsSelector=$receiver;
  18539. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  18540. };
  18541. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  18542. },
  18543. args: ["aMessage"],
  18544. 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 ]",
  18545. referencedClasses: ["JSObjectProxy"],
  18546. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  18547. }),
  18548. $globals.JSObjectProxy);
  18549. $core.addMethod(
  18550. $core.method({
  18551. selector: "in:",
  18552. protocol: 'accessing',
  18553. fn: function (aValuable){
  18554. var self=this;
  18555. return $core.withContext(function($ctx1) {
  18556. return $recv(aValuable)._value_(self["@jsObject"]);
  18557. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  18558. },
  18559. args: ["aValuable"],
  18560. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  18561. referencedClasses: [],
  18562. messageSends: ["value:"]
  18563. }),
  18564. $globals.JSObjectProxy);
  18565. $core.addMethod(
  18566. $core.method({
  18567. selector: "jsObject",
  18568. protocol: 'accessing',
  18569. fn: function (){
  18570. var self=this;
  18571. return self["@jsObject"];
  18572. },
  18573. args: [],
  18574. source: "jsObject\x0a\x09^ jsObject",
  18575. referencedClasses: [],
  18576. messageSends: []
  18577. }),
  18578. $globals.JSObjectProxy);
  18579. $core.addMethod(
  18580. $core.method({
  18581. selector: "keysAndValuesDo:",
  18582. protocol: 'enumerating',
  18583. fn: function (aBlock){
  18584. var self=this;
  18585. return $core.withContext(function($ctx1) {
  18586. var o = self['@jsObject'];
  18587. for(var i in o) {
  18588. aBlock._value_value_(i, o[i]);
  18589. }
  18590. ;
  18591. return self;
  18592. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  18593. },
  18594. args: ["aBlock"],
  18595. 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'>",
  18596. referencedClasses: [],
  18597. messageSends: []
  18598. }),
  18599. $globals.JSObjectProxy);
  18600. $core.addMethod(
  18601. $core.method({
  18602. selector: "printOn:",
  18603. protocol: 'printing',
  18604. fn: function (aStream){
  18605. var self=this;
  18606. return $core.withContext(function($ctx1) {
  18607. $recv(aStream)._nextPutAll_(self._printString());
  18608. return self;
  18609. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  18610. },
  18611. args: ["aStream"],
  18612. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  18613. referencedClasses: [],
  18614. messageSends: ["nextPutAll:", "printString"]
  18615. }),
  18616. $globals.JSObjectProxy);
  18617. $core.addMethod(
  18618. $core.method({
  18619. selector: "printString",
  18620. protocol: 'printing',
  18621. fn: function (){
  18622. var self=this;
  18623. return $core.withContext(function($ctx1) {
  18624. var js = self['@jsObject'];
  18625. return js.toString
  18626. ? js.toString()
  18627. : Object.prototype.toString.call(js)
  18628. ;
  18629. return self;
  18630. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  18631. },
  18632. args: [],
  18633. 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'>",
  18634. referencedClasses: [],
  18635. messageSends: []
  18636. }),
  18637. $globals.JSObjectProxy);
  18638. $core.addMethod(
  18639. $core.method({
  18640. selector: "putOn:",
  18641. protocol: 'streaming',
  18642. fn: function (aStream){
  18643. var self=this;
  18644. return $core.withContext(function($ctx1) {
  18645. $recv(aStream)._nextPutJSObject_(self["@jsObject"]);
  18646. return self;
  18647. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  18648. },
  18649. args: ["aStream"],
  18650. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  18651. referencedClasses: [],
  18652. messageSends: ["nextPutJSObject:"]
  18653. }),
  18654. $globals.JSObjectProxy);
  18655. $core.addMethod(
  18656. $core.method({
  18657. selector: "addObjectVariablesTo:ofProxy:",
  18658. protocol: 'proxy',
  18659. fn: function (aDictionary,aProxy){
  18660. var self=this;
  18661. return $core.withContext(function($ctx1) {
  18662. var jsObject = aProxy['@jsObject'];
  18663. for(var i in jsObject) {
  18664. aDictionary._at_put_(i, jsObject[i]);
  18665. }
  18666. ;
  18667. return self;
  18668. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18669. },
  18670. args: ["aDictionary", "aProxy"],
  18671. 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'>",
  18672. referencedClasses: [],
  18673. messageSends: []
  18674. }),
  18675. $globals.JSObjectProxy.klass);
  18676. $core.addMethod(
  18677. $core.method({
  18678. selector: "compareJSObjectOfProxy:withProxy:",
  18679. protocol: 'proxy',
  18680. fn: function (aProxy,anotherProxy){
  18681. var self=this;
  18682. return $core.withContext(function($ctx1) {
  18683. var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy;
  18684. return aProxy["@jsObject"] === anotherJSObject;
  18685. return self;
  18686. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)});
  18687. },
  18688. args: ["aProxy", "anotherProxy"],
  18689. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<inlineJS: '\x0a\x09var anotherJSObject = anotherProxy.klass ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a'>",
  18690. referencedClasses: [],
  18691. messageSends: []
  18692. }),
  18693. $globals.JSObjectProxy.klass);
  18694. $core.addMethod(
  18695. $core.method({
  18696. selector: "forwardMessage:withArguments:ofProxy:",
  18697. protocol: 'proxy',
  18698. fn: function (aString,anArray,aProxy){
  18699. var self=this;
  18700. return $core.withContext(function($ctx1) {
  18701. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  18702. ;
  18703. return self;
  18704. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18705. },
  18706. args: ["aString", "anArray", "aProxy"],
  18707. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  18708. referencedClasses: [],
  18709. messageSends: []
  18710. }),
  18711. $globals.JSObjectProxy.klass);
  18712. $core.addMethod(
  18713. $core.method({
  18714. selector: "jsObject:ofProxy:",
  18715. protocol: 'proxy',
  18716. fn: function (aJSObject,aProxy){
  18717. var self=this;
  18718. return $core.withContext(function($ctx1) {
  18719. aProxy['@jsObject'] = aJSObject;
  18720. return self;
  18721. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18722. },
  18723. args: ["aJSObject", "aProxy"],
  18724. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  18725. referencedClasses: [],
  18726. messageSends: []
  18727. }),
  18728. $globals.JSObjectProxy.klass);
  18729. $core.addMethod(
  18730. $core.method({
  18731. selector: "lookupProperty:ofProxy:",
  18732. protocol: 'proxy',
  18733. fn: function (aString,aProxy){
  18734. var self=this;
  18735. return $core.withContext(function($ctx1) {
  18736. return aString in aProxy._jsObject() ? aString : nil;
  18737. return self;
  18738. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18739. },
  18740. args: ["aString", "aProxy"],
  18741. 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'>",
  18742. referencedClasses: [],
  18743. messageSends: []
  18744. }),
  18745. $globals.JSObjectProxy.klass);
  18746. $core.addMethod(
  18747. $core.method({
  18748. selector: "on:",
  18749. protocol: 'instance creation',
  18750. fn: function (aJSObject){
  18751. var self=this;
  18752. var instance;
  18753. return $core.withContext(function($ctx1) {
  18754. instance=self._new();
  18755. self._jsObject_ofProxy_(aJSObject,instance);
  18756. return instance;
  18757. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)});
  18758. },
  18759. args: ["aJSObject"],
  18760. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  18761. referencedClasses: [],
  18762. messageSends: ["new", "jsObject:ofProxy:"]
  18763. }),
  18764. $globals.JSObjectProxy.klass);
  18765. $core.addClass('Organizer', $globals.Object, [], 'Kernel-Infrastructure');
  18766. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  18767. $core.addMethod(
  18768. $core.method({
  18769. selector: "addElement:",
  18770. protocol: 'accessing',
  18771. fn: function (anObject){
  18772. var self=this;
  18773. return $core.withContext(function($ctx1) {
  18774. self.elements.addElement(anObject);
  18775. return self;
  18776. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  18777. },
  18778. args: ["anObject"],
  18779. source: "addElement: anObject\x0a\x09<inlineJS: 'self.elements.addElement(anObject)'>",
  18780. referencedClasses: [],
  18781. messageSends: []
  18782. }),
  18783. $globals.Organizer);
  18784. $core.addMethod(
  18785. $core.method({
  18786. selector: "elements",
  18787. protocol: 'accessing',
  18788. fn: function (){
  18789. var self=this;
  18790. return $core.withContext(function($ctx1) {
  18791. return $recv(self._basicAt_("elements"))._copy();
  18792. }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
  18793. },
  18794. args: [],
  18795. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  18796. referencedClasses: [],
  18797. messageSends: ["copy", "basicAt:"]
  18798. }),
  18799. $globals.Organizer);
  18800. $core.addMethod(
  18801. $core.method({
  18802. selector: "removeElement:",
  18803. protocol: 'accessing',
  18804. fn: function (anObject){
  18805. var self=this;
  18806. return $core.withContext(function($ctx1) {
  18807. self.elements.removeElement(anObject);
  18808. return self;
  18809. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  18810. },
  18811. args: ["anObject"],
  18812. source: "removeElement: anObject\x0a\x09<inlineJS: 'self.elements.removeElement(anObject)'>",
  18813. referencedClasses: [],
  18814. messageSends: []
  18815. }),
  18816. $globals.Organizer);
  18817. $core.addClass('ClassOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  18818. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  18819. $core.addMethod(
  18820. $core.method({
  18821. selector: "addElement:",
  18822. protocol: 'accessing',
  18823. fn: function (aString){
  18824. var self=this;
  18825. return $core.withContext(function($ctx1) {
  18826. var $1,$3,$2;
  18827. (
  18828. $ctx1.supercall = true,
  18829. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($recv(self), [aString]));
  18830. $ctx1.supercall = false;
  18831. $1=$recv($globals.SystemAnnouncer)._current();
  18832. $3=$recv($globals.ProtocolAdded)._new();
  18833. $recv($3)._protocol_(aString);
  18834. $recv($3)._theClass_(self._theClass());
  18835. $2=$recv($3)._yourself();
  18836. $recv($1)._announce_($2);
  18837. return self;
  18838. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  18839. },
  18840. args: ["aString"],
  18841. 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)",
  18842. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  18843. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  18844. }),
  18845. $globals.ClassOrganizer);
  18846. $core.addMethod(
  18847. $core.method({
  18848. selector: "removeElement:",
  18849. protocol: 'accessing',
  18850. fn: function (aString){
  18851. var self=this;
  18852. return $core.withContext(function($ctx1) {
  18853. var $1,$3,$2;
  18854. (
  18855. $ctx1.supercall = true,
  18856. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($recv(self), [aString]));
  18857. $ctx1.supercall = false;
  18858. $1=$recv($globals.SystemAnnouncer)._current();
  18859. $3=$recv($globals.ProtocolRemoved)._new();
  18860. $recv($3)._protocol_(aString);
  18861. $recv($3)._theClass_(self._theClass());
  18862. $2=$recv($3)._yourself();
  18863. $recv($1)._announce_($2);
  18864. return self;
  18865. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  18866. },
  18867. args: ["aString"],
  18868. 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)",
  18869. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  18870. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  18871. }),
  18872. $globals.ClassOrganizer);
  18873. $core.addMethod(
  18874. $core.method({
  18875. selector: "theClass",
  18876. protocol: 'accessing',
  18877. fn: function (){
  18878. var self=this;
  18879. return $core.withContext(function($ctx1) {
  18880. return self.theClass;
  18881. return self;
  18882. }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
  18883. },
  18884. args: [],
  18885. source: "theClass\x0a\x09<inlineJS: 'return self.theClass'>",
  18886. referencedClasses: [],
  18887. messageSends: []
  18888. }),
  18889. $globals.ClassOrganizer);
  18890. $core.addClass('PackageOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  18891. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  18892. $core.addClass('Package', $globals.Object, ['transport', 'imports', 'dirty'], 'Kernel-Infrastructure');
  18893. $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'";
  18894. $core.addMethod(
  18895. $core.method({
  18896. selector: "basicImports",
  18897. protocol: 'private',
  18898. fn: function (){
  18899. var self=this;
  18900. return $core.withContext(function($ctx1) {
  18901. return self.imports || [];
  18902. return self;
  18903. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  18904. },
  18905. args: [],
  18906. source: "basicImports\x0a\x09\x22Answer the imports literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<inlineJS: 'return self.imports || []'>",
  18907. referencedClasses: [],
  18908. messageSends: []
  18909. }),
  18910. $globals.Package);
  18911. $core.addMethod(
  18912. $core.method({
  18913. selector: "basicName:",
  18914. protocol: 'private',
  18915. fn: function (aString){
  18916. var self=this;
  18917. return $core.withContext(function($ctx1) {
  18918. self.pkgName = aString;
  18919. return self;
  18920. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  18921. },
  18922. args: ["aString"],
  18923. source: "basicName: aString\x0a\x09<inlineJS: 'self.pkgName = aString'>",
  18924. referencedClasses: [],
  18925. messageSends: []
  18926. }),
  18927. $globals.Package);
  18928. $core.addMethod(
  18929. $core.method({
  18930. selector: "basicTransport",
  18931. protocol: 'private',
  18932. fn: function (){
  18933. var self=this;
  18934. return $core.withContext(function($ctx1) {
  18935. return self.transport;
  18936. return self;
  18937. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  18938. },
  18939. args: [],
  18940. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<inlineJS: 'return self.transport'>",
  18941. referencedClasses: [],
  18942. messageSends: []
  18943. }),
  18944. $globals.Package);
  18945. $core.addMethod(
  18946. $core.method({
  18947. selector: "beClean",
  18948. protocol: 'accessing',
  18949. fn: function (){
  18950. var self=this;
  18951. return $core.withContext(function($ctx1) {
  18952. var $1,$3,$2;
  18953. self["@dirty"]=false;
  18954. $1=$recv($globals.SystemAnnouncer)._current();
  18955. $3=$recv($globals.PackageClean)._new();
  18956. $recv($3)._package_(self);
  18957. $2=$recv($3)._yourself();
  18958. $recv($1)._announce_($2);
  18959. return self;
  18960. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  18961. },
  18962. args: [],
  18963. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18964. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  18965. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18966. }),
  18967. $globals.Package);
  18968. $core.addMethod(
  18969. $core.method({
  18970. selector: "beDirty",
  18971. protocol: 'accessing',
  18972. fn: function (){
  18973. var self=this;
  18974. return $core.withContext(function($ctx1) {
  18975. var $1,$3,$2;
  18976. self["@dirty"]=true;
  18977. $1=$recv($globals.SystemAnnouncer)._current();
  18978. $3=$recv($globals.PackageDirty)._new();
  18979. $recv($3)._package_(self);
  18980. $2=$recv($3)._yourself();
  18981. $recv($1)._announce_($2);
  18982. return self;
  18983. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  18984. },
  18985. args: [],
  18986. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18987. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  18988. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18989. }),
  18990. $globals.Package);
  18991. $core.addMethod(
  18992. $core.method({
  18993. selector: "classTemplate",
  18994. protocol: 'accessing',
  18995. fn: function (){
  18996. var self=this;
  18997. return $core.withContext(function($ctx1) {
  18998. var $2,$3,$1,$4,$5;
  18999. return $recv($globals.String)._streamContents_((function(stream){
  19000. return $core.withContext(function($ctx2) {
  19001. $recv(stream)._nextPutAll_("Object");
  19002. $ctx2.sendIdx["nextPutAll:"]=1;
  19003. $recv(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  19004. $ctx2.sendIdx["nextPutAll:"]=2;
  19005. $2=$recv($globals.String)._lf();
  19006. $ctx2.sendIdx["lf"]=1;
  19007. $3=$recv($globals.String)._tab();
  19008. $ctx2.sendIdx["tab"]=1;
  19009. $1=$recv($2).__comma($3);
  19010. $ctx2.sendIdx[","]=1;
  19011. $recv(stream)._nextPutAll_($1);
  19012. $ctx2.sendIdx["nextPutAll:"]=3;
  19013. $4=$recv(stream)._nextPutAll_("instanceVariableNames: ''");
  19014. $ctx2.sendIdx["nextPutAll:"]=4;
  19015. $4;
  19016. $5=$recv("'".__comma($recv($globals.String)._lf())).__comma($recv($globals.String)._tab());
  19017. $ctx2.sendIdx[","]=2;
  19018. $recv(stream)._nextPutAll_($5);
  19019. $ctx2.sendIdx["nextPutAll:"]=5;
  19020. $recv(stream)._nextPutAll_("package: '");
  19021. $ctx2.sendIdx["nextPutAll:"]=6;
  19022. $recv(stream)._nextPutAll_(self._name());
  19023. $ctx2.sendIdx["nextPutAll:"]=7;
  19024. return $recv(stream)._nextPutAll_("'");
  19025. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  19026. }));
  19027. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  19028. },
  19029. args: [],
  19030. source: "classTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: 'Object';\x0a\x09\x09\x09nextPutAll: ' subclass: #NameOfSubclass';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''''.\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: '''' ]",
  19031. referencedClasses: ["String"],
  19032. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"]
  19033. }),
  19034. $globals.Package);
  19035. $core.addMethod(
  19036. $core.method({
  19037. selector: "classes",
  19038. protocol: 'classes',
  19039. fn: function (){
  19040. var self=this;
  19041. return $core.withContext(function($ctx1) {
  19042. return $recv(self._organization())._elements();
  19043. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  19044. },
  19045. args: [],
  19046. source: "classes\x0a\x09^ self organization elements",
  19047. referencedClasses: [],
  19048. messageSends: ["elements", "organization"]
  19049. }),
  19050. $globals.Package);
  19051. $core.addMethod(
  19052. $core.method({
  19053. selector: "definition",
  19054. protocol: 'accessing',
  19055. fn: function (){
  19056. var self=this;
  19057. return $core.withContext(function($ctx1) {
  19058. var $1,$3,$4,$2,$6,$5,$8,$9,$7,$10;
  19059. return $recv($globals.String)._streamContents_((function(stream){
  19060. return $core.withContext(function($ctx2) {
  19061. $1=$recv(self._class())._name();
  19062. $ctx2.sendIdx["name"]=1;
  19063. $recv(stream)._nextPutAll_($1);
  19064. $ctx2.sendIdx["nextPutAll:"]=1;
  19065. $3=$recv($globals.String)._lf();
  19066. $ctx2.sendIdx["lf"]=1;
  19067. $4=$recv($globals.String)._tab();
  19068. $ctx2.sendIdx["tab"]=1;
  19069. $2=$recv($3).__comma($4);
  19070. $ctx2.sendIdx[","]=1;
  19071. $recv(stream)._nextPutAll_($2);
  19072. $ctx2.sendIdx["nextPutAll:"]=2;
  19073. $recv(stream)._nextPutAll_("named: ");
  19074. $ctx2.sendIdx["nextPutAll:"]=3;
  19075. $6="'".__comma(self._name());
  19076. $ctx2.sendIdx[","]=3;
  19077. $5=$recv($6).__comma("'");
  19078. $ctx2.sendIdx[","]=2;
  19079. $recv(stream)._nextPutAll_($5);
  19080. $ctx2.sendIdx["nextPutAll:"]=4;
  19081. $8=$recv($globals.String)._lf();
  19082. $ctx2.sendIdx["lf"]=2;
  19083. $9=$recv($globals.String)._tab();
  19084. $ctx2.sendIdx["tab"]=2;
  19085. $7=$recv($8).__comma($9);
  19086. $ctx2.sendIdx[","]=4;
  19087. $recv(stream)._nextPutAll_($7);
  19088. $ctx2.sendIdx["nextPutAll:"]=5;
  19089. $recv(stream)._nextPutAll_("imports: ");
  19090. $ctx2.sendIdx["nextPutAll:"]=6;
  19091. $recv(stream)._nextPutAll_(self._importsDefinition());
  19092. $ctx2.sendIdx["nextPutAll:"]=7;
  19093. $10=$recv($recv($globals.String)._lf()).__comma($recv($globals.String)._tab());
  19094. $ctx2.sendIdx[","]=5;
  19095. $recv(stream)._nextPutAll_($10);
  19096. $ctx2.sendIdx["nextPutAll:"]=8;
  19097. $recv(stream)._nextPutAll_("transport: (");
  19098. $ctx2.sendIdx["nextPutAll:"]=9;
  19099. return $recv(stream)._nextPutAll_($recv($recv(self._transport())._definition()).__comma(")"));
  19100. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  19101. }));
  19102. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  19103. },
  19104. args: [],
  19105. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'named: ';\x0a\x09\x09\x09nextPutAll: '''', self name, '''';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'imports: ';\x0a\x09\x09\x09nextPutAll: self importsDefinition;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'transport: (';\x0a\x09\x09\x09nextPutAll: self transport definition, ')' ]",
  19106. referencedClasses: ["String"],
  19107. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "importsDefinition", "definition", "transport"]
  19108. }),
  19109. $globals.Package);
  19110. $core.addMethod(
  19111. $core.method({
  19112. selector: "imports",
  19113. protocol: 'accessing',
  19114. fn: function (){
  19115. var self=this;
  19116. return $core.withContext(function($ctx1) {
  19117. var $1,$receiver;
  19118. $1=self["@imports"];
  19119. if(($receiver = $1) == null || $receiver.isNil){
  19120. var parsed;
  19121. parsed=self._importsFromJson_(self._basicImports());
  19122. parsed;
  19123. self._imports_(parsed);
  19124. return self["@imports"];
  19125. } else {
  19126. return $1;
  19127. };
  19128. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  19129. },
  19130. args: [],
  19131. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09| parsed |\x0a\x09\x09parsed := self importsFromJson: self basicImports.\x0a\x09\x09self imports: parsed.\x0a\x09\x09imports ]",
  19132. referencedClasses: [],
  19133. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  19134. }),
  19135. $globals.Package);
  19136. $core.addMethod(
  19137. $core.method({
  19138. selector: "imports:",
  19139. protocol: 'accessing',
  19140. fn: function (anArray){
  19141. var self=this;
  19142. return $core.withContext(function($ctx1) {
  19143. self._validateImports_(anArray);
  19144. self["@imports"]=$recv(anArray)._asSet();
  19145. return self;
  19146. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  19147. },
  19148. args: ["anArray"],
  19149. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  19150. referencedClasses: [],
  19151. messageSends: ["validateImports:", "asSet"]
  19152. }),
  19153. $globals.Package);
  19154. $core.addMethod(
  19155. $core.method({
  19156. selector: "importsAsJson",
  19157. protocol: 'converting',
  19158. fn: function (){
  19159. var self=this;
  19160. return $core.withContext(function($ctx1) {
  19161. var $1;
  19162. return $recv(self._sortedImportsAsArray())._collect_((function(each){
  19163. return $core.withContext(function($ctx2) {
  19164. $1=$recv(each)._isString();
  19165. if($core.assert($1)){
  19166. return each;
  19167. } else {
  19168. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  19169. $ctx2.sendIdx[","]=1;
  19170. };
  19171. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19172. }));
  19173. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  19174. },
  19175. args: [],
  19176. 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 ]]",
  19177. referencedClasses: [],
  19178. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  19179. }),
  19180. $globals.Package);
  19181. $core.addMethod(
  19182. $core.method({
  19183. selector: "importsDefinition",
  19184. protocol: 'accessing',
  19185. fn: function (){
  19186. var self=this;
  19187. return $core.withContext(function($ctx1) {
  19188. return $recv($globals.String)._streamContents_((function(stream){
  19189. return $core.withContext(function($ctx2) {
  19190. $recv(stream)._nextPutAll_("{");
  19191. $ctx2.sendIdx["nextPutAll:"]=1;
  19192. $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
  19193. return $core.withContext(function($ctx3) {
  19194. return $recv(stream)._nextPutAll_($recv(each)._importsString());
  19195. $ctx3.sendIdx["nextPutAll:"]=2;
  19196. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  19197. }),(function(){
  19198. return $core.withContext(function($ctx3) {
  19199. return $recv(stream)._nextPutAll_(". ");
  19200. $ctx3.sendIdx["nextPutAll:"]=3;
  19201. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  19202. }));
  19203. return $recv(stream)._nextPutAll_("}");
  19204. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  19205. }));
  19206. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  19207. },
  19208. args: [],
  19209. source: "importsDefinition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream nextPutAll: '{'.\x0a\x09\x09self sortedImportsAsArray\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each importsString ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: '. ' ].\x0a\x09\x09stream nextPutAll: '}' ]",
  19210. referencedClasses: ["String"],
  19211. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "sortedImportsAsArray", "importsString"]
  19212. }),
  19213. $globals.Package);
  19214. $core.addMethod(
  19215. $core.method({
  19216. selector: "importsFromJson:",
  19217. protocol: 'converting',
  19218. fn: function (anArray){
  19219. var self=this;
  19220. return $core.withContext(function($ctx1) {
  19221. var $1;
  19222. return $recv(anArray)._collect_((function(each){
  19223. var split;
  19224. return $core.withContext(function($ctx2) {
  19225. split=$recv(each)._tokenize_("=");
  19226. split;
  19227. $1=$recv($recv(split)._size()).__eq((1));
  19228. if($core.assert($1)){
  19229. return $recv(split)._first();
  19230. $ctx2.sendIdx["first"]=1;
  19231. } else {
  19232. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  19233. };
  19234. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  19235. }));
  19236. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  19237. },
  19238. args: ["anArray"],
  19239. 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 ]]",
  19240. referencedClasses: [],
  19241. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  19242. }),
  19243. $globals.Package);
  19244. $core.addMethod(
  19245. $core.method({
  19246. selector: "isDirty",
  19247. protocol: 'testing',
  19248. fn: function (){
  19249. var self=this;
  19250. return $core.withContext(function($ctx1) {
  19251. var $1,$receiver;
  19252. $1=self["@dirty"];
  19253. if(($receiver = $1) == null || $receiver.isNil){
  19254. return false;
  19255. } else {
  19256. return $1;
  19257. };
  19258. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  19259. },
  19260. args: [],
  19261. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  19262. referencedClasses: [],
  19263. messageSends: ["ifNil:"]
  19264. }),
  19265. $globals.Package);
  19266. $core.addMethod(
  19267. $core.method({
  19268. selector: "isPackage",
  19269. protocol: 'testing',
  19270. fn: function (){
  19271. var self=this;
  19272. return true;
  19273. },
  19274. args: [],
  19275. source: "isPackage\x0a\x09^ true",
  19276. referencedClasses: [],
  19277. messageSends: []
  19278. }),
  19279. $globals.Package);
  19280. $core.addMethod(
  19281. $core.method({
  19282. selector: "loadDependencies",
  19283. protocol: 'dependencies',
  19284. fn: function (){
  19285. var self=this;
  19286. var classes,packages;
  19287. return $core.withContext(function($ctx1) {
  19288. var $1;
  19289. classes=self._loadDependencyClasses();
  19290. $1=$recv($recv(classes)._collect_((function(each){
  19291. return $core.withContext(function($ctx2) {
  19292. return $recv(each)._package();
  19293. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19294. })))._asSet();
  19295. $recv($1)._remove_ifAbsent_(self,(function(){
  19296. }));
  19297. return $recv($1)._yourself();
  19298. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  19299. },
  19300. args: [],
  19301. 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",
  19302. referencedClasses: [],
  19303. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  19304. }),
  19305. $globals.Package);
  19306. $core.addMethod(
  19307. $core.method({
  19308. selector: "loadDependencyClasses",
  19309. protocol: 'dependencies',
  19310. fn: function (){
  19311. var self=this;
  19312. var starCategoryName;
  19313. return $core.withContext(function($ctx1) {
  19314. var $3,$2,$1,$5,$4;
  19315. starCategoryName="*".__comma(self._name());
  19316. $ctx1.sendIdx[","]=1;
  19317. $3=self._classes();
  19318. $ctx1.sendIdx["classes"]=1;
  19319. $2=$recv($3)._collect_((function(each){
  19320. return $core.withContext(function($ctx2) {
  19321. return $recv(each)._superclass();
  19322. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19323. }));
  19324. $1=$recv($2)._asSet();
  19325. $recv($1)._remove_ifAbsent_(nil,(function(){
  19326. }));
  19327. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  19328. return $core.withContext(function($ctx2) {
  19329. $5=$recv(each)._protocols();
  19330. $ctx2.sendIdx["protocols"]=1;
  19331. $4=$recv($5).__comma($recv($recv(each)._class())._protocols());
  19332. return $recv($4)._includes_(starCategoryName);
  19333. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  19334. })));
  19335. return $recv($1)._yourself();
  19336. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  19337. },
  19338. args: [],
  19339. 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\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09addAll: (Smalltalk classes select: [ :each | each protocols, each class protocols includes: starCategoryName ]);\x0a\x09\x09yourself",
  19340. referencedClasses: ["Smalltalk"],
  19341. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"]
  19342. }),
  19343. $globals.Package);
  19344. $core.addMethod(
  19345. $core.method({
  19346. selector: "name",
  19347. protocol: 'accessing',
  19348. fn: function (){
  19349. var self=this;
  19350. return $core.withContext(function($ctx1) {
  19351. return self.pkgName;
  19352. return self;
  19353. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  19354. },
  19355. args: [],
  19356. source: "name\x0a\x09<inlineJS: 'return self.pkgName'>",
  19357. referencedClasses: [],
  19358. messageSends: []
  19359. }),
  19360. $globals.Package);
  19361. $core.addMethod(
  19362. $core.method({
  19363. selector: "name:",
  19364. protocol: 'accessing',
  19365. fn: function (aString){
  19366. var self=this;
  19367. return $core.withContext(function($ctx1) {
  19368. self._basicName_(aString);
  19369. self._beDirty();
  19370. return self;
  19371. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  19372. },
  19373. args: ["aString"],
  19374. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  19375. referencedClasses: [],
  19376. messageSends: ["basicName:", "beDirty"]
  19377. }),
  19378. $globals.Package);
  19379. $core.addMethod(
  19380. $core.method({
  19381. selector: "organization",
  19382. protocol: 'accessing',
  19383. fn: function (){
  19384. var self=this;
  19385. return $core.withContext(function($ctx1) {
  19386. return self._basicAt_("organization");
  19387. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  19388. },
  19389. args: [],
  19390. source: "organization\x0a\x09^ self basicAt: 'organization'",
  19391. referencedClasses: [],
  19392. messageSends: ["basicAt:"]
  19393. }),
  19394. $globals.Package);
  19395. $core.addMethod(
  19396. $core.method({
  19397. selector: "printOn:",
  19398. protocol: 'printing',
  19399. fn: function (aStream){
  19400. var self=this;
  19401. return $core.withContext(function($ctx1) {
  19402. (
  19403. $ctx1.supercall = true,
  19404. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  19405. $ctx1.supercall = false;
  19406. $recv(aStream)._nextPutAll_(" (");
  19407. $ctx1.sendIdx["nextPutAll:"]=1;
  19408. $recv(aStream)._nextPutAll_(self._name());
  19409. $ctx1.sendIdx["nextPutAll:"]=2;
  19410. $recv(aStream)._nextPutAll_(")");
  19411. return self;
  19412. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  19413. },
  19414. args: ["aStream"],
  19415. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  19416. referencedClasses: [],
  19417. messageSends: ["printOn:", "nextPutAll:", "name"]
  19418. }),
  19419. $globals.Package);
  19420. $core.addMethod(
  19421. $core.method({
  19422. selector: "setupClasses",
  19423. protocol: 'classes',
  19424. fn: function (){
  19425. var self=this;
  19426. return $core.withContext(function($ctx1) {
  19427. var $1;
  19428. $1=self._classes();
  19429. $recv($1)._do_((function(each){
  19430. return $core.withContext(function($ctx2) {
  19431. return $recv($recv($globals.ClassBuilder)._new())._setupClass_(each);
  19432. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19433. }));
  19434. $ctx1.sendIdx["do:"]=1;
  19435. $recv($1)._do_((function(each){
  19436. return $core.withContext(function($ctx2) {
  19437. return $recv(each)._initialize();
  19438. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  19439. }));
  19440. return self;
  19441. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  19442. },
  19443. args: [],
  19444. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  19445. referencedClasses: ["ClassBuilder"],
  19446. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"]
  19447. }),
  19448. $globals.Package);
  19449. $core.addMethod(
  19450. $core.method({
  19451. selector: "sortedClasses",
  19452. protocol: 'classes',
  19453. fn: function (){
  19454. var self=this;
  19455. return $core.withContext(function($ctx1) {
  19456. return $recv(self._class())._sortedClasses_(self._classes());
  19457. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  19458. },
  19459. args: [],
  19460. 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",
  19461. referencedClasses: [],
  19462. messageSends: ["sortedClasses:", "class", "classes"]
  19463. }),
  19464. $globals.Package);
  19465. $core.addMethod(
  19466. $core.method({
  19467. selector: "sortedImportsAsArray",
  19468. protocol: 'private',
  19469. fn: function (){
  19470. var self=this;
  19471. return $core.withContext(function($ctx1) {
  19472. var $3,$2,$4,$1,$6,$5,$7;
  19473. return $recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  19474. return $core.withContext(function($ctx2) {
  19475. $3=$recv(a)._isString();
  19476. $ctx2.sendIdx["isString"]=1;
  19477. $2=$recv($3)._not();
  19478. $4=$recv(b)._isString();
  19479. $ctx2.sendIdx["isString"]=2;
  19480. $1=$recv($2).__and($4);
  19481. return $recv($1)._or_((function(){
  19482. return $core.withContext(function($ctx3) {
  19483. $6=$recv(a)._isString();
  19484. $ctx3.sendIdx["isString"]=3;
  19485. $5=$recv($6).__eq($recv(b)._isString());
  19486. return $recv($5)._and_((function(){
  19487. return $core.withContext(function($ctx4) {
  19488. $7=$recv(a)._value();
  19489. $ctx4.sendIdx["value"]=1;
  19490. return $recv($7).__lt_eq($recv(b)._value());
  19491. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  19492. }));
  19493. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  19494. }));
  19495. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  19496. }));
  19497. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  19498. },
  19499. args: [],
  19500. 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 ]]]",
  19501. referencedClasses: [],
  19502. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  19503. }),
  19504. $globals.Package);
  19505. $core.addMethod(
  19506. $core.method({
  19507. selector: "transport",
  19508. protocol: 'accessing',
  19509. fn: function (){
  19510. var self=this;
  19511. return $core.withContext(function($ctx1) {
  19512. var $1,$2,$receiver;
  19513. $1=self["@transport"];
  19514. if(($receiver = $1) == null || $receiver.isNil){
  19515. $2=$recv($globals.PackageTransport)._fromJson_(self._basicTransport());
  19516. $recv($2)._package_(self);
  19517. self["@transport"]=$recv($2)._yourself();
  19518. return self["@transport"];
  19519. } else {
  19520. return $1;
  19521. };
  19522. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  19523. },
  19524. args: [],
  19525. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  19526. referencedClasses: ["PackageTransport"],
  19527. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  19528. }),
  19529. $globals.Package);
  19530. $core.addMethod(
  19531. $core.method({
  19532. selector: "transport:",
  19533. protocol: 'accessing',
  19534. fn: function (aPackageTransport){
  19535. var self=this;
  19536. return $core.withContext(function($ctx1) {
  19537. self["@transport"]=aPackageTransport;
  19538. $recv(aPackageTransport)._package_(self);
  19539. return self;
  19540. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  19541. },
  19542. args: ["aPackageTransport"],
  19543. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  19544. referencedClasses: [],
  19545. messageSends: ["package:"]
  19546. }),
  19547. $globals.Package);
  19548. $core.addMethod(
  19549. $core.method({
  19550. selector: "validateImports:",
  19551. protocol: 'validation',
  19552. fn: function (aCollection){
  19553. var self=this;
  19554. return $core.withContext(function($ctx1) {
  19555. var $1,$2,$5,$4,$3,$6;
  19556. $recv(aCollection)._do_((function(import_){
  19557. return $core.withContext(function($ctx2) {
  19558. $1=$recv(import_)._isString();
  19559. $ctx2.sendIdx["isString"]=1;
  19560. if(!$core.assert($1)){
  19561. $2=$recv(import_)._respondsTo_("key");
  19562. if(!$core.assert($2)){
  19563. self._error_("Imports must be Strings or Associations");
  19564. $ctx2.sendIdx["error:"]=1;
  19565. };
  19566. $5=$recv(import_)._key();
  19567. $ctx2.sendIdx["key"]=1;
  19568. $4=$recv($5)._isString();
  19569. $ctx2.sendIdx["isString"]=2;
  19570. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  19571. if(!$core.assert($3)){
  19572. self._error_("Key and value must be Strings");
  19573. $ctx2.sendIdx["error:"]=2;
  19574. };
  19575. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  19576. if(!$core.assert($6)){
  19577. return self._error_("Keys must be identifiers");
  19578. };
  19579. };
  19580. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  19581. }));
  19582. return self;
  19583. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  19584. },
  19585. args: ["aCollection"],
  19586. 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' ]]]",
  19587. referencedClasses: [],
  19588. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  19589. }),
  19590. $globals.Package);
  19591. $globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  19592. $core.addMethod(
  19593. $core.method({
  19594. selector: "named:",
  19595. protocol: 'accessing',
  19596. fn: function (aPackageName){
  19597. var self=this;
  19598. return $core.withContext(function($ctx1) {
  19599. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  19600. return $core.withContext(function($ctx2) {
  19601. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  19602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19603. }));
  19604. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  19605. },
  19606. args: ["aPackageName"],
  19607. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  19608. referencedClasses: ["Smalltalk"],
  19609. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  19610. }),
  19611. $globals.Package.klass);
  19612. $core.addMethod(
  19613. $core.method({
  19614. selector: "named:ifAbsent:",
  19615. protocol: 'accessing',
  19616. fn: function (aPackageName,aBlock){
  19617. var self=this;
  19618. return $core.withContext(function($ctx1) {
  19619. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  19620. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  19621. },
  19622. args: ["aPackageName", "aBlock"],
  19623. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  19624. referencedClasses: ["Smalltalk"],
  19625. messageSends: ["packageAt:ifAbsent:"]
  19626. }),
  19627. $globals.Package.klass);
  19628. $core.addMethod(
  19629. $core.method({
  19630. selector: "named:imports:transport:",
  19631. protocol: 'accessing',
  19632. fn: function (aPackageName,anArray,aTransport){
  19633. var self=this;
  19634. var package_;
  19635. return $core.withContext(function($ctx1) {
  19636. package_=self._named_(aPackageName);
  19637. $recv(package_)._imports_(anArray);
  19638. $recv(package_)._transport_(aTransport);
  19639. return package_;
  19640. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  19641. },
  19642. args: ["aPackageName", "anArray", "aTransport"],
  19643. source: "named: aPackageName imports: anArray transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package imports: anArray.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  19644. referencedClasses: [],
  19645. messageSends: ["named:", "imports:", "transport:"]
  19646. }),
  19647. $globals.Package.klass);
  19648. $core.addMethod(
  19649. $core.method({
  19650. selector: "named:transport:",
  19651. protocol: 'accessing',
  19652. fn: function (aPackageName,aTransport){
  19653. var self=this;
  19654. var package_;
  19655. return $core.withContext(function($ctx1) {
  19656. package_=self._named_(aPackageName);
  19657. $recv(package_)._transport_(aTransport);
  19658. return package_;
  19659. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  19660. },
  19661. args: ["aPackageName", "aTransport"],
  19662. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  19663. referencedClasses: [],
  19664. messageSends: ["named:", "transport:"]
  19665. }),
  19666. $globals.Package.klass);
  19667. $core.addMethod(
  19668. $core.method({
  19669. selector: "sortedClasses:",
  19670. protocol: 'sorting',
  19671. fn: function (classes){
  19672. var self=this;
  19673. var children,others,nodes,expandedClasses;
  19674. return $core.withContext(function($ctx1) {
  19675. var $1,$3,$2;
  19676. children=[];
  19677. others=[];
  19678. $recv(classes)._do_((function(each){
  19679. return $core.withContext(function($ctx2) {
  19680. $1=$recv(classes)._includes_($recv(each)._superclass());
  19681. if($core.assert($1)){
  19682. return $recv(others)._add_(each);
  19683. } else {
  19684. return $recv(children)._add_(each);
  19685. $ctx2.sendIdx["add:"]=1;
  19686. };
  19687. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19688. }));
  19689. $ctx1.sendIdx["do:"]=1;
  19690. nodes=$recv(children)._collect_((function(each){
  19691. return $core.withContext(function($ctx2) {
  19692. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  19693. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  19694. }));
  19695. nodes=$recv(nodes)._sorted_((function(a,b){
  19696. return $core.withContext(function($ctx2) {
  19697. $3=$recv(a)._theClass();
  19698. $ctx2.sendIdx["theClass"]=1;
  19699. $2=$recv($3)._name();
  19700. $ctx2.sendIdx["name"]=1;
  19701. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  19702. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  19703. }));
  19704. expandedClasses=$recv($globals.Array)._new();
  19705. $recv(nodes)._do_((function(aNode){
  19706. return $core.withContext(function($ctx2) {
  19707. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  19708. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  19709. }));
  19710. return expandedClasses;
  19711. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  19712. },
  19713. args: ["classes"],
  19714. 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",
  19715. referencedClasses: ["ClassSorterNode", "Array"],
  19716. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  19717. }),
  19718. $globals.Package.klass);
  19719. $core.addClass('PackageStateObserver', $globals.Object, [], 'Kernel-Infrastructure');
  19720. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  19721. $core.addMethod(
  19722. $core.method({
  19723. selector: "announcer",
  19724. protocol: 'accessing',
  19725. fn: function (){
  19726. var self=this;
  19727. return $core.withContext(function($ctx1) {
  19728. return $recv($globals.SystemAnnouncer)._current();
  19729. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  19730. },
  19731. args: [],
  19732. source: "announcer\x0a\x09^ SystemAnnouncer current",
  19733. referencedClasses: ["SystemAnnouncer"],
  19734. messageSends: ["current"]
  19735. }),
  19736. $globals.PackageStateObserver);
  19737. $core.addMethod(
  19738. $core.method({
  19739. selector: "observeSystem",
  19740. protocol: 'actions',
  19741. fn: function (){
  19742. var self=this;
  19743. return $core.withContext(function($ctx1) {
  19744. var $1;
  19745. $1=self._announcer();
  19746. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  19747. $ctx1.sendIdx["on:send:to:"]=1;
  19748. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  19749. $ctx1.sendIdx["on:send:to:"]=2;
  19750. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  19751. $ctx1.sendIdx["on:send:to:"]=3;
  19752. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  19753. return self;
  19754. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  19755. },
  19756. args: [],
  19757. 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",
  19758. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  19759. messageSends: ["on:send:to:", "announcer"]
  19760. }),
  19761. $globals.PackageStateObserver);
  19762. $core.addMethod(
  19763. $core.method({
  19764. selector: "onClassModification:",
  19765. protocol: 'reactions',
  19766. fn: function (anAnnouncement){
  19767. var self=this;
  19768. return $core.withContext(function($ctx1) {
  19769. var $1,$receiver;
  19770. $1=$recv(anAnnouncement)._theClass();
  19771. if(($receiver = $1) == null || $receiver.isNil){
  19772. $1;
  19773. } else {
  19774. var theClass;
  19775. theClass=$receiver;
  19776. $recv($recv(theClass)._package())._beDirty();
  19777. };
  19778. return self;
  19779. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19780. },
  19781. args: ["anAnnouncement"],
  19782. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  19783. referencedClasses: [],
  19784. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  19785. }),
  19786. $globals.PackageStateObserver);
  19787. $core.addMethod(
  19788. $core.method({
  19789. selector: "onMethodModification:",
  19790. protocol: 'reactions',
  19791. fn: function (anAnnouncement){
  19792. var self=this;
  19793. return $core.withContext(function($ctx1) {
  19794. var $1,$receiver;
  19795. $1=$recv($recv(anAnnouncement)._method())._package();
  19796. if(($receiver = $1) == null || $receiver.isNil){
  19797. $1;
  19798. } else {
  19799. var package_;
  19800. package_=$receiver;
  19801. $recv(package_)._beDirty();
  19802. };
  19803. return self;
  19804. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19805. },
  19806. args: ["anAnnouncement"],
  19807. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  19808. referencedClasses: [],
  19809. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  19810. }),
  19811. $globals.PackageStateObserver);
  19812. $core.addMethod(
  19813. $core.method({
  19814. selector: "onPackageAdded:",
  19815. protocol: 'reactions',
  19816. fn: function (anAnnouncement){
  19817. var self=this;
  19818. return $core.withContext(function($ctx1) {
  19819. $recv($recv(anAnnouncement)._package())._beDirty();
  19820. return self;
  19821. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19822. },
  19823. args: ["anAnnouncement"],
  19824. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  19825. referencedClasses: [],
  19826. messageSends: ["beDirty", "package"]
  19827. }),
  19828. $globals.PackageStateObserver);
  19829. $core.addMethod(
  19830. $core.method({
  19831. selector: "onProtocolModification:",
  19832. protocol: 'reactions',
  19833. fn: function (anAnnouncement){
  19834. var self=this;
  19835. return $core.withContext(function($ctx1) {
  19836. var $1,$receiver;
  19837. $1=$recv(anAnnouncement)._package();
  19838. if(($receiver = $1) == null || $receiver.isNil){
  19839. $1;
  19840. } else {
  19841. var package_;
  19842. package_=$receiver;
  19843. $recv(package_)._beDirty();
  19844. };
  19845. return self;
  19846. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19847. },
  19848. args: ["anAnnouncement"],
  19849. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  19850. referencedClasses: [],
  19851. messageSends: ["ifNotNil:", "package", "beDirty"]
  19852. }),
  19853. $globals.PackageStateObserver);
  19854. $globals.PackageStateObserver.klass.iVarNames = ['current'];
  19855. $core.addMethod(
  19856. $core.method({
  19857. selector: "current",
  19858. protocol: 'accessing',
  19859. fn: function (){
  19860. var self=this;
  19861. return $core.withContext(function($ctx1) {
  19862. var $1,$receiver;
  19863. $1=self["@current"];
  19864. if(($receiver = $1) == null || $receiver.isNil){
  19865. self["@current"]=self._new();
  19866. return self["@current"];
  19867. } else {
  19868. return $1;
  19869. };
  19870. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  19871. },
  19872. args: [],
  19873. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  19874. referencedClasses: [],
  19875. messageSends: ["ifNil:", "new"]
  19876. }),
  19877. $globals.PackageStateObserver.klass);
  19878. $core.addMethod(
  19879. $core.method({
  19880. selector: "initialize",
  19881. protocol: 'initialization',
  19882. fn: function (){
  19883. var self=this;
  19884. return $core.withContext(function($ctx1) {
  19885. $recv(self._current())._observeSystem();
  19886. return self;
  19887. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  19888. },
  19889. args: [],
  19890. source: "initialize\x0a\x09self current observeSystem",
  19891. referencedClasses: [],
  19892. messageSends: ["observeSystem", "current"]
  19893. }),
  19894. $globals.PackageStateObserver.klass);
  19895. $core.addClass('ParseError', $globals.Error, [], 'Kernel-Infrastructure');
  19896. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  19897. $core.addClass('Setting', $globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  19898. $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`";
  19899. $core.addMethod(
  19900. $core.method({
  19901. selector: "defaultValue",
  19902. protocol: 'accessing',
  19903. fn: function (){
  19904. var self=this;
  19905. return self["@defaultValue"];
  19906. },
  19907. args: [],
  19908. source: "defaultValue\x0a\x09^ defaultValue",
  19909. referencedClasses: [],
  19910. messageSends: []
  19911. }),
  19912. $globals.Setting);
  19913. $core.addMethod(
  19914. $core.method({
  19915. selector: "defaultValue:",
  19916. protocol: 'accessing',
  19917. fn: function (aStringifiableObject){
  19918. var self=this;
  19919. self["@defaultValue"]=aStringifiableObject;
  19920. return self;
  19921. },
  19922. args: ["aStringifiableObject"],
  19923. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  19924. referencedClasses: [],
  19925. messageSends: []
  19926. }),
  19927. $globals.Setting);
  19928. $core.addMethod(
  19929. $core.method({
  19930. selector: "key",
  19931. protocol: 'accessing',
  19932. fn: function (){
  19933. var self=this;
  19934. return self["@key"];
  19935. },
  19936. args: [],
  19937. source: "key\x0a\x09^ key",
  19938. referencedClasses: [],
  19939. messageSends: []
  19940. }),
  19941. $globals.Setting);
  19942. $core.addMethod(
  19943. $core.method({
  19944. selector: "key:",
  19945. protocol: 'accessing',
  19946. fn: function (aString){
  19947. var self=this;
  19948. self["@key"]=aString;
  19949. return self;
  19950. },
  19951. args: ["aString"],
  19952. source: "key: aString\x0a\x09key := aString",
  19953. referencedClasses: [],
  19954. messageSends: []
  19955. }),
  19956. $globals.Setting);
  19957. $core.addMethod(
  19958. $core.method({
  19959. selector: "value",
  19960. protocol: 'accessing',
  19961. fn: function (){
  19962. var self=this;
  19963. return $core.withContext(function($ctx1) {
  19964. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_(self._key(),(function(){
  19965. return $core.withContext(function($ctx2) {
  19966. return self._defaultValue();
  19967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19968. }));
  19969. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  19970. },
  19971. args: [],
  19972. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  19973. referencedClasses: ["Smalltalk"],
  19974. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  19975. }),
  19976. $globals.Setting);
  19977. $core.addMethod(
  19978. $core.method({
  19979. selector: "value:",
  19980. protocol: 'accessing',
  19981. fn: function (aStringifiableObject){
  19982. var self=this;
  19983. return $core.withContext(function($ctx1) {
  19984. return $recv($recv($globals.Smalltalk)._settings())._at_put_(self._key(),aStringifiableObject);
  19985. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  19986. },
  19987. args: ["aStringifiableObject"],
  19988. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  19989. referencedClasses: ["Smalltalk"],
  19990. messageSends: ["at:put:", "settings", "key"]
  19991. }),
  19992. $globals.Setting);
  19993. $core.addMethod(
  19994. $core.method({
  19995. selector: "at:ifAbsent:",
  19996. protocol: 'instance creation',
  19997. fn: function (aString,aDefaultValue){
  19998. var self=this;
  19999. return $core.withContext(function($ctx1) {
  20000. var $1;
  20001. $1=(
  20002. $ctx1.supercall = true,
  20003. ($globals.Setting.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  20004. $ctx1.supercall = false;
  20005. $recv($1)._key_(aString);
  20006. $recv($1)._defaultValue_(aDefaultValue);
  20007. return $recv($1)._yourself();
  20008. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  20009. },
  20010. args: ["aString", "aDefaultValue"],
  20011. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  20012. referencedClasses: [],
  20013. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  20014. }),
  20015. $globals.Setting.klass);
  20016. $core.addMethod(
  20017. $core.method({
  20018. selector: "new",
  20019. protocol: 'instance creation',
  20020. fn: function (){
  20021. var self=this;
  20022. return $core.withContext(function($ctx1) {
  20023. self._shouldNotImplement();
  20024. return self;
  20025. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  20026. },
  20027. args: [],
  20028. source: "new\x0a\x09self shouldNotImplement",
  20029. referencedClasses: [],
  20030. messageSends: ["shouldNotImplement"]
  20031. }),
  20032. $globals.Setting.klass);
  20033. $core.addClass('SmalltalkImage', $globals.Object, [], 'Kernel-Infrastructure');
  20034. $globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `$core` declared in `support/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#globals #at:` answers a specific global (usually, a class) or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `support/parser.js` parser file in order to work.";
  20035. $core.addMethod(
  20036. $core.method({
  20037. selector: "addGlobalJsVariable:",
  20038. protocol: 'globals',
  20039. fn: function (aString){
  20040. var self=this;
  20041. return $core.withContext(function($ctx1) {
  20042. $recv(self._globalJsVariables())._add_(aString);
  20043. return self;
  20044. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  20045. },
  20046. args: ["aString"],
  20047. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  20048. referencedClasses: [],
  20049. messageSends: ["add:", "globalJsVariables"]
  20050. }),
  20051. $globals.SmalltalkImage);
  20052. $core.addMethod(
  20053. $core.method({
  20054. selector: "amdRequire",
  20055. protocol: 'accessing amd',
  20056. fn: function (){
  20057. var self=this;
  20058. return $core.withContext(function($ctx1) {
  20059. return $recv(self._core())._at_("amdRequire");
  20060. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  20061. },
  20062. args: [],
  20063. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  20064. referencedClasses: [],
  20065. messageSends: ["at:", "core"]
  20066. }),
  20067. $globals.SmalltalkImage);
  20068. $core.addMethod(
  20069. $core.method({
  20070. selector: "asSmalltalkException:",
  20071. protocol: 'error handling',
  20072. fn: function (anObject){
  20073. var self=this;
  20074. return $core.withContext(function($ctx1) {
  20075. var $1;
  20076. $1=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  20077. return $core.withContext(function($ctx2) {
  20078. return $recv(anObject)._isKindOf_($globals.Error);
  20079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20080. }));
  20081. if($core.assert($1)){
  20082. return anObject;
  20083. } else {
  20084. return $recv($globals.JavaScriptException)._on_(anObject);
  20085. };
  20086. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  20087. },
  20088. args: ["anObject"],
  20089. 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 ]",
  20090. referencedClasses: ["Error", "JavaScriptException"],
  20091. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  20092. }),
  20093. $globals.SmalltalkImage);
  20094. $core.addMethod(
  20095. $core.method({
  20096. selector: "basicCreatePackage:",
  20097. protocol: 'private',
  20098. fn: function (packageName){
  20099. var self=this;
  20100. return $core.withContext(function($ctx1) {
  20101. return $core.addPackage(packageName);
  20102. return self;
  20103. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  20104. },
  20105. args: ["packageName"],
  20106. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<inlineJS: 'return $core.addPackage(packageName)'>",
  20107. referencedClasses: [],
  20108. messageSends: []
  20109. }),
  20110. $globals.SmalltalkImage);
  20111. $core.addMethod(
  20112. $core.method({
  20113. selector: "basicParse:",
  20114. protocol: 'private',
  20115. fn: function (aString){
  20116. var self=this;
  20117. return $core.withContext(function($ctx1) {
  20118. return $recv($globals.SmalltalkParser)._parse_(aString);
  20119. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  20120. },
  20121. args: ["aString"],
  20122. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  20123. referencedClasses: ["SmalltalkParser"],
  20124. messageSends: ["parse:"]
  20125. }),
  20126. $globals.SmalltalkImage);
  20127. $core.addMethod(
  20128. $core.method({
  20129. selector: "basicRegisterPackage:",
  20130. protocol: 'private',
  20131. fn: function (aPackage){
  20132. var self=this;
  20133. return $core.withContext(function($ctx1) {
  20134. $core.packages[aPackage.pkgName]=aPackage;
  20135. return self;
  20136. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  20137. },
  20138. args: ["aPackage"],
  20139. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<inlineJS: '$core.packages[aPackage.pkgName]=aPackage'>",
  20140. referencedClasses: [],
  20141. messageSends: []
  20142. }),
  20143. $globals.SmalltalkImage);
  20144. $core.addMethod(
  20145. $core.method({
  20146. selector: "cancelOptOut:",
  20147. protocol: 'accessing',
  20148. fn: function (anObject){
  20149. var self=this;
  20150. return $core.withContext(function($ctx1) {
  20151. delete anObject.klass;
  20152. return self;
  20153. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  20154. },
  20155. args: ["anObject"],
  20156. source: "cancelOptOut: anObject\x0a\x09\x22A Smalltalk object has a 'klass' property.\x0a\x09If this property is shadowed for anObject by optOut:,\x0a\x09the object is treated as plain JS object.\x0a\x09This removes the shadow and anObject is Smalltalk object\x0a\x09again if it was before.\x22\x0a\x09\x0a\x09<inlineJS: 'delete anObject.klass'>",
  20157. referencedClasses: [],
  20158. messageSends: []
  20159. }),
  20160. $globals.SmalltalkImage);
  20161. $core.addMethod(
  20162. $core.method({
  20163. selector: "classes",
  20164. protocol: 'classes',
  20165. fn: function (){
  20166. var self=this;
  20167. return $core.withContext(function($ctx1) {
  20168. return $core.classes();
  20169. return self;
  20170. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  20171. },
  20172. args: [],
  20173. source: "classes\x0a\x09<inlineJS: 'return $core.classes()'>",
  20174. referencedClasses: [],
  20175. messageSends: []
  20176. }),
  20177. $globals.SmalltalkImage);
  20178. $core.addMethod(
  20179. $core.method({
  20180. selector: "core",
  20181. protocol: 'accessing',
  20182. fn: function (){
  20183. var self=this;
  20184. return $core.withContext(function($ctx1) {
  20185. return $core;
  20186. return self;
  20187. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  20188. },
  20189. args: [],
  20190. source: "core\x0a\x09<inlineJS: 'return $core'>",
  20191. referencedClasses: [],
  20192. messageSends: []
  20193. }),
  20194. $globals.SmalltalkImage);
  20195. $core.addMethod(
  20196. $core.method({
  20197. selector: "createPackage:",
  20198. protocol: 'packages',
  20199. fn: function (packageName){
  20200. var self=this;
  20201. var package_,announcement;
  20202. return $core.withContext(function($ctx1) {
  20203. var $1;
  20204. package_=self._basicCreatePackage_(packageName);
  20205. $1=$recv($globals.PackageAdded)._new();
  20206. $recv($1)._package_(package_);
  20207. announcement=$recv($1)._yourself();
  20208. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  20209. return package_;
  20210. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  20211. },
  20212. args: ["packageName"],
  20213. 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",
  20214. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  20215. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  20216. }),
  20217. $globals.SmalltalkImage);
  20218. $core.addMethod(
  20219. $core.method({
  20220. selector: "defaultAmdNamespace",
  20221. protocol: 'accessing amd',
  20222. fn: function (){
  20223. var self=this;
  20224. return $core.withContext(function($ctx1) {
  20225. return "transport.defaultAmdNamespace"._settingValue();
  20226. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  20227. },
  20228. args: [],
  20229. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  20230. referencedClasses: [],
  20231. messageSends: ["settingValue"]
  20232. }),
  20233. $globals.SmalltalkImage);
  20234. $core.addMethod(
  20235. $core.method({
  20236. selector: "defaultAmdNamespace:",
  20237. protocol: 'accessing amd',
  20238. fn: function (aString){
  20239. var self=this;
  20240. return $core.withContext(function($ctx1) {
  20241. "transport.defaultAmdNamespace"._settingValue_(aString);
  20242. return self;
  20243. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  20244. },
  20245. args: ["aString"],
  20246. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  20247. referencedClasses: [],
  20248. messageSends: ["settingValue:"]
  20249. }),
  20250. $globals.SmalltalkImage);
  20251. $core.addMethod(
  20252. $core.method({
  20253. selector: "deleteClass:",
  20254. protocol: 'private',
  20255. fn: function (aClass){
  20256. var self=this;
  20257. return $core.withContext(function($ctx1) {
  20258. $core.removeClass(aClass);
  20259. return self;
  20260. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  20261. },
  20262. args: ["aClass"],
  20263. 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)'>",
  20264. referencedClasses: [],
  20265. messageSends: []
  20266. }),
  20267. $globals.SmalltalkImage);
  20268. $core.addMethod(
  20269. $core.method({
  20270. selector: "deleteGlobalJsVariable:",
  20271. protocol: 'globals',
  20272. fn: function (aString){
  20273. var self=this;
  20274. return $core.withContext(function($ctx1) {
  20275. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  20276. }));
  20277. return self;
  20278. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  20279. },
  20280. args: ["aString"],
  20281. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  20282. referencedClasses: [],
  20283. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  20284. }),
  20285. $globals.SmalltalkImage);
  20286. $core.addMethod(
  20287. $core.method({
  20288. selector: "deletePackage:",
  20289. protocol: 'private',
  20290. fn: function (packageName){
  20291. var self=this;
  20292. return $core.withContext(function($ctx1) {
  20293. delete $core.packages[packageName];
  20294. return self;
  20295. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  20296. },
  20297. args: ["packageName"],
  20298. source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a\x09<inlineJS: 'delete $core.packages[packageName]'>",
  20299. referencedClasses: [],
  20300. messageSends: []
  20301. }),
  20302. $globals.SmalltalkImage);
  20303. $core.addMethod(
  20304. $core.method({
  20305. selector: "existsJsGlobal:",
  20306. protocol: 'testing',
  20307. fn: function (aString){
  20308. var self=this;
  20309. return $core.withContext(function($ctx1) {
  20310. return $recv($recv($globals.Platform)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  20311. return true;
  20312. }),(function(){
  20313. return false;
  20314. }));
  20315. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  20316. },
  20317. args: ["aString"],
  20318. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  20319. referencedClasses: ["Platform"],
  20320. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  20321. }),
  20322. $globals.SmalltalkImage);
  20323. $core.addMethod(
  20324. $core.method({
  20325. selector: "globalJsVariables",
  20326. protocol: 'globals',
  20327. fn: function (){
  20328. var self=this;
  20329. return $core.withContext(function($ctx1) {
  20330. return $core.globalJsVariables;
  20331. return self;
  20332. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  20333. },
  20334. args: [],
  20335. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<inlineJS: 'return $core.globalJsVariables'>",
  20336. referencedClasses: [],
  20337. messageSends: []
  20338. }),
  20339. $globals.SmalltalkImage);
  20340. $core.addMethod(
  20341. $core.method({
  20342. selector: "globals",
  20343. protocol: 'accessing',
  20344. fn: function (){
  20345. var self=this;
  20346. return $core.withContext(function($ctx1) {
  20347. return $globals;
  20348. return self;
  20349. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  20350. },
  20351. args: [],
  20352. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  20353. referencedClasses: [],
  20354. messageSends: []
  20355. }),
  20356. $globals.SmalltalkImage);
  20357. $core.addMethod(
  20358. $core.method({
  20359. selector: "includesKey:",
  20360. protocol: 'accessing',
  20361. fn: function (aKey){
  20362. var self=this;
  20363. return $core.withContext(function($ctx1) {
  20364. return $core.hasOwnProperty(aKey);
  20365. return self;
  20366. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  20367. },
  20368. args: ["aKey"],
  20369. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  20370. referencedClasses: [],
  20371. messageSends: []
  20372. }),
  20373. $globals.SmalltalkImage);
  20374. $core.addMethod(
  20375. $core.method({
  20376. selector: "isSmalltalkObject:",
  20377. protocol: 'testing',
  20378. fn: function (anObject){
  20379. var self=this;
  20380. return $core.withContext(function($ctx1) {
  20381. return anObject.klass != null;
  20382. return self;
  20383. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  20384. },
  20385. args: ["anObject"],
  20386. source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'klass' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09<inlineJS: 'return anObject.klass != null'>",
  20387. referencedClasses: [],
  20388. messageSends: []
  20389. }),
  20390. $globals.SmalltalkImage);
  20391. $core.addMethod(
  20392. $core.method({
  20393. selector: "optOut:",
  20394. protocol: 'accessing',
  20395. fn: function (anObject){
  20396. var self=this;
  20397. return $core.withContext(function($ctx1) {
  20398. anObject.klass = null;
  20399. return self;
  20400. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  20401. },
  20402. args: ["anObject"],
  20403. source: "optOut: anObject\x0a\x09\x22A Smalltalk object has a 'klass' property.\x0a\x09This shadows the property for anObject.\x0a\x09The object is treated as plain JS object following this.\x22\x0a\x09\x0a\x09<inlineJS: 'anObject.klass = null'>",
  20404. referencedClasses: [],
  20405. messageSends: []
  20406. }),
  20407. $globals.SmalltalkImage);
  20408. $core.addMethod(
  20409. $core.method({
  20410. selector: "packageAt:",
  20411. protocol: 'packages',
  20412. fn: function (packageName){
  20413. var self=this;
  20414. return $core.withContext(function($ctx1) {
  20415. return $core.packages[packageName];
  20416. return self;
  20417. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  20418. },
  20419. args: ["packageName"],
  20420. source: "packageAt: packageName\x0a\x09<inlineJS: 'return $core.packages[packageName]'>",
  20421. referencedClasses: [],
  20422. messageSends: []
  20423. }),
  20424. $globals.SmalltalkImage);
  20425. $core.addMethod(
  20426. $core.method({
  20427. selector: "packageAt:ifAbsent:",
  20428. protocol: 'packages',
  20429. fn: function (packageName,aBlock){
  20430. var self=this;
  20431. return $core.withContext(function($ctx1) {
  20432. var $1;
  20433. $1=self._packageAt_(packageName);
  20434. return $recv($1)._ifNil_(aBlock);
  20435. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  20436. },
  20437. args: ["packageName", "aBlock"],
  20438. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  20439. referencedClasses: [],
  20440. messageSends: ["ifNil:", "packageAt:"]
  20441. }),
  20442. $globals.SmalltalkImage);
  20443. $core.addMethod(
  20444. $core.method({
  20445. selector: "packages",
  20446. protocol: 'packages',
  20447. fn: function (){
  20448. var self=this;
  20449. return $core.withContext(function($ctx1) {
  20450. return Object.keys($core.packages).map(function(k) {
  20451. return $core.packages[k];
  20452. })
  20453. ;
  20454. return self;
  20455. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  20456. },
  20457. args: [],
  20458. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<inlineJS: '\x0a\x09\x09return Object.keys($core.packages).map(function(k) {\x0a\x09\x09\x09return $core.packages[k];\x0a\x09\x09})\x0a\x09'>",
  20459. referencedClasses: [],
  20460. messageSends: []
  20461. }),
  20462. $globals.SmalltalkImage);
  20463. $core.addMethod(
  20464. $core.method({
  20465. selector: "parse:",
  20466. protocol: 'accessing',
  20467. fn: function (aString){
  20468. var self=this;
  20469. var result;
  20470. return $core.withContext(function($ctx1) {
  20471. var $1;
  20472. $recv((function(){
  20473. return $core.withContext(function($ctx2) {
  20474. result=self._basicParse_(aString);
  20475. return result;
  20476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20477. }))._tryCatch_((function(ex){
  20478. return $core.withContext(function($ctx2) {
  20479. return $recv(self._parseError_parsing_(ex,aString))._signal();
  20480. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  20481. }));
  20482. $1=result;
  20483. $recv($1)._source_(aString);
  20484. return $recv($1)._yourself();
  20485. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  20486. },
  20487. args: ["aString"],
  20488. 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",
  20489. referencedClasses: [],
  20490. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  20491. }),
  20492. $globals.SmalltalkImage);
  20493. $core.addMethod(
  20494. $core.method({
  20495. selector: "parseError:parsing:",
  20496. protocol: 'error handling',
  20497. fn: function (anException,aString){
  20498. var self=this;
  20499. return $core.withContext(function($ctx1) {
  20500. var $1,$7,$6,$5,$8,$4,$3,$2;
  20501. $1=$recv($globals.ParseError)._new();
  20502. $7=$recv(anException)._basicAt_("line");
  20503. $ctx1.sendIdx["basicAt:"]=1;
  20504. $6="Parse error on line ".__comma($7);
  20505. $5=$recv($6).__comma(" column ");
  20506. $ctx1.sendIdx[","]=4;
  20507. $8=$recv(anException)._basicAt_("column");
  20508. $ctx1.sendIdx["basicAt:"]=2;
  20509. $4=$recv($5).__comma($8);
  20510. $ctx1.sendIdx[","]=3;
  20511. $3=$recv($4).__comma(" : Unexpected character ");
  20512. $ctx1.sendIdx[","]=2;
  20513. $2=$recv($3).__comma($recv(anException)._basicAt_("found"));
  20514. $ctx1.sendIdx[","]=1;
  20515. return $recv($1)._messageText_($2);
  20516. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  20517. },
  20518. args: ["anException", "aString"],
  20519. source: "parseError: anException parsing: aString\x0a\x09^ ParseError new messageText: 'Parse error on line ', (anException basicAt: 'line') ,' column ' , (anException basicAt: 'column') ,' : Unexpected character ', (anException basicAt: 'found')",
  20520. referencedClasses: ["ParseError"],
  20521. messageSends: ["messageText:", "new", ",", "basicAt:"]
  20522. }),
  20523. $globals.SmalltalkImage);
  20524. $core.addMethod(
  20525. $core.method({
  20526. selector: "pseudoVariableNames",
  20527. protocol: 'accessing',
  20528. fn: function (){
  20529. var self=this;
  20530. return ["self", "super", "nil", "true", "false", "thisContext"];
  20531. },
  20532. args: [],
  20533. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  20534. referencedClasses: [],
  20535. messageSends: []
  20536. }),
  20537. $globals.SmalltalkImage);
  20538. $core.addMethod(
  20539. $core.method({
  20540. selector: "readJSObject:",
  20541. protocol: 'accessing',
  20542. fn: function (anObject){
  20543. var self=this;
  20544. return $core.withContext(function($ctx1) {
  20545. return $core.readJSObject(anObject);
  20546. return self;
  20547. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  20548. },
  20549. args: ["anObject"],
  20550. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  20551. referencedClasses: [],
  20552. messageSends: []
  20553. }),
  20554. $globals.SmalltalkImage);
  20555. $core.addMethod(
  20556. $core.method({
  20557. selector: "removeClass:",
  20558. protocol: 'classes',
  20559. fn: function (aClass){
  20560. var self=this;
  20561. return $core.withContext(function($ctx1) {
  20562. var $1,$2,$4,$3;
  20563. $1=$recv(aClass)._isMetaclass();
  20564. if($core.assert($1)){
  20565. self._error_($recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  20566. };
  20567. self._deleteClass_(aClass);
  20568. $2=$recv($globals.SystemAnnouncer)._current();
  20569. $4=$recv($globals.ClassRemoved)._new();
  20570. $recv($4)._theClass_(aClass);
  20571. $3=$recv($4)._yourself();
  20572. $recv($2)._announce_($3);
  20573. return self;
  20574. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  20575. },
  20576. args: ["aClass"],
  20577. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [ self error: aClass asString, ' is a Metaclass and cannot be removed!' ].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  20578. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  20579. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  20580. }),
  20581. $globals.SmalltalkImage);
  20582. $core.addMethod(
  20583. $core.method({
  20584. selector: "removePackage:",
  20585. protocol: 'packages',
  20586. fn: function (packageName){
  20587. var self=this;
  20588. var pkg;
  20589. return $core.withContext(function($ctx1) {
  20590. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  20591. return $core.withContext(function($ctx2) {
  20592. return self._error_("Missing package: ".__comma(packageName));
  20593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20594. }));
  20595. $recv($recv(pkg)._classes())._do_((function(each){
  20596. return $core.withContext(function($ctx2) {
  20597. return self._removeClass_(each);
  20598. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  20599. }));
  20600. self._deletePackage_(packageName);
  20601. return self;
  20602. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  20603. },
  20604. args: ["packageName"],
  20605. 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 deletePackage: packageName",
  20606. referencedClasses: [],
  20607. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  20608. }),
  20609. $globals.SmalltalkImage);
  20610. $core.addMethod(
  20611. $core.method({
  20612. selector: "renamePackage:to:",
  20613. protocol: 'packages',
  20614. fn: function (packageName,newName){
  20615. var self=this;
  20616. var pkg;
  20617. return $core.withContext(function($ctx1) {
  20618. var $1,$2,$receiver;
  20619. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  20620. return $core.withContext(function($ctx2) {
  20621. $1="Missing package: ".__comma(packageName);
  20622. $ctx2.sendIdx[","]=1;
  20623. return self._error_($1);
  20624. $ctx2.sendIdx["error:"]=1;
  20625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20626. }));
  20627. $2=self._packageAt_(newName);
  20628. if(($receiver = $2) == null || $receiver.isNil){
  20629. $2;
  20630. } else {
  20631. self._error_("Already exists a package called: ".__comma(newName));
  20632. };
  20633. $recv(pkg)._name_(newName);
  20634. self._basicRegisterPackage_(pkg);
  20635. self._deletePackage_(packageName);
  20636. return self;
  20637. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  20638. },
  20639. args: ["packageName", "newName"],
  20640. 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\x09(self packageAt: newName) ifNotNil: [ self error: 'Already exists a package called: ', newName ].\x0a\x09pkg name: newName.\x0a\x09self basicRegisterPackage: pkg.\x0a\x09self deletePackage: packageName.",
  20641. referencedClasses: [],
  20642. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  20643. }),
  20644. $globals.SmalltalkImage);
  20645. $core.addMethod(
  20646. $core.method({
  20647. selector: "reservedWords",
  20648. protocol: 'accessing',
  20649. fn: function (){
  20650. var self=this;
  20651. return $core.withContext(function($ctx1) {
  20652. return $core.reservedWords;
  20653. return self;
  20654. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  20655. },
  20656. args: [],
  20657. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<inlineJS: 'return $core.reservedWords'>",
  20658. referencedClasses: [],
  20659. messageSends: []
  20660. }),
  20661. $globals.SmalltalkImage);
  20662. $core.addMethod(
  20663. $core.method({
  20664. selector: "settings",
  20665. protocol: 'accessing',
  20666. fn: function (){
  20667. var self=this;
  20668. return $globals.SmalltalkSettings;
  20669. },
  20670. args: [],
  20671. source: "settings\x0a\x09^ SmalltalkSettings",
  20672. referencedClasses: ["SmalltalkSettings"],
  20673. messageSends: []
  20674. }),
  20675. $globals.SmalltalkImage);
  20676. $core.addMethod(
  20677. $core.method({
  20678. selector: "version",
  20679. protocol: 'accessing',
  20680. fn: function (){
  20681. var self=this;
  20682. return "0.18.0";
  20683. },
  20684. args: [],
  20685. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.18.0'",
  20686. referencedClasses: [],
  20687. messageSends: []
  20688. }),
  20689. $globals.SmalltalkImage);
  20690. $globals.SmalltalkImage.klass.iVarNames = ['current'];
  20691. $core.addMethod(
  20692. $core.method({
  20693. selector: "current",
  20694. protocol: 'instance creation',
  20695. fn: function (){
  20696. var self=this;
  20697. return $core.withContext(function($ctx1) {
  20698. var $1,$receiver;
  20699. $1=self["@current"];
  20700. if(($receiver = $1) == null || $receiver.isNil){
  20701. self["@current"]=(
  20702. $ctx1.supercall = true,
  20703. ($globals.SmalltalkImage.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  20704. $ctx1.supercall = false;
  20705. return self["@current"];
  20706. } else {
  20707. self._deprecatedAPI();
  20708. return self["@current"];
  20709. };
  20710. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  20711. },
  20712. args: [],
  20713. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  20714. referencedClasses: [],
  20715. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  20716. }),
  20717. $globals.SmalltalkImage.klass);
  20718. $core.addMethod(
  20719. $core.method({
  20720. selector: "initialize",
  20721. protocol: 'initialization',
  20722. fn: function (){
  20723. var self=this;
  20724. var st;
  20725. return $core.withContext(function($ctx1) {
  20726. st=self._current();
  20727. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  20728. return self;
  20729. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  20730. },
  20731. args: [],
  20732. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  20733. referencedClasses: [],
  20734. messageSends: ["current", "at:put:", "globals"]
  20735. }),
  20736. $globals.SmalltalkImage.klass);
  20737. $core.addMethod(
  20738. $core.method({
  20739. selector: "new",
  20740. protocol: 'instance creation',
  20741. fn: function (){
  20742. var self=this;
  20743. return $core.withContext(function($ctx1) {
  20744. self._shouldNotImplement();
  20745. return self;
  20746. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  20747. },
  20748. args: [],
  20749. source: "new\x0a\x09self shouldNotImplement",
  20750. referencedClasses: [],
  20751. messageSends: ["shouldNotImplement"]
  20752. }),
  20753. $globals.SmalltalkImage.klass);
  20754. $core.addMethod(
  20755. $core.method({
  20756. selector: "importsString",
  20757. protocol: '*Kernel-Infrastructure',
  20758. fn: function (){
  20759. var self=this;
  20760. return $core.withContext(function($ctx1) {
  20761. var $3,$2,$1;
  20762. $3=$recv(self._key())._importsString();
  20763. $ctx1.sendIdx["importsString"]=1;
  20764. $2=$recv($3).__comma(" -> ");
  20765. $1=$recv($2).__comma($recv(self._value())._importsString());
  20766. $ctx1.sendIdx[","]=1;
  20767. return $1;
  20768. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.Association)});
  20769. },
  20770. args: [],
  20771. source: "importsString\x0a\x09\x22This is for use by package exporter.\x0a\x09It can fail for non-string keys and values.\x22\x0a\x0a\x09^ self key importsString, ' -> ', self value importsString",
  20772. referencedClasses: [],
  20773. messageSends: [",", "importsString", "key", "value"]
  20774. }),
  20775. $globals.Association);
  20776. $core.addMethod(
  20777. $core.method({
  20778. selector: "asJavaScriptPropertyName",
  20779. protocol: '*Kernel-Infrastructure',
  20780. fn: function (){
  20781. var self=this;
  20782. return $core.withContext(function($ctx1) {
  20783. return $core.st2prop(self);
  20784. return self;
  20785. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  20786. },
  20787. args: [],
  20788. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  20789. referencedClasses: [],
  20790. messageSends: []
  20791. }),
  20792. $globals.String);
  20793. $core.addMethod(
  20794. $core.method({
  20795. selector: "asSetting",
  20796. protocol: '*Kernel-Infrastructure',
  20797. fn: function (){
  20798. var self=this;
  20799. return $core.withContext(function($ctx1) {
  20800. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  20801. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  20802. },
  20803. args: [],
  20804. 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",
  20805. referencedClasses: ["Setting"],
  20806. messageSends: ["at:ifAbsent:"]
  20807. }),
  20808. $globals.String);
  20809. $core.addMethod(
  20810. $core.method({
  20811. selector: "asSettingIfAbsent:",
  20812. protocol: '*Kernel-Infrastructure',
  20813. fn: function (aDefaultValue){
  20814. var self=this;
  20815. return $core.withContext(function($ctx1) {
  20816. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  20817. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20818. },
  20819. args: ["aDefaultValue"],
  20820. 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",
  20821. referencedClasses: ["Setting"],
  20822. messageSends: ["at:ifAbsent:"]
  20823. }),
  20824. $globals.String);
  20825. $core.addMethod(
  20826. $core.method({
  20827. selector: "importsString",
  20828. protocol: '*Kernel-Infrastructure',
  20829. fn: function (){
  20830. var self=this;
  20831. return $core.withContext(function($ctx1) {
  20832. var $1;
  20833. $1=$recv("'".__comma(self._replace_with_("'","''"))).__comma("'");
  20834. $ctx1.sendIdx[","]=1;
  20835. return $1;
  20836. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.String)});
  20837. },
  20838. args: [],
  20839. source: "importsString\x0a\x09\x22Answer receiver as Smalltalk expression\x22\x0a\x09^ '''', (self replace: '''' with: ''''''), ''''",
  20840. referencedClasses: [],
  20841. messageSends: [",", "replace:with:"]
  20842. }),
  20843. $globals.String);
  20844. $core.addMethod(
  20845. $core.method({
  20846. selector: "settingValue",
  20847. protocol: '*Kernel-Infrastructure',
  20848. fn: function (){
  20849. var self=this;
  20850. return $core.withContext(function($ctx1) {
  20851. return $recv(self._asSetting())._value();
  20852. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  20853. },
  20854. args: [],
  20855. source: "settingValue\x0a\x09^ self asSetting value",
  20856. referencedClasses: [],
  20857. messageSends: ["value", "asSetting"]
  20858. }),
  20859. $globals.String);
  20860. $core.addMethod(
  20861. $core.method({
  20862. selector: "settingValue:",
  20863. protocol: '*Kernel-Infrastructure',
  20864. fn: function (aValue){
  20865. var self=this;
  20866. return $core.withContext(function($ctx1) {
  20867. return $recv(self._asSetting())._value_(aValue);
  20868. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  20869. },
  20870. args: ["aValue"],
  20871. 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",
  20872. referencedClasses: [],
  20873. messageSends: ["value:", "asSetting"]
  20874. }),
  20875. $globals.String);
  20876. $core.addMethod(
  20877. $core.method({
  20878. selector: "settingValueIfAbsent:",
  20879. protocol: '*Kernel-Infrastructure',
  20880. fn: function (aDefaultValue){
  20881. var self=this;
  20882. return $core.withContext(function($ctx1) {
  20883. return $recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  20884. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20885. },
  20886. args: ["aDefaultValue"],
  20887. 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",
  20888. referencedClasses: [],
  20889. messageSends: ["value", "asSettingIfAbsent:"]
  20890. }),
  20891. $globals.String);
  20892. });
  20893. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20894. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  20895. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20896. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  20897. $core.addPackage('Kernel-Promises');
  20898. $core.packages["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  20899. $core.packages["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20900. $core.addClass('Thenable', $globals.Object, [], 'Kernel-Promises');
  20901. $globals.Thenable.comment="I am the abstract base class for Promises.\x0a\x0aMy subclasses should wrap existing JS implementations.\x0a\x0aI contain methods that wrap Promises/A+ `.then` behaviour.";
  20902. $core.addMethod(
  20903. $core.method({
  20904. selector: "catch:",
  20905. protocol: 'promises',
  20906. fn: function (aBlock){
  20907. var self=this;
  20908. return $core.withContext(function($ctx1) {
  20909. return self.then(null, function (err) {return $core.seamless(function () {
  20910. return aBlock._value_(err);
  20911. })});
  20912. return self;
  20913. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.Thenable)});
  20914. },
  20915. args: ["aBlock"],
  20916. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  20917. referencedClasses: [],
  20918. messageSends: []
  20919. }),
  20920. $globals.Thenable);
  20921. $core.addMethod(
  20922. $core.method({
  20923. selector: "on:do:",
  20924. protocol: 'promises',
  20925. fn: function (aClass,aBlock){
  20926. var self=this;
  20927. return $core.withContext(function($ctx1) {
  20928. return self.then(null, function (err) {return $core.seamless(function () {
  20929. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  20930. else throw err;
  20931. })});
  20932. return self;
  20933. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Thenable)});
  20934. },
  20935. args: ["aClass", "aBlock"],
  20936. 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})})'>",
  20937. referencedClasses: [],
  20938. messageSends: []
  20939. }),
  20940. $globals.Thenable);
  20941. $core.addMethod(
  20942. $core.method({
  20943. selector: "on:do:catch:",
  20944. protocol: 'promises',
  20945. fn: function (aClass,aBlock,anotherBlock){
  20946. var self=this;
  20947. return $core.withContext(function($ctx1) {
  20948. return self.then(null, function (err) {return $core.seamless(function () {
  20949. try { if (err._isKindOf_(aClass)) return aBlock._value_(err); } catch (e) { err = e; }
  20950. return anotherBlock._value_(err);
  20951. })});
  20952. return self;
  20953. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Thenable)});
  20954. },
  20955. args: ["aClass", "aBlock", "anotherBlock"],
  20956. source: "on: aClass do: aBlock catch: anotherBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a try { if (err._isKindOf_(aClass)) return aBlock._value_(err); } catch (e) { err = e; }\x0a return anotherBlock._value_(err);\x0a})})'>",
  20957. referencedClasses: [],
  20958. messageSends: []
  20959. }),
  20960. $globals.Thenable);
  20961. $core.addMethod(
  20962. $core.method({
  20963. selector: "then:",
  20964. protocol: 'promises',
  20965. fn: function (aBlockOrArray){
  20966. var self=this;
  20967. return $core.withContext(function($ctx1) {
  20968. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  20969. return array.reduce(function (soFar, aBlock) {
  20970. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  20971. function (result) {return $core.seamless(function () {
  20972. if (Array.isArray(result)) {
  20973. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  20974. } else {
  20975. return aBlock._value_(result);
  20976. }
  20977. })} :
  20978. function (result) {return $core.seamless(function () {
  20979. return aBlock._value_(result);
  20980. })}
  20981. );
  20982. }, self);
  20983. return self;
  20984. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.Thenable)});
  20985. },
  20986. args: ["aBlockOrArray"],
  20987. 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)'>",
  20988. referencedClasses: [],
  20989. messageSends: []
  20990. }),
  20991. $globals.Thenable);
  20992. $core.addMethod(
  20993. $core.method({
  20994. selector: "then:catch:",
  20995. protocol: 'promises',
  20996. fn: function (aBlockOrArray,anotherBlock){
  20997. var self=this;
  20998. return $core.withContext(function($ctx1) {
  20999. return $recv(self._then_(aBlockOrArray))._catch_(anotherBlock);
  21000. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.Thenable)});
  21001. },
  21002. args: ["aBlockOrArray", "anotherBlock"],
  21003. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  21004. referencedClasses: [],
  21005. messageSends: ["catch:", "then:"]
  21006. }),
  21007. $globals.Thenable);
  21008. $core.addMethod(
  21009. $core.method({
  21010. selector: "then:on:do:",
  21011. protocol: 'promises',
  21012. fn: function (aBlockOrArray,aClass,aBlock){
  21013. var self=this;
  21014. return $core.withContext(function($ctx1) {
  21015. return $recv(self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  21016. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.Thenable)});
  21017. },
  21018. args: ["aBlockOrArray", "aClass", "aBlock"],
  21019. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  21020. referencedClasses: [],
  21021. messageSends: ["on:do:", "then:"]
  21022. }),
  21023. $globals.Thenable);
  21024. $core.addMethod(
  21025. $core.method({
  21026. selector: "then:on:do:catch:",
  21027. protocol: 'promises',
  21028. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21029. var self=this;
  21030. return $core.withContext(function($ctx1) {
  21031. return $recv($recv(self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21032. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Thenable)});
  21033. },
  21034. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21035. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  21036. referencedClasses: [],
  21037. messageSends: ["catch:", "on:do:", "then:"]
  21038. }),
  21039. $globals.Thenable);
  21040. $core.addClass('Promise', $globals.Thenable, [], 'Kernel-Promises');
  21041. $core.addMethod(
  21042. $core.method({
  21043. selector: "all:",
  21044. protocol: 'composites',
  21045. fn: function (aCollection){
  21046. var self=this;
  21047. return $core.withContext(function($ctx1) {
  21048. return Promise.all($recv(aCollection)._asArray());
  21049. return self;
  21050. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.klass)});
  21051. },
  21052. args: ["aCollection"],
  21053. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  21054. referencedClasses: [],
  21055. messageSends: []
  21056. }),
  21057. $globals.Promise.klass);
  21058. $core.addMethod(
  21059. $core.method({
  21060. selector: "any:",
  21061. protocol: 'composites',
  21062. fn: function (aCollection){
  21063. var self=this;
  21064. return $core.withContext(function($ctx1) {
  21065. return Promise.race($recv(aCollection)._asArray());
  21066. return self;
  21067. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.klass)});
  21068. },
  21069. args: ["aCollection"],
  21070. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  21071. referencedClasses: [],
  21072. messageSends: []
  21073. }),
  21074. $globals.Promise.klass);
  21075. $core.addMethod(
  21076. $core.method({
  21077. selector: "forBlock:",
  21078. protocol: 'instance creation',
  21079. fn: function (aBlock){
  21080. var self=this;
  21081. return $core.withContext(function($ctx1) {
  21082. return $recv(self._new())._then_(aBlock);
  21083. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.klass)});
  21084. },
  21085. args: ["aBlock"],
  21086. 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",
  21087. referencedClasses: [],
  21088. messageSends: ["then:", "new"]
  21089. }),
  21090. $globals.Promise.klass);
  21091. $core.addMethod(
  21092. $core.method({
  21093. selector: "new",
  21094. protocol: 'instance creation',
  21095. fn: function (){
  21096. var self=this;
  21097. return $core.withContext(function($ctx1) {
  21098. return Promise.resolve();
  21099. return self;
  21100. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.klass)});
  21101. },
  21102. args: [],
  21103. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  21104. referencedClasses: [],
  21105. messageSends: []
  21106. }),
  21107. $globals.Promise.klass);
  21108. $core.addMethod(
  21109. $core.method({
  21110. selector: "new:",
  21111. protocol: 'instance creation',
  21112. fn: function (aBlock){
  21113. var self=this;
  21114. return $core.withContext(function($ctx1) {
  21115. return new Promise(function (resolve, reject) {
  21116. var model = {value: resolve, signal: reject}; // TODO make faster
  21117. aBlock._value_(model);
  21118. });
  21119. return self;
  21120. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.klass)});
  21121. },
  21122. args: ["aBlock"],
  21123. 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}; // TODO make faster\x0a aBlock._value_(model);\x0a})'>",
  21124. referencedClasses: [],
  21125. messageSends: []
  21126. }),
  21127. $globals.Promise.klass);
  21128. $core.addMethod(
  21129. $core.method({
  21130. selector: "signal:",
  21131. protocol: 'instance creation',
  21132. fn: function (anObject){
  21133. var self=this;
  21134. return $core.withContext(function($ctx1) {
  21135. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  21136. return self;
  21137. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.klass)});
  21138. },
  21139. args: ["anObject"],
  21140. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  21141. referencedClasses: [],
  21142. messageSends: []
  21143. }),
  21144. $globals.Promise.klass);
  21145. $core.addMethod(
  21146. $core.method({
  21147. selector: "value:",
  21148. protocol: 'instance creation',
  21149. fn: function (anObject){
  21150. var self=this;
  21151. return $core.withContext(function($ctx1) {
  21152. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  21153. return self;
  21154. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.klass)});
  21155. },
  21156. args: ["anObject"],
  21157. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  21158. referencedClasses: [],
  21159. messageSends: []
  21160. }),
  21161. $globals.Promise.klass);
  21162. $core.addMethod(
  21163. $core.method({
  21164. selector: "catch:",
  21165. protocol: '*Kernel-Promises',
  21166. fn: function (aBlock){
  21167. var self=this;
  21168. return $core.withContext(function($ctx1) {
  21169. var js = self["@jsObject"];
  21170. if (typeof js.then === "function")
  21171. return $globals.Thenable.fn.prototype._catch_.call(js, aBlock);
  21172. else
  21173. return self._doesNotUnderstand_(
  21174. $globals.Message._new()
  21175. ._selector_("catch:")
  21176. ._arguments_([aBlock])
  21177. );
  21178. return self;
  21179. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21180. },
  21181. args: ["aBlock"],
  21182. source: "catch: aBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._catch_.call(js, aBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22catch:\x22)\x0a ._arguments_([aBlock])\x0a )'>",
  21183. referencedClasses: [],
  21184. messageSends: []
  21185. }),
  21186. $globals.JSObjectProxy);
  21187. $core.addMethod(
  21188. $core.method({
  21189. selector: "on:do:",
  21190. protocol: '*Kernel-Promises',
  21191. fn: function (aClass,aBlock){
  21192. var self=this;
  21193. return $core.withContext(function($ctx1) {
  21194. var js = self["@jsObject"];
  21195. if (typeof js.then === "function")
  21196. return $globals.Thenable.fn.prototype._on_do_.call(js, aClass, aBlock);
  21197. else
  21198. return self._doesNotUnderstand_(
  21199. $globals.Message._new()
  21200. ._selector_("on:do:")
  21201. ._arguments_([aClass, aBlock])
  21202. );
  21203. return self;
  21204. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21205. },
  21206. args: ["aClass", "aBlock"],
  21207. source: "on: aClass do: aBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._on_do_.call(js, aClass, aBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22on:do:\x22)\x0a ._arguments_([aClass, aBlock])\x0a )'>",
  21208. referencedClasses: [],
  21209. messageSends: []
  21210. }),
  21211. $globals.JSObjectProxy);
  21212. $core.addMethod(
  21213. $core.method({
  21214. selector: "on:do:catch:",
  21215. protocol: '*Kernel-Promises',
  21216. fn: function (aClass,aBlock,anotherBlock){
  21217. var self=this;
  21218. return $core.withContext(function($ctx1) {
  21219. var js = self["@jsObject"];
  21220. if (typeof js.then === "function")
  21221. return $globals.Thenable.fn.prototype._on_do_catch_.call(js, aClass, aBlock, anotherBlock);
  21222. else
  21223. return self._doesNotUnderstand_(
  21224. $globals.Message._new()
  21225. ._selector_("on:do:catch:")
  21226. ._arguments_([aClass, aBlock, anotherBlock])
  21227. );
  21228. return self;
  21229. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21230. },
  21231. args: ["aClass", "aBlock", "anotherBlock"],
  21232. source: "on: aClass do: aBlock catch: anotherBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._on_do_catch_.call(js, aClass, aBlock, anotherBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22on:do:catch:\x22)\x0a ._arguments_([aClass, aBlock, anotherBlock])\x0a )'>",
  21233. referencedClasses: [],
  21234. messageSends: []
  21235. }),
  21236. $globals.JSObjectProxy);
  21237. $core.addMethod(
  21238. $core.method({
  21239. selector: "then:",
  21240. protocol: '*Kernel-Promises',
  21241. fn: function (aBlockOrArray){
  21242. var self=this;
  21243. return $core.withContext(function($ctx1) {
  21244. var js = self["@jsObject"];
  21245. if (typeof js.then === "function")
  21246. return $globals.Thenable.fn.prototype._then_.call(js, aBlockOrArray);
  21247. else
  21248. return self._doesNotUnderstand_(
  21249. $globals.Message._new()
  21250. ._selector_("then:")
  21251. ._arguments_([aBlockOrArray])
  21252. );
  21253. return self;
  21254. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  21255. },
  21256. args: ["aBlockOrArray"],
  21257. source: "then: aBlockOrArray\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_.call(js, aBlockOrArray);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:\x22)\x0a ._arguments_([aBlockOrArray])\x0a )'>",
  21258. referencedClasses: [],
  21259. messageSends: []
  21260. }),
  21261. $globals.JSObjectProxy);
  21262. $core.addMethod(
  21263. $core.method({
  21264. selector: "then:catch:",
  21265. protocol: '*Kernel-Promises',
  21266. fn: function (aBlockOrArray,anotherBlock){
  21267. var self=this;
  21268. return $core.withContext(function($ctx1) {
  21269. var js = self["@jsObject"];
  21270. if (typeof js.then === "function")
  21271. return $globals.Thenable.fn.prototype._then_catch_.call(js, aBlockOrArray, anotherBlock);
  21272. else
  21273. return self._doesNotUnderstand_(
  21274. $globals.Message._new()
  21275. ._selector_("then:catch:")
  21276. ._arguments_([aBlockOrArray, anotherBlock])
  21277. );
  21278. return self;
  21279. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21280. },
  21281. args: ["aBlockOrArray", "anotherBlock"],
  21282. source: "then: aBlockOrArray catch: anotherBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_catch_.call(js, aBlockOrArray, anotherBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:catch:\x22)\x0a ._arguments_([aBlockOrArray, anotherBlock])\x0a )'>",
  21283. referencedClasses: [],
  21284. messageSends: []
  21285. }),
  21286. $globals.JSObjectProxy);
  21287. $core.addMethod(
  21288. $core.method({
  21289. selector: "then:on:do:",
  21290. protocol: '*Kernel-Promises',
  21291. fn: function (aBlockOrArray,aClass,aBlock){
  21292. var self=this;
  21293. return $core.withContext(function($ctx1) {
  21294. var js = self["@jsObject"];
  21295. if (typeof js.then === "function")
  21296. return $globals.Thenable.fn.prototype._then_on_do_.call(js, aBlockOrArray, aClass, aBlock);
  21297. else
  21298. return self._doesNotUnderstand_(
  21299. $globals.Message._new()
  21300. ._selector_("then:on:do:")
  21301. ._arguments_([aBlockOrArray, aClass, aBlock])
  21302. );
  21303. return self;
  21304. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21305. },
  21306. args: ["aBlockOrArray", "aClass", "aBlock"],
  21307. source: "then: aBlockOrArray on: aClass do: aBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_on_do_.call(js, aBlockOrArray, aClass, aBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:on:do:\x22)\x0a ._arguments_([aBlockOrArray, aClass, aBlock])\x0a )'>",
  21308. referencedClasses: [],
  21309. messageSends: []
  21310. }),
  21311. $globals.JSObjectProxy);
  21312. $core.addMethod(
  21313. $core.method({
  21314. selector: "then:on:do:catch:",
  21315. protocol: '*Kernel-Promises',
  21316. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21317. var self=this;
  21318. return $core.withContext(function($ctx1) {
  21319. var js = self["@jsObject"];
  21320. if (typeof js.then === "function")
  21321. return $globals.Thenable.fn.prototype._then_on_do_catch_.call(js, aBlockOrArray, aClass, aBlock, anotherBlock);
  21322. else
  21323. return self._doesNotUnderstand_(
  21324. $globals.Message._new()
  21325. ._selector_("then:on:do:catch:")
  21326. ._arguments_([aBlockOrArray, aClass, aBlock, anotherBlock])
  21327. );
  21328. return self;
  21329. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21330. },
  21331. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21332. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_on_do_catch_.call(js, aBlockOrArray, aClass, aBlock, anotherBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:on:do:catch:\x22)\x0a ._arguments_([aBlockOrArray, aClass, aBlock, anotherBlock])\x0a )'>",
  21333. referencedClasses: [],
  21334. messageSends: []
  21335. }),
  21336. $globals.JSObjectProxy);
  21337. });
  21338. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  21339. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  21340. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21341. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  21342. $core.addPackage('Kernel-Announcements');
  21343. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  21344. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21345. $core.addClass('AnnouncementSubscription', $globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  21346. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  21347. $core.addMethod(
  21348. $core.method({
  21349. selector: "announcementClass",
  21350. protocol: 'accessing',
  21351. fn: function (){
  21352. var self=this;
  21353. return self["@announcementClass"];
  21354. },
  21355. args: [],
  21356. source: "announcementClass\x0a\x09^ announcementClass",
  21357. referencedClasses: [],
  21358. messageSends: []
  21359. }),
  21360. $globals.AnnouncementSubscription);
  21361. $core.addMethod(
  21362. $core.method({
  21363. selector: "announcementClass:",
  21364. protocol: 'accessing',
  21365. fn: function (aClass){
  21366. var self=this;
  21367. self["@announcementClass"]=aClass;
  21368. return self;
  21369. },
  21370. args: ["aClass"],
  21371. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  21372. referencedClasses: [],
  21373. messageSends: []
  21374. }),
  21375. $globals.AnnouncementSubscription);
  21376. $core.addMethod(
  21377. $core.method({
  21378. selector: "deliver:",
  21379. protocol: 'announcing',
  21380. fn: function (anAnnouncement){
  21381. var self=this;
  21382. return $core.withContext(function($ctx1) {
  21383. var $1;
  21384. $1=self._handlesAnnouncement_(anAnnouncement);
  21385. if($core.assert($1)){
  21386. $recv(self._valuable())._value_(anAnnouncement);
  21387. };
  21388. return self;
  21389. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  21390. },
  21391. args: ["anAnnouncement"],
  21392. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  21393. referencedClasses: [],
  21394. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  21395. }),
  21396. $globals.AnnouncementSubscription);
  21397. $core.addMethod(
  21398. $core.method({
  21399. selector: "handlesAnnouncement:",
  21400. protocol: 'announcing',
  21401. fn: function (anAnnouncement){
  21402. var self=this;
  21403. return $core.withContext(function($ctx1) {
  21404. var $2,$3,$1,$receiver;
  21405. $2=$recv($globals.Smalltalk)._globals();
  21406. $ctx1.sendIdx["globals"]=1;
  21407. $3=$recv(self._announcementClass())._name();
  21408. $ctx1.sendIdx["name"]=1;
  21409. $1=$recv($2)._at_($3);
  21410. $ctx1.sendIdx["at:"]=1;
  21411. if(($receiver = $1) == null || $receiver.isNil){
  21412. return false;
  21413. } else {
  21414. var class_;
  21415. class_=$receiver;
  21416. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  21417. };
  21418. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  21419. },
  21420. args: ["anAnnouncement"],
  21421. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk globals at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]",
  21422. referencedClasses: ["Smalltalk"],
  21423. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  21424. }),
  21425. $globals.AnnouncementSubscription);
  21426. $core.addMethod(
  21427. $core.method({
  21428. selector: "receiver",
  21429. protocol: 'accessing',
  21430. fn: function (){
  21431. var self=this;
  21432. return $core.withContext(function($ctx1) {
  21433. return $recv(self._valuable())._receiver();
  21434. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  21435. },
  21436. args: [],
  21437. source: "receiver\x0a\x09^ self valuable receiver",
  21438. referencedClasses: [],
  21439. messageSends: ["receiver", "valuable"]
  21440. }),
  21441. $globals.AnnouncementSubscription);
  21442. $core.addMethod(
  21443. $core.method({
  21444. selector: "valuable",
  21445. protocol: 'accessing',
  21446. fn: function (){
  21447. var self=this;
  21448. return self["@valuable"];
  21449. },
  21450. args: [],
  21451. source: "valuable\x0a\x09^ valuable",
  21452. referencedClasses: [],
  21453. messageSends: []
  21454. }),
  21455. $globals.AnnouncementSubscription);
  21456. $core.addMethod(
  21457. $core.method({
  21458. selector: "valuable:",
  21459. protocol: 'accessing',
  21460. fn: function (aValuable){
  21461. var self=this;
  21462. self["@valuable"]=aValuable;
  21463. return self;
  21464. },
  21465. args: ["aValuable"],
  21466. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  21467. referencedClasses: [],
  21468. messageSends: []
  21469. }),
  21470. $globals.AnnouncementSubscription);
  21471. $core.addClass('AnnouncementValuable', $globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
  21472. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  21473. $core.addMethod(
  21474. $core.method({
  21475. selector: "receiver",
  21476. protocol: 'accessing',
  21477. fn: function (){
  21478. var self=this;
  21479. return self["@receiver"];
  21480. },
  21481. args: [],
  21482. source: "receiver\x0a\x09^ receiver",
  21483. referencedClasses: [],
  21484. messageSends: []
  21485. }),
  21486. $globals.AnnouncementValuable);
  21487. $core.addMethod(
  21488. $core.method({
  21489. selector: "receiver:",
  21490. protocol: 'accessing',
  21491. fn: function (anObject){
  21492. var self=this;
  21493. self["@receiver"]=anObject;
  21494. return self;
  21495. },
  21496. args: ["anObject"],
  21497. source: "receiver: anObject\x0a\x09receiver := anObject",
  21498. referencedClasses: [],
  21499. messageSends: []
  21500. }),
  21501. $globals.AnnouncementValuable);
  21502. $core.addMethod(
  21503. $core.method({
  21504. selector: "valuable",
  21505. protocol: 'accessing',
  21506. fn: function (){
  21507. var self=this;
  21508. return self["@valuable"];
  21509. },
  21510. args: [],
  21511. source: "valuable\x0a\x09^ valuable",
  21512. referencedClasses: [],
  21513. messageSends: []
  21514. }),
  21515. $globals.AnnouncementValuable);
  21516. $core.addMethod(
  21517. $core.method({
  21518. selector: "valuable:",
  21519. protocol: 'accessing',
  21520. fn: function (anObject){
  21521. var self=this;
  21522. self["@valuable"]=anObject;
  21523. return self;
  21524. },
  21525. args: ["anObject"],
  21526. source: "valuable: anObject\x0a\x09valuable := anObject",
  21527. referencedClasses: [],
  21528. messageSends: []
  21529. }),
  21530. $globals.AnnouncementValuable);
  21531. $core.addMethod(
  21532. $core.method({
  21533. selector: "value",
  21534. protocol: 'evaluating',
  21535. fn: function (){
  21536. var self=this;
  21537. return $core.withContext(function($ctx1) {
  21538. return $recv(self._valuable())._value();
  21539. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  21540. },
  21541. args: [],
  21542. source: "value\x0a\x09^ self valuable value",
  21543. referencedClasses: [],
  21544. messageSends: ["value", "valuable"]
  21545. }),
  21546. $globals.AnnouncementValuable);
  21547. $core.addMethod(
  21548. $core.method({
  21549. selector: "value:",
  21550. protocol: 'evaluating',
  21551. fn: function (anObject){
  21552. var self=this;
  21553. return $core.withContext(function($ctx1) {
  21554. return $recv(self._valuable())._value_(anObject);
  21555. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  21556. },
  21557. args: ["anObject"],
  21558. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  21559. referencedClasses: [],
  21560. messageSends: ["value:", "valuable"]
  21561. }),
  21562. $globals.AnnouncementValuable);
  21563. $core.addClass('Announcer', $globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  21564. $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' ].";
  21565. $core.addMethod(
  21566. $core.method({
  21567. selector: "announce:",
  21568. protocol: 'announcing',
  21569. fn: function (anAnnouncement){
  21570. var self=this;
  21571. return $core.withContext(function($ctx1) {
  21572. $recv(self["@subscriptions"])._do_((function(each){
  21573. return $core.withContext(function($ctx2) {
  21574. return $recv(each)._deliver_(anAnnouncement);
  21575. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21576. }));
  21577. return self;
  21578. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  21579. },
  21580. args: ["anAnnouncement"],
  21581. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  21582. referencedClasses: [],
  21583. messageSends: ["do:", "deliver:"]
  21584. }),
  21585. $globals.Announcer);
  21586. $core.addMethod(
  21587. $core.method({
  21588. selector: "initialize",
  21589. protocol: 'initialization',
  21590. fn: function (){
  21591. var self=this;
  21592. return $core.withContext(function($ctx1) {
  21593. (
  21594. $ctx1.supercall = true,
  21595. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  21596. $ctx1.supercall = false;
  21597. self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  21598. return self;
  21599. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  21600. },
  21601. args: [],
  21602. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  21603. referencedClasses: ["OrderedCollection"],
  21604. messageSends: ["initialize", "new"]
  21605. }),
  21606. $globals.Announcer);
  21607. $core.addMethod(
  21608. $core.method({
  21609. selector: "on:do:",
  21610. protocol: 'subscribing',
  21611. fn: function (aClass,aBlock){
  21612. var self=this;
  21613. return $core.withContext(function($ctx1) {
  21614. self._on_do_for_(aClass,aBlock,nil);
  21615. return self;
  21616. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  21617. },
  21618. args: ["aClass", "aBlock"],
  21619. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  21620. referencedClasses: [],
  21621. messageSends: ["on:do:for:"]
  21622. }),
  21623. $globals.Announcer);
  21624. $core.addMethod(
  21625. $core.method({
  21626. selector: "on:do:for:",
  21627. protocol: 'subscribing',
  21628. fn: function (aClass,aBlock,aReceiver){
  21629. var self=this;
  21630. return $core.withContext(function($ctx1) {
  21631. var $1,$3,$5,$6,$4,$2;
  21632. $1=self["@subscriptions"];
  21633. $3=$recv($globals.AnnouncementSubscription)._new();
  21634. $ctx1.sendIdx["new"]=1;
  21635. $5=$recv($globals.AnnouncementValuable)._new();
  21636. $recv($5)._valuable_(aBlock);
  21637. $recv($5)._receiver_(aReceiver);
  21638. $6=$recv($5)._yourself();
  21639. $ctx1.sendIdx["yourself"]=1;
  21640. $4=$6;
  21641. $recv($3)._valuable_($4);
  21642. $ctx1.sendIdx["valuable:"]=1;
  21643. $recv($3)._announcementClass_(aClass);
  21644. $2=$recv($3)._yourself();
  21645. $recv($1)._add_($2);
  21646. return self;
  21647. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  21648. },
  21649. args: ["aClass", "aBlock", "aReceiver"],
  21650. 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)",
  21651. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  21652. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  21653. }),
  21654. $globals.Announcer);
  21655. $core.addMethod(
  21656. $core.method({
  21657. selector: "on:doOnce:",
  21658. protocol: 'subscribing',
  21659. fn: function (aClass,aBlock){
  21660. var self=this;
  21661. var subscription;
  21662. return $core.withContext(function($ctx1) {
  21663. var $1;
  21664. $1=$recv($globals.AnnouncementSubscription)._new();
  21665. $recv($1)._announcementClass_(aClass);
  21666. subscription=$recv($1)._yourself();
  21667. $recv(subscription)._valuable_((function(ann){
  21668. return $core.withContext(function($ctx2) {
  21669. $recv(self["@subscriptions"])._remove_(subscription);
  21670. return $recv(aBlock)._value_(ann);
  21671. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  21672. }));
  21673. $recv(self["@subscriptions"])._add_(subscription);
  21674. return self;
  21675. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  21676. },
  21677. args: ["aClass", "aBlock"],
  21678. 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",
  21679. referencedClasses: ["AnnouncementSubscription"],
  21680. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  21681. }),
  21682. $globals.Announcer);
  21683. $core.addMethod(
  21684. $core.method({
  21685. selector: "on:send:to:",
  21686. protocol: 'subscribing',
  21687. fn: function (aClass,aSelector,anObject){
  21688. var self=this;
  21689. return $core.withContext(function($ctx1) {
  21690. var $1,$3,$5,$6,$4,$2;
  21691. $1=self["@subscriptions"];
  21692. $3=$recv($globals.AnnouncementSubscription)._new();
  21693. $ctx1.sendIdx["new"]=1;
  21694. $5=$recv($globals.MessageSend)._new();
  21695. $recv($5)._receiver_(anObject);
  21696. $recv($5)._selector_(aSelector);
  21697. $6=$recv($5)._yourself();
  21698. $ctx1.sendIdx["yourself"]=1;
  21699. $4=$6;
  21700. $recv($3)._valuable_($4);
  21701. $recv($3)._announcementClass_(aClass);
  21702. $2=$recv($3)._yourself();
  21703. $recv($1)._add_($2);
  21704. return self;
  21705. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  21706. },
  21707. args: ["aClass", "aSelector", "anObject"],
  21708. 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)",
  21709. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  21710. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  21711. }),
  21712. $globals.Announcer);
  21713. $core.addMethod(
  21714. $core.method({
  21715. selector: "unsubscribe:",
  21716. protocol: 'subscribing',
  21717. fn: function (anObject){
  21718. var self=this;
  21719. return $core.withContext(function($ctx1) {
  21720. self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){
  21721. return $core.withContext(function($ctx2) {
  21722. return $recv($recv(each)._receiver()).__eq(anObject);
  21723. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21724. }));
  21725. return self;
  21726. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  21727. },
  21728. args: ["anObject"],
  21729. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  21730. referencedClasses: [],
  21731. messageSends: ["reject:", "=", "receiver"]
  21732. }),
  21733. $globals.Announcer);
  21734. $core.addClass('SystemAnnouncer', $globals.Announcer, [], 'Kernel-Announcements');
  21735. $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`";
  21736. $globals.SystemAnnouncer.klass.iVarNames = ['current'];
  21737. $core.addMethod(
  21738. $core.method({
  21739. selector: "current",
  21740. protocol: 'accessing',
  21741. fn: function (){
  21742. var self=this;
  21743. return $core.withContext(function($ctx1) {
  21744. var $1,$receiver;
  21745. $1=self["@current"];
  21746. if(($receiver = $1) == null || $receiver.isNil){
  21747. self["@current"]=(
  21748. $ctx1.supercall = true,
  21749. ($globals.SystemAnnouncer.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  21750. $ctx1.supercall = false;
  21751. return self["@current"];
  21752. } else {
  21753. return $1;
  21754. };
  21755. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)});
  21756. },
  21757. args: [],
  21758. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  21759. referencedClasses: [],
  21760. messageSends: ["ifNil:", "new"]
  21761. }),
  21762. $globals.SystemAnnouncer.klass);
  21763. $core.addMethod(
  21764. $core.method({
  21765. selector: "new",
  21766. protocol: 'instance creation',
  21767. fn: function (){
  21768. var self=this;
  21769. return $core.withContext(function($ctx1) {
  21770. self._shouldNotImplement();
  21771. return self;
  21772. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)});
  21773. },
  21774. args: [],
  21775. source: "new\x0a\x09self shouldNotImplement",
  21776. referencedClasses: [],
  21777. messageSends: ["shouldNotImplement"]
  21778. }),
  21779. $globals.SystemAnnouncer.klass);
  21780. $core.addClass('SystemAnnouncement', $globals.Object, [], 'Kernel-Announcements');
  21781. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  21782. $core.addMethod(
  21783. $core.method({
  21784. selector: "classTag",
  21785. protocol: 'accessing',
  21786. fn: function (){
  21787. var self=this;
  21788. return "announcement";
  21789. },
  21790. args: [],
  21791. 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'",
  21792. referencedClasses: [],
  21793. messageSends: []
  21794. }),
  21795. $globals.SystemAnnouncement.klass);
  21796. $core.addClass('ClassAnnouncement', $globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  21797. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  21798. $core.addMethod(
  21799. $core.method({
  21800. selector: "theClass",
  21801. protocol: 'accessing',
  21802. fn: function (){
  21803. var self=this;
  21804. return self["@theClass"];
  21805. },
  21806. args: [],
  21807. source: "theClass\x0a\x09^ theClass",
  21808. referencedClasses: [],
  21809. messageSends: []
  21810. }),
  21811. $globals.ClassAnnouncement);
  21812. $core.addMethod(
  21813. $core.method({
  21814. selector: "theClass:",
  21815. protocol: 'accessing',
  21816. fn: function (aClass){
  21817. var self=this;
  21818. self["@theClass"]=aClass;
  21819. return self;
  21820. },
  21821. args: ["aClass"],
  21822. source: "theClass: aClass\x0a\x09theClass := aClass",
  21823. referencedClasses: [],
  21824. messageSends: []
  21825. }),
  21826. $globals.ClassAnnouncement);
  21827. $core.addClass('ClassAdded', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21828. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  21829. $core.addClass('ClassCommentChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21830. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  21831. $core.addClass('ClassDefinitionChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21832. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  21833. $core.addClass('ClassMigrated', $globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  21834. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  21835. $core.addMethod(
  21836. $core.method({
  21837. selector: "oldClass",
  21838. protocol: 'accessing',
  21839. fn: function (){
  21840. var self=this;
  21841. return self["@oldClass"];
  21842. },
  21843. args: [],
  21844. source: "oldClass\x0a\x09^ oldClass",
  21845. referencedClasses: [],
  21846. messageSends: []
  21847. }),
  21848. $globals.ClassMigrated);
  21849. $core.addMethod(
  21850. $core.method({
  21851. selector: "oldClass:",
  21852. protocol: 'accessing',
  21853. fn: function (aClass){
  21854. var self=this;
  21855. self["@oldClass"]=aClass;
  21856. return self;
  21857. },
  21858. args: ["aClass"],
  21859. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  21860. referencedClasses: [],
  21861. messageSends: []
  21862. }),
  21863. $globals.ClassMigrated);
  21864. $core.addClass('ClassMoved', $globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  21865. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  21866. $core.addMethod(
  21867. $core.method({
  21868. selector: "oldPackage",
  21869. protocol: 'accessing',
  21870. fn: function (){
  21871. var self=this;
  21872. return self["@oldPackage"];
  21873. },
  21874. args: [],
  21875. source: "oldPackage\x0a\x09^ oldPackage",
  21876. referencedClasses: [],
  21877. messageSends: []
  21878. }),
  21879. $globals.ClassMoved);
  21880. $core.addMethod(
  21881. $core.method({
  21882. selector: "oldPackage:",
  21883. protocol: 'accessing',
  21884. fn: function (aPackage){
  21885. var self=this;
  21886. self["@oldPackage"]=aPackage;
  21887. return self;
  21888. },
  21889. args: ["aPackage"],
  21890. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  21891. referencedClasses: [],
  21892. messageSends: []
  21893. }),
  21894. $globals.ClassMoved);
  21895. $core.addClass('ClassRemoved', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21896. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  21897. $core.addClass('ClassRenamed', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21898. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  21899. $core.addClass('MethodAnnouncement', $globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  21900. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  21901. $core.addMethod(
  21902. $core.method({
  21903. selector: "method",
  21904. protocol: 'accessing',
  21905. fn: function (){
  21906. var self=this;
  21907. return self["@method"];
  21908. },
  21909. args: [],
  21910. source: "method\x0a\x09^ method",
  21911. referencedClasses: [],
  21912. messageSends: []
  21913. }),
  21914. $globals.MethodAnnouncement);
  21915. $core.addMethod(
  21916. $core.method({
  21917. selector: "method:",
  21918. protocol: 'accessing',
  21919. fn: function (aCompiledMethod){
  21920. var self=this;
  21921. self["@method"]=aCompiledMethod;
  21922. return self;
  21923. },
  21924. args: ["aCompiledMethod"],
  21925. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  21926. referencedClasses: [],
  21927. messageSends: []
  21928. }),
  21929. $globals.MethodAnnouncement);
  21930. $core.addClass('MethodAdded', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21931. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  21932. $core.addClass('MethodModified', $globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  21933. $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.";
  21934. $core.addMethod(
  21935. $core.method({
  21936. selector: "oldMethod",
  21937. protocol: 'accessing',
  21938. fn: function (){
  21939. var self=this;
  21940. return self["@oldMethod"];
  21941. },
  21942. args: [],
  21943. source: "oldMethod\x0a\x09^ oldMethod",
  21944. referencedClasses: [],
  21945. messageSends: []
  21946. }),
  21947. $globals.MethodModified);
  21948. $core.addMethod(
  21949. $core.method({
  21950. selector: "oldMethod:",
  21951. protocol: 'accessing',
  21952. fn: function (aMethod){
  21953. var self=this;
  21954. self["@oldMethod"]=aMethod;
  21955. return self;
  21956. },
  21957. args: ["aMethod"],
  21958. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  21959. referencedClasses: [],
  21960. messageSends: []
  21961. }),
  21962. $globals.MethodModified);
  21963. $core.addClass('MethodMoved', $globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  21964. $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.";
  21965. $core.addMethod(
  21966. $core.method({
  21967. selector: "oldProtocol",
  21968. protocol: 'accessing',
  21969. fn: function (){
  21970. var self=this;
  21971. return self["@oldProtocol"];
  21972. },
  21973. args: [],
  21974. source: "oldProtocol\x0a\x09^ oldProtocol",
  21975. referencedClasses: [],
  21976. messageSends: []
  21977. }),
  21978. $globals.MethodMoved);
  21979. $core.addMethod(
  21980. $core.method({
  21981. selector: "oldProtocol:",
  21982. protocol: 'accessing',
  21983. fn: function (aString){
  21984. var self=this;
  21985. self["@oldProtocol"]=aString;
  21986. return self;
  21987. },
  21988. args: ["aString"],
  21989. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  21990. referencedClasses: [],
  21991. messageSends: []
  21992. }),
  21993. $globals.MethodMoved);
  21994. $core.addClass('MethodRemoved', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21995. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  21996. $core.addClass('PackageAnnouncement', $globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  21997. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  21998. $core.addMethod(
  21999. $core.method({
  22000. selector: "package",
  22001. protocol: 'accessing',
  22002. fn: function (){
  22003. var self=this;
  22004. return self["@package"];
  22005. },
  22006. args: [],
  22007. source: "package\x0a\x09^ package",
  22008. referencedClasses: [],
  22009. messageSends: []
  22010. }),
  22011. $globals.PackageAnnouncement);
  22012. $core.addMethod(
  22013. $core.method({
  22014. selector: "package:",
  22015. protocol: 'accessing',
  22016. fn: function (aPackage){
  22017. var self=this;
  22018. self["@package"]=aPackage;
  22019. return self;
  22020. },
  22021. args: ["aPackage"],
  22022. source: "package: aPackage\x0a\x09package := aPackage",
  22023. referencedClasses: [],
  22024. messageSends: []
  22025. }),
  22026. $globals.PackageAnnouncement);
  22027. $core.addClass('PackageAdded', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  22028. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  22029. $core.addClass('PackageClean', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  22030. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  22031. $core.addClass('PackageDirty', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  22032. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  22033. $core.addClass('PackageRemoved', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  22034. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  22035. $core.addClass('ProtocolAnnouncement', $globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  22036. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  22037. $core.addMethod(
  22038. $core.method({
  22039. selector: "package",
  22040. protocol: 'accessing',
  22041. fn: function (){
  22042. var self=this;
  22043. return $core.withContext(function($ctx1) {
  22044. var $1,$receiver;
  22045. $1=self._theClass();
  22046. if(($receiver = $1) == null || $receiver.isNil){
  22047. return $1;
  22048. } else {
  22049. var class_;
  22050. class_=$receiver;
  22051. return $recv(class_)._packageOfProtocol_(self._protocol());
  22052. };
  22053. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  22054. },
  22055. args: [],
  22056. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  22057. referencedClasses: [],
  22058. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  22059. }),
  22060. $globals.ProtocolAnnouncement);
  22061. $core.addMethod(
  22062. $core.method({
  22063. selector: "protocol",
  22064. protocol: 'accessing',
  22065. fn: function (){
  22066. var self=this;
  22067. return self["@protocol"];
  22068. },
  22069. args: [],
  22070. source: "protocol\x0a\x09^ protocol",
  22071. referencedClasses: [],
  22072. messageSends: []
  22073. }),
  22074. $globals.ProtocolAnnouncement);
  22075. $core.addMethod(
  22076. $core.method({
  22077. selector: "protocol:",
  22078. protocol: 'accessing',
  22079. fn: function (aString){
  22080. var self=this;
  22081. self["@protocol"]=aString;
  22082. return self;
  22083. },
  22084. args: ["aString"],
  22085. source: "protocol: aString\x0a\x09protocol := aString",
  22086. referencedClasses: [],
  22087. messageSends: []
  22088. }),
  22089. $globals.ProtocolAnnouncement);
  22090. $core.addMethod(
  22091. $core.method({
  22092. selector: "theClass",
  22093. protocol: 'accessing',
  22094. fn: function (){
  22095. var self=this;
  22096. return self["@theClass"];
  22097. },
  22098. args: [],
  22099. source: "theClass\x0a\x09^ theClass",
  22100. referencedClasses: [],
  22101. messageSends: []
  22102. }),
  22103. $globals.ProtocolAnnouncement);
  22104. $core.addMethod(
  22105. $core.method({
  22106. selector: "theClass:",
  22107. protocol: 'accessing',
  22108. fn: function (aClass){
  22109. var self=this;
  22110. self["@theClass"]=aClass;
  22111. return self;
  22112. },
  22113. args: ["aClass"],
  22114. source: "theClass: aClass\x0a\x09theClass := aClass",
  22115. referencedClasses: [],
  22116. messageSends: []
  22117. }),
  22118. $globals.ProtocolAnnouncement);
  22119. $core.addClass('ProtocolAdded', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  22120. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  22121. $core.addClass('ProtocolRemoved', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  22122. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  22123. });
  22124. define('amber_core/Platform-Services',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  22125. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  22126. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  22127. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  22128. $core.addPackage('Platform-Services');
  22129. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  22130. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  22131. $core.addClass('ConsoleErrorHandler', $globals.Object, [], 'Platform-Services');
  22132. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  22133. $core.addMethod(
  22134. $core.method({
  22135. selector: "handleError:",
  22136. protocol: 'error handling',
  22137. fn: function (anError){
  22138. var self=this;
  22139. return $core.withContext(function($ctx1) {
  22140. var $1,$receiver;
  22141. $1=$recv(anError)._context();
  22142. $ctx1.sendIdx["context"]=1;
  22143. if(($receiver = $1) == null || $receiver.isNil){
  22144. $1;
  22145. } else {
  22146. self._logErrorContext_($recv(anError)._context());
  22147. };
  22148. self._logError_(anError);
  22149. return self;
  22150. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  22151. },
  22152. args: ["anError"],
  22153. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  22154. referencedClasses: [],
  22155. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  22156. }),
  22157. $globals.ConsoleErrorHandler);
  22158. $core.addMethod(
  22159. $core.method({
  22160. selector: "log:",
  22161. protocol: 'private',
  22162. fn: function (aString){
  22163. var self=this;
  22164. return $core.withContext(function($ctx1) {
  22165. $recv(console)._log_(aString);
  22166. return self;
  22167. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  22168. },
  22169. args: ["aString"],
  22170. source: "log: aString\x0a\x09console log: aString",
  22171. referencedClasses: [],
  22172. messageSends: ["log:"]
  22173. }),
  22174. $globals.ConsoleErrorHandler);
  22175. $core.addMethod(
  22176. $core.method({
  22177. selector: "logContext:",
  22178. protocol: 'private',
  22179. fn: function (aContext){
  22180. var self=this;
  22181. return $core.withContext(function($ctx1) {
  22182. var $1,$receiver;
  22183. $1=$recv(aContext)._home();
  22184. $ctx1.sendIdx["home"]=1;
  22185. if(($receiver = $1) == null || $receiver.isNil){
  22186. $1;
  22187. } else {
  22188. self._logContext_($recv(aContext)._home());
  22189. };
  22190. self._log_($recv(aContext)._asString());
  22191. return self;
  22192. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  22193. },
  22194. args: ["aContext"],
  22195. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  22196. referencedClasses: [],
  22197. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  22198. }),
  22199. $globals.ConsoleErrorHandler);
  22200. $core.addMethod(
  22201. $core.method({
  22202. selector: "logError:",
  22203. protocol: 'private',
  22204. fn: function (anError){
  22205. var self=this;
  22206. return $core.withContext(function($ctx1) {
  22207. self._log_($recv(anError)._messageText());
  22208. return self;
  22209. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  22210. },
  22211. args: ["anError"],
  22212. source: "logError: anError\x0a\x09self log: anError messageText",
  22213. referencedClasses: [],
  22214. messageSends: ["log:", "messageText"]
  22215. }),
  22216. $globals.ConsoleErrorHandler);
  22217. $core.addMethod(
  22218. $core.method({
  22219. selector: "logErrorContext:",
  22220. protocol: 'private',
  22221. fn: function (aContext){
  22222. var self=this;
  22223. return $core.withContext(function($ctx1) {
  22224. var $1,$receiver;
  22225. if(($receiver = aContext) == null || $receiver.isNil){
  22226. aContext;
  22227. } else {
  22228. $1=$recv(aContext)._home();
  22229. $ctx1.sendIdx["home"]=1;
  22230. if(($receiver = $1) == null || $receiver.isNil){
  22231. $1;
  22232. } else {
  22233. self._logContext_($recv(aContext)._home());
  22234. };
  22235. };
  22236. return self;
  22237. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  22238. },
  22239. args: ["aContext"],
  22240. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  22241. referencedClasses: [],
  22242. messageSends: ["ifNotNil:", "home", "logContext:"]
  22243. }),
  22244. $globals.ConsoleErrorHandler);
  22245. $globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  22246. $core.addMethod(
  22247. $core.method({
  22248. selector: "initialize",
  22249. protocol: 'initialization',
  22250. fn: function (){
  22251. var self=this;
  22252. return $core.withContext(function($ctx1) {
  22253. $recv($globals.ErrorHandler)._registerIfNone_(self._new());
  22254. return self;
  22255. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)});
  22256. },
  22257. args: [],
  22258. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  22259. referencedClasses: ["ErrorHandler"],
  22260. messageSends: ["registerIfNone:", "new"]
  22261. }),
  22262. $globals.ConsoleErrorHandler.klass);
  22263. $core.addClass('ConsoleTranscript', $globals.Object, ['textarea'], 'Platform-Services');
  22264. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  22265. $core.addMethod(
  22266. $core.method({
  22267. selector: "clear",
  22268. protocol: 'printing',
  22269. fn: function (){
  22270. var self=this;
  22271. return self;
  22272. },
  22273. args: [],
  22274. source: "clear\x0a\x09\x22no op\x22",
  22275. referencedClasses: [],
  22276. messageSends: []
  22277. }),
  22278. $globals.ConsoleTranscript);
  22279. $core.addMethod(
  22280. $core.method({
  22281. selector: "cr",
  22282. protocol: 'printing',
  22283. fn: function (){
  22284. var self=this;
  22285. return self;
  22286. },
  22287. args: [],
  22288. source: "cr\x0a\x09\x22no op\x22",
  22289. referencedClasses: [],
  22290. messageSends: []
  22291. }),
  22292. $globals.ConsoleTranscript);
  22293. $core.addMethod(
  22294. $core.method({
  22295. selector: "open",
  22296. protocol: 'actions',
  22297. fn: function (){
  22298. var self=this;
  22299. return self;
  22300. },
  22301. args: [],
  22302. source: "open",
  22303. referencedClasses: [],
  22304. messageSends: []
  22305. }),
  22306. $globals.ConsoleTranscript);
  22307. $core.addMethod(
  22308. $core.method({
  22309. selector: "show:",
  22310. protocol: 'printing',
  22311. fn: function (anObject){
  22312. var self=this;
  22313. return $core.withContext(function($ctx1) {
  22314. console.log(String($recv(anObject)._asString()));
  22315. return self;
  22316. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  22317. },
  22318. args: ["anObject"],
  22319. 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()))'>",
  22320. referencedClasses: [],
  22321. messageSends: []
  22322. }),
  22323. $globals.ConsoleTranscript);
  22324. $core.addMethod(
  22325. $core.method({
  22326. selector: "initialize",
  22327. protocol: 'initialization',
  22328. fn: function (){
  22329. var self=this;
  22330. return $core.withContext(function($ctx1) {
  22331. $recv($globals.Transcript)._registerIfNone_(self._new());
  22332. return self;
  22333. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
  22334. },
  22335. args: [],
  22336. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  22337. referencedClasses: ["Transcript"],
  22338. messageSends: ["registerIfNone:", "new"]
  22339. }),
  22340. $globals.ConsoleTranscript.klass);
  22341. $core.addClass('Environment', $globals.Object, [], 'Platform-Services');
  22342. $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.";
  22343. $core.addMethod(
  22344. $core.method({
  22345. selector: "addInstVarNamed:to:",
  22346. protocol: 'compiling',
  22347. fn: function (aString,aClass){
  22348. var self=this;
  22349. return $core.withContext(function($ctx1) {
  22350. var $1,$2,$3,$5,$4;
  22351. $1=self._classBuilder();
  22352. $2=$recv(aClass)._superclass();
  22353. $3=$recv(aClass)._name();
  22354. $ctx1.sendIdx["name"]=1;
  22355. $5=$recv($recv(aClass)._instanceVariableNames())._copy();
  22356. $recv($5)._add_(aString);
  22357. $4=$recv($5)._yourself();
  22358. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$recv($recv(aClass)._package())._name());
  22359. return self;
  22360. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  22361. },
  22362. args: ["aString", "aClass"],
  22363. source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name",
  22364. referencedClasses: [],
  22365. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  22366. }),
  22367. $globals.Environment);
  22368. $core.addMethod(
  22369. $core.method({
  22370. selector: "allSelectors",
  22371. protocol: 'accessing',
  22372. fn: function (){
  22373. var self=this;
  22374. return $core.withContext(function($ctx1) {
  22375. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  22376. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  22377. },
  22378. args: [],
  22379. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  22380. referencedClasses: ["Smalltalk"],
  22381. messageSends: ["allSelectors", "core"]
  22382. }),
  22383. $globals.Environment);
  22384. $core.addMethod(
  22385. $core.method({
  22386. selector: "availableClassNames",
  22387. protocol: 'accessing',
  22388. fn: function (){
  22389. var self=this;
  22390. return $core.withContext(function($ctx1) {
  22391. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  22392. return $core.withContext(function($ctx2) {
  22393. return $recv(each)._name();
  22394. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22395. }));
  22396. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  22397. },
  22398. args: [],
  22399. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  22400. referencedClasses: ["Smalltalk"],
  22401. messageSends: ["collect:", "classes", "name"]
  22402. }),
  22403. $globals.Environment);
  22404. $core.addMethod(
  22405. $core.method({
  22406. selector: "availablePackageNames",
  22407. protocol: 'accessing',
  22408. fn: function (){
  22409. var self=this;
  22410. return $core.withContext(function($ctx1) {
  22411. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  22412. return $core.withContext(function($ctx2) {
  22413. return $recv(each)._name();
  22414. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22415. }));
  22416. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  22417. },
  22418. args: [],
  22419. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  22420. referencedClasses: ["Smalltalk"],
  22421. messageSends: ["collect:", "packages", "name"]
  22422. }),
  22423. $globals.Environment);
  22424. $core.addMethod(
  22425. $core.method({
  22426. selector: "availableProtocolsFor:",
  22427. protocol: 'accessing',
  22428. fn: function (aClass){
  22429. var self=this;
  22430. var protocols;
  22431. return $core.withContext(function($ctx1) {
  22432. var $1,$receiver;
  22433. protocols=$recv(aClass)._protocols();
  22434. $1=$recv(aClass)._superclass();
  22435. $ctx1.sendIdx["superclass"]=1;
  22436. if(($receiver = $1) == null || $receiver.isNil){
  22437. $1;
  22438. } else {
  22439. $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
  22440. };
  22441. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  22442. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  22443. },
  22444. args: ["aClass"],
  22445. 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",
  22446. referencedClasses: [],
  22447. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  22448. }),
  22449. $globals.Environment);
  22450. $core.addMethod(
  22451. $core.method({
  22452. selector: "classBuilder",
  22453. protocol: 'accessing',
  22454. fn: function (){
  22455. var self=this;
  22456. return $core.withContext(function($ctx1) {
  22457. return $recv($globals.ClassBuilder)._new();
  22458. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  22459. },
  22460. args: [],
  22461. source: "classBuilder\x0a\x09^ ClassBuilder new",
  22462. referencedClasses: ["ClassBuilder"],
  22463. messageSends: ["new"]
  22464. }),
  22465. $globals.Environment);
  22466. $core.addMethod(
  22467. $core.method({
  22468. selector: "classNamed:",
  22469. protocol: 'accessing',
  22470. fn: function (aString){
  22471. var self=this;
  22472. return $core.withContext(function($ctx1) {
  22473. var $1,$receiver;
  22474. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  22475. if(($receiver = $1) == null || $receiver.isNil){
  22476. return self._error_("Invalid class name");
  22477. } else {
  22478. return $1;
  22479. };
  22480. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  22481. },
  22482. args: ["aString"],
  22483. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  22484. referencedClasses: ["Smalltalk"],
  22485. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  22486. }),
  22487. $globals.Environment);
  22488. $core.addMethod(
  22489. $core.method({
  22490. selector: "classes",
  22491. protocol: 'accessing',
  22492. fn: function (){
  22493. var self=this;
  22494. return $core.withContext(function($ctx1) {
  22495. return $recv($globals.Smalltalk)._classes();
  22496. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  22497. },
  22498. args: [],
  22499. source: "classes\x0a\x09^ Smalltalk classes",
  22500. referencedClasses: ["Smalltalk"],
  22501. messageSends: ["classes"]
  22502. }),
  22503. $globals.Environment);
  22504. $core.addMethod(
  22505. $core.method({
  22506. selector: "commitPackage:onSuccess:onError:",
  22507. protocol: 'actions',
  22508. fn: function (aPackage,aBlock,anotherBlock){
  22509. var self=this;
  22510. return $core.withContext(function($ctx1) {
  22511. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  22512. return self;
  22513. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  22514. },
  22515. args: ["aPackage", "aBlock", "anotherBlock"],
  22516. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  22517. referencedClasses: [],
  22518. messageSends: ["commitOnSuccess:onError:", "transport"]
  22519. }),
  22520. $globals.Environment);
  22521. $core.addMethod(
  22522. $core.method({
  22523. selector: "compileClassComment:for:",
  22524. protocol: 'compiling',
  22525. fn: function (aString,aClass){
  22526. var self=this;
  22527. return $core.withContext(function($ctx1) {
  22528. $recv(aClass)._comment_(aString);
  22529. return self;
  22530. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  22531. },
  22532. args: ["aString", "aClass"],
  22533. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  22534. referencedClasses: [],
  22535. messageSends: ["comment:"]
  22536. }),
  22537. $globals.Environment);
  22538. $core.addMethod(
  22539. $core.method({
  22540. selector: "compileClassDefinition:",
  22541. protocol: 'compiling',
  22542. fn: function (aString){
  22543. var self=this;
  22544. return $core.withContext(function($ctx1) {
  22545. $recv((function(){
  22546. return $core.withContext(function($ctx2) {
  22547. return self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  22548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22549. }))._on_do_($globals.Error,(function(error){
  22550. return $core.withContext(function($ctx2) {
  22551. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  22552. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  22553. }));
  22554. return self;
  22555. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  22556. },
  22557. args: ["aString"],
  22558. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  22559. referencedClasses: ["DoIt", "Error", "Terminal"],
  22560. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  22561. }),
  22562. $globals.Environment);
  22563. $core.addMethod(
  22564. $core.method({
  22565. selector: "compileMethod:for:protocol:",
  22566. protocol: 'compiling',
  22567. fn: function (sourceCode,class_,protocol){
  22568. var self=this;
  22569. return $core.withContext(function($ctx1) {
  22570. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  22571. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  22572. },
  22573. args: ["sourceCode", "class", "protocol"],
  22574. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  22575. referencedClasses: [],
  22576. messageSends: ["compile:protocol:"]
  22577. }),
  22578. $globals.Environment);
  22579. $core.addMethod(
  22580. $core.method({
  22581. selector: "copyClass:to:",
  22582. protocol: 'actions',
  22583. fn: function (aClass,aClassName){
  22584. var self=this;
  22585. return $core.withContext(function($ctx1) {
  22586. var $1,$2,$receiver;
  22587. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  22588. if(($receiver = $1) == null || $receiver.isNil){
  22589. $1;
  22590. } else {
  22591. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22592. $ctx1.sendIdx[","]=1;
  22593. self._error_($2);
  22594. };
  22595. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  22596. return self;
  22597. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22598. },
  22599. args: ["aClass", "aClassName"],
  22600. 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",
  22601. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22602. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  22603. }),
  22604. $globals.Environment);
  22605. $core.addMethod(
  22606. $core.method({
  22607. selector: "doItReceiver",
  22608. protocol: 'accessing',
  22609. fn: function (){
  22610. var self=this;
  22611. return $core.withContext(function($ctx1) {
  22612. return $recv($globals.DoIt)._new();
  22613. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  22614. },
  22615. args: [],
  22616. source: "doItReceiver\x0a\x09^ DoIt new",
  22617. referencedClasses: ["DoIt"],
  22618. messageSends: ["new"]
  22619. }),
  22620. $globals.Environment);
  22621. $core.addMethod(
  22622. $core.method({
  22623. selector: "evaluate:for:",
  22624. protocol: 'evaluating',
  22625. fn: function (aString,anObject){
  22626. var self=this;
  22627. return $core.withContext(function($ctx1) {
  22628. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  22629. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  22630. },
  22631. args: ["aString", "anObject"],
  22632. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  22633. referencedClasses: ["Evaluator"],
  22634. messageSends: ["evaluate:for:"]
  22635. }),
  22636. $globals.Environment);
  22637. $core.addMethod(
  22638. $core.method({
  22639. selector: "evaluate:on:do:",
  22640. protocol: 'error handling',
  22641. fn: function (aBlock,anErrorClass,exceptionBlock){
  22642. var self=this;
  22643. return $core.withContext(function($ctx1) {
  22644. var $1;
  22645. $recv(aBlock)._tryCatch_((function(exception){
  22646. return $core.withContext(function($ctx2) {
  22647. $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
  22648. if($core.assert($1)){
  22649. return $recv(exceptionBlock)._value_(exception);
  22650. } else {
  22651. return $recv(exception)._resignal();
  22652. };
  22653. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  22654. }));
  22655. return self;
  22656. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  22657. },
  22658. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  22659. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception resignal ] ]",
  22660. referencedClasses: [],
  22661. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  22662. }),
  22663. $globals.Environment);
  22664. $core.addMethod(
  22665. $core.method({
  22666. selector: "inspect:",
  22667. protocol: 'actions',
  22668. fn: function (anObject){
  22669. var self=this;
  22670. return $core.withContext(function($ctx1) {
  22671. $recv($globals.Inspector)._inspect_(anObject);
  22672. return self;
  22673. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  22674. },
  22675. args: ["anObject"],
  22676. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  22677. referencedClasses: ["Inspector"],
  22678. messageSends: ["inspect:"]
  22679. }),
  22680. $globals.Environment);
  22681. $core.addMethod(
  22682. $core.method({
  22683. selector: "moveClass:toPackage:",
  22684. protocol: 'actions',
  22685. fn: function (aClass,aPackageName){
  22686. var self=this;
  22687. var package_;
  22688. return $core.withContext(function($ctx1) {
  22689. var $1,$2,$receiver;
  22690. package_=$recv($globals.Package)._named_(aPackageName);
  22691. $1=package_;
  22692. if(($receiver = $1) == null || $receiver.isNil){
  22693. self._error_("Invalid package name");
  22694. } else {
  22695. $1;
  22696. };
  22697. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  22698. if($core.assert($2)){
  22699. return self;
  22700. };
  22701. $recv(aClass)._package_(package_);
  22702. return self;
  22703. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  22704. },
  22705. args: ["aClass", "aPackageName"],
  22706. 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",
  22707. referencedClasses: ["Package"],
  22708. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
  22709. }),
  22710. $globals.Environment);
  22711. $core.addMethod(
  22712. $core.method({
  22713. selector: "moveMethod:toClass:",
  22714. protocol: 'actions',
  22715. fn: function (aMethod,aClassName){
  22716. var self=this;
  22717. var destinationClass;
  22718. return $core.withContext(function($ctx1) {
  22719. var $2,$3,$1,$5,$4;
  22720. destinationClass=self._classNamed_(aClassName);
  22721. $2=destinationClass;
  22722. $3=$recv(aMethod)._methodClass();
  22723. $ctx1.sendIdx["methodClass"]=1;
  22724. $1=$recv($2).__eq_eq($3);
  22725. if($core.assert($1)){
  22726. return self;
  22727. };
  22728. $5=$recv(aMethod)._methodClass();
  22729. $ctx1.sendIdx["methodClass"]=2;
  22730. $4=$recv($5)._isMetaclass();
  22731. if($core.assert($4)){
  22732. destinationClass=$recv(destinationClass)._class();
  22733. destinationClass;
  22734. };
  22735. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  22736. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22737. return self;
  22738. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  22739. },
  22740. args: ["aMethod", "aClassName"],
  22741. 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 class ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
  22742. referencedClasses: [],
  22743. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  22744. }),
  22745. $globals.Environment);
  22746. $core.addMethod(
  22747. $core.method({
  22748. selector: "moveMethod:toProtocol:",
  22749. protocol: 'actions',
  22750. fn: function (aMethod,aProtocol){
  22751. var self=this;
  22752. return $core.withContext(function($ctx1) {
  22753. $recv(aMethod)._protocol_(aProtocol);
  22754. return self;
  22755. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  22756. },
  22757. args: ["aMethod", "aProtocol"],
  22758. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  22759. referencedClasses: [],
  22760. messageSends: ["protocol:"]
  22761. }),
  22762. $globals.Environment);
  22763. $core.addMethod(
  22764. $core.method({
  22765. selector: "packages",
  22766. protocol: 'accessing',
  22767. fn: function (){
  22768. var self=this;
  22769. return $core.withContext(function($ctx1) {
  22770. return $recv($globals.Smalltalk)._packages();
  22771. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  22772. },
  22773. args: [],
  22774. source: "packages\x0a\x09^ Smalltalk packages",
  22775. referencedClasses: ["Smalltalk"],
  22776. messageSends: ["packages"]
  22777. }),
  22778. $globals.Environment);
  22779. $core.addMethod(
  22780. $core.method({
  22781. selector: "registerErrorHandler:",
  22782. protocol: 'services',
  22783. fn: function (anErrorHandler){
  22784. var self=this;
  22785. return $core.withContext(function($ctx1) {
  22786. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  22787. return self;
  22788. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  22789. },
  22790. args: ["anErrorHandler"],
  22791. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  22792. referencedClasses: ["ErrorHandler"],
  22793. messageSends: ["register:"]
  22794. }),
  22795. $globals.Environment);
  22796. $core.addMethod(
  22797. $core.method({
  22798. selector: "registerFinder:",
  22799. protocol: 'services',
  22800. fn: function (aFinder){
  22801. var self=this;
  22802. return $core.withContext(function($ctx1) {
  22803. $recv($globals.Finder)._register_(aFinder);
  22804. return self;
  22805. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  22806. },
  22807. args: ["aFinder"],
  22808. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  22809. referencedClasses: ["Finder"],
  22810. messageSends: ["register:"]
  22811. }),
  22812. $globals.Environment);
  22813. $core.addMethod(
  22814. $core.method({
  22815. selector: "registerInspector:",
  22816. protocol: 'services',
  22817. fn: function (anInspector){
  22818. var self=this;
  22819. return $core.withContext(function($ctx1) {
  22820. $recv($globals.Inspector)._register_(anInspector);
  22821. return self;
  22822. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  22823. },
  22824. args: ["anInspector"],
  22825. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  22826. referencedClasses: ["Inspector"],
  22827. messageSends: ["register:"]
  22828. }),
  22829. $globals.Environment);
  22830. $core.addMethod(
  22831. $core.method({
  22832. selector: "registerProgressHandler:",
  22833. protocol: 'services',
  22834. fn: function (aProgressHandler){
  22835. var self=this;
  22836. return $core.withContext(function($ctx1) {
  22837. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  22838. return self;
  22839. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  22840. },
  22841. args: ["aProgressHandler"],
  22842. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  22843. referencedClasses: ["ProgressHandler"],
  22844. messageSends: ["register:"]
  22845. }),
  22846. $globals.Environment);
  22847. $core.addMethod(
  22848. $core.method({
  22849. selector: "registerTranscript:",
  22850. protocol: 'services',
  22851. fn: function (aTranscript){
  22852. var self=this;
  22853. return $core.withContext(function($ctx1) {
  22854. $recv($globals.Transcript)._register_(aTranscript);
  22855. return self;
  22856. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  22857. },
  22858. args: ["aTranscript"],
  22859. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  22860. referencedClasses: ["Transcript"],
  22861. messageSends: ["register:"]
  22862. }),
  22863. $globals.Environment);
  22864. $core.addMethod(
  22865. $core.method({
  22866. selector: "removeClass:",
  22867. protocol: 'actions',
  22868. fn: function (aClass){
  22869. var self=this;
  22870. return $core.withContext(function($ctx1) {
  22871. $recv($globals.Smalltalk)._removeClass_(aClass);
  22872. return self;
  22873. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  22874. },
  22875. args: ["aClass"],
  22876. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  22877. referencedClasses: ["Smalltalk"],
  22878. messageSends: ["removeClass:"]
  22879. }),
  22880. $globals.Environment);
  22881. $core.addMethod(
  22882. $core.method({
  22883. selector: "removeMethod:",
  22884. protocol: 'actions',
  22885. fn: function (aMethod){
  22886. var self=this;
  22887. return $core.withContext(function($ctx1) {
  22888. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22889. return self;
  22890. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  22891. },
  22892. args: ["aMethod"],
  22893. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  22894. referencedClasses: [],
  22895. messageSends: ["removeCompiledMethod:", "methodClass"]
  22896. }),
  22897. $globals.Environment);
  22898. $core.addMethod(
  22899. $core.method({
  22900. selector: "removeProtocol:from:",
  22901. protocol: 'actions',
  22902. fn: function (aString,aClass){
  22903. var self=this;
  22904. return $core.withContext(function($ctx1) {
  22905. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22906. return $core.withContext(function($ctx2) {
  22907. return $recv(aClass)._removeCompiledMethod_(each);
  22908. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22909. }));
  22910. return self;
  22911. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  22912. },
  22913. args: ["aString", "aClass"],
  22914. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  22915. referencedClasses: [],
  22916. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  22917. }),
  22918. $globals.Environment);
  22919. $core.addMethod(
  22920. $core.method({
  22921. selector: "renameClass:to:",
  22922. protocol: 'actions',
  22923. fn: function (aClass,aClassName){
  22924. var self=this;
  22925. return $core.withContext(function($ctx1) {
  22926. var $1,$2,$receiver;
  22927. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  22928. if(($receiver = $1) == null || $receiver.isNil){
  22929. $1;
  22930. } else {
  22931. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22932. $ctx1.sendIdx[","]=1;
  22933. self._error_($2);
  22934. };
  22935. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  22936. return self;
  22937. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22938. },
  22939. args: ["aClass", "aClassName"],
  22940. 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",
  22941. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22942. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  22943. }),
  22944. $globals.Environment);
  22945. $core.addMethod(
  22946. $core.method({
  22947. selector: "renamePackage:to:",
  22948. protocol: 'actions',
  22949. fn: function (aPackageName,aNewPackageName){
  22950. var self=this;
  22951. return $core.withContext(function($ctx1) {
  22952. var $1,$2,$receiver;
  22953. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aNewPackageName);
  22954. if(($receiver = $1) == null || $receiver.isNil){
  22955. $1;
  22956. } else {
  22957. $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
  22958. $ctx1.sendIdx[","]=1;
  22959. self._error_($2);
  22960. };
  22961. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  22962. return self;
  22963. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  22964. },
  22965. args: ["aPackageName", "aNewPackageName"],
  22966. source: "renamePackage: aPackageName to: aNewPackageName\x0a (Smalltalk globals at: aNewPackageName)\x0a ifNotNil: [ self error: 'A package named ', aNewPackageName, ' already exists' ].\x0a\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  22967. referencedClasses: ["Smalltalk"],
  22968. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
  22969. }),
  22970. $globals.Environment);
  22971. $core.addMethod(
  22972. $core.method({
  22973. selector: "renameProtocol:to:in:",
  22974. protocol: 'actions',
  22975. fn: function (aString,anotherString,aClass){
  22976. var self=this;
  22977. return $core.withContext(function($ctx1) {
  22978. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22979. return $core.withContext(function($ctx2) {
  22980. return $recv(each)._protocol_(anotherString);
  22981. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22982. }));
  22983. return self;
  22984. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  22985. },
  22986. args: ["aString", "anotherString", "aClass"],
  22987. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  22988. referencedClasses: [],
  22989. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  22990. }),
  22991. $globals.Environment);
  22992. $core.addMethod(
  22993. $core.method({
  22994. selector: "setClassCommentOf:to:",
  22995. protocol: 'actions',
  22996. fn: function (aClass,aString){
  22997. var self=this;
  22998. return $core.withContext(function($ctx1) {
  22999. $recv(aClass)._comment_(aString);
  23000. return self;
  23001. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  23002. },
  23003. args: ["aClass", "aString"],
  23004. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  23005. referencedClasses: [],
  23006. messageSends: ["comment:"]
  23007. }),
  23008. $globals.Environment);
  23009. $core.addMethod(
  23010. $core.method({
  23011. selector: "systemAnnouncer",
  23012. protocol: 'accessing',
  23013. fn: function (){
  23014. var self=this;
  23015. return $core.withContext(function($ctx1) {
  23016. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  23017. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  23018. },
  23019. args: [],
  23020. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  23021. referencedClasses: ["Smalltalk"],
  23022. messageSends: ["current", "at:", "globals"]
  23023. }),
  23024. $globals.Environment);
  23025. $core.addClass('NullProgressHandler', $globals.Object, [], 'Platform-Services');
  23026. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  23027. $core.addMethod(
  23028. $core.method({
  23029. selector: "do:on:displaying:",
  23030. protocol: 'progress handling',
  23031. fn: function (aBlock,aCollection,aString){
  23032. var self=this;
  23033. return $core.withContext(function($ctx1) {
  23034. $recv(aCollection)._do_(aBlock);
  23035. return self;
  23036. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  23037. },
  23038. args: ["aBlock", "aCollection", "aString"],
  23039. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  23040. referencedClasses: [],
  23041. messageSends: ["do:"]
  23042. }),
  23043. $globals.NullProgressHandler);
  23044. $globals.NullProgressHandler.klass.iVarNames = ['current'];
  23045. $core.addMethod(
  23046. $core.method({
  23047. selector: "initialize",
  23048. protocol: 'initialization',
  23049. fn: function (){
  23050. var self=this;
  23051. return $core.withContext(function($ctx1) {
  23052. $recv($globals.ProgressHandler)._registerIfNone_(self._new());
  23053. return self;
  23054. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
  23055. },
  23056. args: [],
  23057. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  23058. referencedClasses: ["ProgressHandler"],
  23059. messageSends: ["registerIfNone:", "new"]
  23060. }),
  23061. $globals.NullProgressHandler.klass);
  23062. $core.addClass('Service', $globals.Object, [], 'Platform-Services');
  23063. $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.";
  23064. $globals.Service.klass.iVarNames = ['current'];
  23065. $core.addMethod(
  23066. $core.method({
  23067. selector: "current",
  23068. protocol: 'accessing',
  23069. fn: function (){
  23070. var self=this;
  23071. return self["@current"];
  23072. },
  23073. args: [],
  23074. source: "current\x0a\x09^ current",
  23075. referencedClasses: [],
  23076. messageSends: []
  23077. }),
  23078. $globals.Service.klass);
  23079. $core.addMethod(
  23080. $core.method({
  23081. selector: "new",
  23082. protocol: 'instance creation',
  23083. fn: function (){
  23084. var self=this;
  23085. return $core.withContext(function($ctx1) {
  23086. self._shouldNotImplement();
  23087. return self;
  23088. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
  23089. },
  23090. args: [],
  23091. source: "new\x0a\x09self shouldNotImplement",
  23092. referencedClasses: [],
  23093. messageSends: ["shouldNotImplement"]
  23094. }),
  23095. $globals.Service.klass);
  23096. $core.addMethod(
  23097. $core.method({
  23098. selector: "register:",
  23099. protocol: 'registration',
  23100. fn: function (anObject){
  23101. var self=this;
  23102. self["@current"]=anObject;
  23103. return self;
  23104. },
  23105. args: ["anObject"],
  23106. source: "register: anObject\x0a\x09current := anObject",
  23107. referencedClasses: [],
  23108. messageSends: []
  23109. }),
  23110. $globals.Service.klass);
  23111. $core.addMethod(
  23112. $core.method({
  23113. selector: "registerIfNone:",
  23114. protocol: 'registration',
  23115. fn: function (anObject){
  23116. var self=this;
  23117. return $core.withContext(function($ctx1) {
  23118. var $1,$receiver;
  23119. $1=self._current();
  23120. if(($receiver = $1) == null || $receiver.isNil){
  23121. self._register_(anObject);
  23122. } else {
  23123. $1;
  23124. };
  23125. return self;
  23126. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
  23127. },
  23128. args: ["anObject"],
  23129. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  23130. referencedClasses: [],
  23131. messageSends: ["ifNil:", "current", "register:"]
  23132. }),
  23133. $globals.Service.klass);
  23134. $core.addClass('ErrorHandler', $globals.Service, [], 'Platform-Services');
  23135. $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.";
  23136. $core.addMethod(
  23137. $core.method({
  23138. selector: "handleError:",
  23139. protocol: 'error handling',
  23140. fn: function (anError){
  23141. var self=this;
  23142. return $core.withContext(function($ctx1) {
  23143. self._handleUnhandledError_(anError);
  23144. return self;
  23145. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
  23146. },
  23147. args: ["anError"],
  23148. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  23149. referencedClasses: [],
  23150. messageSends: ["handleUnhandledError:"]
  23151. }),
  23152. $globals.ErrorHandler.klass);
  23153. $core.addMethod(
  23154. $core.method({
  23155. selector: "handleUnhandledError:",
  23156. protocol: 'error handling',
  23157. fn: function (anError){
  23158. var self=this;
  23159. return $core.withContext(function($ctx1) {
  23160. var $1;
  23161. $1=$recv(anError)._wasHandled();
  23162. if($core.assert($1)){
  23163. return self;
  23164. };
  23165. return $recv(self._current())._handleError_(anError);
  23166. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
  23167. },
  23168. args: ["anError"],
  23169. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  23170. referencedClasses: [],
  23171. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  23172. }),
  23173. $globals.ErrorHandler.klass);
  23174. $core.addClass('Finder', $globals.Service, [], 'Platform-Services');
  23175. $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.";
  23176. $core.addMethod(
  23177. $core.method({
  23178. selector: "findClass:",
  23179. protocol: 'finding',
  23180. fn: function (aClass){
  23181. var self=this;
  23182. return $core.withContext(function($ctx1) {
  23183. return $recv(self._current())._findClass_(aClass);
  23184. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
  23185. },
  23186. args: ["aClass"],
  23187. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  23188. referencedClasses: [],
  23189. messageSends: ["findClass:", "current"]
  23190. }),
  23191. $globals.Finder.klass);
  23192. $core.addMethod(
  23193. $core.method({
  23194. selector: "findMethod:",
  23195. protocol: 'finding',
  23196. fn: function (aCompiledMethod){
  23197. var self=this;
  23198. return $core.withContext(function($ctx1) {
  23199. return $recv(self._current())._findMethod_(aCompiledMethod);
  23200. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
  23201. },
  23202. args: ["aCompiledMethod"],
  23203. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  23204. referencedClasses: [],
  23205. messageSends: ["findMethod:", "current"]
  23206. }),
  23207. $globals.Finder.klass);
  23208. $core.addMethod(
  23209. $core.method({
  23210. selector: "findString:",
  23211. protocol: 'finding',
  23212. fn: function (aString){
  23213. var self=this;
  23214. return $core.withContext(function($ctx1) {
  23215. return $recv(self._current())._findString_(aString);
  23216. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
  23217. },
  23218. args: ["aString"],
  23219. source: "findString: aString\x0a\x09^ self current findString: aString",
  23220. referencedClasses: [],
  23221. messageSends: ["findString:", "current"]
  23222. }),
  23223. $globals.Finder.klass);
  23224. $core.addClass('Inspector', $globals.Service, [], 'Platform-Services');
  23225. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  23226. $core.addMethod(
  23227. $core.method({
  23228. selector: "inspect:",
  23229. protocol: 'inspecting',
  23230. fn: function (anObject){
  23231. var self=this;
  23232. return $core.withContext(function($ctx1) {
  23233. return $recv(self._current())._inspect_(anObject);
  23234. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
  23235. },
  23236. args: ["anObject"],
  23237. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  23238. referencedClasses: [],
  23239. messageSends: ["inspect:", "current"]
  23240. }),
  23241. $globals.Inspector.klass);
  23242. $core.addClass('Platform', $globals.Service, [], 'Platform-Services');
  23243. $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";
  23244. $core.addMethod(
  23245. $core.method({
  23246. selector: "globals",
  23247. protocol: 'accessing',
  23248. fn: function (){
  23249. var self=this;
  23250. return $core.withContext(function($ctx1) {
  23251. return $recv(self._current())._globals();
  23252. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.klass)});
  23253. },
  23254. args: [],
  23255. source: "globals\x0a\x09^ self current globals",
  23256. referencedClasses: [],
  23257. messageSends: ["globals", "current"]
  23258. }),
  23259. $globals.Platform.klass);
  23260. $core.addMethod(
  23261. $core.method({
  23262. selector: "newXhr",
  23263. protocol: 'accessing',
  23264. fn: function (){
  23265. var self=this;
  23266. return $core.withContext(function($ctx1) {
  23267. return $recv(self._current())._newXhr();
  23268. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.klass)});
  23269. },
  23270. args: [],
  23271. source: "newXhr\x0a\x09^ self current newXhr",
  23272. referencedClasses: [],
  23273. messageSends: ["newXhr", "current"]
  23274. }),
  23275. $globals.Platform.klass);
  23276. $core.addClass('ProgressHandler', $globals.Service, [], 'Platform-Services');
  23277. $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`.";
  23278. $core.addMethod(
  23279. $core.method({
  23280. selector: "do:on:displaying:",
  23281. protocol: 'progress handling',
  23282. fn: function (aBlock,aCollection,aString){
  23283. var self=this;
  23284. return $core.withContext(function($ctx1) {
  23285. $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  23286. return self;
  23287. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
  23288. },
  23289. args: ["aBlock", "aCollection", "aString"],
  23290. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  23291. referencedClasses: [],
  23292. messageSends: ["do:on:displaying:", "current"]
  23293. }),
  23294. $globals.ProgressHandler.klass);
  23295. $core.addClass('Terminal', $globals.Service, [], 'Platform-Services');
  23296. $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:'.";
  23297. $core.addMethod(
  23298. $core.method({
  23299. selector: "alert:",
  23300. protocol: 'dialogs',
  23301. fn: function (aString){
  23302. var self=this;
  23303. return $core.withContext(function($ctx1) {
  23304. return $recv(self._current())._alert_(aString);
  23305. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.klass)});
  23306. },
  23307. args: ["aString"],
  23308. source: "alert: aString\x0a\x09^ self current alert: aString",
  23309. referencedClasses: [],
  23310. messageSends: ["alert:", "current"]
  23311. }),
  23312. $globals.Terminal.klass);
  23313. $core.addMethod(
  23314. $core.method({
  23315. selector: "confirm:",
  23316. protocol: 'dialogs',
  23317. fn: function (aString){
  23318. var self=this;
  23319. return $core.withContext(function($ctx1) {
  23320. return $recv(self._current())._confirm_(aString);
  23321. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.klass)});
  23322. },
  23323. args: ["aString"],
  23324. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  23325. referencedClasses: [],
  23326. messageSends: ["confirm:", "current"]
  23327. }),
  23328. $globals.Terminal.klass);
  23329. $core.addMethod(
  23330. $core.method({
  23331. selector: "prompt:",
  23332. protocol: 'dialogs',
  23333. fn: function (aString){
  23334. var self=this;
  23335. return $core.withContext(function($ctx1) {
  23336. return $recv(self._current())._prompt_(aString);
  23337. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.klass)});
  23338. },
  23339. args: ["aString"],
  23340. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  23341. referencedClasses: [],
  23342. messageSends: ["prompt:", "current"]
  23343. }),
  23344. $globals.Terminal.klass);
  23345. $core.addMethod(
  23346. $core.method({
  23347. selector: "prompt:default:",
  23348. protocol: 'dialogs',
  23349. fn: function (aString,defaultString){
  23350. var self=this;
  23351. return $core.withContext(function($ctx1) {
  23352. return $recv(self._current())._prompt_default_(aString,defaultString);
  23353. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.klass)});
  23354. },
  23355. args: ["aString", "defaultString"],
  23356. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  23357. referencedClasses: [],
  23358. messageSends: ["prompt:default:", "current"]
  23359. }),
  23360. $globals.Terminal.klass);
  23361. $core.addClass('Transcript', $globals.Service, [], 'Platform-Services');
  23362. $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.";
  23363. $core.addMethod(
  23364. $core.method({
  23365. selector: "clear",
  23366. protocol: 'printing',
  23367. fn: function (){
  23368. var self=this;
  23369. return $core.withContext(function($ctx1) {
  23370. $recv(self._current())._clear();
  23371. return self;
  23372. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
  23373. },
  23374. args: [],
  23375. source: "clear\x0a\x09self current clear",
  23376. referencedClasses: [],
  23377. messageSends: ["clear", "current"]
  23378. }),
  23379. $globals.Transcript.klass);
  23380. $core.addMethod(
  23381. $core.method({
  23382. selector: "cr",
  23383. protocol: 'printing',
  23384. fn: function (){
  23385. var self=this;
  23386. return $core.withContext(function($ctx1) {
  23387. $recv(self._current())._show_($recv($globals.String)._cr());
  23388. return self;
  23389. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
  23390. },
  23391. args: [],
  23392. source: "cr\x0a\x09self current show: String cr",
  23393. referencedClasses: ["String"],
  23394. messageSends: ["show:", "current", "cr"]
  23395. }),
  23396. $globals.Transcript.klass);
  23397. $core.addMethod(
  23398. $core.method({
  23399. selector: "inspect:",
  23400. protocol: 'printing',
  23401. fn: function (anObject){
  23402. var self=this;
  23403. return $core.withContext(function($ctx1) {
  23404. self._show_(anObject);
  23405. return self;
  23406. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
  23407. },
  23408. args: ["anObject"],
  23409. source: "inspect: anObject\x0a\x09self show: anObject",
  23410. referencedClasses: [],
  23411. messageSends: ["show:"]
  23412. }),
  23413. $globals.Transcript.klass);
  23414. $core.addMethod(
  23415. $core.method({
  23416. selector: "open",
  23417. protocol: 'instance creation',
  23418. fn: function (){
  23419. var self=this;
  23420. return $core.withContext(function($ctx1) {
  23421. $recv(self._current())._open();
  23422. return self;
  23423. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
  23424. },
  23425. args: [],
  23426. source: "open\x0a\x09self current open",
  23427. referencedClasses: [],
  23428. messageSends: ["open", "current"]
  23429. }),
  23430. $globals.Transcript.klass);
  23431. $core.addMethod(
  23432. $core.method({
  23433. selector: "show:",
  23434. protocol: 'printing',
  23435. fn: function (anObject){
  23436. var self=this;
  23437. return $core.withContext(function($ctx1) {
  23438. $recv(self._current())._show_(anObject);
  23439. return self;
  23440. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
  23441. },
  23442. args: ["anObject"],
  23443. source: "show: anObject\x0a\x09self current show: anObject",
  23444. referencedClasses: [],
  23445. messageSends: ["show:", "current"]
  23446. }),
  23447. $globals.Transcript.klass);
  23448. $core.addMethod(
  23449. $core.method({
  23450. selector: "inspectOn:",
  23451. protocol: '*Platform-Services',
  23452. fn: function (anInspector){
  23453. var self=this;
  23454. var variables;
  23455. return $core.withContext(function($ctx1) {
  23456. variables=$recv($globals.Dictionary)._new();
  23457. $recv(variables)._at_put_("#self",self);
  23458. $ctx1.sendIdx["at:put:"]=1;
  23459. $recv(variables)._at_put_("#keys",self._keys());
  23460. $ctx1.sendIdx["at:put:"]=2;
  23461. self._keysAndValuesDo_((function(key,value){
  23462. return $core.withContext(function($ctx2) {
  23463. return $recv(variables)._at_put_(key,value);
  23464. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23465. }));
  23466. $recv(anInspector)._setLabel_(self._printString());
  23467. $recv(anInspector)._setVariables_(variables);
  23468. return self;
  23469. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  23470. },
  23471. args: ["anInspector"],
  23472. 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",
  23473. referencedClasses: ["Dictionary"],
  23474. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  23475. }),
  23476. $globals.AssociativeCollection);
  23477. $core.addMethod(
  23478. $core.method({
  23479. selector: "inspectOn:",
  23480. protocol: '*Platform-Services',
  23481. fn: function (anInspector){
  23482. var self=this;
  23483. var variables;
  23484. return $core.withContext(function($ctx1) {
  23485. variables=$recv($globals.Dictionary)._new();
  23486. $recv(variables)._at_put_("#self",self);
  23487. $ctx1.sendIdx["at:put:"]=1;
  23488. self._withIndexDo_((function(each,i){
  23489. return $core.withContext(function($ctx2) {
  23490. return $recv(variables)._at_put_(i,each);
  23491. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  23492. }));
  23493. $recv(anInspector)._setLabel_(self._printString());
  23494. $recv(anInspector)._setVariables_(variables);
  23495. return self;
  23496. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  23497. },
  23498. args: ["anInspector"],
  23499. 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",
  23500. referencedClasses: ["Dictionary"],
  23501. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  23502. }),
  23503. $globals.Collection);
  23504. $core.addMethod(
  23505. $core.method({
  23506. selector: "inspectOn:",
  23507. protocol: '*Platform-Services',
  23508. fn: function (anInspector){
  23509. var self=this;
  23510. var variables;
  23511. return $core.withContext(function($ctx1) {
  23512. variables=$recv($globals.Dictionary)._new();
  23513. $recv(variables)._at_put_("#self",self);
  23514. $ctx1.sendIdx["at:put:"]=1;
  23515. $recv(variables)._at_put_("#year",self._year());
  23516. $ctx1.sendIdx["at:put:"]=2;
  23517. $recv(variables)._at_put_("#month",self._month());
  23518. $ctx1.sendIdx["at:put:"]=3;
  23519. $recv(variables)._at_put_("#day",self._day());
  23520. $ctx1.sendIdx["at:put:"]=4;
  23521. $recv(variables)._at_put_("#hours",self._hours());
  23522. $ctx1.sendIdx["at:put:"]=5;
  23523. $recv(variables)._at_put_("#minutes",self._minutes());
  23524. $ctx1.sendIdx["at:put:"]=6;
  23525. $recv(variables)._at_put_("#seconds",self._seconds());
  23526. $ctx1.sendIdx["at:put:"]=7;
  23527. $recv(variables)._at_put_("#milliseconds",self._milliseconds());
  23528. $recv(anInspector)._setLabel_(self._printString());
  23529. $recv(anInspector)._setVariables_(variables);
  23530. return self;
  23531. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  23532. },
  23533. args: ["anInspector"],
  23534. 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",
  23535. referencedClasses: ["Dictionary"],
  23536. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  23537. }),
  23538. $globals.Date);
  23539. $core.addMethod(
  23540. $core.method({
  23541. selector: "inspectOn:",
  23542. protocol: '*Platform-Services',
  23543. fn: function (anInspector){
  23544. var self=this;
  23545. var variables;
  23546. return $core.withContext(function($ctx1) {
  23547. variables=$recv($globals.Dictionary)._new();
  23548. $recv(variables)._at_put_("#self",self._jsObject());
  23549. $recv(anInspector)._setLabel_(self._printString());
  23550. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  23551. $recv(anInspector)._setVariables_(variables);
  23552. return self;
  23553. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  23554. },
  23555. args: ["anInspector"],
  23556. 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",
  23557. referencedClasses: ["Dictionary", "JSObjectProxy"],
  23558. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  23559. }),
  23560. $globals.JSObjectProxy);
  23561. $core.addMethod(
  23562. $core.method({
  23563. selector: "inspectOn:",
  23564. protocol: '*Platform-Services',
  23565. fn: function (anInspector){
  23566. var self=this;
  23567. var variables;
  23568. return $core.withContext(function($ctx1) {
  23569. variables=$recv($globals.Dictionary)._new();
  23570. $recv(variables)._at_put_("#self",self);
  23571. $ctx1.sendIdx["at:put:"]=1;
  23572. $recv(variables)._at_put_("#home",self._home());
  23573. $ctx1.sendIdx["at:put:"]=2;
  23574. $recv(variables)._at_put_("#receiver",self._receiver());
  23575. $ctx1.sendIdx["at:put:"]=3;
  23576. $recv(variables)._at_put_("#selector",self._selector());
  23577. $ctx1.sendIdx["at:put:"]=4;
  23578. $recv(variables)._at_put_("#locals",self._locals());
  23579. $ctx1.sendIdx["at:put:"]=5;
  23580. $recv($recv(self._class())._instanceVariableNames())._do_((function(each){
  23581. return $core.withContext(function($ctx2) {
  23582. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23583. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23584. }));
  23585. $recv(anInspector)._setLabel_(self._printString());
  23586. $recv(anInspector)._setVariables_(variables);
  23587. return self;
  23588. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  23589. },
  23590. args: ["anInspector"],
  23591. 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",
  23592. referencedClasses: ["Dictionary"],
  23593. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23594. }),
  23595. $globals.MethodContext);
  23596. $core.addMethod(
  23597. $core.method({
  23598. selector: "inspectOn:",
  23599. protocol: '*Platform-Services',
  23600. fn: function (anInspector){
  23601. var self=this;
  23602. var variables;
  23603. return $core.withContext(function($ctx1) {
  23604. variables=$recv($globals.Dictionary)._new();
  23605. $recv(variables)._at_put_("#self",self);
  23606. $ctx1.sendIdx["at:put:"]=1;
  23607. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  23608. return $core.withContext(function($ctx2) {
  23609. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23610. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23611. }));
  23612. $recv(anInspector)._setLabel_(self._printString());
  23613. $recv(anInspector)._setVariables_(variables);
  23614. return self;
  23615. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  23616. },
  23617. args: ["anInspector"],
  23618. 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",
  23619. referencedClasses: ["Dictionary"],
  23620. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23621. }),
  23622. $globals.Object);
  23623. $core.addMethod(
  23624. $core.method({
  23625. selector: "do:displayingProgress:",
  23626. protocol: '*Platform-Services',
  23627. fn: function (aBlock,aString){
  23628. var self=this;
  23629. return $core.withContext(function($ctx1) {
  23630. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  23631. return self;
  23632. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  23633. },
  23634. args: ["aBlock", "aString"],
  23635. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  23636. referencedClasses: ["ProgressHandler"],
  23637. messageSends: ["do:on:displaying:"]
  23638. }),
  23639. $globals.SequenceableCollection);
  23640. $core.addMethod(
  23641. $core.method({
  23642. selector: "inspectOn:",
  23643. protocol: '*Platform-Services',
  23644. fn: function (anInspector){
  23645. var self=this;
  23646. var variables,i;
  23647. return $core.withContext(function($ctx1) {
  23648. variables=$recv($globals.Dictionary)._new();
  23649. $recv(variables)._at_put_("#self",self);
  23650. $ctx1.sendIdx["at:put:"]=1;
  23651. i=(1);
  23652. self._do_((function(each){
  23653. return $core.withContext(function($ctx2) {
  23654. $recv(variables)._at_put_(i,each);
  23655. i=$recv(i).__plus((1));
  23656. return i;
  23657. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23658. }));
  23659. $recv(anInspector)._setLabel_(self._printString());
  23660. $recv(anInspector)._setVariables_(variables);
  23661. return self;
  23662. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  23663. },
  23664. args: ["anInspector"],
  23665. 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",
  23666. referencedClasses: ["Dictionary"],
  23667. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  23668. }),
  23669. $globals.Set);
  23670. $core.addMethod(
  23671. $core.method({
  23672. selector: "inspectOn:",
  23673. protocol: '*Platform-Services',
  23674. fn: function (anInspector){
  23675. var self=this;
  23676. var label;
  23677. return $core.withContext(function($ctx1) {
  23678. var $3,$2,$1,$5,$4;
  23679. (
  23680. $ctx1.supercall = true,
  23681. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($recv(self), [anInspector]));
  23682. $ctx1.supercall = false;
  23683. $3=self._printString();
  23684. $ctx1.sendIdx["printString"]=1;
  23685. $2=$recv($3)._size();
  23686. $1=$recv($2).__gt((30));
  23687. if($core.assert($1)){
  23688. $5=self._printString();
  23689. $ctx1.sendIdx["printString"]=2;
  23690. $4=$recv($5)._copyFrom_to_((1),(30));
  23691. label=$recv($4).__comma("...'");
  23692. label;
  23693. } else {
  23694. label=self._printString();
  23695. label;
  23696. };
  23697. $recv(anInspector)._setLabel_(label);
  23698. return self;
  23699. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  23700. },
  23701. args: ["anInspector"],
  23702. 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",
  23703. referencedClasses: [],
  23704. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  23705. }),
  23706. $globals.String);
  23707. });
  23708. define('amber_core/Platform-Node',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  23709. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  23710. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  23711. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  23712. $core.addPackage('Platform-Node');
  23713. $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  23714. $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23715. $core.addClass('NodePlatform', $globals.Object, [], 'Platform-Node');
  23716. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  23717. $core.addMethod(
  23718. $core.method({
  23719. selector: "globals",
  23720. protocol: 'accessing',
  23721. fn: function (){
  23722. var self=this;
  23723. return global;
  23724. },
  23725. args: [],
  23726. source: "globals\x0a\x09^ global",
  23727. referencedClasses: [],
  23728. messageSends: []
  23729. }),
  23730. $globals.NodePlatform);
  23731. $core.addMethod(
  23732. $core.method({
  23733. selector: "newXhr",
  23734. protocol: 'accessing',
  23735. fn: function (){
  23736. var self=this;
  23737. return $core.withContext(function($ctx1) {
  23738. var $receiver;
  23739. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.isNil){
  23740. self._error_("XMLHttpRequest not available.");
  23741. } else {
  23742. return $recv($globals.XMLHttpRequest)._new();
  23743. };
  23744. return self;
  23745. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  23746. },
  23747. args: [],
  23748. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  23749. referencedClasses: ["XMLHttpRequest"],
  23750. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  23751. }),
  23752. $globals.NodePlatform);
  23753. $core.addMethod(
  23754. $core.method({
  23755. selector: "initialize",
  23756. protocol: 'testing',
  23757. fn: function (){
  23758. var self=this;
  23759. return $core.withContext(function($ctx1) {
  23760. var $1;
  23761. $1=self._isFeasible();
  23762. if($core.assert($1)){
  23763. $recv($globals.Platform)._registerIfNone_(self._new());
  23764. };
  23765. return self;
  23766. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.klass)});
  23767. },
  23768. args: [],
  23769. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  23770. referencedClasses: ["Platform"],
  23771. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  23772. }),
  23773. $globals.NodePlatform.klass);
  23774. $core.addMethod(
  23775. $core.method({
  23776. selector: "isFeasible",
  23777. protocol: 'testing',
  23778. fn: function (){
  23779. var self=this;
  23780. return $core.withContext(function($ctx1) {
  23781. return typeof global !== "undefined";
  23782. return self;
  23783. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.klass)});
  23784. },
  23785. args: [],
  23786. source: "isFeasible\x0a<inlineJS: 'return typeof global !== \x22undefined\x22'>",
  23787. referencedClasses: [],
  23788. messageSends: []
  23789. }),
  23790. $globals.NodePlatform.klass);
  23791. });
  23792. define('amber/deploy',[
  23793. './helpers',
  23794. './compatibility', // pre-fetch, dep of ./boot
  23795. './boot', // pre-fetch, dep of ./helpers
  23796. // --- packages of the core Amber begin here ---
  23797. 'amber_core/Kernel-Objects',
  23798. 'amber_core/Kernel-Classes',
  23799. 'amber_core/Kernel-Methods',
  23800. 'amber_core/Kernel-Collections',
  23801. 'amber_core/Kernel-Dag',
  23802. 'amber_core/Kernel-Infrastructure',
  23803. 'amber_core/Kernel-Promises',
  23804. 'amber_core/Kernel-Exceptions',
  23805. 'amber_core/Kernel-Announcements',
  23806. 'amber_core/Platform-Services',
  23807. 'amber/Platform'
  23808. // --- packages of the core Amber end here ---
  23809. ], function (amber) { return amber; });
  23810. define('amber/parser',['./boot'], function($boot) {
  23811. var $globals = $boot.globals, nil = $boot.nilAsReceiver;
  23812. $globals.SmalltalkParser = (function() {
  23813. "use strict";
  23814. /*
  23815. * Generated by PEG.js 0.9.0.
  23816. *
  23817. * http://pegjs.org/
  23818. */
  23819. function peg$subclass(child, parent) {
  23820. function ctor() { this.constructor = child; }
  23821. ctor.prototype = parent.prototype;
  23822. child.prototype = new ctor();
  23823. }
  23824. function peg$SyntaxError(message, expected, found, location) {
  23825. this.message = message;
  23826. this.expected = expected;
  23827. this.found = found;
  23828. this.location = location;
  23829. this.name = "SyntaxError";
  23830. if (typeof Error.captureStackTrace === "function") {
  23831. Error.captureStackTrace(this, peg$SyntaxError);
  23832. }
  23833. }
  23834. peg$subclass(peg$SyntaxError, Error);
  23835. function peg$parse(input) {
  23836. var options = arguments.length > 1 ? arguments[1] : {},
  23837. parser = this,
  23838. peg$FAILED = {},
  23839. peg$startRuleFunctions = { start: peg$parsestart },
  23840. peg$startRuleFunction = peg$parsestart,
  23841. peg$c0 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  23842. peg$c1 = { type: "class", value: "[ \\t\\v\\f\\u00A0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\v\\f\\u00A0\\uFEFF\\n\\r\\u2028\\u2029]" },
  23843. peg$c2 = "\"",
  23844. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  23845. peg$c4 = /^[^"]/,
  23846. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  23847. peg$c6 = ".",
  23848. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  23849. peg$c8 = /^[a-zA-Z]/,
  23850. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  23851. peg$c10 = /^[a-zA-Z0-9]/,
  23852. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  23853. peg$c12 = function(first, others) {return first + others.join("");},
  23854. peg$c13 = ":",
  23855. peg$c14 = { type: "literal", value: ":", description: "\":\"" },
  23856. peg$c15 = function(first, last) {return first + last;},
  23857. peg$c16 = /^[a-zA-Z0-9:]/,
  23858. peg$c17 = { type: "class", value: "[a-zA-Z0-9\\:]", description: "[a-zA-Z0-9\\:]" },
  23859. peg$c18 = /^[A-Z]/,
  23860. peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  23861. peg$c20 = "'",
  23862. peg$c21 = { type: "literal", value: "'", description: "\"'\"" },
  23863. peg$c22 = "''",
  23864. peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
  23865. peg$c24 = function() {return "'";},
  23866. peg$c25 = /^[^']/,
  23867. peg$c26 = { type: "class", value: "[^']", description: "[^']" },
  23868. peg$c27 = function(val) {
  23869. return $globals.ValueNode._new()
  23870. ._location_(location())
  23871. ._source_(text())
  23872. ._value_(val.join(""));
  23873. },
  23874. peg$c28 = "$",
  23875. peg$c29 = { type: "literal", value: "$", description: "\"$\"" },
  23876. peg$c30 = { type: "any", description: "any character" },
  23877. peg$c31 = function(char) {
  23878. return $globals.ValueNode._new()
  23879. ._location_(location())
  23880. ._source_(text())
  23881. ._value_(char);
  23882. },
  23883. peg$c32 = "#",
  23884. peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
  23885. peg$c34 = function(rest) {return rest;},
  23886. peg$c35 = function(node) {return node._value();},
  23887. peg$c36 = function(val) {
  23888. return $globals.ValueNode._new()
  23889. ._location_(location())
  23890. ._source_(text())
  23891. ._value_(val);
  23892. },
  23893. peg$c37 = function(n) {
  23894. return $globals.ValueNode._new()
  23895. ._location_(location())
  23896. ._source_(text())
  23897. ._value_(n);
  23898. },
  23899. peg$c38 = "e",
  23900. peg$c39 = { type: "literal", value: "e", description: "\"e\"" },
  23901. peg$c40 = function(n) {return parseFloat(n.join(""));},
  23902. peg$c41 = "-",
  23903. peg$c42 = { type: "literal", value: "-", description: "\"-\"" },
  23904. peg$c43 = "16r",
  23905. peg$c44 = { type: "literal", value: "16r", description: "\"16r\"" },
  23906. peg$c45 = /^[0-9a-fA-F]/,
  23907. peg$c46 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  23908. peg$c47 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  23909. peg$c48 = /^[0-9]/,
  23910. peg$c49 = { type: "class", value: "[0-9]", description: "[0-9]" },
  23911. peg$c50 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  23912. peg$c51 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));},
  23913. peg$c52 = "#(",
  23914. peg$c53 = { type: "literal", value: "#(", description: "\"#(\"" },
  23915. peg$c54 = ")",
  23916. peg$c55 = { type: "literal", value: ")", description: "\")\"" },
  23917. peg$c56 = function(rest) {
  23918. return rest
  23919. ._location_(location())
  23920. ._source_(text());
  23921. },
  23922. peg$c57 = "(",
  23923. peg$c58 = { type: "literal", value: "(", description: "\"(\"" },
  23924. peg$c59 = function(lit) {return lit._value();},
  23925. peg$c60 = function(lits) {
  23926. return $globals.ValueNode._new()
  23927. ._value_(lits);
  23928. },
  23929. peg$c61 = "{",
  23930. peg$c62 = { type: "literal", value: "{", description: "\"{\"" },
  23931. peg$c63 = "}",
  23932. peg$c64 = { type: "literal", value: "}", description: "\"}\"" },
  23933. peg$c65 = function(expressions) {
  23934. return $globals.DynamicArrayNode._new()
  23935. ._location_(location())
  23936. ._source_(text())
  23937. ._dagChildren_(expressions || []);
  23938. },
  23939. peg$c66 = "#{",
  23940. peg$c67 = { type: "literal", value: "#{", description: "\"#{\"" },
  23941. peg$c68 = function(expressions) {
  23942. return $globals.DynamicDictionaryNode._new()
  23943. ._location_(location())
  23944. ._source_(text())
  23945. ._dagChildren_(expressions || []);
  23946. },
  23947. peg$c69 = "true",
  23948. peg$c70 = { type: "literal", value: "true", description: "\"true\"" },
  23949. peg$c71 = function() {return true;},
  23950. peg$c72 = "false",
  23951. peg$c73 = { type: "literal", value: "false", description: "\"false\"" },
  23952. peg$c74 = function() {return false;},
  23953. peg$c75 = "nil",
  23954. peg$c76 = { type: "literal", value: "nil", description: "\"nil\"" },
  23955. peg$c77 = function() {return nil;},
  23956. peg$c78 = function(val) {
  23957. return $globals.ValueNode._new()
  23958. ._location_(location())
  23959. ._source_(text())
  23960. ._value_(val);
  23961. },
  23962. peg$c79 = function(identifier) {
  23963. return $globals.VariableNode._new()
  23964. ._location_(location())
  23965. ._source_(text())
  23966. ._value_(identifier);
  23967. },
  23968. peg$c80 = /^[\\+*\/=><,@%~|&\-]/,
  23969. peg$c81 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  23970. peg$c82 = function(bin) {return bin.join("");},
  23971. peg$c83 = function(key, arg) {return {key:key, arg:arg};},
  23972. peg$c84 = function(pairs) {
  23973. var selector = "";
  23974. var params = [];
  23975. for(var i = 0; i < pairs.length; i++){
  23976. selector += pairs[i].key;
  23977. params.push(pairs[i].arg);
  23978. }
  23979. return [selector, params];
  23980. },
  23981. peg$c85 = function(selector, arg) {return [selector, [arg]];},
  23982. peg$c86 = function(selector) {return [selector, []];},
  23983. peg$c87 = function(expression) {return expression;},
  23984. peg$c88 = function(first, others) { return [first].concat(others); },
  23985. peg$c89 = ":=",
  23986. peg$c90 = { type: "literal", value: ":=", description: "\":=\"" },
  23987. peg$c91 = function(variable, expression) {
  23988. return $globals.AssignmentNode._new()
  23989. ._location_(location())
  23990. ._source_(text())
  23991. ._left_(variable)
  23992. ._right_(expression);
  23993. },
  23994. peg$c92 = "^",
  23995. peg$c93 = { type: "literal", value: "^", description: "\"^\"" },
  23996. peg$c94 = function(expression) {
  23997. return $globals.ReturnNode._new()
  23998. ._location_(location())
  23999. ._source_(text())
  24000. ._dagChildren_([expression]);
  24001. },
  24002. peg$c95 = "|",
  24003. peg$c96 = { type: "literal", value: "|", description: "\"|\"" },
  24004. peg$c97 = function(variable) {return variable;},
  24005. peg$c98 = function(vars) {return vars;},
  24006. peg$c99 = function(param) {return param;},
  24007. peg$c100 = function(params) {return params;},
  24008. peg$c101 = function(ret) {return [ret];},
  24009. peg$c102 = function(exps, ret) {
  24010. var expressions = exps;
  24011. expressions.push(ret);
  24012. return expressions;
  24013. },
  24014. peg$c103 = function(expressions) {
  24015. return expressions || [];
  24016. },
  24017. peg$c104 = function(js) { return js; },
  24018. peg$c105 = function(temps, statements) {
  24019. return $globals.SequenceNode._new()
  24020. ._location_(location())
  24021. ._source_(text())
  24022. ._temps_(temps || [])
  24023. ._dagChildren_(statements || []);
  24024. },
  24025. peg$c106 = "[",
  24026. peg$c107 = { type: "literal", value: "[", description: "\"[\"" },
  24027. peg$c108 = "]",
  24028. peg$c109 = { type: "literal", value: "]", description: "\"]\"" },
  24029. peg$c110 = function(params, sequence) {
  24030. return $globals.BlockNode._new()
  24031. ._location_(location())
  24032. ._source_(text())
  24033. ._parameters_(params || [])
  24034. ._dagChildren_([sequence._asBlockSequenceNode()]);
  24035. },
  24036. peg$c111 = function(selector) {
  24037. return $globals.SendNode._new()
  24038. ._location_(location())
  24039. ._source_(text())
  24040. ._selector_(selector);
  24041. },
  24042. peg$c112 = function(message, tail) {
  24043. if(tail) {
  24044. return tail._valueForReceiver_(message);
  24045. }
  24046. else {
  24047. return message;
  24048. }
  24049. },
  24050. peg$c113 = function(receiver, tail) {
  24051. if(tail) {
  24052. return tail._valueForReceiver_(receiver);
  24053. }
  24054. else {
  24055. return receiver;
  24056. }
  24057. },
  24058. peg$c114 = function(selector, arg) {
  24059. return $globals.SendNode._new()
  24060. ._location_(location())
  24061. ._source_(text())
  24062. ._selector_(selector)
  24063. ._arguments_([arg]);
  24064. },
  24065. peg$c115 = function(message, tail) {
  24066. if(tail) {
  24067. return tail._valueForReceiver_(message);
  24068. }
  24069. else {
  24070. return message;
  24071. }
  24072. },
  24073. peg$c116 = function(pairs) {
  24074. var selector = "";
  24075. var args = [];
  24076. for(var i = 0; i < pairs.length; i++) {
  24077. selector += pairs[i].key;
  24078. args.push(pairs[i].arg);
  24079. }
  24080. return $globals.SendNode._new()
  24081. ._location_(location())
  24082. ._source_(text())
  24083. ._selector_(selector)
  24084. ._arguments_(args);
  24085. },
  24086. peg$c117 = function(send) { return send._isSendNode(); },
  24087. peg$c118 = ";",
  24088. peg$c119 = { type: "literal", value: ";", description: "\";\"" },
  24089. peg$c120 = function(send, mess) {return mess;},
  24090. peg$c121 = function(send, messages) {
  24091. messages.unshift(send);
  24092. return $globals.CascadeNode._new()
  24093. ._location_(location())
  24094. ._source_(text())
  24095. ._dagChildren_(messages);
  24096. },
  24097. peg$c122 = "<",
  24098. peg$c123 = { type: "literal", value: "<", description: "\"<\"" },
  24099. peg$c124 = ">>",
  24100. peg$c125 = { type: "literal", value: ">>", description: "\">>\"" },
  24101. peg$c126 = function() {return ">";},
  24102. peg$c127 = /^[^>]/,
  24103. peg$c128 = { type: "class", value: "[^>]", description: "[^>]" },
  24104. peg$c129 = ">",
  24105. peg$c130 = { type: "literal", value: ">", description: "\">\"" },
  24106. peg$c131 = function(val) {
  24107. console.warn("Use of <...js code...> is deprecated, in:\n" + val.join(""));
  24108. return $globals.JSStatementNode._new()
  24109. ._location_(location())
  24110. ._source_(val.join(""))
  24111. },
  24112. peg$c132 = "inlineJS:",
  24113. peg$c133 = { type: "literal", value: "inlineJS:", description: "\"inlineJS:\"" },
  24114. peg$c134 = function(val) {
  24115. return $globals.JSStatementNode._new()
  24116. ._location_(location())
  24117. ._source_(val._value())
  24118. },
  24119. peg$c135 = function(pattern, sequence) {
  24120. return $globals.MethodNode._new()
  24121. ._location_(location())
  24122. ._source_(text())
  24123. ._selector_(pattern[0])
  24124. ._arguments_(pattern[1])
  24125. ._dagChildren_([sequence]);
  24126. },
  24127. peg$c136 = function(send) { return send._isSendNode() && send._selector() === "->" },
  24128. peg$c137 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  24129. peg$c138 = function(first, others) { return first.concat.apply(first, others); },
  24130. peg$currPos = 0,
  24131. peg$savedPos = 0,
  24132. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  24133. peg$maxFailPos = 0,
  24134. peg$maxFailExpected = [],
  24135. peg$silentFails = 0,
  24136. peg$resultsCache = {},
  24137. peg$result;
  24138. if ("startRule" in options) {
  24139. if (!(options.startRule in peg$startRuleFunctions)) {
  24140. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  24141. }
  24142. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  24143. }
  24144. function text() {
  24145. return input.substring(peg$savedPos, peg$currPos);
  24146. }
  24147. function location() {
  24148. return peg$computeLocation(peg$savedPos, peg$currPos);
  24149. }
  24150. function expected(description) {
  24151. throw peg$buildException(
  24152. null,
  24153. [{ type: "other", description: description }],
  24154. input.substring(peg$savedPos, peg$currPos),
  24155. peg$computeLocation(peg$savedPos, peg$currPos)
  24156. );
  24157. }
  24158. function error(message) {
  24159. throw peg$buildException(
  24160. message,
  24161. null,
  24162. input.substring(peg$savedPos, peg$currPos),
  24163. peg$computeLocation(peg$savedPos, peg$currPos)
  24164. );
  24165. }
  24166. function peg$computePosDetails(pos) {
  24167. var details = peg$posDetailsCache[pos],
  24168. p, ch;
  24169. if (details) {
  24170. return details;
  24171. } else {
  24172. p = pos - 1;
  24173. while (!peg$posDetailsCache[p]) {
  24174. p--;
  24175. }
  24176. details = peg$posDetailsCache[p];
  24177. details = {
  24178. line: details.line,
  24179. column: details.column,
  24180. seenCR: details.seenCR
  24181. };
  24182. while (p < pos) {
  24183. ch = input.charAt(p);
  24184. if (ch === "\n") {
  24185. if (!details.seenCR) { details.line++; }
  24186. details.column = 1;
  24187. details.seenCR = false;
  24188. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  24189. details.line++;
  24190. details.column = 1;
  24191. details.seenCR = true;
  24192. } else {
  24193. details.column++;
  24194. details.seenCR = false;
  24195. }
  24196. p++;
  24197. }
  24198. peg$posDetailsCache[pos] = details;
  24199. return details;
  24200. }
  24201. }
  24202. function peg$computeLocation(startPos, endPos) {
  24203. var startPosDetails = peg$computePosDetails(startPos),
  24204. endPosDetails = peg$computePosDetails(endPos);
  24205. return {
  24206. start: {
  24207. offset: startPos,
  24208. line: startPosDetails.line,
  24209. column: startPosDetails.column
  24210. },
  24211. end: {
  24212. offset: endPos,
  24213. line: endPosDetails.line,
  24214. column: endPosDetails.column
  24215. }
  24216. };
  24217. }
  24218. function peg$fail(expected) {
  24219. if (peg$currPos < peg$maxFailPos) { return; }
  24220. if (peg$currPos > peg$maxFailPos) {
  24221. peg$maxFailPos = peg$currPos;
  24222. peg$maxFailExpected = [];
  24223. }
  24224. peg$maxFailExpected.push(expected);
  24225. }
  24226. function peg$buildException(message, expected, found, location) {
  24227. function cleanupExpected(expected) {
  24228. var i = 1;
  24229. expected.sort(function(a, b) {
  24230. if (a.description < b.description) {
  24231. return -1;
  24232. } else if (a.description > b.description) {
  24233. return 1;
  24234. } else {
  24235. return 0;
  24236. }
  24237. });
  24238. while (i < expected.length) {
  24239. if (expected[i - 1] === expected[i]) {
  24240. expected.splice(i, 1);
  24241. } else {
  24242. i++;
  24243. }
  24244. }
  24245. }
  24246. function buildMessage(expected, found) {
  24247. function stringEscape(s) {
  24248. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  24249. return s
  24250. .replace(/\\/g, '\\\\')
  24251. .replace(/"/g, '\\"')
  24252. .replace(/\x08/g, '\\b')
  24253. .replace(/\t/g, '\\t')
  24254. .replace(/\n/g, '\\n')
  24255. .replace(/\f/g, '\\f')
  24256. .replace(/\r/g, '\\r')
  24257. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  24258. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  24259. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  24260. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  24261. }
  24262. var expectedDescs = new Array(expected.length),
  24263. expectedDesc, foundDesc, i;
  24264. for (i = 0; i < expected.length; i++) {
  24265. expectedDescs[i] = expected[i].description;
  24266. }
  24267. expectedDesc = expected.length > 1
  24268. ? expectedDescs.slice(0, -1).join(", ")
  24269. + " or "
  24270. + expectedDescs[expected.length - 1]
  24271. : expectedDescs[0];
  24272. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  24273. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  24274. }
  24275. if (expected !== null) {
  24276. cleanupExpected(expected);
  24277. }
  24278. return new peg$SyntaxError(
  24279. message !== null ? message : buildMessage(expected, found),
  24280. expected,
  24281. found,
  24282. location
  24283. );
  24284. }
  24285. function peg$parsestart() {
  24286. var s0;
  24287. var key = peg$currPos * 63 + 0,
  24288. cached = peg$resultsCache[key];
  24289. if (cached) {
  24290. peg$currPos = cached.nextPos;
  24291. return cached.result;
  24292. }
  24293. s0 = peg$parsemethod();
  24294. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24295. return s0;
  24296. }
  24297. function peg$parseseparator() {
  24298. var s0, s1;
  24299. var key = peg$currPos * 63 + 1,
  24300. cached = peg$resultsCache[key];
  24301. if (cached) {
  24302. peg$currPos = cached.nextPos;
  24303. return cached.result;
  24304. }
  24305. s0 = [];
  24306. if (peg$c0.test(input.charAt(peg$currPos))) {
  24307. s1 = input.charAt(peg$currPos);
  24308. peg$currPos++;
  24309. } else {
  24310. s1 = peg$FAILED;
  24311. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  24312. }
  24313. if (s1 !== peg$FAILED) {
  24314. while (s1 !== peg$FAILED) {
  24315. s0.push(s1);
  24316. if (peg$c0.test(input.charAt(peg$currPos))) {
  24317. s1 = input.charAt(peg$currPos);
  24318. peg$currPos++;
  24319. } else {
  24320. s1 = peg$FAILED;
  24321. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  24322. }
  24323. }
  24324. } else {
  24325. s0 = peg$FAILED;
  24326. }
  24327. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24328. return s0;
  24329. }
  24330. function peg$parsecomments() {
  24331. var s0, s1, s2, s3, s4;
  24332. var key = peg$currPos * 63 + 2,
  24333. cached = peg$resultsCache[key];
  24334. if (cached) {
  24335. peg$currPos = cached.nextPos;
  24336. return cached.result;
  24337. }
  24338. s0 = [];
  24339. s1 = peg$currPos;
  24340. if (input.charCodeAt(peg$currPos) === 34) {
  24341. s2 = peg$c2;
  24342. peg$currPos++;
  24343. } else {
  24344. s2 = peg$FAILED;
  24345. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24346. }
  24347. if (s2 !== peg$FAILED) {
  24348. s3 = [];
  24349. if (peg$c4.test(input.charAt(peg$currPos))) {
  24350. s4 = input.charAt(peg$currPos);
  24351. peg$currPos++;
  24352. } else {
  24353. s4 = peg$FAILED;
  24354. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24355. }
  24356. while (s4 !== peg$FAILED) {
  24357. s3.push(s4);
  24358. if (peg$c4.test(input.charAt(peg$currPos))) {
  24359. s4 = input.charAt(peg$currPos);
  24360. peg$currPos++;
  24361. } else {
  24362. s4 = peg$FAILED;
  24363. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24364. }
  24365. }
  24366. if (s3 !== peg$FAILED) {
  24367. if (input.charCodeAt(peg$currPos) === 34) {
  24368. s4 = peg$c2;
  24369. peg$currPos++;
  24370. } else {
  24371. s4 = peg$FAILED;
  24372. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24373. }
  24374. if (s4 !== peg$FAILED) {
  24375. s2 = [s2, s3, s4];
  24376. s1 = s2;
  24377. } else {
  24378. peg$currPos = s1;
  24379. s1 = peg$FAILED;
  24380. }
  24381. } else {
  24382. peg$currPos = s1;
  24383. s1 = peg$FAILED;
  24384. }
  24385. } else {
  24386. peg$currPos = s1;
  24387. s1 = peg$FAILED;
  24388. }
  24389. if (s1 !== peg$FAILED) {
  24390. while (s1 !== peg$FAILED) {
  24391. s0.push(s1);
  24392. s1 = peg$currPos;
  24393. if (input.charCodeAt(peg$currPos) === 34) {
  24394. s2 = peg$c2;
  24395. peg$currPos++;
  24396. } else {
  24397. s2 = peg$FAILED;
  24398. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24399. }
  24400. if (s2 !== peg$FAILED) {
  24401. s3 = [];
  24402. if (peg$c4.test(input.charAt(peg$currPos))) {
  24403. s4 = input.charAt(peg$currPos);
  24404. peg$currPos++;
  24405. } else {
  24406. s4 = peg$FAILED;
  24407. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24408. }
  24409. while (s4 !== peg$FAILED) {
  24410. s3.push(s4);
  24411. if (peg$c4.test(input.charAt(peg$currPos))) {
  24412. s4 = input.charAt(peg$currPos);
  24413. peg$currPos++;
  24414. } else {
  24415. s4 = peg$FAILED;
  24416. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24417. }
  24418. }
  24419. if (s3 !== peg$FAILED) {
  24420. if (input.charCodeAt(peg$currPos) === 34) {
  24421. s4 = peg$c2;
  24422. peg$currPos++;
  24423. } else {
  24424. s4 = peg$FAILED;
  24425. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24426. }
  24427. if (s4 !== peg$FAILED) {
  24428. s2 = [s2, s3, s4];
  24429. s1 = s2;
  24430. } else {
  24431. peg$currPos = s1;
  24432. s1 = peg$FAILED;
  24433. }
  24434. } else {
  24435. peg$currPos = s1;
  24436. s1 = peg$FAILED;
  24437. }
  24438. } else {
  24439. peg$currPos = s1;
  24440. s1 = peg$FAILED;
  24441. }
  24442. }
  24443. } else {
  24444. s0 = peg$FAILED;
  24445. }
  24446. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24447. return s0;
  24448. }
  24449. function peg$parsews() {
  24450. var s0, s1;
  24451. var key = peg$currPos * 63 + 3,
  24452. cached = peg$resultsCache[key];
  24453. if (cached) {
  24454. peg$currPos = cached.nextPos;
  24455. return cached.result;
  24456. }
  24457. s0 = [];
  24458. s1 = peg$parseseparator();
  24459. if (s1 === peg$FAILED) {
  24460. s1 = peg$parsecomments();
  24461. }
  24462. while (s1 !== peg$FAILED) {
  24463. s0.push(s1);
  24464. s1 = peg$parseseparator();
  24465. if (s1 === peg$FAILED) {
  24466. s1 = peg$parsecomments();
  24467. }
  24468. }
  24469. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24470. return s0;
  24471. }
  24472. function peg$parsemaybeDotsWs() {
  24473. var s0, s1;
  24474. var key = peg$currPos * 63 + 4,
  24475. cached = peg$resultsCache[key];
  24476. if (cached) {
  24477. peg$currPos = cached.nextPos;
  24478. return cached.result;
  24479. }
  24480. s0 = [];
  24481. if (input.charCodeAt(peg$currPos) === 46) {
  24482. s1 = peg$c6;
  24483. peg$currPos++;
  24484. } else {
  24485. s1 = peg$FAILED;
  24486. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24487. }
  24488. if (s1 === peg$FAILED) {
  24489. s1 = peg$parseseparator();
  24490. if (s1 === peg$FAILED) {
  24491. s1 = peg$parsecomments();
  24492. }
  24493. }
  24494. while (s1 !== peg$FAILED) {
  24495. s0.push(s1);
  24496. if (input.charCodeAt(peg$currPos) === 46) {
  24497. s1 = peg$c6;
  24498. peg$currPos++;
  24499. } else {
  24500. s1 = peg$FAILED;
  24501. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24502. }
  24503. if (s1 === peg$FAILED) {
  24504. s1 = peg$parseseparator();
  24505. if (s1 === peg$FAILED) {
  24506. s1 = peg$parsecomments();
  24507. }
  24508. }
  24509. }
  24510. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24511. return s0;
  24512. }
  24513. function peg$parseidentifier() {
  24514. var s0, s1, s2, s3;
  24515. var key = peg$currPos * 63 + 5,
  24516. cached = peg$resultsCache[key];
  24517. if (cached) {
  24518. peg$currPos = cached.nextPos;
  24519. return cached.result;
  24520. }
  24521. s0 = peg$currPos;
  24522. if (peg$c8.test(input.charAt(peg$currPos))) {
  24523. s1 = input.charAt(peg$currPos);
  24524. peg$currPos++;
  24525. } else {
  24526. s1 = peg$FAILED;
  24527. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24528. }
  24529. if (s1 !== peg$FAILED) {
  24530. s2 = [];
  24531. if (peg$c10.test(input.charAt(peg$currPos))) {
  24532. s3 = input.charAt(peg$currPos);
  24533. peg$currPos++;
  24534. } else {
  24535. s3 = peg$FAILED;
  24536. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24537. }
  24538. while (s3 !== peg$FAILED) {
  24539. s2.push(s3);
  24540. if (peg$c10.test(input.charAt(peg$currPos))) {
  24541. s3 = input.charAt(peg$currPos);
  24542. peg$currPos++;
  24543. } else {
  24544. s3 = peg$FAILED;
  24545. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24546. }
  24547. }
  24548. if (s2 !== peg$FAILED) {
  24549. peg$savedPos = s0;
  24550. s1 = peg$c12(s1, s2);
  24551. s0 = s1;
  24552. } else {
  24553. peg$currPos = s0;
  24554. s0 = peg$FAILED;
  24555. }
  24556. } else {
  24557. peg$currPos = s0;
  24558. s0 = peg$FAILED;
  24559. }
  24560. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24561. return s0;
  24562. }
  24563. function peg$parsekeyword() {
  24564. var s0, s1, s2;
  24565. var key = peg$currPos * 63 + 6,
  24566. cached = peg$resultsCache[key];
  24567. if (cached) {
  24568. peg$currPos = cached.nextPos;
  24569. return cached.result;
  24570. }
  24571. s0 = peg$currPos;
  24572. s1 = peg$parseidentifier();
  24573. if (s1 !== peg$FAILED) {
  24574. if (input.charCodeAt(peg$currPos) === 58) {
  24575. s2 = peg$c13;
  24576. peg$currPos++;
  24577. } else {
  24578. s2 = peg$FAILED;
  24579. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  24580. }
  24581. if (s2 !== peg$FAILED) {
  24582. peg$savedPos = s0;
  24583. s1 = peg$c15(s1, s2);
  24584. s0 = s1;
  24585. } else {
  24586. peg$currPos = s0;
  24587. s0 = peg$FAILED;
  24588. }
  24589. } else {
  24590. peg$currPos = s0;
  24591. s0 = peg$FAILED;
  24592. }
  24593. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24594. return s0;
  24595. }
  24596. function peg$parseselector() {
  24597. var s0, s1, s2, s3;
  24598. var key = peg$currPos * 63 + 7,
  24599. cached = peg$resultsCache[key];
  24600. if (cached) {
  24601. peg$currPos = cached.nextPos;
  24602. return cached.result;
  24603. }
  24604. s0 = peg$currPos;
  24605. if (peg$c8.test(input.charAt(peg$currPos))) {
  24606. s1 = input.charAt(peg$currPos);
  24607. peg$currPos++;
  24608. } else {
  24609. s1 = peg$FAILED;
  24610. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24611. }
  24612. if (s1 !== peg$FAILED) {
  24613. s2 = [];
  24614. if (peg$c16.test(input.charAt(peg$currPos))) {
  24615. s3 = input.charAt(peg$currPos);
  24616. peg$currPos++;
  24617. } else {
  24618. s3 = peg$FAILED;
  24619. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24620. }
  24621. while (s3 !== peg$FAILED) {
  24622. s2.push(s3);
  24623. if (peg$c16.test(input.charAt(peg$currPos))) {
  24624. s3 = input.charAt(peg$currPos);
  24625. peg$currPos++;
  24626. } else {
  24627. s3 = peg$FAILED;
  24628. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24629. }
  24630. }
  24631. if (s2 !== peg$FAILED) {
  24632. peg$savedPos = s0;
  24633. s1 = peg$c12(s1, s2);
  24634. s0 = s1;
  24635. } else {
  24636. peg$currPos = s0;
  24637. s0 = peg$FAILED;
  24638. }
  24639. } else {
  24640. peg$currPos = s0;
  24641. s0 = peg$FAILED;
  24642. }
  24643. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24644. return s0;
  24645. }
  24646. function peg$parseclassName() {
  24647. var s0, s1, s2, s3;
  24648. var key = peg$currPos * 63 + 8,
  24649. cached = peg$resultsCache[key];
  24650. if (cached) {
  24651. peg$currPos = cached.nextPos;
  24652. return cached.result;
  24653. }
  24654. s0 = peg$currPos;
  24655. if (peg$c18.test(input.charAt(peg$currPos))) {
  24656. s1 = input.charAt(peg$currPos);
  24657. peg$currPos++;
  24658. } else {
  24659. s1 = peg$FAILED;
  24660. if (peg$silentFails === 0) { peg$fail(peg$c19); }
  24661. }
  24662. if (s1 !== peg$FAILED) {
  24663. s2 = [];
  24664. if (peg$c10.test(input.charAt(peg$currPos))) {
  24665. s3 = input.charAt(peg$currPos);
  24666. peg$currPos++;
  24667. } else {
  24668. s3 = peg$FAILED;
  24669. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24670. }
  24671. while (s3 !== peg$FAILED) {
  24672. s2.push(s3);
  24673. if (peg$c10.test(input.charAt(peg$currPos))) {
  24674. s3 = input.charAt(peg$currPos);
  24675. peg$currPos++;
  24676. } else {
  24677. s3 = peg$FAILED;
  24678. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24679. }
  24680. }
  24681. if (s2 !== peg$FAILED) {
  24682. peg$savedPos = s0;
  24683. s1 = peg$c12(s1, s2);
  24684. s0 = s1;
  24685. } else {
  24686. peg$currPos = s0;
  24687. s0 = peg$FAILED;
  24688. }
  24689. } else {
  24690. peg$currPos = s0;
  24691. s0 = peg$FAILED;
  24692. }
  24693. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24694. return s0;
  24695. }
  24696. function peg$parsestring() {
  24697. var s0, s1, s2, s3, s4;
  24698. var key = peg$currPos * 63 + 9,
  24699. cached = peg$resultsCache[key];
  24700. if (cached) {
  24701. peg$currPos = cached.nextPos;
  24702. return cached.result;
  24703. }
  24704. s0 = peg$currPos;
  24705. if (input.charCodeAt(peg$currPos) === 39) {
  24706. s1 = peg$c20;
  24707. peg$currPos++;
  24708. } else {
  24709. s1 = peg$FAILED;
  24710. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24711. }
  24712. if (s1 !== peg$FAILED) {
  24713. s2 = [];
  24714. s3 = peg$currPos;
  24715. if (input.substr(peg$currPos, 2) === peg$c22) {
  24716. s4 = peg$c22;
  24717. peg$currPos += 2;
  24718. } else {
  24719. s4 = peg$FAILED;
  24720. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24721. }
  24722. if (s4 !== peg$FAILED) {
  24723. peg$savedPos = s3;
  24724. s4 = peg$c24();
  24725. }
  24726. s3 = s4;
  24727. if (s3 === peg$FAILED) {
  24728. if (peg$c25.test(input.charAt(peg$currPos))) {
  24729. s3 = input.charAt(peg$currPos);
  24730. peg$currPos++;
  24731. } else {
  24732. s3 = peg$FAILED;
  24733. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24734. }
  24735. }
  24736. while (s3 !== peg$FAILED) {
  24737. s2.push(s3);
  24738. s3 = peg$currPos;
  24739. if (input.substr(peg$currPos, 2) === peg$c22) {
  24740. s4 = peg$c22;
  24741. peg$currPos += 2;
  24742. } else {
  24743. s4 = peg$FAILED;
  24744. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24745. }
  24746. if (s4 !== peg$FAILED) {
  24747. peg$savedPos = s3;
  24748. s4 = peg$c24();
  24749. }
  24750. s3 = s4;
  24751. if (s3 === peg$FAILED) {
  24752. if (peg$c25.test(input.charAt(peg$currPos))) {
  24753. s3 = input.charAt(peg$currPos);
  24754. peg$currPos++;
  24755. } else {
  24756. s3 = peg$FAILED;
  24757. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24758. }
  24759. }
  24760. }
  24761. if (s2 !== peg$FAILED) {
  24762. if (input.charCodeAt(peg$currPos) === 39) {
  24763. s3 = peg$c20;
  24764. peg$currPos++;
  24765. } else {
  24766. s3 = peg$FAILED;
  24767. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24768. }
  24769. if (s3 !== peg$FAILED) {
  24770. peg$savedPos = s0;
  24771. s1 = peg$c27(s2);
  24772. s0 = s1;
  24773. } else {
  24774. peg$currPos = s0;
  24775. s0 = peg$FAILED;
  24776. }
  24777. } else {
  24778. peg$currPos = s0;
  24779. s0 = peg$FAILED;
  24780. }
  24781. } else {
  24782. peg$currPos = s0;
  24783. s0 = peg$FAILED;
  24784. }
  24785. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24786. return s0;
  24787. }
  24788. function peg$parsecharacter() {
  24789. var s0, s1, s2;
  24790. var key = peg$currPos * 63 + 10,
  24791. cached = peg$resultsCache[key];
  24792. if (cached) {
  24793. peg$currPos = cached.nextPos;
  24794. return cached.result;
  24795. }
  24796. s0 = peg$currPos;
  24797. if (input.charCodeAt(peg$currPos) === 36) {
  24798. s1 = peg$c28;
  24799. peg$currPos++;
  24800. } else {
  24801. s1 = peg$FAILED;
  24802. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  24803. }
  24804. if (s1 !== peg$FAILED) {
  24805. if (input.length > peg$currPos) {
  24806. s2 = input.charAt(peg$currPos);
  24807. peg$currPos++;
  24808. } else {
  24809. s2 = peg$FAILED;
  24810. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  24811. }
  24812. if (s2 !== peg$FAILED) {
  24813. peg$savedPos = s0;
  24814. s1 = peg$c31(s2);
  24815. s0 = s1;
  24816. } else {
  24817. peg$currPos = s0;
  24818. s0 = peg$FAILED;
  24819. }
  24820. } else {
  24821. peg$currPos = s0;
  24822. s0 = peg$FAILED;
  24823. }
  24824. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24825. return s0;
  24826. }
  24827. function peg$parsesymbol() {
  24828. var s0, s1, s2;
  24829. var key = peg$currPos * 63 + 11,
  24830. cached = peg$resultsCache[key];
  24831. if (cached) {
  24832. peg$currPos = cached.nextPos;
  24833. return cached.result;
  24834. }
  24835. s0 = peg$currPos;
  24836. if (input.charCodeAt(peg$currPos) === 35) {
  24837. s1 = peg$c32;
  24838. peg$currPos++;
  24839. } else {
  24840. s1 = peg$FAILED;
  24841. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  24842. }
  24843. if (s1 !== peg$FAILED) {
  24844. s2 = peg$parsebareSymbol();
  24845. if (s2 !== peg$FAILED) {
  24846. peg$savedPos = s0;
  24847. s1 = peg$c34(s2);
  24848. s0 = s1;
  24849. } else {
  24850. peg$currPos = s0;
  24851. s0 = peg$FAILED;
  24852. }
  24853. } else {
  24854. peg$currPos = s0;
  24855. s0 = peg$FAILED;
  24856. }
  24857. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24858. return s0;
  24859. }
  24860. function peg$parsebareSymbol() {
  24861. var s0, s1, s2;
  24862. var key = peg$currPos * 63 + 12,
  24863. cached = peg$resultsCache[key];
  24864. if (cached) {
  24865. peg$currPos = cached.nextPos;
  24866. return cached.result;
  24867. }
  24868. s0 = peg$currPos;
  24869. s1 = peg$parseselector();
  24870. if (s1 === peg$FAILED) {
  24871. s1 = peg$parsebinarySelector();
  24872. if (s1 === peg$FAILED) {
  24873. s1 = peg$currPos;
  24874. s2 = peg$parsestring();
  24875. if (s2 !== peg$FAILED) {
  24876. peg$savedPos = s1;
  24877. s2 = peg$c35(s2);
  24878. }
  24879. s1 = s2;
  24880. }
  24881. }
  24882. if (s1 !== peg$FAILED) {
  24883. peg$savedPos = s0;
  24884. s1 = peg$c36(s1);
  24885. }
  24886. s0 = s1;
  24887. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24888. return s0;
  24889. }
  24890. function peg$parsenumber() {
  24891. var s0, s1;
  24892. var key = peg$currPos * 63 + 13,
  24893. cached = peg$resultsCache[key];
  24894. if (cached) {
  24895. peg$currPos = cached.nextPos;
  24896. return cached.result;
  24897. }
  24898. s0 = peg$currPos;
  24899. s1 = peg$parsenumberExp();
  24900. if (s1 === peg$FAILED) {
  24901. s1 = peg$parsehex();
  24902. if (s1 === peg$FAILED) {
  24903. s1 = peg$parsefloat();
  24904. if (s1 === peg$FAILED) {
  24905. s1 = peg$parseinteger();
  24906. }
  24907. }
  24908. }
  24909. if (s1 !== peg$FAILED) {
  24910. peg$savedPos = s0;
  24911. s1 = peg$c37(s1);
  24912. }
  24913. s0 = s1;
  24914. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24915. return s0;
  24916. }
  24917. function peg$parsenumberExp() {
  24918. var s0, s1, s2, s3, s4;
  24919. var key = peg$currPos * 63 + 14,
  24920. cached = peg$resultsCache[key];
  24921. if (cached) {
  24922. peg$currPos = cached.nextPos;
  24923. return cached.result;
  24924. }
  24925. s0 = peg$currPos;
  24926. s1 = peg$currPos;
  24927. s2 = peg$parsefloat();
  24928. if (s2 === peg$FAILED) {
  24929. s2 = peg$parseinteger();
  24930. }
  24931. if (s2 !== peg$FAILED) {
  24932. if (input.charCodeAt(peg$currPos) === 101) {
  24933. s3 = peg$c38;
  24934. peg$currPos++;
  24935. } else {
  24936. s3 = peg$FAILED;
  24937. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  24938. }
  24939. if (s3 !== peg$FAILED) {
  24940. s4 = peg$parseinteger();
  24941. if (s4 !== peg$FAILED) {
  24942. s2 = [s2, s3, s4];
  24943. s1 = s2;
  24944. } else {
  24945. peg$currPos = s1;
  24946. s1 = peg$FAILED;
  24947. }
  24948. } else {
  24949. peg$currPos = s1;
  24950. s1 = peg$FAILED;
  24951. }
  24952. } else {
  24953. peg$currPos = s1;
  24954. s1 = peg$FAILED;
  24955. }
  24956. if (s1 !== peg$FAILED) {
  24957. peg$savedPos = s0;
  24958. s1 = peg$c40(s1);
  24959. }
  24960. s0 = s1;
  24961. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24962. return s0;
  24963. }
  24964. function peg$parsehex() {
  24965. var s0, s1, s2, s3, s4;
  24966. var key = peg$currPos * 63 + 15,
  24967. cached = peg$resultsCache[key];
  24968. if (cached) {
  24969. peg$currPos = cached.nextPos;
  24970. return cached.result;
  24971. }
  24972. s0 = peg$currPos;
  24973. if (input.charCodeAt(peg$currPos) === 45) {
  24974. s1 = peg$c41;
  24975. peg$currPos++;
  24976. } else {
  24977. s1 = peg$FAILED;
  24978. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  24979. }
  24980. if (s1 === peg$FAILED) {
  24981. s1 = null;
  24982. }
  24983. if (s1 !== peg$FAILED) {
  24984. if (input.substr(peg$currPos, 3) === peg$c43) {
  24985. s2 = peg$c43;
  24986. peg$currPos += 3;
  24987. } else {
  24988. s2 = peg$FAILED;
  24989. if (peg$silentFails === 0) { peg$fail(peg$c44); }
  24990. }
  24991. if (s2 !== peg$FAILED) {
  24992. s3 = [];
  24993. if (peg$c45.test(input.charAt(peg$currPos))) {
  24994. s4 = input.charAt(peg$currPos);
  24995. peg$currPos++;
  24996. } else {
  24997. s4 = peg$FAILED;
  24998. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  24999. }
  25000. if (s4 !== peg$FAILED) {
  25001. while (s4 !== peg$FAILED) {
  25002. s3.push(s4);
  25003. if (peg$c45.test(input.charAt(peg$currPos))) {
  25004. s4 = input.charAt(peg$currPos);
  25005. peg$currPos++;
  25006. } else {
  25007. s4 = peg$FAILED;
  25008. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  25009. }
  25010. }
  25011. } else {
  25012. s3 = peg$FAILED;
  25013. }
  25014. if (s3 !== peg$FAILED) {
  25015. peg$savedPos = s0;
  25016. s1 = peg$c47(s1, s3);
  25017. s0 = s1;
  25018. } else {
  25019. peg$currPos = s0;
  25020. s0 = peg$FAILED;
  25021. }
  25022. } else {
  25023. peg$currPos = s0;
  25024. s0 = peg$FAILED;
  25025. }
  25026. } else {
  25027. peg$currPos = s0;
  25028. s0 = peg$FAILED;
  25029. }
  25030. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25031. return s0;
  25032. }
  25033. function peg$parsefloat() {
  25034. var s0, s1, s2, s3, s4, s5;
  25035. var key = peg$currPos * 63 + 16,
  25036. cached = peg$resultsCache[key];
  25037. if (cached) {
  25038. peg$currPos = cached.nextPos;
  25039. return cached.result;
  25040. }
  25041. s0 = peg$currPos;
  25042. if (input.charCodeAt(peg$currPos) === 45) {
  25043. s1 = peg$c41;
  25044. peg$currPos++;
  25045. } else {
  25046. s1 = peg$FAILED;
  25047. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  25048. }
  25049. if (s1 === peg$FAILED) {
  25050. s1 = null;
  25051. }
  25052. if (s1 !== peg$FAILED) {
  25053. s2 = [];
  25054. if (peg$c48.test(input.charAt(peg$currPos))) {
  25055. s3 = input.charAt(peg$currPos);
  25056. peg$currPos++;
  25057. } else {
  25058. s3 = peg$FAILED;
  25059. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  25060. }
  25061. if (s3 !== peg$FAILED) {
  25062. while (s3 !== peg$FAILED) {
  25063. s2.push(s3);
  25064. if (peg$c48.test(input.charAt(peg$currPos))) {
  25065. s3 = input.charAt(peg$currPos);
  25066. peg$currPos++;
  25067. } else {
  25068. s3 = peg$FAILED;
  25069. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  25070. }
  25071. }
  25072. } else {
  25073. s2 = peg$FAILED;
  25074. }
  25075. if (s2 !== peg$FAILED) {
  25076. if (input.charCodeAt(peg$currPos) === 46) {
  25077. s3 = peg$c6;
  25078. peg$currPos++;
  25079. } else {
  25080. s3 = peg$FAILED;
  25081. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  25082. }
  25083. if (s3 !== peg$FAILED) {
  25084. s4 = [];
  25085. if (peg$c48.test(input.charAt(peg$currPos))) {
  25086. s5 = input.charAt(peg$currPos);
  25087. peg$currPos++;
  25088. } else {
  25089. s5 = peg$FAILED;
  25090. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  25091. }
  25092. if (s5 !== peg$FAILED) {
  25093. while (s5 !== peg$FAILED) {
  25094. s4.push(s5);
  25095. if (peg$c48.test(input.charAt(peg$currPos))) {
  25096. s5 = input.charAt(peg$currPos);
  25097. peg$currPos++;
  25098. } else {
  25099. s5 = peg$FAILED;
  25100. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  25101. }
  25102. }
  25103. } else {
  25104. s4 = peg$FAILED;
  25105. }
  25106. if (s4 !== peg$FAILED) {
  25107. peg$savedPos = s0;
  25108. s1 = peg$c50(s1, s2, s4);
  25109. s0 = s1;
  25110. } else {
  25111. peg$currPos = s0;
  25112. s0 = peg$FAILED;
  25113. }
  25114. } else {
  25115. peg$currPos = s0;
  25116. s0 = peg$FAILED;
  25117. }
  25118. } else {
  25119. peg$currPos = s0;
  25120. s0 = peg$FAILED;
  25121. }
  25122. } else {
  25123. peg$currPos = s0;
  25124. s0 = peg$FAILED;
  25125. }
  25126. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25127. return s0;
  25128. }
  25129. function peg$parseinteger() {
  25130. var s0, s1, s2, s3;
  25131. var key = peg$currPos * 63 + 17,
  25132. cached = peg$resultsCache[key];
  25133. if (cached) {
  25134. peg$currPos = cached.nextPos;
  25135. return cached.result;
  25136. }
  25137. s0 = peg$currPos;
  25138. if (input.charCodeAt(peg$currPos) === 45) {
  25139. s1 = peg$c41;
  25140. peg$currPos++;
  25141. } else {
  25142. s1 = peg$FAILED;
  25143. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  25144. }
  25145. if (s1 === peg$FAILED) {
  25146. s1 = null;
  25147. }
  25148. if (s1 !== peg$FAILED) {
  25149. s2 = [];
  25150. if (peg$c48.test(input.charAt(peg$currPos))) {
  25151. s3 = input.charAt(peg$currPos);
  25152. peg$currPos++;
  25153. } else {
  25154. s3 = peg$FAILED;
  25155. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  25156. }
  25157. if (s3 !== peg$FAILED) {
  25158. while (s3 !== peg$FAILED) {
  25159. s2.push(s3);
  25160. if (peg$c48.test(input.charAt(peg$currPos))) {
  25161. s3 = input.charAt(peg$currPos);
  25162. peg$currPos++;
  25163. } else {
  25164. s3 = peg$FAILED;
  25165. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  25166. }
  25167. }
  25168. } else {
  25169. s2 = peg$FAILED;
  25170. }
  25171. if (s2 !== peg$FAILED) {
  25172. peg$savedPos = s0;
  25173. s1 = peg$c51(s1, s2);
  25174. s0 = s1;
  25175. } else {
  25176. peg$currPos = s0;
  25177. s0 = peg$FAILED;
  25178. }
  25179. } else {
  25180. peg$currPos = s0;
  25181. s0 = peg$FAILED;
  25182. }
  25183. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25184. return s0;
  25185. }
  25186. function peg$parseliteralArray() {
  25187. var s0, s1, s2, s3, s4;
  25188. var key = peg$currPos * 63 + 18,
  25189. cached = peg$resultsCache[key];
  25190. if (cached) {
  25191. peg$currPos = cached.nextPos;
  25192. return cached.result;
  25193. }
  25194. s0 = peg$currPos;
  25195. if (input.substr(peg$currPos, 2) === peg$c52) {
  25196. s1 = peg$c52;
  25197. peg$currPos += 2;
  25198. } else {
  25199. s1 = peg$FAILED;
  25200. if (peg$silentFails === 0) { peg$fail(peg$c53); }
  25201. }
  25202. if (s1 !== peg$FAILED) {
  25203. s2 = peg$parsewsLiteralArrayContents();
  25204. if (s2 !== peg$FAILED) {
  25205. s3 = peg$parsews();
  25206. if (s3 !== peg$FAILED) {
  25207. if (input.charCodeAt(peg$currPos) === 41) {
  25208. s4 = peg$c54;
  25209. peg$currPos++;
  25210. } else {
  25211. s4 = peg$FAILED;
  25212. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  25213. }
  25214. if (s4 !== peg$FAILED) {
  25215. peg$savedPos = s0;
  25216. s1 = peg$c56(s2);
  25217. s0 = s1;
  25218. } else {
  25219. peg$currPos = s0;
  25220. s0 = peg$FAILED;
  25221. }
  25222. } else {
  25223. peg$currPos = s0;
  25224. s0 = peg$FAILED;
  25225. }
  25226. } else {
  25227. peg$currPos = s0;
  25228. s0 = peg$FAILED;
  25229. }
  25230. } else {
  25231. peg$currPos = s0;
  25232. s0 = peg$FAILED;
  25233. }
  25234. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25235. return s0;
  25236. }
  25237. function peg$parsebareLiteralArray() {
  25238. var s0, s1, s2, s3, s4;
  25239. var key = peg$currPos * 63 + 19,
  25240. cached = peg$resultsCache[key];
  25241. if (cached) {
  25242. peg$currPos = cached.nextPos;
  25243. return cached.result;
  25244. }
  25245. s0 = peg$currPos;
  25246. if (input.charCodeAt(peg$currPos) === 40) {
  25247. s1 = peg$c57;
  25248. peg$currPos++;
  25249. } else {
  25250. s1 = peg$FAILED;
  25251. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  25252. }
  25253. if (s1 !== peg$FAILED) {
  25254. s2 = peg$parsewsLiteralArrayContents();
  25255. if (s2 !== peg$FAILED) {
  25256. s3 = peg$parsews();
  25257. if (s3 !== peg$FAILED) {
  25258. if (input.charCodeAt(peg$currPos) === 41) {
  25259. s4 = peg$c54;
  25260. peg$currPos++;
  25261. } else {
  25262. s4 = peg$FAILED;
  25263. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  25264. }
  25265. if (s4 !== peg$FAILED) {
  25266. peg$savedPos = s0;
  25267. s1 = peg$c56(s2);
  25268. s0 = s1;
  25269. } else {
  25270. peg$currPos = s0;
  25271. s0 = peg$FAILED;
  25272. }
  25273. } else {
  25274. peg$currPos = s0;
  25275. s0 = peg$FAILED;
  25276. }
  25277. } else {
  25278. peg$currPos = s0;
  25279. s0 = peg$FAILED;
  25280. }
  25281. } else {
  25282. peg$currPos = s0;
  25283. s0 = peg$FAILED;
  25284. }
  25285. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25286. return s0;
  25287. }
  25288. function peg$parseliteralArrayElement() {
  25289. var s0;
  25290. var key = peg$currPos * 63 + 20,
  25291. cached = peg$resultsCache[key];
  25292. if (cached) {
  25293. peg$currPos = cached.nextPos;
  25294. return cached.result;
  25295. }
  25296. s0 = peg$parseparseTimeLiteral();
  25297. if (s0 === peg$FAILED) {
  25298. s0 = peg$parsebareLiteralArray();
  25299. if (s0 === peg$FAILED) {
  25300. s0 = peg$parsebareSymbol();
  25301. }
  25302. }
  25303. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25304. return s0;
  25305. }
  25306. function peg$parsewsLiteralArrayContents() {
  25307. var s0, s1, s2, s3, s4;
  25308. var key = peg$currPos * 63 + 21,
  25309. cached = peg$resultsCache[key];
  25310. if (cached) {
  25311. peg$currPos = cached.nextPos;
  25312. return cached.result;
  25313. }
  25314. s0 = peg$currPos;
  25315. s1 = [];
  25316. s2 = peg$currPos;
  25317. s3 = peg$parsews();
  25318. if (s3 !== peg$FAILED) {
  25319. s4 = peg$parseliteralArrayElement();
  25320. if (s4 !== peg$FAILED) {
  25321. peg$savedPos = s2;
  25322. s3 = peg$c59(s4);
  25323. s2 = s3;
  25324. } else {
  25325. peg$currPos = s2;
  25326. s2 = peg$FAILED;
  25327. }
  25328. } else {
  25329. peg$currPos = s2;
  25330. s2 = peg$FAILED;
  25331. }
  25332. while (s2 !== peg$FAILED) {
  25333. s1.push(s2);
  25334. s2 = peg$currPos;
  25335. s3 = peg$parsews();
  25336. if (s3 !== peg$FAILED) {
  25337. s4 = peg$parseliteralArrayElement();
  25338. if (s4 !== peg$FAILED) {
  25339. peg$savedPos = s2;
  25340. s3 = peg$c59(s4);
  25341. s2 = s3;
  25342. } else {
  25343. peg$currPos = s2;
  25344. s2 = peg$FAILED;
  25345. }
  25346. } else {
  25347. peg$currPos = s2;
  25348. s2 = peg$FAILED;
  25349. }
  25350. }
  25351. if (s1 !== peg$FAILED) {
  25352. peg$savedPos = s0;
  25353. s1 = peg$c60(s1);
  25354. }
  25355. s0 = s1;
  25356. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25357. return s0;
  25358. }
  25359. function peg$parsedynamicArray() {
  25360. var s0, s1, s2, s3, s4, s5;
  25361. var key = peg$currPos * 63 + 22,
  25362. cached = peg$resultsCache[key];
  25363. if (cached) {
  25364. peg$currPos = cached.nextPos;
  25365. return cached.result;
  25366. }
  25367. s0 = peg$currPos;
  25368. if (input.charCodeAt(peg$currPos) === 123) {
  25369. s1 = peg$c61;
  25370. peg$currPos++;
  25371. } else {
  25372. s1 = peg$FAILED;
  25373. if (peg$silentFails === 0) { peg$fail(peg$c62); }
  25374. }
  25375. if (s1 !== peg$FAILED) {
  25376. s2 = peg$parsews();
  25377. if (s2 !== peg$FAILED) {
  25378. s3 = peg$parseexpressions();
  25379. if (s3 === peg$FAILED) {
  25380. s3 = null;
  25381. }
  25382. if (s3 !== peg$FAILED) {
  25383. s4 = peg$parsemaybeDotsWs();
  25384. if (s4 !== peg$FAILED) {
  25385. if (input.charCodeAt(peg$currPos) === 125) {
  25386. s5 = peg$c63;
  25387. peg$currPos++;
  25388. } else {
  25389. s5 = peg$FAILED;
  25390. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  25391. }
  25392. if (s5 !== peg$FAILED) {
  25393. peg$savedPos = s0;
  25394. s1 = peg$c65(s3);
  25395. s0 = s1;
  25396. } else {
  25397. peg$currPos = s0;
  25398. s0 = peg$FAILED;
  25399. }
  25400. } else {
  25401. peg$currPos = s0;
  25402. s0 = peg$FAILED;
  25403. }
  25404. } else {
  25405. peg$currPos = s0;
  25406. s0 = peg$FAILED;
  25407. }
  25408. } else {
  25409. peg$currPos = s0;
  25410. s0 = peg$FAILED;
  25411. }
  25412. } else {
  25413. peg$currPos = s0;
  25414. s0 = peg$FAILED;
  25415. }
  25416. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25417. return s0;
  25418. }
  25419. function peg$parsedynamicDictionary() {
  25420. var s0, s1, s2, s3, s4, s5;
  25421. var key = peg$currPos * 63 + 23,
  25422. cached = peg$resultsCache[key];
  25423. if (cached) {
  25424. peg$currPos = cached.nextPos;
  25425. return cached.result;
  25426. }
  25427. s0 = peg$currPos;
  25428. if (input.substr(peg$currPos, 2) === peg$c66) {
  25429. s1 = peg$c66;
  25430. peg$currPos += 2;
  25431. } else {
  25432. s1 = peg$FAILED;
  25433. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  25434. }
  25435. if (s1 !== peg$FAILED) {
  25436. s2 = peg$parsews();
  25437. if (s2 !== peg$FAILED) {
  25438. s3 = peg$parseassociations();
  25439. if (s3 === peg$FAILED) {
  25440. s3 = null;
  25441. }
  25442. if (s3 !== peg$FAILED) {
  25443. s4 = peg$parsemaybeDotsWs();
  25444. if (s4 !== peg$FAILED) {
  25445. if (input.charCodeAt(peg$currPos) === 125) {
  25446. s5 = peg$c63;
  25447. peg$currPos++;
  25448. } else {
  25449. s5 = peg$FAILED;
  25450. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  25451. }
  25452. if (s5 !== peg$FAILED) {
  25453. peg$savedPos = s0;
  25454. s1 = peg$c68(s3);
  25455. s0 = s1;
  25456. } else {
  25457. peg$currPos = s0;
  25458. s0 = peg$FAILED;
  25459. }
  25460. } else {
  25461. peg$currPos = s0;
  25462. s0 = peg$FAILED;
  25463. }
  25464. } else {
  25465. peg$currPos = s0;
  25466. s0 = peg$FAILED;
  25467. }
  25468. } else {
  25469. peg$currPos = s0;
  25470. s0 = peg$FAILED;
  25471. }
  25472. } else {
  25473. peg$currPos = s0;
  25474. s0 = peg$FAILED;
  25475. }
  25476. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25477. return s0;
  25478. }
  25479. function peg$parsepseudoVariable() {
  25480. var s0, s1, s2;
  25481. var key = peg$currPos * 63 + 24,
  25482. cached = peg$resultsCache[key];
  25483. if (cached) {
  25484. peg$currPos = cached.nextPos;
  25485. return cached.result;
  25486. }
  25487. s0 = peg$currPos;
  25488. s1 = peg$currPos;
  25489. if (input.substr(peg$currPos, 4) === peg$c69) {
  25490. s2 = peg$c69;
  25491. peg$currPos += 4;
  25492. } else {
  25493. s2 = peg$FAILED;
  25494. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  25495. }
  25496. if (s2 !== peg$FAILED) {
  25497. peg$savedPos = s1;
  25498. s2 = peg$c71();
  25499. }
  25500. s1 = s2;
  25501. if (s1 === peg$FAILED) {
  25502. s1 = peg$currPos;
  25503. if (input.substr(peg$currPos, 5) === peg$c72) {
  25504. s2 = peg$c72;
  25505. peg$currPos += 5;
  25506. } else {
  25507. s2 = peg$FAILED;
  25508. if (peg$silentFails === 0) { peg$fail(peg$c73); }
  25509. }
  25510. if (s2 !== peg$FAILED) {
  25511. peg$savedPos = s1;
  25512. s2 = peg$c74();
  25513. }
  25514. s1 = s2;
  25515. if (s1 === peg$FAILED) {
  25516. s1 = peg$currPos;
  25517. if (input.substr(peg$currPos, 3) === peg$c75) {
  25518. s2 = peg$c75;
  25519. peg$currPos += 3;
  25520. } else {
  25521. s2 = peg$FAILED;
  25522. if (peg$silentFails === 0) { peg$fail(peg$c76); }
  25523. }
  25524. if (s2 !== peg$FAILED) {
  25525. peg$savedPos = s1;
  25526. s2 = peg$c77();
  25527. }
  25528. s1 = s2;
  25529. }
  25530. }
  25531. if (s1 !== peg$FAILED) {
  25532. peg$savedPos = s0;
  25533. s1 = peg$c78(s1);
  25534. }
  25535. s0 = s1;
  25536. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25537. return s0;
  25538. }
  25539. function peg$parseparseTimeLiteral() {
  25540. var s0;
  25541. var key = peg$currPos * 63 + 25,
  25542. cached = peg$resultsCache[key];
  25543. if (cached) {
  25544. peg$currPos = cached.nextPos;
  25545. return cached.result;
  25546. }
  25547. s0 = peg$parsepseudoVariable();
  25548. if (s0 === peg$FAILED) {
  25549. s0 = peg$parsenumber();
  25550. if (s0 === peg$FAILED) {
  25551. s0 = peg$parseliteralArray();
  25552. if (s0 === peg$FAILED) {
  25553. s0 = peg$parsestring();
  25554. if (s0 === peg$FAILED) {
  25555. s0 = peg$parsesymbol();
  25556. if (s0 === peg$FAILED) {
  25557. s0 = peg$parsecharacter();
  25558. }
  25559. }
  25560. }
  25561. }
  25562. }
  25563. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25564. return s0;
  25565. }
  25566. function peg$parseruntimeLiteral() {
  25567. var s0;
  25568. var key = peg$currPos * 63 + 26,
  25569. cached = peg$resultsCache[key];
  25570. if (cached) {
  25571. peg$currPos = cached.nextPos;
  25572. return cached.result;
  25573. }
  25574. s0 = peg$parsedynamicDictionary();
  25575. if (s0 === peg$FAILED) {
  25576. s0 = peg$parsedynamicArray();
  25577. if (s0 === peg$FAILED) {
  25578. s0 = peg$parseblock();
  25579. }
  25580. }
  25581. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25582. return s0;
  25583. }
  25584. function peg$parseliteral() {
  25585. var s0;
  25586. var key = peg$currPos * 63 + 27,
  25587. cached = peg$resultsCache[key];
  25588. if (cached) {
  25589. peg$currPos = cached.nextPos;
  25590. return cached.result;
  25591. }
  25592. s0 = peg$parseruntimeLiteral();
  25593. if (s0 === peg$FAILED) {
  25594. s0 = peg$parseparseTimeLiteral();
  25595. }
  25596. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25597. return s0;
  25598. }
  25599. function peg$parsevariable() {
  25600. var s0, s1;
  25601. var key = peg$currPos * 63 + 28,
  25602. cached = peg$resultsCache[key];
  25603. if (cached) {
  25604. peg$currPos = cached.nextPos;
  25605. return cached.result;
  25606. }
  25607. s0 = peg$currPos;
  25608. s1 = peg$parseidentifier();
  25609. if (s1 !== peg$FAILED) {
  25610. peg$savedPos = s0;
  25611. s1 = peg$c79(s1);
  25612. }
  25613. s0 = s1;
  25614. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25615. return s0;
  25616. }
  25617. function peg$parsebinarySelector() {
  25618. var s0, s1, s2;
  25619. var key = peg$currPos * 63 + 29,
  25620. cached = peg$resultsCache[key];
  25621. if (cached) {
  25622. peg$currPos = cached.nextPos;
  25623. return cached.result;
  25624. }
  25625. s0 = peg$currPos;
  25626. s1 = [];
  25627. if (peg$c80.test(input.charAt(peg$currPos))) {
  25628. s2 = input.charAt(peg$currPos);
  25629. peg$currPos++;
  25630. } else {
  25631. s2 = peg$FAILED;
  25632. if (peg$silentFails === 0) { peg$fail(peg$c81); }
  25633. }
  25634. if (s2 !== peg$FAILED) {
  25635. while (s2 !== peg$FAILED) {
  25636. s1.push(s2);
  25637. if (peg$c80.test(input.charAt(peg$currPos))) {
  25638. s2 = input.charAt(peg$currPos);
  25639. peg$currPos++;
  25640. } else {
  25641. s2 = peg$FAILED;
  25642. if (peg$silentFails === 0) { peg$fail(peg$c81); }
  25643. }
  25644. }
  25645. } else {
  25646. s1 = peg$FAILED;
  25647. }
  25648. if (s1 !== peg$FAILED) {
  25649. peg$savedPos = s0;
  25650. s1 = peg$c82(s1);
  25651. }
  25652. s0 = s1;
  25653. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25654. return s0;
  25655. }
  25656. function peg$parsewsKeywordPattern() {
  25657. var s0, s1, s2, s3, s4, s5, s6;
  25658. var key = peg$currPos * 63 + 30,
  25659. cached = peg$resultsCache[key];
  25660. if (cached) {
  25661. peg$currPos = cached.nextPos;
  25662. return cached.result;
  25663. }
  25664. s0 = peg$currPos;
  25665. s1 = [];
  25666. s2 = peg$currPos;
  25667. s3 = peg$parsews();
  25668. if (s3 !== peg$FAILED) {
  25669. s4 = peg$parsekeyword();
  25670. if (s4 !== peg$FAILED) {
  25671. s5 = peg$parsews();
  25672. if (s5 !== peg$FAILED) {
  25673. s6 = peg$parseidentifier();
  25674. if (s6 !== peg$FAILED) {
  25675. peg$savedPos = s2;
  25676. s3 = peg$c83(s4, s6);
  25677. s2 = s3;
  25678. } else {
  25679. peg$currPos = s2;
  25680. s2 = peg$FAILED;
  25681. }
  25682. } else {
  25683. peg$currPos = s2;
  25684. s2 = peg$FAILED;
  25685. }
  25686. } else {
  25687. peg$currPos = s2;
  25688. s2 = peg$FAILED;
  25689. }
  25690. } else {
  25691. peg$currPos = s2;
  25692. s2 = peg$FAILED;
  25693. }
  25694. if (s2 !== peg$FAILED) {
  25695. while (s2 !== peg$FAILED) {
  25696. s1.push(s2);
  25697. s2 = peg$currPos;
  25698. s3 = peg$parsews();
  25699. if (s3 !== peg$FAILED) {
  25700. s4 = peg$parsekeyword();
  25701. if (s4 !== peg$FAILED) {
  25702. s5 = peg$parsews();
  25703. if (s5 !== peg$FAILED) {
  25704. s6 = peg$parseidentifier();
  25705. if (s6 !== peg$FAILED) {
  25706. peg$savedPos = s2;
  25707. s3 = peg$c83(s4, s6);
  25708. s2 = s3;
  25709. } else {
  25710. peg$currPos = s2;
  25711. s2 = peg$FAILED;
  25712. }
  25713. } else {
  25714. peg$currPos = s2;
  25715. s2 = peg$FAILED;
  25716. }
  25717. } else {
  25718. peg$currPos = s2;
  25719. s2 = peg$FAILED;
  25720. }
  25721. } else {
  25722. peg$currPos = s2;
  25723. s2 = peg$FAILED;
  25724. }
  25725. }
  25726. } else {
  25727. s1 = peg$FAILED;
  25728. }
  25729. if (s1 !== peg$FAILED) {
  25730. peg$savedPos = s0;
  25731. s1 = peg$c84(s1);
  25732. }
  25733. s0 = s1;
  25734. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25735. return s0;
  25736. }
  25737. function peg$parsewsBinaryPattern() {
  25738. var s0, s1, s2, s3, s4;
  25739. var key = peg$currPos * 63 + 31,
  25740. cached = peg$resultsCache[key];
  25741. if (cached) {
  25742. peg$currPos = cached.nextPos;
  25743. return cached.result;
  25744. }
  25745. s0 = peg$currPos;
  25746. s1 = peg$parsews();
  25747. if (s1 !== peg$FAILED) {
  25748. s2 = peg$parsebinarySelector();
  25749. if (s2 !== peg$FAILED) {
  25750. s3 = peg$parsews();
  25751. if (s3 !== peg$FAILED) {
  25752. s4 = peg$parseidentifier();
  25753. if (s4 !== peg$FAILED) {
  25754. peg$savedPos = s0;
  25755. s1 = peg$c85(s2, s4);
  25756. s0 = s1;
  25757. } else {
  25758. peg$currPos = s0;
  25759. s0 = peg$FAILED;
  25760. }
  25761. } else {
  25762. peg$currPos = s0;
  25763. s0 = peg$FAILED;
  25764. }
  25765. } else {
  25766. peg$currPos = s0;
  25767. s0 = peg$FAILED;
  25768. }
  25769. } else {
  25770. peg$currPos = s0;
  25771. s0 = peg$FAILED;
  25772. }
  25773. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25774. return s0;
  25775. }
  25776. function peg$parsewsUnaryPattern() {
  25777. var s0, s1, s2;
  25778. var key = peg$currPos * 63 + 32,
  25779. cached = peg$resultsCache[key];
  25780. if (cached) {
  25781. peg$currPos = cached.nextPos;
  25782. return cached.result;
  25783. }
  25784. s0 = peg$currPos;
  25785. s1 = peg$parsews();
  25786. if (s1 !== peg$FAILED) {
  25787. s2 = peg$parseidentifier();
  25788. if (s2 !== peg$FAILED) {
  25789. peg$savedPos = s0;
  25790. s1 = peg$c86(s2);
  25791. s0 = s1;
  25792. } else {
  25793. peg$currPos = s0;
  25794. s0 = peg$FAILED;
  25795. }
  25796. } else {
  25797. peg$currPos = s0;
  25798. s0 = peg$FAILED;
  25799. }
  25800. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25801. return s0;
  25802. }
  25803. function peg$parseexpression() {
  25804. var s0;
  25805. var key = peg$currPos * 63 + 33,
  25806. cached = peg$resultsCache[key];
  25807. if (cached) {
  25808. peg$currPos = cached.nextPos;
  25809. return cached.result;
  25810. }
  25811. s0 = peg$parseassignment();
  25812. if (s0 === peg$FAILED) {
  25813. s0 = peg$parsecascade();
  25814. if (s0 === peg$FAILED) {
  25815. s0 = peg$parsekeywordSend();
  25816. }
  25817. }
  25818. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25819. return s0;
  25820. }
  25821. function peg$parsewsExpressionsRest() {
  25822. var s0, s1, s2, s3, s4;
  25823. var key = peg$currPos * 63 + 34,
  25824. cached = peg$resultsCache[key];
  25825. if (cached) {
  25826. peg$currPos = cached.nextPos;
  25827. return cached.result;
  25828. }
  25829. s0 = peg$currPos;
  25830. s1 = peg$parsews();
  25831. if (s1 !== peg$FAILED) {
  25832. if (input.charCodeAt(peg$currPos) === 46) {
  25833. s2 = peg$c6;
  25834. peg$currPos++;
  25835. } else {
  25836. s2 = peg$FAILED;
  25837. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  25838. }
  25839. if (s2 !== peg$FAILED) {
  25840. s3 = peg$parsemaybeDotsWs();
  25841. if (s3 !== peg$FAILED) {
  25842. s4 = peg$parseexpression();
  25843. if (s4 !== peg$FAILED) {
  25844. peg$savedPos = s0;
  25845. s1 = peg$c87(s4);
  25846. s0 = s1;
  25847. } else {
  25848. peg$currPos = s0;
  25849. s0 = peg$FAILED;
  25850. }
  25851. } else {
  25852. peg$currPos = s0;
  25853. s0 = peg$FAILED;
  25854. }
  25855. } else {
  25856. peg$currPos = s0;
  25857. s0 = peg$FAILED;
  25858. }
  25859. } else {
  25860. peg$currPos = s0;
  25861. s0 = peg$FAILED;
  25862. }
  25863. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25864. return s0;
  25865. }
  25866. function peg$parseexpressions() {
  25867. var s0, s1, s2, s3;
  25868. var key = peg$currPos * 63 + 35,
  25869. cached = peg$resultsCache[key];
  25870. if (cached) {
  25871. peg$currPos = cached.nextPos;
  25872. return cached.result;
  25873. }
  25874. s0 = peg$currPos;
  25875. s1 = peg$parseexpression();
  25876. if (s1 !== peg$FAILED) {
  25877. s2 = [];
  25878. s3 = peg$parsewsExpressionsRest();
  25879. while (s3 !== peg$FAILED) {
  25880. s2.push(s3);
  25881. s3 = peg$parsewsExpressionsRest();
  25882. }
  25883. if (s2 !== peg$FAILED) {
  25884. peg$savedPos = s0;
  25885. s1 = peg$c88(s1, s2);
  25886. s0 = s1;
  25887. } else {
  25888. peg$currPos = s0;
  25889. s0 = peg$FAILED;
  25890. }
  25891. } else {
  25892. peg$currPos = s0;
  25893. s0 = peg$FAILED;
  25894. }
  25895. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25896. return s0;
  25897. }
  25898. function peg$parseassignment() {
  25899. var s0, s1, s2, s3, s4, s5;
  25900. var key = peg$currPos * 63 + 36,
  25901. cached = peg$resultsCache[key];
  25902. if (cached) {
  25903. peg$currPos = cached.nextPos;
  25904. return cached.result;
  25905. }
  25906. s0 = peg$currPos;
  25907. s1 = peg$parsevariable();
  25908. if (s1 !== peg$FAILED) {
  25909. s2 = peg$parsews();
  25910. if (s2 !== peg$FAILED) {
  25911. if (input.substr(peg$currPos, 2) === peg$c89) {
  25912. s3 = peg$c89;
  25913. peg$currPos += 2;
  25914. } else {
  25915. s3 = peg$FAILED;
  25916. if (peg$silentFails === 0) { peg$fail(peg$c90); }
  25917. }
  25918. if (s3 !== peg$FAILED) {
  25919. s4 = peg$parsews();
  25920. if (s4 !== peg$FAILED) {
  25921. s5 = peg$parseexpression();
  25922. if (s5 !== peg$FAILED) {
  25923. peg$savedPos = s0;
  25924. s1 = peg$c91(s1, s5);
  25925. s0 = s1;
  25926. } else {
  25927. peg$currPos = s0;
  25928. s0 = peg$FAILED;
  25929. }
  25930. } else {
  25931. peg$currPos = s0;
  25932. s0 = peg$FAILED;
  25933. }
  25934. } else {
  25935. peg$currPos = s0;
  25936. s0 = peg$FAILED;
  25937. }
  25938. } else {
  25939. peg$currPos = s0;
  25940. s0 = peg$FAILED;
  25941. }
  25942. } else {
  25943. peg$currPos = s0;
  25944. s0 = peg$FAILED;
  25945. }
  25946. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25947. return s0;
  25948. }
  25949. function peg$parseret() {
  25950. var s0, s1, s2, s3;
  25951. var key = peg$currPos * 63 + 37,
  25952. cached = peg$resultsCache[key];
  25953. if (cached) {
  25954. peg$currPos = cached.nextPos;
  25955. return cached.result;
  25956. }
  25957. s0 = peg$currPos;
  25958. if (input.charCodeAt(peg$currPos) === 94) {
  25959. s1 = peg$c92;
  25960. peg$currPos++;
  25961. } else {
  25962. s1 = peg$FAILED;
  25963. if (peg$silentFails === 0) { peg$fail(peg$c93); }
  25964. }
  25965. if (s1 !== peg$FAILED) {
  25966. s2 = peg$parsews();
  25967. if (s2 !== peg$FAILED) {
  25968. s3 = peg$parseexpression();
  25969. if (s3 !== peg$FAILED) {
  25970. peg$savedPos = s0;
  25971. s1 = peg$c94(s3);
  25972. s0 = s1;
  25973. } else {
  25974. peg$currPos = s0;
  25975. s0 = peg$FAILED;
  25976. }
  25977. } else {
  25978. peg$currPos = s0;
  25979. s0 = peg$FAILED;
  25980. }
  25981. } else {
  25982. peg$currPos = s0;
  25983. s0 = peg$FAILED;
  25984. }
  25985. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25986. return s0;
  25987. }
  25988. function peg$parsetemps() {
  25989. var s0, s1, s2, s3, s4, s5;
  25990. var key = peg$currPos * 63 + 38,
  25991. cached = peg$resultsCache[key];
  25992. if (cached) {
  25993. peg$currPos = cached.nextPos;
  25994. return cached.result;
  25995. }
  25996. s0 = peg$currPos;
  25997. if (input.charCodeAt(peg$currPos) === 124) {
  25998. s1 = peg$c95;
  25999. peg$currPos++;
  26000. } else {
  26001. s1 = peg$FAILED;
  26002. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  26003. }
  26004. if (s1 !== peg$FAILED) {
  26005. s2 = [];
  26006. s3 = peg$currPos;
  26007. s4 = peg$parsews();
  26008. if (s4 !== peg$FAILED) {
  26009. s5 = peg$parseidentifier();
  26010. if (s5 !== peg$FAILED) {
  26011. peg$savedPos = s3;
  26012. s4 = peg$c97(s5);
  26013. s3 = s4;
  26014. } else {
  26015. peg$currPos = s3;
  26016. s3 = peg$FAILED;
  26017. }
  26018. } else {
  26019. peg$currPos = s3;
  26020. s3 = peg$FAILED;
  26021. }
  26022. while (s3 !== peg$FAILED) {
  26023. s2.push(s3);
  26024. s3 = peg$currPos;
  26025. s4 = peg$parsews();
  26026. if (s4 !== peg$FAILED) {
  26027. s5 = peg$parseidentifier();
  26028. if (s5 !== peg$FAILED) {
  26029. peg$savedPos = s3;
  26030. s4 = peg$c97(s5);
  26031. s3 = s4;
  26032. } else {
  26033. peg$currPos = s3;
  26034. s3 = peg$FAILED;
  26035. }
  26036. } else {
  26037. peg$currPos = s3;
  26038. s3 = peg$FAILED;
  26039. }
  26040. }
  26041. if (s2 !== peg$FAILED) {
  26042. s3 = peg$parsews();
  26043. if (s3 !== peg$FAILED) {
  26044. if (input.charCodeAt(peg$currPos) === 124) {
  26045. s4 = peg$c95;
  26046. peg$currPos++;
  26047. } else {
  26048. s4 = peg$FAILED;
  26049. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  26050. }
  26051. if (s4 !== peg$FAILED) {
  26052. peg$savedPos = s0;
  26053. s1 = peg$c98(s2);
  26054. s0 = s1;
  26055. } else {
  26056. peg$currPos = s0;
  26057. s0 = peg$FAILED;
  26058. }
  26059. } else {
  26060. peg$currPos = s0;
  26061. s0 = peg$FAILED;
  26062. }
  26063. } else {
  26064. peg$currPos = s0;
  26065. s0 = peg$FAILED;
  26066. }
  26067. } else {
  26068. peg$currPos = s0;
  26069. s0 = peg$FAILED;
  26070. }
  26071. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26072. return s0;
  26073. }
  26074. function peg$parsewsBlockParamList() {
  26075. var s0, s1, s2, s3, s4, s5, s6;
  26076. var key = peg$currPos * 63 + 39,
  26077. cached = peg$resultsCache[key];
  26078. if (cached) {
  26079. peg$currPos = cached.nextPos;
  26080. return cached.result;
  26081. }
  26082. s0 = peg$currPos;
  26083. s1 = [];
  26084. s2 = peg$currPos;
  26085. s3 = peg$parsews();
  26086. if (s3 !== peg$FAILED) {
  26087. if (input.charCodeAt(peg$currPos) === 58) {
  26088. s4 = peg$c13;
  26089. peg$currPos++;
  26090. } else {
  26091. s4 = peg$FAILED;
  26092. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  26093. }
  26094. if (s4 !== peg$FAILED) {
  26095. s5 = peg$parsews();
  26096. if (s5 !== peg$FAILED) {
  26097. s6 = peg$parseidentifier();
  26098. if (s6 !== peg$FAILED) {
  26099. peg$savedPos = s2;
  26100. s3 = peg$c99(s6);
  26101. s2 = s3;
  26102. } else {
  26103. peg$currPos = s2;
  26104. s2 = peg$FAILED;
  26105. }
  26106. } else {
  26107. peg$currPos = s2;
  26108. s2 = peg$FAILED;
  26109. }
  26110. } else {
  26111. peg$currPos = s2;
  26112. s2 = peg$FAILED;
  26113. }
  26114. } else {
  26115. peg$currPos = s2;
  26116. s2 = peg$FAILED;
  26117. }
  26118. if (s2 !== peg$FAILED) {
  26119. while (s2 !== peg$FAILED) {
  26120. s1.push(s2);
  26121. s2 = peg$currPos;
  26122. s3 = peg$parsews();
  26123. if (s3 !== peg$FAILED) {
  26124. if (input.charCodeAt(peg$currPos) === 58) {
  26125. s4 = peg$c13;
  26126. peg$currPos++;
  26127. } else {
  26128. s4 = peg$FAILED;
  26129. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  26130. }
  26131. if (s4 !== peg$FAILED) {
  26132. s5 = peg$parsews();
  26133. if (s5 !== peg$FAILED) {
  26134. s6 = peg$parseidentifier();
  26135. if (s6 !== peg$FAILED) {
  26136. peg$savedPos = s2;
  26137. s3 = peg$c99(s6);
  26138. s2 = s3;
  26139. } else {
  26140. peg$currPos = s2;
  26141. s2 = peg$FAILED;
  26142. }
  26143. } else {
  26144. peg$currPos = s2;
  26145. s2 = peg$FAILED;
  26146. }
  26147. } else {
  26148. peg$currPos = s2;
  26149. s2 = peg$FAILED;
  26150. }
  26151. } else {
  26152. peg$currPos = s2;
  26153. s2 = peg$FAILED;
  26154. }
  26155. }
  26156. } else {
  26157. s1 = peg$FAILED;
  26158. }
  26159. if (s1 !== peg$FAILED) {
  26160. s2 = peg$parsews();
  26161. if (s2 !== peg$FAILED) {
  26162. if (input.charCodeAt(peg$currPos) === 124) {
  26163. s3 = peg$c95;
  26164. peg$currPos++;
  26165. } else {
  26166. s3 = peg$FAILED;
  26167. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  26168. }
  26169. if (s3 !== peg$FAILED) {
  26170. peg$savedPos = s0;
  26171. s1 = peg$c100(s1);
  26172. s0 = s1;
  26173. } else {
  26174. peg$currPos = s0;
  26175. s0 = peg$FAILED;
  26176. }
  26177. } else {
  26178. peg$currPos = s0;
  26179. s0 = peg$FAILED;
  26180. }
  26181. } else {
  26182. peg$currPos = s0;
  26183. s0 = peg$FAILED;
  26184. }
  26185. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26186. return s0;
  26187. }
  26188. function peg$parsesubexpression() {
  26189. var s0, s1, s2, s3, s4, s5;
  26190. var key = peg$currPos * 63 + 40,
  26191. cached = peg$resultsCache[key];
  26192. if (cached) {
  26193. peg$currPos = cached.nextPos;
  26194. return cached.result;
  26195. }
  26196. s0 = peg$currPos;
  26197. if (input.charCodeAt(peg$currPos) === 40) {
  26198. s1 = peg$c57;
  26199. peg$currPos++;
  26200. } else {
  26201. s1 = peg$FAILED;
  26202. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  26203. }
  26204. if (s1 !== peg$FAILED) {
  26205. s2 = peg$parsews();
  26206. if (s2 !== peg$FAILED) {
  26207. s3 = peg$parseexpression();
  26208. if (s3 !== peg$FAILED) {
  26209. s4 = peg$parsews();
  26210. if (s4 !== peg$FAILED) {
  26211. if (input.charCodeAt(peg$currPos) === 41) {
  26212. s5 = peg$c54;
  26213. peg$currPos++;
  26214. } else {
  26215. s5 = peg$FAILED;
  26216. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  26217. }
  26218. if (s5 !== peg$FAILED) {
  26219. peg$savedPos = s0;
  26220. s1 = peg$c87(s3);
  26221. s0 = s1;
  26222. } else {
  26223. peg$currPos = s0;
  26224. s0 = peg$FAILED;
  26225. }
  26226. } else {
  26227. peg$currPos = s0;
  26228. s0 = peg$FAILED;
  26229. }
  26230. } else {
  26231. peg$currPos = s0;
  26232. s0 = peg$FAILED;
  26233. }
  26234. } else {
  26235. peg$currPos = s0;
  26236. s0 = peg$FAILED;
  26237. }
  26238. } else {
  26239. peg$currPos = s0;
  26240. s0 = peg$FAILED;
  26241. }
  26242. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26243. return s0;
  26244. }
  26245. function peg$parsestatementsWs() {
  26246. var s0, s1, s2, s3, s4, s5, s6;
  26247. var key = peg$currPos * 63 + 41,
  26248. cached = peg$resultsCache[key];
  26249. if (cached) {
  26250. peg$currPos = cached.nextPos;
  26251. return cached.result;
  26252. }
  26253. s0 = peg$currPos;
  26254. s1 = peg$parseret();
  26255. if (s1 !== peg$FAILED) {
  26256. s2 = peg$parsemaybeDotsWs();
  26257. if (s2 !== peg$FAILED) {
  26258. peg$savedPos = s0;
  26259. s1 = peg$c101(s1);
  26260. s0 = s1;
  26261. } else {
  26262. peg$currPos = s0;
  26263. s0 = peg$FAILED;
  26264. }
  26265. } else {
  26266. peg$currPos = s0;
  26267. s0 = peg$FAILED;
  26268. }
  26269. if (s0 === peg$FAILED) {
  26270. s0 = peg$currPos;
  26271. s1 = peg$parseexpressions();
  26272. if (s1 !== peg$FAILED) {
  26273. s2 = peg$parsews();
  26274. if (s2 !== peg$FAILED) {
  26275. if (input.charCodeAt(peg$currPos) === 46) {
  26276. s3 = peg$c6;
  26277. peg$currPos++;
  26278. } else {
  26279. s3 = peg$FAILED;
  26280. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  26281. }
  26282. if (s3 !== peg$FAILED) {
  26283. s4 = peg$parsemaybeDotsWs();
  26284. if (s4 !== peg$FAILED) {
  26285. s5 = peg$parseret();
  26286. if (s5 !== peg$FAILED) {
  26287. s6 = peg$parsemaybeDotsWs();
  26288. if (s6 !== peg$FAILED) {
  26289. peg$savedPos = s0;
  26290. s1 = peg$c102(s1, s5);
  26291. s0 = s1;
  26292. } else {
  26293. peg$currPos = s0;
  26294. s0 = peg$FAILED;
  26295. }
  26296. } else {
  26297. peg$currPos = s0;
  26298. s0 = peg$FAILED;
  26299. }
  26300. } else {
  26301. peg$currPos = s0;
  26302. s0 = peg$FAILED;
  26303. }
  26304. } else {
  26305. peg$currPos = s0;
  26306. s0 = peg$FAILED;
  26307. }
  26308. } else {
  26309. peg$currPos = s0;
  26310. s0 = peg$FAILED;
  26311. }
  26312. } else {
  26313. peg$currPos = s0;
  26314. s0 = peg$FAILED;
  26315. }
  26316. if (s0 === peg$FAILED) {
  26317. s0 = peg$currPos;
  26318. s1 = peg$parseexpressions();
  26319. if (s1 === peg$FAILED) {
  26320. s1 = null;
  26321. }
  26322. if (s1 !== peg$FAILED) {
  26323. s2 = peg$parsemaybeDotsWs();
  26324. if (s2 !== peg$FAILED) {
  26325. peg$savedPos = s0;
  26326. s1 = peg$c103(s1);
  26327. s0 = s1;
  26328. } else {
  26329. peg$currPos = s0;
  26330. s0 = peg$FAILED;
  26331. }
  26332. } else {
  26333. peg$currPos = s0;
  26334. s0 = peg$FAILED;
  26335. }
  26336. }
  26337. }
  26338. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26339. return s0;
  26340. }
  26341. function peg$parsewsSequenceWs() {
  26342. var s0, s1, s2, s3;
  26343. var key = peg$currPos * 63 + 42,
  26344. cached = peg$resultsCache[key];
  26345. if (cached) {
  26346. peg$currPos = cached.nextPos;
  26347. return cached.result;
  26348. }
  26349. s0 = peg$currPos;
  26350. s1 = peg$parsews();
  26351. if (s1 !== peg$FAILED) {
  26352. s2 = peg$parsejsStatement();
  26353. if (s2 !== peg$FAILED) {
  26354. s3 = peg$parsews();
  26355. if (s3 !== peg$FAILED) {
  26356. peg$savedPos = s0;
  26357. s1 = peg$c104(s2);
  26358. s0 = s1;
  26359. } else {
  26360. peg$currPos = s0;
  26361. s0 = peg$FAILED;
  26362. }
  26363. } else {
  26364. peg$currPos = s0;
  26365. s0 = peg$FAILED;
  26366. }
  26367. } else {
  26368. peg$currPos = s0;
  26369. s0 = peg$FAILED;
  26370. }
  26371. if (s0 === peg$FAILED) {
  26372. s0 = peg$parsewsStSequenceWs();
  26373. }
  26374. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26375. return s0;
  26376. }
  26377. function peg$parsewsStSequenceWs() {
  26378. var s0, s1, s2, s3, s4;
  26379. var key = peg$currPos * 63 + 43,
  26380. cached = peg$resultsCache[key];
  26381. if (cached) {
  26382. peg$currPos = cached.nextPos;
  26383. return cached.result;
  26384. }
  26385. s0 = peg$currPos;
  26386. s1 = peg$parsews();
  26387. if (s1 !== peg$FAILED) {
  26388. s2 = peg$parsetemps();
  26389. if (s2 === peg$FAILED) {
  26390. s2 = null;
  26391. }
  26392. if (s2 !== peg$FAILED) {
  26393. s3 = peg$parsemaybeDotsWs();
  26394. if (s3 !== peg$FAILED) {
  26395. s4 = peg$parsestatementsWs();
  26396. if (s4 === peg$FAILED) {
  26397. s4 = null;
  26398. }
  26399. if (s4 !== peg$FAILED) {
  26400. peg$savedPos = s0;
  26401. s1 = peg$c105(s2, s4);
  26402. s0 = s1;
  26403. } else {
  26404. peg$currPos = s0;
  26405. s0 = peg$FAILED;
  26406. }
  26407. } else {
  26408. peg$currPos = s0;
  26409. s0 = peg$FAILED;
  26410. }
  26411. } else {
  26412. peg$currPos = s0;
  26413. s0 = peg$FAILED;
  26414. }
  26415. } else {
  26416. peg$currPos = s0;
  26417. s0 = peg$FAILED;
  26418. }
  26419. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26420. return s0;
  26421. }
  26422. function peg$parseblock() {
  26423. var s0, s1, s2, s3, s4;
  26424. var key = peg$currPos * 63 + 44,
  26425. cached = peg$resultsCache[key];
  26426. if (cached) {
  26427. peg$currPos = cached.nextPos;
  26428. return cached.result;
  26429. }
  26430. s0 = peg$currPos;
  26431. if (input.charCodeAt(peg$currPos) === 91) {
  26432. s1 = peg$c106;
  26433. peg$currPos++;
  26434. } else {
  26435. s1 = peg$FAILED;
  26436. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  26437. }
  26438. if (s1 !== peg$FAILED) {
  26439. s2 = peg$parsewsBlockParamList();
  26440. if (s2 === peg$FAILED) {
  26441. s2 = null;
  26442. }
  26443. if (s2 !== peg$FAILED) {
  26444. s3 = peg$parsewsSequenceWs();
  26445. if (s3 === peg$FAILED) {
  26446. s3 = null;
  26447. }
  26448. if (s3 !== peg$FAILED) {
  26449. if (input.charCodeAt(peg$currPos) === 93) {
  26450. s4 = peg$c108;
  26451. peg$currPos++;
  26452. } else {
  26453. s4 = peg$FAILED;
  26454. if (peg$silentFails === 0) { peg$fail(peg$c109); }
  26455. }
  26456. if (s4 !== peg$FAILED) {
  26457. peg$savedPos = s0;
  26458. s1 = peg$c110(s2, s3);
  26459. s0 = s1;
  26460. } else {
  26461. peg$currPos = s0;
  26462. s0 = peg$FAILED;
  26463. }
  26464. } else {
  26465. peg$currPos = s0;
  26466. s0 = peg$FAILED;
  26467. }
  26468. } else {
  26469. peg$currPos = s0;
  26470. s0 = peg$FAILED;
  26471. }
  26472. } else {
  26473. peg$currPos = s0;
  26474. s0 = peg$FAILED;
  26475. }
  26476. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26477. return s0;
  26478. }
  26479. function peg$parseoperand() {
  26480. var s0;
  26481. var key = peg$currPos * 63 + 45,
  26482. cached = peg$resultsCache[key];
  26483. if (cached) {
  26484. peg$currPos = cached.nextPos;
  26485. return cached.result;
  26486. }
  26487. s0 = peg$parseliteral();
  26488. if (s0 === peg$FAILED) {
  26489. s0 = peg$parsevariable();
  26490. if (s0 === peg$FAILED) {
  26491. s0 = peg$parsesubexpression();
  26492. }
  26493. }
  26494. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26495. return s0;
  26496. }
  26497. function peg$parsewsUnaryMessage() {
  26498. var s0, s1, s2, s3, s4;
  26499. var key = peg$currPos * 63 + 46,
  26500. cached = peg$resultsCache[key];
  26501. if (cached) {
  26502. peg$currPos = cached.nextPos;
  26503. return cached.result;
  26504. }
  26505. s0 = peg$currPos;
  26506. s1 = peg$parsews();
  26507. if (s1 !== peg$FAILED) {
  26508. s2 = peg$parseidentifier();
  26509. if (s2 !== peg$FAILED) {
  26510. s3 = peg$currPos;
  26511. peg$silentFails++;
  26512. if (input.charCodeAt(peg$currPos) === 58) {
  26513. s4 = peg$c13;
  26514. peg$currPos++;
  26515. } else {
  26516. s4 = peg$FAILED;
  26517. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  26518. }
  26519. peg$silentFails--;
  26520. if (s4 === peg$FAILED) {
  26521. s3 = void 0;
  26522. } else {
  26523. peg$currPos = s3;
  26524. s3 = peg$FAILED;
  26525. }
  26526. if (s3 !== peg$FAILED) {
  26527. peg$savedPos = s0;
  26528. s1 = peg$c111(s2);
  26529. s0 = s1;
  26530. } else {
  26531. peg$currPos = s0;
  26532. s0 = peg$FAILED;
  26533. }
  26534. } else {
  26535. peg$currPos = s0;
  26536. s0 = peg$FAILED;
  26537. }
  26538. } else {
  26539. peg$currPos = s0;
  26540. s0 = peg$FAILED;
  26541. }
  26542. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26543. return s0;
  26544. }
  26545. function peg$parsewsUnaryTail() {
  26546. var s0, s1, s2;
  26547. var key = peg$currPos * 63 + 47,
  26548. cached = peg$resultsCache[key];
  26549. if (cached) {
  26550. peg$currPos = cached.nextPos;
  26551. return cached.result;
  26552. }
  26553. s0 = peg$currPos;
  26554. s1 = peg$parsewsUnaryMessage();
  26555. if (s1 !== peg$FAILED) {
  26556. s2 = peg$parsewsUnaryTail();
  26557. if (s2 === peg$FAILED) {
  26558. s2 = null;
  26559. }
  26560. if (s2 !== peg$FAILED) {
  26561. peg$savedPos = s0;
  26562. s1 = peg$c112(s1, s2);
  26563. s0 = s1;
  26564. } else {
  26565. peg$currPos = s0;
  26566. s0 = peg$FAILED;
  26567. }
  26568. } else {
  26569. peg$currPos = s0;
  26570. s0 = peg$FAILED;
  26571. }
  26572. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26573. return s0;
  26574. }
  26575. function peg$parseunarySend() {
  26576. var s0, s1, s2;
  26577. var key = peg$currPos * 63 + 48,
  26578. cached = peg$resultsCache[key];
  26579. if (cached) {
  26580. peg$currPos = cached.nextPos;
  26581. return cached.result;
  26582. }
  26583. s0 = peg$currPos;
  26584. s1 = peg$parseoperand();
  26585. if (s1 !== peg$FAILED) {
  26586. s2 = peg$parsewsUnaryTail();
  26587. if (s2 === peg$FAILED) {
  26588. s2 = null;
  26589. }
  26590. if (s2 !== peg$FAILED) {
  26591. peg$savedPos = s0;
  26592. s1 = peg$c113(s1, s2);
  26593. s0 = s1;
  26594. } else {
  26595. peg$currPos = s0;
  26596. s0 = peg$FAILED;
  26597. }
  26598. } else {
  26599. peg$currPos = s0;
  26600. s0 = peg$FAILED;
  26601. }
  26602. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26603. return s0;
  26604. }
  26605. function peg$parsewsBinaryMessage() {
  26606. var s0, s1, s2, s3, s4;
  26607. var key = peg$currPos * 63 + 49,
  26608. cached = peg$resultsCache[key];
  26609. if (cached) {
  26610. peg$currPos = cached.nextPos;
  26611. return cached.result;
  26612. }
  26613. s0 = peg$currPos;
  26614. s1 = peg$parsews();
  26615. if (s1 !== peg$FAILED) {
  26616. s2 = peg$parsebinarySelector();
  26617. if (s2 !== peg$FAILED) {
  26618. s3 = peg$parsews();
  26619. if (s3 !== peg$FAILED) {
  26620. s4 = peg$parseunarySend();
  26621. if (s4 !== peg$FAILED) {
  26622. peg$savedPos = s0;
  26623. s1 = peg$c114(s2, s4);
  26624. s0 = s1;
  26625. } else {
  26626. peg$currPos = s0;
  26627. s0 = peg$FAILED;
  26628. }
  26629. } else {
  26630. peg$currPos = s0;
  26631. s0 = peg$FAILED;
  26632. }
  26633. } else {
  26634. peg$currPos = s0;
  26635. s0 = peg$FAILED;
  26636. }
  26637. } else {
  26638. peg$currPos = s0;
  26639. s0 = peg$FAILED;
  26640. }
  26641. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26642. return s0;
  26643. }
  26644. function peg$parsewsBinaryTail() {
  26645. var s0, s1, s2;
  26646. var key = peg$currPos * 63 + 50,
  26647. cached = peg$resultsCache[key];
  26648. if (cached) {
  26649. peg$currPos = cached.nextPos;
  26650. return cached.result;
  26651. }
  26652. s0 = peg$currPos;
  26653. s1 = peg$parsewsBinaryMessage();
  26654. if (s1 !== peg$FAILED) {
  26655. s2 = peg$parsewsBinaryTail();
  26656. if (s2 === peg$FAILED) {
  26657. s2 = null;
  26658. }
  26659. if (s2 !== peg$FAILED) {
  26660. peg$savedPos = s0;
  26661. s1 = peg$c115(s1, s2);
  26662. s0 = s1;
  26663. } else {
  26664. peg$currPos = s0;
  26665. s0 = peg$FAILED;
  26666. }
  26667. } else {
  26668. peg$currPos = s0;
  26669. s0 = peg$FAILED;
  26670. }
  26671. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26672. return s0;
  26673. }
  26674. function peg$parsebinarySend() {
  26675. var s0, s1, s2;
  26676. var key = peg$currPos * 63 + 51,
  26677. cached = peg$resultsCache[key];
  26678. if (cached) {
  26679. peg$currPos = cached.nextPos;
  26680. return cached.result;
  26681. }
  26682. s0 = peg$currPos;
  26683. s1 = peg$parseunarySend();
  26684. if (s1 !== peg$FAILED) {
  26685. s2 = peg$parsewsBinaryTail();
  26686. if (s2 === peg$FAILED) {
  26687. s2 = null;
  26688. }
  26689. if (s2 !== peg$FAILED) {
  26690. peg$savedPos = s0;
  26691. s1 = peg$c113(s1, s2);
  26692. s0 = s1;
  26693. } else {
  26694. peg$currPos = s0;
  26695. s0 = peg$FAILED;
  26696. }
  26697. } else {
  26698. peg$currPos = s0;
  26699. s0 = peg$FAILED;
  26700. }
  26701. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26702. return s0;
  26703. }
  26704. function peg$parsewsKeywordMessage() {
  26705. var s0, s1, s2, s3, s4, s5, s6;
  26706. var key = peg$currPos * 63 + 52,
  26707. cached = peg$resultsCache[key];
  26708. if (cached) {
  26709. peg$currPos = cached.nextPos;
  26710. return cached.result;
  26711. }
  26712. s0 = peg$currPos;
  26713. s1 = [];
  26714. s2 = peg$currPos;
  26715. s3 = peg$parsews();
  26716. if (s3 !== peg$FAILED) {
  26717. s4 = peg$parsekeyword();
  26718. if (s4 !== peg$FAILED) {
  26719. s5 = peg$parsews();
  26720. if (s5 !== peg$FAILED) {
  26721. s6 = peg$parsebinarySend();
  26722. if (s6 !== peg$FAILED) {
  26723. peg$savedPos = s2;
  26724. s3 = peg$c83(s4, s6);
  26725. s2 = s3;
  26726. } else {
  26727. peg$currPos = s2;
  26728. s2 = peg$FAILED;
  26729. }
  26730. } else {
  26731. peg$currPos = s2;
  26732. s2 = peg$FAILED;
  26733. }
  26734. } else {
  26735. peg$currPos = s2;
  26736. s2 = peg$FAILED;
  26737. }
  26738. } else {
  26739. peg$currPos = s2;
  26740. s2 = peg$FAILED;
  26741. }
  26742. if (s2 !== peg$FAILED) {
  26743. while (s2 !== peg$FAILED) {
  26744. s1.push(s2);
  26745. s2 = peg$currPos;
  26746. s3 = peg$parsews();
  26747. if (s3 !== peg$FAILED) {
  26748. s4 = peg$parsekeyword();
  26749. if (s4 !== peg$FAILED) {
  26750. s5 = peg$parsews();
  26751. if (s5 !== peg$FAILED) {
  26752. s6 = peg$parsebinarySend();
  26753. if (s6 !== peg$FAILED) {
  26754. peg$savedPos = s2;
  26755. s3 = peg$c83(s4, s6);
  26756. s2 = s3;
  26757. } else {
  26758. peg$currPos = s2;
  26759. s2 = peg$FAILED;
  26760. }
  26761. } else {
  26762. peg$currPos = s2;
  26763. s2 = peg$FAILED;
  26764. }
  26765. } else {
  26766. peg$currPos = s2;
  26767. s2 = peg$FAILED;
  26768. }
  26769. } else {
  26770. peg$currPos = s2;
  26771. s2 = peg$FAILED;
  26772. }
  26773. }
  26774. } else {
  26775. s1 = peg$FAILED;
  26776. }
  26777. if (s1 !== peg$FAILED) {
  26778. peg$savedPos = s0;
  26779. s1 = peg$c116(s1);
  26780. }
  26781. s0 = s1;
  26782. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26783. return s0;
  26784. }
  26785. function peg$parsekeywordSend() {
  26786. var s0, s1, s2;
  26787. var key = peg$currPos * 63 + 53,
  26788. cached = peg$resultsCache[key];
  26789. if (cached) {
  26790. peg$currPos = cached.nextPos;
  26791. return cached.result;
  26792. }
  26793. s0 = peg$currPos;
  26794. s1 = peg$parsebinarySend();
  26795. if (s1 !== peg$FAILED) {
  26796. s2 = peg$parsewsKeywordMessage();
  26797. if (s2 === peg$FAILED) {
  26798. s2 = null;
  26799. }
  26800. if (s2 !== peg$FAILED) {
  26801. peg$savedPos = s0;
  26802. s1 = peg$c113(s1, s2);
  26803. s0 = s1;
  26804. } else {
  26805. peg$currPos = s0;
  26806. s0 = peg$FAILED;
  26807. }
  26808. } else {
  26809. peg$currPos = s0;
  26810. s0 = peg$FAILED;
  26811. }
  26812. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26813. return s0;
  26814. }
  26815. function peg$parsewsMessage() {
  26816. var s0;
  26817. var key = peg$currPos * 63 + 54,
  26818. cached = peg$resultsCache[key];
  26819. if (cached) {
  26820. peg$currPos = cached.nextPos;
  26821. return cached.result;
  26822. }
  26823. s0 = peg$parsewsBinaryMessage();
  26824. if (s0 === peg$FAILED) {
  26825. s0 = peg$parsewsUnaryMessage();
  26826. if (s0 === peg$FAILED) {
  26827. s0 = peg$parsewsKeywordMessage();
  26828. }
  26829. }
  26830. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26831. return s0;
  26832. }
  26833. function peg$parsecascade() {
  26834. var s0, s1, s2, s3, s4, s5, s6, s7;
  26835. var key = peg$currPos * 63 + 55,
  26836. cached = peg$resultsCache[key];
  26837. if (cached) {
  26838. peg$currPos = cached.nextPos;
  26839. return cached.result;
  26840. }
  26841. s0 = peg$currPos;
  26842. s1 = peg$parsekeywordSend();
  26843. if (s1 !== peg$FAILED) {
  26844. peg$savedPos = peg$currPos;
  26845. s2 = peg$c117(s1);
  26846. if (s2) {
  26847. s2 = void 0;
  26848. } else {
  26849. s2 = peg$FAILED;
  26850. }
  26851. if (s2 !== peg$FAILED) {
  26852. s3 = [];
  26853. s4 = peg$currPos;
  26854. s5 = peg$parsews();
  26855. if (s5 !== peg$FAILED) {
  26856. if (input.charCodeAt(peg$currPos) === 59) {
  26857. s6 = peg$c118;
  26858. peg$currPos++;
  26859. } else {
  26860. s6 = peg$FAILED;
  26861. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  26862. }
  26863. if (s6 !== peg$FAILED) {
  26864. s7 = peg$parsewsMessage();
  26865. if (s7 !== peg$FAILED) {
  26866. peg$savedPos = s4;
  26867. s5 = peg$c120(s1, s7);
  26868. s4 = s5;
  26869. } else {
  26870. peg$currPos = s4;
  26871. s4 = peg$FAILED;
  26872. }
  26873. } else {
  26874. peg$currPos = s4;
  26875. s4 = peg$FAILED;
  26876. }
  26877. } else {
  26878. peg$currPos = s4;
  26879. s4 = peg$FAILED;
  26880. }
  26881. if (s4 !== peg$FAILED) {
  26882. while (s4 !== peg$FAILED) {
  26883. s3.push(s4);
  26884. s4 = peg$currPos;
  26885. s5 = peg$parsews();
  26886. if (s5 !== peg$FAILED) {
  26887. if (input.charCodeAt(peg$currPos) === 59) {
  26888. s6 = peg$c118;
  26889. peg$currPos++;
  26890. } else {
  26891. s6 = peg$FAILED;
  26892. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  26893. }
  26894. if (s6 !== peg$FAILED) {
  26895. s7 = peg$parsewsMessage();
  26896. if (s7 !== peg$FAILED) {
  26897. peg$savedPos = s4;
  26898. s5 = peg$c120(s1, s7);
  26899. s4 = s5;
  26900. } else {
  26901. peg$currPos = s4;
  26902. s4 = peg$FAILED;
  26903. }
  26904. } else {
  26905. peg$currPos = s4;
  26906. s4 = peg$FAILED;
  26907. }
  26908. } else {
  26909. peg$currPos = s4;
  26910. s4 = peg$FAILED;
  26911. }
  26912. }
  26913. } else {
  26914. s3 = peg$FAILED;
  26915. }
  26916. if (s3 !== peg$FAILED) {
  26917. peg$savedPos = s0;
  26918. s1 = peg$c121(s1, s3);
  26919. s0 = s1;
  26920. } else {
  26921. peg$currPos = s0;
  26922. s0 = peg$FAILED;
  26923. }
  26924. } else {
  26925. peg$currPos = s0;
  26926. s0 = peg$FAILED;
  26927. }
  26928. } else {
  26929. peg$currPos = s0;
  26930. s0 = peg$FAILED;
  26931. }
  26932. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26933. return s0;
  26934. }
  26935. function peg$parsejsStatement() {
  26936. var s0;
  26937. var key = peg$currPos * 63 + 56,
  26938. cached = peg$resultsCache[key];
  26939. if (cached) {
  26940. peg$currPos = cached.nextPos;
  26941. return cached.result;
  26942. }
  26943. s0 = peg$parsepragmaJsStatement();
  26944. if (s0 === peg$FAILED) {
  26945. s0 = peg$parselegacyJsStatement();
  26946. }
  26947. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26948. return s0;
  26949. }
  26950. function peg$parselegacyJsStatement() {
  26951. var s0, s1, s2, s3, s4;
  26952. var key = peg$currPos * 63 + 57,
  26953. cached = peg$resultsCache[key];
  26954. if (cached) {
  26955. peg$currPos = cached.nextPos;
  26956. return cached.result;
  26957. }
  26958. s0 = peg$currPos;
  26959. if (input.charCodeAt(peg$currPos) === 60) {
  26960. s1 = peg$c122;
  26961. peg$currPos++;
  26962. } else {
  26963. s1 = peg$FAILED;
  26964. if (peg$silentFails === 0) { peg$fail(peg$c123); }
  26965. }
  26966. if (s1 !== peg$FAILED) {
  26967. s2 = [];
  26968. s3 = peg$currPos;
  26969. if (input.substr(peg$currPos, 2) === peg$c124) {
  26970. s4 = peg$c124;
  26971. peg$currPos += 2;
  26972. } else {
  26973. s4 = peg$FAILED;
  26974. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  26975. }
  26976. if (s4 !== peg$FAILED) {
  26977. peg$savedPos = s3;
  26978. s4 = peg$c126();
  26979. }
  26980. s3 = s4;
  26981. if (s3 === peg$FAILED) {
  26982. if (peg$c127.test(input.charAt(peg$currPos))) {
  26983. s3 = input.charAt(peg$currPos);
  26984. peg$currPos++;
  26985. } else {
  26986. s3 = peg$FAILED;
  26987. if (peg$silentFails === 0) { peg$fail(peg$c128); }
  26988. }
  26989. }
  26990. while (s3 !== peg$FAILED) {
  26991. s2.push(s3);
  26992. s3 = peg$currPos;
  26993. if (input.substr(peg$currPos, 2) === peg$c124) {
  26994. s4 = peg$c124;
  26995. peg$currPos += 2;
  26996. } else {
  26997. s4 = peg$FAILED;
  26998. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  26999. }
  27000. if (s4 !== peg$FAILED) {
  27001. peg$savedPos = s3;
  27002. s4 = peg$c126();
  27003. }
  27004. s3 = s4;
  27005. if (s3 === peg$FAILED) {
  27006. if (peg$c127.test(input.charAt(peg$currPos))) {
  27007. s3 = input.charAt(peg$currPos);
  27008. peg$currPos++;
  27009. } else {
  27010. s3 = peg$FAILED;
  27011. if (peg$silentFails === 0) { peg$fail(peg$c128); }
  27012. }
  27013. }
  27014. }
  27015. if (s2 !== peg$FAILED) {
  27016. if (input.charCodeAt(peg$currPos) === 62) {
  27017. s3 = peg$c129;
  27018. peg$currPos++;
  27019. } else {
  27020. s3 = peg$FAILED;
  27021. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  27022. }
  27023. if (s3 !== peg$FAILED) {
  27024. peg$savedPos = s0;
  27025. s1 = peg$c131(s2);
  27026. s0 = s1;
  27027. } else {
  27028. peg$currPos = s0;
  27029. s0 = peg$FAILED;
  27030. }
  27031. } else {
  27032. peg$currPos = s0;
  27033. s0 = peg$FAILED;
  27034. }
  27035. } else {
  27036. peg$currPos = s0;
  27037. s0 = peg$FAILED;
  27038. }
  27039. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27040. return s0;
  27041. }
  27042. function peg$parsepragmaJsStatement() {
  27043. var s0, s1, s2, s3, s4, s5, s6, s7;
  27044. var key = peg$currPos * 63 + 58,
  27045. cached = peg$resultsCache[key];
  27046. if (cached) {
  27047. peg$currPos = cached.nextPos;
  27048. return cached.result;
  27049. }
  27050. s0 = peg$currPos;
  27051. if (input.charCodeAt(peg$currPos) === 60) {
  27052. s1 = peg$c122;
  27053. peg$currPos++;
  27054. } else {
  27055. s1 = peg$FAILED;
  27056. if (peg$silentFails === 0) { peg$fail(peg$c123); }
  27057. }
  27058. if (s1 !== peg$FAILED) {
  27059. s2 = peg$parsews();
  27060. if (s2 !== peg$FAILED) {
  27061. if (input.substr(peg$currPos, 9) === peg$c132) {
  27062. s3 = peg$c132;
  27063. peg$currPos += 9;
  27064. } else {
  27065. s3 = peg$FAILED;
  27066. if (peg$silentFails === 0) { peg$fail(peg$c133); }
  27067. }
  27068. if (s3 !== peg$FAILED) {
  27069. s4 = peg$parsews();
  27070. if (s4 !== peg$FAILED) {
  27071. s5 = peg$parsestring();
  27072. if (s5 !== peg$FAILED) {
  27073. s6 = peg$parsews();
  27074. if (s6 !== peg$FAILED) {
  27075. if (input.charCodeAt(peg$currPos) === 62) {
  27076. s7 = peg$c129;
  27077. peg$currPos++;
  27078. } else {
  27079. s7 = peg$FAILED;
  27080. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  27081. }
  27082. if (s7 !== peg$FAILED) {
  27083. peg$savedPos = s0;
  27084. s1 = peg$c134(s5);
  27085. s0 = s1;
  27086. } else {
  27087. peg$currPos = s0;
  27088. s0 = peg$FAILED;
  27089. }
  27090. } else {
  27091. peg$currPos = s0;
  27092. s0 = peg$FAILED;
  27093. }
  27094. } else {
  27095. peg$currPos = s0;
  27096. s0 = peg$FAILED;
  27097. }
  27098. } else {
  27099. peg$currPos = s0;
  27100. s0 = peg$FAILED;
  27101. }
  27102. } else {
  27103. peg$currPos = s0;
  27104. s0 = peg$FAILED;
  27105. }
  27106. } else {
  27107. peg$currPos = s0;
  27108. s0 = peg$FAILED;
  27109. }
  27110. } else {
  27111. peg$currPos = s0;
  27112. s0 = peg$FAILED;
  27113. }
  27114. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27115. return s0;
  27116. }
  27117. function peg$parsemethod() {
  27118. var s0, s1, s2;
  27119. var key = peg$currPos * 63 + 59,
  27120. cached = peg$resultsCache[key];
  27121. if (cached) {
  27122. peg$currPos = cached.nextPos;
  27123. return cached.result;
  27124. }
  27125. s0 = peg$currPos;
  27126. s1 = peg$parsewsKeywordPattern();
  27127. if (s1 === peg$FAILED) {
  27128. s1 = peg$parsewsBinaryPattern();
  27129. if (s1 === peg$FAILED) {
  27130. s1 = peg$parsewsUnaryPattern();
  27131. }
  27132. }
  27133. if (s1 !== peg$FAILED) {
  27134. s2 = peg$parsewsSequenceWs();
  27135. if (s2 === peg$FAILED) {
  27136. s2 = null;
  27137. }
  27138. if (s2 !== peg$FAILED) {
  27139. peg$savedPos = s0;
  27140. s1 = peg$c135(s1, s2);
  27141. s0 = s1;
  27142. } else {
  27143. peg$currPos = s0;
  27144. s0 = peg$FAILED;
  27145. }
  27146. } else {
  27147. peg$currPos = s0;
  27148. s0 = peg$FAILED;
  27149. }
  27150. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27151. return s0;
  27152. }
  27153. function peg$parseassociationSend() {
  27154. var s0, s1, s2;
  27155. var key = peg$currPos * 63 + 60,
  27156. cached = peg$resultsCache[key];
  27157. if (cached) {
  27158. peg$currPos = cached.nextPos;
  27159. return cached.result;
  27160. }
  27161. s0 = peg$currPos;
  27162. s1 = peg$parsebinarySend();
  27163. if (s1 !== peg$FAILED) {
  27164. peg$savedPos = peg$currPos;
  27165. s2 = peg$c136(s1);
  27166. if (s2) {
  27167. s2 = void 0;
  27168. } else {
  27169. s2 = peg$FAILED;
  27170. }
  27171. if (s2 !== peg$FAILED) {
  27172. peg$savedPos = s0;
  27173. s1 = peg$c137(s1);
  27174. s0 = s1;
  27175. } else {
  27176. peg$currPos = s0;
  27177. s0 = peg$FAILED;
  27178. }
  27179. } else {
  27180. peg$currPos = s0;
  27181. s0 = peg$FAILED;
  27182. }
  27183. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27184. return s0;
  27185. }
  27186. function peg$parsewsAssociationsRest() {
  27187. var s0, s1, s2, s3, s4;
  27188. var key = peg$currPos * 63 + 61,
  27189. cached = peg$resultsCache[key];
  27190. if (cached) {
  27191. peg$currPos = cached.nextPos;
  27192. return cached.result;
  27193. }
  27194. s0 = peg$currPos;
  27195. s1 = peg$parsews();
  27196. if (s1 !== peg$FAILED) {
  27197. if (input.charCodeAt(peg$currPos) === 46) {
  27198. s2 = peg$c6;
  27199. peg$currPos++;
  27200. } else {
  27201. s2 = peg$FAILED;
  27202. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27203. }
  27204. if (s2 !== peg$FAILED) {
  27205. s3 = peg$parsemaybeDotsWs();
  27206. if (s3 !== peg$FAILED) {
  27207. s4 = peg$parseassociationSend();
  27208. if (s4 !== peg$FAILED) {
  27209. peg$savedPos = s0;
  27210. s1 = peg$c87(s4);
  27211. s0 = s1;
  27212. } else {
  27213. peg$currPos = s0;
  27214. s0 = peg$FAILED;
  27215. }
  27216. } else {
  27217. peg$currPos = s0;
  27218. s0 = peg$FAILED;
  27219. }
  27220. } else {
  27221. peg$currPos = s0;
  27222. s0 = peg$FAILED;
  27223. }
  27224. } else {
  27225. peg$currPos = s0;
  27226. s0 = peg$FAILED;
  27227. }
  27228. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27229. return s0;
  27230. }
  27231. function peg$parseassociations() {
  27232. var s0, s1, s2, s3;
  27233. var key = peg$currPos * 63 + 62,
  27234. cached = peg$resultsCache[key];
  27235. if (cached) {
  27236. peg$currPos = cached.nextPos;
  27237. return cached.result;
  27238. }
  27239. s0 = peg$currPos;
  27240. s1 = peg$parseassociationSend();
  27241. if (s1 !== peg$FAILED) {
  27242. s2 = [];
  27243. s3 = peg$parsewsAssociationsRest();
  27244. while (s3 !== peg$FAILED) {
  27245. s2.push(s3);
  27246. s3 = peg$parsewsAssociationsRest();
  27247. }
  27248. if (s2 !== peg$FAILED) {
  27249. peg$savedPos = s0;
  27250. s1 = peg$c138(s1, s2);
  27251. s0 = s1;
  27252. } else {
  27253. peg$currPos = s0;
  27254. s0 = peg$FAILED;
  27255. }
  27256. } else {
  27257. peg$currPos = s0;
  27258. s0 = peg$FAILED;
  27259. }
  27260. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27261. return s0;
  27262. }
  27263. peg$result = peg$startRuleFunction();
  27264. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  27265. return peg$result;
  27266. } else {
  27267. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  27268. peg$fail({ type: "end", description: "end of input" });
  27269. }
  27270. throw peg$buildException(
  27271. null,
  27272. peg$maxFailExpected,
  27273. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  27274. peg$maxFailPos < input.length
  27275. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  27276. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  27277. );
  27278. }
  27279. }
  27280. return {
  27281. SyntaxError: peg$SyntaxError,
  27282. parse: peg$parse
  27283. };
  27284. })();
  27285. });
  27286. define('amber_core/Platform-ImportExport',["amber/boot", "amber_core/Kernel-Classes", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  27287. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  27288. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  27289. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  27290. $core.addPackage('Platform-ImportExport');
  27291. $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  27292. $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  27293. $core.addClass('AbstractExporter', $globals.Object, [], 'Platform-ImportExport');
  27294. $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.";
  27295. $core.addMethod(
  27296. $core.method({
  27297. selector: "classNameFor:",
  27298. protocol: 'convenience',
  27299. fn: function (aClass){
  27300. var self=this;
  27301. return $core.withContext(function($ctx1) {
  27302. var $1,$2,$receiver;
  27303. $1=$recv(aClass)._isMetaclass();
  27304. if($core.assert($1)){
  27305. $2=$recv($recv(aClass)._instanceClass())._name();
  27306. $ctx1.sendIdx["name"]=1;
  27307. return $recv($2).__comma(" class");
  27308. } else {
  27309. if(($receiver = aClass) == null || $receiver.isNil){
  27310. return "nil";
  27311. } else {
  27312. return $recv(aClass)._name();
  27313. };
  27314. };
  27315. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractExporter)});
  27316. },
  27317. args: ["aClass"],
  27318. source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, ' class' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass\x0a\x09\x09\x09\x09ifNil: [ 'nil' ]\x0a\x09\x09\x09\x09ifNotNil: [ aClass name ] ]",
  27319. referencedClasses: [],
  27320. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "ifNil:ifNotNil:"]
  27321. }),
  27322. $globals.AbstractExporter);
  27323. $core.addMethod(
  27324. $core.method({
  27325. selector: "exportPackage:on:",
  27326. protocol: 'output',
  27327. fn: function (aPackage,aStream){
  27328. var self=this;
  27329. return $core.withContext(function($ctx1) {
  27330. self._subclassResponsibility();
  27331. return self;
  27332. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  27333. },
  27334. args: ["aPackage", "aStream"],
  27335. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27336. referencedClasses: [],
  27337. messageSends: ["subclassResponsibility"]
  27338. }),
  27339. $globals.AbstractExporter);
  27340. $core.addMethod(
  27341. $core.method({
  27342. selector: "extensionMethodsOfPackage:",
  27343. protocol: 'accessing',
  27344. fn: function (aPackage){
  27345. var self=this;
  27346. var result;
  27347. return $core.withContext(function($ctx1) {
  27348. result=$recv($globals.OrderedCollection)._new();
  27349. $recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  27350. return $core.withContext(function($ctx2) {
  27351. return $recv(result)._addAll_($recv(each)._methods());
  27352. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27353. }));
  27354. return result;
  27355. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  27356. },
  27357. args: ["aPackage"],
  27358. 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 methods ].\x0a\x09\x09\x0a\x09^ result",
  27359. referencedClasses: ["OrderedCollection"],
  27360. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"]
  27361. }),
  27362. $globals.AbstractExporter);
  27363. $core.addMethod(
  27364. $core.method({
  27365. selector: "extensionProtocolsOfPackage:",
  27366. protocol: 'accessing',
  27367. fn: function (aPackage){
  27368. var self=this;
  27369. var extensionName,result;
  27370. return $core.withContext(function($ctx1) {
  27371. var $1,$2,$3;
  27372. $1=$recv(aPackage)._name();
  27373. $ctx1.sendIdx["name"]=1;
  27374. extensionName="*".__comma($1);
  27375. result=$recv($globals.OrderedCollection)._new();
  27376. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  27377. return $core.withContext(function($ctx2) {
  27378. $2=$recv(a)._name();
  27379. $ctx2.sendIdx["name"]=2;
  27380. return $recv($2).__lt($recv(b)._name());
  27381. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  27382. })))._do_((function(each){
  27383. return $core.withContext(function($ctx2) {
  27384. return $recv([each,$recv(each)._class()])._do_((function(behavior){
  27385. return $core.withContext(function($ctx3) {
  27386. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  27387. if($core.assert($3)){
  27388. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  27389. };
  27390. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  27391. }));
  27392. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27393. }));
  27394. $ctx1.sendIdx["do:"]=1;
  27395. return result;
  27396. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  27397. },
  27398. args: ["aPackage"],
  27399. 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 class} 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",
  27400. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  27401. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  27402. }),
  27403. $globals.AbstractExporter);
  27404. $core.addClass('ChunkExporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27405. $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.";
  27406. $core.addMethod(
  27407. $core.method({
  27408. selector: "chunkEscape:",
  27409. protocol: 'convenience',
  27410. fn: function (aString){
  27411. var self=this;
  27412. return $core.withContext(function($ctx1) {
  27413. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  27414. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  27415. },
  27416. args: ["aString"],
  27417. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  27418. referencedClasses: [],
  27419. messageSends: ["trimBoth", "replace:with:"]
  27420. }),
  27421. $globals.ChunkExporter);
  27422. $core.addMethod(
  27423. $core.method({
  27424. selector: "exportCategoryEpilogueOf:on:",
  27425. protocol: 'output',
  27426. fn: function (aCategory,aStream){
  27427. var self=this;
  27428. return $core.withContext(function($ctx1) {
  27429. $recv(aStream)._nextPutAll_(" !");
  27430. $recv(aStream)._lf();
  27431. $ctx1.sendIdx["lf"]=1;
  27432. $recv(aStream)._lf();
  27433. return self;
  27434. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27435. },
  27436. args: ["aCategory", "aStream"],
  27437. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27438. referencedClasses: [],
  27439. messageSends: ["nextPutAll:", "lf"]
  27440. }),
  27441. $globals.ChunkExporter);
  27442. $core.addMethod(
  27443. $core.method({
  27444. selector: "exportCategoryPrologueOf:on:",
  27445. protocol: 'output',
  27446. fn: function (aCategory,aStream){
  27447. var self=this;
  27448. return $core.withContext(function($ctx1) {
  27449. var $1,$2;
  27450. $1="!".__comma(self._classNameFor_($recv(aCategory)._theClass()));
  27451. $ctx1.sendIdx[","]=1;
  27452. $recv(aStream)._nextPutAll_($1);
  27453. $ctx1.sendIdx["nextPutAll:"]=1;
  27454. $2=$recv(" methodsFor: '".__comma($recv(aCategory)._name())).__comma("'!");
  27455. $ctx1.sendIdx[","]=2;
  27456. $recv(aStream)._nextPutAll_($2);
  27457. return self;
  27458. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27459. },
  27460. args: ["aCategory", "aStream"],
  27461. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  27462. referencedClasses: [],
  27463. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27464. }),
  27465. $globals.ChunkExporter);
  27466. $core.addMethod(
  27467. $core.method({
  27468. selector: "exportDefinitionOf:on:",
  27469. protocol: 'output',
  27470. fn: function (aClass,aStream){
  27471. var self=this;
  27472. return $core.withContext(function($ctx1) {
  27473. var $1,$3,$2,$4,$6,$5,$7,$8,$10,$9,$11;
  27474. $1=self._classNameFor_($recv(aClass)._superclass());
  27475. $ctx1.sendIdx["classNameFor:"]=1;
  27476. $recv(aStream)._nextPutAll_($1);
  27477. $ctx1.sendIdx["nextPutAll:"]=1;
  27478. $3=self._classNameFor_(aClass);
  27479. $ctx1.sendIdx["classNameFor:"]=2;
  27480. $2=" subclass: #".__comma($3);
  27481. $ctx1.sendIdx[","]=1;
  27482. $recv(aStream)._nextPutAll_($2);
  27483. $ctx1.sendIdx["nextPutAll:"]=2;
  27484. $recv(aStream)._lf();
  27485. $ctx1.sendIdx["lf"]=1;
  27486. $recv(aStream)._tab();
  27487. $ctx1.sendIdx["tab"]=1;
  27488. $4=$recv(aStream)._nextPutAll_("instanceVariableNames: '");
  27489. $ctx1.sendIdx["nextPutAll:"]=3;
  27490. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27491. return $core.withContext(function($ctx2) {
  27492. return $recv(aStream)._nextPutAll_(each);
  27493. $ctx2.sendIdx["nextPutAll:"]=4;
  27494. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27495. }),(function(){
  27496. return $core.withContext(function($ctx2) {
  27497. return $recv(aStream)._nextPutAll_(" ");
  27498. $ctx2.sendIdx["nextPutAll:"]=5;
  27499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27500. }));
  27501. $recv(aStream)._nextPutAll_("'");
  27502. $ctx1.sendIdx["nextPutAll:"]=6;
  27503. $recv(aStream)._lf();
  27504. $ctx1.sendIdx["lf"]=2;
  27505. $recv(aStream)._tab();
  27506. $6="package: '".__comma($recv(aClass)._category());
  27507. $ctx1.sendIdx[","]=3;
  27508. $5=$recv($6).__comma("'!");
  27509. $ctx1.sendIdx[","]=2;
  27510. $recv(aStream)._nextPutAll_($5);
  27511. $ctx1.sendIdx["nextPutAll:"]=7;
  27512. $7=$recv(aStream)._lf();
  27513. $ctx1.sendIdx["lf"]=3;
  27514. $8=$recv(aClass)._comment();
  27515. $ctx1.sendIdx["comment"]=1;
  27516. $recv($8)._ifNotEmpty_((function(){
  27517. return $core.withContext(function($ctx2) {
  27518. $10="!".__comma(self._classNameFor_(aClass));
  27519. $ctx2.sendIdx[","]=5;
  27520. $9=$recv($10).__comma(" commentStamp!");
  27521. $ctx2.sendIdx[","]=4;
  27522. $recv(aStream)._nextPutAll_($9);
  27523. $ctx2.sendIdx["nextPutAll:"]=8;
  27524. $recv(aStream)._lf();
  27525. $ctx2.sendIdx["lf"]=4;
  27526. $recv(aStream)._nextPutAll_($recv(self._chunkEscape_($recv(aClass)._comment())).__comma("!"));
  27527. $11=$recv(aStream)._lf();
  27528. $ctx2.sendIdx["lf"]=5;
  27529. return $11;
  27530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27531. }));
  27532. $recv(aStream)._lf();
  27533. return self;
  27534. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27535. },
  27536. args: ["aClass", "aStream"],
  27537. source: "exportDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;\x0a\x09\x09tab; nextPutAll: 'instanceVariableNames: '''.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: ''''; lf;\x0a\x09\x09tab; nextPutAll: 'package: ''', aClass category, '''!'; lf.\x0a\x09aClass comment ifNotEmpty: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass), ' commentStamp!';lf;\x0a\x09\x09nextPutAll: (self chunkEscape: aClass comment), '!';lf ].\x0a\x09aStream lf",
  27538. referencedClasses: [],
  27539. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  27540. }),
  27541. $globals.ChunkExporter);
  27542. $core.addMethod(
  27543. $core.method({
  27544. selector: "exportMetaDefinitionOf:on:",
  27545. protocol: 'output',
  27546. fn: function (aClass,aStream){
  27547. var self=this;
  27548. return $core.withContext(function($ctx1) {
  27549. var $2,$1,$3;
  27550. $2=$recv(aClass)._class();
  27551. $ctx1.sendIdx["class"]=1;
  27552. $1=$recv($2)._instanceVariableNames();
  27553. $recv($1)._ifNotEmpty_((function(classIvars){
  27554. return $core.withContext(function($ctx2) {
  27555. $recv(aStream)._nextPutAll_(self._classNameFor_($recv(aClass)._class()));
  27556. $ctx2.sendIdx["nextPutAll:"]=1;
  27557. $3=$recv(aStream)._nextPutAll_(" instanceVariableNames: '");
  27558. $ctx2.sendIdx["nextPutAll:"]=2;
  27559. $3;
  27560. $recv(classIvars)._do_separatedBy_((function(each){
  27561. return $core.withContext(function($ctx3) {
  27562. return $recv(aStream)._nextPutAll_(each);
  27563. $ctx3.sendIdx["nextPutAll:"]=3;
  27564. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  27565. }),(function(){
  27566. return $core.withContext(function($ctx3) {
  27567. return $recv(aStream)._nextPutAll_(" ");
  27568. $ctx3.sendIdx["nextPutAll:"]=4;
  27569. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  27570. }));
  27571. $recv(aStream)._nextPutAll_("'!");
  27572. $recv(aStream)._lf();
  27573. $ctx2.sendIdx["lf"]=1;
  27574. return $recv(aStream)._lf();
  27575. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  27576. }));
  27577. return self;
  27578. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27579. },
  27580. args: ["aClass", "aStream"],
  27581. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09aClass class instanceVariableNames ifNotEmpty: [ :classIvars |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: (self classNameFor: aClass class);\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09classIvars\x0a\x09\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '''!'; lf; lf ]",
  27582. referencedClasses: [],
  27583. messageSends: ["ifNotEmpty:", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"]
  27584. }),
  27585. $globals.ChunkExporter);
  27586. $core.addMethod(
  27587. $core.method({
  27588. selector: "exportMethod:on:",
  27589. protocol: 'output',
  27590. fn: function (aMethod,aStream){
  27591. var self=this;
  27592. return $core.withContext(function($ctx1) {
  27593. $recv(aStream)._lf();
  27594. $ctx1.sendIdx["lf"]=1;
  27595. $recv(aStream)._lf();
  27596. $ctx1.sendIdx["lf"]=2;
  27597. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aMethod)._source()));
  27598. $ctx1.sendIdx["nextPutAll:"]=1;
  27599. $recv(aStream)._lf();
  27600. $recv(aStream)._nextPutAll_("!");
  27601. return self;
  27602. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  27603. },
  27604. args: ["aMethod", "aStream"],
  27605. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  27606. referencedClasses: [],
  27607. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]
  27608. }),
  27609. $globals.ChunkExporter);
  27610. $core.addMethod(
  27611. $core.method({
  27612. selector: "exportPackage:on:",
  27613. protocol: 'output',
  27614. fn: function (aPackage,aStream){
  27615. var self=this;
  27616. return $core.withContext(function($ctx1) {
  27617. var $1;
  27618. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27619. self._exportPackageImportsOf_on_(aPackage,aStream);
  27620. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27621. return $core.withContext(function($ctx2) {
  27622. self._exportDefinitionOf_on_(each,aStream);
  27623. $1=self._ownMethodProtocolsOfClass_(each);
  27624. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  27625. self._exportProtocols_on_($1,aStream);
  27626. $ctx2.sendIdx["exportProtocols:on:"]=1;
  27627. self._exportMetaDefinitionOf_on_(each,aStream);
  27628. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_($recv(each)._class()),aStream);
  27629. $ctx2.sendIdx["exportProtocols:on:"]=2;
  27630. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27631. }));
  27632. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  27633. return self;
  27634. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27635. },
  27636. args: ["aPackage", "aStream"],
  27637. 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 exportDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each)\x0a\x09\x09\x09on: aStream.\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each class)\x0a\x09\x09\x09on: aStream ].\x0a\x09\x09\x09\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream",
  27638. referencedClasses: [],
  27639. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"]
  27640. }),
  27641. $globals.ChunkExporter);
  27642. $core.addMethod(
  27643. $core.method({
  27644. selector: "exportPackageDefinitionOf:on:",
  27645. protocol: 'output',
  27646. fn: function (aPackage,aStream){
  27647. var self=this;
  27648. return $core.withContext(function($ctx1) {
  27649. var $1;
  27650. $1=$recv("Smalltalk createPackage: '".__comma($recv(aPackage)._name())).__comma("'!");
  27651. $ctx1.sendIdx[","]=1;
  27652. $recv(aStream)._nextPutAll_($1);
  27653. $recv(aStream)._lf();
  27654. return self;
  27655. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27656. },
  27657. args: ["aPackage", "aStream"],
  27658. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  27659. referencedClasses: [],
  27660. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27661. }),
  27662. $globals.ChunkExporter);
  27663. $core.addMethod(
  27664. $core.method({
  27665. selector: "exportPackageImportsOf:on:",
  27666. protocol: 'output',
  27667. fn: function (aPackage,aStream){
  27668. var self=this;
  27669. return $core.withContext(function($ctx1) {
  27670. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  27671. return $core.withContext(function($ctx2) {
  27672. $recv(aStream)._nextPutAll_("(Smalltalk packageAt: '");
  27673. $ctx2.sendIdx["nextPutAll:"]=1;
  27674. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  27675. $ctx2.sendIdx["nextPutAll:"]=2;
  27676. $recv(aStream)._nextPutAll_("') imports: ");
  27677. $ctx2.sendIdx["nextPutAll:"]=3;
  27678. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aPackage)._importsDefinition()));
  27679. $ctx2.sendIdx["nextPutAll:"]=4;
  27680. $recv(aStream)._nextPutAll_("!");
  27681. return $recv(aStream)._lf();
  27682. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27683. }));
  27684. return self;
  27685. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27686. },
  27687. args: ["aPackage", "aStream"],
  27688. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage imports ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '(Smalltalk packageAt: ''';\x0a\x09\x09\x09nextPutAll: aPackage name;\x0a\x09\x09\x09nextPutAll: ''') imports: ';\x0a\x09\x09\x09nextPutAll: (self chunkEscape: aPackage importsDefinition);\x0a\x09\x09\x09nextPutAll: '!';\x0a\x09\x09\x09lf ]",
  27689. referencedClasses: [],
  27690. messageSends: ["ifNotEmpty:", "imports", "nextPutAll:", "name", "chunkEscape:", "importsDefinition", "lf"]
  27691. }),
  27692. $globals.ChunkExporter);
  27693. $core.addMethod(
  27694. $core.method({
  27695. selector: "exportProtocol:on:",
  27696. protocol: 'output',
  27697. fn: function (aProtocol,aStream){
  27698. var self=this;
  27699. return $core.withContext(function($ctx1) {
  27700. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  27701. $recv($recv(aProtocol)._methods())._do_((function(method){
  27702. return $core.withContext(function($ctx2) {
  27703. return self._exportMethod_on_(method,aStream);
  27704. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  27705. }));
  27706. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  27707. return self;
  27708. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27709. },
  27710. args: ["aProtocol", "aStream"],
  27711. source: "exportProtocol: aProtocol on: aStream\x0a\x09self exportProtocolPrologueOf: aProtocol on: aStream.\x0a\x09aProtocol methods do: [ :method | \x0a\x09\x09self exportMethod: method on: aStream ].\x0a\x09self exportProtocolEpilogueOf: aProtocol on: aStream",
  27712. referencedClasses: [],
  27713. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  27714. }),
  27715. $globals.ChunkExporter);
  27716. $core.addMethod(
  27717. $core.method({
  27718. selector: "exportProtocolEpilogueOf:on:",
  27719. protocol: 'output',
  27720. fn: function (aProtocol,aStream){
  27721. var self=this;
  27722. return $core.withContext(function($ctx1) {
  27723. $recv(aStream)._nextPutAll_(" !");
  27724. $recv(aStream)._lf();
  27725. $ctx1.sendIdx["lf"]=1;
  27726. $recv(aStream)._lf();
  27727. return self;
  27728. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27729. },
  27730. args: ["aProtocol", "aStream"],
  27731. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27732. referencedClasses: [],
  27733. messageSends: ["nextPutAll:", "lf"]
  27734. }),
  27735. $globals.ChunkExporter);
  27736. $core.addMethod(
  27737. $core.method({
  27738. selector: "exportProtocolPrologueOf:on:",
  27739. protocol: 'output',
  27740. fn: function (aProtocol,aStream){
  27741. var self=this;
  27742. return $core.withContext(function($ctx1) {
  27743. var $1,$2;
  27744. $1="!".__comma(self._classNameFor_($recv(aProtocol)._theClass()));
  27745. $ctx1.sendIdx[","]=1;
  27746. $recv(aStream)._nextPutAll_($1);
  27747. $ctx1.sendIdx["nextPutAll:"]=1;
  27748. $2=$recv(" methodsFor: '".__comma($recv(aProtocol)._name())).__comma("'!");
  27749. $ctx1.sendIdx[","]=2;
  27750. $recv(aStream)._nextPutAll_($2);
  27751. return self;
  27752. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27753. },
  27754. args: ["aProtocol", "aStream"],
  27755. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  27756. referencedClasses: [],
  27757. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27758. }),
  27759. $globals.ChunkExporter);
  27760. $core.addMethod(
  27761. $core.method({
  27762. selector: "exportProtocols:on:",
  27763. protocol: 'output',
  27764. fn: function (aCollection,aStream){
  27765. var self=this;
  27766. return $core.withContext(function($ctx1) {
  27767. $recv(aCollection)._do_((function(each){
  27768. return $core.withContext(function($ctx2) {
  27769. return self._exportProtocol_on_(each,aStream);
  27770. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27771. }));
  27772. return self;
  27773. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  27774. },
  27775. args: ["aCollection", "aStream"],
  27776. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  27777. referencedClasses: [],
  27778. messageSends: ["do:", "exportProtocol:on:"]
  27779. }),
  27780. $globals.ChunkExporter);
  27781. $core.addMethod(
  27782. $core.method({
  27783. selector: "extensionCategoriesOfPackage:",
  27784. protocol: 'accessing',
  27785. fn: function (aPackage){
  27786. var self=this;
  27787. var name,map,result;
  27788. return $core.withContext(function($ctx1) {
  27789. var $1;
  27790. name=$recv(aPackage)._name();
  27791. result=$recv($globals.OrderedCollection)._new();
  27792. $ctx1.sendIdx["new"]=1;
  27793. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  27794. return $core.withContext(function($ctx2) {
  27795. return $recv([each,$recv(each)._class()])._do_((function(aClass){
  27796. return $core.withContext(function($ctx3) {
  27797. map=$recv($globals.Dictionary)._new();
  27798. map;
  27799. $recv(aClass)._protocolsDo_((function(category,methods){
  27800. return $core.withContext(function($ctx4) {
  27801. $1=$recv(category).__eq("*".__comma(name));
  27802. if($core.assert($1)){
  27803. return $recv(map)._at_put_(category,methods);
  27804. };
  27805. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  27806. }));
  27807. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27808. return $core.withContext(function($ctx4) {
  27809. return $recv(a).__lt_eq(b);
  27810. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  27811. })))._collect_((function(category){
  27812. return $core.withContext(function($ctx4) {
  27813. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  27814. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  27815. })));
  27816. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  27817. }));
  27818. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27819. }));
  27820. $ctx1.sendIdx["do:"]=1;
  27821. return result;
  27822. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  27823. },
  27824. args: ["aPackage"],
  27825. 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 class} 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",
  27826. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  27827. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27828. }),
  27829. $globals.ChunkExporter);
  27830. $core.addMethod(
  27831. $core.method({
  27832. selector: "ownCategoriesOfClass:",
  27833. protocol: 'accessing',
  27834. fn: function (aClass){
  27835. var self=this;
  27836. var map;
  27837. return $core.withContext(function($ctx1) {
  27838. var $1;
  27839. map=$recv($globals.Dictionary)._new();
  27840. $recv(aClass)._protocolsDo_((function(each,methods){
  27841. return $core.withContext(function($ctx2) {
  27842. $1=$recv(each)._match_("^\x5c*");
  27843. if(!$core.assert($1)){
  27844. return $recv(map)._at_put_(each,methods);
  27845. };
  27846. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  27847. }));
  27848. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27849. return $core.withContext(function($ctx2) {
  27850. return $recv(a).__lt_eq(b);
  27851. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  27852. })))._collect_((function(each){
  27853. return $core.withContext(function($ctx2) {
  27854. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  27855. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27856. }));
  27857. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  27858. },
  27859. args: ["aClass"],
  27860. 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) ]",
  27861. referencedClasses: ["Dictionary", "MethodCategory"],
  27862. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27863. }),
  27864. $globals.ChunkExporter);
  27865. $core.addMethod(
  27866. $core.method({
  27867. selector: "ownCategoriesOfMetaClass:",
  27868. protocol: 'accessing',
  27869. fn: function (aClass){
  27870. var self=this;
  27871. return $core.withContext(function($ctx1) {
  27872. return self._ownCategoriesOfClass_($recv(aClass)._class());
  27873. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  27874. },
  27875. args: ["aClass"],
  27876. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  27877. referencedClasses: [],
  27878. messageSends: ["ownCategoriesOfClass:", "class"]
  27879. }),
  27880. $globals.ChunkExporter);
  27881. $core.addMethod(
  27882. $core.method({
  27883. selector: "ownMethodProtocolsOfClass:",
  27884. protocol: 'accessing',
  27885. fn: function (aClass){
  27886. var self=this;
  27887. return $core.withContext(function($ctx1) {
  27888. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  27889. return $core.withContext(function($ctx2) {
  27890. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  27891. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27892. }));
  27893. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  27894. },
  27895. args: ["aClass"],
  27896. 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 ]",
  27897. referencedClasses: ["ExportMethodProtocol"],
  27898. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  27899. }),
  27900. $globals.ChunkExporter);
  27901. $core.addClass('Exporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27902. $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.).";
  27903. $core.addMethod(
  27904. $core.method({
  27905. selector: "exportDefinitionOf:on:",
  27906. protocol: 'output',
  27907. fn: function (aClass,aStream){
  27908. var self=this;
  27909. return $core.withContext(function($ctx1) {
  27910. var $2,$1,$3,$4,$6,$5,$7,$8;
  27911. $recv(aStream)._lf();
  27912. $ctx1.sendIdx["lf"]=1;
  27913. $recv(aStream)._nextPutAll_("$core.addClass(");
  27914. $ctx1.sendIdx["nextPutAll:"]=1;
  27915. $2="'".__comma(self._classNameFor_(aClass));
  27916. $ctx1.sendIdx[","]=2;
  27917. $1=$recv($2).__comma("', ");
  27918. $ctx1.sendIdx[","]=1;
  27919. $recv(aStream)._nextPutAll_($1);
  27920. $ctx1.sendIdx["nextPutAll:"]=2;
  27921. $3=self._jsClassNameFor_($recv(aClass)._superclass());
  27922. $ctx1.sendIdx["jsClassNameFor:"]=1;
  27923. $recv(aStream)._nextPutAll_($3);
  27924. $ctx1.sendIdx["nextPutAll:"]=3;
  27925. $4=$recv(aStream)._nextPutAll_(", [");
  27926. $ctx1.sendIdx["nextPutAll:"]=4;
  27927. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27928. return $core.withContext(function($ctx2) {
  27929. $6="'".__comma(each);
  27930. $ctx2.sendIdx[","]=4;
  27931. $5=$recv($6).__comma("'");
  27932. $ctx2.sendIdx[","]=3;
  27933. return $recv(aStream)._nextPutAll_($5);
  27934. $ctx2.sendIdx["nextPutAll:"]=5;
  27935. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27936. }),(function(){
  27937. return $core.withContext(function($ctx2) {
  27938. return $recv(aStream)._nextPutAll_(", ");
  27939. $ctx2.sendIdx["nextPutAll:"]=6;
  27940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27941. }));
  27942. $recv(aStream)._nextPutAll_("], '");
  27943. $ctx1.sendIdx["nextPutAll:"]=7;
  27944. $recv(aStream)._nextPutAll_($recv($recv(aClass)._category()).__comma("'"));
  27945. $ctx1.sendIdx["nextPutAll:"]=8;
  27946. $7=$recv(aStream)._nextPutAll_(");");
  27947. $ctx1.sendIdx["nextPutAll:"]=9;
  27948. $8=$recv(aClass)._comment();
  27949. $ctx1.sendIdx["comment"]=1;
  27950. $recv($8)._ifNotEmpty_((function(){
  27951. return $core.withContext(function($ctx2) {
  27952. $recv(aStream)._lf();
  27953. $ctx2.sendIdx["lf"]=2;
  27954. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27955. $ctx2.sendIdx["nextPutAll:"]=10;
  27956. $recv(aStream)._lf();
  27957. $ctx2.sendIdx["lf"]=3;
  27958. $recv(aStream)._nextPutAll_(self._jsClassNameFor_(aClass));
  27959. $ctx2.sendIdx["nextPutAll:"]=11;
  27960. $recv(aStream)._nextPutAll_(".comment=");
  27961. $ctx2.sendIdx["nextPutAll:"]=12;
  27962. $recv(aStream)._nextPutAll_($recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavascript());
  27963. $ctx2.sendIdx["nextPutAll:"]=13;
  27964. $recv(aStream)._nextPutAll_(";");
  27965. $ctx2.sendIdx["nextPutAll:"]=14;
  27966. $recv(aStream)._lf();
  27967. $ctx2.sendIdx["lf"]=4;
  27968. return $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27970. }));
  27971. $recv(aStream)._lf();
  27972. return self;
  27973. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27974. },
  27975. args: ["aClass", "aStream"],
  27976. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '$core.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ', ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: '], ''';\x0a\x09\x09nextPutAll: aClass category, '''';\x0a\x09\x09nextPutAll: ');'.\x0a\x09aClass comment ifNotEmpty: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);';\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: (self jsClassNameFor: aClass);\x0a\x09\x09\x09nextPutAll: '.comment=';\x0a\x09\x09\x09nextPutAll: aClass comment crlfSanitized asJavascript;\x0a\x09\x09\x09nextPutAll: ';';\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: '//>>excludeEnd(\x22ide\x22);' ].\x0a\x09aStream lf",
  27977. referencedClasses: [],
  27978. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "asJavascript", "crlfSanitized"]
  27979. }),
  27980. $globals.Exporter);
  27981. $core.addMethod(
  27982. $core.method({
  27983. selector: "exportMetaDefinitionOf:on:",
  27984. protocol: 'output',
  27985. fn: function (aClass,aStream){
  27986. var self=this;
  27987. return $core.withContext(function($ctx1) {
  27988. var $2,$1,$3,$5,$4;
  27989. $recv(aStream)._lf();
  27990. $ctx1.sendIdx["lf"]=1;
  27991. $2=$recv(aClass)._class();
  27992. $ctx1.sendIdx["class"]=1;
  27993. $1=$recv($2)._instanceVariableNames();
  27994. $recv($1)._ifNotEmpty_((function(classIvars){
  27995. return $core.withContext(function($ctx2) {
  27996. $recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aClass)._class()));
  27997. $ctx2.sendIdx["nextPutAll:"]=1;
  27998. $3=$recv(aStream)._nextPutAll_(".iVarNames = [");
  27999. $ctx2.sendIdx["nextPutAll:"]=2;
  28000. $3;
  28001. $recv(classIvars)._do_separatedBy_((function(each){
  28002. return $core.withContext(function($ctx3) {
  28003. $5="'".__comma(each);
  28004. $ctx3.sendIdx[","]=2;
  28005. $4=$recv($5).__comma("'");
  28006. $ctx3.sendIdx[","]=1;
  28007. return $recv(aStream)._nextPutAll_($4);
  28008. $ctx3.sendIdx["nextPutAll:"]=3;
  28009. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  28010. }),(function(){
  28011. return $core.withContext(function($ctx3) {
  28012. return $recv(aStream)._nextPutAll_(",");
  28013. $ctx3.sendIdx["nextPutAll:"]=4;
  28014. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28015. }));
  28016. return $recv(aStream)._nextPutAll_("];".__comma($recv($globals.String)._lf()));
  28017. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  28018. }));
  28019. return self;
  28020. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  28021. },
  28022. args: ["aClass", "aStream"],
  28023. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass class instanceVariableNames ifNotEmpty: [ :classIvars |\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09\x09classIvars\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ',' ].\x0a\x09\x09aStream nextPutAll: '];', String lf ]",
  28024. referencedClasses: ["String"],
  28025. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","]
  28026. }),
  28027. $globals.Exporter);
  28028. $core.addMethod(
  28029. $core.method({
  28030. selector: "exportMethod:on:",
  28031. protocol: 'output',
  28032. fn: function (aMethod,aStream){
  28033. var self=this;
  28034. return $core.withContext(function($ctx1) {
  28035. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14;
  28036. $recv(aStream)._nextPutAll_("$core.addMethod(");
  28037. $ctx1.sendIdx["nextPutAll:"]=1;
  28038. $recv(aStream)._lf();
  28039. $ctx1.sendIdx["lf"]=1;
  28040. $recv(aStream)._nextPutAll_("$core.method({");
  28041. $ctx1.sendIdx["nextPutAll:"]=2;
  28042. $recv(aStream)._lf();
  28043. $ctx1.sendIdx["lf"]=2;
  28044. $3=$recv($recv(aMethod)._selector())._asJavascript();
  28045. $ctx1.sendIdx["asJavascript"]=1;
  28046. $2="selector: ".__comma($3);
  28047. $ctx1.sendIdx[","]=2;
  28048. $1=$recv($2).__comma(",");
  28049. $ctx1.sendIdx[","]=1;
  28050. $recv(aStream)._nextPutAll_($1);
  28051. $ctx1.sendIdx["nextPutAll:"]=3;
  28052. $recv(aStream)._lf();
  28053. $ctx1.sendIdx["lf"]=3;
  28054. $5="protocol: '".__comma($recv(aMethod)._protocol());
  28055. $ctx1.sendIdx[","]=4;
  28056. $4=$recv($5).__comma("',");
  28057. $ctx1.sendIdx[","]=3;
  28058. $recv(aStream)._nextPutAll_($4);
  28059. $ctx1.sendIdx["nextPutAll:"]=4;
  28060. $recv(aStream)._lf();
  28061. $ctx1.sendIdx["lf"]=4;
  28062. $7="fn: ".__comma($recv($recv(aMethod)._fn())._compiledSource());
  28063. $ctx1.sendIdx[","]=6;
  28064. $6=$recv($7).__comma(",");
  28065. $ctx1.sendIdx[","]=5;
  28066. $recv(aStream)._nextPutAll_($6);
  28067. $ctx1.sendIdx["nextPutAll:"]=5;
  28068. $recv(aStream)._lf();
  28069. $ctx1.sendIdx["lf"]=5;
  28070. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  28071. $ctx1.sendIdx["nextPutAll:"]=6;
  28072. $recv(aStream)._lf();
  28073. $ctx1.sendIdx["lf"]=6;
  28074. $10=$recv($recv(aMethod)._arguments())._asJavascript();
  28075. $ctx1.sendIdx["asJavascript"]=2;
  28076. $9="args: ".__comma($10);
  28077. $ctx1.sendIdx[","]=8;
  28078. $8=$recv($9).__comma(",");
  28079. $ctx1.sendIdx[","]=7;
  28080. $recv(aStream)._nextPutAll_($8);
  28081. $ctx1.sendIdx["nextPutAll:"]=7;
  28082. $recv(aStream)._lf();
  28083. $ctx1.sendIdx["lf"]=7;
  28084. $13=$recv($recv(aMethod)._source())._asJavascript();
  28085. $ctx1.sendIdx["asJavascript"]=3;
  28086. $12="source: ".__comma($13);
  28087. $ctx1.sendIdx[","]=10;
  28088. $11=$recv($12).__comma(",");
  28089. $ctx1.sendIdx[","]=9;
  28090. $recv(aStream)._nextPutAll_($11);
  28091. $ctx1.sendIdx["nextPutAll:"]=8;
  28092. $recv(aStream)._lf();
  28093. $ctx1.sendIdx["lf"]=8;
  28094. $16=$recv($recv(aMethod)._referencedClasses())._asJavascript();
  28095. $ctx1.sendIdx["asJavascript"]=4;
  28096. $15="referencedClasses: ".__comma($16);
  28097. $ctx1.sendIdx[","]=12;
  28098. $14=$recv($15).__comma(",");
  28099. $ctx1.sendIdx[","]=11;
  28100. $recv(aStream)._nextPutAll_($14);
  28101. $ctx1.sendIdx["nextPutAll:"]=9;
  28102. $recv(aStream)._lf();
  28103. $ctx1.sendIdx["lf"]=9;
  28104. $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  28105. $ctx1.sendIdx["nextPutAll:"]=10;
  28106. $recv(aStream)._lf();
  28107. $ctx1.sendIdx["lf"]=10;
  28108. $recv(aStream)._nextPutAll_("messageSends: ".__comma($recv($recv(aMethod)._messageSends())._asJavascript()));
  28109. $ctx1.sendIdx["nextPutAll:"]=11;
  28110. $recv(aStream)._lf();
  28111. $ctx1.sendIdx["lf"]=11;
  28112. $recv(aStream)._nextPutAll_("}),");
  28113. $ctx1.sendIdx["nextPutAll:"]=12;
  28114. $recv(aStream)._lf();
  28115. $ctx1.sendIdx["lf"]=12;
  28116. $recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aMethod)._methodClass()));
  28117. $ctx1.sendIdx["nextPutAll:"]=13;
  28118. $recv(aStream)._nextPutAll_(");");
  28119. $recv(aStream)._lf();
  28120. $ctx1.sendIdx["lf"]=13;
  28121. $recv(aStream)._lf();
  28122. return self;
  28123. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  28124. },
  28125. args: ["aMethod", "aStream"],
  28126. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addMethod(';lf;\x0a\x09\x09nextPutAll: '$core.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'protocol: ''', aMethod protocol, ''',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript, ',';lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ide\x22);';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript;lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: (self jsClassNameFor: aMethod methodClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
  28127. referencedClasses: [],
  28128. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"]
  28129. }),
  28130. $globals.Exporter);
  28131. $core.addMethod(
  28132. $core.method({
  28133. selector: "exportPackage:on:",
  28134. protocol: 'output',
  28135. fn: function (aPackage,aStream){
  28136. var self=this;
  28137. return $core.withContext(function($ctx1) {
  28138. var $1;
  28139. self._exportPackagePrologueOf_on_(aPackage,aStream);
  28140. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  28141. self._exportPackageContextOf_on_(aPackage,aStream);
  28142. self._exportPackageImportsOf_on_(aPackage,aStream);
  28143. self._exportPackageTransportOf_on_(aPackage,aStream);
  28144. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  28145. return $core.withContext(function($ctx2) {
  28146. self._exportDefinitionOf_on_(each,aStream);
  28147. $1=$recv(each)._ownMethods();
  28148. $ctx2.sendIdx["ownMethods"]=1;
  28149. $recv($1)._do_((function(method){
  28150. return $core.withContext(function($ctx3) {
  28151. return self._exportMethod_on_(method,aStream);
  28152. $ctx3.sendIdx["exportMethod:on:"]=1;
  28153. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  28154. }));
  28155. $ctx2.sendIdx["do:"]=2;
  28156. self._exportMetaDefinitionOf_on_(each,aStream);
  28157. return $recv($recv($recv(each)._class())._ownMethods())._do_((function(method){
  28158. return $core.withContext(function($ctx3) {
  28159. return self._exportMethod_on_(method,aStream);
  28160. $ctx3.sendIdx["exportMethod:on:"]=2;
  28161. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)});
  28162. }));
  28163. $ctx2.sendIdx["do:"]=3;
  28164. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28165. }));
  28166. $ctx1.sendIdx["do:"]=1;
  28167. $recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  28168. return $core.withContext(function($ctx2) {
  28169. return self._exportMethod_on_(each,aStream);
  28170. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  28171. }));
  28172. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  28173. return self;
  28174. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28175. },
  28176. args: ["aPackage", "aStream"],
  28177. 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 exportDefinitionOf: each on: aStream.\x0a\x09\x09each ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ].\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09each class ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ] ].\x0a\x09\x09\x09\x0a\x09(self extensionMethodsOfPackage: aPackage) do: [ :each |\x0a\x09\x09self exportMethod: each on: aStream ].\x0a\x09\x09\x0a\x09self exportPackageEpilogueOf: aPackage on: aStream",
  28178. referencedClasses: [],
  28179. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"]
  28180. }),
  28181. $globals.Exporter);
  28182. $core.addMethod(
  28183. $core.method({
  28184. selector: "exportPackageBodyBlockPrologueOf:on:",
  28185. protocol: 'output',
  28186. fn: function (aPackage,aStream){
  28187. var self=this;
  28188. return $core.withContext(function($ctx1) {
  28189. $recv(aStream)._nextPutAll_("if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;");
  28190. $ctx1.sendIdx["nextPutAll:"]=1;
  28191. $recv(aStream)._lf();
  28192. $ctx1.sendIdx["lf"]=1;
  28193. $recv(aStream)._nextPutAll_("var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  28194. $ctx1.sendIdx["nextPutAll:"]=2;
  28195. $recv(aStream)._lf();
  28196. $ctx1.sendIdx["lf"]=2;
  28197. $recv(aStream)._nextPutAll_("if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;");
  28198. $recv(aStream)._lf();
  28199. return self;
  28200. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28201. },
  28202. args: ["aPackage", "aStream"],
  28203. source: "exportPackageBodyBlockPrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;';\x0a\x09\x09lf",
  28204. referencedClasses: [],
  28205. messageSends: ["nextPutAll:", "lf"]
  28206. }),
  28207. $globals.Exporter);
  28208. $core.addMethod(
  28209. $core.method({
  28210. selector: "exportPackageContextOf:on:",
  28211. protocol: 'output',
  28212. fn: function (aPackage,aStream){
  28213. var self=this;
  28214. return $core.withContext(function($ctx1) {
  28215. $recv(aStream)._nextPutAll_("$core.packages[");
  28216. $ctx1.sendIdx["nextPutAll:"]=1;
  28217. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  28218. $ctx1.sendIdx["nextPutAll:"]=2;
  28219. $recv(aStream)._nextPutAll_("].innerEval = ");
  28220. $ctx1.sendIdx["nextPutAll:"]=3;
  28221. $recv(aStream)._nextPutAll_("function (expr) { return eval(expr); }");
  28222. $ctx1.sendIdx["nextPutAll:"]=4;
  28223. $recv(aStream)._nextPutAll_(";");
  28224. $recv(aStream)._lf();
  28225. return self;
  28226. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28227. },
  28228. args: ["aPackage", "aStream"],
  28229. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].innerEval = ';\x0a\x09\x09nextPutAll: 'function (expr) { return eval(expr); }';\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf",
  28230. referencedClasses: [],
  28231. messageSends: ["nextPutAll:", "asJavascript", "name", "lf"]
  28232. }),
  28233. $globals.Exporter);
  28234. $core.addMethod(
  28235. $core.method({
  28236. selector: "exportPackageDefinitionOf:on:",
  28237. protocol: 'output',
  28238. fn: function (aPackage,aStream){
  28239. var self=this;
  28240. return $core.withContext(function($ctx1) {
  28241. var $1;
  28242. $recv(aStream)._nextPutAll_("$core.addPackage(");
  28243. $ctx1.sendIdx["nextPutAll:"]=1;
  28244. $1=$recv("'".__comma($recv(aPackage)._name())).__comma("');");
  28245. $ctx1.sendIdx[","]=1;
  28246. $recv(aStream)._nextPutAll_($1);
  28247. $recv(aStream)._lf();
  28248. return self;
  28249. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28250. },
  28251. args: ["aPackage", "aStream"],
  28252. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  28253. referencedClasses: [],
  28254. messageSends: ["nextPutAll:", ",", "name", "lf"]
  28255. }),
  28256. $globals.Exporter);
  28257. $core.addMethod(
  28258. $core.method({
  28259. selector: "exportPackageEpilogueOf:on:",
  28260. protocol: 'output',
  28261. fn: function (aPackage,aStream){
  28262. var self=this;
  28263. return $core.withContext(function($ctx1) {
  28264. self._subclassResponsibility();
  28265. return self;
  28266. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28267. },
  28268. args: ["aPackage", "aStream"],
  28269. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  28270. referencedClasses: [],
  28271. messageSends: ["subclassResponsibility"]
  28272. }),
  28273. $globals.Exporter);
  28274. $core.addMethod(
  28275. $core.method({
  28276. selector: "exportPackageImportsOf:on:",
  28277. protocol: 'output',
  28278. fn: function (aPackage,aStream){
  28279. var self=this;
  28280. return $core.withContext(function($ctx1) {
  28281. var $1;
  28282. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  28283. return $core.withContext(function($ctx2) {
  28284. $recv(aStream)._nextPutAll_("$core.packages[");
  28285. $ctx2.sendIdx["nextPutAll:"]=1;
  28286. $1=$recv($recv(aPackage)._name())._asJavascript();
  28287. $ctx2.sendIdx["asJavascript"]=1;
  28288. $recv(aStream)._nextPutAll_($1);
  28289. $ctx2.sendIdx["nextPutAll:"]=2;
  28290. $recv(aStream)._nextPutAll_("].imports = ");
  28291. $ctx2.sendIdx["nextPutAll:"]=3;
  28292. $recv(aStream)._nextPutAll_($recv(imports)._asJavascript());
  28293. $ctx2.sendIdx["nextPutAll:"]=4;
  28294. $recv(aStream)._nextPutAll_(";");
  28295. return $recv(aStream)._lf();
  28296. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  28297. }));
  28298. return self;
  28299. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28300. },
  28301. args: ["aPackage", "aStream"],
  28302. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09\x09nextPutAll: '].imports = ';\x0a\x09\x09\x09nextPutAll: imports asJavascript;\x0a\x09\x09\x09nextPutAll: ';';\x0a\x09\x09\x09lf ]",
  28303. referencedClasses: [],
  28304. messageSends: ["ifNotEmpty:", "importsAsJson", "nextPutAll:", "asJavascript", "name", "lf"]
  28305. }),
  28306. $globals.Exporter);
  28307. $core.addMethod(
  28308. $core.method({
  28309. selector: "exportPackagePrologueOf:on:",
  28310. protocol: 'output',
  28311. fn: function (aPackage,aStream){
  28312. var self=this;
  28313. return $core.withContext(function($ctx1) {
  28314. self._subclassResponsibility();
  28315. return self;
  28316. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28317. },
  28318. args: ["aPackage", "aStream"],
  28319. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  28320. referencedClasses: [],
  28321. messageSends: ["subclassResponsibility"]
  28322. }),
  28323. $globals.Exporter);
  28324. $core.addMethod(
  28325. $core.method({
  28326. selector: "exportPackageTransportOf:on:",
  28327. protocol: 'output',
  28328. fn: function (aPackage,aStream){
  28329. var self=this;
  28330. return $core.withContext(function($ctx1) {
  28331. $recv(aStream)._nextPutAll_("$core.packages[");
  28332. $ctx1.sendIdx["nextPutAll:"]=1;
  28333. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  28334. $ctx1.sendIdx["nextPutAll:"]=2;
  28335. $recv(aStream)._nextPutAll_("].transport = ");
  28336. $ctx1.sendIdx["nextPutAll:"]=3;
  28337. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._transport())._asJSONString());
  28338. $ctx1.sendIdx["nextPutAll:"]=4;
  28339. $recv(aStream)._nextPutAll_(";");
  28340. $recv(aStream)._lf();
  28341. return self;
  28342. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28343. },
  28344. args: ["aPackage", "aStream"],
  28345. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].transport = ';\x0a\x09\x09nextPutAll: aPackage transport asJSONString;\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf",
  28346. referencedClasses: [],
  28347. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"]
  28348. }),
  28349. $globals.Exporter);
  28350. $core.addMethod(
  28351. $core.method({
  28352. selector: "jsClassNameFor:",
  28353. protocol: 'convenience',
  28354. fn: function (aClass){
  28355. var self=this;
  28356. return $core.withContext(function($ctx1) {
  28357. var $1,$receiver;
  28358. $1=$recv(aClass)._isMetaclass();
  28359. if($core.assert($1)){
  28360. return $recv(self._jsClassNameFor_($recv(aClass)._instanceClass())).__comma(".klass");
  28361. $ctx1.sendIdx[","]=1;
  28362. } else {
  28363. if(($receiver = aClass) == null || $receiver.isNil){
  28364. return "null";
  28365. } else {
  28366. return "$globals.".__comma($recv(aClass)._name());
  28367. };
  28368. };
  28369. }, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},$globals.Exporter)});
  28370. },
  28371. args: ["aClass"],
  28372. source: "jsClassNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ (self jsClassNameFor: aClass instanceClass), '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass\x0a\x09\x09\x09\x09ifNil: [ 'null' ]\x0a\x09\x09\x09\x09ifNotNil: [ '$globals.', aClass name ] ]",
  28373. referencedClasses: [],
  28374. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"]
  28375. }),
  28376. $globals.Exporter);
  28377. $core.addMethod(
  28378. $core.method({
  28379. selector: "ownMethodsOfClass:",
  28380. protocol: 'accessing',
  28381. fn: function (aClass){
  28382. var self=this;
  28383. return $core.withContext(function($ctx1) {
  28384. var $1;
  28385. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  28386. return $core.withContext(function($ctx2) {
  28387. $1=$recv(a)._selector();
  28388. $ctx2.sendIdx["selector"]=1;
  28389. return $recv($1).__lt_eq($recv(b)._selector());
  28390. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28391. })))._reject_((function(each){
  28392. return $core.withContext(function($ctx2) {
  28393. return $recv($recv(each)._protocol())._match_("^\x5c*");
  28394. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28395. }));
  28396. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  28397. },
  28398. args: ["aClass"],
  28399. 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*') ]",
  28400. referencedClasses: [],
  28401. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  28402. }),
  28403. $globals.Exporter);
  28404. $core.addMethod(
  28405. $core.method({
  28406. selector: "ownMethodsOfMetaClass:",
  28407. protocol: 'accessing',
  28408. fn: function (aClass){
  28409. var self=this;
  28410. return $core.withContext(function($ctx1) {
  28411. return self._ownMethodsOfClass_($recv(aClass)._class());
  28412. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  28413. },
  28414. args: ["aClass"],
  28415. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  28416. referencedClasses: [],
  28417. messageSends: ["ownMethodsOfClass:", "class"]
  28418. }),
  28419. $globals.Exporter);
  28420. $core.addClass('AmdExporter', $globals.Exporter, ['namespace'], 'Platform-ImportExport');
  28421. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  28422. $core.addMethod(
  28423. $core.method({
  28424. selector: "amdNamesOfPackages:",
  28425. protocol: 'private',
  28426. fn: function (anArray){
  28427. var self=this;
  28428. return $core.withContext(function($ctx1) {
  28429. var $1;
  28430. return $recv($recv(anArray)._select_((function(each){
  28431. return $core.withContext(function($ctx2) {
  28432. $1=self._amdNamespaceOfPackage_(each);
  28433. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  28434. return $recv($1)._notNil();
  28435. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28436. })))._collect_((function(each){
  28437. return $core.withContext(function($ctx2) {
  28438. return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  28439. $ctx2.sendIdx[","]=1;
  28440. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28441. }));
  28442. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  28443. },
  28444. args: ["anArray"],
  28445. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  28446. referencedClasses: [],
  28447. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  28448. }),
  28449. $globals.AmdExporter);
  28450. $core.addMethod(
  28451. $core.method({
  28452. selector: "amdNamespaceOfPackage:",
  28453. protocol: 'private',
  28454. fn: function (aPackage){
  28455. var self=this;
  28456. return $core.withContext(function($ctx1) {
  28457. var $3,$2,$1;
  28458. $3=$recv(aPackage)._transport();
  28459. $ctx1.sendIdx["transport"]=1;
  28460. $2=$recv($3)._type();
  28461. $1=$recv($2).__eq("amd");
  28462. if($core.assert($1)){
  28463. return $recv($recv(aPackage)._transport())._namespace();
  28464. } else {
  28465. return nil;
  28466. };
  28467. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  28468. },
  28469. args: ["aPackage"],
  28470. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  28471. referencedClasses: [],
  28472. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  28473. }),
  28474. $globals.AmdExporter);
  28475. $core.addMethod(
  28476. $core.method({
  28477. selector: "exportPackageEpilogueOf:on:",
  28478. protocol: 'output',
  28479. fn: function (aPackage,aStream){
  28480. var self=this;
  28481. return $core.withContext(function($ctx1) {
  28482. $recv(aStream)._nextPutAll_("});");
  28483. $recv(aStream)._lf();
  28484. return self;
  28485. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  28486. },
  28487. args: ["aPackage", "aStream"],
  28488. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  28489. referencedClasses: [],
  28490. messageSends: ["nextPutAll:", "lf"]
  28491. }),
  28492. $globals.AmdExporter);
  28493. $core.addMethod(
  28494. $core.method({
  28495. selector: "exportPackagePrologueOf:on:",
  28496. protocol: 'output',
  28497. fn: function (aPackage,aStream){
  28498. var self=this;
  28499. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  28500. return $core.withContext(function($ctx1) {
  28501. var $1,$3,$2,$4,$6,$5,$7,$13,$12,$11,$10,$9,$8,$17,$16,$15,$14;
  28502. pragmaStart="";
  28503. pragmaEnd="";
  28504. importsForOutput=self._importsForOutput_(aPackage);
  28505. loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  28506. $1=$recv(importsForOutput)._value();
  28507. $ctx1.sendIdx["value"]=1;
  28508. $recv($1)._ifNotEmpty_((function(){
  28509. return $core.withContext(function($ctx2) {
  28510. $3=$recv($globals.String)._lf();
  28511. $ctx2.sendIdx["lf"]=1;
  28512. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  28513. $ctx2.sendIdx[","]=2;
  28514. $4=$recv($globals.String)._lf();
  28515. $ctx2.sendIdx["lf"]=2;
  28516. pragmaStart=$recv($2).__comma($4);
  28517. $ctx2.sendIdx[","]=1;
  28518. pragmaStart;
  28519. $6=$recv($globals.String)._lf();
  28520. $ctx2.sendIdx["lf"]=3;
  28521. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  28522. $ctx2.sendIdx[","]=4;
  28523. $7=$recv($globals.String)._lf();
  28524. $ctx2.sendIdx["lf"]=4;
  28525. pragmaEnd=$recv($5).__comma($7);
  28526. $ctx2.sendIdx[","]=3;
  28527. return pragmaEnd;
  28528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28529. }));
  28530. $recv(aStream)._nextPutAll_("define(");
  28531. $ctx1.sendIdx["nextPutAll:"]=1;
  28532. $13=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  28533. $ctx1.sendIdx[","]=7;
  28534. $12=$recv($13).__comma([":2:"]);
  28535. $ctx1.sendIdx[","]=6;
  28536. $11=$recv($12).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  28537. $ctx1.sendIdx[","]=5;
  28538. $10=$recv($11)._asJavascript();
  28539. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  28540. $ctx1.sendIdx["replace:with:"]=2;
  28541. $8=$recv($9)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  28542. $ctx1.sendIdx["replace:with:"]=1;
  28543. $recv(aStream)._nextPutAll_($8);
  28544. $ctx1.sendIdx["nextPutAll:"]=2;
  28545. $recv(aStream)._nextPutAll_(", function(");
  28546. $ctx1.sendIdx["nextPutAll:"]=3;
  28547. $17=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  28548. $ctx1.sendIdx[","]=8;
  28549. $16=$recv($17)._join_(",");
  28550. $15=$recv($16)._replace_with_(",\x5cs*:1:",pragmaStart);
  28551. $14=$recv($15)._replace_with_(",\x5cs*:2:",pragmaEnd);
  28552. $ctx1.sendIdx["replace:with:"]=3;
  28553. $recv(aStream)._nextPutAll_($14);
  28554. $ctx1.sendIdx["nextPutAll:"]=4;
  28555. $recv(aStream)._nextPutAll_("){\x22use strict\x22;");
  28556. $recv(aStream)._lf();
  28557. self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  28558. return self;
  28559. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  28560. },
  28561. args: ["aPackage", "aStream"],
  28562. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09| importsForOutput loadDependencies pragmaStart pragmaEnd |\x0a\x09pragmaStart := ''.\x0a\x09pragmaEnd := ''.\x0a\x09importsForOutput := self importsForOutput: aPackage.\x0a\x09loadDependencies := self amdNamesOfPackages: aPackage loadDependencies.\x0a\x09importsForOutput value ifNotEmpty: [\x0a\x09\x09pragmaStart := String lf, '//>>excludeStart(\x22imports\x22, pragmas.excludeImports);', String lf.\x0a\x09\x09pragmaEnd := String lf, '//>>excludeEnd(\x22imports\x22);', String lf ].\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(';\x0a\x09\x09nextPutAll: (((\x0a\x09\x09\x09(#('amber/boot' ':1:'), importsForOutput value, #(':2:'), loadDependencies asArray sorted) asJavascript)\x0a\x09\x09\x09replace: ',\x5cs*[\x22'']:1:[\x22'']' with: pragmaStart) replace: ',\x5cs*[\x22'']:2:[\x22'']' with: pragmaEnd);\x0a\x09\x09nextPutAll: ', function(';\x0a\x09\x09nextPutAll: (((\x0a\x09\x09\x09(#('$boot' ':1:'), importsForOutput key, #(':2:')) join: ',')\x0a\x09\x09\x09replace: ',\x5cs*:1:' with: pragmaStart) replace: ',\x5cs*:2:' with: pragmaEnd);\x0a\x09\x09nextPutAll: '){\x22use strict\x22;';\x0a\x09\x09lf.\x0a\x09self exportPackageBodyBlockPrologueOf: aPackage on: aStream",
  28563. referencedClasses: ["String"],
  28564. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "nextPutAll:", "replace:with:", "asJavascript", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  28565. }),
  28566. $globals.AmdExporter);
  28567. $core.addMethod(
  28568. $core.method({
  28569. selector: "importsForOutput:",
  28570. protocol: 'private',
  28571. fn: function (aPackage){
  28572. var self=this;
  28573. var namedImports,anonImports,importVarNames;
  28574. return $core.withContext(function($ctx1) {
  28575. var $1;
  28576. namedImports=[];
  28577. anonImports=[];
  28578. importVarNames=[];
  28579. $recv($recv(aPackage)._imports())._do_((function(each){
  28580. return $core.withContext(function($ctx2) {
  28581. $1=$recv(each)._isString();
  28582. if($core.assert($1)){
  28583. return $recv(anonImports)._add_(each);
  28584. $ctx2.sendIdx["add:"]=1;
  28585. } else {
  28586. $recv(namedImports)._add_($recv(each)._value());
  28587. $ctx2.sendIdx["add:"]=2;
  28588. return $recv(importVarNames)._add_($recv(each)._key());
  28589. };
  28590. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28591. }));
  28592. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  28593. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  28594. },
  28595. args: ["aPackage"],
  28596. 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)",
  28597. referencedClasses: [],
  28598. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  28599. }),
  28600. $globals.AmdExporter);
  28601. $core.addClass('ChunkParser', $globals.Object, ['stream', 'last'], 'Platform-ImportExport');
  28602. $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";
  28603. $core.addMethod(
  28604. $core.method({
  28605. selector: "last",
  28606. protocol: 'accessing',
  28607. fn: function (){
  28608. var self=this;
  28609. return self["@last"];
  28610. },
  28611. args: [],
  28612. source: "last\x0a\x09^ last",
  28613. referencedClasses: [],
  28614. messageSends: []
  28615. }),
  28616. $globals.ChunkParser);
  28617. $core.addMethod(
  28618. $core.method({
  28619. selector: "nextChunk",
  28620. protocol: 'reading',
  28621. fn: function (){
  28622. var self=this;
  28623. var char,result,chunk;
  28624. return $core.withContext(function($ctx1) {
  28625. var $1,$2,$3,$4;
  28626. var $early={};
  28627. try {
  28628. result=""._writeStream();
  28629. $recv((function(){
  28630. return $core.withContext(function($ctx2) {
  28631. char=$recv(self["@stream"])._next();
  28632. $ctx2.sendIdx["next"]=1;
  28633. char;
  28634. return $recv(char)._notNil();
  28635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28636. }))._whileTrue_((function(){
  28637. return $core.withContext(function($ctx2) {
  28638. $1=$recv(char).__eq("!");
  28639. $ctx2.sendIdx["="]=1;
  28640. if($core.assert($1)){
  28641. $2=$recv($recv(self["@stream"])._peek()).__eq("!");
  28642. if($core.assert($2)){
  28643. $recv(self["@stream"])._next();
  28644. } else {
  28645. self["@last"]=$recv($recv(result)._contents())._trimBoth();
  28646. $3=self["@last"];
  28647. throw $early=[$3];
  28648. };
  28649. };
  28650. return $recv(result)._nextPut_(char);
  28651. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28652. }));
  28653. self["@last"]=nil;
  28654. $4=self["@last"];
  28655. return $4;
  28656. }
  28657. catch(e) {if(e===$early)return e[0]; throw e}
  28658. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  28659. },
  28660. args: [],
  28661. 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",
  28662. referencedClasses: [],
  28663. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  28664. }),
  28665. $globals.ChunkParser);
  28666. $core.addMethod(
  28667. $core.method({
  28668. selector: "stream:",
  28669. protocol: 'accessing',
  28670. fn: function (aStream){
  28671. var self=this;
  28672. self["@stream"]=aStream;
  28673. return self;
  28674. },
  28675. args: ["aStream"],
  28676. source: "stream: aStream\x0a\x09stream := aStream",
  28677. referencedClasses: [],
  28678. messageSends: []
  28679. }),
  28680. $globals.ChunkParser);
  28681. $core.addMethod(
  28682. $core.method({
  28683. selector: "on:",
  28684. protocol: 'instance creation',
  28685. fn: function (aStream){
  28686. var self=this;
  28687. return $core.withContext(function($ctx1) {
  28688. return $recv(self._new())._stream_(aStream);
  28689. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)});
  28690. },
  28691. args: ["aStream"],
  28692. source: "on: aStream\x0a\x09^ self new stream: aStream",
  28693. referencedClasses: [],
  28694. messageSends: ["stream:", "new"]
  28695. }),
  28696. $globals.ChunkParser.klass);
  28697. $core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Platform-ImportExport');
  28698. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  28699. $core.addMethod(
  28700. $core.method({
  28701. selector: "class:",
  28702. protocol: 'accessing',
  28703. fn: function (aClass){
  28704. var self=this;
  28705. self["@class"]=aClass;
  28706. return self;
  28707. },
  28708. args: ["aClass"],
  28709. source: "class: aClass\x0a\x09class := aClass",
  28710. referencedClasses: [],
  28711. messageSends: []
  28712. }),
  28713. $globals.ClassCommentReader);
  28714. $core.addMethod(
  28715. $core.method({
  28716. selector: "initialize",
  28717. protocol: 'initialization',
  28718. fn: function (){
  28719. var self=this;
  28720. return $core.withContext(function($ctx1) {
  28721. (
  28722. $ctx1.supercall = true,
  28723. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  28724. $ctx1.supercall = false;
  28725. return self;
  28726. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  28727. },
  28728. args: [],
  28729. source: "initialize\x0a\x09super initialize.",
  28730. referencedClasses: [],
  28731. messageSends: ["initialize"]
  28732. }),
  28733. $globals.ClassCommentReader);
  28734. $core.addMethod(
  28735. $core.method({
  28736. selector: "scanFrom:",
  28737. protocol: 'fileIn',
  28738. fn: function (aChunkParser){
  28739. var self=this;
  28740. var chunk;
  28741. return $core.withContext(function($ctx1) {
  28742. chunk=$recv(aChunkParser)._nextChunk();
  28743. $recv(chunk)._ifNotEmpty_((function(){
  28744. return $core.withContext(function($ctx2) {
  28745. return self._setComment_(chunk);
  28746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28747. }));
  28748. return self;
  28749. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  28750. },
  28751. args: ["aChunkParser"],
  28752. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  28753. referencedClasses: [],
  28754. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  28755. }),
  28756. $globals.ClassCommentReader);
  28757. $core.addMethod(
  28758. $core.method({
  28759. selector: "setComment:",
  28760. protocol: 'private',
  28761. fn: function (aString){
  28762. var self=this;
  28763. return $core.withContext(function($ctx1) {
  28764. $recv(self["@class"])._comment_(aString);
  28765. return self;
  28766. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  28767. },
  28768. args: ["aString"],
  28769. source: "setComment: aString\x0a\x09class comment: aString",
  28770. referencedClasses: [],
  28771. messageSends: ["comment:"]
  28772. }),
  28773. $globals.ClassCommentReader);
  28774. $core.addClass('ClassProtocolReader', $globals.Object, ['class', 'category'], 'Platform-ImportExport');
  28775. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  28776. $core.addMethod(
  28777. $core.method({
  28778. selector: "class:category:",
  28779. protocol: 'accessing',
  28780. fn: function (aClass,aString){
  28781. var self=this;
  28782. self["@class"]=aClass;
  28783. self["@category"]=aString;
  28784. return self;
  28785. },
  28786. args: ["aClass", "aString"],
  28787. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  28788. referencedClasses: [],
  28789. messageSends: []
  28790. }),
  28791. $globals.ClassProtocolReader);
  28792. $core.addMethod(
  28793. $core.method({
  28794. selector: "compileMethod:",
  28795. protocol: 'private',
  28796. fn: function (aString){
  28797. var self=this;
  28798. return $core.withContext(function($ctx1) {
  28799. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  28800. return self;
  28801. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  28802. },
  28803. args: ["aString"],
  28804. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  28805. referencedClasses: ["Compiler"],
  28806. messageSends: ["install:forClass:protocol:", "new"]
  28807. }),
  28808. $globals.ClassProtocolReader);
  28809. $core.addMethod(
  28810. $core.method({
  28811. selector: "initialize",
  28812. protocol: 'initialization',
  28813. fn: function (){
  28814. var self=this;
  28815. return $core.withContext(function($ctx1) {
  28816. (
  28817. $ctx1.supercall = true,
  28818. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  28819. $ctx1.supercall = false;
  28820. return self;
  28821. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  28822. },
  28823. args: [],
  28824. source: "initialize\x0a\x09super initialize.",
  28825. referencedClasses: [],
  28826. messageSends: ["initialize"]
  28827. }),
  28828. $globals.ClassProtocolReader);
  28829. $core.addMethod(
  28830. $core.method({
  28831. selector: "scanFrom:",
  28832. protocol: 'fileIn',
  28833. fn: function (aChunkParser){
  28834. var self=this;
  28835. var chunk;
  28836. return $core.withContext(function($ctx1) {
  28837. $recv((function(){
  28838. return $core.withContext(function($ctx2) {
  28839. chunk=$recv(aChunkParser)._nextChunk();
  28840. chunk;
  28841. return $recv(chunk)._isEmpty();
  28842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28843. }))._whileFalse_((function(){
  28844. return $core.withContext(function($ctx2) {
  28845. return self._compileMethod_(chunk);
  28846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28847. }));
  28848. return self;
  28849. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  28850. },
  28851. args: ["aChunkParser"],
  28852. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  28853. referencedClasses: [],
  28854. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  28855. }),
  28856. $globals.ClassProtocolReader);
  28857. $core.addClass('ExportMethodProtocol', $globals.Object, ['name', 'theClass'], 'Platform-ImportExport');
  28858. $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.";
  28859. $core.addMethod(
  28860. $core.method({
  28861. selector: "methods",
  28862. protocol: 'accessing',
  28863. fn: function (){
  28864. var self=this;
  28865. return $core.withContext(function($ctx1) {
  28866. var $1;
  28867. return $recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  28868. return $core.withContext(function($ctx2) {
  28869. $1=$recv(a)._selector();
  28870. $ctx2.sendIdx["selector"]=1;
  28871. return $recv($1).__lt_eq($recv(b)._selector());
  28872. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28873. }));
  28874. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  28875. },
  28876. args: [],
  28877. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  28878. referencedClasses: [],
  28879. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  28880. }),
  28881. $globals.ExportMethodProtocol);
  28882. $core.addMethod(
  28883. $core.method({
  28884. selector: "name",
  28885. protocol: 'accessing',
  28886. fn: function (){
  28887. var self=this;
  28888. return self["@name"];
  28889. },
  28890. args: [],
  28891. source: "name\x0a\x09^ name",
  28892. referencedClasses: [],
  28893. messageSends: []
  28894. }),
  28895. $globals.ExportMethodProtocol);
  28896. $core.addMethod(
  28897. $core.method({
  28898. selector: "name:",
  28899. protocol: 'accessing',
  28900. fn: function (aString){
  28901. var self=this;
  28902. self["@name"]=aString;
  28903. return self;
  28904. },
  28905. args: ["aString"],
  28906. source: "name: aString\x0a\x09name := aString",
  28907. referencedClasses: [],
  28908. messageSends: []
  28909. }),
  28910. $globals.ExportMethodProtocol);
  28911. $core.addMethod(
  28912. $core.method({
  28913. selector: "theClass",
  28914. protocol: 'accessing',
  28915. fn: function (){
  28916. var self=this;
  28917. return self["@theClass"];
  28918. },
  28919. args: [],
  28920. source: "theClass\x0a\x09^ theClass",
  28921. referencedClasses: [],
  28922. messageSends: []
  28923. }),
  28924. $globals.ExportMethodProtocol);
  28925. $core.addMethod(
  28926. $core.method({
  28927. selector: "theClass:",
  28928. protocol: 'accessing',
  28929. fn: function (aClass){
  28930. var self=this;
  28931. self["@theClass"]=aClass;
  28932. return self;
  28933. },
  28934. args: ["aClass"],
  28935. source: "theClass: aClass\x0a\x09theClass := aClass",
  28936. referencedClasses: [],
  28937. messageSends: []
  28938. }),
  28939. $globals.ExportMethodProtocol);
  28940. $core.addMethod(
  28941. $core.method({
  28942. selector: "name:theClass:",
  28943. protocol: 'instance creation',
  28944. fn: function (aString,aClass){
  28945. var self=this;
  28946. return $core.withContext(function($ctx1) {
  28947. var $1;
  28948. $1=self._new();
  28949. $recv($1)._name_(aString);
  28950. $recv($1)._theClass_(aClass);
  28951. return $recv($1)._yourself();
  28952. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)});
  28953. },
  28954. args: ["aString", "aClass"],
  28955. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  28956. referencedClasses: [],
  28957. messageSends: ["name:", "new", "theClass:", "yourself"]
  28958. }),
  28959. $globals.ExportMethodProtocol.klass);
  28960. $core.addClass('Importer', $globals.Object, ['lastSection', 'lastChunk'], 'Platform-ImportExport');
  28961. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  28962. $core.addMethod(
  28963. $core.method({
  28964. selector: "import:",
  28965. protocol: 'fileIn',
  28966. fn: function (aStream){
  28967. var self=this;
  28968. var chunk,result,parser,lastEmpty;
  28969. return $core.withContext(function($ctx1) {
  28970. var $1;
  28971. parser=$recv($globals.ChunkParser)._on_(aStream);
  28972. lastEmpty=false;
  28973. self["@lastSection"]="n/a, not started";
  28974. self["@lastChunk"]=nil;
  28975. $recv((function(){
  28976. return $core.withContext(function($ctx2) {
  28977. $recv((function(){
  28978. return $core.withContext(function($ctx3) {
  28979. chunk=$recv(parser)._nextChunk();
  28980. chunk;
  28981. return $recv(chunk)._isNil();
  28982. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28983. }))._whileFalse_((function(){
  28984. return $core.withContext(function($ctx3) {
  28985. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  28986. lastEmpty=true;
  28987. return lastEmpty;
  28988. }),(function(){
  28989. return $core.withContext(function($ctx4) {
  28990. self["@lastSection"]=chunk;
  28991. self["@lastSection"];
  28992. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  28993. result;
  28994. $1=lastEmpty;
  28995. if($core.assert($1)){
  28996. lastEmpty=false;
  28997. lastEmpty;
  28998. return $recv(result)._scanFrom_(parser);
  28999. };
  29000. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  29001. }));
  29002. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  29003. }));
  29004. self["@lastSection"]="n/a, finished";
  29005. return self["@lastSection"];
  29006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  29007. }))._on_do_($globals.Error,(function(e){
  29008. return $core.withContext(function($ctx2) {
  29009. self["@lastChunk"]=$recv(parser)._last();
  29010. self["@lastChunk"];
  29011. return $recv(e)._resignal();
  29012. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  29013. }));
  29014. return self;
  29015. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  29016. },
  29017. args: ["aStream"],
  29018. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk\x0a\x09\x09\x09ifEmpty: [ lastEmpty := true ]\x0a\x09\x09\x09ifNotEmpty: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e resignal ].",
  29019. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  29020. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  29021. }),
  29022. $globals.Importer);
  29023. $core.addMethod(
  29024. $core.method({
  29025. selector: "lastChunk",
  29026. protocol: 'accessing',
  29027. fn: function (){
  29028. var self=this;
  29029. return self["@lastChunk"];
  29030. },
  29031. args: [],
  29032. source: "lastChunk\x0a\x09^ lastChunk",
  29033. referencedClasses: [],
  29034. messageSends: []
  29035. }),
  29036. $globals.Importer);
  29037. $core.addMethod(
  29038. $core.method({
  29039. selector: "lastSection",
  29040. protocol: 'accessing',
  29041. fn: function (){
  29042. var self=this;
  29043. return self["@lastSection"];
  29044. },
  29045. args: [],
  29046. source: "lastSection\x0a\x09^ lastSection",
  29047. referencedClasses: [],
  29048. messageSends: []
  29049. }),
  29050. $globals.Importer);
  29051. $core.addClass('PackageCommitError', $globals.Error, [], 'Platform-ImportExport');
  29052. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  29053. $core.addClass('PackageHandler', $globals.Object, [], 'Platform-ImportExport');
  29054. $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.";
  29055. $core.addMethod(
  29056. $core.method({
  29057. selector: "ajaxPutAt:data:onSuccess:onError:",
  29058. protocol: 'private',
  29059. fn: function (aURL,aString,aBlock,anotherBlock){
  29060. var self=this;
  29061. var xhr;
  29062. return $core.withContext(function($ctx1) {
  29063. var $1,$4,$3,$2;
  29064. xhr=$recv($globals.Platform)._newXhr();
  29065. $recv(xhr)._open_url_async_("PUT",aURL,true);
  29066. $recv(xhr)._onreadystatechange_((function(){
  29067. return $core.withContext(function($ctx2) {
  29068. $1=$recv($recv(xhr)._readyState()).__eq((4));
  29069. if($core.assert($1)){
  29070. $4=$recv(xhr)._status();
  29071. $ctx2.sendIdx["status"]=1;
  29072. $3=$recv($4).__gt_eq((200));
  29073. $2=$recv($3)._and_((function(){
  29074. return $core.withContext(function($ctx3) {
  29075. return $recv($recv(xhr)._status()).__lt((300));
  29076. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  29077. }));
  29078. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  29079. };
  29080. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  29081. }));
  29082. $recv(xhr)._send_(aString);
  29083. return self;
  29084. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  29085. },
  29086. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  29087. 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",
  29088. referencedClasses: ["Platform"],
  29089. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  29090. }),
  29091. $globals.PackageHandler);
  29092. $core.addMethod(
  29093. $core.method({
  29094. selector: "chunkContentsFor:",
  29095. protocol: 'accessing',
  29096. fn: function (aPackage){
  29097. var self=this;
  29098. return $core.withContext(function($ctx1) {
  29099. return $recv($globals.String)._streamContents_((function(str){
  29100. return $core.withContext(function($ctx2) {
  29101. return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str);
  29102. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  29103. }));
  29104. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  29105. },
  29106. args: ["aPackage"],
  29107. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  29108. referencedClasses: ["String"],
  29109. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  29110. }),
  29111. $globals.PackageHandler);
  29112. $core.addMethod(
  29113. $core.method({
  29114. selector: "chunkExporter",
  29115. protocol: 'factory',
  29116. fn: function (){
  29117. var self=this;
  29118. return $core.withContext(function($ctx1) {
  29119. return $recv(self._chunkExporterClass())._new();
  29120. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  29121. },
  29122. args: [],
  29123. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  29124. referencedClasses: [],
  29125. messageSends: ["new", "chunkExporterClass"]
  29126. }),
  29127. $globals.PackageHandler);
  29128. $core.addMethod(
  29129. $core.method({
  29130. selector: "chunkExporterClass",
  29131. protocol: 'accessing',
  29132. fn: function (){
  29133. var self=this;
  29134. return $globals.ChunkExporter;
  29135. },
  29136. args: [],
  29137. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  29138. referencedClasses: ["ChunkExporter"],
  29139. messageSends: []
  29140. }),
  29141. $globals.PackageHandler);
  29142. $core.addMethod(
  29143. $core.method({
  29144. selector: "commit:",
  29145. protocol: 'committing',
  29146. fn: function (aPackage){
  29147. var self=this;
  29148. return $core.withContext(function($ctx1) {
  29149. var $1,$2;
  29150. self._commit_onSuccess_onError_(aPackage,(function(){
  29151. }),(function(error){
  29152. return $core.withContext(function($ctx2) {
  29153. $1=$recv($globals.PackageCommitError)._new();
  29154. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  29155. $ctx2.sendIdx[","]=1;
  29156. $recv($1)._messageText_($2);
  29157. return $recv($1)._signal();
  29158. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  29159. }));
  29160. return self;
  29161. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  29162. },
  29163. args: ["aPackage"],
  29164. 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 ]",
  29165. referencedClasses: ["PackageCommitError"],
  29166. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  29167. }),
  29168. $globals.PackageHandler);
  29169. $core.addMethod(
  29170. $core.method({
  29171. selector: "commit:onSuccess:onError:",
  29172. protocol: 'committing',
  29173. fn: function (aPackage,aBlock,anotherBlock){
  29174. var self=this;
  29175. return $core.withContext(function($ctx1) {
  29176. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  29177. return $core.withContext(function($ctx2) {
  29178. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  29179. return $core.withContext(function($ctx3) {
  29180. $recv(aPackage)._beClean();
  29181. return $recv(aBlock)._value();
  29182. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  29183. }),anotherBlock);
  29184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  29185. }),anotherBlock);
  29186. return self;
  29187. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  29188. },
  29189. args: ["aPackage", "aBlock", "anotherBlock"],
  29190. 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",
  29191. referencedClasses: [],
  29192. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  29193. }),
  29194. $globals.PackageHandler);
  29195. $core.addMethod(
  29196. $core.method({
  29197. selector: "commitJsFileFor:onSuccess:onError:",
  29198. protocol: 'committing',
  29199. fn: function (aPackage,aBlock,anotherBlock){
  29200. var self=this;
  29201. return $core.withContext(function($ctx1) {
  29202. var $2,$1;
  29203. $2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  29204. $ctx1.sendIdx[","]=2;
  29205. $1=$recv($2).__comma(".js");
  29206. $ctx1.sendIdx[","]=1;
  29207. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  29208. return self;
  29209. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  29210. },
  29211. args: ["aPackage", "aBlock", "anotherBlock"],
  29212. 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",
  29213. referencedClasses: [],
  29214. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  29215. }),
  29216. $globals.PackageHandler);
  29217. $core.addMethod(
  29218. $core.method({
  29219. selector: "commitPathJsFor:",
  29220. protocol: 'accessing',
  29221. fn: function (aPackage){
  29222. var self=this;
  29223. return $core.withContext(function($ctx1) {
  29224. self._subclassResponsibility();
  29225. return self;
  29226. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  29227. },
  29228. args: ["aPackage"],
  29229. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  29230. referencedClasses: [],
  29231. messageSends: ["subclassResponsibility"]
  29232. }),
  29233. $globals.PackageHandler);
  29234. $core.addMethod(
  29235. $core.method({
  29236. selector: "commitPathStFor:",
  29237. protocol: 'accessing',
  29238. fn: function (aPackage){
  29239. var self=this;
  29240. return $core.withContext(function($ctx1) {
  29241. self._subclassResponsibility();
  29242. return self;
  29243. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  29244. },
  29245. args: ["aPackage"],
  29246. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  29247. referencedClasses: [],
  29248. messageSends: ["subclassResponsibility"]
  29249. }),
  29250. $globals.PackageHandler);
  29251. $core.addMethod(
  29252. $core.method({
  29253. selector: "commitStFileFor:onSuccess:onError:",
  29254. protocol: 'committing',
  29255. fn: function (aPackage,aBlock,anotherBlock){
  29256. var self=this;
  29257. return $core.withContext(function($ctx1) {
  29258. var $2,$1;
  29259. $2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  29260. $ctx1.sendIdx[","]=2;
  29261. $1=$recv($2).__comma(".st");
  29262. $ctx1.sendIdx[","]=1;
  29263. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  29264. return self;
  29265. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  29266. },
  29267. args: ["aPackage", "aBlock", "anotherBlock"],
  29268. 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",
  29269. referencedClasses: [],
  29270. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  29271. }),
  29272. $globals.PackageHandler);
  29273. $core.addMethod(
  29274. $core.method({
  29275. selector: "contentsFor:",
  29276. protocol: 'accessing',
  29277. fn: function (aPackage){
  29278. var self=this;
  29279. return $core.withContext(function($ctx1) {
  29280. return $recv($globals.String)._streamContents_((function(str){
  29281. return $core.withContext(function($ctx2) {
  29282. return $recv(self._exporter())._exportPackage_on_(aPackage,str);
  29283. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  29284. }));
  29285. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  29286. },
  29287. args: ["aPackage"],
  29288. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  29289. referencedClasses: ["String"],
  29290. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  29291. }),
  29292. $globals.PackageHandler);
  29293. $core.addMethod(
  29294. $core.method({
  29295. selector: "exporter",
  29296. protocol: 'factory',
  29297. fn: function (){
  29298. var self=this;
  29299. return $core.withContext(function($ctx1) {
  29300. return $recv(self._exporterClass())._new();
  29301. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  29302. },
  29303. args: [],
  29304. source: "exporter\x0a\x09^ self exporterClass new",
  29305. referencedClasses: [],
  29306. messageSends: ["new", "exporterClass"]
  29307. }),
  29308. $globals.PackageHandler);
  29309. $core.addMethod(
  29310. $core.method({
  29311. selector: "exporterClass",
  29312. protocol: 'accessing',
  29313. fn: function (){
  29314. var self=this;
  29315. return $core.withContext(function($ctx1) {
  29316. self._subclassResponsibility();
  29317. return self;
  29318. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  29319. },
  29320. args: [],
  29321. source: "exporterClass\x0a\x09self subclassResponsibility",
  29322. referencedClasses: [],
  29323. messageSends: ["subclassResponsibility"]
  29324. }),
  29325. $globals.PackageHandler);
  29326. $core.addMethod(
  29327. $core.method({
  29328. selector: "load:",
  29329. protocol: 'loading',
  29330. fn: function (aPackage){
  29331. var self=this;
  29332. return $core.withContext(function($ctx1) {
  29333. self._subclassResponsibility();
  29334. return self;
  29335. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  29336. },
  29337. args: ["aPackage"],
  29338. source: "load: aPackage\x0a\x09self subclassResponsibility",
  29339. referencedClasses: [],
  29340. messageSends: ["subclassResponsibility"]
  29341. }),
  29342. $globals.PackageHandler);
  29343. $core.addMethod(
  29344. $core.method({
  29345. selector: "onCommitError:",
  29346. protocol: 'error handling',
  29347. fn: function (anError){
  29348. var self=this;
  29349. return $core.withContext(function($ctx1) {
  29350. var $1,$2;
  29351. $1=$recv($globals.PackageCommitError)._new();
  29352. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  29353. $ctx1.sendIdx[","]=1;
  29354. $recv($1)._messageText_($2);
  29355. $recv($1)._signal();
  29356. return self;
  29357. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  29358. },
  29359. args: ["anError"],
  29360. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  29361. referencedClasses: ["PackageCommitError"],
  29362. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  29363. }),
  29364. $globals.PackageHandler);
  29365. $core.addClass('AmdPackageHandler', $globals.PackageHandler, [], 'Platform-ImportExport');
  29366. $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.";
  29367. $core.addMethod(
  29368. $core.method({
  29369. selector: "commitPathJsFor:",
  29370. protocol: 'accessing',
  29371. fn: function (aPackage){
  29372. var self=this;
  29373. return $core.withContext(function($ctx1) {
  29374. return self._toUrl_(self._namespaceFor_(aPackage));
  29375. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29376. },
  29377. args: ["aPackage"],
  29378. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  29379. referencedClasses: [],
  29380. messageSends: ["toUrl:", "namespaceFor:"]
  29381. }),
  29382. $globals.AmdPackageHandler);
  29383. $core.addMethod(
  29384. $core.method({
  29385. selector: "commitPathStFor:",
  29386. protocol: 'accessing',
  29387. fn: function (aPackage){
  29388. var self=this;
  29389. var path,pathWithout;
  29390. return $core.withContext(function($ctx1) {
  29391. var $1,$2;
  29392. $1=$recv(self._namespaceFor_(aPackage)).__comma("/_source");
  29393. $ctx1.sendIdx[","]=1;
  29394. path=self._toUrl_($1);
  29395. pathWithout=self._commitPathJsFor_(aPackage);
  29396. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  29397. if($core.assert($2)){
  29398. return pathWithout;
  29399. } else {
  29400. return path;
  29401. };
  29402. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  29403. },
  29404. args: ["aPackage"],
  29405. 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 ]",
  29406. referencedClasses: [],
  29407. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  29408. }),
  29409. $globals.AmdPackageHandler);
  29410. $core.addMethod(
  29411. $core.method({
  29412. selector: "exporterClass",
  29413. protocol: 'accessing',
  29414. fn: function (){
  29415. var self=this;
  29416. return $globals.AmdExporter;
  29417. },
  29418. args: [],
  29419. source: "exporterClass\x0a\x09^ AmdExporter",
  29420. referencedClasses: ["AmdExporter"],
  29421. messageSends: []
  29422. }),
  29423. $globals.AmdPackageHandler);
  29424. $core.addMethod(
  29425. $core.method({
  29426. selector: "load:",
  29427. protocol: 'loading',
  29428. fn: function (aPackage){
  29429. var self=this;
  29430. return $core.withContext(function($ctx1) {
  29431. var $1,$3,$2,$receiver;
  29432. $1=$recv($globals.Smalltalk)._amdRequire();
  29433. if(($receiver = $1) == null || $receiver.isNil){
  29434. self._error_("AMD loader not present");
  29435. } else {
  29436. var require;
  29437. require=$receiver;
  29438. $3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  29439. $ctx1.sendIdx[","]=1;
  29440. $2=$recv($globals.Array)._with_($3);
  29441. $recv(require)._value_($2);
  29442. };
  29443. return self;
  29444. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29445. },
  29446. args: ["aPackage"],
  29447. source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array with: (self namespaceFor: aPackage), '/', aPackage name ) ]",
  29448. referencedClasses: ["Smalltalk", "Array"],
  29449. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  29450. }),
  29451. $globals.AmdPackageHandler);
  29452. $core.addMethod(
  29453. $core.method({
  29454. selector: "namespaceFor:",
  29455. protocol: 'committing',
  29456. fn: function (aPackage){
  29457. var self=this;
  29458. return $core.withContext(function($ctx1) {
  29459. return $recv($recv(aPackage)._transport())._namespace();
  29460. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29461. },
  29462. args: ["aPackage"],
  29463. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  29464. referencedClasses: [],
  29465. messageSends: ["namespace", "transport"]
  29466. }),
  29467. $globals.AmdPackageHandler);
  29468. $core.addMethod(
  29469. $core.method({
  29470. selector: "toUrl:",
  29471. protocol: 'private',
  29472. fn: function (aString){
  29473. var self=this;
  29474. return $core.withContext(function($ctx1) {
  29475. var $1,$receiver;
  29476. $1=$recv($globals.Smalltalk)._amdRequire();
  29477. if(($receiver = $1) == null || $receiver.isNil){
  29478. return self._error_("AMD loader not present");
  29479. } else {
  29480. var require;
  29481. require=$receiver;
  29482. return $recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  29483. };
  29484. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  29485. },
  29486. args: ["aString"],
  29487. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
  29488. referencedClasses: ["Smalltalk"],
  29489. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  29490. }),
  29491. $globals.AmdPackageHandler);
  29492. $core.addMethod(
  29493. $core.method({
  29494. selector: "defaultNamespace",
  29495. protocol: 'commit paths',
  29496. fn: function (){
  29497. var self=this;
  29498. return $core.withContext(function($ctx1) {
  29499. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  29500. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)});
  29501. },
  29502. args: [],
  29503. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29504. referencedClasses: ["Smalltalk"],
  29505. messageSends: ["defaultAmdNamespace"]
  29506. }),
  29507. $globals.AmdPackageHandler.klass);
  29508. $core.addMethod(
  29509. $core.method({
  29510. selector: "defaultNamespace:",
  29511. protocol: 'commit paths',
  29512. fn: function (aString){
  29513. var self=this;
  29514. return $core.withContext(function($ctx1) {
  29515. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  29516. return self;
  29517. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)});
  29518. },
  29519. args: ["aString"],
  29520. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  29521. referencedClasses: ["Smalltalk"],
  29522. messageSends: ["defaultAmdNamespace:"]
  29523. }),
  29524. $globals.AmdPackageHandler.klass);
  29525. $core.addClass('PackageTransport', $globals.Object, ['package'], 'Platform-ImportExport');
  29526. $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.";
  29527. $core.addMethod(
  29528. $core.method({
  29529. selector: "asJSON",
  29530. protocol: 'converting',
  29531. fn: function (){
  29532. var self=this;
  29533. return $core.withContext(function($ctx1) {
  29534. return $globals.HashedCollection._newFromPairs_(["type",self._type()]);
  29535. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.PackageTransport)});
  29536. },
  29537. args: [],
  29538. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  29539. referencedClasses: [],
  29540. messageSends: ["type"]
  29541. }),
  29542. $globals.PackageTransport);
  29543. $core.addMethod(
  29544. $core.method({
  29545. selector: "commit",
  29546. protocol: 'committing',
  29547. fn: function (){
  29548. var self=this;
  29549. return $core.withContext(function($ctx1) {
  29550. $recv(self._commitHandler())._commit_(self._package());
  29551. return self;
  29552. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  29553. },
  29554. args: [],
  29555. source: "commit\x0a\x09self commitHandler commit: self package",
  29556. referencedClasses: [],
  29557. messageSends: ["commit:", "commitHandler", "package"]
  29558. }),
  29559. $globals.PackageTransport);
  29560. $core.addMethod(
  29561. $core.method({
  29562. selector: "commitHandler",
  29563. protocol: 'factory',
  29564. fn: function (){
  29565. var self=this;
  29566. return $core.withContext(function($ctx1) {
  29567. return $recv(self._commitHandlerClass())._new();
  29568. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  29569. },
  29570. args: [],
  29571. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  29572. referencedClasses: [],
  29573. messageSends: ["new", "commitHandlerClass"]
  29574. }),
  29575. $globals.PackageTransport);
  29576. $core.addMethod(
  29577. $core.method({
  29578. selector: "commitHandlerClass",
  29579. protocol: 'accessing',
  29580. fn: function (){
  29581. var self=this;
  29582. return $core.withContext(function($ctx1) {
  29583. self._subclassResponsibility();
  29584. return self;
  29585. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  29586. },
  29587. args: [],
  29588. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  29589. referencedClasses: [],
  29590. messageSends: ["subclassResponsibility"]
  29591. }),
  29592. $globals.PackageTransport);
  29593. $core.addMethod(
  29594. $core.method({
  29595. selector: "commitOnSuccess:onError:",
  29596. protocol: 'committing',
  29597. fn: function (aBlock,anotherBlock){
  29598. var self=this;
  29599. return $core.withContext(function($ctx1) {
  29600. $recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  29601. return self;
  29602. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  29603. },
  29604. args: ["aBlock", "anotherBlock"],
  29605. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  29606. referencedClasses: [],
  29607. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  29608. }),
  29609. $globals.PackageTransport);
  29610. $core.addMethod(
  29611. $core.method({
  29612. selector: "definition",
  29613. protocol: 'accessing',
  29614. fn: function (){
  29615. var self=this;
  29616. return "";
  29617. },
  29618. args: [],
  29619. source: "definition\x0a\x09^ ''",
  29620. referencedClasses: [],
  29621. messageSends: []
  29622. }),
  29623. $globals.PackageTransport);
  29624. $core.addMethod(
  29625. $core.method({
  29626. selector: "load",
  29627. protocol: 'loading',
  29628. fn: function (){
  29629. var self=this;
  29630. return $core.withContext(function($ctx1) {
  29631. $recv(self._commitHandler())._load_(self._package());
  29632. return self;
  29633. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  29634. },
  29635. args: [],
  29636. source: "load\x0a\x09self commitHandler load: self package",
  29637. referencedClasses: [],
  29638. messageSends: ["load:", "commitHandler", "package"]
  29639. }),
  29640. $globals.PackageTransport);
  29641. $core.addMethod(
  29642. $core.method({
  29643. selector: "package",
  29644. protocol: 'accessing',
  29645. fn: function (){
  29646. var self=this;
  29647. return self["@package"];
  29648. },
  29649. args: [],
  29650. source: "package\x0a\x09^ package",
  29651. referencedClasses: [],
  29652. messageSends: []
  29653. }),
  29654. $globals.PackageTransport);
  29655. $core.addMethod(
  29656. $core.method({
  29657. selector: "package:",
  29658. protocol: 'accessing',
  29659. fn: function (aPackage){
  29660. var self=this;
  29661. self["@package"]=aPackage;
  29662. return self;
  29663. },
  29664. args: ["aPackage"],
  29665. source: "package: aPackage\x0a\x09package := aPackage",
  29666. referencedClasses: [],
  29667. messageSends: []
  29668. }),
  29669. $globals.PackageTransport);
  29670. $core.addMethod(
  29671. $core.method({
  29672. selector: "setupFromJson:",
  29673. protocol: 'initialization',
  29674. fn: function (anObject){
  29675. var self=this;
  29676. return self;
  29677. },
  29678. args: ["anObject"],
  29679. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  29680. referencedClasses: [],
  29681. messageSends: []
  29682. }),
  29683. $globals.PackageTransport);
  29684. $core.addMethod(
  29685. $core.method({
  29686. selector: "type",
  29687. protocol: 'accessing',
  29688. fn: function (){
  29689. var self=this;
  29690. return $core.withContext(function($ctx1) {
  29691. return $recv(self._class())._type();
  29692. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  29693. },
  29694. args: [],
  29695. source: "type\x0a\x09^ self class type",
  29696. referencedClasses: [],
  29697. messageSends: ["type", "class"]
  29698. }),
  29699. $globals.PackageTransport);
  29700. $globals.PackageTransport.klass.iVarNames = ['registry'];
  29701. $core.addMethod(
  29702. $core.method({
  29703. selector: "classRegisteredFor:",
  29704. protocol: 'accessing',
  29705. fn: function (aString){
  29706. var self=this;
  29707. return $core.withContext(function($ctx1) {
  29708. return $recv(self["@registry"])._at_(aString);
  29709. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)});
  29710. },
  29711. args: ["aString"],
  29712. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  29713. referencedClasses: [],
  29714. messageSends: ["at:"]
  29715. }),
  29716. $globals.PackageTransport.klass);
  29717. $core.addMethod(
  29718. $core.method({
  29719. selector: "defaultType",
  29720. protocol: 'accessing',
  29721. fn: function (){
  29722. var self=this;
  29723. return $core.withContext(function($ctx1) {
  29724. return $recv($globals.AmdPackageTransport)._type();
  29725. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)});
  29726. },
  29727. args: [],
  29728. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  29729. referencedClasses: ["AmdPackageTransport"],
  29730. messageSends: ["type"]
  29731. }),
  29732. $globals.PackageTransport.klass);
  29733. $core.addMethod(
  29734. $core.method({
  29735. selector: "for:",
  29736. protocol: 'instance creation',
  29737. fn: function (aString){
  29738. var self=this;
  29739. return $core.withContext(function($ctx1) {
  29740. return $recv(self._classRegisteredFor_(aString))._new();
  29741. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)});
  29742. },
  29743. args: ["aString"],
  29744. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  29745. referencedClasses: [],
  29746. messageSends: ["new", "classRegisteredFor:"]
  29747. }),
  29748. $globals.PackageTransport.klass);
  29749. $core.addMethod(
  29750. $core.method({
  29751. selector: "fromJson:",
  29752. protocol: 'instance creation',
  29753. fn: function (anObject){
  29754. var self=this;
  29755. return $core.withContext(function($ctx1) {
  29756. var $1,$2,$receiver;
  29757. if(($receiver = anObject) == null || $receiver.isNil){
  29758. $1=self._for_(self._defaultType());
  29759. $ctx1.sendIdx["for:"]=1;
  29760. return $1;
  29761. } else {
  29762. anObject;
  29763. };
  29764. $2=self._for_($recv(anObject)._type());
  29765. $recv($2)._setupFromJson_(anObject);
  29766. return $recv($2)._yourself();
  29767. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)});
  29768. },
  29769. args: ["anObject"],
  29770. 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",
  29771. referencedClasses: [],
  29772. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  29773. }),
  29774. $globals.PackageTransport.klass);
  29775. $core.addMethod(
  29776. $core.method({
  29777. selector: "initialize",
  29778. protocol: 'initialization',
  29779. fn: function (){
  29780. var self=this;
  29781. return $core.withContext(function($ctx1) {
  29782. var $1;
  29783. (
  29784. $ctx1.supercall = true,
  29785. ($globals.PackageTransport.klass.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  29786. $ctx1.supercall = false;
  29787. $1=self.__eq_eq($globals.PackageTransport);
  29788. if($core.assert($1)){
  29789. self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  29790. self["@registry"];
  29791. } else {
  29792. self._register();
  29793. };
  29794. return self;
  29795. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)});
  29796. },
  29797. args: [],
  29798. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  29799. referencedClasses: ["PackageTransport"],
  29800. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  29801. }),
  29802. $globals.PackageTransport.klass);
  29803. $core.addMethod(
  29804. $core.method({
  29805. selector: "register",
  29806. protocol: 'registration',
  29807. fn: function (){
  29808. var self=this;
  29809. return $core.withContext(function($ctx1) {
  29810. $recv($globals.PackageTransport)._register_(self);
  29811. return self;
  29812. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)});
  29813. },
  29814. args: [],
  29815. source: "register\x0a\x09PackageTransport register: self",
  29816. referencedClasses: ["PackageTransport"],
  29817. messageSends: ["register:"]
  29818. }),
  29819. $globals.PackageTransport.klass);
  29820. $core.addMethod(
  29821. $core.method({
  29822. selector: "register:",
  29823. protocol: 'registration',
  29824. fn: function (aClass){
  29825. var self=this;
  29826. return $core.withContext(function($ctx1) {
  29827. var $1,$receiver;
  29828. $1=$recv(aClass)._type();
  29829. $ctx1.sendIdx["type"]=1;
  29830. if(($receiver = $1) == null || $receiver.isNil){
  29831. $1;
  29832. } else {
  29833. $recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  29834. };
  29835. return self;
  29836. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)});
  29837. },
  29838. args: ["aClass"],
  29839. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  29840. referencedClasses: [],
  29841. messageSends: ["ifNotNil:", "type", "at:put:"]
  29842. }),
  29843. $globals.PackageTransport.klass);
  29844. $core.addMethod(
  29845. $core.method({
  29846. selector: "type",
  29847. protocol: 'accessing',
  29848. fn: function (){
  29849. var self=this;
  29850. return nil;
  29851. },
  29852. args: [],
  29853. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  29854. referencedClasses: [],
  29855. messageSends: []
  29856. }),
  29857. $globals.PackageTransport.klass);
  29858. $core.addClass('AmdPackageTransport', $globals.PackageTransport, ['namespace'], 'Platform-ImportExport');
  29859. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  29860. $core.addMethod(
  29861. $core.method({
  29862. selector: "asJSON",
  29863. protocol: 'converting',
  29864. fn: function (){
  29865. var self=this;
  29866. return $core.withContext(function($ctx1) {
  29867. var $1;
  29868. $1=(
  29869. $ctx1.supercall = true,
  29870. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJSON.apply($recv(self), []));
  29871. $ctx1.supercall = false;
  29872. $recv($1)._at_put_("amdNamespace",self._namespace());
  29873. return $recv($1)._yourself();
  29874. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.AmdPackageTransport)});
  29875. },
  29876. args: [],
  29877. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  29878. referencedClasses: [],
  29879. messageSends: ["at:put:", "asJSON", "namespace", "yourself"]
  29880. }),
  29881. $globals.AmdPackageTransport);
  29882. $core.addMethod(
  29883. $core.method({
  29884. selector: "commitHandlerClass",
  29885. protocol: 'accessing',
  29886. fn: function (){
  29887. var self=this;
  29888. return $globals.AmdPackageHandler;
  29889. },
  29890. args: [],
  29891. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  29892. referencedClasses: ["AmdPackageHandler"],
  29893. messageSends: []
  29894. }),
  29895. $globals.AmdPackageTransport);
  29896. $core.addMethod(
  29897. $core.method({
  29898. selector: "defaultNamespace",
  29899. protocol: 'defaults',
  29900. fn: function (){
  29901. var self=this;
  29902. return $core.withContext(function($ctx1) {
  29903. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  29904. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  29905. },
  29906. args: [],
  29907. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29908. referencedClasses: ["Smalltalk"],
  29909. messageSends: ["defaultAmdNamespace"]
  29910. }),
  29911. $globals.AmdPackageTransport);
  29912. $core.addMethod(
  29913. $core.method({
  29914. selector: "definition",
  29915. protocol: 'accessing',
  29916. fn: function (){
  29917. var self=this;
  29918. return $core.withContext(function($ctx1) {
  29919. var $1;
  29920. return $recv($globals.String)._streamContents_((function(stream){
  29921. return $core.withContext(function($ctx2) {
  29922. $recv(stream)._nextPutAll_($recv(self._class())._name());
  29923. $ctx2.sendIdx["nextPutAll:"]=1;
  29924. $recv(stream)._nextPutAll_(" namespace: ");
  29925. $ctx2.sendIdx["nextPutAll:"]=2;
  29926. $1=$recv("'".__comma(self._namespace())).__comma("'");
  29927. $ctx2.sendIdx[","]=1;
  29928. return $recv(stream)._nextPutAll_($1);
  29929. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  29930. }));
  29931. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  29932. },
  29933. args: [],
  29934. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: ' namespace: ';\x0a\x09\x09\x09nextPutAll: '''', self namespace, '''' ]",
  29935. referencedClasses: ["String"],
  29936. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"]
  29937. }),
  29938. $globals.AmdPackageTransport);
  29939. $core.addMethod(
  29940. $core.method({
  29941. selector: "namespace",
  29942. protocol: 'accessing',
  29943. fn: function (){
  29944. var self=this;
  29945. return $core.withContext(function($ctx1) {
  29946. var $1,$receiver;
  29947. $1=self["@namespace"];
  29948. if(($receiver = $1) == null || $receiver.isNil){
  29949. return self._defaultNamespace();
  29950. } else {
  29951. return $1;
  29952. };
  29953. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  29954. },
  29955. args: [],
  29956. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  29957. referencedClasses: [],
  29958. messageSends: ["ifNil:", "defaultNamespace"]
  29959. }),
  29960. $globals.AmdPackageTransport);
  29961. $core.addMethod(
  29962. $core.method({
  29963. selector: "namespace:",
  29964. protocol: 'accessing',
  29965. fn: function (aString){
  29966. var self=this;
  29967. self["@namespace"]=aString;
  29968. return self;
  29969. },
  29970. args: ["aString"],
  29971. source: "namespace: aString\x0a\x09namespace := aString",
  29972. referencedClasses: [],
  29973. messageSends: []
  29974. }),
  29975. $globals.AmdPackageTransport);
  29976. $core.addMethod(
  29977. $core.method({
  29978. selector: "printOn:",
  29979. protocol: 'printing',
  29980. fn: function (aStream){
  29981. var self=this;
  29982. return $core.withContext(function($ctx1) {
  29983. (
  29984. $ctx1.supercall = true,
  29985. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  29986. $ctx1.supercall = false;
  29987. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  29988. $ctx1.sendIdx["nextPutAll:"]=1;
  29989. $recv(aStream)._nextPutAll_(self._namespace());
  29990. $ctx1.sendIdx["nextPutAll:"]=2;
  29991. $recv(aStream)._nextPutAll_(")");
  29992. return self;
  29993. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  29994. },
  29995. args: ["aStream"],
  29996. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  29997. referencedClasses: [],
  29998. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  29999. }),
  30000. $globals.AmdPackageTransport);
  30001. $core.addMethod(
  30002. $core.method({
  30003. selector: "setPath:",
  30004. protocol: 'actions',
  30005. fn: function (aString){
  30006. var self=this;
  30007. return $core.withContext(function($ctx1) {
  30008. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  30009. return self;
  30010. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  30011. },
  30012. args: ["aString"],
  30013. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09(require basicAt: 'config') value: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  30014. referencedClasses: [],
  30015. messageSends: ["value:", "basicAt:", "namespace"]
  30016. }),
  30017. $globals.AmdPackageTransport);
  30018. $core.addMethod(
  30019. $core.method({
  30020. selector: "setupFromJson:",
  30021. protocol: 'initialization',
  30022. fn: function (anObject){
  30023. var self=this;
  30024. return $core.withContext(function($ctx1) {
  30025. self._namespace_($recv(anObject)._at_("amdNamespace"));
  30026. return self;
  30027. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  30028. },
  30029. args: ["anObject"],
  30030. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  30031. referencedClasses: [],
  30032. messageSends: ["namespace:", "at:"]
  30033. }),
  30034. $globals.AmdPackageTransport);
  30035. $core.addMethod(
  30036. $core.method({
  30037. selector: "namespace:",
  30038. protocol: 'instance creation',
  30039. fn: function (aString){
  30040. var self=this;
  30041. return $core.withContext(function($ctx1) {
  30042. var $1;
  30043. $1=self._new();
  30044. $recv($1)._namespace_(aString);
  30045. return $recv($1)._yourself();
  30046. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)});
  30047. },
  30048. args: ["aString"],
  30049. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  30050. referencedClasses: [],
  30051. messageSends: ["namespace:", "new", "yourself"]
  30052. }),
  30053. $globals.AmdPackageTransport.klass);
  30054. $core.addMethod(
  30055. $core.method({
  30056. selector: "type",
  30057. protocol: 'accessing',
  30058. fn: function (){
  30059. var self=this;
  30060. return "amd";
  30061. },
  30062. args: [],
  30063. source: "type\x0a\x09^ 'amd'",
  30064. referencedClasses: [],
  30065. messageSends: []
  30066. }),
  30067. $globals.AmdPackageTransport.klass);
  30068. $core.addMethod(
  30069. $core.method({
  30070. selector: "commentStamp",
  30071. protocol: '*Platform-ImportExport',
  30072. fn: function (){
  30073. var self=this;
  30074. return $core.withContext(function($ctx1) {
  30075. var $1;
  30076. $1=$recv($globals.ClassCommentReader)._new();
  30077. $recv($1)._class_(self);
  30078. return $recv($1)._yourself();
  30079. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)});
  30080. },
  30081. args: [],
  30082. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  30083. referencedClasses: ["ClassCommentReader"],
  30084. messageSends: ["class:", "new", "yourself"]
  30085. }),
  30086. $globals.Behavior);
  30087. $core.addMethod(
  30088. $core.method({
  30089. selector: "commentStamp:prior:",
  30090. protocol: '*Platform-ImportExport',
  30091. fn: function (aStamp,prior){
  30092. var self=this;
  30093. return $core.withContext(function($ctx1) {
  30094. return self._commentStamp();
  30095. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)});
  30096. },
  30097. args: ["aStamp", "prior"],
  30098. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  30099. referencedClasses: [],
  30100. messageSends: ["commentStamp"]
  30101. }),
  30102. $globals.Behavior);
  30103. $core.addMethod(
  30104. $core.method({
  30105. selector: "methodsFor:",
  30106. protocol: '*Platform-ImportExport',
  30107. fn: function (aString){
  30108. var self=this;
  30109. return $core.withContext(function($ctx1) {
  30110. var $1;
  30111. $1=$recv($globals.ClassProtocolReader)._new();
  30112. $recv($1)._class_category_(self,aString);
  30113. return $recv($1)._yourself();
  30114. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)});
  30115. },
  30116. args: ["aString"],
  30117. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  30118. referencedClasses: ["ClassProtocolReader"],
  30119. messageSends: ["class:category:", "new", "yourself"]
  30120. }),
  30121. $globals.Behavior);
  30122. $core.addMethod(
  30123. $core.method({
  30124. selector: "methodsFor:stamp:",
  30125. protocol: '*Platform-ImportExport',
  30126. fn: function (aString,aStamp){
  30127. var self=this;
  30128. return $core.withContext(function($ctx1) {
  30129. return self._methodsFor_(aString);
  30130. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)});
  30131. },
  30132. args: ["aString", "aStamp"],
  30133. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  30134. referencedClasses: [],
  30135. messageSends: ["methodsFor:"]
  30136. }),
  30137. $globals.Behavior);
  30138. $core.addMethod(
  30139. $core.method({
  30140. selector: "commit",
  30141. protocol: '*Platform-ImportExport',
  30142. fn: function (){
  30143. var self=this;
  30144. return $core.withContext(function($ctx1) {
  30145. return $recv(self._transport())._commit();
  30146. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  30147. },
  30148. args: [],
  30149. source: "commit\x0a\x09^ self transport commit",
  30150. referencedClasses: [],
  30151. messageSends: ["commit", "transport"]
  30152. }),
  30153. $globals.Package);
  30154. $core.addMethod(
  30155. $core.method({
  30156. selector: "load",
  30157. protocol: '*Platform-ImportExport',
  30158. fn: function (){
  30159. var self=this;
  30160. return $core.withContext(function($ctx1) {
  30161. return $recv(self._transport())._load();
  30162. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  30163. },
  30164. args: [],
  30165. source: "load\x0a\x09^ self transport load",
  30166. referencedClasses: [],
  30167. messageSends: ["load", "transport"]
  30168. }),
  30169. $globals.Package);
  30170. $core.addMethod(
  30171. $core.method({
  30172. selector: "loadFromNamespace:",
  30173. protocol: '*Platform-ImportExport',
  30174. fn: function (aString){
  30175. var self=this;
  30176. return $core.withContext(function($ctx1) {
  30177. var $1;
  30178. $1=self._transport();
  30179. $recv($1)._namespace_(aString);
  30180. return $recv($1)._load();
  30181. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  30182. },
  30183. args: ["aString"],
  30184. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  30185. referencedClasses: [],
  30186. messageSends: ["namespace:", "transport", "load"]
  30187. }),
  30188. $globals.Package);
  30189. $core.addMethod(
  30190. $core.method({
  30191. selector: "load:",
  30192. protocol: '*Platform-ImportExport',
  30193. fn: function (aPackageName){
  30194. var self=this;
  30195. return $core.withContext(function($ctx1) {
  30196. $recv(self._named_(aPackageName))._load();
  30197. return self;
  30198. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)});
  30199. },
  30200. args: ["aPackageName"],
  30201. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  30202. referencedClasses: [],
  30203. messageSends: ["load", "named:"]
  30204. }),
  30205. $globals.Package.klass);
  30206. $core.addMethod(
  30207. $core.method({
  30208. selector: "load:fromNamespace:",
  30209. protocol: '*Platform-ImportExport',
  30210. fn: function (aPackageName,aString){
  30211. var self=this;
  30212. return $core.withContext(function($ctx1) {
  30213. $recv(self._named_(aPackageName))._loadFromNamespace_(aString);
  30214. return self;
  30215. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)});
  30216. },
  30217. args: ["aPackageName", "aString"],
  30218. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  30219. referencedClasses: [],
  30220. messageSends: ["loadFromNamespace:", "named:"]
  30221. }),
  30222. $globals.Package.klass);
  30223. });
  30224. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  30225. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  30226. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30227. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  30228. $core.addPackage('Compiler-Core');
  30229. $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  30230. $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30231. $core.addClass('AbstractCodeGenerator', $globals.Object, ['currentClass', 'currentPackage', 'source'], 'Compiler-Core');
  30232. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  30233. $core.addMethod(
  30234. $core.method({
  30235. selector: "compileNode:",
  30236. protocol: 'compiling',
  30237. fn: function (aNode){
  30238. var self=this;
  30239. return $core.withContext(function($ctx1) {
  30240. self._subclassResponsibility();
  30241. return self;
  30242. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  30243. },
  30244. args: ["aNode"],
  30245. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  30246. referencedClasses: [],
  30247. messageSends: ["subclassResponsibility"]
  30248. }),
  30249. $globals.AbstractCodeGenerator);
  30250. $core.addMethod(
  30251. $core.method({
  30252. selector: "currentClass",
  30253. protocol: 'accessing',
  30254. fn: function (){
  30255. var self=this;
  30256. return self["@currentClass"];
  30257. },
  30258. args: [],
  30259. source: "currentClass\x0a\x09^ currentClass",
  30260. referencedClasses: [],
  30261. messageSends: []
  30262. }),
  30263. $globals.AbstractCodeGenerator);
  30264. $core.addMethod(
  30265. $core.method({
  30266. selector: "currentClass:",
  30267. protocol: 'accessing',
  30268. fn: function (aClass){
  30269. var self=this;
  30270. self["@currentClass"]=aClass;
  30271. return self;
  30272. },
  30273. args: ["aClass"],
  30274. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30275. referencedClasses: [],
  30276. messageSends: []
  30277. }),
  30278. $globals.AbstractCodeGenerator);
  30279. $core.addMethod(
  30280. $core.method({
  30281. selector: "currentPackage",
  30282. protocol: 'accessing',
  30283. fn: function (){
  30284. var self=this;
  30285. return self["@currentPackage"];
  30286. },
  30287. args: [],
  30288. source: "currentPackage\x0a\x09^ currentPackage",
  30289. referencedClasses: [],
  30290. messageSends: []
  30291. }),
  30292. $globals.AbstractCodeGenerator);
  30293. $core.addMethod(
  30294. $core.method({
  30295. selector: "currentPackage:",
  30296. protocol: 'accessing',
  30297. fn: function (anObject){
  30298. var self=this;
  30299. self["@currentPackage"]=anObject;
  30300. return self;
  30301. },
  30302. args: ["anObject"],
  30303. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30304. referencedClasses: [],
  30305. messageSends: []
  30306. }),
  30307. $globals.AbstractCodeGenerator);
  30308. $core.addMethod(
  30309. $core.method({
  30310. selector: "pseudoVariables",
  30311. protocol: 'accessing',
  30312. fn: function (){
  30313. var self=this;
  30314. return $core.withContext(function($ctx1) {
  30315. return $recv($globals.Smalltalk)._pseudoVariableNames();
  30316. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  30317. },
  30318. args: [],
  30319. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  30320. referencedClasses: ["Smalltalk"],
  30321. messageSends: ["pseudoVariableNames"]
  30322. }),
  30323. $globals.AbstractCodeGenerator);
  30324. $core.addMethod(
  30325. $core.method({
  30326. selector: "source",
  30327. protocol: 'accessing',
  30328. fn: function (){
  30329. var self=this;
  30330. return $core.withContext(function($ctx1) {
  30331. var $1,$receiver;
  30332. $1=self["@source"];
  30333. if(($receiver = $1) == null || $receiver.isNil){
  30334. return "";
  30335. } else {
  30336. return $1;
  30337. };
  30338. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  30339. },
  30340. args: [],
  30341. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30342. referencedClasses: [],
  30343. messageSends: ["ifNil:"]
  30344. }),
  30345. $globals.AbstractCodeGenerator);
  30346. $core.addMethod(
  30347. $core.method({
  30348. selector: "source:",
  30349. protocol: 'accessing',
  30350. fn: function (aString){
  30351. var self=this;
  30352. self["@source"]=aString;
  30353. return self;
  30354. },
  30355. args: ["aString"],
  30356. source: "source: aString\x0a\x09source := aString",
  30357. referencedClasses: [],
  30358. messageSends: []
  30359. }),
  30360. $globals.AbstractCodeGenerator);
  30361. $core.addClass('CodeGenerator', $globals.AbstractCodeGenerator, [], 'Compiler-Core');
  30362. $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.";
  30363. $core.addMethod(
  30364. $core.method({
  30365. selector: "compileNode:",
  30366. protocol: 'compiling',
  30367. fn: function (aNode){
  30368. var self=this;
  30369. var ir,stream;
  30370. return $core.withContext(function($ctx1) {
  30371. var $1;
  30372. $recv(self._semanticAnalyzer())._visit_(aNode);
  30373. $ctx1.sendIdx["visit:"]=1;
  30374. ir=$recv(self._translator())._visit_(aNode);
  30375. $ctx1.sendIdx["visit:"]=2;
  30376. $1=self._irTranslator();
  30377. $recv($1)._currentClass_(self._currentClass());
  30378. $recv($1)._visit_(ir);
  30379. return $recv($1)._contents();
  30380. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.CodeGenerator)});
  30381. },
  30382. args: ["aNode"],
  30383. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  30384. referencedClasses: [],
  30385. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"]
  30386. }),
  30387. $globals.CodeGenerator);
  30388. $core.addMethod(
  30389. $core.method({
  30390. selector: "irTranslator",
  30391. protocol: 'compiling',
  30392. fn: function (){
  30393. var self=this;
  30394. return $core.withContext(function($ctx1) {
  30395. return $recv($globals.IRJSTranslator)._new();
  30396. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  30397. },
  30398. args: [],
  30399. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  30400. referencedClasses: ["IRJSTranslator"],
  30401. messageSends: ["new"]
  30402. }),
  30403. $globals.CodeGenerator);
  30404. $core.addMethod(
  30405. $core.method({
  30406. selector: "semanticAnalyzer",
  30407. protocol: 'compiling',
  30408. fn: function (){
  30409. var self=this;
  30410. return $core.withContext(function($ctx1) {
  30411. var $1;
  30412. $1=$recv(self._semanticAnalyzerClass())._on_(self._currentClass());
  30413. $recv($1)._thePackage_(self._currentPackage());
  30414. return $recv($1)._yourself();
  30415. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  30416. },
  30417. args: [],
  30418. source: "semanticAnalyzer\x0a\x09^ (self semanticAnalyzerClass on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  30419. referencedClasses: [],
  30420. messageSends: ["thePackage:", "on:", "semanticAnalyzerClass", "currentClass", "currentPackage", "yourself"]
  30421. }),
  30422. $globals.CodeGenerator);
  30423. $core.addMethod(
  30424. $core.method({
  30425. selector: "semanticAnalyzerClass",
  30426. protocol: 'compiling',
  30427. fn: function (){
  30428. var self=this;
  30429. return $globals.SemanticAnalyzer;
  30430. },
  30431. args: [],
  30432. source: "semanticAnalyzerClass\x0a\x09^ SemanticAnalyzer",
  30433. referencedClasses: ["SemanticAnalyzer"],
  30434. messageSends: []
  30435. }),
  30436. $globals.CodeGenerator);
  30437. $core.addMethod(
  30438. $core.method({
  30439. selector: "translator",
  30440. protocol: 'compiling',
  30441. fn: function (){
  30442. var self=this;
  30443. return $core.withContext(function($ctx1) {
  30444. var $1;
  30445. $1=$recv($globals.IRASTTranslator)._new();
  30446. $recv($1)._source_(self._source());
  30447. $recv($1)._theClass_(self._currentClass());
  30448. return $recv($1)._yourself();
  30449. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  30450. },
  30451. args: [],
  30452. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  30453. referencedClasses: ["IRASTTranslator"],
  30454. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  30455. }),
  30456. $globals.CodeGenerator);
  30457. $core.addClass('Compiler', $globals.Object, ['currentClass', 'currentPackage', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  30458. $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`";
  30459. $core.addMethod(
  30460. $core.method({
  30461. selector: "codeGeneratorClass",
  30462. protocol: 'accessing',
  30463. fn: function (){
  30464. var self=this;
  30465. return $core.withContext(function($ctx1) {
  30466. var $1,$receiver;
  30467. $1=self["@codeGeneratorClass"];
  30468. if(($receiver = $1) == null || $receiver.isNil){
  30469. return $globals.InliningCodeGenerator;
  30470. } else {
  30471. return $1;
  30472. };
  30473. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  30474. },
  30475. args: [],
  30476. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  30477. referencedClasses: ["InliningCodeGenerator"],
  30478. messageSends: ["ifNil:"]
  30479. }),
  30480. $globals.Compiler);
  30481. $core.addMethod(
  30482. $core.method({
  30483. selector: "codeGeneratorClass:",
  30484. protocol: 'accessing',
  30485. fn: function (aClass){
  30486. var self=this;
  30487. self["@codeGeneratorClass"]=aClass;
  30488. return self;
  30489. },
  30490. args: ["aClass"],
  30491. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  30492. referencedClasses: [],
  30493. messageSends: []
  30494. }),
  30495. $globals.Compiler);
  30496. $core.addMethod(
  30497. $core.method({
  30498. selector: "compile:forClass:protocol:",
  30499. protocol: 'compiling',
  30500. fn: function (aString,aClass,anotherString){
  30501. var self=this;
  30502. return $core.withContext(function($ctx1) {
  30503. self._source_(aString);
  30504. return self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  30505. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  30506. },
  30507. args: ["aString", "aClass", "anotherString"],
  30508. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09compileNode: (self parse: aString)\x0a\x09\x09forClass: aClass\x0a\x09\x09package: (aClass packageOfProtocol: anotherString)",
  30509. referencedClasses: [],
  30510. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  30511. }),
  30512. $globals.Compiler);
  30513. $core.addMethod(
  30514. $core.method({
  30515. selector: "compileExpression:on:",
  30516. protocol: 'compiling',
  30517. fn: function (aString,anObject){
  30518. var self=this;
  30519. return $core.withContext(function($ctx1) {
  30520. var $1;
  30521. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  30522. $ctx1.sendIdx[","]=1;
  30523. return self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  30524. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  30525. },
  30526. args: ["aString", "anObject"],
  30527. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  30528. referencedClasses: [],
  30529. messageSends: ["compile:forClass:protocol:", ",", "class"]
  30530. }),
  30531. $globals.Compiler);
  30532. $core.addMethod(
  30533. $core.method({
  30534. selector: "compileNode:",
  30535. protocol: 'compiling',
  30536. fn: function (aNode){
  30537. var self=this;
  30538. var generator,result;
  30539. return $core.withContext(function($ctx1) {
  30540. var $1;
  30541. generator=$recv(self._codeGeneratorClass())._new();
  30542. $1=generator;
  30543. $recv($1)._source_(self._source());
  30544. $recv($1)._currentClass_(self._currentClass());
  30545. $recv($1)._currentPackage_(self._currentPackage());
  30546. result=$recv(generator)._compileNode_(aNode);
  30547. self._unknownVariables_([]);
  30548. return result;
  30549. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  30550. },
  30551. args: ["aNode"],
  30552. source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09currentPackage: self currentPackage.\x0a\x09result := generator compileNode: aNode.\x0a\x09self unknownVariables: #().\x0a\x09^ result",
  30553. referencedClasses: [],
  30554. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"]
  30555. }),
  30556. $globals.Compiler);
  30557. $core.addMethod(
  30558. $core.method({
  30559. selector: "compileNode:forClass:package:",
  30560. protocol: 'compiling',
  30561. fn: function (aNode,aClass,aPackage){
  30562. var self=this;
  30563. return $core.withContext(function($ctx1) {
  30564. self._currentClass_(aClass);
  30565. self._currentPackage_(aPackage);
  30566. return self._compileNode_(aNode);
  30567. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  30568. },
  30569. args: ["aNode", "aClass", "aPackage"],
  30570. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  30571. referencedClasses: [],
  30572. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  30573. }),
  30574. $globals.Compiler);
  30575. $core.addMethod(
  30576. $core.method({
  30577. selector: "currentClass",
  30578. protocol: 'accessing',
  30579. fn: function (){
  30580. var self=this;
  30581. return self["@currentClass"];
  30582. },
  30583. args: [],
  30584. source: "currentClass\x0a\x09^ currentClass",
  30585. referencedClasses: [],
  30586. messageSends: []
  30587. }),
  30588. $globals.Compiler);
  30589. $core.addMethod(
  30590. $core.method({
  30591. selector: "currentClass:",
  30592. protocol: 'accessing',
  30593. fn: function (aClass){
  30594. var self=this;
  30595. self["@currentClass"]=aClass;
  30596. return self;
  30597. },
  30598. args: ["aClass"],
  30599. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30600. referencedClasses: [],
  30601. messageSends: []
  30602. }),
  30603. $globals.Compiler);
  30604. $core.addMethod(
  30605. $core.method({
  30606. selector: "currentPackage",
  30607. protocol: 'accessing',
  30608. fn: function (){
  30609. var self=this;
  30610. return self["@currentPackage"];
  30611. },
  30612. args: [],
  30613. source: "currentPackage\x0a\x09^ currentPackage",
  30614. referencedClasses: [],
  30615. messageSends: []
  30616. }),
  30617. $globals.Compiler);
  30618. $core.addMethod(
  30619. $core.method({
  30620. selector: "currentPackage:",
  30621. protocol: 'accessing',
  30622. fn: function (anObject){
  30623. var self=this;
  30624. self["@currentPackage"]=anObject;
  30625. return self;
  30626. },
  30627. args: ["anObject"],
  30628. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30629. referencedClasses: [],
  30630. messageSends: []
  30631. }),
  30632. $globals.Compiler);
  30633. $core.addMethod(
  30634. $core.method({
  30635. selector: "eval:",
  30636. protocol: 'compiling',
  30637. fn: function (aString){
  30638. var self=this;
  30639. return $core.withContext(function($ctx1) {
  30640. return eval(aString);
  30641. return self;
  30642. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  30643. },
  30644. args: ["aString"],
  30645. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  30646. referencedClasses: [],
  30647. messageSends: []
  30648. }),
  30649. $globals.Compiler);
  30650. $core.addMethod(
  30651. $core.method({
  30652. selector: "eval:forPackage:",
  30653. protocol: 'compiling',
  30654. fn: function (aString,aPackage){
  30655. var self=this;
  30656. return $core.withContext(function($ctx1) {
  30657. return aPackage && aPackage.innerEval
  30658. ? aPackage.innerEval(aString)
  30659. : eval(aString);
  30660. return self;
  30661. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  30662. },
  30663. args: ["aString", "aPackage"],
  30664. source: "eval: aString forPackage: aPackage\x0a\x09<inlineJS: 'return aPackage && aPackage.innerEval\x0a\x09\x09? aPackage.innerEval(aString)\x0a\x09\x09: eval(aString)'>",
  30665. referencedClasses: [],
  30666. messageSends: []
  30667. }),
  30668. $globals.Compiler);
  30669. $core.addMethod(
  30670. $core.method({
  30671. selector: "evaluateExpression:",
  30672. protocol: 'compiling',
  30673. fn: function (aString){
  30674. var self=this;
  30675. return $core.withContext(function($ctx1) {
  30676. return self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  30677. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  30678. },
  30679. args: ["aString"],
  30680. 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",
  30681. referencedClasses: ["DoIt"],
  30682. messageSends: ["evaluateExpression:on:", "new"]
  30683. }),
  30684. $globals.Compiler);
  30685. $core.addMethod(
  30686. $core.method({
  30687. selector: "evaluateExpression:on:",
  30688. protocol: 'compiling',
  30689. fn: function (aString,anObject){
  30690. var self=this;
  30691. var result,method;
  30692. return $core.withContext(function($ctx1) {
  30693. var $1;
  30694. method=self._eval_(self._compileExpression_on_(aString,anObject));
  30695. $recv(method)._protocol_("**xxxDoIt");
  30696. $1=$recv(anObject)._class();
  30697. $ctx1.sendIdx["class"]=1;
  30698. $recv($1)._addCompiledMethod_(method);
  30699. result=$recv(anObject)._xxxDoIt();
  30700. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  30701. return result;
  30702. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  30703. },
  30704. args: ["aString", "anObject"],
  30705. 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",
  30706. referencedClasses: [],
  30707. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  30708. }),
  30709. $globals.Compiler);
  30710. $core.addMethod(
  30711. $core.method({
  30712. selector: "install:forClass:protocol:",
  30713. protocol: 'compiling',
  30714. fn: function (aString,aBehavior,anotherString){
  30715. var self=this;
  30716. var compiledMethod;
  30717. return $core.withContext(function($ctx1) {
  30718. compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  30719. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  30720. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  30721. },
  30722. args: ["aString", "aBehavior", "anotherString"],
  30723. 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",
  30724. referencedClasses: ["ClassBuilder"],
  30725. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  30726. }),
  30727. $globals.Compiler);
  30728. $core.addMethod(
  30729. $core.method({
  30730. selector: "parse:",
  30731. protocol: 'compiling',
  30732. fn: function (aString){
  30733. var self=this;
  30734. return $core.withContext(function($ctx1) {
  30735. return $recv($globals.Smalltalk)._parse_(aString);
  30736. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  30737. },
  30738. args: ["aString"],
  30739. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  30740. referencedClasses: ["Smalltalk"],
  30741. messageSends: ["parse:"]
  30742. }),
  30743. $globals.Compiler);
  30744. $core.addMethod(
  30745. $core.method({
  30746. selector: "parseExpression:",
  30747. protocol: 'compiling',
  30748. fn: function (aString){
  30749. var self=this;
  30750. return $core.withContext(function($ctx1) {
  30751. var $1;
  30752. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  30753. $ctx1.sendIdx[","]=1;
  30754. return self._parse_($1);
  30755. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  30756. },
  30757. args: ["aString"],
  30758. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  30759. referencedClasses: [],
  30760. messageSends: ["parse:", ","]
  30761. }),
  30762. $globals.Compiler);
  30763. $core.addMethod(
  30764. $core.method({
  30765. selector: "recompile:",
  30766. protocol: 'compiling',
  30767. fn: function (aClass){
  30768. var self=this;
  30769. return $core.withContext(function($ctx1) {
  30770. var $1;
  30771. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  30772. return $core.withContext(function($ctx2) {
  30773. return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  30774. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30775. }),"Recompiling ".__comma($recv(aClass)._name()));
  30776. $1=$recv(aClass)._isMetaclass();
  30777. if(!$core.assert($1)){
  30778. self._recompile_($recv(aClass)._class());
  30779. };
  30780. return self;
  30781. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  30782. },
  30783. args: ["aClass"],
  30784. source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | \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 isMetaclass ifFalse: [ self recompile: aClass class ]",
  30785. referencedClasses: [],
  30786. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"]
  30787. }),
  30788. $globals.Compiler);
  30789. $core.addMethod(
  30790. $core.method({
  30791. selector: "recompileAll",
  30792. protocol: 'compiling',
  30793. fn: function (){
  30794. var self=this;
  30795. return $core.withContext(function($ctx1) {
  30796. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  30797. return $core.withContext(function($ctx2) {
  30798. return self._recompile_(each);
  30799. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30800. }),"Compiling all classes...");
  30801. return self;
  30802. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  30803. },
  30804. args: [],
  30805. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  30806. referencedClasses: ["Smalltalk"],
  30807. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  30808. }),
  30809. $globals.Compiler);
  30810. $core.addMethod(
  30811. $core.method({
  30812. selector: "source",
  30813. protocol: 'accessing',
  30814. fn: function (){
  30815. var self=this;
  30816. return $core.withContext(function($ctx1) {
  30817. var $1,$receiver;
  30818. $1=self["@source"];
  30819. if(($receiver = $1) == null || $receiver.isNil){
  30820. return "";
  30821. } else {
  30822. return $1;
  30823. };
  30824. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  30825. },
  30826. args: [],
  30827. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30828. referencedClasses: [],
  30829. messageSends: ["ifNil:"]
  30830. }),
  30831. $globals.Compiler);
  30832. $core.addMethod(
  30833. $core.method({
  30834. selector: "source:",
  30835. protocol: 'accessing',
  30836. fn: function (aString){
  30837. var self=this;
  30838. self["@source"]=aString;
  30839. return self;
  30840. },
  30841. args: ["aString"],
  30842. source: "source: aString\x0a\x09source := aString",
  30843. referencedClasses: [],
  30844. messageSends: []
  30845. }),
  30846. $globals.Compiler);
  30847. $core.addMethod(
  30848. $core.method({
  30849. selector: "unknownVariables",
  30850. protocol: 'accessing',
  30851. fn: function (){
  30852. var self=this;
  30853. return self["@unknownVariables"];
  30854. },
  30855. args: [],
  30856. source: "unknownVariables\x0a\x09^ unknownVariables",
  30857. referencedClasses: [],
  30858. messageSends: []
  30859. }),
  30860. $globals.Compiler);
  30861. $core.addMethod(
  30862. $core.method({
  30863. selector: "unknownVariables:",
  30864. protocol: 'accessing',
  30865. fn: function (aCollection){
  30866. var self=this;
  30867. self["@unknownVariables"]=aCollection;
  30868. return self;
  30869. },
  30870. args: ["aCollection"],
  30871. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  30872. referencedClasses: [],
  30873. messageSends: []
  30874. }),
  30875. $globals.Compiler);
  30876. $core.addMethod(
  30877. $core.method({
  30878. selector: "recompile:",
  30879. protocol: 'compiling',
  30880. fn: function (aClass){
  30881. var self=this;
  30882. return $core.withContext(function($ctx1) {
  30883. $recv(self._new())._recompile_(aClass);
  30884. return self;
  30885. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)});
  30886. },
  30887. args: ["aClass"],
  30888. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  30889. referencedClasses: [],
  30890. messageSends: ["recompile:", "new"]
  30891. }),
  30892. $globals.Compiler.klass);
  30893. $core.addMethod(
  30894. $core.method({
  30895. selector: "recompileAll",
  30896. protocol: 'compiling',
  30897. fn: function (){
  30898. var self=this;
  30899. return $core.withContext(function($ctx1) {
  30900. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  30901. return $core.withContext(function($ctx2) {
  30902. return self._recompile_(each);
  30903. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30904. }));
  30905. return self;
  30906. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)});
  30907. },
  30908. args: [],
  30909. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  30910. referencedClasses: ["Smalltalk"],
  30911. messageSends: ["do:", "classes", "recompile:"]
  30912. }),
  30913. $globals.Compiler.klass);
  30914. $core.addClass('CompilerError', $globals.Error, [], 'Compiler-Core');
  30915. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  30916. $core.addClass('DoIt', $globals.Object, [], 'Compiler-Core');
  30917. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  30918. $core.addClass('Evaluator', $globals.Object, [], 'Compiler-Core');
  30919. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  30920. $core.addMethod(
  30921. $core.method({
  30922. selector: "evaluate:context:",
  30923. protocol: 'evaluating',
  30924. fn: function (aString,aContext){
  30925. var self=this;
  30926. var compiler,ast;
  30927. return $core.withContext(function($ctx1) {
  30928. var $1;
  30929. var $early={};
  30930. try {
  30931. compiler=$recv($globals.Compiler)._new();
  30932. $recv((function(){
  30933. return $core.withContext(function($ctx2) {
  30934. ast=$recv(compiler)._parseExpression_(aString);
  30935. return ast;
  30936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30937. }))._on_do_($globals.Error,(function(ex){
  30938. return $core.withContext(function($ctx2) {
  30939. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  30940. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30941. }));
  30942. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  30943. $recv($1)._context_(aContext);
  30944. $recv($1)._visit_(ast);
  30945. return $recv(aContext)._evaluateNode_(ast);
  30946. }
  30947. catch(e) {if(e===$early)return e[0]; throw e}
  30948. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  30949. },
  30950. args: ["aString", "aContext"],
  30951. 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",
  30952. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  30953. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  30954. }),
  30955. $globals.Evaluator);
  30956. $core.addMethod(
  30957. $core.method({
  30958. selector: "evaluate:for:",
  30959. protocol: 'evaluating',
  30960. fn: function (aString,anObject){
  30961. var self=this;
  30962. return $core.withContext(function($ctx1) {
  30963. return $recv(anObject)._evaluate_on_(aString,self);
  30964. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  30965. },
  30966. args: ["aString", "anObject"],
  30967. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  30968. referencedClasses: [],
  30969. messageSends: ["evaluate:on:"]
  30970. }),
  30971. $globals.Evaluator);
  30972. $core.addMethod(
  30973. $core.method({
  30974. selector: "evaluate:receiver:",
  30975. protocol: 'evaluating',
  30976. fn: function (aString,anObject){
  30977. var self=this;
  30978. var compiler;
  30979. return $core.withContext(function($ctx1) {
  30980. var $early={};
  30981. try {
  30982. compiler=$recv($globals.Compiler)._new();
  30983. $recv((function(){
  30984. return $core.withContext(function($ctx2) {
  30985. return $recv(compiler)._parseExpression_(aString);
  30986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30987. }))._on_do_($globals.Error,(function(ex){
  30988. return $core.withContext(function($ctx2) {
  30989. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  30990. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30991. }));
  30992. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  30993. }
  30994. catch(e) {if(e===$early)return e[0]; throw e}
  30995. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  30996. },
  30997. args: ["aString", "anObject"],
  30998. 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",
  30999. referencedClasses: ["Compiler", "Error", "Terminal"],
  31000. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  31001. }),
  31002. $globals.Evaluator);
  31003. $core.addMethod(
  31004. $core.method({
  31005. selector: "evaluate:for:",
  31006. protocol: 'instance creation',
  31007. fn: function (aString,anObject){
  31008. var self=this;
  31009. return $core.withContext(function($ctx1) {
  31010. return $recv(self._new())._evaluate_for_(aString,anObject);
  31011. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)});
  31012. },
  31013. args: ["aString", "anObject"],
  31014. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  31015. referencedClasses: [],
  31016. messageSends: ["evaluate:for:", "new"]
  31017. }),
  31018. $globals.Evaluator.klass);
  31019. $core.addMethod(
  31020. $core.method({
  31021. selector: "asVariableName",
  31022. protocol: '*Compiler-Core',
  31023. fn: function (){
  31024. var self=this;
  31025. return $core.withContext(function($ctx1) {
  31026. var $1;
  31027. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  31028. if($core.assert($1)){
  31029. return self.__comma("_");
  31030. } else {
  31031. return self;
  31032. };
  31033. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  31034. },
  31035. args: [],
  31036. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  31037. referencedClasses: ["Smalltalk"],
  31038. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  31039. }),
  31040. $globals.String);
  31041. });
  31042. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Methods"], function($boot){"use strict";
  31043. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  31044. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  31045. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  31046. $core.addPackage('Compiler-AST');
  31047. $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  31048. $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  31049. $core.addClass('ASTNode', $globals.DagParentNode, ['parent', 'position', 'source', 'shouldBeAliased'], 'Compiler-AST');
  31050. $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.";
  31051. $core.addMethod(
  31052. $core.method({
  31053. selector: "inPosition:",
  31054. protocol: 'testing',
  31055. fn: function (aPoint){
  31056. var self=this;
  31057. return $core.withContext(function($ctx1) {
  31058. return $recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  31059. return $core.withContext(function($ctx2) {
  31060. return $recv(self._positionEnd()).__gt_eq(aPoint);
  31061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31062. }));
  31063. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  31064. },
  31065. args: ["aPoint"],
  31066. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  31067. referencedClasses: [],
  31068. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  31069. }),
  31070. $globals.ASTNode);
  31071. $core.addMethod(
  31072. $core.method({
  31073. selector: "isAssignmentNode",
  31074. protocol: 'testing',
  31075. fn: function (){
  31076. var self=this;
  31077. return false;
  31078. },
  31079. args: [],
  31080. source: "isAssignmentNode\x0a\x09^ false",
  31081. referencedClasses: [],
  31082. messageSends: []
  31083. }),
  31084. $globals.ASTNode);
  31085. $core.addMethod(
  31086. $core.method({
  31087. selector: "isBlockNode",
  31088. protocol: 'testing',
  31089. fn: function (){
  31090. var self=this;
  31091. return false;
  31092. },
  31093. args: [],
  31094. source: "isBlockNode\x0a\x09^ false",
  31095. referencedClasses: [],
  31096. messageSends: []
  31097. }),
  31098. $globals.ASTNode);
  31099. $core.addMethod(
  31100. $core.method({
  31101. selector: "isBlockSequenceNode",
  31102. protocol: 'testing',
  31103. fn: function (){
  31104. var self=this;
  31105. return false;
  31106. },
  31107. args: [],
  31108. source: "isBlockSequenceNode\x0a\x09^ false",
  31109. referencedClasses: [],
  31110. messageSends: []
  31111. }),
  31112. $globals.ASTNode);
  31113. $core.addMethod(
  31114. $core.method({
  31115. selector: "isCascadeNode",
  31116. protocol: 'testing',
  31117. fn: function (){
  31118. var self=this;
  31119. return false;
  31120. },
  31121. args: [],
  31122. source: "isCascadeNode\x0a\x09^ false",
  31123. referencedClasses: [],
  31124. messageSends: []
  31125. }),
  31126. $globals.ASTNode);
  31127. $core.addMethod(
  31128. $core.method({
  31129. selector: "isImmutable",
  31130. protocol: 'testing',
  31131. fn: function (){
  31132. var self=this;
  31133. return false;
  31134. },
  31135. args: [],
  31136. source: "isImmutable\x0a\x09^ false",
  31137. referencedClasses: [],
  31138. messageSends: []
  31139. }),
  31140. $globals.ASTNode);
  31141. $core.addMethod(
  31142. $core.method({
  31143. selector: "isJSStatementNode",
  31144. protocol: 'testing',
  31145. fn: function (){
  31146. var self=this;
  31147. return false;
  31148. },
  31149. args: [],
  31150. source: "isJSStatementNode\x0a\x09^ false",
  31151. referencedClasses: [],
  31152. messageSends: []
  31153. }),
  31154. $globals.ASTNode);
  31155. $core.addMethod(
  31156. $core.method({
  31157. selector: "isNavigationNode",
  31158. protocol: 'testing',
  31159. fn: function (){
  31160. var self=this;
  31161. return false;
  31162. },
  31163. args: [],
  31164. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  31165. referencedClasses: [],
  31166. messageSends: []
  31167. }),
  31168. $globals.ASTNode);
  31169. $core.addMethod(
  31170. $core.method({
  31171. selector: "isReturnNode",
  31172. protocol: 'testing',
  31173. fn: function (){
  31174. var self=this;
  31175. return false;
  31176. },
  31177. args: [],
  31178. source: "isReturnNode\x0a\x09^ false",
  31179. referencedClasses: [],
  31180. messageSends: []
  31181. }),
  31182. $globals.ASTNode);
  31183. $core.addMethod(
  31184. $core.method({
  31185. selector: "isSendNode",
  31186. protocol: 'testing',
  31187. fn: function (){
  31188. var self=this;
  31189. return false;
  31190. },
  31191. args: [],
  31192. source: "isSendNode\x0a\x09^ false",
  31193. referencedClasses: [],
  31194. messageSends: []
  31195. }),
  31196. $globals.ASTNode);
  31197. $core.addMethod(
  31198. $core.method({
  31199. selector: "isSequenceNode",
  31200. protocol: 'testing',
  31201. fn: function (){
  31202. var self=this;
  31203. return false;
  31204. },
  31205. args: [],
  31206. source: "isSequenceNode\x0a\x09^ false",
  31207. referencedClasses: [],
  31208. messageSends: []
  31209. }),
  31210. $globals.ASTNode);
  31211. $core.addMethod(
  31212. $core.method({
  31213. selector: "isSuperKeyword",
  31214. protocol: 'testing',
  31215. fn: function (){
  31216. var self=this;
  31217. return false;
  31218. },
  31219. args: [],
  31220. source: "isSuperKeyword\x0a\x09^ false",
  31221. referencedClasses: [],
  31222. messageSends: []
  31223. }),
  31224. $globals.ASTNode);
  31225. $core.addMethod(
  31226. $core.method({
  31227. selector: "isValueNode",
  31228. protocol: 'testing',
  31229. fn: function (){
  31230. var self=this;
  31231. return false;
  31232. },
  31233. args: [],
  31234. source: "isValueNode\x0a\x09^ false",
  31235. referencedClasses: [],
  31236. messageSends: []
  31237. }),
  31238. $globals.ASTNode);
  31239. $core.addMethod(
  31240. $core.method({
  31241. selector: "isVariableNode",
  31242. protocol: 'testing',
  31243. fn: function (){
  31244. var self=this;
  31245. return false;
  31246. },
  31247. args: [],
  31248. source: "isVariableNode\x0a\x09^ false",
  31249. referencedClasses: [],
  31250. messageSends: []
  31251. }),
  31252. $globals.ASTNode);
  31253. $core.addMethod(
  31254. $core.method({
  31255. selector: "location:",
  31256. protocol: 'accessing',
  31257. fn: function (aLocation){
  31258. var self=this;
  31259. return $core.withContext(function($ctx1) {
  31260. var $3,$2,$1;
  31261. $3=$recv(aLocation)._start();
  31262. $ctx1.sendIdx["start"]=1;
  31263. $2=$recv($3)._line();
  31264. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  31265. self._position_($1);
  31266. return self;
  31267. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  31268. },
  31269. args: ["aLocation"],
  31270. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  31271. referencedClasses: [],
  31272. messageSends: ["position:", "@", "line", "start", "column"]
  31273. }),
  31274. $globals.ASTNode);
  31275. $core.addMethod(
  31276. $core.method({
  31277. selector: "method",
  31278. protocol: 'accessing',
  31279. fn: function (){
  31280. var self=this;
  31281. return $core.withContext(function($ctx1) {
  31282. var $1,$receiver;
  31283. $1=self._parent();
  31284. if(($receiver = $1) == null || $receiver.isNil){
  31285. return $1;
  31286. } else {
  31287. var node;
  31288. node=$receiver;
  31289. return $recv(node)._method();
  31290. };
  31291. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  31292. },
  31293. args: [],
  31294. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  31295. referencedClasses: [],
  31296. messageSends: ["ifNotNil:", "parent", "method"]
  31297. }),
  31298. $globals.ASTNode);
  31299. $core.addMethod(
  31300. $core.method({
  31301. selector: "navigationNodeAt:ifAbsent:",
  31302. protocol: 'accessing',
  31303. fn: function (aPoint,aBlock){
  31304. var self=this;
  31305. var children;
  31306. return $core.withContext(function($ctx1) {
  31307. var $2,$1;
  31308. var $early={};
  31309. try {
  31310. children=$recv(self._allDagChildren())._select_((function(each){
  31311. return $core.withContext(function($ctx2) {
  31312. return $recv($recv(each)._isNavigationNode())._and_((function(){
  31313. return $core.withContext(function($ctx3) {
  31314. return $recv(each)._inPosition_(aPoint);
  31315. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31316. }));
  31317. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31318. }));
  31319. $recv(children)._ifEmpty_((function(){
  31320. return $core.withContext(function($ctx2) {
  31321. throw $early=[$recv(aBlock)._value()];
  31322. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  31323. }));
  31324. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  31325. return $core.withContext(function($ctx2) {
  31326. $2=$recv(a)._positionStart();
  31327. $ctx2.sendIdx["positionStart"]=1;
  31328. $1=$recv($2)._dist_(aPoint);
  31329. $ctx2.sendIdx["dist:"]=1;
  31330. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  31331. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  31332. })))._first();
  31333. }
  31334. catch(e) {if(e===$early)return e[0]; throw e}
  31335. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  31336. },
  31337. args: ["aPoint", "aBlock"],
  31338. 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",
  31339. referencedClasses: [],
  31340. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  31341. }),
  31342. $globals.ASTNode);
  31343. $core.addMethod(
  31344. $core.method({
  31345. selector: "parent",
  31346. protocol: 'accessing',
  31347. fn: function (){
  31348. var self=this;
  31349. return self["@parent"];
  31350. },
  31351. args: [],
  31352. source: "parent\x0a\x09^ parent",
  31353. referencedClasses: [],
  31354. messageSends: []
  31355. }),
  31356. $globals.ASTNode);
  31357. $core.addMethod(
  31358. $core.method({
  31359. selector: "parent:",
  31360. protocol: 'accessing',
  31361. fn: function (aNode){
  31362. var self=this;
  31363. self["@parent"]=aNode;
  31364. return self;
  31365. },
  31366. args: ["aNode"],
  31367. source: "parent: aNode\x0a\x09parent := aNode",
  31368. referencedClasses: [],
  31369. messageSends: []
  31370. }),
  31371. $globals.ASTNode);
  31372. $core.addMethod(
  31373. $core.method({
  31374. selector: "position",
  31375. protocol: 'accessing',
  31376. fn: function (){
  31377. var self=this;
  31378. return $core.withContext(function($ctx1) {
  31379. var $1,$2,$receiver;
  31380. $1=self["@position"];
  31381. if(($receiver = $1) == null || $receiver.isNil){
  31382. $2=self._parent();
  31383. if(($receiver = $2) == null || $receiver.isNil){
  31384. return $2;
  31385. } else {
  31386. var node;
  31387. node=$receiver;
  31388. return $recv(node)._position();
  31389. };
  31390. } else {
  31391. return $1;
  31392. };
  31393. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  31394. },
  31395. args: [],
  31396. 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 ] ]",
  31397. referencedClasses: [],
  31398. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  31399. }),
  31400. $globals.ASTNode);
  31401. $core.addMethod(
  31402. $core.method({
  31403. selector: "position:",
  31404. protocol: 'accessing',
  31405. fn: function (aPosition){
  31406. var self=this;
  31407. self["@position"]=aPosition;
  31408. return self;
  31409. },
  31410. args: ["aPosition"],
  31411. source: "position: aPosition\x0a\x09position := aPosition",
  31412. referencedClasses: [],
  31413. messageSends: []
  31414. }),
  31415. $globals.ASTNode);
  31416. $core.addMethod(
  31417. $core.method({
  31418. selector: "positionEnd",
  31419. protocol: 'accessing',
  31420. fn: function (){
  31421. var self=this;
  31422. return $core.withContext(function($ctx1) {
  31423. var $1,$6,$5,$4,$3,$2;
  31424. $1=self._positionStart();
  31425. $6=self._source();
  31426. $ctx1.sendIdx["source"]=1;
  31427. $5=$recv($6)._lines();
  31428. $ctx1.sendIdx["lines"]=1;
  31429. $4=$recv($5)._size();
  31430. $ctx1.sendIdx["size"]=1;
  31431. $3=$recv($4).__minus((1));
  31432. $ctx1.sendIdx["-"]=1;
  31433. $2=$recv($3).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1)));
  31434. return $recv($1).__plus($2);
  31435. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  31436. },
  31437. args: [],
  31438. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  31439. referencedClasses: [],
  31440. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  31441. }),
  31442. $globals.ASTNode);
  31443. $core.addMethod(
  31444. $core.method({
  31445. selector: "positionStart",
  31446. protocol: 'accessing',
  31447. fn: function (){
  31448. var self=this;
  31449. return $core.withContext(function($ctx1) {
  31450. return self._position();
  31451. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  31452. },
  31453. args: [],
  31454. source: "positionStart\x0a\x09^ self position",
  31455. referencedClasses: [],
  31456. messageSends: ["position"]
  31457. }),
  31458. $globals.ASTNode);
  31459. $core.addMethod(
  31460. $core.method({
  31461. selector: "requiresSmalltalkContext",
  31462. protocol: 'testing',
  31463. fn: function (){
  31464. var self=this;
  31465. return $core.withContext(function($ctx1) {
  31466. return $recv($recv(self._dagChildren())._detect_ifNone_((function(each){
  31467. return $core.withContext(function($ctx2) {
  31468. return $recv(each)._requiresSmalltalkContext();
  31469. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31470. }),(function(){
  31471. return nil;
  31472. })))._notNil();
  31473. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  31474. },
  31475. args: [],
  31476. 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",
  31477. referencedClasses: [],
  31478. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  31479. }),
  31480. $globals.ASTNode);
  31481. $core.addMethod(
  31482. $core.method({
  31483. selector: "shouldBeAliased",
  31484. protocol: 'accessing',
  31485. fn: function (){
  31486. var self=this;
  31487. return $core.withContext(function($ctx1) {
  31488. var $1,$receiver;
  31489. $1=self["@shouldBeAliased"];
  31490. if(($receiver = $1) == null || $receiver.isNil){
  31491. return false;
  31492. } else {
  31493. return $1;
  31494. };
  31495. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  31496. },
  31497. args: [],
  31498. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  31499. referencedClasses: [],
  31500. messageSends: ["ifNil:"]
  31501. }),
  31502. $globals.ASTNode);
  31503. $core.addMethod(
  31504. $core.method({
  31505. selector: "shouldBeAliased:",
  31506. protocol: 'accessing',
  31507. fn: function (aBoolean){
  31508. var self=this;
  31509. self["@shouldBeAliased"]=aBoolean;
  31510. return self;
  31511. },
  31512. args: ["aBoolean"],
  31513. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  31514. referencedClasses: [],
  31515. messageSends: []
  31516. }),
  31517. $globals.ASTNode);
  31518. $core.addMethod(
  31519. $core.method({
  31520. selector: "size",
  31521. protocol: 'accessing',
  31522. fn: function (){
  31523. var self=this;
  31524. return $core.withContext(function($ctx1) {
  31525. return $recv(self._source())._size();
  31526. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  31527. },
  31528. args: [],
  31529. source: "size\x0a\x09^ self source size",
  31530. referencedClasses: [],
  31531. messageSends: ["size", "source"]
  31532. }),
  31533. $globals.ASTNode);
  31534. $core.addMethod(
  31535. $core.method({
  31536. selector: "source",
  31537. protocol: 'accessing',
  31538. fn: function (){
  31539. var self=this;
  31540. return $core.withContext(function($ctx1) {
  31541. var $1,$receiver;
  31542. $1=self["@source"];
  31543. if(($receiver = $1) == null || $receiver.isNil){
  31544. return "";
  31545. } else {
  31546. return $1;
  31547. };
  31548. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  31549. },
  31550. args: [],
  31551. source: "source\x0a\x09^ source ifNil: [ '' ]",
  31552. referencedClasses: [],
  31553. messageSends: ["ifNil:"]
  31554. }),
  31555. $globals.ASTNode);
  31556. $core.addMethod(
  31557. $core.method({
  31558. selector: "source:",
  31559. protocol: 'accessing',
  31560. fn: function (aString){
  31561. var self=this;
  31562. self["@source"]=aString;
  31563. return self;
  31564. },
  31565. args: ["aString"],
  31566. source: "source: aString\x0a\x09source := aString",
  31567. referencedClasses: [],
  31568. messageSends: []
  31569. }),
  31570. $globals.ASTNode);
  31571. $core.addClass('AssignmentNode', $globals.ASTNode, ['left', 'right'], 'Compiler-AST');
  31572. $globals.AssignmentNode.comment="I represent an assignment node.";
  31573. $core.addMethod(
  31574. $core.method({
  31575. selector: "acceptDagVisitor:",
  31576. protocol: 'visiting',
  31577. fn: function (aVisitor){
  31578. var self=this;
  31579. return $core.withContext(function($ctx1) {
  31580. return $recv(aVisitor)._visitAssignmentNode_(self);
  31581. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  31582. },
  31583. args: ["aVisitor"],
  31584. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  31585. referencedClasses: [],
  31586. messageSends: ["visitAssignmentNode:"]
  31587. }),
  31588. $globals.AssignmentNode);
  31589. $core.addMethod(
  31590. $core.method({
  31591. selector: "dagChildren",
  31592. protocol: 'accessing',
  31593. fn: function (){
  31594. var self=this;
  31595. return $core.withContext(function($ctx1) {
  31596. return $recv($globals.Array)._with_with_(self._left(),self._right());
  31597. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  31598. },
  31599. args: [],
  31600. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  31601. referencedClasses: ["Array"],
  31602. messageSends: ["with:with:", "left", "right"]
  31603. }),
  31604. $globals.AssignmentNode);
  31605. $core.addMethod(
  31606. $core.method({
  31607. selector: "isAssignmentNode",
  31608. protocol: 'testing',
  31609. fn: function (){
  31610. var self=this;
  31611. return true;
  31612. },
  31613. args: [],
  31614. source: "isAssignmentNode\x0a\x09^ true",
  31615. referencedClasses: [],
  31616. messageSends: []
  31617. }),
  31618. $globals.AssignmentNode);
  31619. $core.addMethod(
  31620. $core.method({
  31621. selector: "left",
  31622. protocol: 'accessing',
  31623. fn: function (){
  31624. var self=this;
  31625. return self["@left"];
  31626. },
  31627. args: [],
  31628. source: "left\x0a\x09^ left",
  31629. referencedClasses: [],
  31630. messageSends: []
  31631. }),
  31632. $globals.AssignmentNode);
  31633. $core.addMethod(
  31634. $core.method({
  31635. selector: "left:",
  31636. protocol: 'accessing',
  31637. fn: function (aNode){
  31638. var self=this;
  31639. self["@left"]=aNode;
  31640. return self;
  31641. },
  31642. args: ["aNode"],
  31643. source: "left: aNode\x0a\x09left := aNode",
  31644. referencedClasses: [],
  31645. messageSends: []
  31646. }),
  31647. $globals.AssignmentNode);
  31648. $core.addMethod(
  31649. $core.method({
  31650. selector: "right",
  31651. protocol: 'accessing',
  31652. fn: function (){
  31653. var self=this;
  31654. return self["@right"];
  31655. },
  31656. args: [],
  31657. source: "right\x0a\x09^ right",
  31658. referencedClasses: [],
  31659. messageSends: []
  31660. }),
  31661. $globals.AssignmentNode);
  31662. $core.addMethod(
  31663. $core.method({
  31664. selector: "right:",
  31665. protocol: 'accessing',
  31666. fn: function (aNode){
  31667. var self=this;
  31668. self["@right"]=aNode;
  31669. return self;
  31670. },
  31671. args: ["aNode"],
  31672. source: "right: aNode\x0a\x09right := aNode",
  31673. referencedClasses: [],
  31674. messageSends: []
  31675. }),
  31676. $globals.AssignmentNode);
  31677. $core.addClass('BlockNode', $globals.ASTNode, ['parameters', 'scope'], 'Compiler-AST');
  31678. $globals.BlockNode.comment="I represent an block closure node.";
  31679. $core.addMethod(
  31680. $core.method({
  31681. selector: "acceptDagVisitor:",
  31682. protocol: 'visiting',
  31683. fn: function (aVisitor){
  31684. var self=this;
  31685. return $core.withContext(function($ctx1) {
  31686. return $recv(aVisitor)._visitBlockNode_(self);
  31687. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  31688. },
  31689. args: ["aVisitor"],
  31690. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  31691. referencedClasses: [],
  31692. messageSends: ["visitBlockNode:"]
  31693. }),
  31694. $globals.BlockNode);
  31695. $core.addMethod(
  31696. $core.method({
  31697. selector: "isBlockNode",
  31698. protocol: 'testing',
  31699. fn: function (){
  31700. var self=this;
  31701. return true;
  31702. },
  31703. args: [],
  31704. source: "isBlockNode\x0a\x09^ true",
  31705. referencedClasses: [],
  31706. messageSends: []
  31707. }),
  31708. $globals.BlockNode);
  31709. $core.addMethod(
  31710. $core.method({
  31711. selector: "parameters",
  31712. protocol: 'accessing',
  31713. fn: function (){
  31714. var self=this;
  31715. return $core.withContext(function($ctx1) {
  31716. var $1,$receiver;
  31717. $1=self["@parameters"];
  31718. if(($receiver = $1) == null || $receiver.isNil){
  31719. self["@parameters"]=$recv($globals.Array)._new();
  31720. return self["@parameters"];
  31721. } else {
  31722. return $1;
  31723. };
  31724. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  31725. },
  31726. args: [],
  31727. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  31728. referencedClasses: ["Array"],
  31729. messageSends: ["ifNil:", "new"]
  31730. }),
  31731. $globals.BlockNode);
  31732. $core.addMethod(
  31733. $core.method({
  31734. selector: "parameters:",
  31735. protocol: 'accessing',
  31736. fn: function (aCollection){
  31737. var self=this;
  31738. self["@parameters"]=aCollection;
  31739. return self;
  31740. },
  31741. args: ["aCollection"],
  31742. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  31743. referencedClasses: [],
  31744. messageSends: []
  31745. }),
  31746. $globals.BlockNode);
  31747. $core.addMethod(
  31748. $core.method({
  31749. selector: "scope",
  31750. protocol: 'accessing',
  31751. fn: function (){
  31752. var self=this;
  31753. return self["@scope"];
  31754. },
  31755. args: [],
  31756. source: "scope\x0a\x09^ scope",
  31757. referencedClasses: [],
  31758. messageSends: []
  31759. }),
  31760. $globals.BlockNode);
  31761. $core.addMethod(
  31762. $core.method({
  31763. selector: "scope:",
  31764. protocol: 'accessing',
  31765. fn: function (aLexicalScope){
  31766. var self=this;
  31767. self["@scope"]=aLexicalScope;
  31768. return self;
  31769. },
  31770. args: ["aLexicalScope"],
  31771. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  31772. referencedClasses: [],
  31773. messageSends: []
  31774. }),
  31775. $globals.BlockNode);
  31776. $core.addClass('CascadeNode', $globals.ASTNode, ['receiver'], 'Compiler-AST');
  31777. $globals.CascadeNode.comment="I represent an cascade node.";
  31778. $core.addMethod(
  31779. $core.method({
  31780. selector: "acceptDagVisitor:",
  31781. protocol: 'visiting',
  31782. fn: function (aVisitor){
  31783. var self=this;
  31784. return $core.withContext(function($ctx1) {
  31785. return $recv(aVisitor)._visitCascadeNode_(self);
  31786. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  31787. },
  31788. args: ["aVisitor"],
  31789. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  31790. referencedClasses: [],
  31791. messageSends: ["visitCascadeNode:"]
  31792. }),
  31793. $globals.CascadeNode);
  31794. $core.addMethod(
  31795. $core.method({
  31796. selector: "isCascadeNode",
  31797. protocol: 'testing',
  31798. fn: function (){
  31799. var self=this;
  31800. return true;
  31801. },
  31802. args: [],
  31803. source: "isCascadeNode\x0a\x09^ true",
  31804. referencedClasses: [],
  31805. messageSends: []
  31806. }),
  31807. $globals.CascadeNode);
  31808. $core.addMethod(
  31809. $core.method({
  31810. selector: "receiver",
  31811. protocol: 'accessing',
  31812. fn: function (){
  31813. var self=this;
  31814. return self["@receiver"];
  31815. },
  31816. args: [],
  31817. source: "receiver\x0a\x09^ receiver",
  31818. referencedClasses: [],
  31819. messageSends: []
  31820. }),
  31821. $globals.CascadeNode);
  31822. $core.addMethod(
  31823. $core.method({
  31824. selector: "receiver:",
  31825. protocol: 'accessing',
  31826. fn: function (aNode){
  31827. var self=this;
  31828. self["@receiver"]=aNode;
  31829. return self;
  31830. },
  31831. args: ["aNode"],
  31832. source: "receiver: aNode\x0a\x09receiver := aNode",
  31833. referencedClasses: [],
  31834. messageSends: []
  31835. }),
  31836. $globals.CascadeNode);
  31837. $core.addClass('DynamicArrayNode', $globals.ASTNode, [], 'Compiler-AST');
  31838. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  31839. $core.addMethod(
  31840. $core.method({
  31841. selector: "acceptDagVisitor:",
  31842. protocol: 'visiting',
  31843. fn: function (aVisitor){
  31844. var self=this;
  31845. return $core.withContext(function($ctx1) {
  31846. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  31847. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  31848. },
  31849. args: ["aVisitor"],
  31850. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  31851. referencedClasses: [],
  31852. messageSends: ["visitDynamicArrayNode:"]
  31853. }),
  31854. $globals.DynamicArrayNode);
  31855. $core.addClass('DynamicDictionaryNode', $globals.ASTNode, [], 'Compiler-AST');
  31856. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  31857. $core.addMethod(
  31858. $core.method({
  31859. selector: "acceptDagVisitor:",
  31860. protocol: 'visiting',
  31861. fn: function (aVisitor){
  31862. var self=this;
  31863. return $core.withContext(function($ctx1) {
  31864. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  31865. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  31866. },
  31867. args: ["aVisitor"],
  31868. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  31869. referencedClasses: [],
  31870. messageSends: ["visitDynamicDictionaryNode:"]
  31871. }),
  31872. $globals.DynamicDictionaryNode);
  31873. $core.addClass('JSStatementNode', $globals.ASTNode, [], 'Compiler-AST');
  31874. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  31875. $core.addMethod(
  31876. $core.method({
  31877. selector: "acceptDagVisitor:",
  31878. protocol: 'visiting',
  31879. fn: function (aVisitor){
  31880. var self=this;
  31881. return $core.withContext(function($ctx1) {
  31882. return $recv(aVisitor)._visitJSStatementNode_(self);
  31883. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  31884. },
  31885. args: ["aVisitor"],
  31886. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  31887. referencedClasses: [],
  31888. messageSends: ["visitJSStatementNode:"]
  31889. }),
  31890. $globals.JSStatementNode);
  31891. $core.addMethod(
  31892. $core.method({
  31893. selector: "isJSStatementNode",
  31894. protocol: 'testing',
  31895. fn: function (){
  31896. var self=this;
  31897. return true;
  31898. },
  31899. args: [],
  31900. source: "isJSStatementNode\x0a\x09^ true",
  31901. referencedClasses: [],
  31902. messageSends: []
  31903. }),
  31904. $globals.JSStatementNode);
  31905. $core.addMethod(
  31906. $core.method({
  31907. selector: "requiresSmalltalkContext",
  31908. protocol: 'testing',
  31909. fn: function (){
  31910. var self=this;
  31911. return true;
  31912. },
  31913. args: [],
  31914. source: "requiresSmalltalkContext\x0a\x09^ true",
  31915. referencedClasses: [],
  31916. messageSends: []
  31917. }),
  31918. $globals.JSStatementNode);
  31919. $core.addClass('MethodNode', $globals.ASTNode, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes'], 'Compiler-AST');
  31920. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  31921. $core.addMethod(
  31922. $core.method({
  31923. selector: "acceptDagVisitor:",
  31924. protocol: 'visiting',
  31925. fn: function (aVisitor){
  31926. var self=this;
  31927. return $core.withContext(function($ctx1) {
  31928. return $recv(aVisitor)._visitMethodNode_(self);
  31929. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  31930. },
  31931. args: ["aVisitor"],
  31932. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  31933. referencedClasses: [],
  31934. messageSends: ["visitMethodNode:"]
  31935. }),
  31936. $globals.MethodNode);
  31937. $core.addMethod(
  31938. $core.method({
  31939. selector: "arguments",
  31940. protocol: 'accessing',
  31941. fn: function (){
  31942. var self=this;
  31943. return $core.withContext(function($ctx1) {
  31944. var $1,$receiver;
  31945. $1=self["@arguments"];
  31946. if(($receiver = $1) == null || $receiver.isNil){
  31947. return [];
  31948. } else {
  31949. return $1;
  31950. };
  31951. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  31952. },
  31953. args: [],
  31954. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  31955. referencedClasses: [],
  31956. messageSends: ["ifNil:"]
  31957. }),
  31958. $globals.MethodNode);
  31959. $core.addMethod(
  31960. $core.method({
  31961. selector: "arguments:",
  31962. protocol: 'accessing',
  31963. fn: function (aCollection){
  31964. var self=this;
  31965. self["@arguments"]=aCollection;
  31966. return self;
  31967. },
  31968. args: ["aCollection"],
  31969. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  31970. referencedClasses: [],
  31971. messageSends: []
  31972. }),
  31973. $globals.MethodNode);
  31974. $core.addMethod(
  31975. $core.method({
  31976. selector: "classReferences",
  31977. protocol: 'accessing',
  31978. fn: function (){
  31979. var self=this;
  31980. return self["@classReferences"];
  31981. },
  31982. args: [],
  31983. source: "classReferences\x0a\x09^ classReferences",
  31984. referencedClasses: [],
  31985. messageSends: []
  31986. }),
  31987. $globals.MethodNode);
  31988. $core.addMethod(
  31989. $core.method({
  31990. selector: "classReferences:",
  31991. protocol: 'accessing',
  31992. fn: function (aCollection){
  31993. var self=this;
  31994. self["@classReferences"]=aCollection;
  31995. return self;
  31996. },
  31997. args: ["aCollection"],
  31998. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  31999. referencedClasses: [],
  32000. messageSends: []
  32001. }),
  32002. $globals.MethodNode);
  32003. $core.addMethod(
  32004. $core.method({
  32005. selector: "messageSends",
  32006. protocol: 'accessing',
  32007. fn: function (){
  32008. var self=this;
  32009. return $core.withContext(function($ctx1) {
  32010. return $recv(self._sendIndexes())._keys();
  32011. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  32012. },
  32013. args: [],
  32014. source: "messageSends\x0a\x09^ self sendIndexes keys",
  32015. referencedClasses: [],
  32016. messageSends: ["keys", "sendIndexes"]
  32017. }),
  32018. $globals.MethodNode);
  32019. $core.addMethod(
  32020. $core.method({
  32021. selector: "method",
  32022. protocol: 'accessing',
  32023. fn: function (){
  32024. var self=this;
  32025. return self;
  32026. },
  32027. args: [],
  32028. source: "method\x0a\x09^ self",
  32029. referencedClasses: [],
  32030. messageSends: []
  32031. }),
  32032. $globals.MethodNode);
  32033. $core.addMethod(
  32034. $core.method({
  32035. selector: "scope",
  32036. protocol: 'accessing',
  32037. fn: function (){
  32038. var self=this;
  32039. return self["@scope"];
  32040. },
  32041. args: [],
  32042. source: "scope\x0a\x09^ scope",
  32043. referencedClasses: [],
  32044. messageSends: []
  32045. }),
  32046. $globals.MethodNode);
  32047. $core.addMethod(
  32048. $core.method({
  32049. selector: "scope:",
  32050. protocol: 'accessing',
  32051. fn: function (aMethodScope){
  32052. var self=this;
  32053. self["@scope"]=aMethodScope;
  32054. return self;
  32055. },
  32056. args: ["aMethodScope"],
  32057. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  32058. referencedClasses: [],
  32059. messageSends: []
  32060. }),
  32061. $globals.MethodNode);
  32062. $core.addMethod(
  32063. $core.method({
  32064. selector: "selector",
  32065. protocol: 'accessing',
  32066. fn: function (){
  32067. var self=this;
  32068. return self["@selector"];
  32069. },
  32070. args: [],
  32071. source: "selector\x0a\x09^ selector",
  32072. referencedClasses: [],
  32073. messageSends: []
  32074. }),
  32075. $globals.MethodNode);
  32076. $core.addMethod(
  32077. $core.method({
  32078. selector: "selector:",
  32079. protocol: 'accessing',
  32080. fn: function (aString){
  32081. var self=this;
  32082. self["@selector"]=aString;
  32083. return self;
  32084. },
  32085. args: ["aString"],
  32086. source: "selector: aString\x0a\x09selector := aString",
  32087. referencedClasses: [],
  32088. messageSends: []
  32089. }),
  32090. $globals.MethodNode);
  32091. $core.addMethod(
  32092. $core.method({
  32093. selector: "sendIndexes",
  32094. protocol: 'accessing',
  32095. fn: function (){
  32096. var self=this;
  32097. return self["@sendIndexes"];
  32098. },
  32099. args: [],
  32100. source: "sendIndexes\x0a\x09^ sendIndexes",
  32101. referencedClasses: [],
  32102. messageSends: []
  32103. }),
  32104. $globals.MethodNode);
  32105. $core.addMethod(
  32106. $core.method({
  32107. selector: "sendIndexes:",
  32108. protocol: 'accessing',
  32109. fn: function (aDictionary){
  32110. var self=this;
  32111. self["@sendIndexes"]=aDictionary;
  32112. return self;
  32113. },
  32114. args: ["aDictionary"],
  32115. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  32116. referencedClasses: [],
  32117. messageSends: []
  32118. }),
  32119. $globals.MethodNode);
  32120. $core.addMethod(
  32121. $core.method({
  32122. selector: "sequenceNode",
  32123. protocol: 'accessing',
  32124. fn: function (){
  32125. var self=this;
  32126. return $core.withContext(function($ctx1) {
  32127. var $1;
  32128. var $early={};
  32129. try {
  32130. $recv(self._dagChildren())._do_((function(each){
  32131. return $core.withContext(function($ctx2) {
  32132. $1=$recv(each)._isSequenceNode();
  32133. if($core.assert($1)){
  32134. throw $early=[each];
  32135. };
  32136. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32137. }));
  32138. return nil;
  32139. }
  32140. catch(e) {if(e===$early)return e[0]; throw e}
  32141. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  32142. },
  32143. args: [],
  32144. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  32145. referencedClasses: [],
  32146. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  32147. }),
  32148. $globals.MethodNode);
  32149. $core.addMethod(
  32150. $core.method({
  32151. selector: "source",
  32152. protocol: 'accessing',
  32153. fn: function (){
  32154. var self=this;
  32155. return self["@source"];
  32156. },
  32157. args: [],
  32158. source: "source\x0a\x09^ source",
  32159. referencedClasses: [],
  32160. messageSends: []
  32161. }),
  32162. $globals.MethodNode);
  32163. $core.addMethod(
  32164. $core.method({
  32165. selector: "source:",
  32166. protocol: 'accessing',
  32167. fn: function (aString){
  32168. var self=this;
  32169. self["@source"]=aString;
  32170. return self;
  32171. },
  32172. args: ["aString"],
  32173. source: "source: aString\x0a\x09source := aString",
  32174. referencedClasses: [],
  32175. messageSends: []
  32176. }),
  32177. $globals.MethodNode);
  32178. $core.addClass('ReturnNode', $globals.ASTNode, ['scope'], 'Compiler-AST');
  32179. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  32180. $core.addMethod(
  32181. $core.method({
  32182. selector: "acceptDagVisitor:",
  32183. protocol: 'visiting',
  32184. fn: function (aVisitor){
  32185. var self=this;
  32186. return $core.withContext(function($ctx1) {
  32187. return $recv(aVisitor)._visitReturnNode_(self);
  32188. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  32189. },
  32190. args: ["aVisitor"],
  32191. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  32192. referencedClasses: [],
  32193. messageSends: ["visitReturnNode:"]
  32194. }),
  32195. $globals.ReturnNode);
  32196. $core.addMethod(
  32197. $core.method({
  32198. selector: "isReturnNode",
  32199. protocol: 'testing',
  32200. fn: function (){
  32201. var self=this;
  32202. return true;
  32203. },
  32204. args: [],
  32205. source: "isReturnNode\x0a\x09^ true",
  32206. referencedClasses: [],
  32207. messageSends: []
  32208. }),
  32209. $globals.ReturnNode);
  32210. $core.addMethod(
  32211. $core.method({
  32212. selector: "nonLocalReturn",
  32213. protocol: 'testing',
  32214. fn: function (){
  32215. var self=this;
  32216. return $core.withContext(function($ctx1) {
  32217. return $recv($recv(self._scope())._isMethodScope())._not();
  32218. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  32219. },
  32220. args: [],
  32221. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  32222. referencedClasses: [],
  32223. messageSends: ["not", "isMethodScope", "scope"]
  32224. }),
  32225. $globals.ReturnNode);
  32226. $core.addMethod(
  32227. $core.method({
  32228. selector: "scope",
  32229. protocol: 'accessing',
  32230. fn: function (){
  32231. var self=this;
  32232. return self["@scope"];
  32233. },
  32234. args: [],
  32235. source: "scope\x0a\x09^ scope",
  32236. referencedClasses: [],
  32237. messageSends: []
  32238. }),
  32239. $globals.ReturnNode);
  32240. $core.addMethod(
  32241. $core.method({
  32242. selector: "scope:",
  32243. protocol: 'accessing',
  32244. fn: function (aLexicalScope){
  32245. var self=this;
  32246. self["@scope"]=aLexicalScope;
  32247. return self;
  32248. },
  32249. args: ["aLexicalScope"],
  32250. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32251. referencedClasses: [],
  32252. messageSends: []
  32253. }),
  32254. $globals.ReturnNode);
  32255. $core.addClass('SendNode', $globals.ASTNode, ['selector', 'arguments', 'receiver', 'index', 'shouldBeInlined'], 'Compiler-AST');
  32256. $globals.SendNode.comment="I represent an message send node.";
  32257. $core.addMethod(
  32258. $core.method({
  32259. selector: "acceptDagVisitor:",
  32260. protocol: 'visiting',
  32261. fn: function (aVisitor){
  32262. var self=this;
  32263. return $core.withContext(function($ctx1) {
  32264. return $recv(aVisitor)._visitSendNode_(self);
  32265. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  32266. },
  32267. args: ["aVisitor"],
  32268. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  32269. referencedClasses: [],
  32270. messageSends: ["visitSendNode:"]
  32271. }),
  32272. $globals.SendNode);
  32273. $core.addMethod(
  32274. $core.method({
  32275. selector: "arguments",
  32276. protocol: 'accessing',
  32277. fn: function (){
  32278. var self=this;
  32279. return $core.withContext(function($ctx1) {
  32280. var $1,$receiver;
  32281. $1=self["@arguments"];
  32282. if(($receiver = $1) == null || $receiver.isNil){
  32283. self["@arguments"]=[];
  32284. return self["@arguments"];
  32285. } else {
  32286. return $1;
  32287. };
  32288. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  32289. },
  32290. args: [],
  32291. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  32292. referencedClasses: [],
  32293. messageSends: ["ifNil:"]
  32294. }),
  32295. $globals.SendNode);
  32296. $core.addMethod(
  32297. $core.method({
  32298. selector: "arguments:",
  32299. protocol: 'accessing',
  32300. fn: function (aCollection){
  32301. var self=this;
  32302. self["@arguments"]=aCollection;
  32303. return self;
  32304. },
  32305. args: ["aCollection"],
  32306. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  32307. referencedClasses: [],
  32308. messageSends: []
  32309. }),
  32310. $globals.SendNode);
  32311. $core.addMethod(
  32312. $core.method({
  32313. selector: "dagChildren",
  32314. protocol: 'accessing',
  32315. fn: function (){
  32316. var self=this;
  32317. return $core.withContext(function($ctx1) {
  32318. var $1,$2,$3,$receiver;
  32319. $1=self._receiver();
  32320. $ctx1.sendIdx["receiver"]=1;
  32321. if(($receiver = $1) == null || $receiver.isNil){
  32322. $2=self._arguments();
  32323. $ctx1.sendIdx["arguments"]=1;
  32324. return $recv($2)._copy();
  32325. } else {
  32326. $1;
  32327. };
  32328. $3=$recv($globals.Array)._with_(self._receiver());
  32329. $recv($3)._addAll_(self._arguments());
  32330. return $recv($3)._yourself();
  32331. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  32332. },
  32333. args: [],
  32334. 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",
  32335. referencedClasses: ["Array"],
  32336. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  32337. }),
  32338. $globals.SendNode);
  32339. $core.addMethod(
  32340. $core.method({
  32341. selector: "index",
  32342. protocol: 'accessing',
  32343. fn: function (){
  32344. var self=this;
  32345. return self["@index"];
  32346. },
  32347. args: [],
  32348. source: "index\x0a\x09^ index",
  32349. referencedClasses: [],
  32350. messageSends: []
  32351. }),
  32352. $globals.SendNode);
  32353. $core.addMethod(
  32354. $core.method({
  32355. selector: "index:",
  32356. protocol: 'accessing',
  32357. fn: function (anInteger){
  32358. var self=this;
  32359. self["@index"]=anInteger;
  32360. return self;
  32361. },
  32362. args: ["anInteger"],
  32363. source: "index: anInteger\x0a\x09index := anInteger",
  32364. referencedClasses: [],
  32365. messageSends: []
  32366. }),
  32367. $globals.SendNode);
  32368. $core.addMethod(
  32369. $core.method({
  32370. selector: "isNavigationNode",
  32371. protocol: 'testing',
  32372. fn: function (){
  32373. var self=this;
  32374. return true;
  32375. },
  32376. args: [],
  32377. source: "isNavigationNode\x0a\x09^ true",
  32378. referencedClasses: [],
  32379. messageSends: []
  32380. }),
  32381. $globals.SendNode);
  32382. $core.addMethod(
  32383. $core.method({
  32384. selector: "isSendNode",
  32385. protocol: 'testing',
  32386. fn: function (){
  32387. var self=this;
  32388. return true;
  32389. },
  32390. args: [],
  32391. source: "isSendNode\x0a\x09^ true",
  32392. referencedClasses: [],
  32393. messageSends: []
  32394. }),
  32395. $globals.SendNode);
  32396. $core.addMethod(
  32397. $core.method({
  32398. selector: "navigationLink",
  32399. protocol: 'accessing',
  32400. fn: function (){
  32401. var self=this;
  32402. return $core.withContext(function($ctx1) {
  32403. return self._selector();
  32404. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  32405. },
  32406. args: [],
  32407. source: "navigationLink\x0a\x09^ self selector",
  32408. referencedClasses: [],
  32409. messageSends: ["selector"]
  32410. }),
  32411. $globals.SendNode);
  32412. $core.addMethod(
  32413. $core.method({
  32414. selector: "receiver",
  32415. protocol: 'accessing',
  32416. fn: function (){
  32417. var self=this;
  32418. return self["@receiver"];
  32419. },
  32420. args: [],
  32421. source: "receiver\x0a\x09^ receiver",
  32422. referencedClasses: [],
  32423. messageSends: []
  32424. }),
  32425. $globals.SendNode);
  32426. $core.addMethod(
  32427. $core.method({
  32428. selector: "receiver:",
  32429. protocol: 'accessing',
  32430. fn: function (aNode){
  32431. var self=this;
  32432. self["@receiver"]=aNode;
  32433. return self;
  32434. },
  32435. args: ["aNode"],
  32436. source: "receiver: aNode\x0a\x09receiver := aNode",
  32437. referencedClasses: [],
  32438. messageSends: []
  32439. }),
  32440. $globals.SendNode);
  32441. $core.addMethod(
  32442. $core.method({
  32443. selector: "requiresSmalltalkContext",
  32444. protocol: 'testing',
  32445. fn: function (){
  32446. var self=this;
  32447. return true;
  32448. },
  32449. args: [],
  32450. source: "requiresSmalltalkContext\x0a\x09^ true",
  32451. referencedClasses: [],
  32452. messageSends: []
  32453. }),
  32454. $globals.SendNode);
  32455. $core.addMethod(
  32456. $core.method({
  32457. selector: "selector",
  32458. protocol: 'accessing',
  32459. fn: function (){
  32460. var self=this;
  32461. return self["@selector"];
  32462. },
  32463. args: [],
  32464. source: "selector\x0a\x09^ selector",
  32465. referencedClasses: [],
  32466. messageSends: []
  32467. }),
  32468. $globals.SendNode);
  32469. $core.addMethod(
  32470. $core.method({
  32471. selector: "selector:",
  32472. protocol: 'accessing',
  32473. fn: function (aString){
  32474. var self=this;
  32475. self["@selector"]=aString;
  32476. return self;
  32477. },
  32478. args: ["aString"],
  32479. source: "selector: aString\x0a\x09selector := aString",
  32480. referencedClasses: [],
  32481. messageSends: []
  32482. }),
  32483. $globals.SendNode);
  32484. $core.addMethod(
  32485. $core.method({
  32486. selector: "shouldBeInlined",
  32487. protocol: 'accessing',
  32488. fn: function (){
  32489. var self=this;
  32490. return $core.withContext(function($ctx1) {
  32491. var $1,$receiver;
  32492. $1=self["@shouldBeInlined"];
  32493. if(($receiver = $1) == null || $receiver.isNil){
  32494. return false;
  32495. } else {
  32496. return $1;
  32497. };
  32498. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  32499. },
  32500. args: [],
  32501. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  32502. referencedClasses: [],
  32503. messageSends: ["ifNil:"]
  32504. }),
  32505. $globals.SendNode);
  32506. $core.addMethod(
  32507. $core.method({
  32508. selector: "shouldBeInlined:",
  32509. protocol: 'accessing',
  32510. fn: function (aBoolean){
  32511. var self=this;
  32512. self["@shouldBeInlined"]=aBoolean;
  32513. return self;
  32514. },
  32515. args: ["aBoolean"],
  32516. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  32517. referencedClasses: [],
  32518. messageSends: []
  32519. }),
  32520. $globals.SendNode);
  32521. $core.addMethod(
  32522. $core.method({
  32523. selector: "superSend",
  32524. protocol: 'accessing',
  32525. fn: function (){
  32526. var self=this;
  32527. return $core.withContext(function($ctx1) {
  32528. var $2,$1;
  32529. $2=self._receiver();
  32530. $ctx1.sendIdx["receiver"]=1;
  32531. $1=$recv($2)._notNil();
  32532. return $recv($1)._and_((function(){
  32533. return $core.withContext(function($ctx2) {
  32534. return $recv(self._receiver())._isSuperKeyword();
  32535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32536. }));
  32537. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  32538. },
  32539. args: [],
  32540. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  32541. referencedClasses: [],
  32542. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  32543. }),
  32544. $globals.SendNode);
  32545. $core.addMethod(
  32546. $core.method({
  32547. selector: "valueForReceiver:",
  32548. protocol: 'building',
  32549. fn: function (anObject){
  32550. var self=this;
  32551. return $core.withContext(function($ctx1) {
  32552. var $1,$3,$2,$receiver;
  32553. $1=$recv($globals.SendNode)._new();
  32554. $recv($1)._position_(self._position());
  32555. $recv($1)._source_(self._source());
  32556. $3=self._receiver();
  32557. $ctx1.sendIdx["receiver"]=1;
  32558. if(($receiver = $3) == null || $receiver.isNil){
  32559. $2=anObject;
  32560. } else {
  32561. $2=$recv(self._receiver())._valueForReceiver_(anObject);
  32562. };
  32563. $recv($1)._receiver_($2);
  32564. $recv($1)._selector_(self._selector());
  32565. $recv($1)._arguments_(self._arguments());
  32566. return $recv($1)._yourself();
  32567. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},$globals.SendNode)});
  32568. },
  32569. args: ["anObject"],
  32570. source: "valueForReceiver: anObject\x0a\x09^ SendNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09receiver: (self receiver\x0a\x09\x09ifNil: [ anObject ] \x0a\x09\x09ifNotNil: [ self receiver valueForReceiver: anObject ]);\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself",
  32571. referencedClasses: ["SendNode"],
  32572. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  32573. }),
  32574. $globals.SendNode);
  32575. $core.addClass('SequenceNode', $globals.ASTNode, ['temps', 'scope'], 'Compiler-AST');
  32576. $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).";
  32577. $core.addMethod(
  32578. $core.method({
  32579. selector: "acceptDagVisitor:",
  32580. protocol: 'visiting',
  32581. fn: function (aVisitor){
  32582. var self=this;
  32583. return $core.withContext(function($ctx1) {
  32584. return $recv(aVisitor)._visitSequenceNode_(self);
  32585. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  32586. },
  32587. args: ["aVisitor"],
  32588. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  32589. referencedClasses: [],
  32590. messageSends: ["visitSequenceNode:"]
  32591. }),
  32592. $globals.SequenceNode);
  32593. $core.addMethod(
  32594. $core.method({
  32595. selector: "asBlockSequenceNode",
  32596. protocol: 'building',
  32597. fn: function (){
  32598. var self=this;
  32599. return $core.withContext(function($ctx1) {
  32600. var $1;
  32601. $1=$recv($globals.BlockSequenceNode)._new();
  32602. $recv($1)._position_(self._position());
  32603. $recv($1)._source_(self._source());
  32604. $recv($1)._dagChildren_(self._dagChildren());
  32605. $recv($1)._temps_(self._temps());
  32606. return $recv($1)._yourself();
  32607. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  32608. },
  32609. args: [],
  32610. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09dagChildren: self dagChildren;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  32611. referencedClasses: ["BlockSequenceNode"],
  32612. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "yourself"]
  32613. }),
  32614. $globals.SequenceNode);
  32615. $core.addMethod(
  32616. $core.method({
  32617. selector: "isSequenceNode",
  32618. protocol: 'testing',
  32619. fn: function (){
  32620. var self=this;
  32621. return true;
  32622. },
  32623. args: [],
  32624. source: "isSequenceNode\x0a\x09^ true",
  32625. referencedClasses: [],
  32626. messageSends: []
  32627. }),
  32628. $globals.SequenceNode);
  32629. $core.addMethod(
  32630. $core.method({
  32631. selector: "scope",
  32632. protocol: 'accessing',
  32633. fn: function (){
  32634. var self=this;
  32635. return self["@scope"];
  32636. },
  32637. args: [],
  32638. source: "scope\x0a\x09^ scope",
  32639. referencedClasses: [],
  32640. messageSends: []
  32641. }),
  32642. $globals.SequenceNode);
  32643. $core.addMethod(
  32644. $core.method({
  32645. selector: "scope:",
  32646. protocol: 'accessing',
  32647. fn: function (aLexicalScope){
  32648. var self=this;
  32649. self["@scope"]=aLexicalScope;
  32650. return self;
  32651. },
  32652. args: ["aLexicalScope"],
  32653. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32654. referencedClasses: [],
  32655. messageSends: []
  32656. }),
  32657. $globals.SequenceNode);
  32658. $core.addMethod(
  32659. $core.method({
  32660. selector: "temps",
  32661. protocol: 'accessing',
  32662. fn: function (){
  32663. var self=this;
  32664. return $core.withContext(function($ctx1) {
  32665. var $1,$receiver;
  32666. $1=self["@temps"];
  32667. if(($receiver = $1) == null || $receiver.isNil){
  32668. return [];
  32669. } else {
  32670. return $1;
  32671. };
  32672. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  32673. },
  32674. args: [],
  32675. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  32676. referencedClasses: [],
  32677. messageSends: ["ifNil:"]
  32678. }),
  32679. $globals.SequenceNode);
  32680. $core.addMethod(
  32681. $core.method({
  32682. selector: "temps:",
  32683. protocol: 'accessing',
  32684. fn: function (aCollection){
  32685. var self=this;
  32686. self["@temps"]=aCollection;
  32687. return self;
  32688. },
  32689. args: ["aCollection"],
  32690. source: "temps: aCollection\x0a\x09temps := aCollection",
  32691. referencedClasses: [],
  32692. messageSends: []
  32693. }),
  32694. $globals.SequenceNode);
  32695. $core.addClass('BlockSequenceNode', $globals.SequenceNode, [], 'Compiler-AST');
  32696. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  32697. $core.addMethod(
  32698. $core.method({
  32699. selector: "acceptDagVisitor:",
  32700. protocol: 'visiting',
  32701. fn: function (aVisitor){
  32702. var self=this;
  32703. return $core.withContext(function($ctx1) {
  32704. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  32705. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  32706. },
  32707. args: ["aVisitor"],
  32708. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  32709. referencedClasses: [],
  32710. messageSends: ["visitBlockSequenceNode:"]
  32711. }),
  32712. $globals.BlockSequenceNode);
  32713. $core.addMethod(
  32714. $core.method({
  32715. selector: "isBlockSequenceNode",
  32716. protocol: 'testing',
  32717. fn: function (){
  32718. var self=this;
  32719. return true;
  32720. },
  32721. args: [],
  32722. source: "isBlockSequenceNode\x0a\x09^ true",
  32723. referencedClasses: [],
  32724. messageSends: []
  32725. }),
  32726. $globals.BlockSequenceNode);
  32727. $core.addClass('ValueNode', $globals.ASTNode, ['value'], 'Compiler-AST');
  32728. $globals.ValueNode.comment="I represent a value node.";
  32729. $core.addMethod(
  32730. $core.method({
  32731. selector: "acceptDagVisitor:",
  32732. protocol: 'visiting',
  32733. fn: function (aVisitor){
  32734. var self=this;
  32735. return $core.withContext(function($ctx1) {
  32736. return $recv(aVisitor)._visitValueNode_(self);
  32737. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  32738. },
  32739. args: ["aVisitor"],
  32740. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  32741. referencedClasses: [],
  32742. messageSends: ["visitValueNode:"]
  32743. }),
  32744. $globals.ValueNode);
  32745. $core.addMethod(
  32746. $core.method({
  32747. selector: "isImmutable",
  32748. protocol: 'testing',
  32749. fn: function (){
  32750. var self=this;
  32751. return $core.withContext(function($ctx1) {
  32752. return $recv(self._value())._isImmutable();
  32753. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  32754. },
  32755. args: [],
  32756. source: "isImmutable\x0a\x09^ self value isImmutable",
  32757. referencedClasses: [],
  32758. messageSends: ["isImmutable", "value"]
  32759. }),
  32760. $globals.ValueNode);
  32761. $core.addMethod(
  32762. $core.method({
  32763. selector: "isValueNode",
  32764. protocol: 'testing',
  32765. fn: function (){
  32766. var self=this;
  32767. return true;
  32768. },
  32769. args: [],
  32770. source: "isValueNode\x0a\x09^ true",
  32771. referencedClasses: [],
  32772. messageSends: []
  32773. }),
  32774. $globals.ValueNode);
  32775. $core.addMethod(
  32776. $core.method({
  32777. selector: "value",
  32778. protocol: 'accessing',
  32779. fn: function (){
  32780. var self=this;
  32781. return self["@value"];
  32782. },
  32783. args: [],
  32784. source: "value\x0a\x09^ value",
  32785. referencedClasses: [],
  32786. messageSends: []
  32787. }),
  32788. $globals.ValueNode);
  32789. $core.addMethod(
  32790. $core.method({
  32791. selector: "value:",
  32792. protocol: 'accessing',
  32793. fn: function (anObject){
  32794. var self=this;
  32795. self["@value"]=anObject;
  32796. return self;
  32797. },
  32798. args: ["anObject"],
  32799. source: "value: anObject\x0a\x09value := anObject",
  32800. referencedClasses: [],
  32801. messageSends: []
  32802. }),
  32803. $globals.ValueNode);
  32804. $core.addClass('VariableNode', $globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  32805. $globals.VariableNode.comment="I represent an variable node.";
  32806. $core.addMethod(
  32807. $core.method({
  32808. selector: "acceptDagVisitor:",
  32809. protocol: 'visiting',
  32810. fn: function (aVisitor){
  32811. var self=this;
  32812. return $core.withContext(function($ctx1) {
  32813. return $recv(aVisitor)._visitVariableNode_(self);
  32814. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  32815. },
  32816. args: ["aVisitor"],
  32817. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  32818. referencedClasses: [],
  32819. messageSends: ["visitVariableNode:"]
  32820. }),
  32821. $globals.VariableNode);
  32822. $core.addMethod(
  32823. $core.method({
  32824. selector: "alias",
  32825. protocol: 'accessing',
  32826. fn: function (){
  32827. var self=this;
  32828. return $core.withContext(function($ctx1) {
  32829. return $recv(self._binding())._alias();
  32830. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  32831. },
  32832. args: [],
  32833. source: "alias\x0a\x09^ self binding alias",
  32834. referencedClasses: [],
  32835. messageSends: ["alias", "binding"]
  32836. }),
  32837. $globals.VariableNode);
  32838. $core.addMethod(
  32839. $core.method({
  32840. selector: "assigned",
  32841. protocol: 'accessing',
  32842. fn: function (){
  32843. var self=this;
  32844. return $core.withContext(function($ctx1) {
  32845. var $1,$receiver;
  32846. $1=self["@assigned"];
  32847. if(($receiver = $1) == null || $receiver.isNil){
  32848. return false;
  32849. } else {
  32850. return $1;
  32851. };
  32852. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  32853. },
  32854. args: [],
  32855. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  32856. referencedClasses: [],
  32857. messageSends: ["ifNil:"]
  32858. }),
  32859. $globals.VariableNode);
  32860. $core.addMethod(
  32861. $core.method({
  32862. selector: "assigned:",
  32863. protocol: 'accessing',
  32864. fn: function (aBoolean){
  32865. var self=this;
  32866. self["@assigned"]=aBoolean;
  32867. return self;
  32868. },
  32869. args: ["aBoolean"],
  32870. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  32871. referencedClasses: [],
  32872. messageSends: []
  32873. }),
  32874. $globals.VariableNode);
  32875. $core.addMethod(
  32876. $core.method({
  32877. selector: "beAssigned",
  32878. protocol: 'accessing',
  32879. fn: function (){
  32880. var self=this;
  32881. return $core.withContext(function($ctx1) {
  32882. $recv(self._binding())._validateAssignment();
  32883. self["@assigned"]=true;
  32884. return self;
  32885. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  32886. },
  32887. args: [],
  32888. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  32889. referencedClasses: [],
  32890. messageSends: ["validateAssignment", "binding"]
  32891. }),
  32892. $globals.VariableNode);
  32893. $core.addMethod(
  32894. $core.method({
  32895. selector: "binding",
  32896. protocol: 'accessing',
  32897. fn: function (){
  32898. var self=this;
  32899. return self["@binding"];
  32900. },
  32901. args: [],
  32902. source: "binding\x0a\x09^ binding",
  32903. referencedClasses: [],
  32904. messageSends: []
  32905. }),
  32906. $globals.VariableNode);
  32907. $core.addMethod(
  32908. $core.method({
  32909. selector: "binding:",
  32910. protocol: 'accessing',
  32911. fn: function (aScopeVar){
  32912. var self=this;
  32913. self["@binding"]=aScopeVar;
  32914. return self;
  32915. },
  32916. args: ["aScopeVar"],
  32917. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  32918. referencedClasses: [],
  32919. messageSends: []
  32920. }),
  32921. $globals.VariableNode);
  32922. $core.addMethod(
  32923. $core.method({
  32924. selector: "isArgument",
  32925. protocol: 'testing',
  32926. fn: function (){
  32927. var self=this;
  32928. return $core.withContext(function($ctx1) {
  32929. return $recv(self._binding())._isArgVar();
  32930. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  32931. },
  32932. args: [],
  32933. source: "isArgument\x0a\x09^ self binding isArgVar",
  32934. referencedClasses: [],
  32935. messageSends: ["isArgVar", "binding"]
  32936. }),
  32937. $globals.VariableNode);
  32938. $core.addMethod(
  32939. $core.method({
  32940. selector: "isImmutable",
  32941. protocol: 'testing',
  32942. fn: function (){
  32943. var self=this;
  32944. return $core.withContext(function($ctx1) {
  32945. return $recv(self._binding())._isImmutable();
  32946. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  32947. },
  32948. args: [],
  32949. source: "isImmutable\x0a\x09^ self binding isImmutable",
  32950. referencedClasses: [],
  32951. messageSends: ["isImmutable", "binding"]
  32952. }),
  32953. $globals.VariableNode);
  32954. $core.addMethod(
  32955. $core.method({
  32956. selector: "isNavigationNode",
  32957. protocol: 'testing',
  32958. fn: function (){
  32959. var self=this;
  32960. return true;
  32961. },
  32962. args: [],
  32963. source: "isNavigationNode\x0a\x09^ true",
  32964. referencedClasses: [],
  32965. messageSends: []
  32966. }),
  32967. $globals.VariableNode);
  32968. $core.addMethod(
  32969. $core.method({
  32970. selector: "isSuperKeyword",
  32971. protocol: 'testing',
  32972. fn: function (){
  32973. var self=this;
  32974. return $core.withContext(function($ctx1) {
  32975. return $recv(self._value()).__eq("super");
  32976. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  32977. },
  32978. args: [],
  32979. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  32980. referencedClasses: [],
  32981. messageSends: ["=", "value"]
  32982. }),
  32983. $globals.VariableNode);
  32984. $core.addMethod(
  32985. $core.method({
  32986. selector: "isVariableNode",
  32987. protocol: 'testing',
  32988. fn: function (){
  32989. var self=this;
  32990. return true;
  32991. },
  32992. args: [],
  32993. source: "isVariableNode\x0a\x09^ true",
  32994. referencedClasses: [],
  32995. messageSends: []
  32996. }),
  32997. $globals.VariableNode);
  32998. $core.addMethod(
  32999. $core.method({
  33000. selector: "navigationLink",
  33001. protocol: 'accessing',
  33002. fn: function (){
  33003. var self=this;
  33004. return $core.withContext(function($ctx1) {
  33005. return self._value();
  33006. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  33007. },
  33008. args: [],
  33009. source: "navigationLink\x0a\x09^ self value",
  33010. referencedClasses: [],
  33011. messageSends: ["value"]
  33012. }),
  33013. $globals.VariableNode);
  33014. $core.addClass('ParentFakingPathDagVisitor', $globals.PathDagVisitor, ['setParentSelector'], 'Compiler-AST');
  33015. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  33016. $core.addMethod(
  33017. $core.method({
  33018. selector: "visit:",
  33019. protocol: 'visiting',
  33020. fn: function (aNode){
  33021. var self=this;
  33022. return $core.withContext(function($ctx1) {
  33023. var $1;
  33024. $recv(self._path())._ifNotEmpty_((function(p){
  33025. return $core.withContext(function($ctx2) {
  33026. return $recv(aNode)._parent_($recv(p)._last());
  33027. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  33028. }));
  33029. $1=(
  33030. $ctx1.supercall = true,
  33031. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($recv(self), [aNode]));
  33032. $ctx1.supercall = false;
  33033. return $1;
  33034. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  33035. },
  33036. args: ["aNode"],
  33037. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  33038. referencedClasses: [],
  33039. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  33040. }),
  33041. $globals.ParentFakingPathDagVisitor);
  33042. $core.addClass('NodeVisitor', $globals.ParentFakingPathDagVisitor, [], 'Compiler-AST');
  33043. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  33044. $core.addMethod(
  33045. $core.method({
  33046. selector: "visitAssignmentNode:",
  33047. protocol: 'visiting',
  33048. fn: function (aNode){
  33049. var self=this;
  33050. return $core.withContext(function($ctx1) {
  33051. return self._visitDagNode_(aNode);
  33052. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  33053. },
  33054. args: ["aNode"],
  33055. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33056. referencedClasses: [],
  33057. messageSends: ["visitDagNode:"]
  33058. }),
  33059. $globals.NodeVisitor);
  33060. $core.addMethod(
  33061. $core.method({
  33062. selector: "visitBlockNode:",
  33063. protocol: 'visiting',
  33064. fn: function (aNode){
  33065. var self=this;
  33066. return $core.withContext(function($ctx1) {
  33067. return self._visitDagNode_(aNode);
  33068. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  33069. },
  33070. args: ["aNode"],
  33071. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33072. referencedClasses: [],
  33073. messageSends: ["visitDagNode:"]
  33074. }),
  33075. $globals.NodeVisitor);
  33076. $core.addMethod(
  33077. $core.method({
  33078. selector: "visitBlockSequenceNode:",
  33079. protocol: 'visiting',
  33080. fn: function (aNode){
  33081. var self=this;
  33082. return $core.withContext(function($ctx1) {
  33083. return self._visitSequenceNode_(aNode);
  33084. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  33085. },
  33086. args: ["aNode"],
  33087. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  33088. referencedClasses: [],
  33089. messageSends: ["visitSequenceNode:"]
  33090. }),
  33091. $globals.NodeVisitor);
  33092. $core.addMethod(
  33093. $core.method({
  33094. selector: "visitCascadeNode:",
  33095. protocol: 'visiting',
  33096. fn: function (aNode){
  33097. var self=this;
  33098. return $core.withContext(function($ctx1) {
  33099. return self._visitDagNode_(aNode);
  33100. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  33101. },
  33102. args: ["aNode"],
  33103. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33104. referencedClasses: [],
  33105. messageSends: ["visitDagNode:"]
  33106. }),
  33107. $globals.NodeVisitor);
  33108. $core.addMethod(
  33109. $core.method({
  33110. selector: "visitDagNode:",
  33111. protocol: 'visiting',
  33112. fn: function (aNode){
  33113. var self=this;
  33114. return $core.withContext(function($ctx1) {
  33115. return self._visitDagNodeVariantSimple_(aNode);
  33116. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  33117. },
  33118. args: ["aNode"],
  33119. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  33120. referencedClasses: [],
  33121. messageSends: ["visitDagNodeVariantSimple:"]
  33122. }),
  33123. $globals.NodeVisitor);
  33124. $core.addMethod(
  33125. $core.method({
  33126. selector: "visitDynamicArrayNode:",
  33127. protocol: 'visiting',
  33128. fn: function (aNode){
  33129. var self=this;
  33130. return $core.withContext(function($ctx1) {
  33131. return self._visitDagNode_(aNode);
  33132. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  33133. },
  33134. args: ["aNode"],
  33135. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33136. referencedClasses: [],
  33137. messageSends: ["visitDagNode:"]
  33138. }),
  33139. $globals.NodeVisitor);
  33140. $core.addMethod(
  33141. $core.method({
  33142. selector: "visitDynamicDictionaryNode:",
  33143. protocol: 'visiting',
  33144. fn: function (aNode){
  33145. var self=this;
  33146. return $core.withContext(function($ctx1) {
  33147. return self._visitDagNode_(aNode);
  33148. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  33149. },
  33150. args: ["aNode"],
  33151. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33152. referencedClasses: [],
  33153. messageSends: ["visitDagNode:"]
  33154. }),
  33155. $globals.NodeVisitor);
  33156. $core.addMethod(
  33157. $core.method({
  33158. selector: "visitJSStatementNode:",
  33159. protocol: 'visiting',
  33160. fn: function (aNode){
  33161. var self=this;
  33162. return $core.withContext(function($ctx1) {
  33163. return self._visitDagNode_(aNode);
  33164. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  33165. },
  33166. args: ["aNode"],
  33167. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33168. referencedClasses: [],
  33169. messageSends: ["visitDagNode:"]
  33170. }),
  33171. $globals.NodeVisitor);
  33172. $core.addMethod(
  33173. $core.method({
  33174. selector: "visitMethodNode:",
  33175. protocol: 'visiting',
  33176. fn: function (aNode){
  33177. var self=this;
  33178. return $core.withContext(function($ctx1) {
  33179. return self._visitDagNode_(aNode);
  33180. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  33181. },
  33182. args: ["aNode"],
  33183. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33184. referencedClasses: [],
  33185. messageSends: ["visitDagNode:"]
  33186. }),
  33187. $globals.NodeVisitor);
  33188. $core.addMethod(
  33189. $core.method({
  33190. selector: "visitReturnNode:",
  33191. protocol: 'visiting',
  33192. fn: function (aNode){
  33193. var self=this;
  33194. return $core.withContext(function($ctx1) {
  33195. return self._visitDagNode_(aNode);
  33196. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  33197. },
  33198. args: ["aNode"],
  33199. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33200. referencedClasses: [],
  33201. messageSends: ["visitDagNode:"]
  33202. }),
  33203. $globals.NodeVisitor);
  33204. $core.addMethod(
  33205. $core.method({
  33206. selector: "visitSendNode:",
  33207. protocol: 'visiting',
  33208. fn: function (aNode){
  33209. var self=this;
  33210. return $core.withContext(function($ctx1) {
  33211. return self._visitDagNode_(aNode);
  33212. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  33213. },
  33214. args: ["aNode"],
  33215. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33216. referencedClasses: [],
  33217. messageSends: ["visitDagNode:"]
  33218. }),
  33219. $globals.NodeVisitor);
  33220. $core.addMethod(
  33221. $core.method({
  33222. selector: "visitSequenceNode:",
  33223. protocol: 'visiting',
  33224. fn: function (aNode){
  33225. var self=this;
  33226. return $core.withContext(function($ctx1) {
  33227. return self._visitDagNode_(aNode);
  33228. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  33229. },
  33230. args: ["aNode"],
  33231. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33232. referencedClasses: [],
  33233. messageSends: ["visitDagNode:"]
  33234. }),
  33235. $globals.NodeVisitor);
  33236. $core.addMethod(
  33237. $core.method({
  33238. selector: "visitValueNode:",
  33239. protocol: 'visiting',
  33240. fn: function (aNode){
  33241. var self=this;
  33242. return $core.withContext(function($ctx1) {
  33243. return self._visitDagNode_(aNode);
  33244. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  33245. },
  33246. args: ["aNode"],
  33247. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33248. referencedClasses: [],
  33249. messageSends: ["visitDagNode:"]
  33250. }),
  33251. $globals.NodeVisitor);
  33252. $core.addMethod(
  33253. $core.method({
  33254. selector: "visitVariableNode:",
  33255. protocol: 'visiting',
  33256. fn: function (aNode){
  33257. var self=this;
  33258. return $core.withContext(function($ctx1) {
  33259. return self._visitDagNode_(aNode);
  33260. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  33261. },
  33262. args: ["aNode"],
  33263. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33264. referencedClasses: [],
  33265. messageSends: ["visitDagNode:"]
  33266. }),
  33267. $globals.NodeVisitor);
  33268. $core.addMethod(
  33269. $core.method({
  33270. selector: "ast",
  33271. protocol: '*Compiler-AST',
  33272. fn: function (){
  33273. var self=this;
  33274. return $core.withContext(function($ctx1) {
  33275. var $1;
  33276. $1=self._source();
  33277. $ctx1.sendIdx["source"]=1;
  33278. $recv($1)._ifEmpty_((function(){
  33279. return $core.withContext(function($ctx2) {
  33280. return self._error_("Method source is empty");
  33281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33282. }));
  33283. return $recv($globals.Smalltalk)._parse_(self._source());
  33284. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  33285. },
  33286. args: [],
  33287. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  33288. referencedClasses: ["Smalltalk"],
  33289. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  33290. }),
  33291. $globals.CompiledMethod);
  33292. });
  33293. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  33294. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  33295. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33296. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  33297. $core.addPackage('Compiler-Semantic');
  33298. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  33299. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33300. $core.addClass('LexicalScope', $globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  33301. $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.";
  33302. $core.addMethod(
  33303. $core.method({
  33304. selector: "addArg:",
  33305. protocol: 'adding',
  33306. fn: function (aString){
  33307. var self=this;
  33308. return $core.withContext(function($ctx1) {
  33309. var $1;
  33310. $1=self._args();
  33311. $ctx1.sendIdx["args"]=1;
  33312. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  33313. $recv($recv(self._args())._at_(aString))._scope_(self);
  33314. return self;
  33315. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  33316. },
  33317. args: ["aString"],
  33318. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  33319. referencedClasses: ["ArgVar"],
  33320. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  33321. }),
  33322. $globals.LexicalScope);
  33323. $core.addMethod(
  33324. $core.method({
  33325. selector: "addTemp:",
  33326. protocol: 'adding',
  33327. fn: function (aString){
  33328. var self=this;
  33329. return $core.withContext(function($ctx1) {
  33330. var $1;
  33331. $1=self._temps();
  33332. $ctx1.sendIdx["temps"]=1;
  33333. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  33334. $recv($recv(self._temps())._at_(aString))._scope_(self);
  33335. return self;
  33336. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  33337. },
  33338. args: ["aString"],
  33339. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  33340. referencedClasses: ["TempVar"],
  33341. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  33342. }),
  33343. $globals.LexicalScope);
  33344. $core.addMethod(
  33345. $core.method({
  33346. selector: "alias",
  33347. protocol: 'accessing',
  33348. fn: function (){
  33349. var self=this;
  33350. return $core.withContext(function($ctx1) {
  33351. return "$ctx".__comma($recv(self._scopeLevel())._asString());
  33352. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  33353. },
  33354. args: [],
  33355. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  33356. referencedClasses: [],
  33357. messageSends: [",", "asString", "scopeLevel"]
  33358. }),
  33359. $globals.LexicalScope);
  33360. $core.addMethod(
  33361. $core.method({
  33362. selector: "allVariableNames",
  33363. protocol: 'accessing',
  33364. fn: function (){
  33365. var self=this;
  33366. return $core.withContext(function($ctx1) {
  33367. var $1;
  33368. $1=$recv(self._args())._keys();
  33369. $ctx1.sendIdx["keys"]=1;
  33370. return $recv($1).__comma($recv(self._temps())._keys());
  33371. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  33372. },
  33373. args: [],
  33374. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  33375. referencedClasses: [],
  33376. messageSends: [",", "keys", "args", "temps"]
  33377. }),
  33378. $globals.LexicalScope);
  33379. $core.addMethod(
  33380. $core.method({
  33381. selector: "args",
  33382. protocol: 'accessing',
  33383. fn: function (){
  33384. var self=this;
  33385. return $core.withContext(function($ctx1) {
  33386. var $1,$receiver;
  33387. $1=self["@args"];
  33388. if(($receiver = $1) == null || $receiver.isNil){
  33389. self["@args"]=$recv($globals.Dictionary)._new();
  33390. return self["@args"];
  33391. } else {
  33392. return $1;
  33393. };
  33394. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  33395. },
  33396. args: [],
  33397. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  33398. referencedClasses: ["Dictionary"],
  33399. messageSends: ["ifNil:", "new"]
  33400. }),
  33401. $globals.LexicalScope);
  33402. $core.addMethod(
  33403. $core.method({
  33404. selector: "bindingFor:",
  33405. protocol: 'accessing',
  33406. fn: function (aStringOrNode){
  33407. var self=this;
  33408. return $core.withContext(function($ctx1) {
  33409. var $2,$3,$4,$5,$1;
  33410. $2=self._pseudoVars();
  33411. $3=$recv(aStringOrNode)._value();
  33412. $ctx1.sendIdx["value"]=1;
  33413. $1=$recv($2)._at_ifAbsent_($3,(function(){
  33414. return $core.withContext(function($ctx2) {
  33415. $4=self._args();
  33416. $5=$recv(aStringOrNode)._value();
  33417. $ctx2.sendIdx["value"]=2;
  33418. return $recv($4)._at_ifAbsent_($5,(function(){
  33419. return $core.withContext(function($ctx3) {
  33420. return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  33421. return nil;
  33422. }));
  33423. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33424. }));
  33425. $ctx2.sendIdx["at:ifAbsent:"]=2;
  33426. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33427. }));
  33428. $ctx1.sendIdx["at:ifAbsent:"]=1;
  33429. return $1;
  33430. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  33431. },
  33432. args: ["aStringOrNode"],
  33433. 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 ]]]",
  33434. referencedClasses: [],
  33435. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  33436. }),
  33437. $globals.LexicalScope);
  33438. $core.addMethod(
  33439. $core.method({
  33440. selector: "blockIndex",
  33441. protocol: 'accessing',
  33442. fn: function (){
  33443. var self=this;
  33444. return $core.withContext(function($ctx1) {
  33445. var $1,$receiver;
  33446. $1=self["@blockIndex"];
  33447. if(($receiver = $1) == null || $receiver.isNil){
  33448. return (0);
  33449. } else {
  33450. return $1;
  33451. };
  33452. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  33453. },
  33454. args: [],
  33455. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  33456. referencedClasses: [],
  33457. messageSends: ["ifNil:"]
  33458. }),
  33459. $globals.LexicalScope);
  33460. $core.addMethod(
  33461. $core.method({
  33462. selector: "blockIndex:",
  33463. protocol: 'accessing',
  33464. fn: function (anInteger){
  33465. var self=this;
  33466. self["@blockIndex"]=anInteger;
  33467. return self;
  33468. },
  33469. args: ["anInteger"],
  33470. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  33471. referencedClasses: [],
  33472. messageSends: []
  33473. }),
  33474. $globals.LexicalScope);
  33475. $core.addMethod(
  33476. $core.method({
  33477. selector: "canInlineNonLocalReturns",
  33478. protocol: 'testing',
  33479. fn: function (){
  33480. var self=this;
  33481. return $core.withContext(function($ctx1) {
  33482. return $recv(self._isInlined())._and_((function(){
  33483. return $core.withContext(function($ctx2) {
  33484. return $recv(self._outerScope())._canInlineNonLocalReturns();
  33485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33486. }));
  33487. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  33488. },
  33489. args: [],
  33490. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  33491. referencedClasses: [],
  33492. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  33493. }),
  33494. $globals.LexicalScope);
  33495. $core.addMethod(
  33496. $core.method({
  33497. selector: "instruction",
  33498. protocol: 'accessing',
  33499. fn: function (){
  33500. var self=this;
  33501. return self["@instruction"];
  33502. },
  33503. args: [],
  33504. source: "instruction\x0a\x09^ instruction",
  33505. referencedClasses: [],
  33506. messageSends: []
  33507. }),
  33508. $globals.LexicalScope);
  33509. $core.addMethod(
  33510. $core.method({
  33511. selector: "instruction:",
  33512. protocol: 'accessing',
  33513. fn: function (anIRInstruction){
  33514. var self=this;
  33515. self["@instruction"]=anIRInstruction;
  33516. return self;
  33517. },
  33518. args: ["anIRInstruction"],
  33519. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  33520. referencedClasses: [],
  33521. messageSends: []
  33522. }),
  33523. $globals.LexicalScope);
  33524. $core.addMethod(
  33525. $core.method({
  33526. selector: "isBlockScope",
  33527. protocol: 'testing',
  33528. fn: function (){
  33529. var self=this;
  33530. return $core.withContext(function($ctx1) {
  33531. return $recv(self._isMethodScope())._not();
  33532. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  33533. },
  33534. args: [],
  33535. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  33536. referencedClasses: [],
  33537. messageSends: ["not", "isMethodScope"]
  33538. }),
  33539. $globals.LexicalScope);
  33540. $core.addMethod(
  33541. $core.method({
  33542. selector: "isInlined",
  33543. protocol: 'testing',
  33544. fn: function (){
  33545. var self=this;
  33546. return $core.withContext(function($ctx1) {
  33547. var $2,$1;
  33548. $2=self._instruction();
  33549. $ctx1.sendIdx["instruction"]=1;
  33550. $1=$recv($2)._notNil();
  33551. return $recv($1)._and_((function(){
  33552. return $core.withContext(function($ctx2) {
  33553. return $recv(self._instruction())._isInlined();
  33554. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33555. }));
  33556. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  33557. },
  33558. args: [],
  33559. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  33560. referencedClasses: [],
  33561. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  33562. }),
  33563. $globals.LexicalScope);
  33564. $core.addMethod(
  33565. $core.method({
  33566. selector: "isMethodScope",
  33567. protocol: 'testing',
  33568. fn: function (){
  33569. var self=this;
  33570. return false;
  33571. },
  33572. args: [],
  33573. source: "isMethodScope\x0a\x09^ false",
  33574. referencedClasses: [],
  33575. messageSends: []
  33576. }),
  33577. $globals.LexicalScope);
  33578. $core.addMethod(
  33579. $core.method({
  33580. selector: "lookupVariable:",
  33581. protocol: 'accessing',
  33582. fn: function (aNode){
  33583. var self=this;
  33584. var lookup;
  33585. return $core.withContext(function($ctx1) {
  33586. var $1,$2,$receiver;
  33587. lookup=self._bindingFor_(aNode);
  33588. $1=lookup;
  33589. if(($receiver = $1) == null || $receiver.isNil){
  33590. $2=self._outerScope();
  33591. $ctx1.sendIdx["outerScope"]=1;
  33592. if(($receiver = $2) == null || $receiver.isNil){
  33593. lookup=$2;
  33594. } else {
  33595. lookup=$recv(self._outerScope())._lookupVariable_(aNode);
  33596. };
  33597. lookup;
  33598. } else {
  33599. $1;
  33600. };
  33601. return lookup;
  33602. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  33603. },
  33604. args: ["aNode"],
  33605. 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",
  33606. referencedClasses: [],
  33607. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  33608. }),
  33609. $globals.LexicalScope);
  33610. $core.addMethod(
  33611. $core.method({
  33612. selector: "methodScope",
  33613. protocol: 'accessing',
  33614. fn: function (){
  33615. var self=this;
  33616. return $core.withContext(function($ctx1) {
  33617. var $1,$receiver;
  33618. $1=self._outerScope();
  33619. $ctx1.sendIdx["outerScope"]=1;
  33620. if(($receiver = $1) == null || $receiver.isNil){
  33621. return $1;
  33622. } else {
  33623. return $recv(self._outerScope())._methodScope();
  33624. };
  33625. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  33626. },
  33627. args: [],
  33628. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  33629. referencedClasses: [],
  33630. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  33631. }),
  33632. $globals.LexicalScope);
  33633. $core.addMethod(
  33634. $core.method({
  33635. selector: "node",
  33636. protocol: 'accessing',
  33637. fn: function (){
  33638. var self=this;
  33639. return self["@node"];
  33640. },
  33641. args: [],
  33642. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  33643. referencedClasses: [],
  33644. messageSends: []
  33645. }),
  33646. $globals.LexicalScope);
  33647. $core.addMethod(
  33648. $core.method({
  33649. selector: "node:",
  33650. protocol: 'accessing',
  33651. fn: function (aNode){
  33652. var self=this;
  33653. self["@node"]=aNode;
  33654. return self;
  33655. },
  33656. args: ["aNode"],
  33657. source: "node: aNode\x0a\x09node := aNode",
  33658. referencedClasses: [],
  33659. messageSends: []
  33660. }),
  33661. $globals.LexicalScope);
  33662. $core.addMethod(
  33663. $core.method({
  33664. selector: "outerScope",
  33665. protocol: 'accessing',
  33666. fn: function (){
  33667. var self=this;
  33668. return self["@outerScope"];
  33669. },
  33670. args: [],
  33671. source: "outerScope\x0a\x09^ outerScope",
  33672. referencedClasses: [],
  33673. messageSends: []
  33674. }),
  33675. $globals.LexicalScope);
  33676. $core.addMethod(
  33677. $core.method({
  33678. selector: "outerScope:",
  33679. protocol: 'accessing',
  33680. fn: function (aLexicalScope){
  33681. var self=this;
  33682. self["@outerScope"]=aLexicalScope;
  33683. return self;
  33684. },
  33685. args: ["aLexicalScope"],
  33686. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  33687. referencedClasses: [],
  33688. messageSends: []
  33689. }),
  33690. $globals.LexicalScope);
  33691. $core.addMethod(
  33692. $core.method({
  33693. selector: "pseudoVars",
  33694. protocol: 'accessing',
  33695. fn: function (){
  33696. var self=this;
  33697. return $core.withContext(function($ctx1) {
  33698. return $recv(self._methodScope())._pseudoVars();
  33699. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  33700. },
  33701. args: [],
  33702. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  33703. referencedClasses: [],
  33704. messageSends: ["pseudoVars", "methodScope"]
  33705. }),
  33706. $globals.LexicalScope);
  33707. $core.addMethod(
  33708. $core.method({
  33709. selector: "scopeLevel",
  33710. protocol: 'accessing',
  33711. fn: function (){
  33712. var self=this;
  33713. return $core.withContext(function($ctx1) {
  33714. var $1,$2,$4,$3,$receiver;
  33715. $1=self._outerScope();
  33716. $ctx1.sendIdx["outerScope"]=1;
  33717. if(($receiver = $1) == null || $receiver.isNil){
  33718. return (1);
  33719. } else {
  33720. $1;
  33721. };
  33722. $2=self._isInlined();
  33723. if($core.assert($2)){
  33724. $4=self._outerScope();
  33725. $ctx1.sendIdx["outerScope"]=2;
  33726. $3=$recv($4)._scopeLevel();
  33727. $ctx1.sendIdx["scopeLevel"]=1;
  33728. return $3;
  33729. };
  33730. return $recv($recv(self._outerScope())._scopeLevel()).__plus((1));
  33731. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  33732. },
  33733. args: [],
  33734. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  33735. referencedClasses: [],
  33736. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  33737. }),
  33738. $globals.LexicalScope);
  33739. $core.addMethod(
  33740. $core.method({
  33741. selector: "temps",
  33742. protocol: 'accessing',
  33743. fn: function (){
  33744. var self=this;
  33745. return $core.withContext(function($ctx1) {
  33746. var $1,$receiver;
  33747. $1=self["@temps"];
  33748. if(($receiver = $1) == null || $receiver.isNil){
  33749. self["@temps"]=$recv($globals.Dictionary)._new();
  33750. return self["@temps"];
  33751. } else {
  33752. return $1;
  33753. };
  33754. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  33755. },
  33756. args: [],
  33757. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  33758. referencedClasses: ["Dictionary"],
  33759. messageSends: ["ifNil:", "new"]
  33760. }),
  33761. $globals.LexicalScope);
  33762. $core.addClass('MethodLexicalScope', $globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  33763. $globals.MethodLexicalScope.comment="I represent a method scope.";
  33764. $core.addMethod(
  33765. $core.method({
  33766. selector: "addIVar:",
  33767. protocol: 'adding',
  33768. fn: function (aString){
  33769. var self=this;
  33770. return $core.withContext(function($ctx1) {
  33771. var $1;
  33772. $1=self._iVars();
  33773. $ctx1.sendIdx["iVars"]=1;
  33774. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  33775. $recv($recv(self._iVars())._at_(aString))._scope_(self);
  33776. return self;
  33777. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  33778. },
  33779. args: ["aString"],
  33780. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  33781. referencedClasses: ["InstanceVar"],
  33782. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  33783. }),
  33784. $globals.MethodLexicalScope);
  33785. $core.addMethod(
  33786. $core.method({
  33787. selector: "addNonLocalReturn:",
  33788. protocol: 'adding',
  33789. fn: function (aScope){
  33790. var self=this;
  33791. return $core.withContext(function($ctx1) {
  33792. $recv(self._nonLocalReturns())._add_(aScope);
  33793. return self;
  33794. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  33795. },
  33796. args: ["aScope"],
  33797. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  33798. referencedClasses: [],
  33799. messageSends: ["add:", "nonLocalReturns"]
  33800. }),
  33801. $globals.MethodLexicalScope);
  33802. $core.addMethod(
  33803. $core.method({
  33804. selector: "allVariableNames",
  33805. protocol: 'accessing',
  33806. fn: function (){
  33807. var self=this;
  33808. return $core.withContext(function($ctx1) {
  33809. var $1;
  33810. $1=(
  33811. $ctx1.supercall = true,
  33812. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($recv(self), []));
  33813. $ctx1.supercall = false;
  33814. return $recv($1).__comma($recv(self._iVars())._keys());
  33815. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  33816. },
  33817. args: [],
  33818. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  33819. referencedClasses: [],
  33820. messageSends: [",", "allVariableNames", "keys", "iVars"]
  33821. }),
  33822. $globals.MethodLexicalScope);
  33823. $core.addMethod(
  33824. $core.method({
  33825. selector: "bindingFor:",
  33826. protocol: 'accessing',
  33827. fn: function (aNode){
  33828. var self=this;
  33829. return $core.withContext(function($ctx1) {
  33830. var $1,$receiver;
  33831. $1=(
  33832. $ctx1.supercall = true,
  33833. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($recv(self), [aNode]));
  33834. $ctx1.supercall = false;
  33835. if(($receiver = $1) == null || $receiver.isNil){
  33836. return $recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  33837. return nil;
  33838. }));
  33839. } else {
  33840. return $1;
  33841. };
  33842. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  33843. },
  33844. args: ["aNode"],
  33845. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  33846. referencedClasses: [],
  33847. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  33848. }),
  33849. $globals.MethodLexicalScope);
  33850. $core.addMethod(
  33851. $core.method({
  33852. selector: "canInlineNonLocalReturns",
  33853. protocol: 'testing',
  33854. fn: function (){
  33855. var self=this;
  33856. return true;
  33857. },
  33858. args: [],
  33859. source: "canInlineNonLocalReturns\x0a\x09^ true",
  33860. referencedClasses: [],
  33861. messageSends: []
  33862. }),
  33863. $globals.MethodLexicalScope);
  33864. $core.addMethod(
  33865. $core.method({
  33866. selector: "hasLocalReturn",
  33867. protocol: 'testing',
  33868. fn: function (){
  33869. var self=this;
  33870. return $core.withContext(function($ctx1) {
  33871. return self._localReturn();
  33872. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  33873. },
  33874. args: [],
  33875. source: "hasLocalReturn\x0a\x09^ self localReturn",
  33876. referencedClasses: [],
  33877. messageSends: ["localReturn"]
  33878. }),
  33879. $globals.MethodLexicalScope);
  33880. $core.addMethod(
  33881. $core.method({
  33882. selector: "hasNonLocalReturn",
  33883. protocol: 'testing',
  33884. fn: function (){
  33885. var self=this;
  33886. return $core.withContext(function($ctx1) {
  33887. return $recv(self._nonLocalReturns())._notEmpty();
  33888. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  33889. },
  33890. args: [],
  33891. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  33892. referencedClasses: [],
  33893. messageSends: ["notEmpty", "nonLocalReturns"]
  33894. }),
  33895. $globals.MethodLexicalScope);
  33896. $core.addMethod(
  33897. $core.method({
  33898. selector: "iVars",
  33899. protocol: 'accessing',
  33900. fn: function (){
  33901. var self=this;
  33902. return $core.withContext(function($ctx1) {
  33903. var $1,$receiver;
  33904. $1=self["@iVars"];
  33905. if(($receiver = $1) == null || $receiver.isNil){
  33906. self["@iVars"]=$recv($globals.Dictionary)._new();
  33907. return self["@iVars"];
  33908. } else {
  33909. return $1;
  33910. };
  33911. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  33912. },
  33913. args: [],
  33914. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  33915. referencedClasses: ["Dictionary"],
  33916. messageSends: ["ifNil:", "new"]
  33917. }),
  33918. $globals.MethodLexicalScope);
  33919. $core.addMethod(
  33920. $core.method({
  33921. selector: "isMethodScope",
  33922. protocol: 'testing',
  33923. fn: function (){
  33924. var self=this;
  33925. return true;
  33926. },
  33927. args: [],
  33928. source: "isMethodScope\x0a\x09^ true",
  33929. referencedClasses: [],
  33930. messageSends: []
  33931. }),
  33932. $globals.MethodLexicalScope);
  33933. $core.addMethod(
  33934. $core.method({
  33935. selector: "localReturn",
  33936. protocol: 'accessing',
  33937. fn: function (){
  33938. var self=this;
  33939. return $core.withContext(function($ctx1) {
  33940. var $1,$receiver;
  33941. $1=self["@localReturn"];
  33942. if(($receiver = $1) == null || $receiver.isNil){
  33943. return false;
  33944. } else {
  33945. return $1;
  33946. };
  33947. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  33948. },
  33949. args: [],
  33950. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  33951. referencedClasses: [],
  33952. messageSends: ["ifNil:"]
  33953. }),
  33954. $globals.MethodLexicalScope);
  33955. $core.addMethod(
  33956. $core.method({
  33957. selector: "localReturn:",
  33958. protocol: 'accessing',
  33959. fn: function (aBoolean){
  33960. var self=this;
  33961. self["@localReturn"]=aBoolean;
  33962. return self;
  33963. },
  33964. args: ["aBoolean"],
  33965. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  33966. referencedClasses: [],
  33967. messageSends: []
  33968. }),
  33969. $globals.MethodLexicalScope);
  33970. $core.addMethod(
  33971. $core.method({
  33972. selector: "methodScope",
  33973. protocol: 'accessing',
  33974. fn: function (){
  33975. var self=this;
  33976. return self;
  33977. },
  33978. args: [],
  33979. source: "methodScope\x0a\x09^ self",
  33980. referencedClasses: [],
  33981. messageSends: []
  33982. }),
  33983. $globals.MethodLexicalScope);
  33984. $core.addMethod(
  33985. $core.method({
  33986. selector: "nonLocalReturns",
  33987. protocol: 'accessing',
  33988. fn: function (){
  33989. var self=this;
  33990. return $core.withContext(function($ctx1) {
  33991. var $1,$receiver;
  33992. $1=self["@nonLocalReturns"];
  33993. if(($receiver = $1) == null || $receiver.isNil){
  33994. self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  33995. return self["@nonLocalReturns"];
  33996. } else {
  33997. return $1;
  33998. };
  33999. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  34000. },
  34001. args: [],
  34002. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  34003. referencedClasses: ["OrderedCollection"],
  34004. messageSends: ["ifNil:", "new"]
  34005. }),
  34006. $globals.MethodLexicalScope);
  34007. $core.addMethod(
  34008. $core.method({
  34009. selector: "pseudoVars",
  34010. protocol: 'accessing',
  34011. fn: function (){
  34012. var self=this;
  34013. return $core.withContext(function($ctx1) {
  34014. var $1,$2,$4,$3,$receiver;
  34015. $1=self["@pseudoVars"];
  34016. if(($receiver = $1) == null || $receiver.isNil){
  34017. self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  34018. self["@pseudoVars"];
  34019. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  34020. return $core.withContext(function($ctx2) {
  34021. $2=self["@pseudoVars"];
  34022. $4=$recv($globals.PseudoVar)._on_(each);
  34023. $recv($4)._scope_(self._methodScope());
  34024. $3=$recv($4)._yourself();
  34025. return $recv($2)._at_put_(each,$3);
  34026. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  34027. }));
  34028. } else {
  34029. $1;
  34030. };
  34031. return self["@pseudoVars"];
  34032. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  34033. },
  34034. args: [],
  34035. 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",
  34036. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  34037. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  34038. }),
  34039. $globals.MethodLexicalScope);
  34040. $core.addMethod(
  34041. $core.method({
  34042. selector: "removeNonLocalReturn:",
  34043. protocol: 'adding',
  34044. fn: function (aScope){
  34045. var self=this;
  34046. return $core.withContext(function($ctx1) {
  34047. $recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  34048. }));
  34049. return self;
  34050. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  34051. },
  34052. args: ["aScope"],
  34053. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  34054. referencedClasses: [],
  34055. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  34056. }),
  34057. $globals.MethodLexicalScope);
  34058. $core.addMethod(
  34059. $core.method({
  34060. selector: "unknownVariables",
  34061. protocol: 'accessing',
  34062. fn: function (){
  34063. var self=this;
  34064. return $core.withContext(function($ctx1) {
  34065. var $1,$receiver;
  34066. $1=self["@unknownVariables"];
  34067. if(($receiver = $1) == null || $receiver.isNil){
  34068. self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  34069. return self["@unknownVariables"];
  34070. } else {
  34071. return $1;
  34072. };
  34073. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  34074. },
  34075. args: [],
  34076. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  34077. referencedClasses: ["OrderedCollection"],
  34078. messageSends: ["ifNil:", "new"]
  34079. }),
  34080. $globals.MethodLexicalScope);
  34081. $core.addClass('ScopeVar', $globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  34082. $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.";
  34083. $core.addMethod(
  34084. $core.method({
  34085. selector: "alias",
  34086. protocol: 'accessing',
  34087. fn: function (){
  34088. var self=this;
  34089. return $core.withContext(function($ctx1) {
  34090. return $recv(self._name())._asVariableName();
  34091. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  34092. },
  34093. args: [],
  34094. source: "alias\x0a\x09^ self name asVariableName",
  34095. referencedClasses: [],
  34096. messageSends: ["asVariableName", "name"]
  34097. }),
  34098. $globals.ScopeVar);
  34099. $core.addMethod(
  34100. $core.method({
  34101. selector: "isArgVar",
  34102. protocol: 'testing',
  34103. fn: function (){
  34104. var self=this;
  34105. return false;
  34106. },
  34107. args: [],
  34108. source: "isArgVar\x0a\x09^ false",
  34109. referencedClasses: [],
  34110. messageSends: []
  34111. }),
  34112. $globals.ScopeVar);
  34113. $core.addMethod(
  34114. $core.method({
  34115. selector: "isClassRefVar",
  34116. protocol: 'testing',
  34117. fn: function (){
  34118. var self=this;
  34119. return false;
  34120. },
  34121. args: [],
  34122. source: "isClassRefVar\x0a\x09^ false",
  34123. referencedClasses: [],
  34124. messageSends: []
  34125. }),
  34126. $globals.ScopeVar);
  34127. $core.addMethod(
  34128. $core.method({
  34129. selector: "isImmutable",
  34130. protocol: 'testing',
  34131. fn: function (){
  34132. var self=this;
  34133. return false;
  34134. },
  34135. args: [],
  34136. source: "isImmutable\x0a\x09^ false",
  34137. referencedClasses: [],
  34138. messageSends: []
  34139. }),
  34140. $globals.ScopeVar);
  34141. $core.addMethod(
  34142. $core.method({
  34143. selector: "isInstanceVar",
  34144. protocol: 'testing',
  34145. fn: function (){
  34146. var self=this;
  34147. return false;
  34148. },
  34149. args: [],
  34150. source: "isInstanceVar\x0a\x09^ false",
  34151. referencedClasses: [],
  34152. messageSends: []
  34153. }),
  34154. $globals.ScopeVar);
  34155. $core.addMethod(
  34156. $core.method({
  34157. selector: "isPseudoVar",
  34158. protocol: 'testing',
  34159. fn: function (){
  34160. var self=this;
  34161. return false;
  34162. },
  34163. args: [],
  34164. source: "isPseudoVar\x0a\x09^ false",
  34165. referencedClasses: [],
  34166. messageSends: []
  34167. }),
  34168. $globals.ScopeVar);
  34169. $core.addMethod(
  34170. $core.method({
  34171. selector: "isTempVar",
  34172. protocol: 'testing',
  34173. fn: function (){
  34174. var self=this;
  34175. return false;
  34176. },
  34177. args: [],
  34178. source: "isTempVar\x0a\x09^ false",
  34179. referencedClasses: [],
  34180. messageSends: []
  34181. }),
  34182. $globals.ScopeVar);
  34183. $core.addMethod(
  34184. $core.method({
  34185. selector: "isUnknownVar",
  34186. protocol: 'testing',
  34187. fn: function (){
  34188. var self=this;
  34189. return false;
  34190. },
  34191. args: [],
  34192. source: "isUnknownVar\x0a\x09^ false",
  34193. referencedClasses: [],
  34194. messageSends: []
  34195. }),
  34196. $globals.ScopeVar);
  34197. $core.addMethod(
  34198. $core.method({
  34199. selector: "name",
  34200. protocol: 'accessing',
  34201. fn: function (){
  34202. var self=this;
  34203. return self["@name"];
  34204. },
  34205. args: [],
  34206. source: "name\x0a\x09^ name",
  34207. referencedClasses: [],
  34208. messageSends: []
  34209. }),
  34210. $globals.ScopeVar);
  34211. $core.addMethod(
  34212. $core.method({
  34213. selector: "name:",
  34214. protocol: 'accessing',
  34215. fn: function (aString){
  34216. var self=this;
  34217. self["@name"]=aString;
  34218. return self;
  34219. },
  34220. args: ["aString"],
  34221. source: "name: aString\x0a\x09name := aString",
  34222. referencedClasses: [],
  34223. messageSends: []
  34224. }),
  34225. $globals.ScopeVar);
  34226. $core.addMethod(
  34227. $core.method({
  34228. selector: "scope",
  34229. protocol: 'accessing',
  34230. fn: function (){
  34231. var self=this;
  34232. return self["@scope"];
  34233. },
  34234. args: [],
  34235. source: "scope\x0a\x09^ scope",
  34236. referencedClasses: [],
  34237. messageSends: []
  34238. }),
  34239. $globals.ScopeVar);
  34240. $core.addMethod(
  34241. $core.method({
  34242. selector: "scope:",
  34243. protocol: 'accessing',
  34244. fn: function (aScope){
  34245. var self=this;
  34246. self["@scope"]=aScope;
  34247. return self;
  34248. },
  34249. args: ["aScope"],
  34250. source: "scope: aScope\x0a\x09scope := aScope",
  34251. referencedClasses: [],
  34252. messageSends: []
  34253. }),
  34254. $globals.ScopeVar);
  34255. $core.addMethod(
  34256. $core.method({
  34257. selector: "validateAssignment",
  34258. protocol: 'testing',
  34259. fn: function (){
  34260. var self=this;
  34261. return $core.withContext(function($ctx1) {
  34262. var $1,$2;
  34263. $1=$recv(self._isArgVar())._or_((function(){
  34264. return $core.withContext(function($ctx2) {
  34265. return self._isPseudoVar();
  34266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34267. }));
  34268. if($core.assert($1)){
  34269. $2=$recv($globals.InvalidAssignmentError)._new();
  34270. $recv($2)._variableName_(self._name());
  34271. $recv($2)._signal();
  34272. };
  34273. return self;
  34274. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  34275. },
  34276. args: [],
  34277. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  34278. referencedClasses: ["InvalidAssignmentError"],
  34279. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  34280. }),
  34281. $globals.ScopeVar);
  34282. $core.addMethod(
  34283. $core.method({
  34284. selector: "on:",
  34285. protocol: 'instance creation',
  34286. fn: function (aString){
  34287. var self=this;
  34288. return $core.withContext(function($ctx1) {
  34289. var $1;
  34290. $1=self._new();
  34291. $recv($1)._name_(aString);
  34292. return $recv($1)._yourself();
  34293. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)});
  34294. },
  34295. args: ["aString"],
  34296. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  34297. referencedClasses: [],
  34298. messageSends: ["name:", "new", "yourself"]
  34299. }),
  34300. $globals.ScopeVar.klass);
  34301. $core.addClass('AliasVar', $globals.ScopeVar, ['node'], 'Compiler-Semantic');
  34302. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  34303. $core.addMethod(
  34304. $core.method({
  34305. selector: "isImmutable",
  34306. protocol: 'testing',
  34307. fn: function (){
  34308. var self=this;
  34309. return true;
  34310. },
  34311. args: [],
  34312. source: "isImmutable\x0a\x09^ true",
  34313. referencedClasses: [],
  34314. messageSends: []
  34315. }),
  34316. $globals.AliasVar);
  34317. $core.addMethod(
  34318. $core.method({
  34319. selector: "node",
  34320. protocol: 'accessing',
  34321. fn: function (){
  34322. var self=this;
  34323. return self["@node"];
  34324. },
  34325. args: [],
  34326. source: "node\x0a\x09^ node",
  34327. referencedClasses: [],
  34328. messageSends: []
  34329. }),
  34330. $globals.AliasVar);
  34331. $core.addMethod(
  34332. $core.method({
  34333. selector: "node:",
  34334. protocol: 'accessing',
  34335. fn: function (aNode){
  34336. var self=this;
  34337. self["@node"]=aNode;
  34338. return self;
  34339. },
  34340. args: ["aNode"],
  34341. source: "node: aNode\x0a\x09node := aNode",
  34342. referencedClasses: [],
  34343. messageSends: []
  34344. }),
  34345. $globals.AliasVar);
  34346. $core.addClass('ArgVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34347. $globals.ArgVar.comment="I am an argument of a method or block.";
  34348. $core.addMethod(
  34349. $core.method({
  34350. selector: "isArgVar",
  34351. protocol: 'testing',
  34352. fn: function (){
  34353. var self=this;
  34354. return true;
  34355. },
  34356. args: [],
  34357. source: "isArgVar\x0a\x09^ true",
  34358. referencedClasses: [],
  34359. messageSends: []
  34360. }),
  34361. $globals.ArgVar);
  34362. $core.addMethod(
  34363. $core.method({
  34364. selector: "isImmutable",
  34365. protocol: 'testing',
  34366. fn: function (){
  34367. var self=this;
  34368. return true;
  34369. },
  34370. args: [],
  34371. source: "isImmutable\x0a\x09^ true",
  34372. referencedClasses: [],
  34373. messageSends: []
  34374. }),
  34375. $globals.ArgVar);
  34376. $core.addClass('ClassRefVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34377. $globals.ClassRefVar.comment="I am an class reference variable";
  34378. $core.addMethod(
  34379. $core.method({
  34380. selector: "alias",
  34381. protocol: 'accessing',
  34382. fn: function (){
  34383. var self=this;
  34384. return $core.withContext(function($ctx1) {
  34385. return "$globals.".__comma(self._name());
  34386. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  34387. },
  34388. args: [],
  34389. 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",
  34390. referencedClasses: [],
  34391. messageSends: [",", "name"]
  34392. }),
  34393. $globals.ClassRefVar);
  34394. $core.addMethod(
  34395. $core.method({
  34396. selector: "isClassRefVar",
  34397. protocol: 'testing',
  34398. fn: function (){
  34399. var self=this;
  34400. return true;
  34401. },
  34402. args: [],
  34403. source: "isClassRefVar\x0a\x09^ true",
  34404. referencedClasses: [],
  34405. messageSends: []
  34406. }),
  34407. $globals.ClassRefVar);
  34408. $core.addMethod(
  34409. $core.method({
  34410. selector: "isImmutable",
  34411. protocol: 'testing',
  34412. fn: function (){
  34413. var self=this;
  34414. return true;
  34415. },
  34416. args: [],
  34417. source: "isImmutable\x0a\x09^ true",
  34418. referencedClasses: [],
  34419. messageSends: []
  34420. }),
  34421. $globals.ClassRefVar);
  34422. $core.addClass('InstanceVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34423. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  34424. $core.addMethod(
  34425. $core.method({
  34426. selector: "alias",
  34427. protocol: 'testing',
  34428. fn: function (){
  34429. var self=this;
  34430. return $core.withContext(function($ctx1) {
  34431. var $1;
  34432. $1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]");
  34433. $ctx1.sendIdx[","]=1;
  34434. return $1;
  34435. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  34436. },
  34437. args: [],
  34438. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  34439. referencedClasses: [],
  34440. messageSends: [",", "name"]
  34441. }),
  34442. $globals.InstanceVar);
  34443. $core.addMethod(
  34444. $core.method({
  34445. selector: "isInstanceVar",
  34446. protocol: 'testing',
  34447. fn: function (){
  34448. var self=this;
  34449. return true;
  34450. },
  34451. args: [],
  34452. source: "isInstanceVar\x0a\x09^ true",
  34453. referencedClasses: [],
  34454. messageSends: []
  34455. }),
  34456. $globals.InstanceVar);
  34457. $core.addClass('PseudoVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34458. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  34459. $core.addMethod(
  34460. $core.method({
  34461. selector: "alias",
  34462. protocol: 'accessing',
  34463. fn: function (){
  34464. var self=this;
  34465. return $core.withContext(function($ctx1) {
  34466. return self._name();
  34467. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  34468. },
  34469. args: [],
  34470. source: "alias\x0a\x09^ self name",
  34471. referencedClasses: [],
  34472. messageSends: ["name"]
  34473. }),
  34474. $globals.PseudoVar);
  34475. $core.addMethod(
  34476. $core.method({
  34477. selector: "isImmutable",
  34478. protocol: 'testing',
  34479. fn: function (){
  34480. var self=this;
  34481. return true;
  34482. },
  34483. args: [],
  34484. source: "isImmutable\x0a\x09^ true",
  34485. referencedClasses: [],
  34486. messageSends: []
  34487. }),
  34488. $globals.PseudoVar);
  34489. $core.addMethod(
  34490. $core.method({
  34491. selector: "isPseudoVar",
  34492. protocol: 'testing',
  34493. fn: function (){
  34494. var self=this;
  34495. return true;
  34496. },
  34497. args: [],
  34498. source: "isPseudoVar\x0a\x09^ true",
  34499. referencedClasses: [],
  34500. messageSends: []
  34501. }),
  34502. $globals.PseudoVar);
  34503. $core.addClass('TempVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34504. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  34505. $core.addMethod(
  34506. $core.method({
  34507. selector: "isTempVar",
  34508. protocol: 'testing',
  34509. fn: function (){
  34510. var self=this;
  34511. return true;
  34512. },
  34513. args: [],
  34514. source: "isTempVar\x0a\x09^ true",
  34515. referencedClasses: [],
  34516. messageSends: []
  34517. }),
  34518. $globals.TempVar);
  34519. $core.addClass('UnknownVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34520. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  34521. $core.addMethod(
  34522. $core.method({
  34523. selector: "isUnknownVar",
  34524. protocol: 'testing',
  34525. fn: function (){
  34526. var self=this;
  34527. return true;
  34528. },
  34529. args: [],
  34530. source: "isUnknownVar\x0a\x09^ true",
  34531. referencedClasses: [],
  34532. messageSends: []
  34533. }),
  34534. $globals.UnknownVar);
  34535. $core.addClass('SemanticAnalyzer', $globals.NodeVisitor, ['currentScope', 'blockIndex', 'thePackage', 'theClass', 'classReferences', 'messageSends'], 'Compiler-Semantic');
  34536. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  34537. $core.addMethod(
  34538. $core.method({
  34539. selector: "classReferences",
  34540. protocol: 'accessing',
  34541. fn: function (){
  34542. var self=this;
  34543. return $core.withContext(function($ctx1) {
  34544. var $1,$receiver;
  34545. $1=self["@classReferences"];
  34546. if(($receiver = $1) == null || $receiver.isNil){
  34547. self["@classReferences"]=$recv($globals.Set)._new();
  34548. return self["@classReferences"];
  34549. } else {
  34550. return $1;
  34551. };
  34552. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  34553. },
  34554. args: [],
  34555. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  34556. referencedClasses: ["Set"],
  34557. messageSends: ["ifNil:", "new"]
  34558. }),
  34559. $globals.SemanticAnalyzer);
  34560. $core.addMethod(
  34561. $core.method({
  34562. selector: "errorShadowingVariable:",
  34563. protocol: 'error handling',
  34564. fn: function (aString){
  34565. var self=this;
  34566. return $core.withContext(function($ctx1) {
  34567. var $1;
  34568. $1=$recv($globals.ShadowingVariableError)._new();
  34569. $recv($1)._variableName_(aString);
  34570. $recv($1)._signal();
  34571. return self;
  34572. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  34573. },
  34574. args: ["aString"],
  34575. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  34576. referencedClasses: ["ShadowingVariableError"],
  34577. messageSends: ["variableName:", "new", "signal"]
  34578. }),
  34579. $globals.SemanticAnalyzer);
  34580. $core.addMethod(
  34581. $core.method({
  34582. selector: "errorUnknownVariable:",
  34583. protocol: 'error handling',
  34584. fn: function (aNode){
  34585. var self=this;
  34586. var identifier;
  34587. return $core.withContext(function($ctx1) {
  34588. var $1,$2,$3;
  34589. identifier=$recv(aNode)._value();
  34590. $ctx1.sendIdx["value"]=1;
  34591. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  34592. return $core.withContext(function($ctx2) {
  34593. return self._isVariableUndefined_inPackage_(identifier,self._thePackage());
  34594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34595. }));
  34596. if($core.assert($1)){
  34597. $2=$recv($globals.UnknownVariableError)._new();
  34598. $3=$recv(aNode)._value();
  34599. $ctx1.sendIdx["value"]=2;
  34600. $recv($2)._variableName_($3);
  34601. $recv($2)._signal();
  34602. } else {
  34603. $recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  34604. };
  34605. return self;
  34606. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  34607. },
  34608. args: ["aNode"],
  34609. 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 ]",
  34610. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  34611. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  34612. }),
  34613. $globals.SemanticAnalyzer);
  34614. $core.addMethod(
  34615. $core.method({
  34616. selector: "isVariableUndefined:inPackage:",
  34617. protocol: 'testing',
  34618. fn: function (aString,aPackage){
  34619. var self=this;
  34620. return $core.withContext(function($ctx1) {
  34621. var $1,$2,$3,$receiver;
  34622. if(($receiver = aPackage) == null || $receiver.isNil){
  34623. aPackage;
  34624. } else {
  34625. var packageKnownVars;
  34626. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  34627. packageKnownVars;
  34628. $1=$recv(packageKnownVars)._includes_(aString);
  34629. if($core.assert($1)){
  34630. return false;
  34631. };
  34632. };
  34633. $2=$recv($globals.Compiler)._new();
  34634. $3=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
  34635. $ctx1.sendIdx[","]=1;
  34636. return $recv($2)._eval_($3);
  34637. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  34638. },
  34639. args: ["aString", "aPackage"],
  34640. 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 new\x0a\x09\x09eval: 'typeof ', aString, ' == \x22undefined\x22'",
  34641. referencedClasses: ["Compiler"],
  34642. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","]
  34643. }),
  34644. $globals.SemanticAnalyzer);
  34645. $core.addMethod(
  34646. $core.method({
  34647. selector: "messageSends",
  34648. protocol: 'accessing',
  34649. fn: function (){
  34650. var self=this;
  34651. return $core.withContext(function($ctx1) {
  34652. var $1,$receiver;
  34653. $1=self["@messageSends"];
  34654. if(($receiver = $1) == null || $receiver.isNil){
  34655. self["@messageSends"]=$recv($globals.Dictionary)._new();
  34656. return self["@messageSends"];
  34657. } else {
  34658. return $1;
  34659. };
  34660. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  34661. },
  34662. args: [],
  34663. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  34664. referencedClasses: ["Dictionary"],
  34665. messageSends: ["ifNil:", "new"]
  34666. }),
  34667. $globals.SemanticAnalyzer);
  34668. $core.addMethod(
  34669. $core.method({
  34670. selector: "newBlockScope",
  34671. protocol: 'factory',
  34672. fn: function (){
  34673. var self=this;
  34674. return $core.withContext(function($ctx1) {
  34675. return self._newScopeOfClass_($globals.LexicalScope);
  34676. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  34677. },
  34678. args: [],
  34679. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  34680. referencedClasses: ["LexicalScope"],
  34681. messageSends: ["newScopeOfClass:"]
  34682. }),
  34683. $globals.SemanticAnalyzer);
  34684. $core.addMethod(
  34685. $core.method({
  34686. selector: "newMethodScope",
  34687. protocol: 'factory',
  34688. fn: function (){
  34689. var self=this;
  34690. return $core.withContext(function($ctx1) {
  34691. return self._newScopeOfClass_($globals.MethodLexicalScope);
  34692. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  34693. },
  34694. args: [],
  34695. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  34696. referencedClasses: ["MethodLexicalScope"],
  34697. messageSends: ["newScopeOfClass:"]
  34698. }),
  34699. $globals.SemanticAnalyzer);
  34700. $core.addMethod(
  34701. $core.method({
  34702. selector: "newScopeOfClass:",
  34703. protocol: 'factory',
  34704. fn: function (aLexicalScopeClass){
  34705. var self=this;
  34706. return $core.withContext(function($ctx1) {
  34707. var $1;
  34708. $1=$recv(aLexicalScopeClass)._new();
  34709. $recv($1)._outerScope_(self["@currentScope"]);
  34710. return $recv($1)._yourself();
  34711. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  34712. },
  34713. args: ["aLexicalScopeClass"],
  34714. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  34715. referencedClasses: [],
  34716. messageSends: ["outerScope:", "new", "yourself"]
  34717. }),
  34718. $globals.SemanticAnalyzer);
  34719. $core.addMethod(
  34720. $core.method({
  34721. selector: "nextBlockIndex",
  34722. protocol: 'private',
  34723. fn: function (){
  34724. var self=this;
  34725. return $core.withContext(function($ctx1) {
  34726. var $1,$receiver;
  34727. $1=self["@blockIndex"];
  34728. if(($receiver = $1) == null || $receiver.isNil){
  34729. self["@blockIndex"]=(0);
  34730. self["@blockIndex"];
  34731. } else {
  34732. $1;
  34733. };
  34734. self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
  34735. return self["@blockIndex"];
  34736. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  34737. },
  34738. args: [],
  34739. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  34740. referencedClasses: [],
  34741. messageSends: ["ifNil:", "+"]
  34742. }),
  34743. $globals.SemanticAnalyzer);
  34744. $core.addMethod(
  34745. $core.method({
  34746. selector: "popScope",
  34747. protocol: 'scope',
  34748. fn: function (){
  34749. var self=this;
  34750. return $core.withContext(function($ctx1) {
  34751. var $1,$receiver;
  34752. $1=self["@currentScope"];
  34753. if(($receiver = $1) == null || $receiver.isNil){
  34754. $1;
  34755. } else {
  34756. self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
  34757. self["@currentScope"];
  34758. };
  34759. return self;
  34760. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  34761. },
  34762. args: [],
  34763. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  34764. referencedClasses: [],
  34765. messageSends: ["ifNotNil:", "outerScope"]
  34766. }),
  34767. $globals.SemanticAnalyzer);
  34768. $core.addMethod(
  34769. $core.method({
  34770. selector: "pushScope:",
  34771. protocol: 'scope',
  34772. fn: function (aScope){
  34773. var self=this;
  34774. return $core.withContext(function($ctx1) {
  34775. $recv(aScope)._outerScope_(self["@currentScope"]);
  34776. self["@currentScope"]=aScope;
  34777. return self;
  34778. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  34779. },
  34780. args: ["aScope"],
  34781. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  34782. referencedClasses: [],
  34783. messageSends: ["outerScope:"]
  34784. }),
  34785. $globals.SemanticAnalyzer);
  34786. $core.addMethod(
  34787. $core.method({
  34788. selector: "theClass",
  34789. protocol: 'accessing',
  34790. fn: function (){
  34791. var self=this;
  34792. return self["@theClass"];
  34793. },
  34794. args: [],
  34795. source: "theClass\x0a\x09^ theClass",
  34796. referencedClasses: [],
  34797. messageSends: []
  34798. }),
  34799. $globals.SemanticAnalyzer);
  34800. $core.addMethod(
  34801. $core.method({
  34802. selector: "theClass:",
  34803. protocol: 'accessing',
  34804. fn: function (aClass){
  34805. var self=this;
  34806. self["@theClass"]=aClass;
  34807. return self;
  34808. },
  34809. args: ["aClass"],
  34810. source: "theClass: aClass\x0a\x09theClass := aClass",
  34811. referencedClasses: [],
  34812. messageSends: []
  34813. }),
  34814. $globals.SemanticAnalyzer);
  34815. $core.addMethod(
  34816. $core.method({
  34817. selector: "thePackage",
  34818. protocol: 'accessing',
  34819. fn: function (){
  34820. var self=this;
  34821. return self["@thePackage"];
  34822. },
  34823. args: [],
  34824. source: "thePackage\x0a\x09^ thePackage",
  34825. referencedClasses: [],
  34826. messageSends: []
  34827. }),
  34828. $globals.SemanticAnalyzer);
  34829. $core.addMethod(
  34830. $core.method({
  34831. selector: "thePackage:",
  34832. protocol: 'accessing',
  34833. fn: function (aPackage){
  34834. var self=this;
  34835. self["@thePackage"]=aPackage;
  34836. return self;
  34837. },
  34838. args: ["aPackage"],
  34839. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  34840. referencedClasses: [],
  34841. messageSends: []
  34842. }),
  34843. $globals.SemanticAnalyzer);
  34844. $core.addMethod(
  34845. $core.method({
  34846. selector: "validateVariableScope:",
  34847. protocol: 'scope',
  34848. fn: function (aString){
  34849. var self=this;
  34850. return $core.withContext(function($ctx1) {
  34851. var $1,$receiver;
  34852. $1=$recv(self["@currentScope"])._lookupVariable_(aString);
  34853. if(($receiver = $1) == null || $receiver.isNil){
  34854. $1;
  34855. } else {
  34856. self._errorShadowingVariable_(aString);
  34857. };
  34858. return self;
  34859. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  34860. },
  34861. args: ["aString"],
  34862. 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 ]",
  34863. referencedClasses: [],
  34864. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  34865. }),
  34866. $globals.SemanticAnalyzer);
  34867. $core.addMethod(
  34868. $core.method({
  34869. selector: "visitAssignmentNode:",
  34870. protocol: 'visiting',
  34871. fn: function (aNode){
  34872. var self=this;
  34873. return $core.withContext(function($ctx1) {
  34874. (
  34875. $ctx1.supercall = true,
  34876. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
  34877. $ctx1.supercall = false;
  34878. $recv($recv(aNode)._left())._beAssigned();
  34879. return self;
  34880. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34881. },
  34882. args: ["aNode"],
  34883. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  34884. referencedClasses: [],
  34885. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  34886. }),
  34887. $globals.SemanticAnalyzer);
  34888. $core.addMethod(
  34889. $core.method({
  34890. selector: "visitBlockNode:",
  34891. protocol: 'visiting',
  34892. fn: function (aNode){
  34893. var self=this;
  34894. return $core.withContext(function($ctx1) {
  34895. self._pushScope_(self._newBlockScope());
  34896. $recv(aNode)._scope_(self["@currentScope"]);
  34897. $recv(self["@currentScope"])._node_(aNode);
  34898. $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  34899. $recv($recv(aNode)._parameters())._do_((function(each){
  34900. return $core.withContext(function($ctx2) {
  34901. self._validateVariableScope_(each);
  34902. return $recv(self["@currentScope"])._addArg_(each);
  34903. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34904. }));
  34905. (
  34906. $ctx1.supercall = true,
  34907. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
  34908. $ctx1.supercall = false;
  34909. self._popScope();
  34910. return self;
  34911. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34912. },
  34913. args: ["aNode"],
  34914. 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",
  34915. referencedClasses: [],
  34916. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  34917. }),
  34918. $globals.SemanticAnalyzer);
  34919. $core.addMethod(
  34920. $core.method({
  34921. selector: "visitCascadeNode:",
  34922. protocol: 'visiting',
  34923. fn: function (aNode){
  34924. var self=this;
  34925. return $core.withContext(function($ctx1) {
  34926. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  34927. (
  34928. $ctx1.supercall = true,
  34929. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
  34930. $ctx1.supercall = false;
  34931. return self;
  34932. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34933. },
  34934. args: ["aNode"],
  34935. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  34936. referencedClasses: [],
  34937. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  34938. }),
  34939. $globals.SemanticAnalyzer);
  34940. $core.addMethod(
  34941. $core.method({
  34942. selector: "visitMethodNode:",
  34943. protocol: 'visiting',
  34944. fn: function (aNode){
  34945. var self=this;
  34946. return $core.withContext(function($ctx1) {
  34947. self._pushScope_(self._newMethodScope());
  34948. $recv(aNode)._scope_(self["@currentScope"]);
  34949. $recv(self["@currentScope"])._node_(aNode);
  34950. $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
  34951. return $core.withContext(function($ctx2) {
  34952. return $recv(self["@currentScope"])._addIVar_(each);
  34953. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34954. }));
  34955. $ctx1.sendIdx["do:"]=1;
  34956. $recv($recv(aNode)._arguments())._do_((function(each){
  34957. return $core.withContext(function($ctx2) {
  34958. self._validateVariableScope_(each);
  34959. return $recv(self["@currentScope"])._addArg_(each);
  34960. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  34961. }));
  34962. (
  34963. $ctx1.supercall = true,
  34964. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
  34965. $ctx1.supercall = false;
  34966. $recv(aNode)._classReferences_(self._classReferences());
  34967. $recv(aNode)._sendIndexes_(self._messageSends());
  34968. self._popScope();
  34969. return self;
  34970. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34971. },
  34972. args: ["aNode"],
  34973. 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",
  34974. referencedClasses: [],
  34975. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  34976. }),
  34977. $globals.SemanticAnalyzer);
  34978. $core.addMethod(
  34979. $core.method({
  34980. selector: "visitReturnNode:",
  34981. protocol: 'visiting',
  34982. fn: function (aNode){
  34983. var self=this;
  34984. return $core.withContext(function($ctx1) {
  34985. var $1;
  34986. $recv(aNode)._scope_(self["@currentScope"]);
  34987. $1=$recv(self["@currentScope"])._isMethodScope();
  34988. if($core.assert($1)){
  34989. $recv(self["@currentScope"])._localReturn_(true);
  34990. } else {
  34991. $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  34992. };
  34993. (
  34994. $ctx1.supercall = true,
  34995. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
  34996. $ctx1.supercall = false;
  34997. return self;
  34998. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34999. },
  35000. args: ["aNode"],
  35001. 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",
  35002. referencedClasses: [],
  35003. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  35004. }),
  35005. $globals.SemanticAnalyzer);
  35006. $core.addMethod(
  35007. $core.method({
  35008. selector: "visitSendNode:",
  35009. protocol: 'visiting',
  35010. fn: function (aNode){
  35011. var self=this;
  35012. var sends;
  35013. return $core.withContext(function($ctx1) {
  35014. sends=$recv(self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  35015. return $core.withContext(function($ctx2) {
  35016. return $recv($globals.OrderedCollection)._new();
  35017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35018. }));
  35019. $recv(sends)._add_(aNode);
  35020. $recv(aNode)._index_($recv(sends)._size());
  35021. (
  35022. $ctx1.supercall = true,
  35023. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  35024. $ctx1.supercall = false;
  35025. return self;
  35026. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  35027. },
  35028. args: ["aNode"],
  35029. 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",
  35030. referencedClasses: ["OrderedCollection"],
  35031. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  35032. }),
  35033. $globals.SemanticAnalyzer);
  35034. $core.addMethod(
  35035. $core.method({
  35036. selector: "visitSequenceNode:",
  35037. protocol: 'visiting',
  35038. fn: function (aNode){
  35039. var self=this;
  35040. return $core.withContext(function($ctx1) {
  35041. $recv($recv(aNode)._temps())._do_((function(each){
  35042. return $core.withContext(function($ctx2) {
  35043. self._validateVariableScope_(each);
  35044. return $recv(self["@currentScope"])._addTemp_(each);
  35045. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35046. }));
  35047. (
  35048. $ctx1.supercall = true,
  35049. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  35050. $ctx1.supercall = false;
  35051. return self;
  35052. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35053. },
  35054. args: ["aNode"],
  35055. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  35056. referencedClasses: [],
  35057. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  35058. }),
  35059. $globals.SemanticAnalyzer);
  35060. $core.addMethod(
  35061. $core.method({
  35062. selector: "visitVariableNode:",
  35063. protocol: 'visiting',
  35064. fn: function (aNode){
  35065. var self=this;
  35066. var binding;
  35067. return $core.withContext(function($ctx1) {
  35068. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  35069. binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
  35070. $1=binding;
  35071. if(($receiver = $1) == null || $receiver.isNil){
  35072. $3=$recv(aNode)._value();
  35073. $ctx1.sendIdx["value"]=1;
  35074. $2=$recv($3)._isCapitalized();
  35075. if($core.assert($2)){
  35076. $4=$recv($globals.ClassRefVar)._new();
  35077. $ctx1.sendIdx["new"]=1;
  35078. $5=$recv(aNode)._value();
  35079. $ctx1.sendIdx["value"]=2;
  35080. $recv($4)._name_($5);
  35081. $ctx1.sendIdx["name:"]=1;
  35082. $6=$recv($4)._yourself();
  35083. $ctx1.sendIdx["yourself"]=1;
  35084. binding=$6;
  35085. binding;
  35086. $7=self._classReferences();
  35087. $8=$recv(aNode)._value();
  35088. $ctx1.sendIdx["value"]=3;
  35089. $recv($7)._add_($8);
  35090. } else {
  35091. self._errorUnknownVariable_(aNode);
  35092. $9=$recv($globals.UnknownVar)._new();
  35093. $recv($9)._name_($recv(aNode)._value());
  35094. binding=$recv($9)._yourself();
  35095. binding;
  35096. };
  35097. } else {
  35098. $1;
  35099. };
  35100. $recv(aNode)._binding_(binding);
  35101. return self;
  35102. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  35103. },
  35104. args: ["aNode"],
  35105. 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.",
  35106. referencedClasses: ["ClassRefVar", "UnknownVar"],
  35107. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  35108. }),
  35109. $globals.SemanticAnalyzer);
  35110. $core.addMethod(
  35111. $core.method({
  35112. selector: "on:",
  35113. protocol: 'instance creation',
  35114. fn: function (aClass){
  35115. var self=this;
  35116. return $core.withContext(function($ctx1) {
  35117. var $1;
  35118. $1=self._new();
  35119. $recv($1)._theClass_(aClass);
  35120. return $recv($1)._yourself();
  35121. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
  35122. },
  35123. args: ["aClass"],
  35124. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  35125. referencedClasses: [],
  35126. messageSends: ["theClass:", "new", "yourself"]
  35127. }),
  35128. $globals.SemanticAnalyzer.klass);
  35129. $core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Semantic');
  35130. $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";
  35131. $core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35132. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  35133. $core.addMethod(
  35134. $core.method({
  35135. selector: "messageText",
  35136. protocol: 'accessing',
  35137. fn: function (){
  35138. var self=this;
  35139. return $core.withContext(function($ctx1) {
  35140. return " Invalid assignment to variable: ".__comma(self._variableName());
  35141. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  35142. },
  35143. args: [],
  35144. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  35145. referencedClasses: [],
  35146. messageSends: [",", "variableName"]
  35147. }),
  35148. $globals.InvalidAssignmentError);
  35149. $core.addMethod(
  35150. $core.method({
  35151. selector: "variableName",
  35152. protocol: 'accessing',
  35153. fn: function (){
  35154. var self=this;
  35155. return self["@variableName"];
  35156. },
  35157. args: [],
  35158. source: "variableName\x0a\x09^ variableName",
  35159. referencedClasses: [],
  35160. messageSends: []
  35161. }),
  35162. $globals.InvalidAssignmentError);
  35163. $core.addMethod(
  35164. $core.method({
  35165. selector: "variableName:",
  35166. protocol: 'accessing',
  35167. fn: function (aString){
  35168. var self=this;
  35169. self["@variableName"]=aString;
  35170. return self;
  35171. },
  35172. args: ["aString"],
  35173. source: "variableName: aString\x0a\x09variableName := aString",
  35174. referencedClasses: [],
  35175. messageSends: []
  35176. }),
  35177. $globals.InvalidAssignmentError);
  35178. $core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35179. $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.";
  35180. $core.addMethod(
  35181. $core.method({
  35182. selector: "messageText",
  35183. protocol: 'accessing',
  35184. fn: function (){
  35185. var self=this;
  35186. return $core.withContext(function($ctx1) {
  35187. var $1;
  35188. $1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  35189. $ctx1.sendIdx[","]=1;
  35190. return $1;
  35191. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  35192. },
  35193. args: [],
  35194. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  35195. referencedClasses: [],
  35196. messageSends: [",", "variableName"]
  35197. }),
  35198. $globals.ShadowingVariableError);
  35199. $core.addMethod(
  35200. $core.method({
  35201. selector: "variableName",
  35202. protocol: 'accessing',
  35203. fn: function (){
  35204. var self=this;
  35205. return self["@variableName"];
  35206. },
  35207. args: [],
  35208. source: "variableName\x0a\x09^ variableName",
  35209. referencedClasses: [],
  35210. messageSends: []
  35211. }),
  35212. $globals.ShadowingVariableError);
  35213. $core.addMethod(
  35214. $core.method({
  35215. selector: "variableName:",
  35216. protocol: 'accessing',
  35217. fn: function (aString){
  35218. var self=this;
  35219. self["@variableName"]=aString;
  35220. return self;
  35221. },
  35222. args: ["aString"],
  35223. source: "variableName: aString\x0a\x09variableName := aString",
  35224. referencedClasses: [],
  35225. messageSends: []
  35226. }),
  35227. $globals.ShadowingVariableError);
  35228. $core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35229. $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.";
  35230. $core.addMethod(
  35231. $core.method({
  35232. selector: "messageText",
  35233. protocol: 'accessing',
  35234. fn: function (){
  35235. var self=this;
  35236. return $core.withContext(function($ctx1) {
  35237. var $1;
  35238. $1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  35239. $ctx1.sendIdx[","]=1;
  35240. return $1;
  35241. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  35242. },
  35243. args: [],
  35244. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  35245. referencedClasses: [],
  35246. messageSends: [",", "variableName"]
  35247. }),
  35248. $globals.UnknownVariableError);
  35249. $core.addMethod(
  35250. $core.method({
  35251. selector: "variableName",
  35252. protocol: 'accessing',
  35253. fn: function (){
  35254. var self=this;
  35255. return self["@variableName"];
  35256. },
  35257. args: [],
  35258. source: "variableName\x0a\x09^ variableName",
  35259. referencedClasses: [],
  35260. messageSends: []
  35261. }),
  35262. $globals.UnknownVariableError);
  35263. $core.addMethod(
  35264. $core.method({
  35265. selector: "variableName:",
  35266. protocol: 'accessing',
  35267. fn: function (aString){
  35268. var self=this;
  35269. self["@variableName"]=aString;
  35270. return self;
  35271. },
  35272. args: ["aString"],
  35273. source: "variableName: aString\x0a\x09variableName := aString",
  35274. referencedClasses: [],
  35275. messageSends: []
  35276. }),
  35277. $globals.UnknownVariableError);
  35278. });
  35279. define('amber_core/Compiler-IR',["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Dag", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  35280. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  35281. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  35282. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  35283. $core.addPackage('Compiler-IR');
  35284. $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  35285. $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35286. $core.addClass('IRASTTranslator', $globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  35287. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  35288. $core.addMethod(
  35289. $core.method({
  35290. selector: "alias:",
  35291. protocol: 'visiting',
  35292. fn: function (aNode){
  35293. var self=this;
  35294. var variable;
  35295. return $core.withContext(function($ctx1) {
  35296. var $1,$2,$3,$5,$4,$6,$7,$9,$8;
  35297. $1=$recv(aNode)._isImmutable();
  35298. if($core.assert($1)){
  35299. $2=self._visit_(aNode);
  35300. $ctx1.sendIdx["visit:"]=1;
  35301. return $2;
  35302. };
  35303. $3=$recv($globals.IRVariable)._new();
  35304. $ctx1.sendIdx["new"]=1;
  35305. $5=$recv($globals.AliasVar)._new();
  35306. $ctx1.sendIdx["new"]=2;
  35307. $4=$recv($5)._name_("$".__comma(self._nextAlias()));
  35308. $recv($3)._variable_($4);
  35309. $6=$recv($3)._yourself();
  35310. $ctx1.sendIdx["yourself"]=1;
  35311. variable=$6;
  35312. $7=self._sequence();
  35313. $9=$recv($globals.IRAssignment)._new();
  35314. $recv($9)._add_(variable);
  35315. $ctx1.sendIdx["add:"]=2;
  35316. $recv($9)._add_(self._visit_(aNode));
  35317. $ctx1.sendIdx["add:"]=3;
  35318. $8=$recv($9)._yourself();
  35319. $recv($7)._add_($8);
  35320. $ctx1.sendIdx["add:"]=1;
  35321. $recv($recv(self._method())._internalVariables())._add_(variable);
  35322. return variable;
  35323. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  35324. },
  35325. args: ["aNode"],
  35326. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  35327. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  35328. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  35329. }),
  35330. $globals.IRASTTranslator);
  35331. $core.addMethod(
  35332. $core.method({
  35333. selector: "aliasTemporally:",
  35334. protocol: 'visiting',
  35335. fn: function (aCollection){
  35336. var self=this;
  35337. var threshold,result;
  35338. return $core.withContext(function($ctx1) {
  35339. var $1,$2,$4,$3;
  35340. threshold=(0);
  35341. $recv(aCollection)._withIndexDo_((function(each,i){
  35342. return $core.withContext(function($ctx2) {
  35343. $1=$recv(each)._subtreeNeedsAliasing();
  35344. if($core.assert($1)){
  35345. threshold=i;
  35346. return threshold;
  35347. };
  35348. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  35349. }));
  35350. $ctx1.sendIdx["withIndexDo:"]=1;
  35351. result=$recv($globals.OrderedCollection)._new();
  35352. $recv(aCollection)._withIndexDo_((function(each,i){
  35353. return $core.withContext(function($ctx2) {
  35354. $2=result;
  35355. $4=$recv(i).__lt_eq(threshold);
  35356. if($core.assert($4)){
  35357. $3=self._alias_(each);
  35358. } else {
  35359. $3=self._visit_(each);
  35360. };
  35361. return $recv($2)._add_($3);
  35362. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  35363. }));
  35364. return result;
  35365. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  35366. },
  35367. args: ["aCollection"],
  35368. 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",
  35369. referencedClasses: ["OrderedCollection"],
  35370. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  35371. }),
  35372. $globals.IRASTTranslator);
  35373. $core.addMethod(
  35374. $core.method({
  35375. selector: "method",
  35376. protocol: 'accessing',
  35377. fn: function (){
  35378. var self=this;
  35379. return self["@method"];
  35380. },
  35381. args: [],
  35382. source: "method\x0a\x09^ method",
  35383. referencedClasses: [],
  35384. messageSends: []
  35385. }),
  35386. $globals.IRASTTranslator);
  35387. $core.addMethod(
  35388. $core.method({
  35389. selector: "method:",
  35390. protocol: 'accessing',
  35391. fn: function (anIRMethod){
  35392. var self=this;
  35393. self["@method"]=anIRMethod;
  35394. return self;
  35395. },
  35396. args: ["anIRMethod"],
  35397. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  35398. referencedClasses: [],
  35399. messageSends: []
  35400. }),
  35401. $globals.IRASTTranslator);
  35402. $core.addMethod(
  35403. $core.method({
  35404. selector: "nextAlias",
  35405. protocol: 'accessing',
  35406. fn: function (){
  35407. var self=this;
  35408. return $core.withContext(function($ctx1) {
  35409. var $1,$receiver;
  35410. $1=self["@nextAlias"];
  35411. if(($receiver = $1) == null || $receiver.isNil){
  35412. self["@nextAlias"]=(0);
  35413. self["@nextAlias"];
  35414. } else {
  35415. $1;
  35416. };
  35417. self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1));
  35418. return $recv(self["@nextAlias"])._asString();
  35419. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  35420. },
  35421. args: [],
  35422. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  35423. referencedClasses: [],
  35424. messageSends: ["ifNil:", "+", "asString"]
  35425. }),
  35426. $globals.IRASTTranslator);
  35427. $core.addMethod(
  35428. $core.method({
  35429. selector: "sequence",
  35430. protocol: 'accessing',
  35431. fn: function (){
  35432. var self=this;
  35433. return self["@sequence"];
  35434. },
  35435. args: [],
  35436. source: "sequence\x0a\x09^ sequence",
  35437. referencedClasses: [],
  35438. messageSends: []
  35439. }),
  35440. $globals.IRASTTranslator);
  35441. $core.addMethod(
  35442. $core.method({
  35443. selector: "sequence:",
  35444. protocol: 'accessing',
  35445. fn: function (anIRSequence){
  35446. var self=this;
  35447. self["@sequence"]=anIRSequence;
  35448. return self;
  35449. },
  35450. args: ["anIRSequence"],
  35451. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  35452. referencedClasses: [],
  35453. messageSends: []
  35454. }),
  35455. $globals.IRASTTranslator);
  35456. $core.addMethod(
  35457. $core.method({
  35458. selector: "source",
  35459. protocol: 'accessing',
  35460. fn: function (){
  35461. var self=this;
  35462. return self["@source"];
  35463. },
  35464. args: [],
  35465. source: "source\x0a\x09^ source",
  35466. referencedClasses: [],
  35467. messageSends: []
  35468. }),
  35469. $globals.IRASTTranslator);
  35470. $core.addMethod(
  35471. $core.method({
  35472. selector: "source:",
  35473. protocol: 'accessing',
  35474. fn: function (aString){
  35475. var self=this;
  35476. self["@source"]=aString;
  35477. return self;
  35478. },
  35479. args: ["aString"],
  35480. source: "source: aString\x0a\x09source := aString",
  35481. referencedClasses: [],
  35482. messageSends: []
  35483. }),
  35484. $globals.IRASTTranslator);
  35485. $core.addMethod(
  35486. $core.method({
  35487. selector: "theClass",
  35488. protocol: 'accessing',
  35489. fn: function (){
  35490. var self=this;
  35491. return self["@theClass"];
  35492. },
  35493. args: [],
  35494. source: "theClass\x0a\x09^ theClass",
  35495. referencedClasses: [],
  35496. messageSends: []
  35497. }),
  35498. $globals.IRASTTranslator);
  35499. $core.addMethod(
  35500. $core.method({
  35501. selector: "theClass:",
  35502. protocol: 'accessing',
  35503. fn: function (aClass){
  35504. var self=this;
  35505. self["@theClass"]=aClass;
  35506. return self;
  35507. },
  35508. args: ["aClass"],
  35509. source: "theClass: aClass\x0a\x09theClass := aClass",
  35510. referencedClasses: [],
  35511. messageSends: []
  35512. }),
  35513. $globals.IRASTTranslator);
  35514. $core.addMethod(
  35515. $core.method({
  35516. selector: "visitAssignmentNode:",
  35517. protocol: 'visiting',
  35518. fn: function (aNode){
  35519. var self=this;
  35520. var left,right,assignment;
  35521. return $core.withContext(function($ctx1) {
  35522. var $1,$3,$2;
  35523. right=self._visit_($recv(aNode)._right());
  35524. $ctx1.sendIdx["visit:"]=1;
  35525. left=self._visit_($recv(aNode)._left());
  35526. $1=self._sequence();
  35527. $3=$recv($globals.IRAssignment)._new();
  35528. $recv($3)._add_(left);
  35529. $ctx1.sendIdx["add:"]=2;
  35530. $recv($3)._add_(right);
  35531. $2=$recv($3)._yourself();
  35532. $recv($1)._add_($2);
  35533. $ctx1.sendIdx["add:"]=1;
  35534. return left;
  35535. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  35536. },
  35537. args: ["aNode"],
  35538. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  35539. referencedClasses: ["IRAssignment"],
  35540. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  35541. }),
  35542. $globals.IRASTTranslator);
  35543. $core.addMethod(
  35544. $core.method({
  35545. selector: "visitBlockNode:",
  35546. protocol: 'visiting',
  35547. fn: function (aNode){
  35548. var self=this;
  35549. var closure;
  35550. return $core.withContext(function($ctx1) {
  35551. var $1,$2,$3,$5,$4,$6,$8,$7;
  35552. $1=$recv($globals.IRClosure)._new();
  35553. $ctx1.sendIdx["new"]=1;
  35554. $recv($1)._arguments_($recv(aNode)._parameters());
  35555. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  35556. $2=$recv(aNode)._scope();
  35557. $ctx1.sendIdx["scope"]=1;
  35558. $recv($1)._scope_($2);
  35559. $ctx1.sendIdx["scope:"]=1;
  35560. $3=$recv($1)._yourself();
  35561. $ctx1.sendIdx["yourself"]=1;
  35562. closure=$3;
  35563. $5=$recv(aNode)._scope();
  35564. $ctx1.sendIdx["scope"]=2;
  35565. $4=$recv($5)._temps();
  35566. $recv($4)._do_((function(each){
  35567. return $core.withContext(function($ctx2) {
  35568. $6=closure;
  35569. $8=$recv($globals.IRTempDeclaration)._new();
  35570. $recv($8)._name_($recv(each)._name());
  35571. $recv($8)._scope_($recv(aNode)._scope());
  35572. $7=$recv($8)._yourself();
  35573. return $recv($6)._add_($7);
  35574. $ctx2.sendIdx["add:"]=1;
  35575. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35576. }));
  35577. $ctx1.sendIdx["do:"]=1;
  35578. $recv($recv(aNode)._dagChildren())._do_((function(each){
  35579. return $core.withContext(function($ctx2) {
  35580. return $recv(closure)._add_(self._visit_(each));
  35581. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35582. }));
  35583. return closure;
  35584. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  35585. },
  35586. args: ["aNode"],
  35587. 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",
  35588. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  35589. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  35590. }),
  35591. $globals.IRASTTranslator);
  35592. $core.addMethod(
  35593. $core.method({
  35594. selector: "visitBlockSequenceNode:",
  35595. protocol: 'visiting',
  35596. fn: function (aNode){
  35597. var self=this;
  35598. return $core.withContext(function($ctx1) {
  35599. var $1,$2,$4,$3,$5,$6,$9,$8,$7,$10,$12,$15,$14,$13,$11;
  35600. $1=$recv($globals.IRBlockSequence)._new();
  35601. $ctx1.sendIdx["new"]=1;
  35602. return self._withSequence_do_($1,(function(){
  35603. return $core.withContext(function($ctx2) {
  35604. $2=$recv(aNode)._dagChildren();
  35605. $ctx2.sendIdx["dagChildren"]=1;
  35606. return $recv($2)._ifNotEmpty_((function(){
  35607. return $core.withContext(function($ctx3) {
  35608. $4=$recv(aNode)._dagChildren();
  35609. $ctx3.sendIdx["dagChildren"]=2;
  35610. $3=$recv($4)._allButLast();
  35611. $recv($3)._do_((function(each){
  35612. return $core.withContext(function($ctx4) {
  35613. $5=self._sequence();
  35614. $ctx4.sendIdx["sequence"]=1;
  35615. $6=self._visitOrAlias_(each);
  35616. $ctx4.sendIdx["visitOrAlias:"]=1;
  35617. return $recv($5)._add_($6);
  35618. $ctx4.sendIdx["add:"]=1;
  35619. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  35620. }));
  35621. $9=$recv(aNode)._dagChildren();
  35622. $ctx3.sendIdx["dagChildren"]=3;
  35623. $8=$recv($9)._last();
  35624. $ctx3.sendIdx["last"]=1;
  35625. $7=$recv($8)._isReturnNode();
  35626. if($core.assert($7)){
  35627. return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  35628. } else {
  35629. $10=self._sequence();
  35630. $ctx3.sendIdx["sequence"]=2;
  35631. $12=$recv($globals.IRBlockReturn)._new();
  35632. $15=$recv(aNode)._dagChildren();
  35633. $ctx3.sendIdx["dagChildren"]=4;
  35634. $14=$recv($15)._last();
  35635. $ctx3.sendIdx["last"]=2;
  35636. $13=self._visitOrAlias_($14);
  35637. $ctx3.sendIdx["visitOrAlias:"]=2;
  35638. $recv($12)._add_($13);
  35639. $ctx3.sendIdx["add:"]=3;
  35640. $11=$recv($12)._yourself();
  35641. return $recv($10)._add_($11);
  35642. $ctx3.sendIdx["add:"]=2;
  35643. };
  35644. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  35645. }));
  35646. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35647. }));
  35648. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35649. },
  35650. args: ["aNode"],
  35651. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren ifNotEmpty: [\x0a\x09\x09\x09\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode dagChildren last) ] ]]",
  35652. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  35653. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  35654. }),
  35655. $globals.IRASTTranslator);
  35656. $core.addMethod(
  35657. $core.method({
  35658. selector: "visitCascadeNode:",
  35659. protocol: 'visiting',
  35660. fn: function (aNode){
  35661. var self=this;
  35662. var receiver;
  35663. return $core.withContext(function($ctx1) {
  35664. var $1,$2,$4,$3;
  35665. receiver=$recv(aNode)._receiver();
  35666. $1=$recv(receiver)._isImmutable();
  35667. if(!$core.assert($1)){
  35668. var alias;
  35669. alias=self._alias_(receiver);
  35670. alias;
  35671. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  35672. receiver;
  35673. };
  35674. $2=$recv(aNode)._dagChildren();
  35675. $ctx1.sendIdx["dagChildren"]=1;
  35676. $recv($2)._do_((function(each){
  35677. return $core.withContext(function($ctx2) {
  35678. return $recv(each)._receiver_(receiver);
  35679. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35680. }));
  35681. $ctx1.sendIdx["do:"]=1;
  35682. $4=$recv(aNode)._dagChildren();
  35683. $ctx1.sendIdx["dagChildren"]=2;
  35684. $3=$recv($4)._allButLast();
  35685. $recv($3)._do_((function(each){
  35686. return $core.withContext(function($ctx2) {
  35687. return $recv(self._sequence())._add_(self._visit_(each));
  35688. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  35689. }));
  35690. return self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  35691. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  35692. },
  35693. args: ["aNode"],
  35694. source: "visitCascadeNode: aNode\x0a\x09| receiver |\x0a\x09receiver := aNode receiver.\x0a\x09receiver isImmutable ifFalse: [\x0a\x09\x09| alias |\x0a\x09\x09alias := self alias: receiver.\x0a\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09aNode dagChildren do: [ :each | each receiver: receiver ].\x0a\x0a\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode dagChildren last",
  35695. referencedClasses: ["VariableNode"],
  35696. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "add:", "sequence", "visit:", "visitOrAlias:", "last"]
  35697. }),
  35698. $globals.IRASTTranslator);
  35699. $core.addMethod(
  35700. $core.method({
  35701. selector: "visitDynamicArrayNode:",
  35702. protocol: 'visiting',
  35703. fn: function (aNode){
  35704. var self=this;
  35705. var array;
  35706. return $core.withContext(function($ctx1) {
  35707. array=$recv($globals.IRDynamicArray)._new();
  35708. $recv(self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  35709. return $core.withContext(function($ctx2) {
  35710. return $recv(array)._add_(each);
  35711. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35712. }));
  35713. return array;
  35714. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  35715. },
  35716. args: ["aNode"],
  35717. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  35718. referencedClasses: ["IRDynamicArray"],
  35719. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  35720. }),
  35721. $globals.IRASTTranslator);
  35722. $core.addMethod(
  35723. $core.method({
  35724. selector: "visitDynamicDictionaryNode:",
  35725. protocol: 'visiting',
  35726. fn: function (aNode){
  35727. var self=this;
  35728. var dictionary;
  35729. return $core.withContext(function($ctx1) {
  35730. dictionary=$recv($globals.IRDynamicDictionary)._new();
  35731. $recv(self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  35732. return $core.withContext(function($ctx2) {
  35733. return $recv(dictionary)._add_(each);
  35734. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35735. }));
  35736. return dictionary;
  35737. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  35738. },
  35739. args: ["aNode"],
  35740. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  35741. referencedClasses: ["IRDynamicDictionary"],
  35742. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  35743. }),
  35744. $globals.IRASTTranslator);
  35745. $core.addMethod(
  35746. $core.method({
  35747. selector: "visitJSStatementNode:",
  35748. protocol: 'visiting',
  35749. fn: function (aNode){
  35750. var self=this;
  35751. return $core.withContext(function($ctx1) {
  35752. var $1;
  35753. $1=$recv($globals.IRVerbatim)._new();
  35754. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  35755. return $recv($1)._yourself();
  35756. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35757. },
  35758. args: ["aNode"],
  35759. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  35760. referencedClasses: ["IRVerbatim"],
  35761. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  35762. }),
  35763. $globals.IRASTTranslator);
  35764. $core.addMethod(
  35765. $core.method({
  35766. selector: "visitMethodNode:",
  35767. protocol: 'visiting',
  35768. fn: function (aNode){
  35769. var self=this;
  35770. return $core.withContext(function($ctx1) {
  35771. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  35772. $2=$recv($globals.IRMethod)._new();
  35773. $ctx1.sendIdx["new"]=1;
  35774. $recv($2)._source_($recv(self._source())._crlfSanitized());
  35775. $ctx1.sendIdx["source:"]=1;
  35776. $recv($2)._theClass_(self._theClass());
  35777. $recv($2)._arguments_($recv(aNode)._arguments());
  35778. $recv($2)._selector_($recv(aNode)._selector());
  35779. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  35780. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  35781. $recv($2)._classReferences_($recv(aNode)._classReferences());
  35782. $3=$recv(aNode)._scope();
  35783. $ctx1.sendIdx["scope"]=1;
  35784. $recv($2)._scope_($3);
  35785. $ctx1.sendIdx["scope:"]=1;
  35786. $4=$recv($2)._yourself();
  35787. $ctx1.sendIdx["yourself"]=1;
  35788. $1=$4;
  35789. self._method_($1);
  35790. $6=$recv(aNode)._scope();
  35791. $ctx1.sendIdx["scope"]=2;
  35792. $5=$recv($6)._temps();
  35793. $recv($5)._do_((function(each){
  35794. return $core.withContext(function($ctx2) {
  35795. $7=self._method();
  35796. $ctx2.sendIdx["method"]=1;
  35797. $9=$recv($globals.IRTempDeclaration)._new();
  35798. $ctx2.sendIdx["new"]=2;
  35799. $recv($9)._name_($recv(each)._name());
  35800. $10=$recv(aNode)._scope();
  35801. $ctx2.sendIdx["scope"]=3;
  35802. $recv($9)._scope_($10);
  35803. $11=$recv($9)._yourself();
  35804. $ctx2.sendIdx["yourself"]=2;
  35805. $8=$11;
  35806. return $recv($7)._add_($8);
  35807. $ctx2.sendIdx["add:"]=1;
  35808. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35809. }));
  35810. $ctx1.sendIdx["do:"]=1;
  35811. $recv($recv(aNode)._dagChildren())._do_((function(each){
  35812. return $core.withContext(function($ctx2) {
  35813. $12=self._method();
  35814. $ctx2.sendIdx["method"]=2;
  35815. return $recv($12)._add_(self._visit_(each));
  35816. $ctx2.sendIdx["add:"]=2;
  35817. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35818. }));
  35819. $14=$recv(aNode)._scope();
  35820. $ctx1.sendIdx["scope"]=4;
  35821. $13=$recv($14)._hasLocalReturn();
  35822. if(!$core.assert($13)){
  35823. $15=self._method();
  35824. $ctx1.sendIdx["method"]=3;
  35825. $17=$recv($globals.IRReturn)._new();
  35826. $ctx1.sendIdx["new"]=3;
  35827. $19=$recv($globals.IRVariable)._new();
  35828. $ctx1.sendIdx["new"]=4;
  35829. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  35830. $20=$recv($19)._yourself();
  35831. $ctx1.sendIdx["yourself"]=3;
  35832. $18=$20;
  35833. $recv($17)._add_($18);
  35834. $ctx1.sendIdx["add:"]=4;
  35835. $21=$recv($17)._yourself();
  35836. $ctx1.sendIdx["yourself"]=4;
  35837. $16=$21;
  35838. $recv($15)._add_($16);
  35839. $ctx1.sendIdx["add:"]=3;
  35840. $23=$recv($globals.IRVerbatim)._new();
  35841. $recv($23)._source_("");
  35842. $22=$recv($23)._yourself();
  35843. $recv($15)._add_($22);
  35844. };
  35845. return self._method();
  35846. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35847. },
  35848. args: ["aNode"],
  35849. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ''; yourself) ].\x0a\x0a\x09^ self method",
  35850. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  35851. 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"]
  35852. }),
  35853. $globals.IRASTTranslator);
  35854. $core.addMethod(
  35855. $core.method({
  35856. selector: "visitOrAlias:",
  35857. protocol: 'visiting',
  35858. fn: function (aNode){
  35859. var self=this;
  35860. return $core.withContext(function($ctx1) {
  35861. var $1;
  35862. $1=$recv(aNode)._shouldBeAliased();
  35863. if($core.assert($1)){
  35864. return self._alias_(aNode);
  35865. } else {
  35866. return self._visit_(aNode);
  35867. };
  35868. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  35869. },
  35870. args: ["aNode"],
  35871. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  35872. referencedClasses: [],
  35873. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  35874. }),
  35875. $globals.IRASTTranslator);
  35876. $core.addMethod(
  35877. $core.method({
  35878. selector: "visitReturnNode:",
  35879. protocol: 'visiting',
  35880. fn: function (aNode){
  35881. var self=this;
  35882. var return_;
  35883. return $core.withContext(function($ctx1) {
  35884. var $1;
  35885. $1=$recv(aNode)._nonLocalReturn();
  35886. if($core.assert($1)){
  35887. return_=$recv($globals.IRNonLocalReturn)._new();
  35888. $ctx1.sendIdx["new"]=1;
  35889. } else {
  35890. return_=$recv($globals.IRReturn)._new();
  35891. };
  35892. $recv(return_)._scope_($recv(aNode)._scope());
  35893. $recv($recv(aNode)._dagChildren())._do_((function(each){
  35894. return $core.withContext(function($ctx2) {
  35895. return $recv(return_)._add_(self._visitOrAlias_(each));
  35896. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  35897. }));
  35898. return return_;
  35899. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  35900. },
  35901. args: ["aNode"],
  35902. 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",
  35903. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  35904. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  35905. }),
  35906. $globals.IRASTTranslator);
  35907. $core.addMethod(
  35908. $core.method({
  35909. selector: "visitSendNode:",
  35910. protocol: 'visiting',
  35911. fn: function (aNode){
  35912. var self=this;
  35913. var send;
  35914. return $core.withContext(function($ctx1) {
  35915. var $1;
  35916. send=$recv($globals.IRSend)._new();
  35917. $1=send;
  35918. $recv($1)._selector_($recv(aNode)._selector());
  35919. $recv($1)._index_($recv(aNode)._index());
  35920. $recv(self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  35921. return $core.withContext(function($ctx2) {
  35922. return $recv(send)._add_(each);
  35923. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35924. }));
  35925. return send;
  35926. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  35927. },
  35928. args: ["aNode"],
  35929. 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",
  35930. referencedClasses: ["IRSend"],
  35931. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  35932. }),
  35933. $globals.IRASTTranslator);
  35934. $core.addMethod(
  35935. $core.method({
  35936. selector: "visitSequenceNode:",
  35937. protocol: 'visiting',
  35938. fn: function (aNode){
  35939. var self=this;
  35940. return $core.withContext(function($ctx1) {
  35941. var $1;
  35942. return self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  35943. return $core.withContext(function($ctx2) {
  35944. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  35945. var instruction;
  35946. return $core.withContext(function($ctx3) {
  35947. instruction=self._visitOrAlias_(each);
  35948. instruction;
  35949. $1=$recv(instruction)._isVariable();
  35950. if(!$core.assert($1)){
  35951. return $recv(self._sequence())._add_(instruction);
  35952. };
  35953. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  35954. }));
  35955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35956. }));
  35957. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35958. },
  35959. args: ["aNode"],
  35960. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]",
  35961. referencedClasses: ["IRSequence"],
  35962. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  35963. }),
  35964. $globals.IRASTTranslator);
  35965. $core.addMethod(
  35966. $core.method({
  35967. selector: "visitValueNode:",
  35968. protocol: 'visiting',
  35969. fn: function (aNode){
  35970. var self=this;
  35971. return $core.withContext(function($ctx1) {
  35972. var $1;
  35973. $1=$recv($globals.IRValue)._new();
  35974. $recv($1)._value_($recv(aNode)._value());
  35975. return $recv($1)._yourself();
  35976. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35977. },
  35978. args: ["aNode"],
  35979. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  35980. referencedClasses: ["IRValue"],
  35981. messageSends: ["value:", "new", "value", "yourself"]
  35982. }),
  35983. $globals.IRASTTranslator);
  35984. $core.addMethod(
  35985. $core.method({
  35986. selector: "visitVariableNode:",
  35987. protocol: 'visiting',
  35988. fn: function (aNode){
  35989. var self=this;
  35990. return $core.withContext(function($ctx1) {
  35991. var $1;
  35992. $1=$recv($globals.IRVariable)._new();
  35993. $recv($1)._variable_($recv(aNode)._binding());
  35994. return $recv($1)._yourself();
  35995. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35996. },
  35997. args: ["aNode"],
  35998. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  35999. referencedClasses: ["IRVariable"],
  36000. messageSends: ["variable:", "new", "binding", "yourself"]
  36001. }),
  36002. $globals.IRASTTranslator);
  36003. $core.addMethod(
  36004. $core.method({
  36005. selector: "withSequence:do:",
  36006. protocol: 'accessing',
  36007. fn: function (aSequence,aBlock){
  36008. var self=this;
  36009. var outerSequence;
  36010. return $core.withContext(function($ctx1) {
  36011. outerSequence=self._sequence();
  36012. self._sequence_(aSequence);
  36013. $ctx1.sendIdx["sequence:"]=1;
  36014. $recv(aBlock)._value();
  36015. self._sequence_(outerSequence);
  36016. return aSequence;
  36017. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  36018. },
  36019. args: ["aSequence", "aBlock"],
  36020. 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",
  36021. referencedClasses: [],
  36022. messageSends: ["sequence", "sequence:", "value"]
  36023. }),
  36024. $globals.IRASTTranslator);
  36025. $core.addClass('IRInstruction', $globals.DagParentNode, ['parent'], 'Compiler-IR');
  36026. $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.";
  36027. $core.addMethod(
  36028. $core.method({
  36029. selector: "add:",
  36030. protocol: 'building',
  36031. fn: function (anObject){
  36032. var self=this;
  36033. return $core.withContext(function($ctx1) {
  36034. $recv(anObject)._parent_(self);
  36035. return $recv(self._dagChildren())._add_(anObject);
  36036. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  36037. },
  36038. args: ["anObject"],
  36039. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  36040. referencedClasses: [],
  36041. messageSends: ["parent:", "add:", "dagChildren"]
  36042. }),
  36043. $globals.IRInstruction);
  36044. $core.addMethod(
  36045. $core.method({
  36046. selector: "isClosure",
  36047. protocol: 'testing',
  36048. fn: function (){
  36049. var self=this;
  36050. return false;
  36051. },
  36052. args: [],
  36053. source: "isClosure\x0a\x09^ false",
  36054. referencedClasses: [],
  36055. messageSends: []
  36056. }),
  36057. $globals.IRInstruction);
  36058. $core.addMethod(
  36059. $core.method({
  36060. selector: "isInlined",
  36061. protocol: 'testing',
  36062. fn: function (){
  36063. var self=this;
  36064. return false;
  36065. },
  36066. args: [],
  36067. source: "isInlined\x0a\x09^ false",
  36068. referencedClasses: [],
  36069. messageSends: []
  36070. }),
  36071. $globals.IRInstruction);
  36072. $core.addMethod(
  36073. $core.method({
  36074. selector: "isMethod",
  36075. protocol: 'testing',
  36076. fn: function (){
  36077. var self=this;
  36078. return false;
  36079. },
  36080. args: [],
  36081. source: "isMethod\x0a\x09^ false",
  36082. referencedClasses: [],
  36083. messageSends: []
  36084. }),
  36085. $globals.IRInstruction);
  36086. $core.addMethod(
  36087. $core.method({
  36088. selector: "isSend",
  36089. protocol: 'testing',
  36090. fn: function (){
  36091. var self=this;
  36092. return false;
  36093. },
  36094. args: [],
  36095. source: "isSend\x0a\x09^ false",
  36096. referencedClasses: [],
  36097. messageSends: []
  36098. }),
  36099. $globals.IRInstruction);
  36100. $core.addMethod(
  36101. $core.method({
  36102. selector: "isSequence",
  36103. protocol: 'testing',
  36104. fn: function (){
  36105. var self=this;
  36106. return false;
  36107. },
  36108. args: [],
  36109. source: "isSequence\x0a\x09^ false",
  36110. referencedClasses: [],
  36111. messageSends: []
  36112. }),
  36113. $globals.IRInstruction);
  36114. $core.addMethod(
  36115. $core.method({
  36116. selector: "isTempDeclaration",
  36117. protocol: 'testing',
  36118. fn: function (){
  36119. var self=this;
  36120. return false;
  36121. },
  36122. args: [],
  36123. source: "isTempDeclaration\x0a\x09^ false",
  36124. referencedClasses: [],
  36125. messageSends: []
  36126. }),
  36127. $globals.IRInstruction);
  36128. $core.addMethod(
  36129. $core.method({
  36130. selector: "isVariable",
  36131. protocol: 'testing',
  36132. fn: function (){
  36133. var self=this;
  36134. return false;
  36135. },
  36136. args: [],
  36137. source: "isVariable\x0a\x09^ false",
  36138. referencedClasses: [],
  36139. messageSends: []
  36140. }),
  36141. $globals.IRInstruction);
  36142. $core.addMethod(
  36143. $core.method({
  36144. selector: "method",
  36145. protocol: 'accessing',
  36146. fn: function (){
  36147. var self=this;
  36148. return $core.withContext(function($ctx1) {
  36149. return $recv(self._parent())._method();
  36150. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  36151. },
  36152. args: [],
  36153. source: "method\x0a\x09^ self parent method",
  36154. referencedClasses: [],
  36155. messageSends: ["method", "parent"]
  36156. }),
  36157. $globals.IRInstruction);
  36158. $core.addMethod(
  36159. $core.method({
  36160. selector: "needsBoxingAsReceiver",
  36161. protocol: 'testing',
  36162. fn: function (){
  36163. var self=this;
  36164. return true;
  36165. },
  36166. args: [],
  36167. source: "needsBoxingAsReceiver\x0a\x09^ true",
  36168. referencedClasses: [],
  36169. messageSends: []
  36170. }),
  36171. $globals.IRInstruction);
  36172. $core.addMethod(
  36173. $core.method({
  36174. selector: "parent",
  36175. protocol: 'accessing',
  36176. fn: function (){
  36177. var self=this;
  36178. return self["@parent"];
  36179. },
  36180. args: [],
  36181. source: "parent\x0a\x09^ parent",
  36182. referencedClasses: [],
  36183. messageSends: []
  36184. }),
  36185. $globals.IRInstruction);
  36186. $core.addMethod(
  36187. $core.method({
  36188. selector: "parent:",
  36189. protocol: 'accessing',
  36190. fn: function (anIRInstruction){
  36191. var self=this;
  36192. self["@parent"]=anIRInstruction;
  36193. return self;
  36194. },
  36195. args: ["anIRInstruction"],
  36196. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  36197. referencedClasses: [],
  36198. messageSends: []
  36199. }),
  36200. $globals.IRInstruction);
  36201. $core.addMethod(
  36202. $core.method({
  36203. selector: "remove:",
  36204. protocol: 'building',
  36205. fn: function (anIRInstruction){
  36206. var self=this;
  36207. return $core.withContext(function($ctx1) {
  36208. $recv(self._dagChildren())._remove_(anIRInstruction);
  36209. return self;
  36210. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  36211. },
  36212. args: ["anIRInstruction"],
  36213. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  36214. referencedClasses: [],
  36215. messageSends: ["remove:", "dagChildren"]
  36216. }),
  36217. $globals.IRInstruction);
  36218. $core.addMethod(
  36219. $core.method({
  36220. selector: "replace:with:",
  36221. protocol: 'building',
  36222. fn: function (anIRInstruction,anotherIRInstruction){
  36223. var self=this;
  36224. return $core.withContext(function($ctx1) {
  36225. var $1;
  36226. $recv(anotherIRInstruction)._parent_(self);
  36227. $1=self._dagChildren();
  36228. $ctx1.sendIdx["dagChildren"]=1;
  36229. $recv($1)._at_put_($recv(self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  36230. return self;
  36231. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  36232. },
  36233. args: ["anIRInstruction", "anotherIRInstruction"],
  36234. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  36235. referencedClasses: [],
  36236. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  36237. }),
  36238. $globals.IRInstruction);
  36239. $core.addMethod(
  36240. $core.method({
  36241. selector: "replaceWith:",
  36242. protocol: 'building',
  36243. fn: function (anIRInstruction){
  36244. var self=this;
  36245. return $core.withContext(function($ctx1) {
  36246. $recv(self._parent())._replace_with_(self,anIRInstruction);
  36247. return self;
  36248. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  36249. },
  36250. args: ["anIRInstruction"],
  36251. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  36252. referencedClasses: [],
  36253. messageSends: ["replace:with:", "parent"]
  36254. }),
  36255. $globals.IRInstruction);
  36256. $core.addMethod(
  36257. $core.method({
  36258. selector: "scope",
  36259. protocol: 'accessing',
  36260. fn: function (){
  36261. var self=this;
  36262. return $core.withContext(function($ctx1) {
  36263. var $1,$receiver;
  36264. $1=self._parent();
  36265. if(($receiver = $1) == null || $receiver.isNil){
  36266. return $1;
  36267. } else {
  36268. var node;
  36269. node=$receiver;
  36270. return $recv(node)._scope();
  36271. };
  36272. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  36273. },
  36274. args: [],
  36275. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  36276. referencedClasses: [],
  36277. messageSends: ["ifNotNil:", "parent", "scope"]
  36278. }),
  36279. $globals.IRInstruction);
  36280. $core.addMethod(
  36281. $core.method({
  36282. selector: "yieldsValue",
  36283. protocol: 'testing',
  36284. fn: function (){
  36285. var self=this;
  36286. return true;
  36287. },
  36288. args: [],
  36289. source: "yieldsValue\x0a\x09^ true",
  36290. referencedClasses: [],
  36291. messageSends: []
  36292. }),
  36293. $globals.IRInstruction);
  36294. $core.addMethod(
  36295. $core.method({
  36296. selector: "on:",
  36297. protocol: 'instance creation',
  36298. fn: function (aBuilder){
  36299. var self=this;
  36300. return $core.withContext(function($ctx1) {
  36301. var $1;
  36302. $1=self._new();
  36303. $recv($1)._builder_(aBuilder);
  36304. return $recv($1)._yourself();
  36305. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)});
  36306. },
  36307. args: ["aBuilder"],
  36308. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  36309. referencedClasses: [],
  36310. messageSends: ["builder:", "new", "yourself"]
  36311. }),
  36312. $globals.IRInstruction.klass);
  36313. $core.addClass('IRAssignment', $globals.IRInstruction, [], 'Compiler-IR');
  36314. $core.addMethod(
  36315. $core.method({
  36316. selector: "acceptDagVisitor:",
  36317. protocol: 'visiting',
  36318. fn: function (aVisitor){
  36319. var self=this;
  36320. return $core.withContext(function($ctx1) {
  36321. return $recv(aVisitor)._visitIRAssignment_(self);
  36322. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  36323. },
  36324. args: ["aVisitor"],
  36325. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  36326. referencedClasses: [],
  36327. messageSends: ["visitIRAssignment:"]
  36328. }),
  36329. $globals.IRAssignment);
  36330. $core.addMethod(
  36331. $core.method({
  36332. selector: "left",
  36333. protocol: 'accessing',
  36334. fn: function (){
  36335. var self=this;
  36336. return $core.withContext(function($ctx1) {
  36337. return $recv(self._dagChildren())._first();
  36338. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  36339. },
  36340. args: [],
  36341. source: "left\x0a\x09^ self dagChildren first",
  36342. referencedClasses: [],
  36343. messageSends: ["first", "dagChildren"]
  36344. }),
  36345. $globals.IRAssignment);
  36346. $core.addMethod(
  36347. $core.method({
  36348. selector: "right",
  36349. protocol: 'accessing',
  36350. fn: function (){
  36351. var self=this;
  36352. return $core.withContext(function($ctx1) {
  36353. return $recv(self._dagChildren())._last();
  36354. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  36355. },
  36356. args: [],
  36357. source: "right\x0a\x09^ self dagChildren last",
  36358. referencedClasses: [],
  36359. messageSends: ["last", "dagChildren"]
  36360. }),
  36361. $globals.IRAssignment);
  36362. $core.addClass('IRDynamicArray', $globals.IRInstruction, [], 'Compiler-IR');
  36363. $core.addMethod(
  36364. $core.method({
  36365. selector: "acceptDagVisitor:",
  36366. protocol: 'visiting',
  36367. fn: function (aVisitor){
  36368. var self=this;
  36369. return $core.withContext(function($ctx1) {
  36370. return $recv(aVisitor)._visitIRDynamicArray_(self);
  36371. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  36372. },
  36373. args: ["aVisitor"],
  36374. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  36375. referencedClasses: [],
  36376. messageSends: ["visitIRDynamicArray:"]
  36377. }),
  36378. $globals.IRDynamicArray);
  36379. $core.addClass('IRDynamicDictionary', $globals.IRInstruction, [], 'Compiler-IR');
  36380. $core.addMethod(
  36381. $core.method({
  36382. selector: "acceptDagVisitor:",
  36383. protocol: 'visiting',
  36384. fn: function (aVisitor){
  36385. var self=this;
  36386. return $core.withContext(function($ctx1) {
  36387. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  36388. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  36389. },
  36390. args: ["aVisitor"],
  36391. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  36392. referencedClasses: [],
  36393. messageSends: ["visitIRDynamicDictionary:"]
  36394. }),
  36395. $globals.IRDynamicDictionary);
  36396. $core.addClass('IRScopedInstruction', $globals.IRInstruction, ['scope'], 'Compiler-IR');
  36397. $core.addMethod(
  36398. $core.method({
  36399. selector: "scope",
  36400. protocol: 'accessing',
  36401. fn: function (){
  36402. var self=this;
  36403. return self["@scope"];
  36404. },
  36405. args: [],
  36406. source: "scope\x0a\x09^ scope",
  36407. referencedClasses: [],
  36408. messageSends: []
  36409. }),
  36410. $globals.IRScopedInstruction);
  36411. $core.addMethod(
  36412. $core.method({
  36413. selector: "scope:",
  36414. protocol: 'accessing',
  36415. fn: function (aScope){
  36416. var self=this;
  36417. self["@scope"]=aScope;
  36418. return self;
  36419. },
  36420. args: ["aScope"],
  36421. source: "scope: aScope\x0a\x09scope := aScope",
  36422. referencedClasses: [],
  36423. messageSends: []
  36424. }),
  36425. $globals.IRScopedInstruction);
  36426. $core.addClass('IRClosureInstruction', $globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  36427. $core.addMethod(
  36428. $core.method({
  36429. selector: "arguments",
  36430. protocol: 'accessing',
  36431. fn: function (){
  36432. var self=this;
  36433. return $core.withContext(function($ctx1) {
  36434. var $1,$receiver;
  36435. $1=self["@arguments"];
  36436. if(($receiver = $1) == null || $receiver.isNil){
  36437. return [];
  36438. } else {
  36439. return $1;
  36440. };
  36441. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  36442. },
  36443. args: [],
  36444. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  36445. referencedClasses: [],
  36446. messageSends: ["ifNil:"]
  36447. }),
  36448. $globals.IRClosureInstruction);
  36449. $core.addMethod(
  36450. $core.method({
  36451. selector: "arguments:",
  36452. protocol: 'accessing',
  36453. fn: function (aCollection){
  36454. var self=this;
  36455. self["@arguments"]=aCollection;
  36456. return self;
  36457. },
  36458. args: ["aCollection"],
  36459. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  36460. referencedClasses: [],
  36461. messageSends: []
  36462. }),
  36463. $globals.IRClosureInstruction);
  36464. $core.addMethod(
  36465. $core.method({
  36466. selector: "locals",
  36467. protocol: 'accessing',
  36468. fn: function (){
  36469. var self=this;
  36470. return $core.withContext(function($ctx1) {
  36471. var $1;
  36472. $1=$recv(self._arguments())._copy();
  36473. $recv($1)._addAll_($recv(self._tempDeclarations())._collect_((function(each){
  36474. return $core.withContext(function($ctx2) {
  36475. return $recv(each)._name();
  36476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36477. })));
  36478. return $recv($1)._yourself();
  36479. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  36480. },
  36481. args: [],
  36482. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  36483. referencedClasses: [],
  36484. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  36485. }),
  36486. $globals.IRClosureInstruction);
  36487. $core.addMethod(
  36488. $core.method({
  36489. selector: "requiresSmalltalkContext",
  36490. protocol: 'accessing',
  36491. fn: function (){
  36492. var self=this;
  36493. return $core.withContext(function($ctx1) {
  36494. var $1,$receiver;
  36495. $1=self["@requiresSmalltalkContext"];
  36496. if(($receiver = $1) == null || $receiver.isNil){
  36497. return false;
  36498. } else {
  36499. return $1;
  36500. };
  36501. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  36502. },
  36503. args: [],
  36504. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  36505. referencedClasses: [],
  36506. messageSends: ["ifNil:"]
  36507. }),
  36508. $globals.IRClosureInstruction);
  36509. $core.addMethod(
  36510. $core.method({
  36511. selector: "requiresSmalltalkContext:",
  36512. protocol: 'accessing',
  36513. fn: function (anObject){
  36514. var self=this;
  36515. self["@requiresSmalltalkContext"]=anObject;
  36516. return self;
  36517. },
  36518. args: ["anObject"],
  36519. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  36520. referencedClasses: [],
  36521. messageSends: []
  36522. }),
  36523. $globals.IRClosureInstruction);
  36524. $core.addMethod(
  36525. $core.method({
  36526. selector: "scope:",
  36527. protocol: 'accessing',
  36528. fn: function (aScope){
  36529. var self=this;
  36530. return $core.withContext(function($ctx1) {
  36531. (
  36532. $ctx1.supercall = true,
  36533. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($recv(self), [aScope]));
  36534. $ctx1.supercall = false;
  36535. $recv(aScope)._instruction_(self);
  36536. return self;
  36537. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  36538. },
  36539. args: ["aScope"],
  36540. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  36541. referencedClasses: [],
  36542. messageSends: ["scope:", "instruction:"]
  36543. }),
  36544. $globals.IRClosureInstruction);
  36545. $core.addMethod(
  36546. $core.method({
  36547. selector: "tempDeclarations",
  36548. protocol: 'accessing',
  36549. fn: function (){
  36550. var self=this;
  36551. return $core.withContext(function($ctx1) {
  36552. return $recv(self._dagChildren())._select_((function(each){
  36553. return $core.withContext(function($ctx2) {
  36554. return $recv(each)._isTempDeclaration();
  36555. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36556. }));
  36557. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  36558. },
  36559. args: [],
  36560. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  36561. referencedClasses: [],
  36562. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  36563. }),
  36564. $globals.IRClosureInstruction);
  36565. $core.addClass('IRClosure', $globals.IRClosureInstruction, [], 'Compiler-IR');
  36566. $core.addMethod(
  36567. $core.method({
  36568. selector: "acceptDagVisitor:",
  36569. protocol: 'visiting',
  36570. fn: function (aVisitor){
  36571. var self=this;
  36572. return $core.withContext(function($ctx1) {
  36573. return $recv(aVisitor)._visitIRClosure_(self);
  36574. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  36575. },
  36576. args: ["aVisitor"],
  36577. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  36578. referencedClasses: [],
  36579. messageSends: ["visitIRClosure:"]
  36580. }),
  36581. $globals.IRClosure);
  36582. $core.addMethod(
  36583. $core.method({
  36584. selector: "isClosure",
  36585. protocol: 'testing',
  36586. fn: function (){
  36587. var self=this;
  36588. return true;
  36589. },
  36590. args: [],
  36591. source: "isClosure\x0a\x09^ true",
  36592. referencedClasses: [],
  36593. messageSends: []
  36594. }),
  36595. $globals.IRClosure);
  36596. $core.addMethod(
  36597. $core.method({
  36598. selector: "sequence",
  36599. protocol: 'accessing',
  36600. fn: function (){
  36601. var self=this;
  36602. return $core.withContext(function($ctx1) {
  36603. return $recv(self._dagChildren())._last();
  36604. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  36605. },
  36606. args: [],
  36607. source: "sequence\x0a\x09^ self dagChildren last",
  36608. referencedClasses: [],
  36609. messageSends: ["last", "dagChildren"]
  36610. }),
  36611. $globals.IRClosure);
  36612. $core.addClass('IRMethod', $globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  36613. $globals.IRMethod.comment="I am a method instruction";
  36614. $core.addMethod(
  36615. $core.method({
  36616. selector: "acceptDagVisitor:",
  36617. protocol: 'visiting',
  36618. fn: function (aVisitor){
  36619. var self=this;
  36620. return $core.withContext(function($ctx1) {
  36621. return $recv(aVisitor)._visitIRMethod_(self);
  36622. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  36623. },
  36624. args: ["aVisitor"],
  36625. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  36626. referencedClasses: [],
  36627. messageSends: ["visitIRMethod:"]
  36628. }),
  36629. $globals.IRMethod);
  36630. $core.addMethod(
  36631. $core.method({
  36632. selector: "classReferences",
  36633. protocol: 'accessing',
  36634. fn: function (){
  36635. var self=this;
  36636. return self["@classReferences"];
  36637. },
  36638. args: [],
  36639. source: "classReferences\x0a\x09^ classReferences",
  36640. referencedClasses: [],
  36641. messageSends: []
  36642. }),
  36643. $globals.IRMethod);
  36644. $core.addMethod(
  36645. $core.method({
  36646. selector: "classReferences:",
  36647. protocol: 'accessing',
  36648. fn: function (aCollection){
  36649. var self=this;
  36650. self["@classReferences"]=aCollection;
  36651. return self;
  36652. },
  36653. args: ["aCollection"],
  36654. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  36655. referencedClasses: [],
  36656. messageSends: []
  36657. }),
  36658. $globals.IRMethod);
  36659. $core.addMethod(
  36660. $core.method({
  36661. selector: "internalVariables",
  36662. protocol: 'accessing',
  36663. fn: function (){
  36664. var self=this;
  36665. return $core.withContext(function($ctx1) {
  36666. var $1,$receiver;
  36667. $1=self["@internalVariables"];
  36668. if(($receiver = $1) == null || $receiver.isNil){
  36669. self["@internalVariables"]=$recv($globals.Set)._new();
  36670. return self["@internalVariables"];
  36671. } else {
  36672. return $1;
  36673. };
  36674. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  36675. },
  36676. args: [],
  36677. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  36678. referencedClasses: ["Set"],
  36679. messageSends: ["ifNil:", "new"]
  36680. }),
  36681. $globals.IRMethod);
  36682. $core.addMethod(
  36683. $core.method({
  36684. selector: "isMethod",
  36685. protocol: 'testing',
  36686. fn: function (){
  36687. var self=this;
  36688. return true;
  36689. },
  36690. args: [],
  36691. source: "isMethod\x0a\x09^ true",
  36692. referencedClasses: [],
  36693. messageSends: []
  36694. }),
  36695. $globals.IRMethod);
  36696. $core.addMethod(
  36697. $core.method({
  36698. selector: "messageSends",
  36699. protocol: 'accessing',
  36700. fn: function (){
  36701. var self=this;
  36702. return $core.withContext(function($ctx1) {
  36703. return $recv(self._sendIndexes())._keys();
  36704. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  36705. },
  36706. args: [],
  36707. source: "messageSends\x0a\x09^ self sendIndexes keys",
  36708. referencedClasses: [],
  36709. messageSends: ["keys", "sendIndexes"]
  36710. }),
  36711. $globals.IRMethod);
  36712. $core.addMethod(
  36713. $core.method({
  36714. selector: "method",
  36715. protocol: 'accessing',
  36716. fn: function (){
  36717. var self=this;
  36718. return self;
  36719. },
  36720. args: [],
  36721. source: "method\x0a\x09^ self",
  36722. referencedClasses: [],
  36723. messageSends: []
  36724. }),
  36725. $globals.IRMethod);
  36726. $core.addMethod(
  36727. $core.method({
  36728. selector: "selector",
  36729. protocol: 'accessing',
  36730. fn: function (){
  36731. var self=this;
  36732. return self["@selector"];
  36733. },
  36734. args: [],
  36735. source: "selector\x0a\x09^ selector",
  36736. referencedClasses: [],
  36737. messageSends: []
  36738. }),
  36739. $globals.IRMethod);
  36740. $core.addMethod(
  36741. $core.method({
  36742. selector: "selector:",
  36743. protocol: 'accessing',
  36744. fn: function (aString){
  36745. var self=this;
  36746. self["@selector"]=aString;
  36747. return self;
  36748. },
  36749. args: ["aString"],
  36750. source: "selector: aString\x0a\x09selector := aString",
  36751. referencedClasses: [],
  36752. messageSends: []
  36753. }),
  36754. $globals.IRMethod);
  36755. $core.addMethod(
  36756. $core.method({
  36757. selector: "sendIndexes",
  36758. protocol: 'accessing',
  36759. fn: function (){
  36760. var self=this;
  36761. return self["@sendIndexes"];
  36762. },
  36763. args: [],
  36764. source: "sendIndexes\x0a\x09^ sendIndexes",
  36765. referencedClasses: [],
  36766. messageSends: []
  36767. }),
  36768. $globals.IRMethod);
  36769. $core.addMethod(
  36770. $core.method({
  36771. selector: "sendIndexes:",
  36772. protocol: 'accessing',
  36773. fn: function (aDictionary){
  36774. var self=this;
  36775. self["@sendIndexes"]=aDictionary;
  36776. return self;
  36777. },
  36778. args: ["aDictionary"],
  36779. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  36780. referencedClasses: [],
  36781. messageSends: []
  36782. }),
  36783. $globals.IRMethod);
  36784. $core.addMethod(
  36785. $core.method({
  36786. selector: "source",
  36787. protocol: 'accessing',
  36788. fn: function (){
  36789. var self=this;
  36790. return self["@source"];
  36791. },
  36792. args: [],
  36793. source: "source\x0a\x09^ source",
  36794. referencedClasses: [],
  36795. messageSends: []
  36796. }),
  36797. $globals.IRMethod);
  36798. $core.addMethod(
  36799. $core.method({
  36800. selector: "source:",
  36801. protocol: 'accessing',
  36802. fn: function (aString){
  36803. var self=this;
  36804. self["@source"]=aString;
  36805. return self;
  36806. },
  36807. args: ["aString"],
  36808. source: "source: aString\x0a\x09source := aString",
  36809. referencedClasses: [],
  36810. messageSends: []
  36811. }),
  36812. $globals.IRMethod);
  36813. $core.addMethod(
  36814. $core.method({
  36815. selector: "theClass",
  36816. protocol: 'accessing',
  36817. fn: function (){
  36818. var self=this;
  36819. return self["@theClass"];
  36820. },
  36821. args: [],
  36822. source: "theClass\x0a\x09^ theClass",
  36823. referencedClasses: [],
  36824. messageSends: []
  36825. }),
  36826. $globals.IRMethod);
  36827. $core.addMethod(
  36828. $core.method({
  36829. selector: "theClass:",
  36830. protocol: 'accessing',
  36831. fn: function (aClass){
  36832. var self=this;
  36833. self["@theClass"]=aClass;
  36834. return self;
  36835. },
  36836. args: ["aClass"],
  36837. source: "theClass: aClass\x0a\x09theClass := aClass",
  36838. referencedClasses: [],
  36839. messageSends: []
  36840. }),
  36841. $globals.IRMethod);
  36842. $core.addClass('IRReturn', $globals.IRScopedInstruction, [], 'Compiler-IR');
  36843. $globals.IRReturn.comment="I am a local return instruction.";
  36844. $core.addMethod(
  36845. $core.method({
  36846. selector: "acceptDagVisitor:",
  36847. protocol: 'visiting',
  36848. fn: function (aVisitor){
  36849. var self=this;
  36850. return $core.withContext(function($ctx1) {
  36851. return $recv(aVisitor)._visitIRReturn_(self);
  36852. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  36853. },
  36854. args: ["aVisitor"],
  36855. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  36856. referencedClasses: [],
  36857. messageSends: ["visitIRReturn:"]
  36858. }),
  36859. $globals.IRReturn);
  36860. $core.addMethod(
  36861. $core.method({
  36862. selector: "expression",
  36863. protocol: 'accessing',
  36864. fn: function (){
  36865. var self=this;
  36866. return $core.withContext(function($ctx1) {
  36867. return $recv(self._dagChildren())._single();
  36868. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  36869. },
  36870. args: [],
  36871. source: "expression\x0a\x09^ self dagChildren single",
  36872. referencedClasses: [],
  36873. messageSends: ["single", "dagChildren"]
  36874. }),
  36875. $globals.IRReturn);
  36876. $core.addMethod(
  36877. $core.method({
  36878. selector: "scope",
  36879. protocol: 'accessing',
  36880. fn: function (){
  36881. var self=this;
  36882. return $core.withContext(function($ctx1) {
  36883. var $1,$receiver;
  36884. $1=self["@scope"];
  36885. if(($receiver = $1) == null || $receiver.isNil){
  36886. return $recv(self._parent())._scope();
  36887. } else {
  36888. return $1;
  36889. };
  36890. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  36891. },
  36892. args: [],
  36893. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  36894. referencedClasses: [],
  36895. messageSends: ["ifNil:", "scope", "parent"]
  36896. }),
  36897. $globals.IRReturn);
  36898. $core.addMethod(
  36899. $core.method({
  36900. selector: "yieldsValue",
  36901. protocol: 'testing',
  36902. fn: function (){
  36903. var self=this;
  36904. return false;
  36905. },
  36906. args: [],
  36907. source: "yieldsValue\x0a\x09^ false",
  36908. referencedClasses: [],
  36909. messageSends: []
  36910. }),
  36911. $globals.IRReturn);
  36912. $core.addClass('IRBlockReturn', $globals.IRReturn, [], 'Compiler-IR');
  36913. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  36914. $core.addMethod(
  36915. $core.method({
  36916. selector: "acceptDagVisitor:",
  36917. protocol: 'visiting',
  36918. fn: function (aVisitor){
  36919. var self=this;
  36920. return $core.withContext(function($ctx1) {
  36921. return $recv(aVisitor)._visitIRBlockReturn_(self);
  36922. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  36923. },
  36924. args: ["aVisitor"],
  36925. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  36926. referencedClasses: [],
  36927. messageSends: ["visitIRBlockReturn:"]
  36928. }),
  36929. $globals.IRBlockReturn);
  36930. $core.addClass('IRNonLocalReturn', $globals.IRReturn, [], 'Compiler-IR');
  36931. $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.";
  36932. $core.addMethod(
  36933. $core.method({
  36934. selector: "acceptDagVisitor:",
  36935. protocol: 'visiting',
  36936. fn: function (aVisitor){
  36937. var self=this;
  36938. return $core.withContext(function($ctx1) {
  36939. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  36940. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  36941. },
  36942. args: ["aVisitor"],
  36943. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  36944. referencedClasses: [],
  36945. messageSends: ["visitIRNonLocalReturn:"]
  36946. }),
  36947. $globals.IRNonLocalReturn);
  36948. $core.addClass('IRTempDeclaration', $globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  36949. $core.addMethod(
  36950. $core.method({
  36951. selector: "acceptDagVisitor:",
  36952. protocol: 'visiting',
  36953. fn: function (aVisitor){
  36954. var self=this;
  36955. return $core.withContext(function($ctx1) {
  36956. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  36957. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  36958. },
  36959. args: ["aVisitor"],
  36960. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  36961. referencedClasses: [],
  36962. messageSends: ["visitIRTempDeclaration:"]
  36963. }),
  36964. $globals.IRTempDeclaration);
  36965. $core.addMethod(
  36966. $core.method({
  36967. selector: "isTempDeclaration",
  36968. protocol: 'testing',
  36969. fn: function (){
  36970. var self=this;
  36971. return true;
  36972. },
  36973. args: [],
  36974. source: "isTempDeclaration\x0a\x09^ true",
  36975. referencedClasses: [],
  36976. messageSends: []
  36977. }),
  36978. $globals.IRTempDeclaration);
  36979. $core.addMethod(
  36980. $core.method({
  36981. selector: "name",
  36982. protocol: 'accessing',
  36983. fn: function (){
  36984. var self=this;
  36985. return self["@name"];
  36986. },
  36987. args: [],
  36988. source: "name\x0a\x09^ name",
  36989. referencedClasses: [],
  36990. messageSends: []
  36991. }),
  36992. $globals.IRTempDeclaration);
  36993. $core.addMethod(
  36994. $core.method({
  36995. selector: "name:",
  36996. protocol: 'accessing',
  36997. fn: function (aString){
  36998. var self=this;
  36999. self["@name"]=aString;
  37000. return self;
  37001. },
  37002. args: ["aString"],
  37003. source: "name: aString\x0a\x09name := aString",
  37004. referencedClasses: [],
  37005. messageSends: []
  37006. }),
  37007. $globals.IRTempDeclaration);
  37008. $core.addClass('IRSend', $globals.IRInstruction, ['selector', 'index'], 'Compiler-IR');
  37009. $globals.IRSend.comment="I am a message send instruction.";
  37010. $core.addMethod(
  37011. $core.method({
  37012. selector: "acceptDagVisitor:",
  37013. protocol: 'visiting',
  37014. fn: function (aVisitor){
  37015. var self=this;
  37016. return $core.withContext(function($ctx1) {
  37017. return $recv(aVisitor)._visitIRSend_(self);
  37018. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  37019. },
  37020. args: ["aVisitor"],
  37021. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  37022. referencedClasses: [],
  37023. messageSends: ["visitIRSend:"]
  37024. }),
  37025. $globals.IRSend);
  37026. $core.addMethod(
  37027. $core.method({
  37028. selector: "arguments",
  37029. protocol: 'accessing',
  37030. fn: function (){
  37031. var self=this;
  37032. return $core.withContext(function($ctx1) {
  37033. return $recv(self._dagChildren())._allButFirst();
  37034. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  37035. },
  37036. args: [],
  37037. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  37038. referencedClasses: [],
  37039. messageSends: ["allButFirst", "dagChildren"]
  37040. }),
  37041. $globals.IRSend);
  37042. $core.addMethod(
  37043. $core.method({
  37044. selector: "index",
  37045. protocol: 'accessing',
  37046. fn: function (){
  37047. var self=this;
  37048. return self["@index"];
  37049. },
  37050. args: [],
  37051. source: "index\x0a\x09^ index",
  37052. referencedClasses: [],
  37053. messageSends: []
  37054. }),
  37055. $globals.IRSend);
  37056. $core.addMethod(
  37057. $core.method({
  37058. selector: "index:",
  37059. protocol: 'accessing',
  37060. fn: function (anInteger){
  37061. var self=this;
  37062. self["@index"]=anInteger;
  37063. return self;
  37064. },
  37065. args: ["anInteger"],
  37066. source: "index: anInteger\x0a\x09index := anInteger",
  37067. referencedClasses: [],
  37068. messageSends: []
  37069. }),
  37070. $globals.IRSend);
  37071. $core.addMethod(
  37072. $core.method({
  37073. selector: "isSend",
  37074. protocol: 'testing',
  37075. fn: function (){
  37076. var self=this;
  37077. return true;
  37078. },
  37079. args: [],
  37080. source: "isSend\x0a\x09^ true",
  37081. referencedClasses: [],
  37082. messageSends: []
  37083. }),
  37084. $globals.IRSend);
  37085. $core.addMethod(
  37086. $core.method({
  37087. selector: "isSuperSend",
  37088. protocol: 'testing',
  37089. fn: function (){
  37090. var self=this;
  37091. var receiver;
  37092. return $core.withContext(function($ctx1) {
  37093. receiver=self._receiver();
  37094. return $recv($recv(receiver)._isVariable())._and_((function(){
  37095. return $core.withContext(function($ctx2) {
  37096. return $recv($recv($recv(receiver)._variable())._name()).__eq("super");
  37097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37098. }));
  37099. }, function($ctx1) {$ctx1.fill(self,"isSuperSend",{receiver:receiver},$globals.IRSend)});
  37100. },
  37101. args: [],
  37102. source: "isSuperSend\x0a\x09| receiver |\x0a\x09receiver := self receiver.\x0a\x09^ receiver isVariable and: [ receiver variable name = 'super' ]",
  37103. referencedClasses: [],
  37104. messageSends: ["receiver", "and:", "isVariable", "=", "name", "variable"]
  37105. }),
  37106. $globals.IRSend);
  37107. $core.addMethod(
  37108. $core.method({
  37109. selector: "receiver",
  37110. protocol: 'accessing',
  37111. fn: function (){
  37112. var self=this;
  37113. return $core.withContext(function($ctx1) {
  37114. return $recv(self._dagChildren())._first();
  37115. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  37116. },
  37117. args: [],
  37118. source: "receiver\x0a\x09^ self dagChildren first",
  37119. referencedClasses: [],
  37120. messageSends: ["first", "dagChildren"]
  37121. }),
  37122. $globals.IRSend);
  37123. $core.addMethod(
  37124. $core.method({
  37125. selector: "selector",
  37126. protocol: 'accessing',
  37127. fn: function (){
  37128. var self=this;
  37129. return self["@selector"];
  37130. },
  37131. args: [],
  37132. source: "selector\x0a\x09^ selector",
  37133. referencedClasses: [],
  37134. messageSends: []
  37135. }),
  37136. $globals.IRSend);
  37137. $core.addMethod(
  37138. $core.method({
  37139. selector: "selector:",
  37140. protocol: 'accessing',
  37141. fn: function (aString){
  37142. var self=this;
  37143. self["@selector"]=aString;
  37144. return self;
  37145. },
  37146. args: ["aString"],
  37147. source: "selector: aString\x0a\x09selector := aString",
  37148. referencedClasses: [],
  37149. messageSends: []
  37150. }),
  37151. $globals.IRSend);
  37152. $core.addClass('IRSequence', $globals.IRInstruction, [], 'Compiler-IR');
  37153. $core.addMethod(
  37154. $core.method({
  37155. selector: "acceptDagVisitor:",
  37156. protocol: 'visiting',
  37157. fn: function (aVisitor){
  37158. var self=this;
  37159. return $core.withContext(function($ctx1) {
  37160. return $recv(aVisitor)._visitIRSequence_(self);
  37161. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  37162. },
  37163. args: ["aVisitor"],
  37164. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  37165. referencedClasses: [],
  37166. messageSends: ["visitIRSequence:"]
  37167. }),
  37168. $globals.IRSequence);
  37169. $core.addMethod(
  37170. $core.method({
  37171. selector: "isSequence",
  37172. protocol: 'testing',
  37173. fn: function (){
  37174. var self=this;
  37175. return true;
  37176. },
  37177. args: [],
  37178. source: "isSequence\x0a\x09^ true",
  37179. referencedClasses: [],
  37180. messageSends: []
  37181. }),
  37182. $globals.IRSequence);
  37183. $core.addClass('IRBlockSequence', $globals.IRSequence, [], 'Compiler-IR');
  37184. $core.addMethod(
  37185. $core.method({
  37186. selector: "acceptDagVisitor:",
  37187. protocol: 'visiting',
  37188. fn: function (aVisitor){
  37189. var self=this;
  37190. return $core.withContext(function($ctx1) {
  37191. return $recv(aVisitor)._visitIRBlockSequence_(self);
  37192. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  37193. },
  37194. args: ["aVisitor"],
  37195. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  37196. referencedClasses: [],
  37197. messageSends: ["visitIRBlockSequence:"]
  37198. }),
  37199. $globals.IRBlockSequence);
  37200. $core.addClass('IRValue', $globals.IRInstruction, ['value'], 'Compiler-IR');
  37201. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  37202. $core.addMethod(
  37203. $core.method({
  37204. selector: "acceptDagVisitor:",
  37205. protocol: 'visiting',
  37206. fn: function (aVisitor){
  37207. var self=this;
  37208. return $core.withContext(function($ctx1) {
  37209. return $recv(aVisitor)._visitIRValue_(self);
  37210. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  37211. },
  37212. args: ["aVisitor"],
  37213. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  37214. referencedClasses: [],
  37215. messageSends: ["visitIRValue:"]
  37216. }),
  37217. $globals.IRValue);
  37218. $core.addMethod(
  37219. $core.method({
  37220. selector: "needsBoxingAsReceiver",
  37221. protocol: 'testing',
  37222. fn: function (){
  37223. var self=this;
  37224. return false;
  37225. },
  37226. args: [],
  37227. source: "needsBoxingAsReceiver\x0a\x09^ false",
  37228. referencedClasses: [],
  37229. messageSends: []
  37230. }),
  37231. $globals.IRValue);
  37232. $core.addMethod(
  37233. $core.method({
  37234. selector: "value",
  37235. protocol: 'accessing',
  37236. fn: function (){
  37237. var self=this;
  37238. return self["@value"];
  37239. },
  37240. args: [],
  37241. source: "value\x0a\x09^ value",
  37242. referencedClasses: [],
  37243. messageSends: []
  37244. }),
  37245. $globals.IRValue);
  37246. $core.addMethod(
  37247. $core.method({
  37248. selector: "value:",
  37249. protocol: 'accessing',
  37250. fn: function (aString){
  37251. var self=this;
  37252. self["@value"]=aString;
  37253. return self;
  37254. },
  37255. args: ["aString"],
  37256. source: "value: aString\x0a\x09value := aString",
  37257. referencedClasses: [],
  37258. messageSends: []
  37259. }),
  37260. $globals.IRValue);
  37261. $core.addClass('IRVariable', $globals.IRInstruction, ['variable'], 'Compiler-IR');
  37262. $globals.IRVariable.comment="I am a variable instruction.";
  37263. $core.addMethod(
  37264. $core.method({
  37265. selector: "acceptDagVisitor:",
  37266. protocol: 'visiting',
  37267. fn: function (aVisitor){
  37268. var self=this;
  37269. return $core.withContext(function($ctx1) {
  37270. return $recv(aVisitor)._visitIRVariable_(self);
  37271. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  37272. },
  37273. args: ["aVisitor"],
  37274. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  37275. referencedClasses: [],
  37276. messageSends: ["visitIRVariable:"]
  37277. }),
  37278. $globals.IRVariable);
  37279. $core.addMethod(
  37280. $core.method({
  37281. selector: "isVariable",
  37282. protocol: 'testing',
  37283. fn: function (){
  37284. var self=this;
  37285. return true;
  37286. },
  37287. args: [],
  37288. source: "isVariable\x0a\x09^ true",
  37289. referencedClasses: [],
  37290. messageSends: []
  37291. }),
  37292. $globals.IRVariable);
  37293. $core.addMethod(
  37294. $core.method({
  37295. selector: "needsBoxingAsReceiver",
  37296. protocol: 'testing',
  37297. fn: function (){
  37298. var self=this;
  37299. return $core.withContext(function($ctx1) {
  37300. return $recv($recv(self._variable())._isPseudoVar())._not();
  37301. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  37302. },
  37303. args: [],
  37304. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  37305. referencedClasses: [],
  37306. messageSends: ["not", "isPseudoVar", "variable"]
  37307. }),
  37308. $globals.IRVariable);
  37309. $core.addMethod(
  37310. $core.method({
  37311. selector: "variable",
  37312. protocol: 'accessing',
  37313. fn: function (){
  37314. var self=this;
  37315. return self["@variable"];
  37316. },
  37317. args: [],
  37318. source: "variable\x0a\x09^ variable",
  37319. referencedClasses: [],
  37320. messageSends: []
  37321. }),
  37322. $globals.IRVariable);
  37323. $core.addMethod(
  37324. $core.method({
  37325. selector: "variable:",
  37326. protocol: 'accessing',
  37327. fn: function (aScopeVariable){
  37328. var self=this;
  37329. self["@variable"]=aScopeVariable;
  37330. return self;
  37331. },
  37332. args: ["aScopeVariable"],
  37333. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  37334. referencedClasses: [],
  37335. messageSends: []
  37336. }),
  37337. $globals.IRVariable);
  37338. $core.addClass('IRVerbatim', $globals.IRInstruction, ['source'], 'Compiler-IR');
  37339. $core.addMethod(
  37340. $core.method({
  37341. selector: "acceptDagVisitor:",
  37342. protocol: 'visiting',
  37343. fn: function (aVisitor){
  37344. var self=this;
  37345. return $core.withContext(function($ctx1) {
  37346. return $recv(aVisitor)._visitIRVerbatim_(self);
  37347. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  37348. },
  37349. args: ["aVisitor"],
  37350. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  37351. referencedClasses: [],
  37352. messageSends: ["visitIRVerbatim:"]
  37353. }),
  37354. $globals.IRVerbatim);
  37355. $core.addMethod(
  37356. $core.method({
  37357. selector: "source",
  37358. protocol: 'accessing',
  37359. fn: function (){
  37360. var self=this;
  37361. return self["@source"];
  37362. },
  37363. args: [],
  37364. source: "source\x0a\x09^ source",
  37365. referencedClasses: [],
  37366. messageSends: []
  37367. }),
  37368. $globals.IRVerbatim);
  37369. $core.addMethod(
  37370. $core.method({
  37371. selector: "source:",
  37372. protocol: 'accessing',
  37373. fn: function (aString){
  37374. var self=this;
  37375. self["@source"]=aString;
  37376. return self;
  37377. },
  37378. args: ["aString"],
  37379. source: "source: aString\x0a\x09source := aString",
  37380. referencedClasses: [],
  37381. messageSends: []
  37382. }),
  37383. $globals.IRVerbatim);
  37384. $core.addClass('IRVisitor', $globals.ParentFakingPathDagVisitor, [], 'Compiler-IR');
  37385. $core.addMethod(
  37386. $core.method({
  37387. selector: "visitDagNode:",
  37388. protocol: 'visiting',
  37389. fn: function (aNode){
  37390. var self=this;
  37391. return $core.withContext(function($ctx1) {
  37392. return self._visitDagNodeVariantSimple_(aNode);
  37393. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  37394. },
  37395. args: ["aNode"],
  37396. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  37397. referencedClasses: [],
  37398. messageSends: ["visitDagNodeVariantSimple:"]
  37399. }),
  37400. $globals.IRVisitor);
  37401. $core.addMethod(
  37402. $core.method({
  37403. selector: "visitIRAssignment:",
  37404. protocol: 'visiting',
  37405. fn: function (anIRAssignment){
  37406. var self=this;
  37407. return $core.withContext(function($ctx1) {
  37408. return self._visitDagNode_(anIRAssignment);
  37409. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  37410. },
  37411. args: ["anIRAssignment"],
  37412. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  37413. referencedClasses: [],
  37414. messageSends: ["visitDagNode:"]
  37415. }),
  37416. $globals.IRVisitor);
  37417. $core.addMethod(
  37418. $core.method({
  37419. selector: "visitIRBlockReturn:",
  37420. protocol: 'visiting',
  37421. fn: function (anIRBlockReturn){
  37422. var self=this;
  37423. return $core.withContext(function($ctx1) {
  37424. return self._visitIRReturn_(anIRBlockReturn);
  37425. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  37426. },
  37427. args: ["anIRBlockReturn"],
  37428. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  37429. referencedClasses: [],
  37430. messageSends: ["visitIRReturn:"]
  37431. }),
  37432. $globals.IRVisitor);
  37433. $core.addMethod(
  37434. $core.method({
  37435. selector: "visitIRBlockSequence:",
  37436. protocol: 'visiting',
  37437. fn: function (anIRBlockSequence){
  37438. var self=this;
  37439. return $core.withContext(function($ctx1) {
  37440. return self._visitIRSequence_(anIRBlockSequence);
  37441. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  37442. },
  37443. args: ["anIRBlockSequence"],
  37444. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  37445. referencedClasses: [],
  37446. messageSends: ["visitIRSequence:"]
  37447. }),
  37448. $globals.IRVisitor);
  37449. $core.addMethod(
  37450. $core.method({
  37451. selector: "visitIRClosure:",
  37452. protocol: 'visiting',
  37453. fn: function (anIRClosure){
  37454. var self=this;
  37455. return $core.withContext(function($ctx1) {
  37456. return self._visitDagNode_(anIRClosure);
  37457. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  37458. },
  37459. args: ["anIRClosure"],
  37460. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  37461. referencedClasses: [],
  37462. messageSends: ["visitDagNode:"]
  37463. }),
  37464. $globals.IRVisitor);
  37465. $core.addMethod(
  37466. $core.method({
  37467. selector: "visitIRDynamicArray:",
  37468. protocol: 'visiting',
  37469. fn: function (anIRDynamicArray){
  37470. var self=this;
  37471. return $core.withContext(function($ctx1) {
  37472. return self._visitDagNode_(anIRDynamicArray);
  37473. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  37474. },
  37475. args: ["anIRDynamicArray"],
  37476. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  37477. referencedClasses: [],
  37478. messageSends: ["visitDagNode:"]
  37479. }),
  37480. $globals.IRVisitor);
  37481. $core.addMethod(
  37482. $core.method({
  37483. selector: "visitIRDynamicDictionary:",
  37484. protocol: 'visiting',
  37485. fn: function (anIRDynamicDictionary){
  37486. var self=this;
  37487. return $core.withContext(function($ctx1) {
  37488. return self._visitDagNode_(anIRDynamicDictionary);
  37489. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  37490. },
  37491. args: ["anIRDynamicDictionary"],
  37492. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  37493. referencedClasses: [],
  37494. messageSends: ["visitDagNode:"]
  37495. }),
  37496. $globals.IRVisitor);
  37497. $core.addMethod(
  37498. $core.method({
  37499. selector: "visitIRInlinedClosure:",
  37500. protocol: 'visiting',
  37501. fn: function (anIRInlinedClosure){
  37502. var self=this;
  37503. return $core.withContext(function($ctx1) {
  37504. return self._visitIRClosure_(anIRInlinedClosure);
  37505. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  37506. },
  37507. args: ["anIRInlinedClosure"],
  37508. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  37509. referencedClasses: [],
  37510. messageSends: ["visitIRClosure:"]
  37511. }),
  37512. $globals.IRVisitor);
  37513. $core.addMethod(
  37514. $core.method({
  37515. selector: "visitIRInlinedSequence:",
  37516. protocol: 'visiting',
  37517. fn: function (anIRInlinedSequence){
  37518. var self=this;
  37519. return $core.withContext(function($ctx1) {
  37520. return self._visitIRSequence_(anIRInlinedSequence);
  37521. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  37522. },
  37523. args: ["anIRInlinedSequence"],
  37524. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  37525. referencedClasses: [],
  37526. messageSends: ["visitIRSequence:"]
  37527. }),
  37528. $globals.IRVisitor);
  37529. $core.addMethod(
  37530. $core.method({
  37531. selector: "visitIRMethod:",
  37532. protocol: 'visiting',
  37533. fn: function (anIRMethod){
  37534. var self=this;
  37535. return $core.withContext(function($ctx1) {
  37536. return self._visitDagNode_(anIRMethod);
  37537. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  37538. },
  37539. args: ["anIRMethod"],
  37540. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  37541. referencedClasses: [],
  37542. messageSends: ["visitDagNode:"]
  37543. }),
  37544. $globals.IRVisitor);
  37545. $core.addMethod(
  37546. $core.method({
  37547. selector: "visitIRNonLocalReturn:",
  37548. protocol: 'visiting',
  37549. fn: function (anIRNonLocalReturn){
  37550. var self=this;
  37551. return $core.withContext(function($ctx1) {
  37552. return self._visitDagNode_(anIRNonLocalReturn);
  37553. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  37554. },
  37555. args: ["anIRNonLocalReturn"],
  37556. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  37557. referencedClasses: [],
  37558. messageSends: ["visitDagNode:"]
  37559. }),
  37560. $globals.IRVisitor);
  37561. $core.addMethod(
  37562. $core.method({
  37563. selector: "visitIRNonLocalReturnHandling:",
  37564. protocol: 'visiting',
  37565. fn: function (anIRNonLocalReturnHandling){
  37566. var self=this;
  37567. return $core.withContext(function($ctx1) {
  37568. return self._visitDagNode_(anIRNonLocalReturnHandling);
  37569. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  37570. },
  37571. args: ["anIRNonLocalReturnHandling"],
  37572. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  37573. referencedClasses: [],
  37574. messageSends: ["visitDagNode:"]
  37575. }),
  37576. $globals.IRVisitor);
  37577. $core.addMethod(
  37578. $core.method({
  37579. selector: "visitIRReturn:",
  37580. protocol: 'visiting',
  37581. fn: function (anIRReturn){
  37582. var self=this;
  37583. return $core.withContext(function($ctx1) {
  37584. return self._visitDagNode_(anIRReturn);
  37585. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  37586. },
  37587. args: ["anIRReturn"],
  37588. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  37589. referencedClasses: [],
  37590. messageSends: ["visitDagNode:"]
  37591. }),
  37592. $globals.IRVisitor);
  37593. $core.addMethod(
  37594. $core.method({
  37595. selector: "visitIRSend:",
  37596. protocol: 'visiting',
  37597. fn: function (anIRSend){
  37598. var self=this;
  37599. return $core.withContext(function($ctx1) {
  37600. return self._visitDagNode_(anIRSend);
  37601. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  37602. },
  37603. args: ["anIRSend"],
  37604. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  37605. referencedClasses: [],
  37606. messageSends: ["visitDagNode:"]
  37607. }),
  37608. $globals.IRVisitor);
  37609. $core.addMethod(
  37610. $core.method({
  37611. selector: "visitIRSequence:",
  37612. protocol: 'visiting',
  37613. fn: function (anIRSequence){
  37614. var self=this;
  37615. return $core.withContext(function($ctx1) {
  37616. return self._visitDagNode_(anIRSequence);
  37617. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  37618. },
  37619. args: ["anIRSequence"],
  37620. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  37621. referencedClasses: [],
  37622. messageSends: ["visitDagNode:"]
  37623. }),
  37624. $globals.IRVisitor);
  37625. $core.addMethod(
  37626. $core.method({
  37627. selector: "visitIRTempDeclaration:",
  37628. protocol: 'visiting',
  37629. fn: function (anIRTempDeclaration){
  37630. var self=this;
  37631. return $core.withContext(function($ctx1) {
  37632. return self._visitDagNode_(anIRTempDeclaration);
  37633. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  37634. },
  37635. args: ["anIRTempDeclaration"],
  37636. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  37637. referencedClasses: [],
  37638. messageSends: ["visitDagNode:"]
  37639. }),
  37640. $globals.IRVisitor);
  37641. $core.addMethod(
  37642. $core.method({
  37643. selector: "visitIRValue:",
  37644. protocol: 'visiting',
  37645. fn: function (anIRValue){
  37646. var self=this;
  37647. return $core.withContext(function($ctx1) {
  37648. return self._visitDagNode_(anIRValue);
  37649. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  37650. },
  37651. args: ["anIRValue"],
  37652. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  37653. referencedClasses: [],
  37654. messageSends: ["visitDagNode:"]
  37655. }),
  37656. $globals.IRVisitor);
  37657. $core.addMethod(
  37658. $core.method({
  37659. selector: "visitIRVariable:",
  37660. protocol: 'visiting',
  37661. fn: function (anIRVariable){
  37662. var self=this;
  37663. return $core.withContext(function($ctx1) {
  37664. return self._visitDagNode_(anIRVariable);
  37665. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  37666. },
  37667. args: ["anIRVariable"],
  37668. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  37669. referencedClasses: [],
  37670. messageSends: ["visitDagNode:"]
  37671. }),
  37672. $globals.IRVisitor);
  37673. $core.addMethod(
  37674. $core.method({
  37675. selector: "visitIRVerbatim:",
  37676. protocol: 'visiting',
  37677. fn: function (anIRVerbatim){
  37678. var self=this;
  37679. return $core.withContext(function($ctx1) {
  37680. return self._visitDagNode_(anIRVerbatim);
  37681. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  37682. },
  37683. args: ["anIRVerbatim"],
  37684. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  37685. referencedClasses: [],
  37686. messageSends: ["visitDagNode:"]
  37687. }),
  37688. $globals.IRVisitor);
  37689. $core.addClass('IRJSTranslator', $globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  37690. $core.addMethod(
  37691. $core.method({
  37692. selector: "contents",
  37693. protocol: 'accessing',
  37694. fn: function (){
  37695. var self=this;
  37696. return $core.withContext(function($ctx1) {
  37697. return $recv(self._stream())._contents();
  37698. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  37699. },
  37700. args: [],
  37701. source: "contents\x0a\x09^ self stream contents",
  37702. referencedClasses: [],
  37703. messageSends: ["contents", "stream"]
  37704. }),
  37705. $globals.IRJSTranslator);
  37706. $core.addMethod(
  37707. $core.method({
  37708. selector: "currentClass",
  37709. protocol: 'accessing',
  37710. fn: function (){
  37711. var self=this;
  37712. return self["@currentClass"];
  37713. },
  37714. args: [],
  37715. source: "currentClass\x0a\x09^ currentClass",
  37716. referencedClasses: [],
  37717. messageSends: []
  37718. }),
  37719. $globals.IRJSTranslator);
  37720. $core.addMethod(
  37721. $core.method({
  37722. selector: "currentClass:",
  37723. protocol: 'accessing',
  37724. fn: function (aClass){
  37725. var self=this;
  37726. self["@currentClass"]=aClass;
  37727. return self;
  37728. },
  37729. args: ["aClass"],
  37730. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  37731. referencedClasses: [],
  37732. messageSends: []
  37733. }),
  37734. $globals.IRJSTranslator);
  37735. $core.addMethod(
  37736. $core.method({
  37737. selector: "initialize",
  37738. protocol: 'initialization',
  37739. fn: function (){
  37740. var self=this;
  37741. return $core.withContext(function($ctx1) {
  37742. (
  37743. $ctx1.supercall = true,
  37744. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  37745. $ctx1.supercall = false;
  37746. self["@stream"]=$recv($globals.JSStream)._new();
  37747. return self;
  37748. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  37749. },
  37750. args: [],
  37751. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  37752. referencedClasses: ["JSStream"],
  37753. messageSends: ["initialize", "new"]
  37754. }),
  37755. $globals.IRJSTranslator);
  37756. $core.addMethod(
  37757. $core.method({
  37758. selector: "stream",
  37759. protocol: 'accessing',
  37760. fn: function (){
  37761. var self=this;
  37762. return self["@stream"];
  37763. },
  37764. args: [],
  37765. source: "stream\x0a\x09^ stream",
  37766. referencedClasses: [],
  37767. messageSends: []
  37768. }),
  37769. $globals.IRJSTranslator);
  37770. $core.addMethod(
  37771. $core.method({
  37772. selector: "stream:",
  37773. protocol: 'accessing',
  37774. fn: function (aStream){
  37775. var self=this;
  37776. self["@stream"]=aStream;
  37777. return self;
  37778. },
  37779. args: ["aStream"],
  37780. source: "stream: aStream\x0a\x09stream := aStream",
  37781. referencedClasses: [],
  37782. messageSends: []
  37783. }),
  37784. $globals.IRJSTranslator);
  37785. $core.addMethod(
  37786. $core.method({
  37787. selector: "visitIRAssignment:",
  37788. protocol: 'visiting',
  37789. fn: function (anIRAssignment){
  37790. var self=this;
  37791. return $core.withContext(function($ctx1) {
  37792. $recv(self._stream())._nextPutAssignLhs_rhs_((function(){
  37793. return $core.withContext(function($ctx2) {
  37794. return self._visit_($recv(anIRAssignment)._left());
  37795. $ctx2.sendIdx["visit:"]=1;
  37796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37797. }),(function(){
  37798. return $core.withContext(function($ctx2) {
  37799. return self._visit_($recv(anIRAssignment)._right());
  37800. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  37801. }));
  37802. return self;
  37803. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  37804. },
  37805. args: ["anIRAssignment"],
  37806. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  37807. referencedClasses: [],
  37808. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  37809. }),
  37810. $globals.IRJSTranslator);
  37811. $core.addMethod(
  37812. $core.method({
  37813. selector: "visitIRClosure:",
  37814. protocol: 'visiting',
  37815. fn: function (anIRClosure){
  37816. var self=this;
  37817. return $core.withContext(function($ctx1) {
  37818. var $1,$2;
  37819. $1=self._stream();
  37820. $ctx1.sendIdx["stream"]=1;
  37821. $recv($1)._nextPutClosureWith_arguments_((function(){
  37822. return $core.withContext(function($ctx2) {
  37823. $2=self._stream();
  37824. $ctx2.sendIdx["stream"]=2;
  37825. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  37826. return $core.withContext(function($ctx3) {
  37827. return $recv($recv(each)._name())._asVariableName();
  37828. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  37829. })));
  37830. return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  37831. return $core.withContext(function($ctx3) {
  37832. return (
  37833. $ctx3.supercall = true,
  37834. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure]));
  37835. $ctx3.supercall = false;
  37836. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  37837. }));
  37838. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37839. }),$recv(anIRClosure)._arguments());
  37840. return self;
  37841. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  37842. },
  37843. args: ["anIRClosure"],
  37844. 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",
  37845. referencedClasses: [],
  37846. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  37847. }),
  37848. $globals.IRJSTranslator);
  37849. $core.addMethod(
  37850. $core.method({
  37851. selector: "visitIRDynamicArray:",
  37852. protocol: 'visiting',
  37853. fn: function (anIRDynamicArray){
  37854. var self=this;
  37855. return $core.withContext(function($ctx1) {
  37856. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  37857. return self;
  37858. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  37859. },
  37860. args: ["anIRDynamicArray"],
  37861. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  37862. referencedClasses: [],
  37863. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  37864. }),
  37865. $globals.IRJSTranslator);
  37866. $core.addMethod(
  37867. $core.method({
  37868. selector: "visitIRDynamicDictionary:",
  37869. protocol: 'visiting',
  37870. fn: function (anIRDynamicDictionary){
  37871. var self=this;
  37872. return $core.withContext(function($ctx1) {
  37873. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  37874. return self;
  37875. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  37876. },
  37877. args: ["anIRDynamicDictionary"],
  37878. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  37879. referencedClasses: [],
  37880. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  37881. }),
  37882. $globals.IRJSTranslator);
  37883. $core.addMethod(
  37884. $core.method({
  37885. selector: "visitIRMethod:",
  37886. protocol: 'visiting',
  37887. fn: function (anIRMethod){
  37888. var self=this;
  37889. return $core.withContext(function($ctx1) {
  37890. var $1,$2,$3,$4,$5,$6,$7;
  37891. $1=self._stream();
  37892. $ctx1.sendIdx["stream"]=1;
  37893. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  37894. return $core.withContext(function($ctx2) {
  37895. $2=self._stream();
  37896. $ctx2.sendIdx["stream"]=2;
  37897. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  37898. return $core.withContext(function($ctx3) {
  37899. $3=self._stream();
  37900. $ctx3.sendIdx["stream"]=3;
  37901. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  37902. return $core.withContext(function($ctx4) {
  37903. return $recv($recv(each)._name())._asVariableName();
  37904. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  37905. }));
  37906. $ctx3.sendIdx["collect:"]=1;
  37907. $recv($3)._nextPutVars_($4);
  37908. $ctx3.sendIdx["nextPutVars:"]=1;
  37909. $5=self._stream();
  37910. $ctx3.sendIdx["stream"]=4;
  37911. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  37912. return $core.withContext(function($ctx4) {
  37913. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  37914. return $core.withContext(function($ctx5) {
  37915. $6=self._stream();
  37916. $ctx5.sendIdx["stream"]=5;
  37917. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  37918. return $core.withContext(function($ctx6) {
  37919. return $recv($recv(each)._variable())._alias();
  37920. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  37921. })));
  37922. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  37923. }));
  37924. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  37925. if($core.assert($7)){
  37926. return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  37927. return $core.withContext(function($ctx5) {
  37928. return (
  37929. $ctx5.supercall = true,
  37930. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  37931. $ctx5.supercall = false;
  37932. $ctx5.sendIdx["visitIRMethod:"]=1;
  37933. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  37934. }));
  37935. } else {
  37936. return (
  37937. $ctx4.supercall = true,
  37938. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  37939. $ctx4.supercall = false;
  37940. };
  37941. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  37942. }));
  37943. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  37944. }),$recv(anIRMethod)._arguments());
  37945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37946. }));
  37947. return self;
  37948. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  37949. },
  37950. args: ["anIRMethod"],
  37951. 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 ]",
  37952. referencedClasses: [],
  37953. 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"]
  37954. }),
  37955. $globals.IRJSTranslator);
  37956. $core.addMethod(
  37957. $core.method({
  37958. selector: "visitIRNonLocalReturn:",
  37959. protocol: 'visiting',
  37960. fn: function (anIRNonLocalReturn){
  37961. var self=this;
  37962. return $core.withContext(function($ctx1) {
  37963. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  37964. return $core.withContext(function($ctx2) {
  37965. return (
  37966. $ctx2.supercall = true,
  37967. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  37968. $ctx2.supercall = false;
  37969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37970. }));
  37971. return self;
  37972. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  37973. },
  37974. args: ["anIRNonLocalReturn"],
  37975. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  37976. referencedClasses: [],
  37977. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  37978. }),
  37979. $globals.IRJSTranslator);
  37980. $core.addMethod(
  37981. $core.method({
  37982. selector: "visitIRReturn:",
  37983. protocol: 'visiting',
  37984. fn: function (anIRReturn){
  37985. var self=this;
  37986. return $core.withContext(function($ctx1) {
  37987. $recv(self._stream())._nextPutReturnWith_((function(){
  37988. return $core.withContext(function($ctx2) {
  37989. return (
  37990. $ctx2.supercall = true,
  37991. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  37992. $ctx2.supercall = false;
  37993. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37994. }));
  37995. return self;
  37996. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  37997. },
  37998. args: ["anIRReturn"],
  37999. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  38000. referencedClasses: [],
  38001. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  38002. }),
  38003. $globals.IRJSTranslator);
  38004. $core.addMethod(
  38005. $core.method({
  38006. selector: "visitIRSend:",
  38007. protocol: 'visiting',
  38008. fn: function (anIRSend){
  38009. var self=this;
  38010. var sends,superclass;
  38011. return $core.withContext(function($ctx1) {
  38012. var $1,$2;
  38013. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  38014. $1=$recv(anIRSend)._isSuperSend();
  38015. if($core.assert($1)){
  38016. self._visitSuperSend_(anIRSend);
  38017. } else {
  38018. self._visitSend_(anIRSend);
  38019. };
  38020. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  38021. if($core.assert($2)){
  38022. $recv(self._stream())._nextPutSendIndexFor_(anIRSend);
  38023. };
  38024. return self;
  38025. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  38026. },
  38027. args: ["anIRSend"],
  38028. source: "visitIRSend: anIRSend\x0a\x09| sends superclass |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend isSuperSend\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 ]",
  38029. referencedClasses: [],
  38030. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuperSend", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  38031. }),
  38032. $globals.IRJSTranslator);
  38033. $core.addMethod(
  38034. $core.method({
  38035. selector: "visitIRSequence:",
  38036. protocol: 'visiting',
  38037. fn: function (anIRSequence){
  38038. var self=this;
  38039. return $core.withContext(function($ctx1) {
  38040. var $1;
  38041. $1=self._stream();
  38042. $ctx1.sendIdx["stream"]=1;
  38043. $recv($1)._nextPutSequenceWith_((function(){
  38044. return $core.withContext(function($ctx2) {
  38045. return $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  38046. return $core.withContext(function($ctx3) {
  38047. return $recv(self._stream())._nextPutStatementWith_(self._visit_(each));
  38048. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38049. }));
  38050. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38051. }));
  38052. return self;
  38053. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  38054. },
  38055. args: ["anIRSequence"],
  38056. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  38057. referencedClasses: [],
  38058. messageSends: ["nextPutSequenceWith:", "stream", "do:", "dagChildren", "nextPutStatementWith:", "visit:"]
  38059. }),
  38060. $globals.IRJSTranslator);
  38061. $core.addMethod(
  38062. $core.method({
  38063. selector: "visitIRTempDeclaration:",
  38064. protocol: 'visiting',
  38065. fn: function (anIRTempDeclaration){
  38066. var self=this;
  38067. return self;
  38068. },
  38069. args: ["anIRTempDeclaration"],
  38070. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  38071. referencedClasses: [],
  38072. messageSends: []
  38073. }),
  38074. $globals.IRJSTranslator);
  38075. $core.addMethod(
  38076. $core.method({
  38077. selector: "visitIRValue:",
  38078. protocol: 'visiting',
  38079. fn: function (anIRValue){
  38080. var self=this;
  38081. return $core.withContext(function($ctx1) {
  38082. $recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavascript());
  38083. return self;
  38084. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  38085. },
  38086. args: ["anIRValue"],
  38087. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  38088. referencedClasses: [],
  38089. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"]
  38090. }),
  38091. $globals.IRJSTranslator);
  38092. $core.addMethod(
  38093. $core.method({
  38094. selector: "visitIRVariable:",
  38095. protocol: 'visiting',
  38096. fn: function (anIRVariable){
  38097. var self=this;
  38098. return $core.withContext(function($ctx1) {
  38099. var $3,$2,$1,$4;
  38100. $3=$recv(anIRVariable)._variable();
  38101. $ctx1.sendIdx["variable"]=1;
  38102. $2=$recv($3)._name();
  38103. $1=$recv($2).__eq("thisContext");
  38104. if($core.assert($1)){
  38105. $4=self._stream();
  38106. $ctx1.sendIdx["stream"]=1;
  38107. $recv($4)._nextPutAll_("$core.getThisContext()");
  38108. $ctx1.sendIdx["nextPutAll:"]=1;
  38109. } else {
  38110. $recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  38111. };
  38112. return self;
  38113. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  38114. },
  38115. args: ["anIRVariable"],
  38116. 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 ]",
  38117. referencedClasses: [],
  38118. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  38119. }),
  38120. $globals.IRJSTranslator);
  38121. $core.addMethod(
  38122. $core.method({
  38123. selector: "visitIRVerbatim:",
  38124. protocol: 'visiting',
  38125. fn: function (anIRVerbatim){
  38126. var self=this;
  38127. return $core.withContext(function($ctx1) {
  38128. var $1;
  38129. $1=self._stream();
  38130. $ctx1.sendIdx["stream"]=1;
  38131. $recv($1)._nextPutStatementWith_((function(){
  38132. return $core.withContext(function($ctx2) {
  38133. return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  38134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38135. }));
  38136. return self;
  38137. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  38138. },
  38139. args: ["anIRVerbatim"],
  38140. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  38141. referencedClasses: [],
  38142. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  38143. }),
  38144. $globals.IRJSTranslator);
  38145. $core.addMethod(
  38146. $core.method({
  38147. selector: "visitInstructionList:enclosedBetween:and:",
  38148. protocol: 'visiting',
  38149. fn: function (anArray,aString,anotherString){
  38150. var self=this;
  38151. return $core.withContext(function($ctx1) {
  38152. var $1;
  38153. $1=self._stream();
  38154. $ctx1.sendIdx["stream"]=1;
  38155. $recv($1)._nextPutAll_(aString);
  38156. $ctx1.sendIdx["nextPutAll:"]=1;
  38157. $recv(anArray)._do_separatedBy_((function(each){
  38158. return $core.withContext(function($ctx2) {
  38159. return self._visit_(each);
  38160. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38161. }),(function(){
  38162. return $core.withContext(function($ctx2) {
  38163. return $recv(self._stream())._nextPutAll_(",");
  38164. $ctx2.sendIdx["nextPutAll:"]=2;
  38165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38166. }));
  38167. $recv(self["@stream"])._nextPutAll_(anotherString);
  38168. return self;
  38169. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  38170. },
  38171. args: ["anArray", "aString", "anotherString"],
  38172. 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",
  38173. referencedClasses: [],
  38174. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  38175. }),
  38176. $globals.IRJSTranslator);
  38177. $core.addMethod(
  38178. $core.method({
  38179. selector: "visitReceiver:",
  38180. protocol: 'visiting',
  38181. fn: function (anIRInstruction){
  38182. var self=this;
  38183. return $core.withContext(function($ctx1) {
  38184. var $1,$2,$3;
  38185. $1=$recv(anIRInstruction)._needsBoxingAsReceiver();
  38186. if(!$core.assert($1)){
  38187. $2=self._visit_(anIRInstruction);
  38188. $ctx1.sendIdx["visit:"]=1;
  38189. return $2;
  38190. };
  38191. $3=self._stream();
  38192. $ctx1.sendIdx["stream"]=1;
  38193. $recv($3)._nextPutAll_("$recv(");
  38194. $ctx1.sendIdx["nextPutAll:"]=1;
  38195. self._visit_(anIRInstruction);
  38196. $recv(self._stream())._nextPutAll_(")");
  38197. return self;
  38198. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)});
  38199. },
  38200. args: ["anIRInstruction"],
  38201. source: "visitReceiver: anIRInstruction\x0a\x09anIRInstruction needsBoxingAsReceiver ifFalse: [ ^ self visit: anIRInstruction ].\x0a\x09\x0a\x09self stream nextPutAll: '$recv('.\x0a\x09self visit: anIRInstruction.\x0a\x09self stream nextPutAll: ')'",
  38202. referencedClasses: [],
  38203. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  38204. }),
  38205. $globals.IRJSTranslator);
  38206. $core.addMethod(
  38207. $core.method({
  38208. selector: "visitSend:",
  38209. protocol: 'visiting',
  38210. fn: function (anIRSend){
  38211. var self=this;
  38212. return $core.withContext(function($ctx1) {
  38213. self._visitReceiver_($recv(anIRSend)._receiver());
  38214. $recv(self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  38215. self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  38216. return self;
  38217. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  38218. },
  38219. args: ["anIRSend"],
  38220. 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: ')'",
  38221. referencedClasses: [],
  38222. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  38223. }),
  38224. $globals.IRJSTranslator);
  38225. $core.addMethod(
  38226. $core.method({
  38227. selector: "visitSuperSend:",
  38228. protocol: 'visiting',
  38229. fn: function (anIRSend){
  38230. var self=this;
  38231. return $core.withContext(function($ctx1) {
  38232. var $1,$4,$3,$2,$5,$6,$7,$8;
  38233. $1=self._stream();
  38234. $ctx1.sendIdx["stream"]=1;
  38235. $recv($1)._nextPutAll_("(");
  38236. $ctx1.sendIdx["nextPutAll:"]=1;
  38237. $recv($1)._lf();
  38238. $ctx1.sendIdx["lf"]=1;
  38239. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38240. $ctx1.sendIdx["nextPutAll:"]=2;
  38241. $recv($1)._lf();
  38242. $ctx1.sendIdx["lf"]=2;
  38243. $4=$recv(anIRSend)._scope();
  38244. $ctx1.sendIdx["scope"]=1;
  38245. $3=$recv($4)._alias();
  38246. $ctx1.sendIdx["alias"]=1;
  38247. $2=$recv($3).__comma(".supercall = true,");
  38248. $ctx1.sendIdx[","]=1;
  38249. $recv($1)._nextPutAll_($2);
  38250. $ctx1.sendIdx["nextPutAll:"]=3;
  38251. $recv($1)._lf();
  38252. $ctx1.sendIdx["lf"]=3;
  38253. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38254. $ctx1.sendIdx["nextPutAll:"]=4;
  38255. $recv($1)._lf();
  38256. $ctx1.sendIdx["lf"]=4;
  38257. $5="(".__comma($recv(self._currentClass())._asJavascript());
  38258. $ctx1.sendIdx[","]=2;
  38259. $recv($1)._nextPutAll_($5);
  38260. $ctx1.sendIdx["nextPutAll:"]=5;
  38261. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  38262. $ctx1.sendIdx["nextPutAll:"]=6;
  38263. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  38264. $ctx1.sendIdx[","]=3;
  38265. $recv($1)._nextPutAll_($6);
  38266. $ctx1.sendIdx["nextPutAll:"]=7;
  38267. $7=$recv($1)._nextPutAll_("$recv(self), ");
  38268. $ctx1.sendIdx["nextPutAll:"]=8;
  38269. self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  38270. $8=self._stream();
  38271. $recv($8)._nextPutAll_("));");
  38272. $ctx1.sendIdx["nextPutAll:"]=9;
  38273. $recv($8)._lf();
  38274. $ctx1.sendIdx["lf"]=5;
  38275. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38276. $ctx1.sendIdx["nextPutAll:"]=10;
  38277. $recv($8)._lf();
  38278. $ctx1.sendIdx["lf"]=6;
  38279. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  38280. $ctx1.sendIdx["nextPutAll:"]=11;
  38281. $recv($8)._lf();
  38282. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38283. return self;
  38284. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  38285. },
  38286. args: ["anIRSend"],
  38287. 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 asJavascript;\x0a\x09\x09nextPutAll: '.superclass||$boot.nilAsClass).fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$recv(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);'",
  38288. referencedClasses: [],
  38289. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  38290. }),
  38291. $globals.IRJSTranslator);
  38292. $core.addClass('JSStream', $globals.Object, ['stream'], 'Compiler-IR');
  38293. $core.addMethod(
  38294. $core.method({
  38295. selector: "contents",
  38296. protocol: 'accessing',
  38297. fn: function (){
  38298. var self=this;
  38299. return $core.withContext(function($ctx1) {
  38300. return $recv(self["@stream"])._contents();
  38301. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  38302. },
  38303. args: [],
  38304. source: "contents\x0a\x09^ stream contents",
  38305. referencedClasses: [],
  38306. messageSends: ["contents"]
  38307. }),
  38308. $globals.JSStream);
  38309. $core.addMethod(
  38310. $core.method({
  38311. selector: "initialize",
  38312. protocol: 'initialization',
  38313. fn: function (){
  38314. var self=this;
  38315. return $core.withContext(function($ctx1) {
  38316. (
  38317. $ctx1.supercall = true,
  38318. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  38319. $ctx1.supercall = false;
  38320. self["@stream"]=""._writeStream();
  38321. return self;
  38322. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  38323. },
  38324. args: [],
  38325. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  38326. referencedClasses: [],
  38327. messageSends: ["initialize", "writeStream"]
  38328. }),
  38329. $globals.JSStream);
  38330. $core.addMethod(
  38331. $core.method({
  38332. selector: "lf",
  38333. protocol: 'streaming',
  38334. fn: function (){
  38335. var self=this;
  38336. return $core.withContext(function($ctx1) {
  38337. $recv(self["@stream"])._lf();
  38338. return self;
  38339. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  38340. },
  38341. args: [],
  38342. source: "lf\x0a\x09stream lf",
  38343. referencedClasses: [],
  38344. messageSends: ["lf"]
  38345. }),
  38346. $globals.JSStream);
  38347. $core.addMethod(
  38348. $core.method({
  38349. selector: "nextPut:",
  38350. protocol: 'streaming',
  38351. fn: function (aString){
  38352. var self=this;
  38353. return $core.withContext(function($ctx1) {
  38354. $recv(self["@stream"])._nextPut_(aString);
  38355. return self;
  38356. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  38357. },
  38358. args: ["aString"],
  38359. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  38360. referencedClasses: [],
  38361. messageSends: ["nextPut:"]
  38362. }),
  38363. $globals.JSStream);
  38364. $core.addMethod(
  38365. $core.method({
  38366. selector: "nextPutAll:",
  38367. protocol: 'streaming',
  38368. fn: function (aString){
  38369. var self=this;
  38370. return $core.withContext(function($ctx1) {
  38371. $recv(self["@stream"])._nextPutAll_(aString);
  38372. return self;
  38373. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  38374. },
  38375. args: ["aString"],
  38376. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  38377. referencedClasses: [],
  38378. messageSends: ["nextPutAll:"]
  38379. }),
  38380. $globals.JSStream);
  38381. $core.addMethod(
  38382. $core.method({
  38383. selector: "nextPutAssignLhs:rhs:",
  38384. protocol: 'streaming',
  38385. fn: function (aBlock,anotherBlock){
  38386. var self=this;
  38387. return $core.withContext(function($ctx1) {
  38388. $recv(aBlock)._value();
  38389. $ctx1.sendIdx["value"]=1;
  38390. $recv(self["@stream"])._nextPutAll_("=");
  38391. $recv(anotherBlock)._value();
  38392. return self;
  38393. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  38394. },
  38395. args: ["aBlock", "anotherBlock"],
  38396. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  38397. referencedClasses: [],
  38398. messageSends: ["value", "nextPutAll:"]
  38399. }),
  38400. $globals.JSStream);
  38401. $core.addMethod(
  38402. $core.method({
  38403. selector: "nextPutBlockContextFor:during:",
  38404. protocol: 'streaming',
  38405. fn: function (anIRClosure,aBlock){
  38406. var self=this;
  38407. return $core.withContext(function($ctx1) {
  38408. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  38409. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  38410. if(!$core.assert($1)){
  38411. $2=$recv(aBlock)._value();
  38412. $ctx1.sendIdx["value"]=1;
  38413. return $2;
  38414. };
  38415. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38416. $ctx1.sendIdx["nextPutAll:"]=1;
  38417. self._lf();
  38418. $ctx1.sendIdx["lf"]=1;
  38419. $6=$recv(anIRClosure)._scope();
  38420. $ctx1.sendIdx["scope"]=1;
  38421. $5=$recv($6)._alias();
  38422. $ctx1.sendIdx["alias"]=1;
  38423. $4="return $core.withContext(function(".__comma($5);
  38424. $ctx1.sendIdx[","]=2;
  38425. $3=$recv($4).__comma(") {");
  38426. $ctx1.sendIdx[","]=1;
  38427. self._nextPutAll_($3);
  38428. $ctx1.sendIdx["nextPutAll:"]=2;
  38429. self._lf();
  38430. $ctx1.sendIdx["lf"]=2;
  38431. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38432. $ctx1.sendIdx["nextPutAll:"]=3;
  38433. $7=self._lf();
  38434. $ctx1.sendIdx["lf"]=3;
  38435. $recv(aBlock)._value();
  38436. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38437. $ctx1.sendIdx["nextPutAll:"]=4;
  38438. self._lf();
  38439. $ctx1.sendIdx["lf"]=4;
  38440. $11=$recv(anIRClosure)._scope();
  38441. $ctx1.sendIdx["scope"]=2;
  38442. $10=$recv($11)._alias();
  38443. $ctx1.sendIdx["alias"]=2;
  38444. $9="}, function(".__comma($10);
  38445. $ctx1.sendIdx[","]=4;
  38446. $8=$recv($9).__comma(") {");
  38447. $ctx1.sendIdx[","]=3;
  38448. self._nextPutAll_($8);
  38449. $ctx1.sendIdx["nextPutAll:"]=5;
  38450. $15=$recv(anIRClosure)._scope();
  38451. $ctx1.sendIdx["scope"]=3;
  38452. $14=$recv($15)._alias();
  38453. $ctx1.sendIdx["alias"]=3;
  38454. $13=$recv($14).__comma(".fillBlock({");
  38455. $ctx1.sendIdx[","]=5;
  38456. $12=self._nextPutAll_($13);
  38457. $ctx1.sendIdx["nextPutAll:"]=6;
  38458. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  38459. return $core.withContext(function($ctx2) {
  38460. $16=$recv(each)._asVariableName();
  38461. $ctx2.sendIdx["asVariableName"]=1;
  38462. self._nextPutAll_($16);
  38463. $ctx2.sendIdx["nextPutAll:"]=7;
  38464. self._nextPutAll_(":");
  38465. $ctx2.sendIdx["nextPutAll:"]=8;
  38466. $17=self._nextPutAll_($recv(each)._asVariableName());
  38467. $ctx2.sendIdx["nextPutAll:"]=9;
  38468. return $17;
  38469. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38470. }),(function(){
  38471. return $core.withContext(function($ctx2) {
  38472. return self._nextPutAll_(",");
  38473. $ctx2.sendIdx["nextPutAll:"]=10;
  38474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38475. }));
  38476. self._nextPutAll_("},");
  38477. $ctx1.sendIdx["nextPutAll:"]=11;
  38478. $23=$recv(anIRClosure)._scope();
  38479. $ctx1.sendIdx["scope"]=4;
  38480. $22=$recv($23)._outerScope();
  38481. $21=$recv($22)._alias();
  38482. $20=$recv($21).__comma(",");
  38483. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  38484. $ctx1.sendIdx[","]=7;
  38485. $18=$recv($19).__comma(")});");
  38486. $ctx1.sendIdx[","]=6;
  38487. self._nextPutAll_($18);
  38488. $ctx1.sendIdx["nextPutAll:"]=12;
  38489. self._lf();
  38490. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38491. return self;
  38492. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  38493. },
  38494. args: ["anIRClosure", "aBlock"],
  38495. 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);'",
  38496. referencedClasses: [],
  38497. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  38498. }),
  38499. $globals.JSStream);
  38500. $core.addMethod(
  38501. $core.method({
  38502. selector: "nextPutClosureWith:arguments:",
  38503. protocol: 'streaming',
  38504. fn: function (aBlock,anArray){
  38505. var self=this;
  38506. return $core.withContext(function($ctx1) {
  38507. var $1,$2,$3;
  38508. $recv(self["@stream"])._nextPutAll_("(function(");
  38509. $ctx1.sendIdx["nextPutAll:"]=1;
  38510. $recv(anArray)._do_separatedBy_((function(each){
  38511. return $core.withContext(function($ctx2) {
  38512. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  38513. $ctx2.sendIdx["nextPutAll:"]=2;
  38514. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38515. }),(function(){
  38516. return $core.withContext(function($ctx2) {
  38517. return $recv(self["@stream"])._nextPut_(",");
  38518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38519. }));
  38520. $1=self["@stream"];
  38521. $recv($1)._nextPutAll_("){");
  38522. $ctx1.sendIdx["nextPutAll:"]=3;
  38523. $2=$recv($1)._lf();
  38524. $ctx1.sendIdx["lf"]=1;
  38525. $recv(aBlock)._value();
  38526. $3=self["@stream"];
  38527. $recv($3)._lf();
  38528. $recv($3)._nextPutAll_("})");
  38529. return self;
  38530. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  38531. },
  38532. args: ["aBlock", "anArray"],
  38533. 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: '})'",
  38534. referencedClasses: [],
  38535. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  38536. }),
  38537. $globals.JSStream);
  38538. $core.addMethod(
  38539. $core.method({
  38540. selector: "nextPutContextFor:during:",
  38541. protocol: 'streaming',
  38542. fn: function (aMethod,aBlock){
  38543. var self=this;
  38544. return $core.withContext(function($ctx1) {
  38545. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  38546. $1=$recv(aMethod)._requiresSmalltalkContext();
  38547. if(!$core.assert($1)){
  38548. $2=$recv(aBlock)._value();
  38549. $ctx1.sendIdx["value"]=1;
  38550. return $2;
  38551. };
  38552. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38553. $ctx1.sendIdx["nextPutAll:"]=1;
  38554. self._lf();
  38555. $ctx1.sendIdx["lf"]=1;
  38556. $6=$recv(aMethod)._scope();
  38557. $ctx1.sendIdx["scope"]=1;
  38558. $5=$recv($6)._alias();
  38559. $ctx1.sendIdx["alias"]=1;
  38560. $4="return $core.withContext(function(".__comma($5);
  38561. $ctx1.sendIdx[","]=2;
  38562. $3=$recv($4).__comma(") {");
  38563. $ctx1.sendIdx[","]=1;
  38564. self._nextPutAll_($3);
  38565. $ctx1.sendIdx["nextPutAll:"]=2;
  38566. self._lf();
  38567. $ctx1.sendIdx["lf"]=2;
  38568. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38569. $ctx1.sendIdx["nextPutAll:"]=3;
  38570. $7=self._lf();
  38571. $ctx1.sendIdx["lf"]=3;
  38572. $recv(aBlock)._value();
  38573. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38574. $ctx1.sendIdx["nextPutAll:"]=4;
  38575. self._lf();
  38576. $ctx1.sendIdx["lf"]=4;
  38577. $12=$recv(aMethod)._scope();
  38578. $ctx1.sendIdx["scope"]=2;
  38579. $11=$recv($12)._alias();
  38580. $ctx1.sendIdx["alias"]=2;
  38581. $10="}, function(".__comma($11);
  38582. $ctx1.sendIdx[","]=5;
  38583. $9=$recv($10).__comma(") {");
  38584. $ctx1.sendIdx[","]=4;
  38585. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  38586. $ctx1.sendIdx[","]=3;
  38587. self._nextPutAll_($8);
  38588. $ctx1.sendIdx["nextPutAll:"]=5;
  38589. $16=$recv($recv(aMethod)._selector())._asJavascript();
  38590. $ctx1.sendIdx["asJavascript"]=1;
  38591. $15=".fill(self,".__comma($16);
  38592. $14=$recv($15).__comma(",{");
  38593. $ctx1.sendIdx[","]=6;
  38594. $13=self._nextPutAll_($14);
  38595. $ctx1.sendIdx["nextPutAll:"]=6;
  38596. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  38597. return $core.withContext(function($ctx2) {
  38598. $17=$recv(each)._asVariableName();
  38599. $ctx2.sendIdx["asVariableName"]=1;
  38600. self._nextPutAll_($17);
  38601. $ctx2.sendIdx["nextPutAll:"]=7;
  38602. self._nextPutAll_(":");
  38603. $ctx2.sendIdx["nextPutAll:"]=8;
  38604. $18=self._nextPutAll_($recv(each)._asVariableName());
  38605. $ctx2.sendIdx["nextPutAll:"]=9;
  38606. return $18;
  38607. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38608. }),(function(){
  38609. return $core.withContext(function($ctx2) {
  38610. return self._nextPutAll_(",");
  38611. $ctx2.sendIdx["nextPutAll:"]=10;
  38612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38613. }));
  38614. self._nextPutAll_("},");
  38615. $ctx1.sendIdx["nextPutAll:"]=11;
  38616. self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavascript());
  38617. $ctx1.sendIdx["nextPutAll:"]=12;
  38618. self._nextPutAll_(")});");
  38619. $ctx1.sendIdx["nextPutAll:"]=13;
  38620. self._lf();
  38621. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38622. return self;
  38623. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  38624. },
  38625. args: ["aMethod", "aBlock"],
  38626. 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 asJavascript, ',{'.\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 asJavascript;\x0a\x09\x09nextPutAll: ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  38627. referencedClasses: [],
  38628. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  38629. }),
  38630. $globals.JSStream);
  38631. $core.addMethod(
  38632. $core.method({
  38633. selector: "nextPutFunctionWith:arguments:",
  38634. protocol: 'streaming',
  38635. fn: function (aBlock,anArray){
  38636. var self=this;
  38637. return $core.withContext(function($ctx1) {
  38638. var $1,$2,$3,$4,$5;
  38639. $recv(self["@stream"])._nextPutAll_("fn: function(");
  38640. $ctx1.sendIdx["nextPutAll:"]=1;
  38641. $recv(anArray)._do_separatedBy_((function(each){
  38642. return $core.withContext(function($ctx2) {
  38643. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  38644. $ctx2.sendIdx["nextPutAll:"]=2;
  38645. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38646. }),(function(){
  38647. return $core.withContext(function($ctx2) {
  38648. return $recv(self["@stream"])._nextPut_(",");
  38649. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38650. }));
  38651. $1=self["@stream"];
  38652. $recv($1)._nextPutAll_("){");
  38653. $ctx1.sendIdx["nextPutAll:"]=3;
  38654. $2=$recv($1)._lf();
  38655. $ctx1.sendIdx["lf"]=1;
  38656. $3=self["@stream"];
  38657. $recv($3)._nextPutAll_("var self=this;");
  38658. $ctx1.sendIdx["nextPutAll:"]=4;
  38659. $4=$recv($3)._lf();
  38660. $ctx1.sendIdx["lf"]=2;
  38661. $recv(aBlock)._value();
  38662. $5=self["@stream"];
  38663. $recv($5)._lf();
  38664. $recv($5)._nextPutAll_("}");
  38665. return self;
  38666. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  38667. },
  38668. args: ["aBlock", "anArray"],
  38669. 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;'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '}'",
  38670. referencedClasses: [],
  38671. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  38672. }),
  38673. $globals.JSStream);
  38674. $core.addMethod(
  38675. $core.method({
  38676. selector: "nextPutIf:then:",
  38677. protocol: 'streaming',
  38678. fn: function (aBlock,anotherBlock){
  38679. var self=this;
  38680. return $core.withContext(function($ctx1) {
  38681. var $1;
  38682. $recv(self["@stream"])._nextPutAll_("if(");
  38683. $ctx1.sendIdx["nextPutAll:"]=1;
  38684. $recv(aBlock)._value();
  38685. $ctx1.sendIdx["value"]=1;
  38686. $1=self["@stream"];
  38687. $recv($1)._nextPutAll_("){");
  38688. $ctx1.sendIdx["nextPutAll:"]=2;
  38689. $recv($1)._lf();
  38690. $recv(anotherBlock)._value();
  38691. $recv(self["@stream"])._nextPutAll_("}");
  38692. return self;
  38693. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  38694. },
  38695. args: ["aBlock", "anotherBlock"],
  38696. source: "nextPutIf: aBlock then: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  38697. referencedClasses: [],
  38698. messageSends: ["nextPutAll:", "value", "lf"]
  38699. }),
  38700. $globals.JSStream);
  38701. $core.addMethod(
  38702. $core.method({
  38703. selector: "nextPutIf:then:else:",
  38704. protocol: 'streaming',
  38705. fn: function (aBlock,ifBlock,elseBlock){
  38706. var self=this;
  38707. return $core.withContext(function($ctx1) {
  38708. var $1,$2,$3;
  38709. $recv(self["@stream"])._nextPutAll_("if(");
  38710. $ctx1.sendIdx["nextPutAll:"]=1;
  38711. $recv(aBlock)._value();
  38712. $ctx1.sendIdx["value"]=1;
  38713. $1=self["@stream"];
  38714. $recv($1)._nextPutAll_("){");
  38715. $ctx1.sendIdx["nextPutAll:"]=2;
  38716. $2=$recv($1)._lf();
  38717. $ctx1.sendIdx["lf"]=1;
  38718. $recv(ifBlock)._value();
  38719. $ctx1.sendIdx["value"]=2;
  38720. $3=self["@stream"];
  38721. $recv($3)._nextPutAll_("} else {");
  38722. $ctx1.sendIdx["nextPutAll:"]=3;
  38723. $recv($3)._lf();
  38724. $recv(elseBlock)._value();
  38725. $recv(self["@stream"])._nextPutAll_("}");
  38726. return self;
  38727. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  38728. },
  38729. args: ["aBlock", "ifBlock", "elseBlock"],
  38730. 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: '}'",
  38731. referencedClasses: [],
  38732. messageSends: ["nextPutAll:", "value", "lf"]
  38733. }),
  38734. $globals.JSStream);
  38735. $core.addMethod(
  38736. $core.method({
  38737. selector: "nextPutMethodDeclaration:with:",
  38738. protocol: 'streaming',
  38739. fn: function (aMethod,aBlock){
  38740. var self=this;
  38741. return $core.withContext(function($ctx1) {
  38742. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  38743. $1=self["@stream"];
  38744. $recv($1)._nextPutAll_("$core.method({");
  38745. $ctx1.sendIdx["nextPutAll:"]=1;
  38746. $recv($1)._lf();
  38747. $ctx1.sendIdx["lf"]=1;
  38748. $4=$recv($recv(aMethod)._selector())._asJavascript();
  38749. $ctx1.sendIdx["asJavascript"]=1;
  38750. $3="selector: ".__comma($4);
  38751. $ctx1.sendIdx[","]=2;
  38752. $2=$recv($3).__comma(",");
  38753. $ctx1.sendIdx[","]=1;
  38754. $recv($1)._nextPutAll_($2);
  38755. $ctx1.sendIdx["nextPutAll:"]=2;
  38756. $recv($1)._lf();
  38757. $ctx1.sendIdx["lf"]=2;
  38758. $7=$recv($recv(aMethod)._source())._asJavascript();
  38759. $ctx1.sendIdx["asJavascript"]=2;
  38760. $6="source: ".__comma($7);
  38761. $ctx1.sendIdx[","]=4;
  38762. $5=$recv($6).__comma(",");
  38763. $ctx1.sendIdx[","]=3;
  38764. $recv($1)._nextPutAll_($5);
  38765. $ctx1.sendIdx["nextPutAll:"]=3;
  38766. $8=$recv($1)._lf();
  38767. $ctx1.sendIdx["lf"]=3;
  38768. $recv(aBlock)._value();
  38769. $ctx1.sendIdx["value"]=1;
  38770. $9=self["@stream"];
  38771. $12=$recv($globals.String)._lf();
  38772. $ctx1.sendIdx["lf"]=4;
  38773. $11=",".__comma($12);
  38774. $ctx1.sendIdx[","]=6;
  38775. $10=$recv($11).__comma("messageSends: ");
  38776. $ctx1.sendIdx[","]=5;
  38777. $recv($9)._nextPutAll_($10);
  38778. $ctx1.sendIdx["nextPutAll:"]=4;
  38779. $15=$recv($recv(aMethod)._messageSends())._asArray();
  38780. $ctx1.sendIdx["asArray"]=1;
  38781. $14=$recv($15)._asJavascript();
  38782. $ctx1.sendIdx["asJavascript"]=3;
  38783. $13=$recv($14).__comma(",");
  38784. $ctx1.sendIdx[","]=7;
  38785. $recv($9)._nextPutAll_($13);
  38786. $ctx1.sendIdx["nextPutAll:"]=5;
  38787. $recv($9)._lf();
  38788. $ctx1.sendIdx["lf"]=5;
  38789. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  38790. return $core.withContext(function($ctx2) {
  38791. return $recv(each)._value();
  38792. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38793. })))._asArray())._asJavascript();
  38794. $ctx1.sendIdx["asJavascript"]=4;
  38795. $17="args: ".__comma($18);
  38796. $16=$recv($17).__comma(",");
  38797. $ctx1.sendIdx[","]=8;
  38798. $recv($9)._nextPutAll_($16);
  38799. $ctx1.sendIdx["nextPutAll:"]=6;
  38800. $recv($9)._lf();
  38801. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  38802. $ctx1.sendIdx["nextPutAll:"]=7;
  38803. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  38804. return $core.withContext(function($ctx2) {
  38805. return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavascript());
  38806. $ctx2.sendIdx["nextPutAll:"]=8;
  38807. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38808. }),(function(){
  38809. return $core.withContext(function($ctx2) {
  38810. return $recv(self["@stream"])._nextPutAll_(",");
  38811. $ctx2.sendIdx["nextPutAll:"]=9;
  38812. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38813. }));
  38814. $20=self["@stream"];
  38815. $recv($20)._nextPutAll_("]");
  38816. $ctx1.sendIdx["nextPutAll:"]=10;
  38817. $recv($20)._nextPutAll_("})");
  38818. return self;
  38819. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  38820. },
  38821. args: ["aMethod", "aBlock"],
  38822. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: '$core.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences\x0a\x09\x09do: [ :each | stream nextPutAll: each asJavascript ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream\x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
  38823. referencedClasses: ["String"],
  38824. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  38825. }),
  38826. $globals.JSStream);
  38827. $core.addMethod(
  38828. $core.method({
  38829. selector: "nextPutNonLocalReturnHandlingWith:",
  38830. protocol: 'streaming',
  38831. fn: function (aBlock){
  38832. var self=this;
  38833. return $core.withContext(function($ctx1) {
  38834. var $1,$2,$3;
  38835. $1=self["@stream"];
  38836. $recv($1)._nextPutAll_("var $early={};");
  38837. $ctx1.sendIdx["nextPutAll:"]=1;
  38838. $recv($1)._lf();
  38839. $ctx1.sendIdx["lf"]=1;
  38840. $recv($1)._nextPutAll_("try {");
  38841. $ctx1.sendIdx["nextPutAll:"]=2;
  38842. $2=$recv($1)._lf();
  38843. $ctx1.sendIdx["lf"]=2;
  38844. $recv(aBlock)._value();
  38845. $3=self["@stream"];
  38846. $recv($3)._nextPutAll_("}");
  38847. $ctx1.sendIdx["nextPutAll:"]=3;
  38848. $recv($3)._lf();
  38849. $ctx1.sendIdx["lf"]=3;
  38850. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  38851. $recv($3)._lf();
  38852. return self;
  38853. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  38854. },
  38855. args: ["aBlock"],
  38856. 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",
  38857. referencedClasses: [],
  38858. messageSends: ["nextPutAll:", "lf", "value"]
  38859. }),
  38860. $globals.JSStream);
  38861. $core.addMethod(
  38862. $core.method({
  38863. selector: "nextPutNonLocalReturnWith:",
  38864. protocol: 'streaming',
  38865. fn: function (aBlock){
  38866. var self=this;
  38867. return $core.withContext(function($ctx1) {
  38868. $recv(self["@stream"])._nextPutAll_("throw $early=[");
  38869. $ctx1.sendIdx["nextPutAll:"]=1;
  38870. $recv(aBlock)._value();
  38871. $recv(self["@stream"])._nextPutAll_("]");
  38872. return self;
  38873. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  38874. },
  38875. args: ["aBlock"],
  38876. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  38877. referencedClasses: [],
  38878. messageSends: ["nextPutAll:", "value"]
  38879. }),
  38880. $globals.JSStream);
  38881. $core.addMethod(
  38882. $core.method({
  38883. selector: "nextPutReturnWith:",
  38884. protocol: 'streaming',
  38885. fn: function (aBlock){
  38886. var self=this;
  38887. return $core.withContext(function($ctx1) {
  38888. $recv(self["@stream"])._nextPutAll_("return ");
  38889. $recv(aBlock)._value();
  38890. return self;
  38891. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  38892. },
  38893. args: ["aBlock"],
  38894. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  38895. referencedClasses: [],
  38896. messageSends: ["nextPutAll:", "value"]
  38897. }),
  38898. $globals.JSStream);
  38899. $core.addMethod(
  38900. $core.method({
  38901. selector: "nextPutSendIndexFor:",
  38902. protocol: 'streaming',
  38903. fn: function (anIRSend){
  38904. var self=this;
  38905. return $core.withContext(function($ctx1) {
  38906. self._nextPutAll_(";");
  38907. $ctx1.sendIdx["nextPutAll:"]=1;
  38908. self._lf();
  38909. $ctx1.sendIdx["lf"]=1;
  38910. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38911. $ctx1.sendIdx["nextPutAll:"]=2;
  38912. self._lf();
  38913. $ctx1.sendIdx["lf"]=2;
  38914. self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  38915. $ctx1.sendIdx["nextPutAll:"]=3;
  38916. self._nextPutAll_(".sendIdx[");
  38917. $ctx1.sendIdx["nextPutAll:"]=4;
  38918. self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavascript());
  38919. $ctx1.sendIdx["nextPutAll:"]=5;
  38920. self._nextPutAll_("]=");
  38921. $ctx1.sendIdx["nextPutAll:"]=6;
  38922. self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  38923. $ctx1.sendIdx["nextPutAll:"]=7;
  38924. self._nextPutAll_(";");
  38925. $ctx1.sendIdx["nextPutAll:"]=8;
  38926. self._lf();
  38927. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  38928. return self;
  38929. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  38930. },
  38931. args: ["anIRSend"],
  38932. 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 asJavascript;\x0a\x09\x09nextPutAll: ']=';\x0a\x09\x09nextPutAll: anIRSend index asString;\x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22)'",
  38933. referencedClasses: [],
  38934. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"]
  38935. }),
  38936. $globals.JSStream);
  38937. $core.addMethod(
  38938. $core.method({
  38939. selector: "nextPutSequenceWith:",
  38940. protocol: 'streaming',
  38941. fn: function (aBlock){
  38942. var self=this;
  38943. return $core.withContext(function($ctx1) {
  38944. $recv(aBlock)._value();
  38945. return self;
  38946. }, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},$globals.JSStream)});
  38947. },
  38948. args: ["aBlock"],
  38949. source: "nextPutSequenceWith: aBlock\x0a\x09\x22stream\x0a\x09\x09nextPutAll: 'switch($core.thisContext.pc){'; lf.\x22\x0a\x09aBlock value.\x0a\x09\x22stream\x0a\x09\x09nextPutAll: '};'; lf\x22",
  38950. referencedClasses: [],
  38951. messageSends: ["value"]
  38952. }),
  38953. $globals.JSStream);
  38954. $core.addMethod(
  38955. $core.method({
  38956. selector: "nextPutStatementWith:",
  38957. protocol: 'streaming',
  38958. fn: function (aBlock){
  38959. var self=this;
  38960. return $core.withContext(function($ctx1) {
  38961. var $1;
  38962. $recv(aBlock)._value();
  38963. $1=self["@stream"];
  38964. $recv($1)._nextPutAll_(";");
  38965. $recv($1)._lf();
  38966. return self;
  38967. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  38968. },
  38969. args: ["aBlock"],
  38970. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  38971. referencedClasses: [],
  38972. messageSends: ["value", "nextPutAll:", "lf"]
  38973. }),
  38974. $globals.JSStream);
  38975. $core.addMethod(
  38976. $core.method({
  38977. selector: "nextPutVars:",
  38978. protocol: 'streaming',
  38979. fn: function (aCollection){
  38980. var self=this;
  38981. return $core.withContext(function($ctx1) {
  38982. var $1;
  38983. $recv(aCollection)._ifNotEmpty_((function(){
  38984. return $core.withContext(function($ctx2) {
  38985. $recv(self["@stream"])._nextPutAll_("var ");
  38986. $ctx2.sendIdx["nextPutAll:"]=1;
  38987. $recv(aCollection)._do_separatedBy_((function(each){
  38988. return $core.withContext(function($ctx3) {
  38989. return $recv(self["@stream"])._nextPutAll_(each);
  38990. $ctx3.sendIdx["nextPutAll:"]=2;
  38991. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38992. }),(function(){
  38993. return $core.withContext(function($ctx3) {
  38994. return $recv(self["@stream"])._nextPutAll_(",");
  38995. $ctx3.sendIdx["nextPutAll:"]=3;
  38996. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  38997. }));
  38998. $1=self["@stream"];
  38999. $recv($1)._nextPutAll_(";");
  39000. return $recv($1)._lf();
  39001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39002. }));
  39003. return self;
  39004. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  39005. },
  39006. args: ["aCollection"],
  39007. 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 ]",
  39008. referencedClasses: [],
  39009. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  39010. }),
  39011. $globals.JSStream);
  39012. $core.addMethod(
  39013. $core.method({
  39014. selector: "isReferenced",
  39015. protocol: '*Compiler-IR',
  39016. fn: function (){
  39017. var self=this;
  39018. return $core.withContext(function($ctx1) {
  39019. var $3,$2,$1;
  39020. $3=self._parent();
  39021. $ctx1.sendIdx["parent"]=1;
  39022. $2=$recv($3)._isSequenceNode();
  39023. $1=$recv($2)._or_((function(){
  39024. return $core.withContext(function($ctx2) {
  39025. return $recv(self._parent())._isAssignmentNode();
  39026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39027. }));
  39028. return $recv($1)._not();
  39029. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  39030. },
  39031. args: [],
  39032. 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",
  39033. referencedClasses: [],
  39034. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  39035. }),
  39036. $globals.ASTNode);
  39037. $core.addMethod(
  39038. $core.method({
  39039. selector: "subtreeNeedsAliasing",
  39040. protocol: '*Compiler-IR',
  39041. fn: function (){
  39042. var self=this;
  39043. return $core.withContext(function($ctx1) {
  39044. return $recv(self._shouldBeAliased())._or_((function(){
  39045. return $core.withContext(function($ctx2) {
  39046. return $recv(self._dagChildren())._anySatisfy_((function(each){
  39047. return $core.withContext(function($ctx3) {
  39048. return $recv(each)._subtreeNeedsAliasing();
  39049. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39050. }));
  39051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39052. }));
  39053. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  39054. },
  39055. args: [],
  39056. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  39057. referencedClasses: [],
  39058. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  39059. }),
  39060. $globals.ASTNode);
  39061. $core.addMethod(
  39062. $core.method({
  39063. selector: "shouldBeAliased",
  39064. protocol: '*Compiler-IR',
  39065. fn: function (){
  39066. var self=this;
  39067. return $core.withContext(function($ctx1) {
  39068. var $1;
  39069. $1=(
  39070. $ctx1.supercall = true,
  39071. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($recv(self), []));
  39072. $ctx1.supercall = false;
  39073. return $recv($1)._or_((function(){
  39074. return $core.withContext(function($ctx2) {
  39075. return self._isReferenced();
  39076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39077. }));
  39078. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  39079. },
  39080. args: [],
  39081. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  39082. referencedClasses: [],
  39083. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  39084. }),
  39085. $globals.AssignmentNode);
  39086. $core.addMethod(
  39087. $core.method({
  39088. selector: "appendToInstruction:",
  39089. protocol: '*Compiler-IR',
  39090. fn: function (anIRInstruction){
  39091. var self=this;
  39092. return $core.withContext(function($ctx1) {
  39093. $recv(anIRInstruction)._appendBlock_(self);
  39094. return self;
  39095. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  39096. },
  39097. args: ["anIRInstruction"],
  39098. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  39099. referencedClasses: [],
  39100. messageSends: ["appendBlock:"]
  39101. }),
  39102. $globals.BlockClosure);
  39103. $core.addMethod(
  39104. $core.method({
  39105. selector: "subtreeNeedsAliasing",
  39106. protocol: '*Compiler-IR',
  39107. fn: function (){
  39108. var self=this;
  39109. return $core.withContext(function($ctx1) {
  39110. return self._shouldBeAliased();
  39111. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  39112. },
  39113. args: [],
  39114. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  39115. referencedClasses: [],
  39116. messageSends: ["shouldBeAliased"]
  39117. }),
  39118. $globals.BlockNode);
  39119. $core.addMethod(
  39120. $core.method({
  39121. selector: "subtreeNeedsAliasing",
  39122. protocol: '*Compiler-IR',
  39123. fn: function (){
  39124. var self=this;
  39125. return $core.withContext(function($ctx1) {
  39126. return $recv($recv(self._parent())._isSequenceNode())._not();
  39127. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  39128. },
  39129. args: [],
  39130. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  39131. referencedClasses: [],
  39132. messageSends: ["not", "isSequenceNode", "parent"]
  39133. }),
  39134. $globals.CascadeNode);
  39135. $core.addMethod(
  39136. $core.method({
  39137. selector: "shouldBeAliased",
  39138. protocol: '*Compiler-IR',
  39139. fn: function (){
  39140. var self=this;
  39141. var sends;
  39142. return $core.withContext(function($ctx1) {
  39143. var $2,$1;
  39144. sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size();
  39145. $2=(
  39146. $ctx1.supercall = true,
  39147. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($recv(self), []));
  39148. $ctx1.supercall = false;
  39149. $1=$recv($2)._or_((function(){
  39150. return $core.withContext(function($ctx2) {
  39151. return $recv(self._isReferenced())._and_((function(){
  39152. return $core.withContext(function($ctx3) {
  39153. return $recv($recv(self._index()).__lt(sends))._or_((function(){
  39154. return $core.withContext(function($ctx4) {
  39155. return self._superSend();
  39156. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  39157. }));
  39158. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39159. }));
  39160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39161. }));
  39162. $ctx1.sendIdx["or:"]=1;
  39163. return $1;
  39164. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  39165. },
  39166. args: [],
  39167. 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 ] ] ])",
  39168. referencedClasses: [],
  39169. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  39170. }),
  39171. $globals.SendNode);
  39172. $core.addMethod(
  39173. $core.method({
  39174. selector: "subtreeNeedsAliasing",
  39175. protocol: '*Compiler-IR',
  39176. fn: function (){
  39177. var self=this;
  39178. return $core.withContext(function($ctx1) {
  39179. return $recv(self._shouldBeInlined())._or_((function(){
  39180. return $core.withContext(function($ctx2) {
  39181. return (
  39182. $ctx2.supercall = true,
  39183. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($recv(self), []));
  39184. $ctx2.supercall = false;
  39185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39186. }));
  39187. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  39188. },
  39189. args: [],
  39190. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  39191. referencedClasses: [],
  39192. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  39193. }),
  39194. $globals.SendNode);
  39195. });
  39196. define('amber_core/Compiler-Inlining',["amber/boot", "amber_core/Compiler-Core", "amber_core/Compiler-IR", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects"], function($boot){"use strict";
  39197. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  39198. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  39199. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  39200. $core.addPackage('Compiler-Inlining');
  39201. $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  39202. $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  39203. $core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining');
  39204. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  39205. $core.addMethod(
  39206. $core.method({
  39207. selector: "acceptDagVisitor:",
  39208. protocol: 'visiting',
  39209. fn: function (aVisitor){
  39210. var self=this;
  39211. return $core.withContext(function($ctx1) {
  39212. $recv(aVisitor)._visitIRInlinedClosure_(self);
  39213. return self;
  39214. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  39215. },
  39216. args: ["aVisitor"],
  39217. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  39218. referencedClasses: [],
  39219. messageSends: ["visitIRInlinedClosure:"]
  39220. }),
  39221. $globals.IRInlinedClosure);
  39222. $core.addMethod(
  39223. $core.method({
  39224. selector: "isInlined",
  39225. protocol: 'testing',
  39226. fn: function (){
  39227. var self=this;
  39228. return true;
  39229. },
  39230. args: [],
  39231. source: "isInlined\x0a\x09^ true",
  39232. referencedClasses: [],
  39233. messageSends: []
  39234. }),
  39235. $globals.IRInlinedClosure);
  39236. $core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining');
  39237. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  39238. $core.addMethod(
  39239. $core.method({
  39240. selector: "acceptDagVisitor:",
  39241. protocol: 'visiting',
  39242. fn: function (aVisitor){
  39243. var self=this;
  39244. return $core.withContext(function($ctx1) {
  39245. $recv(aVisitor)._visitInlinedSend_(self);
  39246. return self;
  39247. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  39248. },
  39249. args: ["aVisitor"],
  39250. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  39251. referencedClasses: [],
  39252. messageSends: ["visitInlinedSend:"]
  39253. }),
  39254. $globals.IRInlinedSend);
  39255. $core.addMethod(
  39256. $core.method({
  39257. selector: "internalVariables",
  39258. protocol: 'accessing',
  39259. fn: function (){
  39260. var self=this;
  39261. return [];
  39262. },
  39263. args: [],
  39264. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  39265. referencedClasses: [],
  39266. messageSends: []
  39267. }),
  39268. $globals.IRInlinedSend);
  39269. $core.addMethod(
  39270. $core.method({
  39271. selector: "isInlined",
  39272. protocol: 'testing',
  39273. fn: function (){
  39274. var self=this;
  39275. return true;
  39276. },
  39277. args: [],
  39278. source: "isInlined\x0a\x09^ true",
  39279. referencedClasses: [],
  39280. messageSends: []
  39281. }),
  39282. $globals.IRInlinedSend);
  39283. $core.addClass('IRInlinedIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39284. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  39285. $core.addMethod(
  39286. $core.method({
  39287. selector: "acceptDagVisitor:",
  39288. protocol: 'visiting',
  39289. fn: function (aVisitor){
  39290. var self=this;
  39291. return $core.withContext(function($ctx1) {
  39292. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  39293. return self;
  39294. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  39295. },
  39296. args: ["aVisitor"],
  39297. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  39298. referencedClasses: [],
  39299. messageSends: ["visitIRInlinedIfFalse:"]
  39300. }),
  39301. $globals.IRInlinedIfFalse);
  39302. $core.addClass('IRInlinedIfNilIfNotNil', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39303. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  39304. $core.addMethod(
  39305. $core.method({
  39306. selector: "acceptDagVisitor:",
  39307. protocol: 'visiting',
  39308. fn: function (aVisitor){
  39309. var self=this;
  39310. return $core.withContext(function($ctx1) {
  39311. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  39312. return self;
  39313. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  39314. },
  39315. args: ["aVisitor"],
  39316. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  39317. referencedClasses: [],
  39318. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  39319. }),
  39320. $globals.IRInlinedIfNilIfNotNil);
  39321. $core.addMethod(
  39322. $core.method({
  39323. selector: "internalVariables",
  39324. protocol: 'accessing',
  39325. fn: function (){
  39326. var self=this;
  39327. return $core.withContext(function($ctx1) {
  39328. return $recv($globals.Array)._with_(self._receiverInternalVariable());
  39329. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  39330. },
  39331. args: [],
  39332. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  39333. referencedClasses: ["Array"],
  39334. messageSends: ["with:", "receiverInternalVariable"]
  39335. }),
  39336. $globals.IRInlinedIfNilIfNotNil);
  39337. $core.addMethod(
  39338. $core.method({
  39339. selector: "receiverInternalVariable",
  39340. protocol: 'accessing',
  39341. fn: function (){
  39342. var self=this;
  39343. return $core.withContext(function($ctx1) {
  39344. var $1;
  39345. $1=$recv($globals.IRVariable)._new();
  39346. $ctx1.sendIdx["new"]=1;
  39347. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_(self._receiverInternalVariableName()));
  39348. return $recv($1)._yourself();
  39349. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  39350. },
  39351. args: [],
  39352. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  39353. referencedClasses: ["IRVariable", "AliasVar"],
  39354. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  39355. }),
  39356. $globals.IRInlinedIfNilIfNotNil);
  39357. $core.addMethod(
  39358. $core.method({
  39359. selector: "receiverInternalVariableName",
  39360. protocol: 'accessing',
  39361. fn: function (){
  39362. var self=this;
  39363. return "$receiver";
  39364. },
  39365. args: [],
  39366. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  39367. referencedClasses: [],
  39368. messageSends: []
  39369. }),
  39370. $globals.IRInlinedIfNilIfNotNil);
  39371. $core.addClass('IRInlinedIfTrue', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39372. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  39373. $core.addMethod(
  39374. $core.method({
  39375. selector: "acceptDagVisitor:",
  39376. protocol: 'visiting',
  39377. fn: function (aVisitor){
  39378. var self=this;
  39379. return $core.withContext(function($ctx1) {
  39380. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  39381. return self;
  39382. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  39383. },
  39384. args: ["aVisitor"],
  39385. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  39386. referencedClasses: [],
  39387. messageSends: ["visitIRInlinedIfTrue:"]
  39388. }),
  39389. $globals.IRInlinedIfTrue);
  39390. $core.addClass('IRInlinedIfTrueIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39391. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  39392. $core.addMethod(
  39393. $core.method({
  39394. selector: "acceptDagVisitor:",
  39395. protocol: 'visiting',
  39396. fn: function (aVisitor){
  39397. var self=this;
  39398. return $core.withContext(function($ctx1) {
  39399. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  39400. return self;
  39401. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  39402. },
  39403. args: ["aVisitor"],
  39404. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  39405. referencedClasses: [],
  39406. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  39407. }),
  39408. $globals.IRInlinedIfTrueIfFalse);
  39409. $core.addClass('IRInlinedSequence', $globals.IRBlockSequence, [], 'Compiler-Inlining');
  39410. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  39411. $core.addMethod(
  39412. $core.method({
  39413. selector: "acceptDagVisitor:",
  39414. protocol: 'visiting',
  39415. fn: function (aVisitor){
  39416. var self=this;
  39417. return $core.withContext(function($ctx1) {
  39418. $recv(aVisitor)._visitIRInlinedSequence_(self);
  39419. return self;
  39420. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  39421. },
  39422. args: ["aVisitor"],
  39423. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  39424. referencedClasses: [],
  39425. messageSends: ["visitIRInlinedSequence:"]
  39426. }),
  39427. $globals.IRInlinedSequence);
  39428. $core.addMethod(
  39429. $core.method({
  39430. selector: "isInlined",
  39431. protocol: 'testing',
  39432. fn: function (){
  39433. var self=this;
  39434. return true;
  39435. },
  39436. args: [],
  39437. source: "isInlined\x0a\x09^ true",
  39438. referencedClasses: [],
  39439. messageSends: []
  39440. }),
  39441. $globals.IRInlinedSequence);
  39442. $core.addClass('IRInliner', $globals.IRVisitor, [], 'Compiler-Inlining');
  39443. $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`";
  39444. $core.addMethod(
  39445. $core.method({
  39446. selector: "assignmentInliner",
  39447. protocol: 'factory',
  39448. fn: function (){
  39449. var self=this;
  39450. return $core.withContext(function($ctx1) {
  39451. var $1;
  39452. $1=$recv($globals.IRAssignmentInliner)._new();
  39453. $recv($1)._translator_(self);
  39454. return $recv($1)._yourself();
  39455. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  39456. },
  39457. args: [],
  39458. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39459. referencedClasses: ["IRAssignmentInliner"],
  39460. messageSends: ["translator:", "new", "yourself"]
  39461. }),
  39462. $globals.IRInliner);
  39463. $core.addMethod(
  39464. $core.method({
  39465. selector: "returnInliner",
  39466. protocol: 'factory',
  39467. fn: function (){
  39468. var self=this;
  39469. return $core.withContext(function($ctx1) {
  39470. var $1;
  39471. $1=$recv($globals.IRReturnInliner)._new();
  39472. $recv($1)._translator_(self);
  39473. return $recv($1)._yourself();
  39474. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  39475. },
  39476. args: [],
  39477. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39478. referencedClasses: ["IRReturnInliner"],
  39479. messageSends: ["translator:", "new", "yourself"]
  39480. }),
  39481. $globals.IRInliner);
  39482. $core.addMethod(
  39483. $core.method({
  39484. selector: "sendInliner",
  39485. protocol: 'factory',
  39486. fn: function (){
  39487. var self=this;
  39488. return $core.withContext(function($ctx1) {
  39489. var $1;
  39490. $1=$recv($globals.IRSendInliner)._new();
  39491. $recv($1)._translator_(self);
  39492. return $recv($1)._yourself();
  39493. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  39494. },
  39495. args: [],
  39496. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39497. referencedClasses: ["IRSendInliner"],
  39498. messageSends: ["translator:", "new", "yourself"]
  39499. }),
  39500. $globals.IRInliner);
  39501. $core.addMethod(
  39502. $core.method({
  39503. selector: "shouldInlineAssignment:",
  39504. protocol: 'testing',
  39505. fn: function (anIRAssignment){
  39506. var self=this;
  39507. return $core.withContext(function($ctx1) {
  39508. var $3,$2,$1;
  39509. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  39510. return $core.withContext(function($ctx2) {
  39511. $3=$recv(anIRAssignment)._right();
  39512. $ctx2.sendIdx["right"]=1;
  39513. $2=$recv($3)._isSend();
  39514. return $recv($2)._and_((function(){
  39515. return $core.withContext(function($ctx3) {
  39516. return self._shouldInlineSend_($recv(anIRAssignment)._right());
  39517. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39518. }));
  39519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39520. }));
  39521. $ctx1.sendIdx["and:"]=1;
  39522. return $1;
  39523. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  39524. },
  39525. args: ["anIRAssignment"],
  39526. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  39527. referencedClasses: [],
  39528. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  39529. }),
  39530. $globals.IRInliner);
  39531. $core.addMethod(
  39532. $core.method({
  39533. selector: "shouldInlineReturn:",
  39534. protocol: 'testing',
  39535. fn: function (anIRReturn){
  39536. var self=this;
  39537. return $core.withContext(function($ctx1) {
  39538. var $3,$2,$1;
  39539. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  39540. return $core.withContext(function($ctx2) {
  39541. $3=$recv(anIRReturn)._expression();
  39542. $ctx2.sendIdx["expression"]=1;
  39543. $2=$recv($3)._isSend();
  39544. return $recv($2)._and_((function(){
  39545. return $core.withContext(function($ctx3) {
  39546. return self._shouldInlineSend_($recv(anIRReturn)._expression());
  39547. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39548. }));
  39549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39550. }));
  39551. $ctx1.sendIdx["and:"]=1;
  39552. return $1;
  39553. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  39554. },
  39555. args: ["anIRReturn"],
  39556. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  39557. referencedClasses: [],
  39558. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  39559. }),
  39560. $globals.IRInliner);
  39561. $core.addMethod(
  39562. $core.method({
  39563. selector: "shouldInlineSend:",
  39564. protocol: 'testing',
  39565. fn: function (anIRSend){
  39566. var self=this;
  39567. return $core.withContext(function($ctx1) {
  39568. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  39569. return $core.withContext(function($ctx2) {
  39570. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  39571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39572. }));
  39573. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  39574. },
  39575. args: ["anIRSend"],
  39576. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  39577. referencedClasses: ["IRSendInliner"],
  39578. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  39579. }),
  39580. $globals.IRInliner);
  39581. $core.addMethod(
  39582. $core.method({
  39583. selector: "visitIRAssignment:",
  39584. protocol: 'visiting',
  39585. fn: function (anIRAssignment){
  39586. var self=this;
  39587. return $core.withContext(function($ctx1) {
  39588. var $1;
  39589. $1=self._shouldInlineAssignment_(anIRAssignment);
  39590. if($core.assert($1)){
  39591. return $recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  39592. } else {
  39593. return (
  39594. $ctx1.supercall = true,
  39595. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment]));
  39596. $ctx1.supercall = false;
  39597. };
  39598. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  39599. },
  39600. args: ["anIRAssignment"],
  39601. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  39602. referencedClasses: [],
  39603. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  39604. }),
  39605. $globals.IRInliner);
  39606. $core.addMethod(
  39607. $core.method({
  39608. selector: "visitIRNonLocalReturn:",
  39609. protocol: 'visiting',
  39610. fn: function (anIRNonLocalReturn){
  39611. var self=this;
  39612. var localReturn;
  39613. return $core.withContext(function($ctx1) {
  39614. var $2,$1,$4,$3,$5,$6,$7;
  39615. $2=$recv(anIRNonLocalReturn)._scope();
  39616. $ctx1.sendIdx["scope"]=1;
  39617. $1=$recv($2)._canInlineNonLocalReturns();
  39618. if($core.assert($1)){
  39619. $4=$recv(anIRNonLocalReturn)._scope();
  39620. $ctx1.sendIdx["scope"]=2;
  39621. $3=$recv($4)._methodScope();
  39622. $5=$recv(anIRNonLocalReturn)._scope();
  39623. $ctx1.sendIdx["scope"]=3;
  39624. $recv($3)._removeNonLocalReturn_($5);
  39625. $6=$recv($globals.IRReturn)._new();
  39626. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  39627. localReturn=$recv($6)._yourself();
  39628. localReturn;
  39629. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  39630. return $core.withContext(function($ctx2) {
  39631. return $recv(localReturn)._add_(each);
  39632. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39633. }));
  39634. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  39635. return self._visitIRReturn_(localReturn);
  39636. };
  39637. $7=(
  39638. $ctx1.supercall = true,
  39639. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  39640. $ctx1.supercall = false;
  39641. return $7;
  39642. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  39643. },
  39644. args: ["anIRNonLocalReturn"],
  39645. 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",
  39646. referencedClasses: ["IRReturn"],
  39647. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  39648. }),
  39649. $globals.IRInliner);
  39650. $core.addMethod(
  39651. $core.method({
  39652. selector: "visitIRReturn:",
  39653. protocol: 'visiting',
  39654. fn: function (anIRReturn){
  39655. var self=this;
  39656. return $core.withContext(function($ctx1) {
  39657. var $1;
  39658. $1=self._shouldInlineReturn_(anIRReturn);
  39659. if($core.assert($1)){
  39660. return $recv(self._returnInliner())._inlineReturn_(anIRReturn);
  39661. } else {
  39662. return (
  39663. $ctx1.supercall = true,
  39664. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  39665. $ctx1.supercall = false;
  39666. };
  39667. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  39668. },
  39669. args: ["anIRReturn"],
  39670. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  39671. referencedClasses: [],
  39672. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  39673. }),
  39674. $globals.IRInliner);
  39675. $core.addMethod(
  39676. $core.method({
  39677. selector: "visitIRSend:",
  39678. protocol: 'visiting',
  39679. fn: function (anIRSend){
  39680. var self=this;
  39681. return $core.withContext(function($ctx1) {
  39682. var $1;
  39683. $1=self._shouldInlineSend_(anIRSend);
  39684. if($core.assert($1)){
  39685. return $recv(self._sendInliner())._inlineSend_(anIRSend);
  39686. } else {
  39687. return (
  39688. $ctx1.supercall = true,
  39689. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($recv(self), [anIRSend]));
  39690. $ctx1.supercall = false;
  39691. };
  39692. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  39693. },
  39694. args: ["anIRSend"],
  39695. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  39696. referencedClasses: [],
  39697. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  39698. }),
  39699. $globals.IRInliner);
  39700. $core.addClass('IRInliningJSTranslator', $globals.IRJSTranslator, [], 'Compiler-Inlining');
  39701. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  39702. $core.addMethod(
  39703. $core.method({
  39704. selector: "visitIRInlinedClosure:",
  39705. protocol: 'visiting',
  39706. fn: function (anIRInlinedClosure){
  39707. var self=this;
  39708. return $core.withContext(function($ctx1) {
  39709. $recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  39710. return $core.withContext(function($ctx2) {
  39711. return $recv($recv(each)._name())._asVariableName();
  39712. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39713. })));
  39714. self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  39715. return self;
  39716. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  39717. },
  39718. args: ["anIRInlinedClosure"],
  39719. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  39720. referencedClasses: [],
  39721. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  39722. }),
  39723. $globals.IRInliningJSTranslator);
  39724. $core.addMethod(
  39725. $core.method({
  39726. selector: "visitIRInlinedIfFalse:",
  39727. protocol: 'visiting',
  39728. fn: function (anIRInlinedIfFalse){
  39729. var self=this;
  39730. return $core.withContext(function($ctx1) {
  39731. var $1,$2,$4,$3;
  39732. $1=self._stream();
  39733. $ctx1.sendIdx["stream"]=1;
  39734. $recv($1)._nextPutIf_then_((function(){
  39735. return $core.withContext(function($ctx2) {
  39736. $2=self._stream();
  39737. $ctx2.sendIdx["stream"]=2;
  39738. $recv($2)._nextPutAll_("!$core.assert(");
  39739. $ctx2.sendIdx["nextPutAll:"]=1;
  39740. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  39741. $ctx2.sendIdx["dagChildren"]=1;
  39742. $3=$recv($4)._first();
  39743. self._visit_($3);
  39744. $ctx2.sendIdx["visit:"]=1;
  39745. return $recv(self._stream())._nextPutAll_(")");
  39746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39747. }),(function(){
  39748. return $core.withContext(function($ctx2) {
  39749. return self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  39750. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39751. }));
  39752. return self;
  39753. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  39754. },
  39755. args: ["anIRInlinedIfFalse"],
  39756. 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 ]",
  39757. referencedClasses: [],
  39758. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  39759. }),
  39760. $globals.IRInliningJSTranslator);
  39761. $core.addMethod(
  39762. $core.method({
  39763. selector: "visitIRInlinedIfNilIfNotNil:",
  39764. protocol: 'visiting',
  39765. fn: function (anIRInlinedIfNilIfNotNil){
  39766. var self=this;
  39767. return $core.withContext(function($ctx1) {
  39768. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  39769. $1=self._stream();
  39770. $ctx1.sendIdx["stream"]=1;
  39771. $recv($1)._nextPutIf_then_else_((function(){
  39772. var recvVarName;
  39773. return $core.withContext(function($ctx2) {
  39774. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  39775. recvVarName;
  39776. $2=self._stream();
  39777. $ctx2.sendIdx["stream"]=2;
  39778. $4="(".__comma(recvVarName);
  39779. $ctx2.sendIdx[","]=2;
  39780. $3=$recv($4).__comma(" = ");
  39781. $ctx2.sendIdx[","]=1;
  39782. $recv($2)._nextPutAll_($3);
  39783. $ctx2.sendIdx["nextPutAll:"]=1;
  39784. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  39785. $ctx2.sendIdx["dagChildren"]=1;
  39786. $5=$recv($6)._first();
  39787. self._visit_($5);
  39788. $ctx2.sendIdx["visit:"]=1;
  39789. $7=self._stream();
  39790. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".isNil");
  39791. $ctx2.sendIdx[","]=3;
  39792. return $recv($7)._nextPutAll_($8);
  39793. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  39794. }),(function(){
  39795. return $core.withContext(function($ctx2) {
  39796. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  39797. $ctx2.sendIdx["dagChildren"]=2;
  39798. $9=$recv($10)._second();
  39799. return self._visit_($9);
  39800. $ctx2.sendIdx["visit:"]=2;
  39801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39802. }),(function(){
  39803. return $core.withContext(function($ctx2) {
  39804. return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  39805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39806. }));
  39807. return self;
  39808. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  39809. },
  39810. args: ["anIRInlinedIfNilIfNotNil"],
  39811. 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, '.isNil' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfNilIfNotNil dagChildren second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfNilIfNotNil dagChildren third ]",
  39812. referencedClasses: [],
  39813. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  39814. }),
  39815. $globals.IRInliningJSTranslator);
  39816. $core.addMethod(
  39817. $core.method({
  39818. selector: "visitIRInlinedIfTrue:",
  39819. protocol: 'visiting',
  39820. fn: function (anIRInlinedIfTrue){
  39821. var self=this;
  39822. return $core.withContext(function($ctx1) {
  39823. var $1,$2,$4,$3;
  39824. $1=self._stream();
  39825. $ctx1.sendIdx["stream"]=1;
  39826. $recv($1)._nextPutIf_then_((function(){
  39827. return $core.withContext(function($ctx2) {
  39828. $2=self._stream();
  39829. $ctx2.sendIdx["stream"]=2;
  39830. $recv($2)._nextPutAll_("$core.assert(");
  39831. $ctx2.sendIdx["nextPutAll:"]=1;
  39832. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  39833. $ctx2.sendIdx["dagChildren"]=1;
  39834. $3=$recv($4)._first();
  39835. self._visit_($3);
  39836. $ctx2.sendIdx["visit:"]=1;
  39837. return $recv(self._stream())._nextPutAll_(")");
  39838. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39839. }),(function(){
  39840. return $core.withContext(function($ctx2) {
  39841. return self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  39842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39843. }));
  39844. return self;
  39845. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  39846. },
  39847. args: ["anIRInlinedIfTrue"],
  39848. 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 ]",
  39849. referencedClasses: [],
  39850. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  39851. }),
  39852. $globals.IRInliningJSTranslator);
  39853. $core.addMethod(
  39854. $core.method({
  39855. selector: "visitIRInlinedIfTrueIfFalse:",
  39856. protocol: 'visiting',
  39857. fn: function (anIRInlinedIfTrueIfFalse){
  39858. var self=this;
  39859. return $core.withContext(function($ctx1) {
  39860. var $1,$2,$4,$3,$6,$5;
  39861. $1=self._stream();
  39862. $ctx1.sendIdx["stream"]=1;
  39863. $recv($1)._nextPutIf_then_else_((function(){
  39864. return $core.withContext(function($ctx2) {
  39865. $2=self._stream();
  39866. $ctx2.sendIdx["stream"]=2;
  39867. $recv($2)._nextPutAll_("$core.assert(");
  39868. $ctx2.sendIdx["nextPutAll:"]=1;
  39869. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  39870. $ctx2.sendIdx["dagChildren"]=1;
  39871. $3=$recv($4)._first();
  39872. self._visit_($3);
  39873. $ctx2.sendIdx["visit:"]=1;
  39874. return $recv(self._stream())._nextPutAll_(")");
  39875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39876. }),(function(){
  39877. return $core.withContext(function($ctx2) {
  39878. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  39879. $ctx2.sendIdx["dagChildren"]=2;
  39880. $5=$recv($6)._second();
  39881. return self._visit_($5);
  39882. $ctx2.sendIdx["visit:"]=2;
  39883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39884. }),(function(){
  39885. return $core.withContext(function($ctx2) {
  39886. return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  39887. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39888. }));
  39889. return self;
  39890. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  39891. },
  39892. args: ["anIRInlinedIfTrueIfFalse"],
  39893. 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 ]",
  39894. referencedClasses: [],
  39895. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  39896. }),
  39897. $globals.IRInliningJSTranslator);
  39898. $core.addMethod(
  39899. $core.method({
  39900. selector: "visitIRInlinedSequence:",
  39901. protocol: 'visiting',
  39902. fn: function (anIRInlinedSequence){
  39903. var self=this;
  39904. return $core.withContext(function($ctx1) {
  39905. $recv($recv(anIRInlinedSequence)._dagChildren())._do_((function(each){
  39906. return $core.withContext(function($ctx2) {
  39907. return $recv(self._stream())._nextPutStatementWith_((function(){
  39908. return $core.withContext(function($ctx3) {
  39909. return self._visit_(each);
  39910. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39911. }));
  39912. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39913. }));
  39914. return self;
  39915. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRInliningJSTranslator)});
  39916. },
  39917. args: ["anIRInlinedSequence"],
  39918. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  39919. referencedClasses: [],
  39920. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  39921. }),
  39922. $globals.IRInliningJSTranslator);
  39923. $core.addClass('IRSendInliner', $globals.Object, ['send', 'translator'], 'Compiler-Inlining');
  39924. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  39925. $core.addMethod(
  39926. $core.method({
  39927. selector: "ifFalse:",
  39928. protocol: 'inlining',
  39929. fn: function (anIRInstruction){
  39930. var self=this;
  39931. return $core.withContext(function($ctx1) {
  39932. return self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  39933. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  39934. },
  39935. args: ["anIRInstruction"],
  39936. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  39937. referencedClasses: ["IRInlinedIfFalse"],
  39938. messageSends: ["inlinedSend:withBlock:", "new"]
  39939. }),
  39940. $globals.IRSendInliner);
  39941. $core.addMethod(
  39942. $core.method({
  39943. selector: "ifFalse:ifTrue:",
  39944. protocol: 'inlining',
  39945. fn: function (anIRInstruction,anotherIRInstruction){
  39946. var self=this;
  39947. return $core.withContext(function($ctx1) {
  39948. return self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  39949. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  39950. },
  39951. args: ["anIRInstruction", "anotherIRInstruction"],
  39952. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  39953. referencedClasses: [],
  39954. messageSends: ["perform:withArguments:"]
  39955. }),
  39956. $globals.IRSendInliner);
  39957. $core.addMethod(
  39958. $core.method({
  39959. selector: "ifNil:",
  39960. protocol: 'inlining',
  39961. fn: function (anIRInstruction){
  39962. var self=this;
  39963. return $core.withContext(function($ctx1) {
  39964. var $1,$3,$5,$6,$4,$2;
  39965. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  39966. $ctx1.sendIdx["new"]=1;
  39967. $3=$recv($globals.IRClosure)._new();
  39968. $ctx1.sendIdx["new"]=2;
  39969. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  39970. $5=$recv($globals.IRBlockSequence)._new();
  39971. $recv($5)._add_($recv(self._send())._receiver());
  39972. $6=$recv($5)._yourself();
  39973. $ctx1.sendIdx["yourself"]=1;
  39974. $4=$6;
  39975. $recv($3)._add_($4);
  39976. $ctx1.sendIdx["add:"]=1;
  39977. $2=$recv($3)._yourself();
  39978. return self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  39979. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  39980. },
  39981. args: ["anIRInstruction"],
  39982. 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)",
  39983. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  39984. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  39985. }),
  39986. $globals.IRSendInliner);
  39987. $core.addMethod(
  39988. $core.method({
  39989. selector: "ifNil:ifNotNil:",
  39990. protocol: 'inlining',
  39991. fn: function (anIRInstruction,anotherIRInstruction){
  39992. var self=this;
  39993. return $core.withContext(function($ctx1) {
  39994. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  39995. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  39996. },
  39997. args: ["anIRInstruction", "anotherIRInstruction"],
  39998. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  39999. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  40000. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40001. }),
  40002. $globals.IRSendInliner);
  40003. $core.addMethod(
  40004. $core.method({
  40005. selector: "ifNotNil:",
  40006. protocol: 'inlining',
  40007. fn: function (anIRInstruction){
  40008. var self=this;
  40009. return $core.withContext(function($ctx1) {
  40010. var $1,$3,$5,$6,$4,$2;
  40011. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  40012. $ctx1.sendIdx["new"]=1;
  40013. $3=$recv($globals.IRClosure)._new();
  40014. $ctx1.sendIdx["new"]=2;
  40015. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  40016. $5=$recv($globals.IRBlockSequence)._new();
  40017. $recv($5)._add_($recv(self._send())._receiver());
  40018. $6=$recv($5)._yourself();
  40019. $ctx1.sendIdx["yourself"]=1;
  40020. $4=$6;
  40021. $recv($3)._add_($4);
  40022. $ctx1.sendIdx["add:"]=1;
  40023. $2=$recv($3)._yourself();
  40024. return self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  40025. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40026. },
  40027. args: ["anIRInstruction"],
  40028. 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",
  40029. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  40030. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  40031. }),
  40032. $globals.IRSendInliner);
  40033. $core.addMethod(
  40034. $core.method({
  40035. selector: "ifNotNil:ifNil:",
  40036. protocol: 'inlining',
  40037. fn: function (anIRInstruction,anotherIRInstruction){
  40038. var self=this;
  40039. return $core.withContext(function($ctx1) {
  40040. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  40041. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40042. },
  40043. args: ["anIRInstruction", "anotherIRInstruction"],
  40044. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  40045. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  40046. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40047. }),
  40048. $globals.IRSendInliner);
  40049. $core.addMethod(
  40050. $core.method({
  40051. selector: "ifTrue:",
  40052. protocol: 'inlining',
  40053. fn: function (anIRInstruction){
  40054. var self=this;
  40055. return $core.withContext(function($ctx1) {
  40056. return self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  40057. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40058. },
  40059. args: ["anIRInstruction"],
  40060. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  40061. referencedClasses: ["IRInlinedIfTrue"],
  40062. messageSends: ["inlinedSend:withBlock:", "new"]
  40063. }),
  40064. $globals.IRSendInliner);
  40065. $core.addMethod(
  40066. $core.method({
  40067. selector: "ifTrue:ifFalse:",
  40068. protocol: 'inlining',
  40069. fn: function (anIRInstruction,anotherIRInstruction){
  40070. var self=this;
  40071. return $core.withContext(function($ctx1) {
  40072. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  40073. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40074. },
  40075. args: ["anIRInstruction", "anotherIRInstruction"],
  40076. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  40077. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  40078. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40079. }),
  40080. $globals.IRSendInliner);
  40081. $core.addMethod(
  40082. $core.method({
  40083. selector: "inlineClosure:",
  40084. protocol: 'inlining',
  40085. fn: function (anIRClosure){
  40086. var self=this;
  40087. var inlinedClosure,sequence,statements;
  40088. return $core.withContext(function($ctx1) {
  40089. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  40090. inlinedClosure=self._inlinedClosure();
  40091. $1=inlinedClosure;
  40092. $2=$recv(anIRClosure)._scope();
  40093. $ctx1.sendIdx["scope"]=1;
  40094. $recv($1)._scope_($2);
  40095. $ctx1.sendIdx["scope:"]=1;
  40096. $recv($1)._parent_($recv(anIRClosure)._parent());
  40097. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  40098. return $core.withContext(function($ctx2) {
  40099. return $recv(inlinedClosure)._add_(each);
  40100. $ctx2.sendIdx["add:"]=1;
  40101. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40102. }));
  40103. $ctx1.sendIdx["do:"]=1;
  40104. sequence=self._inlinedSequence();
  40105. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  40106. return $core.withContext(function($ctx2) {
  40107. $3=inlinedClosure;
  40108. $5=$recv($globals.IRTempDeclaration)._new();
  40109. $ctx2.sendIdx["new"]=1;
  40110. $recv($5)._name_(each);
  40111. $ctx2.sendIdx["name:"]=1;
  40112. $6=$recv($5)._yourself();
  40113. $ctx2.sendIdx["yourself"]=1;
  40114. $4=$6;
  40115. $recv($3)._add_($4);
  40116. $ctx2.sendIdx["add:"]=2;
  40117. $7=sequence;
  40118. $9=$recv($globals.IRAssignment)._new();
  40119. $ctx2.sendIdx["new"]=2;
  40120. $11=$recv($globals.IRVariable)._new();
  40121. $ctx2.sendIdx["new"]=3;
  40122. $13=$recv($globals.AliasVar)._new();
  40123. $ctx2.sendIdx["new"]=4;
  40124. $14=$recv(inlinedClosure)._scope();
  40125. $ctx2.sendIdx["scope"]=2;
  40126. $recv($13)._scope_($14);
  40127. $ctx2.sendIdx["scope:"]=2;
  40128. $recv($13)._name_(each);
  40129. $ctx2.sendIdx["name:"]=2;
  40130. $15=$recv($13)._yourself();
  40131. $ctx2.sendIdx["yourself"]=2;
  40132. $12=$15;
  40133. $10=$recv($11)._variable_($12);
  40134. $ctx2.sendIdx["variable:"]=1;
  40135. $recv($9)._add_($10);
  40136. $ctx2.sendIdx["add:"]=4;
  40137. $17=$recv($globals.IRVariable)._new();
  40138. $ctx2.sendIdx["new"]=5;
  40139. $19=$recv($globals.AliasVar)._new();
  40140. $recv($19)._scope_($recv(inlinedClosure)._scope());
  40141. $recv($19)._name_("$receiver");
  40142. $20=$recv($19)._yourself();
  40143. $ctx2.sendIdx["yourself"]=3;
  40144. $18=$20;
  40145. $16=$recv($17)._variable_($18);
  40146. $recv($9)._add_($16);
  40147. $ctx2.sendIdx["add:"]=5;
  40148. $8=$recv($9)._yourself();
  40149. return $recv($7)._add_($8);
  40150. $ctx2.sendIdx["add:"]=3;
  40151. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40152. }));
  40153. $ctx1.sendIdx["do:"]=2;
  40154. $recv(inlinedClosure)._add_(sequence);
  40155. $ctx1.sendIdx["add:"]=6;
  40156. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  40157. $recv(statements)._ifNotEmpty_((function(){
  40158. return $core.withContext(function($ctx2) {
  40159. $recv($recv(statements)._allButLast())._do_((function(each){
  40160. return $core.withContext(function($ctx3) {
  40161. return $recv(sequence)._add_(each);
  40162. $ctx3.sendIdx["add:"]=7;
  40163. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  40164. }));
  40165. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  40166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40167. }));
  40168. return inlinedClosure;
  40169. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  40170. },
  40171. args: ["anIRClosure"],
  40172. 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",
  40173. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  40174. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  40175. }),
  40176. $globals.IRSendInliner);
  40177. $core.addMethod(
  40178. $core.method({
  40179. selector: "inlineSend:",
  40180. protocol: 'inlining',
  40181. fn: function (anIRSend){
  40182. var self=this;
  40183. return $core.withContext(function($ctx1) {
  40184. var $2,$1;
  40185. self._send_(anIRSend);
  40186. $2=self._send();
  40187. $ctx1.sendIdx["send"]=1;
  40188. $1=$recv($2)._selector();
  40189. return self._perform_withArguments_($1,$recv(self._send())._arguments());
  40190. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  40191. },
  40192. args: ["anIRSend"],
  40193. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  40194. referencedClasses: [],
  40195. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  40196. }),
  40197. $globals.IRSendInliner);
  40198. $core.addMethod(
  40199. $core.method({
  40200. selector: "inlineSend:andReplace:",
  40201. protocol: 'private',
  40202. fn: function (anIRSend,anIRInstruction){
  40203. var self=this;
  40204. return $core.withContext(function($ctx1) {
  40205. $recv(anIRInstruction)._replaceWith_(anIRSend);
  40206. return self._inlineSend_(anIRSend);
  40207. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40208. },
  40209. args: ["anIRSend", "anIRInstruction"],
  40210. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  40211. referencedClasses: [],
  40212. messageSends: ["replaceWith:", "inlineSend:"]
  40213. }),
  40214. $globals.IRSendInliner);
  40215. $core.addMethod(
  40216. $core.method({
  40217. selector: "inlinedClosure",
  40218. protocol: 'factory',
  40219. fn: function (){
  40220. var self=this;
  40221. return $core.withContext(function($ctx1) {
  40222. return $recv($globals.IRInlinedClosure)._new();
  40223. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  40224. },
  40225. args: [],
  40226. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  40227. referencedClasses: ["IRInlinedClosure"],
  40228. messageSends: ["new"]
  40229. }),
  40230. $globals.IRSendInliner);
  40231. $core.addMethod(
  40232. $core.method({
  40233. selector: "inlinedSend:withBlock:",
  40234. protocol: 'private',
  40235. fn: function (inlinedSend,anIRInstruction){
  40236. var self=this;
  40237. var inlinedClosure;
  40238. return $core.withContext(function($ctx1) {
  40239. var $1,$2,$4,$3,$5;
  40240. $1=$recv(anIRInstruction)._isClosure();
  40241. if(!$core.assert($1)){
  40242. self._inliningError_("Message argument should be a block");
  40243. $ctx1.sendIdx["inliningError:"]=1;
  40244. };
  40245. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  40246. if(!$core.assert($2)){
  40247. self._inliningError_("Inlined block should have zero argument");
  40248. };
  40249. inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  40250. $4=self._send();
  40251. $ctx1.sendIdx["send"]=1;
  40252. $3=$recv($4)._receiver();
  40253. $recv(inlinedSend)._add_($3);
  40254. $ctx1.sendIdx["add:"]=1;
  40255. $recv(inlinedSend)._add_(inlinedClosure);
  40256. $recv(self._send())._replaceWith_(inlinedSend);
  40257. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  40258. $ctx1.sendIdx["internalVariables"]=1;
  40259. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  40260. return inlinedSend;
  40261. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  40262. },
  40263. args: ["inlinedSend", "anIRInstruction"],
  40264. 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",
  40265. referencedClasses: [],
  40266. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  40267. }),
  40268. $globals.IRSendInliner);
  40269. $core.addMethod(
  40270. $core.method({
  40271. selector: "inlinedSend:withBlock:withBlock:",
  40272. protocol: 'private',
  40273. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  40274. var self=this;
  40275. var inlinedClosure1,inlinedClosure2;
  40276. return $core.withContext(function($ctx1) {
  40277. var $1,$2,$3,$4,$6,$5,$7;
  40278. $1=$recv(anIRInstruction)._isClosure();
  40279. $ctx1.sendIdx["isClosure"]=1;
  40280. if(!$core.assert($1)){
  40281. self._inliningError_("Message argument should be a block");
  40282. $ctx1.sendIdx["inliningError:"]=1;
  40283. };
  40284. $2=$recv(anotherIRInstruction)._isClosure();
  40285. if(!$core.assert($2)){
  40286. self._inliningError_("Message argument should be a block");
  40287. };
  40288. $3=self._translator();
  40289. $ctx1.sendIdx["translator"]=1;
  40290. $4=self._inlineClosure_(anIRInstruction);
  40291. $ctx1.sendIdx["inlineClosure:"]=1;
  40292. inlinedClosure1=$recv($3)._visit_($4);
  40293. $ctx1.sendIdx["visit:"]=1;
  40294. inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  40295. $6=self._send();
  40296. $ctx1.sendIdx["send"]=1;
  40297. $5=$recv($6)._receiver();
  40298. $recv(inlinedSend)._add_($5);
  40299. $ctx1.sendIdx["add:"]=1;
  40300. $recv(inlinedSend)._add_(inlinedClosure1);
  40301. $ctx1.sendIdx["add:"]=2;
  40302. $recv(inlinedSend)._add_(inlinedClosure2);
  40303. $recv(self._send())._replaceWith_(inlinedSend);
  40304. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  40305. $ctx1.sendIdx["internalVariables"]=1;
  40306. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  40307. return inlinedSend;
  40308. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  40309. },
  40310. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  40311. 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",
  40312. referencedClasses: [],
  40313. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  40314. }),
  40315. $globals.IRSendInliner);
  40316. $core.addMethod(
  40317. $core.method({
  40318. selector: "inlinedSequence",
  40319. protocol: 'factory',
  40320. fn: function (){
  40321. var self=this;
  40322. return $core.withContext(function($ctx1) {
  40323. return $recv($globals.IRInlinedSequence)._new();
  40324. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  40325. },
  40326. args: [],
  40327. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  40328. referencedClasses: ["IRInlinedSequence"],
  40329. messageSends: ["new"]
  40330. }),
  40331. $globals.IRSendInliner);
  40332. $core.addMethod(
  40333. $core.method({
  40334. selector: "inliningError:",
  40335. protocol: 'error handling',
  40336. fn: function (aString){
  40337. var self=this;
  40338. return $core.withContext(function($ctx1) {
  40339. $recv($globals.InliningError)._signal_(aString);
  40340. return self;
  40341. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  40342. },
  40343. args: ["aString"],
  40344. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  40345. referencedClasses: ["InliningError"],
  40346. messageSends: ["signal:"]
  40347. }),
  40348. $globals.IRSendInliner);
  40349. $core.addMethod(
  40350. $core.method({
  40351. selector: "send",
  40352. protocol: 'accessing',
  40353. fn: function (){
  40354. var self=this;
  40355. return self["@send"];
  40356. },
  40357. args: [],
  40358. source: "send\x0a\x09^ send",
  40359. referencedClasses: [],
  40360. messageSends: []
  40361. }),
  40362. $globals.IRSendInliner);
  40363. $core.addMethod(
  40364. $core.method({
  40365. selector: "send:",
  40366. protocol: 'accessing',
  40367. fn: function (anIRSend){
  40368. var self=this;
  40369. self["@send"]=anIRSend;
  40370. return self;
  40371. },
  40372. args: ["anIRSend"],
  40373. source: "send: anIRSend\x0a\x09send := anIRSend",
  40374. referencedClasses: [],
  40375. messageSends: []
  40376. }),
  40377. $globals.IRSendInliner);
  40378. $core.addMethod(
  40379. $core.method({
  40380. selector: "translator",
  40381. protocol: 'accessing',
  40382. fn: function (){
  40383. var self=this;
  40384. return self["@translator"];
  40385. },
  40386. args: [],
  40387. source: "translator\x0a\x09^ translator",
  40388. referencedClasses: [],
  40389. messageSends: []
  40390. }),
  40391. $globals.IRSendInliner);
  40392. $core.addMethod(
  40393. $core.method({
  40394. selector: "translator:",
  40395. protocol: 'accessing',
  40396. fn: function (anASTTranslator){
  40397. var self=this;
  40398. self["@translator"]=anASTTranslator;
  40399. return self;
  40400. },
  40401. args: ["anASTTranslator"],
  40402. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  40403. referencedClasses: [],
  40404. messageSends: []
  40405. }),
  40406. $globals.IRSendInliner);
  40407. $core.addMethod(
  40408. $core.method({
  40409. selector: "inlinedSelectors",
  40410. protocol: 'accessing',
  40411. fn: function (){
  40412. var self=this;
  40413. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  40414. },
  40415. args: [],
  40416. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  40417. referencedClasses: [],
  40418. messageSends: []
  40419. }),
  40420. $globals.IRSendInliner.klass);
  40421. $core.addMethod(
  40422. $core.method({
  40423. selector: "shouldInline:",
  40424. protocol: 'accessing',
  40425. fn: function (anIRSend){
  40426. var self=this;
  40427. return $core.withContext(function($ctx1) {
  40428. var $1;
  40429. $1=$recv(self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  40430. if(!$core.assert($1)){
  40431. return false;
  40432. };
  40433. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  40434. return $core.withContext(function($ctx2) {
  40435. return $recv(each)._isClosure();
  40436. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40437. }));
  40438. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.klass)});
  40439. },
  40440. args: ["anIRSend"],
  40441. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  40442. referencedClasses: [],
  40443. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  40444. }),
  40445. $globals.IRSendInliner.klass);
  40446. $core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['target'], 'Compiler-Inlining');
  40447. $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};";
  40448. $core.addMethod(
  40449. $core.method({
  40450. selector: "inlineAssignment:",
  40451. protocol: 'inlining',
  40452. fn: function (anIRAssignment){
  40453. var self=this;
  40454. return $core.withContext(function($ctx1) {
  40455. self._target_($recv(anIRAssignment)._left());
  40456. return self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  40457. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  40458. },
  40459. args: ["anIRAssignment"],
  40460. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  40461. referencedClasses: [],
  40462. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  40463. }),
  40464. $globals.IRAssignmentInliner);
  40465. $core.addMethod(
  40466. $core.method({
  40467. selector: "inlineClosure:",
  40468. protocol: 'inlining',
  40469. fn: function (anIRClosure){
  40470. var self=this;
  40471. var closure,sequence,statements;
  40472. return $core.withContext(function($ctx1) {
  40473. var $1,$2,$3,$5,$4;
  40474. closure=(
  40475. $ctx1.supercall = true,
  40476. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  40477. $ctx1.supercall = false;
  40478. sequence=$recv(closure)._sequence();
  40479. statements=$recv(sequence)._dagChildren();
  40480. $recv(statements)._ifNotEmpty_((function(){
  40481. var final;
  40482. return $core.withContext(function($ctx2) {
  40483. final=$recv(statements)._last();
  40484. final;
  40485. $1=$recv(final)._yieldsValue();
  40486. if($core.assert($1)){
  40487. $2=sequence;
  40488. $3=final;
  40489. $5=$recv($globals.IRAssignment)._new();
  40490. $recv($5)._add_(self._target());
  40491. $ctx2.sendIdx["add:"]=1;
  40492. $recv($5)._add_($recv(final)._copy());
  40493. $4=$recv($5)._yourself();
  40494. return $recv($2)._replace_with_($3,$4);
  40495. };
  40496. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  40497. }));
  40498. return closure;
  40499. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  40500. },
  40501. args: ["anIRClosure"],
  40502. 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",
  40503. referencedClasses: ["IRAssignment"],
  40504. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  40505. }),
  40506. $globals.IRAssignmentInliner);
  40507. $core.addMethod(
  40508. $core.method({
  40509. selector: "target",
  40510. protocol: 'accessing',
  40511. fn: function (){
  40512. var self=this;
  40513. return self["@target"];
  40514. },
  40515. args: [],
  40516. source: "target\x0a\x09^ target",
  40517. referencedClasses: [],
  40518. messageSends: []
  40519. }),
  40520. $globals.IRAssignmentInliner);
  40521. $core.addMethod(
  40522. $core.method({
  40523. selector: "target:",
  40524. protocol: 'accessing',
  40525. fn: function (anObject){
  40526. var self=this;
  40527. self["@target"]=anObject;
  40528. return self;
  40529. },
  40530. args: ["anObject"],
  40531. source: "target: anObject\x0a\x09target := anObject",
  40532. referencedClasses: [],
  40533. messageSends: []
  40534. }),
  40535. $globals.IRAssignmentInliner);
  40536. $core.addClass('IRReturnInliner', $globals.IRSendInliner, [], 'Compiler-Inlining');
  40537. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  40538. $core.addMethod(
  40539. $core.method({
  40540. selector: "inlineClosure:",
  40541. protocol: 'inlining',
  40542. fn: function (anIRClosure){
  40543. var self=this;
  40544. var closure,sequence,statements;
  40545. return $core.withContext(function($ctx1) {
  40546. var $1,$2,$3,$5,$4;
  40547. closure=(
  40548. $ctx1.supercall = true,
  40549. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  40550. $ctx1.supercall = false;
  40551. sequence=$recv(closure)._sequence();
  40552. statements=$recv(sequence)._dagChildren();
  40553. $recv(statements)._ifNotEmpty_((function(){
  40554. var final;
  40555. return $core.withContext(function($ctx2) {
  40556. final=$recv(statements)._last();
  40557. final;
  40558. $1=$recv(final)._yieldsValue();
  40559. if($core.assert($1)){
  40560. $2=sequence;
  40561. $3=final;
  40562. $5=$recv($globals.IRReturn)._new();
  40563. $recv($5)._add_($recv(final)._copy());
  40564. $4=$recv($5)._yourself();
  40565. return $recv($2)._replace_with_($3,$4);
  40566. };
  40567. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  40568. }));
  40569. return closure;
  40570. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  40571. },
  40572. args: ["anIRClosure"],
  40573. 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",
  40574. referencedClasses: ["IRReturn"],
  40575. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  40576. }),
  40577. $globals.IRReturnInliner);
  40578. $core.addMethod(
  40579. $core.method({
  40580. selector: "inlineReturn:",
  40581. protocol: 'inlining',
  40582. fn: function (anIRReturn){
  40583. var self=this;
  40584. return $core.withContext(function($ctx1) {
  40585. return self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  40586. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  40587. },
  40588. args: ["anIRReturn"],
  40589. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  40590. referencedClasses: [],
  40591. messageSends: ["inlineSend:andReplace:", "expression"]
  40592. }),
  40593. $globals.IRReturnInliner);
  40594. $core.addClass('InliningCodeGenerator', $globals.CodeGenerator, [], 'Compiler-Inlining');
  40595. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  40596. $core.addMethod(
  40597. $core.method({
  40598. selector: "compileNode:",
  40599. protocol: 'compiling',
  40600. fn: function (aNode){
  40601. var self=this;
  40602. var ir,stream;
  40603. return $core.withContext(function($ctx1) {
  40604. var $1;
  40605. $recv(self._semanticAnalyzer())._visit_(aNode);
  40606. $ctx1.sendIdx["visit:"]=1;
  40607. ir=$recv(self._translator())._visit_(aNode);
  40608. $ctx1.sendIdx["visit:"]=2;
  40609. $recv(self._inliner())._visit_(ir);
  40610. $ctx1.sendIdx["visit:"]=3;
  40611. $1=self._irTranslator();
  40612. $recv($1)._currentClass_(self._currentClass());
  40613. $recv($1)._visit_(ir);
  40614. return $recv($1)._contents();
  40615. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.InliningCodeGenerator)});
  40616. },
  40617. args: ["aNode"],
  40618. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09self inliner visit: ir.\x0a\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  40619. referencedClasses: [],
  40620. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"]
  40621. }),
  40622. $globals.InliningCodeGenerator);
  40623. $core.addMethod(
  40624. $core.method({
  40625. selector: "inliner",
  40626. protocol: 'compiling',
  40627. fn: function (){
  40628. var self=this;
  40629. return $core.withContext(function($ctx1) {
  40630. return $recv($globals.IRInliner)._new();
  40631. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  40632. },
  40633. args: [],
  40634. source: "inliner\x0a\x09^ IRInliner new",
  40635. referencedClasses: ["IRInliner"],
  40636. messageSends: ["new"]
  40637. }),
  40638. $globals.InliningCodeGenerator);
  40639. $core.addMethod(
  40640. $core.method({
  40641. selector: "irTranslator",
  40642. protocol: 'compiling',
  40643. fn: function (){
  40644. var self=this;
  40645. return $core.withContext(function($ctx1) {
  40646. return $recv($globals.IRInliningJSTranslator)._new();
  40647. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.InliningCodeGenerator)});
  40648. },
  40649. args: [],
  40650. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  40651. referencedClasses: ["IRInliningJSTranslator"],
  40652. messageSends: ["new"]
  40653. }),
  40654. $globals.InliningCodeGenerator);
  40655. $core.addMethod(
  40656. $core.method({
  40657. selector: "semanticAnalyzerClass",
  40658. protocol: 'compiling',
  40659. fn: function (){
  40660. var self=this;
  40661. return $globals.InliningSemanticAnalyzer;
  40662. },
  40663. args: [],
  40664. source: "semanticAnalyzerClass\x0a\x09^ InliningSemanticAnalyzer",
  40665. referencedClasses: ["InliningSemanticAnalyzer"],
  40666. messageSends: []
  40667. }),
  40668. $globals.InliningCodeGenerator);
  40669. $core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Inlining');
  40670. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  40671. $core.addClass('InliningSemanticAnalyzer', $globals.SemanticAnalyzer, [], 'Compiler-Inlining');
  40672. $core.addMethod(
  40673. $core.method({
  40674. selector: "visitSendNode:",
  40675. protocol: 'visiting',
  40676. fn: function (aNode){
  40677. var self=this;
  40678. return $core.withContext(function($ctx1) {
  40679. var $1,$2,$3,$receiver;
  40680. $1=$recv(aNode)._superSend();
  40681. if(!$core.assert($1)){
  40682. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  40683. if($core.assert($2)){
  40684. $recv(aNode)._shouldBeInlined_(true);
  40685. $3=$recv(aNode)._receiver();
  40686. if(($receiver = $3) == null || $receiver.isNil){
  40687. $3;
  40688. } else {
  40689. var receiver;
  40690. receiver=$receiver;
  40691. $recv(receiver)._shouldBeAliased_(true);
  40692. };
  40693. };
  40694. };
  40695. (
  40696. $ctx1.supercall = true,
  40697. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  40698. $ctx1.supercall = false;
  40699. return self;
  40700. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  40701. },
  40702. args: ["aNode"],
  40703. 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",
  40704. referencedClasses: ["IRSendInliner"],
  40705. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  40706. }),
  40707. $globals.InliningSemanticAnalyzer);
  40708. $core.addMethod(
  40709. $core.method({
  40710. selector: "asInlinedBlockResult",
  40711. protocol: '*Compiler-Inlining',
  40712. fn: function (){
  40713. var self=this;
  40714. return $core.withContext(function($ctx1) {
  40715. return self._expression();
  40716. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  40717. },
  40718. args: [],
  40719. source: "asInlinedBlockResult\x0a\x09^ self expression",
  40720. referencedClasses: [],
  40721. messageSends: ["expression"]
  40722. }),
  40723. $globals.IRBlockReturn);
  40724. $core.addMethod(
  40725. $core.method({
  40726. selector: "asInlinedBlockResult",
  40727. protocol: '*Compiler-Inlining',
  40728. fn: function (){
  40729. var self=this;
  40730. return self;
  40731. },
  40732. args: [],
  40733. source: "asInlinedBlockResult\x0a\x09^ self",
  40734. referencedClasses: [],
  40735. messageSends: []
  40736. }),
  40737. $globals.IRInstruction);
  40738. });
  40739. define('amber_core/Compiler-Interpreter',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Semantic", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  40740. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  40741. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  40742. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  40743. $core.addPackage('Compiler-Interpreter');
  40744. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  40745. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  40746. $core.addClass('AIBlockClosure', $globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  40747. $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`).";
  40748. $core.addMethod(
  40749. $core.method({
  40750. selector: "applyTo:arguments:",
  40751. protocol: 'evaluating',
  40752. fn: function (anObject,aCollection){
  40753. var self=this;
  40754. return $core.withContext(function($ctx1) {
  40755. self._interpreterError();
  40756. return self;
  40757. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  40758. },
  40759. args: ["anObject", "aCollection"],
  40760. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  40761. referencedClasses: [],
  40762. messageSends: ["interpreterError"]
  40763. }),
  40764. $globals.AIBlockClosure);
  40765. $core.addMethod(
  40766. $core.method({
  40767. selector: "compiledSource",
  40768. protocol: 'accessing',
  40769. fn: function (){
  40770. var self=this;
  40771. return "[ AST Block closure ]";
  40772. },
  40773. args: [],
  40774. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  40775. referencedClasses: [],
  40776. messageSends: []
  40777. }),
  40778. $globals.AIBlockClosure);
  40779. $core.addMethod(
  40780. $core.method({
  40781. selector: "currySelf",
  40782. protocol: 'converting',
  40783. fn: function (){
  40784. var self=this;
  40785. return $core.withContext(function($ctx1) {
  40786. self._interpreterError();
  40787. return self;
  40788. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  40789. },
  40790. args: [],
  40791. source: "currySelf\x0a\x09self interpreterError",
  40792. referencedClasses: [],
  40793. messageSends: ["interpreterError"]
  40794. }),
  40795. $globals.AIBlockClosure);
  40796. $core.addMethod(
  40797. $core.method({
  40798. selector: "initializeWithContext:node:",
  40799. protocol: 'initialization',
  40800. fn: function (aContext,aNode){
  40801. var self=this;
  40802. self["@node"]=aNode;
  40803. self["@outerContext"]=aContext;
  40804. return self;
  40805. },
  40806. args: ["aContext", "aNode"],
  40807. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  40808. referencedClasses: [],
  40809. messageSends: []
  40810. }),
  40811. $globals.AIBlockClosure);
  40812. $core.addMethod(
  40813. $core.method({
  40814. selector: "interpreterError",
  40815. protocol: 'error handling',
  40816. fn: function (){
  40817. var self=this;
  40818. return $core.withContext(function($ctx1) {
  40819. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  40820. return self;
  40821. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  40822. },
  40823. args: [],
  40824. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  40825. referencedClasses: ["ASTInterpreterError"],
  40826. messageSends: ["signal:"]
  40827. }),
  40828. $globals.AIBlockClosure);
  40829. $core.addMethod(
  40830. $core.method({
  40831. selector: "numArgs",
  40832. protocol: 'accessing',
  40833. fn: function (){
  40834. var self=this;
  40835. return $core.withContext(function($ctx1) {
  40836. return $recv($recv(self["@node"])._temps())._size();
  40837. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  40838. },
  40839. args: [],
  40840. source: "numArgs\x0a\x09^ node temps size",
  40841. referencedClasses: [],
  40842. messageSends: ["size", "temps"]
  40843. }),
  40844. $globals.AIBlockClosure);
  40845. $core.addMethod(
  40846. $core.method({
  40847. selector: "value",
  40848. protocol: 'evaluating',
  40849. fn: function (){
  40850. var self=this;
  40851. return $core.withContext(function($ctx1) {
  40852. return self._valueWithPossibleArguments_([]);
  40853. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  40854. },
  40855. args: [],
  40856. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  40857. referencedClasses: [],
  40858. messageSends: ["valueWithPossibleArguments:"]
  40859. }),
  40860. $globals.AIBlockClosure);
  40861. $core.addMethod(
  40862. $core.method({
  40863. selector: "value:",
  40864. protocol: 'evaluating',
  40865. fn: function (anArgument){
  40866. var self=this;
  40867. return $core.withContext(function($ctx1) {
  40868. return self._valueWithPossibleArguments_([anArgument]);
  40869. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  40870. },
  40871. args: ["anArgument"],
  40872. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  40873. referencedClasses: [],
  40874. messageSends: ["valueWithPossibleArguments:"]
  40875. }),
  40876. $globals.AIBlockClosure);
  40877. $core.addMethod(
  40878. $core.method({
  40879. selector: "value:value:",
  40880. protocol: 'evaluating',
  40881. fn: function (firstArgument,secondArgument){
  40882. var self=this;
  40883. return $core.withContext(function($ctx1) {
  40884. return self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  40885. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  40886. },
  40887. args: ["firstArgument", "secondArgument"],
  40888. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  40889. referencedClasses: [],
  40890. messageSends: ["valueWithPossibleArguments:"]
  40891. }),
  40892. $globals.AIBlockClosure);
  40893. $core.addMethod(
  40894. $core.method({
  40895. selector: "value:value:value:",
  40896. protocol: 'evaluating',
  40897. fn: function (firstArgument,secondArgument,thirdArgument){
  40898. var self=this;
  40899. return $core.withContext(function($ctx1) {
  40900. return self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  40901. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  40902. },
  40903. args: ["firstArgument", "secondArgument", "thirdArgument"],
  40904. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  40905. referencedClasses: [],
  40906. messageSends: ["valueWithPossibleArguments:"]
  40907. }),
  40908. $globals.AIBlockClosure);
  40909. $core.addMethod(
  40910. $core.method({
  40911. selector: "valueWithPossibleArguments:",
  40912. protocol: 'evaluating',
  40913. fn: function (aCollection){
  40914. var self=this;
  40915. var context,sequenceNode;
  40916. return $core.withContext(function($ctx1) {
  40917. var $1,$2,$3;
  40918. context=$recv(self["@outerContext"])._newInnerContext();
  40919. $1=$recv($recv($recv(self["@node"])._dagChildren())._first())._copy();
  40920. $recv($1)._parent_(nil);
  40921. sequenceNode=$recv($1)._yourself();
  40922. $recv($recv(sequenceNode)._temps())._do_((function(each){
  40923. return $core.withContext(function($ctx2) {
  40924. return $recv(context)._defineLocal_(each);
  40925. $ctx2.sendIdx["defineLocal:"]=1;
  40926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40927. }));
  40928. $recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){
  40929. return $core.withContext(function($ctx2) {
  40930. $recv(context)._defineLocal_(each);
  40931. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  40932. return nil;
  40933. })));
  40934. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  40935. }));
  40936. $2=$recv(context)._interpreter();
  40937. $ctx1.sendIdx["interpreter"]=1;
  40938. $recv($2)._node_(sequenceNode);
  40939. $recv($2)._enterNode();
  40940. $recv($2)._proceed();
  40941. $3=$recv(self["@outerContext"])._interpreter();
  40942. $ctx1.sendIdx["interpreter"]=2;
  40943. $recv($3)._setNonLocalReturnFromContext_(context);
  40944. return $recv($recv(context)._interpreter())._pop();
  40945. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  40946. },
  40947. args: ["aCollection"],
  40948. 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",
  40949. referencedClasses: [],
  40950. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  40951. }),
  40952. $globals.AIBlockClosure);
  40953. $core.addMethod(
  40954. $core.method({
  40955. selector: "forContext:node:",
  40956. protocol: 'instance creation',
  40957. fn: function (aContext,aNode){
  40958. var self=this;
  40959. return $core.withContext(function($ctx1) {
  40960. var $1;
  40961. $1=self._new();
  40962. $recv($1)._initializeWithContext_node_(aContext,aNode);
  40963. return $recv($1)._yourself();
  40964. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)});
  40965. },
  40966. args: ["aContext", "aNode"],
  40967. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  40968. referencedClasses: [],
  40969. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  40970. }),
  40971. $globals.AIBlockClosure.klass);
  40972. $core.addClass('AIContext', $globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
  40973. $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)";
  40974. $core.addMethod(
  40975. $core.method({
  40976. selector: "arguments",
  40977. protocol: 'interpreting',
  40978. fn: function (){
  40979. var self=this;
  40980. return $core.withContext(function($ctx1) {
  40981. return $recv($recv(self._ast())._arguments())._collect_((function(each){
  40982. return $core.withContext(function($ctx2) {
  40983. return self._localAt_ifAbsent_(each,(function(){
  40984. return $core.withContext(function($ctx3) {
  40985. return self._error_("Argument not in context");
  40986. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40987. }));
  40988. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40989. }));
  40990. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  40991. },
  40992. args: [],
  40993. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  40994. referencedClasses: [],
  40995. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  40996. }),
  40997. $globals.AIContext);
  40998. $core.addMethod(
  40999. $core.method({
  41000. selector: "ast",
  41001. protocol: 'interpreting',
  41002. fn: function (){
  41003. var self=this;
  41004. return $core.withContext(function($ctx1) {
  41005. var $1,$2,$3,$receiver;
  41006. $1=self._isBlockContext();
  41007. if($core.assert($1)){
  41008. $2=self._outerContext();
  41009. if(($receiver = $2) == null || $receiver.isNil){
  41010. return $2;
  41011. } else {
  41012. var context;
  41013. context=$receiver;
  41014. return $recv(context)._ast();
  41015. };
  41016. };
  41017. $3=self["@ast"];
  41018. if(($receiver = $3) == null || $receiver.isNil){
  41019. self._initializeAST();
  41020. } else {
  41021. $3;
  41022. };
  41023. return self["@ast"];
  41024. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  41025. },
  41026. args: [],
  41027. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  41028. referencedClasses: [],
  41029. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  41030. }),
  41031. $globals.AIContext);
  41032. $core.addMethod(
  41033. $core.method({
  41034. selector: "basicLocalAt:",
  41035. protocol: 'private',
  41036. fn: function (aString){
  41037. var self=this;
  41038. return $core.withContext(function($ctx1) {
  41039. return $recv(self._locals())._at_(aString);
  41040. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  41041. },
  41042. args: ["aString"],
  41043. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  41044. referencedClasses: [],
  41045. messageSends: ["at:", "locals"]
  41046. }),
  41047. $globals.AIContext);
  41048. $core.addMethod(
  41049. $core.method({
  41050. selector: "basicLocalAt:put:",
  41051. protocol: 'private',
  41052. fn: function (aString,anObject){
  41053. var self=this;
  41054. return $core.withContext(function($ctx1) {
  41055. $recv(self._locals())._at_put_(aString,anObject);
  41056. return self;
  41057. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  41058. },
  41059. args: ["aString", "anObject"],
  41060. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  41061. referencedClasses: [],
  41062. messageSends: ["at:put:", "locals"]
  41063. }),
  41064. $globals.AIContext);
  41065. $core.addMethod(
  41066. $core.method({
  41067. selector: "basicReceiver",
  41068. protocol: 'interpreting',
  41069. fn: function (){
  41070. var self=this;
  41071. return $core.withContext(function($ctx1) {
  41072. return self._localAt_("self");
  41073. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  41074. },
  41075. args: [],
  41076. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  41077. referencedClasses: [],
  41078. messageSends: ["localAt:"]
  41079. }),
  41080. $globals.AIContext);
  41081. $core.addMethod(
  41082. $core.method({
  41083. selector: "defineLocal:",
  41084. protocol: 'accessing',
  41085. fn: function (aString){
  41086. var self=this;
  41087. return $core.withContext(function($ctx1) {
  41088. $recv(self._locals())._at_put_(aString,nil);
  41089. return self;
  41090. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  41091. },
  41092. args: ["aString"],
  41093. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  41094. referencedClasses: [],
  41095. messageSends: ["at:put:", "locals"]
  41096. }),
  41097. $globals.AIContext);
  41098. $core.addMethod(
  41099. $core.method({
  41100. selector: "evaluate:on:",
  41101. protocol: 'evaluating',
  41102. fn: function (aString,anEvaluator){
  41103. var self=this;
  41104. return $core.withContext(function($ctx1) {
  41105. return $recv(anEvaluator)._evaluate_context_(aString,self);
  41106. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  41107. },
  41108. args: ["aString", "anEvaluator"],
  41109. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  41110. referencedClasses: [],
  41111. messageSends: ["evaluate:context:"]
  41112. }),
  41113. $globals.AIContext);
  41114. $core.addMethod(
  41115. $core.method({
  41116. selector: "evaluateNode:",
  41117. protocol: 'evaluating',
  41118. fn: function (aNode){
  41119. var self=this;
  41120. return $core.withContext(function($ctx1) {
  41121. var $1;
  41122. $1=$recv($globals.ASTInterpreter)._new();
  41123. $recv($1)._context_(self);
  41124. $recv($1)._node_(aNode);
  41125. $recv($1)._enterNode();
  41126. $recv($1)._proceed();
  41127. return $recv($1)._result();
  41128. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  41129. },
  41130. args: ["aNode"],
  41131. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  41132. referencedClasses: ["ASTInterpreter"],
  41133. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  41134. }),
  41135. $globals.AIContext);
  41136. $core.addMethod(
  41137. $core.method({
  41138. selector: "evaluatedSelector",
  41139. protocol: 'accessing',
  41140. fn: function (){
  41141. var self=this;
  41142. return self["@evaluatedSelector"];
  41143. },
  41144. args: [],
  41145. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  41146. referencedClasses: [],
  41147. messageSends: []
  41148. }),
  41149. $globals.AIContext);
  41150. $core.addMethod(
  41151. $core.method({
  41152. selector: "evaluatedSelector:",
  41153. protocol: 'accessing',
  41154. fn: function (aString){
  41155. var self=this;
  41156. self["@evaluatedSelector"]=aString;
  41157. return self;
  41158. },
  41159. args: ["aString"],
  41160. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  41161. referencedClasses: [],
  41162. messageSends: []
  41163. }),
  41164. $globals.AIContext);
  41165. $core.addMethod(
  41166. $core.method({
  41167. selector: "index",
  41168. protocol: 'accessing',
  41169. fn: function (){
  41170. var self=this;
  41171. return $core.withContext(function($ctx1) {
  41172. var $1,$receiver;
  41173. $1=self["@index"];
  41174. if(($receiver = $1) == null || $receiver.isNil){
  41175. return (0);
  41176. } else {
  41177. return $1;
  41178. };
  41179. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  41180. },
  41181. args: [],
  41182. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  41183. referencedClasses: [],
  41184. messageSends: ["ifNil:"]
  41185. }),
  41186. $globals.AIContext);
  41187. $core.addMethod(
  41188. $core.method({
  41189. selector: "index:",
  41190. protocol: 'accessing',
  41191. fn: function (anInteger){
  41192. var self=this;
  41193. self["@index"]=anInteger;
  41194. return self;
  41195. },
  41196. args: ["anInteger"],
  41197. source: "index: anInteger\x0a\x09index := anInteger",
  41198. referencedClasses: [],
  41199. messageSends: []
  41200. }),
  41201. $globals.AIContext);
  41202. $core.addMethod(
  41203. $core.method({
  41204. selector: "initializeAST",
  41205. protocol: 'initialization',
  41206. fn: function (){
  41207. var self=this;
  41208. return $core.withContext(function($ctx1) {
  41209. var $1;
  41210. $1=self._method();
  41211. $ctx1.sendIdx["method"]=1;
  41212. self["@ast"]=$recv($1)._ast();
  41213. $recv($recv($globals.SemanticAnalyzer)._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]);
  41214. return self;
  41215. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  41216. },
  41217. args: [],
  41218. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  41219. referencedClasses: ["SemanticAnalyzer"],
  41220. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  41221. }),
  41222. $globals.AIContext);
  41223. $core.addMethod(
  41224. $core.method({
  41225. selector: "initializeFromMethodContext:",
  41226. protocol: 'initialization',
  41227. fn: function (aMethodContext){
  41228. var self=this;
  41229. return $core.withContext(function($ctx1) {
  41230. var $1,$2,$3,$receiver;
  41231. self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  41232. self._index_($recv(aMethodContext)._index());
  41233. self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  41234. self._receiver_($recv(aMethodContext)._receiver());
  41235. self._supercall_($recv(aMethodContext)._supercall());
  41236. self._selector_($recv(aMethodContext)._selector());
  41237. $1=$recv(aMethodContext)._outerContext();
  41238. $ctx1.sendIdx["outerContext"]=1;
  41239. if(($receiver = $1) == null || $receiver.isNil){
  41240. $1;
  41241. } else {
  41242. var outer;
  41243. outer=$receiver;
  41244. $2=$recv(outer)._methodContext();
  41245. if(($receiver = $2) == null || $receiver.isNil){
  41246. $2;
  41247. } else {
  41248. self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  41249. };
  41250. $3=$recv(aMethodContext)._locals();
  41251. $ctx1.sendIdx["locals"]=1;
  41252. $recv($3)._keysAndValuesDo_((function(key,value){
  41253. return $core.withContext(function($ctx2) {
  41254. return $recv(self._locals())._at_put_(key,value);
  41255. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  41256. }));
  41257. };
  41258. return self;
  41259. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  41260. },
  41261. args: ["aMethodContext"],
  41262. 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 ] ]",
  41263. referencedClasses: [],
  41264. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  41265. }),
  41266. $globals.AIContext);
  41267. $core.addMethod(
  41268. $core.method({
  41269. selector: "initializeInterpreter",
  41270. protocol: 'initialization',
  41271. fn: function (){
  41272. var self=this;
  41273. return $core.withContext(function($ctx1) {
  41274. var $1,$2,$receiver;
  41275. $1=$recv($globals.ASTInterpreter)._new();
  41276. $recv($1)._context_(self);
  41277. self["@interpreter"]=$recv($1)._yourself();
  41278. $2=self._innerContext();
  41279. if(($receiver = $2) == null || $receiver.isNil){
  41280. $2;
  41281. } else {
  41282. self._setupInterpreter_(self["@interpreter"]);
  41283. };
  41284. return self;
  41285. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  41286. },
  41287. args: [],
  41288. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  41289. referencedClasses: ["ASTInterpreter"],
  41290. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  41291. }),
  41292. $globals.AIContext);
  41293. $core.addMethod(
  41294. $core.method({
  41295. selector: "initializeLocals",
  41296. protocol: 'initialization',
  41297. fn: function (){
  41298. var self=this;
  41299. return $core.withContext(function($ctx1) {
  41300. self["@locals"]=$recv($globals.Dictionary)._new();
  41301. $recv(self["@locals"])._at_put_("thisContext",self);
  41302. return self;
  41303. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  41304. },
  41305. args: [],
  41306. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  41307. referencedClasses: ["Dictionary"],
  41308. messageSends: ["new", "at:put:"]
  41309. }),
  41310. $globals.AIContext);
  41311. $core.addMethod(
  41312. $core.method({
  41313. selector: "innerContext",
  41314. protocol: 'accessing',
  41315. fn: function (){
  41316. var self=this;
  41317. return self["@innerContext"];
  41318. },
  41319. args: [],
  41320. source: "innerContext\x0a\x09^ innerContext",
  41321. referencedClasses: [],
  41322. messageSends: []
  41323. }),
  41324. $globals.AIContext);
  41325. $core.addMethod(
  41326. $core.method({
  41327. selector: "innerContext:",
  41328. protocol: 'accessing',
  41329. fn: function (anAIContext){
  41330. var self=this;
  41331. self["@innerContext"]=anAIContext;
  41332. return self;
  41333. },
  41334. args: ["anAIContext"],
  41335. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  41336. referencedClasses: [],
  41337. messageSends: []
  41338. }),
  41339. $globals.AIContext);
  41340. $core.addMethod(
  41341. $core.method({
  41342. selector: "interpreter",
  41343. protocol: 'interpreting',
  41344. fn: function (){
  41345. var self=this;
  41346. return $core.withContext(function($ctx1) {
  41347. var $1,$receiver;
  41348. $1=self["@interpreter"];
  41349. if(($receiver = $1) == null || $receiver.isNil){
  41350. self._initializeInterpreter();
  41351. } else {
  41352. $1;
  41353. };
  41354. return self["@interpreter"];
  41355. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  41356. },
  41357. args: [],
  41358. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  41359. referencedClasses: [],
  41360. messageSends: ["ifNil:", "initializeInterpreter"]
  41361. }),
  41362. $globals.AIContext);
  41363. $core.addMethod(
  41364. $core.method({
  41365. selector: "interpreter:",
  41366. protocol: 'interpreting',
  41367. fn: function (anInterpreter){
  41368. var self=this;
  41369. self["@interpreter"]=anInterpreter;
  41370. return self;
  41371. },
  41372. args: ["anInterpreter"],
  41373. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  41374. referencedClasses: [],
  41375. messageSends: []
  41376. }),
  41377. $globals.AIContext);
  41378. $core.addMethod(
  41379. $core.method({
  41380. selector: "isTopContext",
  41381. protocol: 'testing',
  41382. fn: function (){
  41383. var self=this;
  41384. return $core.withContext(function($ctx1) {
  41385. return $recv(self._innerContext())._isNil();
  41386. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  41387. },
  41388. args: [],
  41389. source: "isTopContext\x0a\x09^ self innerContext isNil",
  41390. referencedClasses: [],
  41391. messageSends: ["isNil", "innerContext"]
  41392. }),
  41393. $globals.AIContext);
  41394. $core.addMethod(
  41395. $core.method({
  41396. selector: "localAt:",
  41397. protocol: 'accessing',
  41398. fn: function (aString){
  41399. var self=this;
  41400. var context;
  41401. return $core.withContext(function($ctx1) {
  41402. context=self._lookupContextForLocal_(aString);
  41403. return $recv(context)._basicLocalAt_(aString);
  41404. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  41405. },
  41406. args: ["aString"],
  41407. 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",
  41408. referencedClasses: [],
  41409. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  41410. }),
  41411. $globals.AIContext);
  41412. $core.addMethod(
  41413. $core.method({
  41414. selector: "localAt:ifAbsent:",
  41415. protocol: 'accessing',
  41416. fn: function (aString,aBlock){
  41417. var self=this;
  41418. var context;
  41419. return $core.withContext(function($ctx1) {
  41420. var $early={};
  41421. try {
  41422. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  41423. return $core.withContext(function($ctx2) {
  41424. throw $early=[$recv(aBlock)._value()];
  41425. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41426. }));
  41427. return $recv(context)._basicLocalAt_(aString);
  41428. }
  41429. catch(e) {if(e===$early)return e[0]; throw e}
  41430. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  41431. },
  41432. args: ["aString", "aBlock"],
  41433. 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",
  41434. referencedClasses: [],
  41435. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  41436. }),
  41437. $globals.AIContext);
  41438. $core.addMethod(
  41439. $core.method({
  41440. selector: "localAt:put:",
  41441. protocol: 'accessing',
  41442. fn: function (aString,anObject){
  41443. var self=this;
  41444. var context;
  41445. return $core.withContext(function($ctx1) {
  41446. context=self._lookupContextForLocal_(aString);
  41447. $recv(context)._basicLocalAt_put_(aString,anObject);
  41448. return self;
  41449. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  41450. },
  41451. args: ["aString", "anObject"],
  41452. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  41453. referencedClasses: [],
  41454. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  41455. }),
  41456. $globals.AIContext);
  41457. $core.addMethod(
  41458. $core.method({
  41459. selector: "locals",
  41460. protocol: 'accessing',
  41461. fn: function (){
  41462. var self=this;
  41463. return $core.withContext(function($ctx1) {
  41464. var $1,$receiver;
  41465. $1=self["@locals"];
  41466. if(($receiver = $1) == null || $receiver.isNil){
  41467. self._initializeLocals();
  41468. } else {
  41469. $1;
  41470. };
  41471. return self["@locals"];
  41472. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  41473. },
  41474. args: [],
  41475. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  41476. referencedClasses: [],
  41477. messageSends: ["ifNil:", "initializeLocals"]
  41478. }),
  41479. $globals.AIContext);
  41480. $core.addMethod(
  41481. $core.method({
  41482. selector: "lookupContextForLocal:",
  41483. protocol: 'private',
  41484. fn: function (aString){
  41485. var self=this;
  41486. return $core.withContext(function($ctx1) {
  41487. return self._lookupContextForLocal_ifNone_(aString,(function(){
  41488. return $core.withContext(function($ctx2) {
  41489. return self._variableNotFound();
  41490. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41491. }));
  41492. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  41493. },
  41494. args: ["aString"],
  41495. 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 ]",
  41496. referencedClasses: [],
  41497. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  41498. }),
  41499. $globals.AIContext);
  41500. $core.addMethod(
  41501. $core.method({
  41502. selector: "lookupContextForLocal:ifNone:",
  41503. protocol: 'private',
  41504. fn: function (aString,aBlock){
  41505. var self=this;
  41506. return $core.withContext(function($ctx1) {
  41507. var $1;
  41508. return $recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  41509. return self;
  41510. }),(function(){
  41511. return $core.withContext(function($ctx2) {
  41512. $1=self._outerContext();
  41513. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  41514. return $core.withContext(function($ctx3) {
  41515. return $recv(context)._lookupContextForLocal_(aString);
  41516. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  41517. }));
  41518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41519. }));
  41520. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  41521. },
  41522. args: ["aString", "aBlock"],
  41523. 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 ] ]",
  41524. referencedClasses: [],
  41525. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  41526. }),
  41527. $globals.AIContext);
  41528. $core.addMethod(
  41529. $core.method({
  41530. selector: "newInnerContext",
  41531. protocol: 'factory',
  41532. fn: function (){
  41533. var self=this;
  41534. return $core.withContext(function($ctx1) {
  41535. var $1;
  41536. $1=$recv(self._class())._new();
  41537. $recv($1)._outerContext_(self);
  41538. return $recv($1)._yourself();
  41539. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  41540. },
  41541. args: [],
  41542. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  41543. referencedClasses: [],
  41544. messageSends: ["outerContext:", "new", "class", "yourself"]
  41545. }),
  41546. $globals.AIContext);
  41547. $core.addMethod(
  41548. $core.method({
  41549. selector: "outerContext",
  41550. protocol: 'accessing',
  41551. fn: function (){
  41552. var self=this;
  41553. return self["@outerContext"];
  41554. },
  41555. args: [],
  41556. source: "outerContext\x0a\x09^ outerContext",
  41557. referencedClasses: [],
  41558. messageSends: []
  41559. }),
  41560. $globals.AIContext);
  41561. $core.addMethod(
  41562. $core.method({
  41563. selector: "outerContext:",
  41564. protocol: 'accessing',
  41565. fn: function (anAIContext){
  41566. var self=this;
  41567. return $core.withContext(function($ctx1) {
  41568. var $1,$receiver;
  41569. self["@outerContext"]=anAIContext;
  41570. $1=self["@outerContext"];
  41571. if(($receiver = $1) == null || $receiver.isNil){
  41572. $1;
  41573. } else {
  41574. var context;
  41575. context=$receiver;
  41576. $recv(context)._innerContext_(self);
  41577. };
  41578. return self;
  41579. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  41580. },
  41581. args: ["anAIContext"],
  41582. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  41583. referencedClasses: [],
  41584. messageSends: ["ifNotNil:", "innerContext:"]
  41585. }),
  41586. $globals.AIContext);
  41587. $core.addMethod(
  41588. $core.method({
  41589. selector: "receiver:",
  41590. protocol: 'interpreting',
  41591. fn: function (anObject){
  41592. var self=this;
  41593. return $core.withContext(function($ctx1) {
  41594. $recv(self._locals())._at_put_("self",anObject);
  41595. return self;
  41596. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  41597. },
  41598. args: ["anObject"],
  41599. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  41600. referencedClasses: [],
  41601. messageSends: ["at:put:", "locals"]
  41602. }),
  41603. $globals.AIContext);
  41604. $core.addMethod(
  41605. $core.method({
  41606. selector: "selector",
  41607. protocol: 'accessing',
  41608. fn: function (){
  41609. var self=this;
  41610. return self["@selector"];
  41611. },
  41612. args: [],
  41613. source: "selector\x0a\x09^ selector",
  41614. referencedClasses: [],
  41615. messageSends: []
  41616. }),
  41617. $globals.AIContext);
  41618. $core.addMethod(
  41619. $core.method({
  41620. selector: "selector:",
  41621. protocol: 'accessing',
  41622. fn: function (aString){
  41623. var self=this;
  41624. self["@selector"]=aString;
  41625. return self;
  41626. },
  41627. args: ["aString"],
  41628. source: "selector: aString\x0a\x09selector := aString",
  41629. referencedClasses: [],
  41630. messageSends: []
  41631. }),
  41632. $globals.AIContext);
  41633. $core.addMethod(
  41634. $core.method({
  41635. selector: "sendIndexAt:",
  41636. protocol: 'accessing',
  41637. fn: function (aString){
  41638. var self=this;
  41639. return $core.withContext(function($ctx1) {
  41640. return $recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  41641. return (0);
  41642. }));
  41643. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  41644. },
  41645. args: ["aString"],
  41646. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  41647. referencedClasses: [],
  41648. messageSends: ["at:ifAbsent:", "sendIndexes"]
  41649. }),
  41650. $globals.AIContext);
  41651. $core.addMethod(
  41652. $core.method({
  41653. selector: "sendIndexes",
  41654. protocol: 'accessing',
  41655. fn: function (){
  41656. var self=this;
  41657. return $core.withContext(function($ctx1) {
  41658. var $1,$receiver;
  41659. $1=self["@sendIndexes"];
  41660. if(($receiver = $1) == null || $receiver.isNil){
  41661. return $recv($globals.Dictionary)._new();
  41662. } else {
  41663. return $1;
  41664. };
  41665. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  41666. },
  41667. args: [],
  41668. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  41669. referencedClasses: ["Dictionary"],
  41670. messageSends: ["ifNil:", "new"]
  41671. }),
  41672. $globals.AIContext);
  41673. $core.addMethod(
  41674. $core.method({
  41675. selector: "sendIndexes:",
  41676. protocol: 'accessing',
  41677. fn: function (aDictionary){
  41678. var self=this;
  41679. self["@sendIndexes"]=aDictionary;
  41680. return self;
  41681. },
  41682. args: ["aDictionary"],
  41683. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  41684. referencedClasses: [],
  41685. messageSends: []
  41686. }),
  41687. $globals.AIContext);
  41688. $core.addMethod(
  41689. $core.method({
  41690. selector: "setupInterpreter:",
  41691. protocol: 'interpreting',
  41692. fn: function (anInterpreter){
  41693. var self=this;
  41694. var currentNode;
  41695. return $core.withContext(function($ctx1) {
  41696. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  41697. $1=$recv($globals.ASTPCNodeVisitor)._new();
  41698. $2=self._evaluatedSelector();
  41699. $ctx1.sendIdx["evaluatedSelector"]=1;
  41700. $recv($1)._selector_($2);
  41701. $recv($1)._index_(self._sendIndexAt_(self._evaluatedSelector()));
  41702. $3=self._ast();
  41703. $ctx1.sendIdx["ast"]=1;
  41704. $recv($1)._visit_($3);
  41705. currentNode=$recv($1)._currentNode();
  41706. $4=$recv(self._ast())._sequenceNode();
  41707. if(($receiver = $4) == null || $receiver.isNil){
  41708. $4;
  41709. } else {
  41710. var sequence;
  41711. sequence=$receiver;
  41712. $recv($recv(sequence)._temps())._do_((function(each){
  41713. return $core.withContext(function($ctx2) {
  41714. return self._defineLocal_(each);
  41715. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41716. }));
  41717. $ctx1.sendIdx["do:"]=1;
  41718. };
  41719. $recv(anInterpreter)._node_(currentNode);
  41720. $7=self._innerContext();
  41721. $ctx1.sendIdx["innerContext"]=1;
  41722. $6=$recv($7)._arguments();
  41723. $5=$recv($6)._reversed();
  41724. $recv($5)._do_((function(each){
  41725. return $core.withContext(function($ctx2) {
  41726. return $recv(anInterpreter)._push_(each);
  41727. $ctx2.sendIdx["push:"]=1;
  41728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  41729. }));
  41730. $recv(anInterpreter)._push_($recv(self._innerContext())._receiver());
  41731. return self;
  41732. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  41733. },
  41734. args: ["anInterpreter"],
  41735. 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)",
  41736. referencedClasses: ["ASTPCNodeVisitor"],
  41737. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  41738. }),
  41739. $globals.AIContext);
  41740. $core.addMethod(
  41741. $core.method({
  41742. selector: "supercall",
  41743. protocol: 'interpreting',
  41744. fn: function (){
  41745. var self=this;
  41746. return $core.withContext(function($ctx1) {
  41747. var $1,$receiver;
  41748. $1=self["@supercall"];
  41749. if(($receiver = $1) == null || $receiver.isNil){
  41750. return false;
  41751. } else {
  41752. return $1;
  41753. };
  41754. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  41755. },
  41756. args: [],
  41757. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  41758. referencedClasses: [],
  41759. messageSends: ["ifNil:"]
  41760. }),
  41761. $globals.AIContext);
  41762. $core.addMethod(
  41763. $core.method({
  41764. selector: "supercall:",
  41765. protocol: 'interpreting',
  41766. fn: function (aBoolean){
  41767. var self=this;
  41768. self["@supercall"]=aBoolean;
  41769. return self;
  41770. },
  41771. args: ["aBoolean"],
  41772. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  41773. referencedClasses: [],
  41774. messageSends: []
  41775. }),
  41776. $globals.AIContext);
  41777. $core.addMethod(
  41778. $core.method({
  41779. selector: "variableNotFound",
  41780. protocol: 'error handling',
  41781. fn: function (){
  41782. var self=this;
  41783. return $core.withContext(function($ctx1) {
  41784. self._error_("Variable missing");
  41785. return self;
  41786. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  41787. },
  41788. args: [],
  41789. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  41790. referencedClasses: [],
  41791. messageSends: ["error:"]
  41792. }),
  41793. $globals.AIContext);
  41794. $core.addMethod(
  41795. $core.method({
  41796. selector: "fromMethodContext:",
  41797. protocol: 'instance creation',
  41798. fn: function (aMethodContext){
  41799. var self=this;
  41800. return $core.withContext(function($ctx1) {
  41801. var $1;
  41802. $1=self._new();
  41803. $recv($1)._initializeFromMethodContext_(aMethodContext);
  41804. return $recv($1)._yourself();
  41805. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)});
  41806. },
  41807. args: ["aMethodContext"],
  41808. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  41809. referencedClasses: [],
  41810. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  41811. }),
  41812. $globals.AIContext.klass);
  41813. $core.addClass('AISemanticAnalyzer', $globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
  41814. $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.";
  41815. $core.addMethod(
  41816. $core.method({
  41817. selector: "context",
  41818. protocol: 'accessing',
  41819. fn: function (){
  41820. var self=this;
  41821. return self["@context"];
  41822. },
  41823. args: [],
  41824. source: "context\x0a\x09^ context",
  41825. referencedClasses: [],
  41826. messageSends: []
  41827. }),
  41828. $globals.AISemanticAnalyzer);
  41829. $core.addMethod(
  41830. $core.method({
  41831. selector: "context:",
  41832. protocol: 'accessing',
  41833. fn: function (anAIContext){
  41834. var self=this;
  41835. self["@context"]=anAIContext;
  41836. return self;
  41837. },
  41838. args: ["anAIContext"],
  41839. source: "context: anAIContext\x0a\x09context := anAIContext",
  41840. referencedClasses: [],
  41841. messageSends: []
  41842. }),
  41843. $globals.AISemanticAnalyzer);
  41844. $core.addMethod(
  41845. $core.method({
  41846. selector: "visitVariableNode:",
  41847. protocol: 'visiting',
  41848. fn: function (aNode){
  41849. var self=this;
  41850. return $core.withContext(function($ctx1) {
  41851. var $1;
  41852. var $early={};
  41853. try {
  41854. $recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  41855. return $core.withContext(function($ctx2) {
  41856. $1=(
  41857. $ctx2.supercall = true,
  41858. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($recv(self), [aNode]));
  41859. $ctx2.supercall = false;
  41860. throw $early=[$1];
  41861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41862. }));
  41863. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  41864. return self;
  41865. }
  41866. catch(e) {if(e===$early)return e[0]; throw e}
  41867. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  41868. },
  41869. args: ["aNode"],
  41870. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  41871. referencedClasses: ["ASTContextVar"],
  41872. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  41873. }),
  41874. $globals.AISemanticAnalyzer);
  41875. $core.addClass('ASTContextVar', $globals.ScopeVar, ['context'], 'Compiler-Interpreter');
  41876. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  41877. $core.addMethod(
  41878. $core.method({
  41879. selector: "context",
  41880. protocol: 'accessing',
  41881. fn: function (){
  41882. var self=this;
  41883. return self["@context"];
  41884. },
  41885. args: [],
  41886. source: "context\x0a\x09^ context",
  41887. referencedClasses: [],
  41888. messageSends: []
  41889. }),
  41890. $globals.ASTContextVar);
  41891. $core.addMethod(
  41892. $core.method({
  41893. selector: "context:",
  41894. protocol: 'accessing',
  41895. fn: function (anObject){
  41896. var self=this;
  41897. self["@context"]=anObject;
  41898. return self;
  41899. },
  41900. args: ["anObject"],
  41901. source: "context: anObject\x0a\x09context := anObject",
  41902. referencedClasses: [],
  41903. messageSends: []
  41904. }),
  41905. $globals.ASTContextVar);
  41906. $core.addClass('ASTDebugger', $globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
  41907. $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.";
  41908. $core.addMethod(
  41909. $core.method({
  41910. selector: "atEnd",
  41911. protocol: 'testing',
  41912. fn: function (){
  41913. var self=this;
  41914. return $core.withContext(function($ctx1) {
  41915. var $1,$receiver;
  41916. $1=self._context();
  41917. $ctx1.sendIdx["context"]=1;
  41918. if(($receiver = $1) == null || $receiver.isNil){
  41919. return true;
  41920. } else {
  41921. $1;
  41922. };
  41923. return $recv($recv(self._interpreter())._atEnd())._and_((function(){
  41924. return $core.withContext(function($ctx2) {
  41925. return $recv(self._context())._isTopContext();
  41926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41927. }));
  41928. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  41929. },
  41930. args: [],
  41931. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  41932. referencedClasses: [],
  41933. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  41934. }),
  41935. $globals.ASTDebugger);
  41936. $core.addMethod(
  41937. $core.method({
  41938. selector: "context",
  41939. protocol: 'accessing',
  41940. fn: function (){
  41941. var self=this;
  41942. return self["@context"];
  41943. },
  41944. args: [],
  41945. source: "context\x0a\x09^ context",
  41946. referencedClasses: [],
  41947. messageSends: []
  41948. }),
  41949. $globals.ASTDebugger);
  41950. $core.addMethod(
  41951. $core.method({
  41952. selector: "context:",
  41953. protocol: 'accessing',
  41954. fn: function (aContext){
  41955. var self=this;
  41956. self["@context"]=aContext;
  41957. return self;
  41958. },
  41959. args: ["aContext"],
  41960. source: "context: aContext\x0a\x09context := aContext",
  41961. referencedClasses: [],
  41962. messageSends: []
  41963. }),
  41964. $globals.ASTDebugger);
  41965. $core.addMethod(
  41966. $core.method({
  41967. selector: "flushInnerContexts",
  41968. protocol: 'actions',
  41969. fn: function (){
  41970. var self=this;
  41971. return $core.withContext(function($ctx1) {
  41972. var $1,$receiver;
  41973. $1=self._context();
  41974. if(($receiver = $1) == null || $receiver.isNil){
  41975. $1;
  41976. } else {
  41977. var cxt;
  41978. cxt=$receiver;
  41979. $recv(cxt)._innerContext_(nil);
  41980. };
  41981. return self;
  41982. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  41983. },
  41984. args: [],
  41985. 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 ]",
  41986. referencedClasses: [],
  41987. messageSends: ["ifNotNil:", "context", "innerContext:"]
  41988. }),
  41989. $globals.ASTDebugger);
  41990. $core.addMethod(
  41991. $core.method({
  41992. selector: "interpreter",
  41993. protocol: 'accessing',
  41994. fn: function (){
  41995. var self=this;
  41996. return $core.withContext(function($ctx1) {
  41997. var $1,$receiver;
  41998. $1=self._context();
  41999. if(($receiver = $1) == null || $receiver.isNil){
  42000. return $1;
  42001. } else {
  42002. var ctx;
  42003. ctx=$receiver;
  42004. return $recv(ctx)._interpreter();
  42005. };
  42006. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  42007. },
  42008. args: [],
  42009. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  42010. referencedClasses: [],
  42011. messageSends: ["ifNotNil:", "context", "interpreter"]
  42012. }),
  42013. $globals.ASTDebugger);
  42014. $core.addMethod(
  42015. $core.method({
  42016. selector: "method",
  42017. protocol: 'accessing',
  42018. fn: function (){
  42019. var self=this;
  42020. return $core.withContext(function($ctx1) {
  42021. return $recv(self._context())._method();
  42022. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  42023. },
  42024. args: [],
  42025. source: "method\x0a\x09^ self context method",
  42026. referencedClasses: [],
  42027. messageSends: ["method", "context"]
  42028. }),
  42029. $globals.ASTDebugger);
  42030. $core.addMethod(
  42031. $core.method({
  42032. selector: "node",
  42033. protocol: 'accessing',
  42034. fn: function (){
  42035. var self=this;
  42036. return $core.withContext(function($ctx1) {
  42037. var $1,$receiver;
  42038. $1=self._interpreter();
  42039. $ctx1.sendIdx["interpreter"]=1;
  42040. if(($receiver = $1) == null || $receiver.isNil){
  42041. return $1;
  42042. } else {
  42043. return $recv(self._interpreter())._node();
  42044. };
  42045. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  42046. },
  42047. args: [],
  42048. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  42049. referencedClasses: [],
  42050. messageSends: ["ifNotNil:", "interpreter", "node"]
  42051. }),
  42052. $globals.ASTDebugger);
  42053. $core.addMethod(
  42054. $core.method({
  42055. selector: "onStep",
  42056. protocol: 'private',
  42057. fn: function (){
  42058. var self=this;
  42059. return $core.withContext(function($ctx1) {
  42060. var $1,$3,$2,$4,$6,$5,$receiver;
  42061. $1=self._interpreter();
  42062. $ctx1.sendIdx["interpreter"]=1;
  42063. self["@result"]=$recv($1)._result();
  42064. $3=self._interpreter();
  42065. $ctx1.sendIdx["interpreter"]=2;
  42066. $2=$recv($3)._atEnd();
  42067. $ctx1.sendIdx["atEnd"]=1;
  42068. if($core.assert($2)){
  42069. $4=$recv(self._context())._outerContext();
  42070. if(($receiver = $4) == null || $receiver.isNil){
  42071. $4;
  42072. } else {
  42073. var outerContext;
  42074. outerContext=$receiver;
  42075. self._context_(outerContext);
  42076. };
  42077. $6=self._interpreter();
  42078. $ctx1.sendIdx["interpreter"]=3;
  42079. $5=$recv($6)._atEnd();
  42080. if(!$core.assert($5)){
  42081. $recv(self._interpreter())._skip();
  42082. };
  42083. };
  42084. self._flushInnerContexts();
  42085. return self;
  42086. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  42087. },
  42088. args: [],
  42089. 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",
  42090. referencedClasses: [],
  42091. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  42092. }),
  42093. $globals.ASTDebugger);
  42094. $core.addMethod(
  42095. $core.method({
  42096. selector: "proceed",
  42097. protocol: 'stepping',
  42098. fn: function (){
  42099. var self=this;
  42100. return $core.withContext(function($ctx1) {
  42101. $recv((function(){
  42102. return $core.withContext(function($ctx2) {
  42103. return self._atEnd();
  42104. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42105. }))._whileFalse_((function(){
  42106. return $core.withContext(function($ctx2) {
  42107. return self._stepOver();
  42108. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42109. }));
  42110. return self;
  42111. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  42112. },
  42113. args: [],
  42114. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  42115. referencedClasses: [],
  42116. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  42117. }),
  42118. $globals.ASTDebugger);
  42119. $core.addMethod(
  42120. $core.method({
  42121. selector: "restart",
  42122. protocol: 'stepping',
  42123. fn: function (){
  42124. var self=this;
  42125. return $core.withContext(function($ctx1) {
  42126. $recv(self._interpreter())._restart();
  42127. self._flushInnerContexts();
  42128. return self;
  42129. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  42130. },
  42131. args: [],
  42132. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  42133. referencedClasses: [],
  42134. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  42135. }),
  42136. $globals.ASTDebugger);
  42137. $core.addMethod(
  42138. $core.method({
  42139. selector: "result",
  42140. protocol: 'accessing',
  42141. fn: function (){
  42142. var self=this;
  42143. return self["@result"];
  42144. },
  42145. args: [],
  42146. source: "result\x0a\x09^ result",
  42147. referencedClasses: [],
  42148. messageSends: []
  42149. }),
  42150. $globals.ASTDebugger);
  42151. $core.addMethod(
  42152. $core.method({
  42153. selector: "stepInto",
  42154. protocol: 'stepping',
  42155. fn: function (){
  42156. var self=this;
  42157. return $core.withContext(function($ctx1) {
  42158. self._shouldBeImplemented();
  42159. return self;
  42160. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  42161. },
  42162. args: [],
  42163. source: "stepInto\x0a\x09self shouldBeImplemented",
  42164. referencedClasses: [],
  42165. messageSends: ["shouldBeImplemented"]
  42166. }),
  42167. $globals.ASTDebugger);
  42168. $core.addMethod(
  42169. $core.method({
  42170. selector: "stepOver",
  42171. protocol: 'stepping',
  42172. fn: function (){
  42173. var self=this;
  42174. return $core.withContext(function($ctx1) {
  42175. var $1,$2;
  42176. $1=$recv(self._context())._isTopContext();
  42177. if($core.assert($1)){
  42178. $recv(self._interpreter())._stepOver();
  42179. } else {
  42180. $2=self._interpreter();
  42181. $ctx1.sendIdx["interpreter"]=1;
  42182. $recv($2)._skip();
  42183. };
  42184. self._onStep();
  42185. return self;
  42186. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  42187. },
  42188. args: [],
  42189. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  42190. referencedClasses: [],
  42191. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  42192. }),
  42193. $globals.ASTDebugger);
  42194. $core.addMethod(
  42195. $core.method({
  42196. selector: "context:",
  42197. protocol: 'instance creation',
  42198. fn: function (aContext){
  42199. var self=this;
  42200. return $core.withContext(function($ctx1) {
  42201. var $1;
  42202. $1=self._new();
  42203. $recv($1)._context_(aContext);
  42204. return $recv($1)._yourself();
  42205. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)});
  42206. },
  42207. args: ["aContext"],
  42208. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  42209. referencedClasses: [],
  42210. messageSends: ["context:", "new", "yourself"]
  42211. }),
  42212. $globals.ASTDebugger.klass);
  42213. $core.addClass('ASTEnterNode', $globals.NodeVisitor, ['interpreter'], 'Compiler-Interpreter');
  42214. $core.addMethod(
  42215. $core.method({
  42216. selector: "interpreter",
  42217. protocol: 'accessing',
  42218. fn: function (){
  42219. var self=this;
  42220. return self["@interpreter"];
  42221. },
  42222. args: [],
  42223. source: "interpreter\x0a\x09^ interpreter",
  42224. referencedClasses: [],
  42225. messageSends: []
  42226. }),
  42227. $globals.ASTEnterNode);
  42228. $core.addMethod(
  42229. $core.method({
  42230. selector: "interpreter:",
  42231. protocol: 'accessing',
  42232. fn: function (anObject){
  42233. var self=this;
  42234. self["@interpreter"]=anObject;
  42235. return self;
  42236. },
  42237. args: ["anObject"],
  42238. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  42239. referencedClasses: [],
  42240. messageSends: []
  42241. }),
  42242. $globals.ASTEnterNode);
  42243. $core.addMethod(
  42244. $core.method({
  42245. selector: "visitBlockNode:",
  42246. protocol: 'visiting',
  42247. fn: function (aNode){
  42248. var self=this;
  42249. return aNode;
  42250. },
  42251. args: ["aNode"],
  42252. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  42253. referencedClasses: [],
  42254. messageSends: []
  42255. }),
  42256. $globals.ASTEnterNode);
  42257. $core.addMethod(
  42258. $core.method({
  42259. selector: "visitDagNode:",
  42260. protocol: 'visiting',
  42261. fn: function (aNode){
  42262. var self=this;
  42263. return $core.withContext(function($ctx1) {
  42264. var $early={};
  42265. try {
  42266. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  42267. throw $early=[aNode];
  42268. }),(function(nodes){
  42269. return $core.withContext(function($ctx2) {
  42270. throw $early=[self._visit_($recv(nodes)._first())];
  42271. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  42272. }));
  42273. return self;
  42274. }
  42275. catch(e) {if(e===$early)return e[0]; throw e}
  42276. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  42277. },
  42278. args: ["aNode"],
  42279. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  42280. referencedClasses: [],
  42281. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  42282. }),
  42283. $globals.ASTEnterNode);
  42284. $core.addMethod(
  42285. $core.method({
  42286. selector: "visitSequenceNode:",
  42287. protocol: 'visiting',
  42288. fn: function (aNode){
  42289. var self=this;
  42290. return $core.withContext(function($ctx1) {
  42291. var $1;
  42292. $recv($recv(aNode)._temps())._do_((function(each){
  42293. return $core.withContext(function($ctx2) {
  42294. return $recv($recv(self._interpreter())._context())._defineLocal_(each);
  42295. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42296. }));
  42297. $1=(
  42298. $ctx1.supercall = true,
  42299. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  42300. $ctx1.supercall = false;
  42301. return $1;
  42302. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  42303. },
  42304. args: ["aNode"],
  42305. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  42306. referencedClasses: [],
  42307. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  42308. }),
  42309. $globals.ASTEnterNode);
  42310. $core.addMethod(
  42311. $core.method({
  42312. selector: "on:",
  42313. protocol: 'instance creation',
  42314. fn: function (anInterpreter){
  42315. var self=this;
  42316. return $core.withContext(function($ctx1) {
  42317. var $1;
  42318. $1=self._new();
  42319. $recv($1)._interpreter_(anInterpreter);
  42320. return $recv($1)._yourself();
  42321. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.klass)});
  42322. },
  42323. args: ["anInterpreter"],
  42324. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  42325. referencedClasses: [],
  42326. messageSends: ["interpreter:", "new", "yourself"]
  42327. }),
  42328. $globals.ASTEnterNode.klass);
  42329. $core.addClass('ASTInterpreter', $globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
  42330. $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";
  42331. $core.addMethod(
  42332. $core.method({
  42333. selector: "assign:to:",
  42334. protocol: 'private',
  42335. fn: function (aNode,anObject){
  42336. var self=this;
  42337. return $core.withContext(function($ctx1) {
  42338. var $1,$3,$2,$4;
  42339. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  42340. if($core.assert($1)){
  42341. $3=self._context();
  42342. $ctx1.sendIdx["context"]=1;
  42343. $2=$recv($3)._receiver();
  42344. $4=$recv(aNode)._value();
  42345. $ctx1.sendIdx["value"]=1;
  42346. $recv($2)._instVarAt_put_($4,anObject);
  42347. } else {
  42348. $recv(self._context())._localAt_put_($recv(aNode)._value(),anObject);
  42349. };
  42350. return self;
  42351. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  42352. },
  42353. args: ["aNode", "anObject"],
  42354. 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 ]",
  42355. referencedClasses: [],
  42356. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  42357. }),
  42358. $globals.ASTInterpreter);
  42359. $core.addMethod(
  42360. $core.method({
  42361. selector: "atEnd",
  42362. protocol: 'testing',
  42363. fn: function (){
  42364. var self=this;
  42365. return $core.withContext(function($ctx1) {
  42366. var $1;
  42367. $1=self["@forceAtEnd"];
  42368. if($core.assert($1)){
  42369. return true;
  42370. };
  42371. return $recv(self._hasReturned())._or_((function(){
  42372. return $core.withContext(function($ctx2) {
  42373. return $recv(self._node())._isNil();
  42374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42375. }));
  42376. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  42377. },
  42378. args: [],
  42379. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  42380. referencedClasses: [],
  42381. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  42382. }),
  42383. $globals.ASTInterpreter);
  42384. $core.addMethod(
  42385. $core.method({
  42386. selector: "context",
  42387. protocol: 'accessing',
  42388. fn: function (){
  42389. var self=this;
  42390. return self["@context"];
  42391. },
  42392. args: [],
  42393. source: "context\x0a\x09^ context",
  42394. referencedClasses: [],
  42395. messageSends: []
  42396. }),
  42397. $globals.ASTInterpreter);
  42398. $core.addMethod(
  42399. $core.method({
  42400. selector: "context:",
  42401. protocol: 'accessing',
  42402. fn: function (aContext){
  42403. var self=this;
  42404. self["@context"]=aContext;
  42405. return self;
  42406. },
  42407. args: ["aContext"],
  42408. source: "context: aContext\x0a\x09context := aContext",
  42409. referencedClasses: [],
  42410. messageSends: []
  42411. }),
  42412. $globals.ASTInterpreter);
  42413. $core.addMethod(
  42414. $core.method({
  42415. selector: "enterNode",
  42416. protocol: 'interpreting',
  42417. fn: function (){
  42418. var self=this;
  42419. return $core.withContext(function($ctx1) {
  42420. self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_(self._node()));
  42421. return self;
  42422. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  42423. },
  42424. args: [],
  42425. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  42426. referencedClasses: ["ASTEnterNode"],
  42427. messageSends: ["node:", "visit:", "on:", "node"]
  42428. }),
  42429. $globals.ASTInterpreter);
  42430. $core.addMethod(
  42431. $core.method({
  42432. selector: "eval:",
  42433. protocol: 'private',
  42434. fn: function (aString){
  42435. var self=this;
  42436. var source,function_;
  42437. return $core.withContext(function($ctx1) {
  42438. var $3,$2,$1;
  42439. source=$recv($globals.String)._streamContents_((function(str){
  42440. return $core.withContext(function($ctx2) {
  42441. $recv(str)._nextPutAll_("0,(function(");
  42442. $ctx2.sendIdx["nextPutAll:"]=1;
  42443. $3=self._context();
  42444. $ctx2.sendIdx["context"]=1;
  42445. $2=$recv($3)._locals();
  42446. $ctx2.sendIdx["locals"]=1;
  42447. $1=$recv($2)._keys();
  42448. $recv($1)._do_separatedBy_((function(each){
  42449. return $core.withContext(function($ctx3) {
  42450. return $recv(str)._nextPutAll_(each);
  42451. $ctx3.sendIdx["nextPutAll:"]=2;
  42452. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42453. }),(function(){
  42454. return $core.withContext(function($ctx3) {
  42455. return $recv(str)._nextPutAll_(",");
  42456. $ctx3.sendIdx["nextPutAll:"]=3;
  42457. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42458. }));
  42459. $recv(str)._nextPutAll_("){ return (function() {");
  42460. $ctx2.sendIdx["nextPutAll:"]=4;
  42461. $recv(str)._nextPutAll_(aString);
  42462. $ctx2.sendIdx["nextPutAll:"]=5;
  42463. return $recv(str)._nextPutAll_("})()})");
  42464. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  42465. }));
  42466. function_=$recv($recv($globals.Compiler)._new())._eval_(source);
  42467. return $recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values());
  42468. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  42469. },
  42470. args: ["aString"],
  42471. 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 new eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values",
  42472. referencedClasses: ["String", "Compiler"],
  42473. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  42474. }),
  42475. $globals.ASTInterpreter);
  42476. $core.addMethod(
  42477. $core.method({
  42478. selector: "hasReturned",
  42479. protocol: 'testing',
  42480. fn: function (){
  42481. var self=this;
  42482. return $core.withContext(function($ctx1) {
  42483. var $1,$receiver;
  42484. $1=self["@returned"];
  42485. if(($receiver = $1) == null || $receiver.isNil){
  42486. return false;
  42487. } else {
  42488. return $1;
  42489. };
  42490. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  42491. },
  42492. args: [],
  42493. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  42494. referencedClasses: [],
  42495. messageSends: ["ifNil:"]
  42496. }),
  42497. $globals.ASTInterpreter);
  42498. $core.addMethod(
  42499. $core.method({
  42500. selector: "initialize",
  42501. protocol: 'initialization',
  42502. fn: function (){
  42503. var self=this;
  42504. return $core.withContext(function($ctx1) {
  42505. (
  42506. $ctx1.supercall = true,
  42507. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  42508. $ctx1.supercall = false;
  42509. self["@forceAtEnd"]=false;
  42510. return self;
  42511. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  42512. },
  42513. args: [],
  42514. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  42515. referencedClasses: [],
  42516. messageSends: ["initialize"]
  42517. }),
  42518. $globals.ASTInterpreter);
  42519. $core.addMethod(
  42520. $core.method({
  42521. selector: "interpret",
  42522. protocol: 'interpreting',
  42523. fn: function (){
  42524. var self=this;
  42525. return $core.withContext(function($ctx1) {
  42526. self._visit_(self._node());
  42527. return self;
  42528. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  42529. },
  42530. args: [],
  42531. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  42532. referencedClasses: [],
  42533. messageSends: ["visit:", "node"]
  42534. }),
  42535. $globals.ASTInterpreter);
  42536. $core.addMethod(
  42537. $core.method({
  42538. selector: "messageFromSendNode:arguments:",
  42539. protocol: 'private',
  42540. fn: function (aSendNode,aCollection){
  42541. var self=this;
  42542. return $core.withContext(function($ctx1) {
  42543. var $1;
  42544. $1=$recv($globals.Message)._new();
  42545. $recv($1)._selector_($recv(aSendNode)._selector());
  42546. $recv($1)._arguments_(aCollection);
  42547. return $recv($1)._yourself();
  42548. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  42549. },
  42550. args: ["aSendNode", "aCollection"],
  42551. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  42552. referencedClasses: ["Message"],
  42553. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  42554. }),
  42555. $globals.ASTInterpreter);
  42556. $core.addMethod(
  42557. $core.method({
  42558. selector: "messageNotUnderstood:receiver:",
  42559. protocol: 'private',
  42560. fn: function (aMessage,anObject){
  42561. var self=this;
  42562. return $core.withContext(function($ctx1) {
  42563. var $1;
  42564. $1=$recv($globals.MessageNotUnderstood)._new();
  42565. $recv($1)._message_(aMessage);
  42566. $recv($1)._receiver_(anObject);
  42567. $recv($1)._signal();
  42568. return self;
  42569. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  42570. },
  42571. args: ["aMessage", "anObject"],
  42572. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  42573. referencedClasses: ["MessageNotUnderstood"],
  42574. messageSends: ["message:", "new", "receiver:", "signal"]
  42575. }),
  42576. $globals.ASTInterpreter);
  42577. $core.addMethod(
  42578. $core.method({
  42579. selector: "next",
  42580. protocol: 'interpreting',
  42581. fn: function (){
  42582. var self=this;
  42583. var nd,nextNode;
  42584. return $core.withContext(function($ctx1) {
  42585. var $1,$2,$receiver;
  42586. nd=self._node();
  42587. $1=$recv(nd)._parent();
  42588. if(($receiver = $1) == null || $receiver.isNil){
  42589. nextNode=$1;
  42590. } else {
  42591. var parent;
  42592. parent=$receiver;
  42593. $2=$recv(parent)._nextSiblingNode_(nd);
  42594. if(($receiver = $2) == null || $receiver.isNil){
  42595. nextNode=parent;
  42596. } else {
  42597. var sibling;
  42598. sibling=$receiver;
  42599. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  42600. };
  42601. };
  42602. self._node_(nextNode);
  42603. return self;
  42604. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  42605. },
  42606. args: [],
  42607. 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",
  42608. referencedClasses: ["ASTEnterNode"],
  42609. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  42610. }),
  42611. $globals.ASTInterpreter);
  42612. $core.addMethod(
  42613. $core.method({
  42614. selector: "node",
  42615. protocol: 'accessing',
  42616. fn: function (){
  42617. var self=this;
  42618. return self["@node"];
  42619. },
  42620. args: [],
  42621. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  42622. referencedClasses: [],
  42623. messageSends: []
  42624. }),
  42625. $globals.ASTInterpreter);
  42626. $core.addMethod(
  42627. $core.method({
  42628. selector: "node:",
  42629. protocol: 'accessing',
  42630. fn: function (aNode){
  42631. var self=this;
  42632. self["@node"]=aNode;
  42633. return self;
  42634. },
  42635. args: ["aNode"],
  42636. source: "node: aNode\x0a\x09node := aNode",
  42637. referencedClasses: [],
  42638. messageSends: []
  42639. }),
  42640. $globals.ASTInterpreter);
  42641. $core.addMethod(
  42642. $core.method({
  42643. selector: "peek",
  42644. protocol: 'stack',
  42645. fn: function (){
  42646. var self=this;
  42647. return $core.withContext(function($ctx1) {
  42648. var $1;
  42649. var $early={};
  42650. try {
  42651. $1=self._stack();
  42652. $ctx1.sendIdx["stack"]=1;
  42653. $recv($1)._ifEmpty_((function(){
  42654. throw $early=[nil];
  42655. }));
  42656. return $recv(self._stack())._last();
  42657. }
  42658. catch(e) {if(e===$early)return e[0]; throw e}
  42659. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  42660. },
  42661. args: [],
  42662. 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",
  42663. referencedClasses: [],
  42664. messageSends: ["ifEmpty:", "stack", "last"]
  42665. }),
  42666. $globals.ASTInterpreter);
  42667. $core.addMethod(
  42668. $core.method({
  42669. selector: "pop",
  42670. protocol: 'stack',
  42671. fn: function (){
  42672. var self=this;
  42673. var peekedValue;
  42674. return $core.withContext(function($ctx1) {
  42675. peekedValue=self._peek();
  42676. $recv(self._stack())._removeLast();
  42677. return peekedValue;
  42678. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  42679. },
  42680. args: [],
  42681. 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",
  42682. referencedClasses: [],
  42683. messageSends: ["peek", "removeLast", "stack"]
  42684. }),
  42685. $globals.ASTInterpreter);
  42686. $core.addMethod(
  42687. $core.method({
  42688. selector: "proceed",
  42689. protocol: 'interpreting',
  42690. fn: function (){
  42691. var self=this;
  42692. return $core.withContext(function($ctx1) {
  42693. $recv((function(){
  42694. return $core.withContext(function($ctx2) {
  42695. return self._atEnd();
  42696. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42697. }))._whileFalse_((function(){
  42698. return $core.withContext(function($ctx2) {
  42699. return self._step();
  42700. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42701. }));
  42702. return self;
  42703. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  42704. },
  42705. args: [],
  42706. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  42707. referencedClasses: [],
  42708. messageSends: ["whileFalse:", "atEnd", "step"]
  42709. }),
  42710. $globals.ASTInterpreter);
  42711. $core.addMethod(
  42712. $core.method({
  42713. selector: "push:",
  42714. protocol: 'stack',
  42715. fn: function (anObject){
  42716. var self=this;
  42717. return $core.withContext(function($ctx1) {
  42718. return $recv(self._stack())._add_(anObject);
  42719. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  42720. },
  42721. args: ["anObject"],
  42722. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  42723. referencedClasses: [],
  42724. messageSends: ["add:", "stack"]
  42725. }),
  42726. $globals.ASTInterpreter);
  42727. $core.addMethod(
  42728. $core.method({
  42729. selector: "restart",
  42730. protocol: 'interpreting',
  42731. fn: function (){
  42732. var self=this;
  42733. return $core.withContext(function($ctx1) {
  42734. self._node_($recv(self._context())._ast());
  42735. self._enterNode();
  42736. return self;
  42737. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  42738. },
  42739. args: [],
  42740. source: "restart\x0a\x09self node: self context ast; enterNode",
  42741. referencedClasses: [],
  42742. messageSends: ["node:", "ast", "context", "enterNode"]
  42743. }),
  42744. $globals.ASTInterpreter);
  42745. $core.addMethod(
  42746. $core.method({
  42747. selector: "result",
  42748. protocol: 'accessing',
  42749. fn: function (){
  42750. var self=this;
  42751. return $core.withContext(function($ctx1) {
  42752. var $1;
  42753. $1=self._hasReturned();
  42754. if($core.assert($1)){
  42755. return self._returnValue();
  42756. } else {
  42757. return $recv(self._context())._receiver();
  42758. };
  42759. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  42760. },
  42761. args: [],
  42762. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  42763. referencedClasses: [],
  42764. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  42765. }),
  42766. $globals.ASTInterpreter);
  42767. $core.addMethod(
  42768. $core.method({
  42769. selector: "returnValue",
  42770. protocol: 'accessing',
  42771. fn: function (){
  42772. var self=this;
  42773. return self["@returnValue"];
  42774. },
  42775. args: [],
  42776. source: "returnValue\x0a\x09^ returnValue",
  42777. referencedClasses: [],
  42778. messageSends: []
  42779. }),
  42780. $globals.ASTInterpreter);
  42781. $core.addMethod(
  42782. $core.method({
  42783. selector: "returnValue:",
  42784. protocol: 'accessing',
  42785. fn: function (anObject){
  42786. var self=this;
  42787. self["@returnValue"]=anObject;
  42788. return self;
  42789. },
  42790. args: ["anObject"],
  42791. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  42792. referencedClasses: [],
  42793. messageSends: []
  42794. }),
  42795. $globals.ASTInterpreter);
  42796. $core.addMethod(
  42797. $core.method({
  42798. selector: "sendMessage:to:superSend:",
  42799. protocol: 'private',
  42800. fn: function (aMessage,anObject,aBoolean){
  42801. var self=this;
  42802. var method;
  42803. return $core.withContext(function($ctx1) {
  42804. var $2,$1,$3,$receiver;
  42805. var $early={};
  42806. try {
  42807. if(!$core.assert(aBoolean)){
  42808. return $recv(aMessage)._sendTo_(anObject);
  42809. };
  42810. $2=$recv(anObject)._class();
  42811. $ctx1.sendIdx["class"]=1;
  42812. $1=$recv($2)._superclass();
  42813. $ctx1.sendIdx["superclass"]=1;
  42814. if(($receiver = $1) == null || $receiver.isNil){
  42815. $3=self._messageNotUnderstood_receiver_(aMessage,anObject);
  42816. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  42817. return $3;
  42818. } else {
  42819. $1;
  42820. };
  42821. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  42822. return $core.withContext(function($ctx2) {
  42823. throw $early=[self._messageNotUnderstood_receiver_(aMessage,anObject)];
  42824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42825. }));
  42826. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  42827. }
  42828. catch(e) {if(e===$early)return e[0]; throw e}
  42829. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  42830. },
  42831. args: ["aMessage", "anObject", "aBoolean"],
  42832. 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",
  42833. referencedClasses: [],
  42834. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  42835. }),
  42836. $globals.ASTInterpreter);
  42837. $core.addMethod(
  42838. $core.method({
  42839. selector: "setNonLocalReturnFromContext:",
  42840. protocol: 'interpreting',
  42841. fn: function (aContext){
  42842. var self=this;
  42843. return $core.withContext(function($ctx1) {
  42844. var $2,$1;
  42845. $2=$recv(aContext)._interpreter();
  42846. $ctx1.sendIdx["interpreter"]=1;
  42847. $1=$recv($2)._hasReturned();
  42848. if($core.assert($1)){
  42849. self["@returned"]=true;
  42850. self["@returned"];
  42851. self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  42852. };
  42853. return self;
  42854. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  42855. },
  42856. args: ["aContext"],
  42857. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  42858. referencedClasses: [],
  42859. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  42860. }),
  42861. $globals.ASTInterpreter);
  42862. $core.addMethod(
  42863. $core.method({
  42864. selector: "skip",
  42865. protocol: 'interpreting',
  42866. fn: function (){
  42867. var self=this;
  42868. return $core.withContext(function($ctx1) {
  42869. self._next();
  42870. return self;
  42871. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  42872. },
  42873. args: [],
  42874. source: "skip\x0a\x09self next",
  42875. referencedClasses: [],
  42876. messageSends: ["next"]
  42877. }),
  42878. $globals.ASTInterpreter);
  42879. $core.addMethod(
  42880. $core.method({
  42881. selector: "stack",
  42882. protocol: 'accessing',
  42883. fn: function (){
  42884. var self=this;
  42885. return $core.withContext(function($ctx1) {
  42886. var $1,$receiver;
  42887. $1=self["@stack"];
  42888. if(($receiver = $1) == null || $receiver.isNil){
  42889. self["@stack"]=$recv($globals.OrderedCollection)._new();
  42890. return self["@stack"];
  42891. } else {
  42892. return $1;
  42893. };
  42894. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  42895. },
  42896. args: [],
  42897. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  42898. referencedClasses: ["OrderedCollection"],
  42899. messageSends: ["ifNil:", "new"]
  42900. }),
  42901. $globals.ASTInterpreter);
  42902. $core.addMethod(
  42903. $core.method({
  42904. selector: "step",
  42905. protocol: 'interpreting',
  42906. fn: function (){
  42907. var self=this;
  42908. return $core.withContext(function($ctx1) {
  42909. self._interpret();
  42910. self._next();
  42911. return self;
  42912. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  42913. },
  42914. args: [],
  42915. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  42916. referencedClasses: [],
  42917. messageSends: ["interpret", "next"]
  42918. }),
  42919. $globals.ASTInterpreter);
  42920. $core.addMethod(
  42921. $core.method({
  42922. selector: "stepOver",
  42923. protocol: 'interpreting',
  42924. fn: function (){
  42925. var self=this;
  42926. return $core.withContext(function($ctx1) {
  42927. var $2,$1;
  42928. self._step();
  42929. $ctx1.sendIdx["step"]=1;
  42930. $recv((function(){
  42931. return $core.withContext(function($ctx2) {
  42932. $2=self._node();
  42933. $ctx2.sendIdx["node"]=1;
  42934. $1=$recv($2)._isNil();
  42935. return $recv($1)._or_((function(){
  42936. return $core.withContext(function($ctx3) {
  42937. return $recv(self._node())._isSteppingNode();
  42938. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42939. }));
  42940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42941. }))._whileFalse_((function(){
  42942. return $core.withContext(function($ctx2) {
  42943. return self._step();
  42944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42945. }));
  42946. return self;
  42947. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  42948. },
  42949. args: [],
  42950. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  42951. referencedClasses: [],
  42952. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  42953. }),
  42954. $globals.ASTInterpreter);
  42955. $core.addMethod(
  42956. $core.method({
  42957. selector: "visit:",
  42958. protocol: 'visiting',
  42959. fn: function (aNode){
  42960. var self=this;
  42961. return $core.withContext(function($ctx1) {
  42962. var $1;
  42963. $1=self._hasReturned();
  42964. if(!$core.assert($1)){
  42965. (
  42966. $ctx1.supercall = true,
  42967. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($recv(self), [aNode]));
  42968. $ctx1.supercall = false;
  42969. };
  42970. return self;
  42971. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  42972. },
  42973. args: ["aNode"],
  42974. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  42975. referencedClasses: [],
  42976. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  42977. }),
  42978. $globals.ASTInterpreter);
  42979. $core.addMethod(
  42980. $core.method({
  42981. selector: "visitAssignmentNode:",
  42982. protocol: 'visiting',
  42983. fn: function (aNode){
  42984. var self=this;
  42985. var poppedValue;
  42986. return $core.withContext(function($ctx1) {
  42987. poppedValue=self._pop();
  42988. $ctx1.sendIdx["pop"]=1;
  42989. self._pop();
  42990. self._push_(poppedValue);
  42991. self._assign_to_($recv(aNode)._left(),poppedValue);
  42992. return self;
  42993. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  42994. },
  42995. args: ["aNode"],
  42996. 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",
  42997. referencedClasses: [],
  42998. messageSends: ["pop", "push:", "assign:to:", "left"]
  42999. }),
  43000. $globals.ASTInterpreter);
  43001. $core.addMethod(
  43002. $core.method({
  43003. selector: "visitBlockNode:",
  43004. protocol: 'visiting',
  43005. fn: function (aNode){
  43006. var self=this;
  43007. var block;
  43008. return $core.withContext(function($ctx1) {
  43009. block=$recv($globals.AIBlockClosure)._forContext_node_(self._context(),aNode);
  43010. self._push_(block);
  43011. return self;
  43012. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  43013. },
  43014. args: ["aNode"],
  43015. 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",
  43016. referencedClasses: ["AIBlockClosure"],
  43017. messageSends: ["forContext:node:", "context", "push:"]
  43018. }),
  43019. $globals.ASTInterpreter);
  43020. $core.addMethod(
  43021. $core.method({
  43022. selector: "visitBlockSequenceNode:",
  43023. protocol: 'visiting',
  43024. fn: function (aNode){
  43025. var self=this;
  43026. return $core.withContext(function($ctx1) {
  43027. (
  43028. $ctx1.supercall = true,
  43029. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode]));
  43030. $ctx1.supercall = false;
  43031. self["@forceAtEnd"]=true;
  43032. return self;
  43033. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43034. },
  43035. args: ["aNode"],
  43036. 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",
  43037. referencedClasses: [],
  43038. messageSends: ["visitBlockSequenceNode:"]
  43039. }),
  43040. $globals.ASTInterpreter);
  43041. $core.addMethod(
  43042. $core.method({
  43043. selector: "visitDagNode:",
  43044. protocol: 'visiting',
  43045. fn: function (aNode){
  43046. var self=this;
  43047. return self;
  43048. },
  43049. args: ["aNode"],
  43050. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  43051. referencedClasses: [],
  43052. messageSends: []
  43053. }),
  43054. $globals.ASTInterpreter);
  43055. $core.addMethod(
  43056. $core.method({
  43057. selector: "visitDynamicArrayNode:",
  43058. protocol: 'visiting',
  43059. fn: function (aNode){
  43060. var self=this;
  43061. var array;
  43062. return $core.withContext(function($ctx1) {
  43063. array=[];
  43064. $recv($recv(aNode)._dagChildren())._do_((function(each){
  43065. return $core.withContext(function($ctx2) {
  43066. return $recv(array)._addFirst_(self._pop());
  43067. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43068. }));
  43069. self._push_(array);
  43070. return self;
  43071. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  43072. },
  43073. args: ["aNode"],
  43074. 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",
  43075. referencedClasses: [],
  43076. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  43077. }),
  43078. $globals.ASTInterpreter);
  43079. $core.addMethod(
  43080. $core.method({
  43081. selector: "visitDynamicDictionaryNode:",
  43082. protocol: 'visiting',
  43083. fn: function (aNode){
  43084. var self=this;
  43085. var keyValueList;
  43086. return $core.withContext(function($ctx1) {
  43087. keyValueList=$recv($globals.OrderedCollection)._new();
  43088. $recv($recv(aNode)._dagChildren())._do_((function(each){
  43089. return $core.withContext(function($ctx2) {
  43090. return $recv(keyValueList)._add_(self._pop());
  43091. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43092. }));
  43093. self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  43094. return self;
  43095. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  43096. },
  43097. args: ["aNode"],
  43098. 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)",
  43099. referencedClasses: ["OrderedCollection", "HashedCollection"],
  43100. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  43101. }),
  43102. $globals.ASTInterpreter);
  43103. $core.addMethod(
  43104. $core.method({
  43105. selector: "visitJSStatementNode:",
  43106. protocol: 'visiting',
  43107. fn: function (aNode){
  43108. var self=this;
  43109. return $core.withContext(function($ctx1) {
  43110. self["@returned"]=true;
  43111. self._returnValue_(self._eval_($recv(aNode)._source()));
  43112. return self;
  43113. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43114. },
  43115. args: ["aNode"],
  43116. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  43117. referencedClasses: [],
  43118. messageSends: ["returnValue:", "eval:", "source"]
  43119. }),
  43120. $globals.ASTInterpreter);
  43121. $core.addMethod(
  43122. $core.method({
  43123. selector: "visitReturnNode:",
  43124. protocol: 'visiting',
  43125. fn: function (aNode){
  43126. var self=this;
  43127. return $core.withContext(function($ctx1) {
  43128. self["@returned"]=true;
  43129. self._returnValue_(self._pop());
  43130. return self;
  43131. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43132. },
  43133. args: ["aNode"],
  43134. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  43135. referencedClasses: [],
  43136. messageSends: ["returnValue:", "pop"]
  43137. }),
  43138. $globals.ASTInterpreter);
  43139. $core.addMethod(
  43140. $core.method({
  43141. selector: "visitSendNode:",
  43142. protocol: 'visiting',
  43143. fn: function (aNode){
  43144. var self=this;
  43145. var receiver,args,message,result;
  43146. return $core.withContext(function($ctx1) {
  43147. var $1;
  43148. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  43149. return $core.withContext(function($ctx2) {
  43150. return self._pop();
  43151. $ctx2.sendIdx["pop"]=1;
  43152. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43153. }));
  43154. receiver=self._peek();
  43155. message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  43156. result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  43157. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  43158. return $core.withContext(function($ctx2) {
  43159. return $recv($recv(aNode)._isLastChild())._not();
  43160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43161. }));
  43162. if(!$core.assert($1)){
  43163. self._pop();
  43164. self._push_(result);
  43165. };
  43166. return self;
  43167. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  43168. },
  43169. args: ["aNode"],
  43170. 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 ]",
  43171. referencedClasses: [],
  43172. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  43173. }),
  43174. $globals.ASTInterpreter);
  43175. $core.addMethod(
  43176. $core.method({
  43177. selector: "visitValueNode:",
  43178. protocol: 'visiting',
  43179. fn: function (aNode){
  43180. var self=this;
  43181. return $core.withContext(function($ctx1) {
  43182. self._push_($recv(aNode)._value());
  43183. return self;
  43184. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43185. },
  43186. args: ["aNode"],
  43187. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  43188. referencedClasses: [],
  43189. messageSends: ["push:", "value"]
  43190. }),
  43191. $globals.ASTInterpreter);
  43192. $core.addMethod(
  43193. $core.method({
  43194. selector: "visitVariableNode:",
  43195. protocol: 'visiting',
  43196. fn: function (aNode){
  43197. var self=this;
  43198. return $core.withContext(function($ctx1) {
  43199. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  43200. $2=$recv(aNode)._binding();
  43201. $ctx1.sendIdx["binding"]=1;
  43202. $1=$recv($2)._isUnknownVar();
  43203. if($core.assert($1)){
  43204. $5=$recv($globals.Platform)._globals();
  43205. $ctx1.sendIdx["globals"]=1;
  43206. $6=$recv(aNode)._value();
  43207. $ctx1.sendIdx["value"]=1;
  43208. $4=$recv($5)._at_ifAbsent_($6,(function(){
  43209. return $core.withContext(function($ctx2) {
  43210. return self._error_("Unknown variable");
  43211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43212. }));
  43213. $ctx1.sendIdx["at:ifAbsent:"]=1;
  43214. $3=self._push_($4);
  43215. $ctx1.sendIdx["push:"]=1;
  43216. return $3;
  43217. };
  43218. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  43219. if($core.assert($8)){
  43220. $10=self._context();
  43221. $ctx1.sendIdx["context"]=1;
  43222. $9=$recv($10)._receiver();
  43223. $11=$recv(aNode)._value();
  43224. $ctx1.sendIdx["value"]=2;
  43225. $7=$recv($9)._instVarAt_($11);
  43226. } else {
  43227. $12=self._context();
  43228. $13=$recv(aNode)._value();
  43229. $ctx1.sendIdx["value"]=3;
  43230. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  43231. return $core.withContext(function($ctx2) {
  43232. $15=$recv(aNode)._value();
  43233. $ctx2.sendIdx["value"]=4;
  43234. $14=$recv($15)._isCapitalized();
  43235. if($core.assert($14)){
  43236. $16=$recv($globals.Smalltalk)._globals();
  43237. $ctx2.sendIdx["globals"]=2;
  43238. $17=$recv(aNode)._value();
  43239. $ctx2.sendIdx["value"]=5;
  43240. return $recv($16)._at_ifAbsent_($17,(function(){
  43241. return $core.withContext(function($ctx3) {
  43242. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  43243. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  43244. }));
  43245. };
  43246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  43247. }));
  43248. };
  43249. self._push_($7);
  43250. return self;
  43251. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43252. },
  43253. args: ["aNode"],
  43254. 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 ] ] ] ])",
  43255. referencedClasses: ["Platform", "Smalltalk"],
  43256. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  43257. }),
  43258. $globals.ASTInterpreter);
  43259. $core.addClass('ASTInterpreterError', $globals.Error, [], 'Compiler-Interpreter');
  43260. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  43261. $core.addClass('ASTPCNodeVisitor', $globals.NodeVisitor, ['index', 'trackedIndex', 'selector', 'currentNode'], 'Compiler-Interpreter');
  43262. $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`";
  43263. $core.addMethod(
  43264. $core.method({
  43265. selector: "currentNode",
  43266. protocol: 'accessing',
  43267. fn: function (){
  43268. var self=this;
  43269. return self["@currentNode"];
  43270. },
  43271. args: [],
  43272. source: "currentNode\x0a\x09^ currentNode",
  43273. referencedClasses: [],
  43274. messageSends: []
  43275. }),
  43276. $globals.ASTPCNodeVisitor);
  43277. $core.addMethod(
  43278. $core.method({
  43279. selector: "increaseTrackedIndex",
  43280. protocol: 'accessing',
  43281. fn: function (){
  43282. var self=this;
  43283. return $core.withContext(function($ctx1) {
  43284. self["@trackedIndex"]=$recv(self._trackedIndex()).__plus((1));
  43285. return self;
  43286. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  43287. },
  43288. args: [],
  43289. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  43290. referencedClasses: [],
  43291. messageSends: ["+", "trackedIndex"]
  43292. }),
  43293. $globals.ASTPCNodeVisitor);
  43294. $core.addMethod(
  43295. $core.method({
  43296. selector: "index",
  43297. protocol: 'accessing',
  43298. fn: function (){
  43299. var self=this;
  43300. return self["@index"];
  43301. },
  43302. args: [],
  43303. source: "index\x0a\x09^ index",
  43304. referencedClasses: [],
  43305. messageSends: []
  43306. }),
  43307. $globals.ASTPCNodeVisitor);
  43308. $core.addMethod(
  43309. $core.method({
  43310. selector: "index:",
  43311. protocol: 'accessing',
  43312. fn: function (aNumber){
  43313. var self=this;
  43314. self["@index"]=aNumber;
  43315. return self;
  43316. },
  43317. args: ["aNumber"],
  43318. source: "index: aNumber\x0a\x09index := aNumber",
  43319. referencedClasses: [],
  43320. messageSends: []
  43321. }),
  43322. $globals.ASTPCNodeVisitor);
  43323. $core.addMethod(
  43324. $core.method({
  43325. selector: "selector",
  43326. protocol: 'accessing',
  43327. fn: function (){
  43328. var self=this;
  43329. return self["@selector"];
  43330. },
  43331. args: [],
  43332. source: "selector\x0a\x09^ selector",
  43333. referencedClasses: [],
  43334. messageSends: []
  43335. }),
  43336. $globals.ASTPCNodeVisitor);
  43337. $core.addMethod(
  43338. $core.method({
  43339. selector: "selector:",
  43340. protocol: 'accessing',
  43341. fn: function (aString){
  43342. var self=this;
  43343. self["@selector"]=aString;
  43344. return self;
  43345. },
  43346. args: ["aString"],
  43347. source: "selector: aString\x0a\x09selector := aString",
  43348. referencedClasses: [],
  43349. messageSends: []
  43350. }),
  43351. $globals.ASTPCNodeVisitor);
  43352. $core.addMethod(
  43353. $core.method({
  43354. selector: "trackedIndex",
  43355. protocol: 'accessing',
  43356. fn: function (){
  43357. var self=this;
  43358. return $core.withContext(function($ctx1) {
  43359. var $1,$receiver;
  43360. $1=self["@trackedIndex"];
  43361. if(($receiver = $1) == null || $receiver.isNil){
  43362. self["@trackedIndex"]=(0);
  43363. return self["@trackedIndex"];
  43364. } else {
  43365. return $1;
  43366. };
  43367. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  43368. },
  43369. args: [],
  43370. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  43371. referencedClasses: [],
  43372. messageSends: ["ifNil:"]
  43373. }),
  43374. $globals.ASTPCNodeVisitor);
  43375. $core.addMethod(
  43376. $core.method({
  43377. selector: "visitJSStatementNode:",
  43378. protocol: 'visiting',
  43379. fn: function (aNode){
  43380. var self=this;
  43381. self["@currentNode"]=aNode;
  43382. return self;
  43383. },
  43384. args: ["aNode"],
  43385. 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",
  43386. referencedClasses: [],
  43387. messageSends: []
  43388. }),
  43389. $globals.ASTPCNodeVisitor);
  43390. $core.addMethod(
  43391. $core.method({
  43392. selector: "visitSendNode:",
  43393. protocol: 'visiting',
  43394. fn: function (aNode){
  43395. var self=this;
  43396. return $core.withContext(function($ctx1) {
  43397. var $2,$1,$3;
  43398. (
  43399. $ctx1.supercall = true,
  43400. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  43401. $ctx1.supercall = false;
  43402. $2=self._selector();
  43403. $ctx1.sendIdx["selector"]=1;
  43404. $1=$recv($2).__eq($recv(aNode)._selector());
  43405. $ctx1.sendIdx["="]=1;
  43406. if($core.assert($1)){
  43407. $3=$recv(self._trackedIndex()).__eq(self._index());
  43408. if($core.assert($3)){
  43409. self["@currentNode"]=aNode;
  43410. self["@currentNode"];
  43411. };
  43412. self._increaseTrackedIndex();
  43413. };
  43414. return self;
  43415. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  43416. },
  43417. args: ["aNode"],
  43418. 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 ]",
  43419. referencedClasses: [],
  43420. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  43421. }),
  43422. $globals.ASTPCNodeVisitor);
  43423. $core.addMethod(
  43424. $core.method({
  43425. selector: "isLastChild",
  43426. protocol: '*Compiler-Interpreter',
  43427. fn: function (){
  43428. var self=this;
  43429. return $core.withContext(function($ctx1) {
  43430. return $recv($recv($recv(self._parent())._dagChildren())._last()).__eq(self);
  43431. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  43432. },
  43433. args: [],
  43434. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  43435. referencedClasses: [],
  43436. messageSends: ["=", "last", "dagChildren", "parent"]
  43437. }),
  43438. $globals.ASTNode);
  43439. $core.addMethod(
  43440. $core.method({
  43441. selector: "isSteppingNode",
  43442. protocol: '*Compiler-Interpreter',
  43443. fn: function (){
  43444. var self=this;
  43445. return false;
  43446. },
  43447. args: [],
  43448. source: "isSteppingNode\x0a\x09^ false",
  43449. referencedClasses: [],
  43450. messageSends: []
  43451. }),
  43452. $globals.ASTNode);
  43453. $core.addMethod(
  43454. $core.method({
  43455. selector: "nextSiblingNode:",
  43456. protocol: '*Compiler-Interpreter',
  43457. fn: function (aNode){
  43458. var self=this;
  43459. return $core.withContext(function($ctx1) {
  43460. var $1;
  43461. var $early={};
  43462. try {
  43463. $1=self._dagChildren();
  43464. $ctx1.sendIdx["dagChildren"]=1;
  43465. return $recv($1)._at_ifAbsent_($recv($recv(self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  43466. throw $early=[nil];
  43467. }));
  43468. }
  43469. catch(e) {if(e===$early)return e[0]; throw e}
  43470. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  43471. },
  43472. args: ["aNode"],
  43473. 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 ]",
  43474. referencedClasses: [],
  43475. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  43476. }),
  43477. $globals.ASTNode);
  43478. $core.addMethod(
  43479. $core.method({
  43480. selector: "isSteppingNode",
  43481. protocol: '*Compiler-Interpreter',
  43482. fn: function (){
  43483. var self=this;
  43484. return true;
  43485. },
  43486. args: [],
  43487. source: "isSteppingNode\x0a\x09^ true",
  43488. referencedClasses: [],
  43489. messageSends: []
  43490. }),
  43491. $globals.AssignmentNode);
  43492. $core.addMethod(
  43493. $core.method({
  43494. selector: "isSteppingNode",
  43495. protocol: '*Compiler-Interpreter',
  43496. fn: function (){
  43497. var self=this;
  43498. return true;
  43499. },
  43500. args: [],
  43501. source: "isSteppingNode\x0a\x09^ true",
  43502. referencedClasses: [],
  43503. messageSends: []
  43504. }),
  43505. $globals.BlockNode);
  43506. $core.addMethod(
  43507. $core.method({
  43508. selector: "nextSiblingNode:",
  43509. protocol: '*Compiler-Interpreter',
  43510. fn: function (aNode){
  43511. var self=this;
  43512. return nil;
  43513. },
  43514. args: ["aNode"],
  43515. 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",
  43516. referencedClasses: [],
  43517. messageSends: []
  43518. }),
  43519. $globals.BlockNode);
  43520. $core.addMethod(
  43521. $core.method({
  43522. selector: "isSteppingNode",
  43523. protocol: '*Compiler-Interpreter',
  43524. fn: function (){
  43525. var self=this;
  43526. return true;
  43527. },
  43528. args: [],
  43529. source: "isSteppingNode\x0a\x09^ true",
  43530. referencedClasses: [],
  43531. messageSends: []
  43532. }),
  43533. $globals.DynamicArrayNode);
  43534. $core.addMethod(
  43535. $core.method({
  43536. selector: "isSteppingNode",
  43537. protocol: '*Compiler-Interpreter',
  43538. fn: function (){
  43539. var self=this;
  43540. return true;
  43541. },
  43542. args: [],
  43543. source: "isSteppingNode\x0a\x09^ true",
  43544. referencedClasses: [],
  43545. messageSends: []
  43546. }),
  43547. $globals.DynamicDictionaryNode);
  43548. $core.addMethod(
  43549. $core.method({
  43550. selector: "isSteppingNode",
  43551. protocol: '*Compiler-Interpreter',
  43552. fn: function (){
  43553. var self=this;
  43554. return true;
  43555. },
  43556. args: [],
  43557. source: "isSteppingNode\x0a\x09^ true",
  43558. referencedClasses: [],
  43559. messageSends: []
  43560. }),
  43561. $globals.JSStatementNode);
  43562. $core.addMethod(
  43563. $core.method({
  43564. selector: "isCascadeSendNode",
  43565. protocol: '*Compiler-Interpreter',
  43566. fn: function (){
  43567. var self=this;
  43568. return $core.withContext(function($ctx1) {
  43569. return $recv(self._parent())._isCascadeNode();
  43570. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  43571. },
  43572. args: [],
  43573. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  43574. referencedClasses: [],
  43575. messageSends: ["isCascadeNode", "parent"]
  43576. }),
  43577. $globals.SendNode);
  43578. $core.addMethod(
  43579. $core.method({
  43580. selector: "isSteppingNode",
  43581. protocol: '*Compiler-Interpreter',
  43582. fn: function (){
  43583. var self=this;
  43584. return true;
  43585. },
  43586. args: [],
  43587. source: "isSteppingNode\x0a\x09^ true",
  43588. referencedClasses: [],
  43589. messageSends: []
  43590. }),
  43591. $globals.SendNode);
  43592. });
  43593. define('amber/lang',[
  43594. './deploy',
  43595. './compatibility', // pre-fetch, dep of ./boot
  43596. './boot', // pre-fetch, dep of ./helpers
  43597. './helpers', // pre-fetch, dep of ./deploy
  43598. './parser',
  43599. // --- packages for the Amber reflection begin here ---
  43600. 'amber_core/Platform-ImportExport',
  43601. 'amber_core/Compiler-Core',
  43602. 'amber_core/Compiler-AST',
  43603. 'amber_core/Compiler-Semantic',
  43604. 'amber_core/Compiler-IR',
  43605. 'amber_core/Compiler-Inlining',
  43606. 'amber_core/Compiler-Interpreter'
  43607. // --- packages for the Amber reflection end here ---
  43608. ], function (amber) { return amber; });
  43609. define('amber_core/SUnit',["amber/boot", "amber_core/Kernel-Classes", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  43610. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  43611. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  43612. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  43613. $core.addPackage('SUnit');
  43614. $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
  43615. $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  43616. $core.addClass('ResultAnnouncement', $globals.Object, ['result'], 'SUnit');
  43617. $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.";
  43618. $core.addMethod(
  43619. $core.method({
  43620. selector: "result",
  43621. protocol: 'accessing',
  43622. fn: function (){
  43623. var self=this;
  43624. return self["@result"];
  43625. },
  43626. args: [],
  43627. source: "result\x0a\x09^ result",
  43628. referencedClasses: [],
  43629. messageSends: []
  43630. }),
  43631. $globals.ResultAnnouncement);
  43632. $core.addMethod(
  43633. $core.method({
  43634. selector: "result:",
  43635. protocol: 'accessing',
  43636. fn: function (aTestResult){
  43637. var self=this;
  43638. self["@result"]=aTestResult;
  43639. return self;
  43640. },
  43641. args: ["aTestResult"],
  43642. source: "result: aTestResult\x0a\x09result := aTestResult",
  43643. referencedClasses: [],
  43644. messageSends: []
  43645. }),
  43646. $globals.ResultAnnouncement);
  43647. $core.addClass('TestCase', $globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
  43648. $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.";
  43649. $core.addMethod(
  43650. $core.method({
  43651. selector: "assert:",
  43652. protocol: 'testing',
  43653. fn: function (aBoolean){
  43654. var self=this;
  43655. return $core.withContext(function($ctx1) {
  43656. self._assert_description_(aBoolean,"Assertion failed");
  43657. return self;
  43658. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  43659. },
  43660. args: ["aBoolean"],
  43661. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  43662. referencedClasses: [],
  43663. messageSends: ["assert:description:"]
  43664. }),
  43665. $globals.TestCase);
  43666. $core.addMethod(
  43667. $core.method({
  43668. selector: "assert:description:",
  43669. protocol: 'testing',
  43670. fn: function (aBoolean,aString){
  43671. var self=this;
  43672. return $core.withContext(function($ctx1) {
  43673. if(!$core.assert(aBoolean)){
  43674. self._signalFailure_(aString);
  43675. };
  43676. return self;
  43677. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  43678. },
  43679. args: ["aBoolean", "aString"],
  43680. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  43681. referencedClasses: [],
  43682. messageSends: ["ifFalse:", "signalFailure:"]
  43683. }),
  43684. $globals.TestCase);
  43685. $core.addMethod(
  43686. $core.method({
  43687. selector: "assert:equals:",
  43688. protocol: 'testing',
  43689. fn: function (actual,expected){
  43690. var self=this;
  43691. return $core.withContext(function($ctx1) {
  43692. var $1,$5,$4,$3,$2;
  43693. $1=$recv(actual).__eq(expected);
  43694. $5=$recv(expected)._printString();
  43695. $ctx1.sendIdx["printString"]=1;
  43696. $4="Expected: ".__comma($5);
  43697. $3=$recv($4).__comma(" but was: ");
  43698. $ctx1.sendIdx[","]=2;
  43699. $2=$recv($3).__comma($recv(actual)._printString());
  43700. $ctx1.sendIdx[","]=1;
  43701. return self._assert_description_($1,$2);
  43702. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  43703. },
  43704. args: ["actual", "expected"],
  43705. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  43706. referencedClasses: [],
  43707. messageSends: ["assert:description:", "=", ",", "printString"]
  43708. }),
  43709. $globals.TestCase);
  43710. $core.addMethod(
  43711. $core.method({
  43712. selector: "async:",
  43713. protocol: 'async',
  43714. fn: function (aBlock){
  43715. var self=this;
  43716. var c;
  43717. return $core.withContext(function($ctx1) {
  43718. var $1;
  43719. self._errorIfNotAsync_("#async");
  43720. c=self["@context"];
  43721. return (function(){
  43722. return $core.withContext(function($ctx2) {
  43723. $1=self._isAsync();
  43724. if($core.assert($1)){
  43725. return $recv(c)._execute_(aBlock);
  43726. };
  43727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43728. });
  43729. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  43730. },
  43731. args: ["aBlock"],
  43732. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  43733. referencedClasses: [],
  43734. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  43735. }),
  43736. $globals.TestCase);
  43737. $core.addMethod(
  43738. $core.method({
  43739. selector: "context:",
  43740. protocol: 'accessing',
  43741. fn: function (aRunningTestContext){
  43742. var self=this;
  43743. self["@context"]=aRunningTestContext;
  43744. return self;
  43745. },
  43746. args: ["aRunningTestContext"],
  43747. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  43748. referencedClasses: [],
  43749. messageSends: []
  43750. }),
  43751. $globals.TestCase);
  43752. $core.addMethod(
  43753. $core.method({
  43754. selector: "deny:",
  43755. protocol: 'testing',
  43756. fn: function (aBoolean){
  43757. var self=this;
  43758. return $core.withContext(function($ctx1) {
  43759. self._assert_($recv(aBoolean)._not());
  43760. return self;
  43761. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  43762. },
  43763. args: ["aBoolean"],
  43764. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  43765. referencedClasses: [],
  43766. messageSends: ["assert:", "not"]
  43767. }),
  43768. $globals.TestCase);
  43769. $core.addMethod(
  43770. $core.method({
  43771. selector: "errorIfNotAsync:",
  43772. protocol: 'error handling',
  43773. fn: function (aString){
  43774. var self=this;
  43775. return $core.withContext(function($ctx1) {
  43776. var $1;
  43777. $1=self._isAsync();
  43778. if(!$core.assert($1)){
  43779. self._error_($recv(aString).__comma(" used without prior #timeout:"));
  43780. };
  43781. return self;
  43782. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  43783. },
  43784. args: ["aString"],
  43785. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  43786. referencedClasses: [],
  43787. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  43788. }),
  43789. $globals.TestCase);
  43790. $core.addMethod(
  43791. $core.method({
  43792. selector: "finished",
  43793. protocol: 'async',
  43794. fn: function (){
  43795. var self=this;
  43796. return $core.withContext(function($ctx1) {
  43797. self._errorIfNotAsync_("#finished");
  43798. self["@asyncTimeout"]=nil;
  43799. return self;
  43800. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  43801. },
  43802. args: [],
  43803. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  43804. referencedClasses: [],
  43805. messageSends: ["errorIfNotAsync:"]
  43806. }),
  43807. $globals.TestCase);
  43808. $core.addMethod(
  43809. $core.method({
  43810. selector: "isAsync",
  43811. protocol: 'testing',
  43812. fn: function (){
  43813. var self=this;
  43814. return $core.withContext(function($ctx1) {
  43815. return $recv(self["@asyncTimeout"])._notNil();
  43816. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  43817. },
  43818. args: [],
  43819. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  43820. referencedClasses: [],
  43821. messageSends: ["notNil"]
  43822. }),
  43823. $globals.TestCase);
  43824. $core.addMethod(
  43825. $core.method({
  43826. selector: "performTest",
  43827. protocol: 'running',
  43828. fn: function (){
  43829. var self=this;
  43830. return $core.withContext(function($ctx1) {
  43831. self["@asyncTimeout"]=nil;
  43832. self._perform_(self._selector());
  43833. return self;
  43834. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  43835. },
  43836. args: [],
  43837. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  43838. referencedClasses: [],
  43839. messageSends: ["perform:", "selector"]
  43840. }),
  43841. $globals.TestCase);
  43842. $core.addMethod(
  43843. $core.method({
  43844. selector: "runCase",
  43845. protocol: 'running',
  43846. fn: function (){
  43847. var self=this;
  43848. return $core.withContext(function($ctx1) {
  43849. $recv($recv($globals.TestContext)._testCase_(self))._start();
  43850. return self;
  43851. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  43852. },
  43853. args: [],
  43854. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  43855. referencedClasses: ["TestContext"],
  43856. messageSends: ["start", "testCase:"]
  43857. }),
  43858. $globals.TestCase);
  43859. $core.addMethod(
  43860. $core.method({
  43861. selector: "selector",
  43862. protocol: 'accessing',
  43863. fn: function (){
  43864. var self=this;
  43865. return self["@testSelector"];
  43866. },
  43867. args: [],
  43868. source: "selector\x0a\x09^ testSelector",
  43869. referencedClasses: [],
  43870. messageSends: []
  43871. }),
  43872. $globals.TestCase);
  43873. $core.addMethod(
  43874. $core.method({
  43875. selector: "setTestSelector:",
  43876. protocol: 'accessing',
  43877. fn: function (aSelector){
  43878. var self=this;
  43879. self["@testSelector"]=aSelector;
  43880. return self;
  43881. },
  43882. args: ["aSelector"],
  43883. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  43884. referencedClasses: [],
  43885. messageSends: []
  43886. }),
  43887. $globals.TestCase);
  43888. $core.addMethod(
  43889. $core.method({
  43890. selector: "setUp",
  43891. protocol: 'running',
  43892. fn: function (){
  43893. var self=this;
  43894. return self;
  43895. },
  43896. args: [],
  43897. source: "setUp",
  43898. referencedClasses: [],
  43899. messageSends: []
  43900. }),
  43901. $globals.TestCase);
  43902. $core.addMethod(
  43903. $core.method({
  43904. selector: "should:",
  43905. protocol: 'testing',
  43906. fn: function (aBlock){
  43907. var self=this;
  43908. return $core.withContext(function($ctx1) {
  43909. self._assert_($recv(aBlock)._value());
  43910. return self;
  43911. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  43912. },
  43913. args: ["aBlock"],
  43914. source: "should: aBlock\x0a\x09self assert: aBlock value",
  43915. referencedClasses: [],
  43916. messageSends: ["assert:", "value"]
  43917. }),
  43918. $globals.TestCase);
  43919. $core.addMethod(
  43920. $core.method({
  43921. selector: "should:raise:",
  43922. protocol: 'testing',
  43923. fn: function (aBlock,anExceptionClass){
  43924. var self=this;
  43925. return $core.withContext(function($ctx1) {
  43926. self._assert_($recv((function(){
  43927. return $core.withContext(function($ctx2) {
  43928. $recv(aBlock)._value();
  43929. return false;
  43930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43931. }))._on_do_(anExceptionClass,(function(ex){
  43932. return true;
  43933. })));
  43934. return self;
  43935. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  43936. },
  43937. args: ["aBlock", "anExceptionClass"],
  43938. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  43939. referencedClasses: [],
  43940. messageSends: ["assert:", "on:do:", "value"]
  43941. }),
  43942. $globals.TestCase);
  43943. $core.addMethod(
  43944. $core.method({
  43945. selector: "shouldnt:raise:",
  43946. protocol: 'testing',
  43947. fn: function (aBlock,anExceptionClass){
  43948. var self=this;
  43949. return $core.withContext(function($ctx1) {
  43950. self._assert_($recv((function(){
  43951. return $core.withContext(function($ctx2) {
  43952. $recv(aBlock)._value();
  43953. return true;
  43954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43955. }))._on_do_(anExceptionClass,(function(ex){
  43956. return false;
  43957. })));
  43958. return self;
  43959. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  43960. },
  43961. args: ["aBlock", "anExceptionClass"],
  43962. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  43963. referencedClasses: [],
  43964. messageSends: ["assert:", "on:do:", "value"]
  43965. }),
  43966. $globals.TestCase);
  43967. $core.addMethod(
  43968. $core.method({
  43969. selector: "signalFailure:",
  43970. protocol: 'private',
  43971. fn: function (aString){
  43972. var self=this;
  43973. return $core.withContext(function($ctx1) {
  43974. var $1;
  43975. $1=$recv($globals.TestFailure)._new();
  43976. $recv($1)._messageText_(aString);
  43977. $recv($1)._signal();
  43978. return self;
  43979. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  43980. },
  43981. args: ["aString"],
  43982. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  43983. referencedClasses: ["TestFailure"],
  43984. messageSends: ["messageText:", "new", "signal"]
  43985. }),
  43986. $globals.TestCase);
  43987. $core.addMethod(
  43988. $core.method({
  43989. selector: "tearDown",
  43990. protocol: 'running',
  43991. fn: function (){
  43992. var self=this;
  43993. return self;
  43994. },
  43995. args: [],
  43996. source: "tearDown",
  43997. referencedClasses: [],
  43998. messageSends: []
  43999. }),
  44000. $globals.TestCase);
  44001. $core.addMethod(
  44002. $core.method({
  44003. selector: "timeout:",
  44004. protocol: 'async',
  44005. fn: function (aNumber){
  44006. var self=this;
  44007. return $core.withContext(function($ctx1) {
  44008. var $1,$receiver;
  44009. $1=self["@asyncTimeout"];
  44010. if(($receiver = $1) == null || $receiver.isNil){
  44011. $1;
  44012. } else {
  44013. $recv(self["@asyncTimeout"])._clearTimeout();
  44014. };
  44015. self["@asyncTimeout"]=(0);
  44016. self["@asyncTimeout"]=$recv(self._async_((function(){
  44017. return $core.withContext(function($ctx2) {
  44018. return self._assert_description_(false,"SUnit grace time exhausted");
  44019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44020. })))._valueWithTimeout_(aNumber);
  44021. return self;
  44022. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  44023. },
  44024. args: ["aNumber"],
  44025. 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",
  44026. referencedClasses: [],
  44027. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  44028. }),
  44029. $globals.TestCase);
  44030. $core.addMethod(
  44031. $core.method({
  44032. selector: "allTestSelectors",
  44033. protocol: 'accessing',
  44034. fn: function (){
  44035. var self=this;
  44036. var selectors;
  44037. return $core.withContext(function($ctx1) {
  44038. var $1;
  44039. selectors=self._testSelectors();
  44040. $1=self._shouldInheritSelectors();
  44041. if($core.assert($1)){
  44042. $recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors());
  44043. };
  44044. return selectors;
  44045. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)});
  44046. },
  44047. args: [],
  44048. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  44049. referencedClasses: [],
  44050. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  44051. }),
  44052. $globals.TestCase.klass);
  44053. $core.addMethod(
  44054. $core.method({
  44055. selector: "buildSuite",
  44056. protocol: 'accessing',
  44057. fn: function (){
  44058. var self=this;
  44059. return $core.withContext(function($ctx1) {
  44060. return $recv(self._allTestSelectors())._collect_((function(each){
  44061. return $core.withContext(function($ctx2) {
  44062. return self._selector_(each);
  44063. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44064. }));
  44065. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)});
  44066. },
  44067. args: [],
  44068. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  44069. referencedClasses: [],
  44070. messageSends: ["collect:", "allTestSelectors", "selector:"]
  44071. }),
  44072. $globals.TestCase.klass);
  44073. $core.addMethod(
  44074. $core.method({
  44075. selector: "classTag",
  44076. protocol: 'accessing',
  44077. fn: function (){
  44078. var self=this;
  44079. return "test";
  44080. },
  44081. args: [],
  44082. 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'",
  44083. referencedClasses: [],
  44084. messageSends: []
  44085. }),
  44086. $globals.TestCase.klass);
  44087. $core.addMethod(
  44088. $core.method({
  44089. selector: "isAbstract",
  44090. protocol: 'testing',
  44091. fn: function (){
  44092. var self=this;
  44093. return $core.withContext(function($ctx1) {
  44094. return $recv(self._name()).__eq("TestCase");
  44095. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)});
  44096. },
  44097. args: [],
  44098. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  44099. referencedClasses: [],
  44100. messageSends: ["=", "name"]
  44101. }),
  44102. $globals.TestCase.klass);
  44103. $core.addMethod(
  44104. $core.method({
  44105. selector: "lookupHierarchyRoot",
  44106. protocol: 'accessing',
  44107. fn: function (){
  44108. var self=this;
  44109. return $globals.TestCase;
  44110. },
  44111. args: [],
  44112. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  44113. referencedClasses: ["TestCase"],
  44114. messageSends: []
  44115. }),
  44116. $globals.TestCase.klass);
  44117. $core.addMethod(
  44118. $core.method({
  44119. selector: "selector:",
  44120. protocol: 'accessing',
  44121. fn: function (aSelector){
  44122. var self=this;
  44123. return $core.withContext(function($ctx1) {
  44124. var $1;
  44125. $1=self._new();
  44126. $recv($1)._setTestSelector_(aSelector);
  44127. return $recv($1)._yourself();
  44128. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)});
  44129. },
  44130. args: ["aSelector"],
  44131. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  44132. referencedClasses: [],
  44133. messageSends: ["setTestSelector:", "new", "yourself"]
  44134. }),
  44135. $globals.TestCase.klass);
  44136. $core.addMethod(
  44137. $core.method({
  44138. selector: "shouldInheritSelectors",
  44139. protocol: 'testing',
  44140. fn: function (){
  44141. var self=this;
  44142. return $core.withContext(function($ctx1) {
  44143. return self.__tild_eq(self._lookupHierarchyRoot());
  44144. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)});
  44145. },
  44146. args: [],
  44147. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  44148. referencedClasses: [],
  44149. messageSends: ["~=", "lookupHierarchyRoot"]
  44150. }),
  44151. $globals.TestCase.klass);
  44152. $core.addMethod(
  44153. $core.method({
  44154. selector: "testSelectors",
  44155. protocol: 'accessing',
  44156. fn: function (){
  44157. var self=this;
  44158. return $core.withContext(function($ctx1) {
  44159. return $recv($recv(self._methodDictionary())._keys())._select_((function(each){
  44160. return $core.withContext(function($ctx2) {
  44161. return $recv(each)._match_("^test");
  44162. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44163. }));
  44164. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)});
  44165. },
  44166. args: [],
  44167. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  44168. referencedClasses: [],
  44169. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  44170. }),
  44171. $globals.TestCase.klass);
  44172. $core.addClass('TestContext', $globals.Object, ['testCase'], 'SUnit');
  44173. $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).";
  44174. $core.addMethod(
  44175. $core.method({
  44176. selector: "execute:",
  44177. protocol: 'running',
  44178. fn: function (aBlock){
  44179. var self=this;
  44180. var failed;
  44181. return $core.withContext(function($ctx1) {
  44182. var $1,$2;
  44183. $recv(self["@testCase"])._context_(self);
  44184. $ctx1.sendIdx["context:"]=1;
  44185. $recv((function(){
  44186. return $core.withContext(function($ctx2) {
  44187. failed=true;
  44188. failed;
  44189. $recv(aBlock)._value();
  44190. failed=false;
  44191. return failed;
  44192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44193. }))._ensure_((function(){
  44194. return $core.withContext(function($ctx2) {
  44195. $recv(self["@testCase"])._context_(nil);
  44196. $1=$recv(failed)._and_((function(){
  44197. return $core.withContext(function($ctx3) {
  44198. return $recv(self["@testCase"])._isAsync();
  44199. $ctx3.sendIdx["isAsync"]=1;
  44200. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  44201. }));
  44202. if($core.assert($1)){
  44203. $recv(self["@testCase"])._finished();
  44204. };
  44205. $2=$recv(self["@testCase"])._isAsync();
  44206. if(!$core.assert($2)){
  44207. return $recv(self["@testCase"])._tearDown();
  44208. };
  44209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44210. }));
  44211. return self;
  44212. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  44213. },
  44214. args: ["aBlock"],
  44215. 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 ] ]",
  44216. referencedClasses: [],
  44217. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  44218. }),
  44219. $globals.TestContext);
  44220. $core.addMethod(
  44221. $core.method({
  44222. selector: "start",
  44223. protocol: 'running',
  44224. fn: function (){
  44225. var self=this;
  44226. return $core.withContext(function($ctx1) {
  44227. self._execute_((function(){
  44228. return $core.withContext(function($ctx2) {
  44229. $recv(self["@testCase"])._setUp();
  44230. return $recv(self["@testCase"])._performTest();
  44231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44232. }));
  44233. return self;
  44234. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  44235. },
  44236. args: [],
  44237. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  44238. referencedClasses: [],
  44239. messageSends: ["execute:", "setUp", "performTest"]
  44240. }),
  44241. $globals.TestContext);
  44242. $core.addMethod(
  44243. $core.method({
  44244. selector: "testCase:",
  44245. protocol: 'accessing',
  44246. fn: function (aTestCase){
  44247. var self=this;
  44248. self["@testCase"]=aTestCase;
  44249. return self;
  44250. },
  44251. args: ["aTestCase"],
  44252. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  44253. referencedClasses: [],
  44254. messageSends: []
  44255. }),
  44256. $globals.TestContext);
  44257. $core.addMethod(
  44258. $core.method({
  44259. selector: "testCase:",
  44260. protocol: 'instance creation',
  44261. fn: function (aTestCase){
  44262. var self=this;
  44263. return $core.withContext(function($ctx1) {
  44264. var $1;
  44265. $1=self._new();
  44266. $recv($1)._testCase_(aTestCase);
  44267. return $recv($1)._yourself();
  44268. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)});
  44269. },
  44270. args: ["aTestCase"],
  44271. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  44272. referencedClasses: [],
  44273. messageSends: ["testCase:", "new", "yourself"]
  44274. }),
  44275. $globals.TestContext.klass);
  44276. $core.addClass('ReportingTestContext', $globals.TestContext, ['finished', 'result'], 'SUnit');
  44277. $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`.";
  44278. $core.addMethod(
  44279. $core.method({
  44280. selector: "execute:",
  44281. protocol: 'running',
  44282. fn: function (aBlock){
  44283. var self=this;
  44284. return $core.withContext(function($ctx1) {
  44285. var $1;
  44286. $recv((function(){
  44287. return $core.withContext(function($ctx2) {
  44288. return self._withErrorReporting_((function(){
  44289. return $core.withContext(function($ctx3) {
  44290. return (
  44291. $ctx3.supercall = true,
  44292. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($recv(self), [aBlock]));
  44293. $ctx3.supercall = false;
  44294. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44295. }));
  44296. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44297. }))._ensure_((function(){
  44298. return $core.withContext(function($ctx2) {
  44299. $1=$recv(self["@testCase"])._isAsync();
  44300. if(!$core.assert($1)){
  44301. $recv(self["@result"])._increaseRuns();
  44302. return $recv(self["@finished"])._value();
  44303. };
  44304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44305. }));
  44306. return self;
  44307. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  44308. },
  44309. args: ["aBlock"],
  44310. 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 ] ]",
  44311. referencedClasses: [],
  44312. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  44313. }),
  44314. $globals.ReportingTestContext);
  44315. $core.addMethod(
  44316. $core.method({
  44317. selector: "finished:",
  44318. protocol: 'accessing',
  44319. fn: function (aBlock){
  44320. var self=this;
  44321. self["@finished"]=aBlock;
  44322. return self;
  44323. },
  44324. args: ["aBlock"],
  44325. source: "finished: aBlock\x0a\x09finished := aBlock",
  44326. referencedClasses: [],
  44327. messageSends: []
  44328. }),
  44329. $globals.ReportingTestContext);
  44330. $core.addMethod(
  44331. $core.method({
  44332. selector: "result:",
  44333. protocol: 'accessing',
  44334. fn: function (aTestResult){
  44335. var self=this;
  44336. self["@result"]=aTestResult;
  44337. return self;
  44338. },
  44339. args: ["aTestResult"],
  44340. source: "result: aTestResult\x0a\x09result := aTestResult",
  44341. referencedClasses: [],
  44342. messageSends: []
  44343. }),
  44344. $globals.ReportingTestContext);
  44345. $core.addMethod(
  44346. $core.method({
  44347. selector: "withErrorReporting:",
  44348. protocol: 'private',
  44349. fn: function (aBlock){
  44350. var self=this;
  44351. return $core.withContext(function($ctx1) {
  44352. $recv((function(){
  44353. return $core.withContext(function($ctx2) {
  44354. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  44355. return $core.withContext(function($ctx3) {
  44356. return $recv(self["@result"])._addFailure_(self["@testCase"]);
  44357. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  44358. }));
  44359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44360. }))._on_do_($globals.Error,(function(ex){
  44361. return $core.withContext(function($ctx2) {
  44362. return $recv(self["@result"])._addError_(self["@testCase"]);
  44363. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  44364. }));
  44365. $ctx1.sendIdx["on:do:"]=1;
  44366. return self;
  44367. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  44368. },
  44369. args: ["aBlock"],
  44370. 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 ]",
  44371. referencedClasses: ["TestFailure", "Error"],
  44372. messageSends: ["on:do:", "addFailure:", "addError:"]
  44373. }),
  44374. $globals.ReportingTestContext);
  44375. $core.addMethod(
  44376. $core.method({
  44377. selector: "testCase:result:finished:",
  44378. protocol: 'instance creation',
  44379. fn: function (aTestCase,aTestResult,aBlock){
  44380. var self=this;
  44381. return $core.withContext(function($ctx1) {
  44382. var $1;
  44383. $1=(
  44384. $ctx1.supercall = true,
  44385. ($globals.ReportingTestContext.klass.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($recv(self), [aTestCase]));
  44386. $ctx1.supercall = false;
  44387. $recv($1)._result_(aTestResult);
  44388. $recv($1)._finished_(aBlock);
  44389. return $recv($1)._yourself();
  44390. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)});
  44391. },
  44392. args: ["aTestCase", "aTestResult", "aBlock"],
  44393. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  44394. referencedClasses: [],
  44395. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  44396. }),
  44397. $globals.ReportingTestContext.klass);
  44398. $core.addClass('TestFailure', $globals.Error, [], 'SUnit');
  44399. $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.";
  44400. $core.addClass('TestResult', $globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  44401. $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";
  44402. $core.addMethod(
  44403. $core.method({
  44404. selector: "addError:",
  44405. protocol: 'accessing',
  44406. fn: function (anError){
  44407. var self=this;
  44408. return $core.withContext(function($ctx1) {
  44409. $recv(self._errors())._add_(anError);
  44410. return self;
  44411. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  44412. },
  44413. args: ["anError"],
  44414. source: "addError: anError\x0a\x09self errors add: anError",
  44415. referencedClasses: [],
  44416. messageSends: ["add:", "errors"]
  44417. }),
  44418. $globals.TestResult);
  44419. $core.addMethod(
  44420. $core.method({
  44421. selector: "addFailure:",
  44422. protocol: 'accessing',
  44423. fn: function (aFailure){
  44424. var self=this;
  44425. return $core.withContext(function($ctx1) {
  44426. $recv(self._failures())._add_(aFailure);
  44427. return self;
  44428. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  44429. },
  44430. args: ["aFailure"],
  44431. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  44432. referencedClasses: [],
  44433. messageSends: ["add:", "failures"]
  44434. }),
  44435. $globals.TestResult);
  44436. $core.addMethod(
  44437. $core.method({
  44438. selector: "errors",
  44439. protocol: 'accessing',
  44440. fn: function (){
  44441. var self=this;
  44442. return self["@errors"];
  44443. },
  44444. args: [],
  44445. source: "errors\x0a\x09^ errors",
  44446. referencedClasses: [],
  44447. messageSends: []
  44448. }),
  44449. $globals.TestResult);
  44450. $core.addMethod(
  44451. $core.method({
  44452. selector: "failures",
  44453. protocol: 'accessing',
  44454. fn: function (){
  44455. var self=this;
  44456. return self["@failures"];
  44457. },
  44458. args: [],
  44459. source: "failures\x0a\x09^ failures",
  44460. referencedClasses: [],
  44461. messageSends: []
  44462. }),
  44463. $globals.TestResult);
  44464. $core.addMethod(
  44465. $core.method({
  44466. selector: "increaseRuns",
  44467. protocol: 'accessing',
  44468. fn: function (){
  44469. var self=this;
  44470. return $core.withContext(function($ctx1) {
  44471. self["@runs"]=$recv(self["@runs"]).__plus((1));
  44472. return self;
  44473. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  44474. },
  44475. args: [],
  44476. source: "increaseRuns\x0a\x09runs := runs + 1",
  44477. referencedClasses: [],
  44478. messageSends: ["+"]
  44479. }),
  44480. $globals.TestResult);
  44481. $core.addMethod(
  44482. $core.method({
  44483. selector: "initialize",
  44484. protocol: 'initialization',
  44485. fn: function (){
  44486. var self=this;
  44487. return $core.withContext(function($ctx1) {
  44488. (
  44489. $ctx1.supercall = true,
  44490. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  44491. $ctx1.supercall = false;
  44492. self["@timestamp"]=$recv($globals.Date)._now();
  44493. self["@runs"]=(0);
  44494. self["@errors"]=$recv($globals.Array)._new();
  44495. $ctx1.sendIdx["new"]=1;
  44496. self["@failures"]=$recv($globals.Array)._new();
  44497. self["@total"]=(0);
  44498. return self;
  44499. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  44500. },
  44501. args: [],
  44502. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  44503. referencedClasses: ["Date", "Array"],
  44504. messageSends: ["initialize", "now", "new"]
  44505. }),
  44506. $globals.TestResult);
  44507. $core.addMethod(
  44508. $core.method({
  44509. selector: "nextRunDo:",
  44510. protocol: 'running',
  44511. fn: function (aBlock){
  44512. var self=this;
  44513. return $core.withContext(function($ctx1) {
  44514. var $2,$1;
  44515. $2=self._runs();
  44516. $ctx1.sendIdx["runs"]=1;
  44517. $1=$recv($2).__eq_eq(self._total());
  44518. if(!$core.assert($1)){
  44519. return $recv(aBlock)._value_($recv(self._runs()).__plus((1)));
  44520. };
  44521. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  44522. },
  44523. args: ["aBlock"],
  44524. 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 ]",
  44525. referencedClasses: [],
  44526. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  44527. }),
  44528. $globals.TestResult);
  44529. $core.addMethod(
  44530. $core.method({
  44531. selector: "runCase:",
  44532. protocol: 'running',
  44533. fn: function (aTestCase){
  44534. var self=this;
  44535. return $core.withContext(function($ctx1) {
  44536. $recv((function(){
  44537. return $core.withContext(function($ctx2) {
  44538. return $recv((function(){
  44539. return $core.withContext(function($ctx3) {
  44540. self._increaseRuns();
  44541. return $recv(aTestCase)._runCase();
  44542. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44543. }))._on_do_($globals.TestFailure,(function(ex){
  44544. return $core.withContext(function($ctx3) {
  44545. return self._addFailure_(aTestCase);
  44546. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  44547. }));
  44548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44549. }))._on_do_($globals.Error,(function(ex){
  44550. return $core.withContext(function($ctx2) {
  44551. return self._addError_(aTestCase);
  44552. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  44553. }));
  44554. $ctx1.sendIdx["on:do:"]=1;
  44555. return self;
  44556. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  44557. },
  44558. args: ["aTestCase"],
  44559. 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 ]",
  44560. referencedClasses: ["TestFailure", "Error"],
  44561. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  44562. }),
  44563. $globals.TestResult);
  44564. $core.addMethod(
  44565. $core.method({
  44566. selector: "runs",
  44567. protocol: 'accessing',
  44568. fn: function (){
  44569. var self=this;
  44570. return self["@runs"];
  44571. },
  44572. args: [],
  44573. source: "runs\x0a\x09^ runs",
  44574. referencedClasses: [],
  44575. messageSends: []
  44576. }),
  44577. $globals.TestResult);
  44578. $core.addMethod(
  44579. $core.method({
  44580. selector: "status",
  44581. protocol: 'accessing',
  44582. fn: function (){
  44583. var self=this;
  44584. return $core.withContext(function($ctx1) {
  44585. var $1;
  44586. $1=$recv(self._errors())._ifNotEmpty_ifEmpty_((function(){
  44587. return "error";
  44588. }),(function(){
  44589. return $core.withContext(function($ctx2) {
  44590. return $recv(self._failures())._ifNotEmpty_ifEmpty_((function(){
  44591. return "failure";
  44592. }),(function(){
  44593. return "success";
  44594. }));
  44595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44596. }));
  44597. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  44598. return $1;
  44599. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  44600. },
  44601. args: [],
  44602. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  44603. referencedClasses: [],
  44604. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  44605. }),
  44606. $globals.TestResult);
  44607. $core.addMethod(
  44608. $core.method({
  44609. selector: "timestamp",
  44610. protocol: 'accessing',
  44611. fn: function (){
  44612. var self=this;
  44613. return self["@timestamp"];
  44614. },
  44615. args: [],
  44616. source: "timestamp\x0a\x09^ timestamp",
  44617. referencedClasses: [],
  44618. messageSends: []
  44619. }),
  44620. $globals.TestResult);
  44621. $core.addMethod(
  44622. $core.method({
  44623. selector: "total",
  44624. protocol: 'accessing',
  44625. fn: function (){
  44626. var self=this;
  44627. return self["@total"];
  44628. },
  44629. args: [],
  44630. source: "total\x0a\x09^ total",
  44631. referencedClasses: [],
  44632. messageSends: []
  44633. }),
  44634. $globals.TestResult);
  44635. $core.addMethod(
  44636. $core.method({
  44637. selector: "total:",
  44638. protocol: 'accessing',
  44639. fn: function (aNumber){
  44640. var self=this;
  44641. self["@total"]=aNumber;
  44642. return self;
  44643. },
  44644. args: ["aNumber"],
  44645. source: "total: aNumber\x0a\x09total := aNumber",
  44646. referencedClasses: [],
  44647. messageSends: []
  44648. }),
  44649. $globals.TestResult);
  44650. $core.addClass('TestSuiteRunner', $globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  44651. $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`.";
  44652. $core.addMethod(
  44653. $core.method({
  44654. selector: "announcer",
  44655. protocol: 'accessing',
  44656. fn: function (){
  44657. var self=this;
  44658. return self["@announcer"];
  44659. },
  44660. args: [],
  44661. source: "announcer\x0a\x09^ announcer",
  44662. referencedClasses: [],
  44663. messageSends: []
  44664. }),
  44665. $globals.TestSuiteRunner);
  44666. $core.addMethod(
  44667. $core.method({
  44668. selector: "contextOf:",
  44669. protocol: 'private',
  44670. fn: function (anInteger){
  44671. var self=this;
  44672. return $core.withContext(function($ctx1) {
  44673. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){
  44674. return $core.withContext(function($ctx2) {
  44675. return self._resume();
  44676. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44677. }));
  44678. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  44679. },
  44680. args: ["anInteger"],
  44681. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  44682. referencedClasses: ["ReportingTestContext"],
  44683. messageSends: ["testCase:result:finished:", "at:", "resume"]
  44684. }),
  44685. $globals.TestSuiteRunner);
  44686. $core.addMethod(
  44687. $core.method({
  44688. selector: "initialize",
  44689. protocol: 'initialization',
  44690. fn: function (){
  44691. var self=this;
  44692. return $core.withContext(function($ctx1) {
  44693. var $1;
  44694. (
  44695. $ctx1.supercall = true,
  44696. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  44697. $ctx1.supercall = false;
  44698. self["@announcer"]=$recv($globals.Announcer)._new();
  44699. $ctx1.sendIdx["new"]=1;
  44700. self["@result"]=$recv($globals.TestResult)._new();
  44701. self["@runNextTest"]=(function(){
  44702. var runs;
  44703. return $core.withContext(function($ctx2) {
  44704. runs=$recv(self["@result"])._runs();
  44705. runs;
  44706. $1=$recv(runs).__lt($recv(self["@result"])._total());
  44707. if($core.assert($1)){
  44708. return $recv(self._contextOf_($recv(runs).__plus((1))))._start();
  44709. };
  44710. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  44711. });
  44712. return self;
  44713. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  44714. },
  44715. args: [],
  44716. 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 ] ].",
  44717. referencedClasses: ["Announcer", "TestResult"],
  44718. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  44719. }),
  44720. $globals.TestSuiteRunner);
  44721. $core.addMethod(
  44722. $core.method({
  44723. selector: "result",
  44724. protocol: 'accessing',
  44725. fn: function (){
  44726. var self=this;
  44727. return self["@result"];
  44728. },
  44729. args: [],
  44730. source: "result\x0a\x09^ result",
  44731. referencedClasses: [],
  44732. messageSends: []
  44733. }),
  44734. $globals.TestSuiteRunner);
  44735. $core.addMethod(
  44736. $core.method({
  44737. selector: "resume",
  44738. protocol: 'actions',
  44739. fn: function (){
  44740. var self=this;
  44741. return $core.withContext(function($ctx1) {
  44742. $recv(self["@runNextTest"])._fork();
  44743. $recv(self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_(self["@result"]));
  44744. return self;
  44745. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  44746. },
  44747. args: [],
  44748. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  44749. referencedClasses: ["ResultAnnouncement"],
  44750. messageSends: ["fork", "announce:", "result:", "new"]
  44751. }),
  44752. $globals.TestSuiteRunner);
  44753. $core.addMethod(
  44754. $core.method({
  44755. selector: "run",
  44756. protocol: 'actions',
  44757. fn: function (){
  44758. var self=this;
  44759. return $core.withContext(function($ctx1) {
  44760. $recv(self["@result"])._total_($recv(self["@suite"])._size());
  44761. self._resume();
  44762. return self;
  44763. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  44764. },
  44765. args: [],
  44766. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  44767. referencedClasses: [],
  44768. messageSends: ["total:", "size", "resume"]
  44769. }),
  44770. $globals.TestSuiteRunner);
  44771. $core.addMethod(
  44772. $core.method({
  44773. selector: "suite:",
  44774. protocol: 'accessing',
  44775. fn: function (aCollection){
  44776. var self=this;
  44777. self["@suite"]=aCollection;
  44778. return self;
  44779. },
  44780. args: ["aCollection"],
  44781. source: "suite: aCollection\x0a\x09suite := aCollection",
  44782. referencedClasses: [],
  44783. messageSends: []
  44784. }),
  44785. $globals.TestSuiteRunner);
  44786. $core.addMethod(
  44787. $core.method({
  44788. selector: "new",
  44789. protocol: 'instance creation',
  44790. fn: function (){
  44791. var self=this;
  44792. return $core.withContext(function($ctx1) {
  44793. self._shouldNotImplement();
  44794. return self;
  44795. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)});
  44796. },
  44797. args: [],
  44798. source: "new\x0a\x09self shouldNotImplement",
  44799. referencedClasses: [],
  44800. messageSends: ["shouldNotImplement"]
  44801. }),
  44802. $globals.TestSuiteRunner.klass);
  44803. $core.addMethod(
  44804. $core.method({
  44805. selector: "on:",
  44806. protocol: 'instance creation',
  44807. fn: function (aCollection){
  44808. var self=this;
  44809. return $core.withContext(function($ctx1) {
  44810. var $1;
  44811. $1=(
  44812. $ctx1.supercall = true,
  44813. ($globals.TestSuiteRunner.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  44814. $ctx1.supercall = false;
  44815. return $recv($1)._suite_(aCollection);
  44816. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)});
  44817. },
  44818. args: ["aCollection"],
  44819. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  44820. referencedClasses: [],
  44821. messageSends: ["suite:", "new"]
  44822. }),
  44823. $globals.TestSuiteRunner.klass);
  44824. $core.addMethod(
  44825. $core.method({
  44826. selector: "isTestClass",
  44827. protocol: '*SUnit',
  44828. fn: function (){
  44829. var self=this;
  44830. return $core.withContext(function($ctx1) {
  44831. return $recv(self._includesBehavior_($globals.TestCase))._and_((function(){
  44832. return $core.withContext(function($ctx2) {
  44833. return $recv(self._isAbstract())._not();
  44834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44835. }));
  44836. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.Behavior)});
  44837. },
  44838. args: [],
  44839. source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
  44840. referencedClasses: ["TestCase"],
  44841. messageSends: ["and:", "includesBehavior:", "not", "isAbstract"]
  44842. }),
  44843. $globals.Behavior);
  44844. $core.addMethod(
  44845. $core.method({
  44846. selector: "isTestPackage",
  44847. protocol: '*SUnit',
  44848. fn: function (){
  44849. var self=this;
  44850. return $core.withContext(function($ctx1) {
  44851. return $recv(self._classes())._anySatisfy_((function(each){
  44852. return $core.withContext(function($ctx2) {
  44853. return $recv(each)._isTestClass();
  44854. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44855. }));
  44856. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  44857. },
  44858. args: [],
  44859. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  44860. referencedClasses: [],
  44861. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  44862. }),
  44863. $globals.Package);
  44864. });
  44865. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  44866. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  44867. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  44868. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  44869. $core.addPackage('Compiler-Tests');
  44870. $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  44871. $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  44872. $core.addClass('ASTParsingTest', $globals.TestCase, [], 'Compiler-Tests');
  44873. $core.addMethod(
  44874. $core.method({
  44875. selector: "analyze:forClass:",
  44876. protocol: 'convenience',
  44877. fn: function (aNode,aClass){
  44878. var self=this;
  44879. return $core.withContext(function($ctx1) {
  44880. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  44881. return aNode;
  44882. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  44883. },
  44884. args: ["aNode", "aClass"],
  44885. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  44886. referencedClasses: ["SemanticAnalyzer"],
  44887. messageSends: ["visit:", "on:"]
  44888. }),
  44889. $globals.ASTParsingTest);
  44890. $core.addMethod(
  44891. $core.method({
  44892. selector: "parse:",
  44893. protocol: 'parsing',
  44894. fn: function (aString){
  44895. var self=this;
  44896. return $core.withContext(function($ctx1) {
  44897. return $recv($globals.Smalltalk)._parse_(aString);
  44898. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  44899. },
  44900. args: ["aString"],
  44901. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  44902. referencedClasses: ["Smalltalk"],
  44903. messageSends: ["parse:"]
  44904. }),
  44905. $globals.ASTParsingTest);
  44906. $core.addMethod(
  44907. $core.method({
  44908. selector: "parse:forClass:",
  44909. protocol: 'parsing',
  44910. fn: function (aString,aClass){
  44911. var self=this;
  44912. return $core.withContext(function($ctx1) {
  44913. return self._analyze_forClass_(self._parse_(aString),aClass);
  44914. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  44915. },
  44916. args: ["aString", "aClass"],
  44917. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  44918. referencedClasses: [],
  44919. messageSends: ["analyze:forClass:", "parse:"]
  44920. }),
  44921. $globals.ASTParsingTest);
  44922. $core.addClass('ASTPCNodeVisitorTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  44923. $core.addMethod(
  44924. $core.method({
  44925. selector: "astPCNodeVisitor",
  44926. protocol: 'factory',
  44927. fn: function (){
  44928. var self=this;
  44929. return $core.withContext(function($ctx1) {
  44930. var $1;
  44931. $1=$recv($globals.ASTPCNodeVisitor)._new();
  44932. $recv($1)._index_((0));
  44933. return $recv($1)._yourself();
  44934. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  44935. },
  44936. args: [],
  44937. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  44938. referencedClasses: ["ASTPCNodeVisitor"],
  44939. messageSends: ["index:", "new", "yourself"]
  44940. }),
  44941. $globals.ASTPCNodeVisitorTest);
  44942. $core.addMethod(
  44943. $core.method({
  44944. selector: "astPCNodeVisitorForSelector:",
  44945. protocol: 'factory',
  44946. fn: function (aString){
  44947. var self=this;
  44948. return $core.withContext(function($ctx1) {
  44949. var $1;
  44950. $1=$recv($globals.ASTPCNodeVisitor)._new();
  44951. $recv($1)._selector_(aString);
  44952. $recv($1)._index_((0));
  44953. return $recv($1)._yourself();
  44954. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  44955. },
  44956. args: ["aString"],
  44957. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  44958. referencedClasses: ["ASTPCNodeVisitor"],
  44959. messageSends: ["selector:", "new", "index:", "yourself"]
  44960. }),
  44961. $globals.ASTPCNodeVisitorTest);
  44962. $core.addMethod(
  44963. $core.method({
  44964. selector: "testJSStatementNode",
  44965. protocol: 'tests',
  44966. fn: function (){
  44967. var self=this;
  44968. var ast,visitor;
  44969. return $core.withContext(function($ctx1) {
  44970. var $3,$2,$1;
  44971. ast=self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  44972. $3=self._astPCNodeVisitor();
  44973. $recv($3)._visit_(ast);
  44974. $2=$recv($3)._currentNode();
  44975. $1=$recv($2)._isJSStatementNode();
  44976. self._assert_($1);
  44977. return self;
  44978. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  44979. },
  44980. args: [],
  44981. 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",
  44982. referencedClasses: ["Object"],
  44983. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  44984. }),
  44985. $globals.ASTPCNodeVisitorTest);
  44986. $core.addMethod(
  44987. $core.method({
  44988. selector: "testLegacyJSStatementNode",
  44989. protocol: 'tests',
  44990. fn: function (){
  44991. var self=this;
  44992. var ast,visitor;
  44993. return $core.withContext(function($ctx1) {
  44994. var $3,$2,$1;
  44995. ast=self._parse_forClass_("foo <consolee.log(1)>",$globals.Object);
  44996. $3=self._astPCNodeVisitor();
  44997. $recv($3)._visit_(ast);
  44998. $2=$recv($3)._currentNode();
  44999. $1=$recv($2)._isJSStatementNode();
  45000. self._assert_($1);
  45001. return self;
  45002. }, function($ctx1) {$ctx1.fill(self,"testLegacyJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  45003. },
  45004. args: [],
  45005. source: "testLegacyJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <consolee.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  45006. referencedClasses: ["Object"],
  45007. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  45008. }),
  45009. $globals.ASTPCNodeVisitorTest);
  45010. $core.addMethod(
  45011. $core.method({
  45012. selector: "testMessageSend",
  45013. protocol: 'tests',
  45014. fn: function (){
  45015. var self=this;
  45016. var ast;
  45017. return $core.withContext(function($ctx1) {
  45018. var $3,$2,$1;
  45019. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  45020. $3=self._astPCNodeVisitorForSelector_("yourself");
  45021. $recv($3)._visit_(ast);
  45022. $2=$recv($3)._currentNode();
  45023. $1=$recv($2)._selector();
  45024. self._assert_equals_($1,"yourself");
  45025. return self;
  45026. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45027. },
  45028. args: [],
  45029. 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'",
  45030. referencedClasses: ["Object"],
  45031. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  45032. }),
  45033. $globals.ASTPCNodeVisitorTest);
  45034. $core.addMethod(
  45035. $core.method({
  45036. selector: "testMessageSendWithBlocks",
  45037. protocol: 'tests',
  45038. fn: function (){
  45039. var self=this;
  45040. var ast;
  45041. return $core.withContext(function($ctx1) {
  45042. var $3,$2,$1;
  45043. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  45044. $3=self._astPCNodeVisitorForSelector_("yourself");
  45045. $recv($3)._visit_(ast);
  45046. $2=$recv($3)._currentNode();
  45047. $1=$recv($2)._selector();
  45048. self._assert_equals_($1,"yourself");
  45049. return self;
  45050. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45051. },
  45052. args: [],
  45053. 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'",
  45054. referencedClasses: ["Object"],
  45055. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  45056. }),
  45057. $globals.ASTPCNodeVisitorTest);
  45058. $core.addMethod(
  45059. $core.method({
  45060. selector: "testMessageSendWithInlining",
  45061. protocol: 'tests',
  45062. fn: function (){
  45063. var self=this;
  45064. var ast;
  45065. return $core.withContext(function($ctx1) {
  45066. var $3,$4,$2,$1,$7,$6,$5;
  45067. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  45068. $ctx1.sendIdx["parse:forClass:"]=1;
  45069. $3=self._astPCNodeVisitorForSelector_("yourself");
  45070. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  45071. $recv($3)._visit_(ast);
  45072. $ctx1.sendIdx["visit:"]=1;
  45073. $4=$recv($3)._currentNode();
  45074. $ctx1.sendIdx["currentNode"]=1;
  45075. $2=$4;
  45076. $1=$recv($2)._selector();
  45077. $ctx1.sendIdx["selector"]=1;
  45078. self._assert_equals_($1,"yourself");
  45079. $ctx1.sendIdx["assert:equals:"]=1;
  45080. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  45081. $7=self._astPCNodeVisitorForSelector_("asBoolean");
  45082. $recv($7)._visit_(ast);
  45083. $6=$recv($7)._currentNode();
  45084. $5=$recv($6)._selector();
  45085. self._assert_equals_($5,"asBoolean");
  45086. return self;
  45087. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45088. },
  45089. args: [],
  45090. 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'",
  45091. referencedClasses: ["Object"],
  45092. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  45093. }),
  45094. $globals.ASTPCNodeVisitorTest);
  45095. $core.addMethod(
  45096. $core.method({
  45097. selector: "testNoMessageSend",
  45098. protocol: 'tests',
  45099. fn: function (){
  45100. var self=this;
  45101. var ast;
  45102. return $core.withContext(function($ctx1) {
  45103. var $3,$2,$1;
  45104. ast=self._parse_forClass_("foo ^ self",$globals.Object);
  45105. $3=self._astPCNodeVisitor();
  45106. $recv($3)._visit_(ast);
  45107. $2=$recv($3)._currentNode();
  45108. $1=$recv($2)._isNil();
  45109. self._assert_($1);
  45110. return self;
  45111. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45112. },
  45113. args: [],
  45114. 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",
  45115. referencedClasses: ["Object"],
  45116. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  45117. }),
  45118. $globals.ASTPCNodeVisitorTest);
  45119. $core.addClass('ASTPositionTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  45120. $core.addMethod(
  45121. $core.method({
  45122. selector: "testNodeAtPosition",
  45123. protocol: 'tests',
  45124. fn: function (){
  45125. var self=this;
  45126. var node;
  45127. return $core.withContext(function($ctx1) {
  45128. var $3,$4,$2,$1,$7,$8,$6,$5;
  45129. node=self._parse_("yourself\x0a\x09^ self");
  45130. $ctx1.sendIdx["parse:"]=1;
  45131. $3=node;
  45132. $4=(2).__at((4));
  45133. $ctx1.sendIdx["@"]=1;
  45134. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  45135. return nil;
  45136. }));
  45137. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  45138. $1=$recv($2)._source();
  45139. self._assert_equals_($1,"self");
  45140. $ctx1.sendIdx["assert:equals:"]=1;
  45141. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  45142. $ctx1.sendIdx["parse:"]=2;
  45143. $7=node;
  45144. $8=(2).__at((7));
  45145. $ctx1.sendIdx["@"]=2;
  45146. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  45147. return nil;
  45148. }));
  45149. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  45150. $5=$recv($6)._selector();
  45151. $ctx1.sendIdx["selector"]=1;
  45152. self._assert_equals_($5,"ifTrue:");
  45153. $ctx1.sendIdx["assert:equals:"]=2;
  45154. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  45155. self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  45156. return nil;
  45157. })))._selector(),"foo");
  45158. return self;
  45159. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  45160. },
  45161. args: [],
  45162. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  45163. referencedClasses: [],
  45164. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  45165. }),
  45166. $globals.ASTPositionTest);
  45167. $core.addClass('CodeGeneratorTest', $globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
  45168. $core.addMethod(
  45169. $core.method({
  45170. selector: "codeGeneratorClass",
  45171. protocol: 'accessing',
  45172. fn: function (){
  45173. var self=this;
  45174. return $globals.CodeGenerator;
  45175. },
  45176. args: [],
  45177. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  45178. referencedClasses: ["CodeGenerator"],
  45179. messageSends: []
  45180. }),
  45181. $globals.CodeGeneratorTest);
  45182. $core.addMethod(
  45183. $core.method({
  45184. selector: "compiler",
  45185. protocol: 'factory',
  45186. fn: function (){
  45187. var self=this;
  45188. return $core.withContext(function($ctx1) {
  45189. var $1;
  45190. $1=$recv($globals.Compiler)._new();
  45191. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  45192. return $recv($1)._yourself();
  45193. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  45194. },
  45195. args: [],
  45196. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  45197. referencedClasses: ["Compiler"],
  45198. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  45199. }),
  45200. $globals.CodeGeneratorTest);
  45201. $core.addMethod(
  45202. $core.method({
  45203. selector: "setUp",
  45204. protocol: 'initialization',
  45205. fn: function (){
  45206. var self=this;
  45207. return $core.withContext(function($ctx1) {
  45208. self["@receiver"]=$recv($globals.DoIt)._new();
  45209. return self;
  45210. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  45211. },
  45212. args: [],
  45213. source: "setUp\x0a\x09receiver := DoIt new",
  45214. referencedClasses: ["DoIt"],
  45215. messageSends: ["new"]
  45216. }),
  45217. $globals.CodeGeneratorTest);
  45218. $core.addMethod(
  45219. $core.method({
  45220. selector: "should:receiver:raise:",
  45221. protocol: 'testing',
  45222. fn: function (aString,anObject,anErrorClass){
  45223. var self=this;
  45224. var method,result;
  45225. return $core.withContext(function($ctx1) {
  45226. var $1,$2,$3,$receiver;
  45227. self["@receiver"]=anObject;
  45228. $recv((function(){
  45229. return $core.withContext(function($ctx2) {
  45230. return self._should_raise_((function(){
  45231. return $core.withContext(function($ctx3) {
  45232. $1=self._compiler();
  45233. $2=$recv(anObject)._class();
  45234. $ctx3.sendIdx["class"]=1;
  45235. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  45236. method;
  45237. return $recv(self["@receiver"])._perform_($recv(method)._selector());
  45238. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45239. }),anErrorClass);
  45240. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45241. }))._ensure_((function(){
  45242. return $core.withContext(function($ctx2) {
  45243. $3=method;
  45244. if(($receiver = $3) == null || $receiver.isNil){
  45245. return $3;
  45246. } else {
  45247. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  45248. };
  45249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45250. }));
  45251. return self;
  45252. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  45253. },
  45254. args: ["aString", "anObject", "anErrorClass"],
  45255. 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 ] ]",
  45256. referencedClasses: [],
  45257. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  45258. }),
  45259. $globals.CodeGeneratorTest);
  45260. $core.addMethod(
  45261. $core.method({
  45262. selector: "should:receiver:return:",
  45263. protocol: 'testing',
  45264. fn: function (aString,anObject,aResult){
  45265. var self=this;
  45266. var method,result;
  45267. return $core.withContext(function($ctx1) {
  45268. var $1,$2;
  45269. self["@receiver"]=anObject;
  45270. $1=self._compiler();
  45271. $2=$recv(anObject)._class();
  45272. $ctx1.sendIdx["class"]=1;
  45273. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  45274. result=$recv(self["@receiver"])._perform_($recv(method)._selector());
  45275. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  45276. self._assert_equals_(aResult,result);
  45277. return self;
  45278. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  45279. },
  45280. args: ["aString", "anObject", "aResult"],
  45281. 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",
  45282. referencedClasses: [],
  45283. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  45284. }),
  45285. $globals.CodeGeneratorTest);
  45286. $core.addMethod(
  45287. $core.method({
  45288. selector: "should:return:",
  45289. protocol: 'testing',
  45290. fn: function (aString,anObject){
  45291. var self=this;
  45292. return $core.withContext(function($ctx1) {
  45293. return self._should_receiver_return_(aString,self["@receiver"],anObject);
  45294. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  45295. },
  45296. args: ["aString", "anObject"],
  45297. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  45298. referencedClasses: [],
  45299. messageSends: ["should:receiver:return:"]
  45300. }),
  45301. $globals.CodeGeneratorTest);
  45302. $core.addMethod(
  45303. $core.method({
  45304. selector: "tearDown",
  45305. protocol: 'initialization',
  45306. fn: function (){
  45307. var self=this;
  45308. return self;
  45309. },
  45310. args: [],
  45311. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  45312. referencedClasses: [],
  45313. messageSends: []
  45314. }),
  45315. $globals.CodeGeneratorTest);
  45316. $core.addMethod(
  45317. $core.method({
  45318. selector: "testAssignment",
  45319. protocol: 'tests',
  45320. fn: function (){
  45321. var self=this;
  45322. return $core.withContext(function($ctx1) {
  45323. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  45324. $ctx1.sendIdx["should:return:"]=1;
  45325. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  45326. $ctx1.sendIdx["should:return:"]=2;
  45327. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  45328. return self;
  45329. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  45330. },
  45331. args: [],
  45332. 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",
  45333. referencedClasses: [],
  45334. messageSends: ["should:return:"]
  45335. }),
  45336. $globals.CodeGeneratorTest);
  45337. $core.addMethod(
  45338. $core.method({
  45339. selector: "testBackslashSelectors",
  45340. protocol: 'tests',
  45341. fn: function (){
  45342. var self=this;
  45343. return $core.withContext(function($ctx1) {
  45344. self._should_return_("\x5c arg ^ 4",(4));
  45345. $ctx1.sendIdx["should:return:"]=1;
  45346. self._should_return_("\x5c\x5c arg ^ 42",(42));
  45347. return self;
  45348. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  45349. },
  45350. args: [],
  45351. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  45352. referencedClasses: [],
  45353. messageSends: ["should:return:"]
  45354. }),
  45355. $globals.CodeGeneratorTest);
  45356. $core.addMethod(
  45357. $core.method({
  45358. selector: "testBlockReturn",
  45359. protocol: 'tests',
  45360. fn: function (){
  45361. var self=this;
  45362. return $core.withContext(function($ctx1) {
  45363. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  45364. $ctx1.sendIdx["should:return:"]=1;
  45365. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  45366. $ctx1.sendIdx["should:return:"]=2;
  45367. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  45368. return self;
  45369. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  45370. },
  45371. args: [],
  45372. 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).",
  45373. referencedClasses: [],
  45374. messageSends: ["should:return:"]
  45375. }),
  45376. $globals.CodeGeneratorTest);
  45377. $core.addMethod(
  45378. $core.method({
  45379. selector: "testCascades",
  45380. protocol: 'tests',
  45381. fn: function (){
  45382. var self=this;
  45383. return $core.withContext(function($ctx1) {
  45384. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  45385. return self;
  45386. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  45387. },
  45388. args: [],
  45389. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  45390. referencedClasses: [],
  45391. messageSends: ["should:return:"]
  45392. }),
  45393. $globals.CodeGeneratorTest);
  45394. $core.addMethod(
  45395. $core.method({
  45396. selector: "testCascadesInDynamicArray",
  45397. protocol: 'tests',
  45398. fn: function (){
  45399. var self=this;
  45400. return $core.withContext(function($ctx1) {
  45401. self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  45402. return self;
  45403. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  45404. },
  45405. args: [],
  45406. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  45407. referencedClasses: [],
  45408. messageSends: ["should:return:"]
  45409. }),
  45410. $globals.CodeGeneratorTest);
  45411. $core.addMethod(
  45412. $core.method({
  45413. selector: "testCascadesInDynamicDictioary",
  45414. protocol: 'tests',
  45415. fn: function (){
  45416. var self=this;
  45417. return $core.withContext(function($ctx1) {
  45418. self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  45419. return self;
  45420. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  45421. },
  45422. args: [],
  45423. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  45424. referencedClasses: [],
  45425. messageSends: ["should:return:"]
  45426. }),
  45427. $globals.CodeGeneratorTest);
  45428. $core.addMethod(
  45429. $core.method({
  45430. selector: "testCascadesInSend",
  45431. protocol: 'tests',
  45432. fn: function (){
  45433. var self=this;
  45434. return $core.withContext(function($ctx1) {
  45435. self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  45436. return self;
  45437. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  45438. },
  45439. args: [],
  45440. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  45441. referencedClasses: [],
  45442. messageSends: ["should:return:"]
  45443. }),
  45444. $globals.CodeGeneratorTest);
  45445. $core.addMethod(
  45446. $core.method({
  45447. selector: "testCascadesWithInlining",
  45448. protocol: 'tests',
  45449. fn: function (){
  45450. var self=this;
  45451. return $core.withContext(function($ctx1) {
  45452. self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  45453. $ctx1.sendIdx["should:return:"]=1;
  45454. self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  45455. return self;
  45456. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  45457. },
  45458. args: [],
  45459. 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",
  45460. referencedClasses: [],
  45461. messageSends: ["should:return:"]
  45462. }),
  45463. $globals.CodeGeneratorTest);
  45464. $core.addMethod(
  45465. $core.method({
  45466. selector: "testDynamicArrayElementsOrdered",
  45467. protocol: 'tests',
  45468. fn: function (){
  45469. var self=this;
  45470. return $core.withContext(function($ctx1) {
  45471. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  45472. $ctx1.sendIdx["should:return:"]=1;
  45473. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  45474. return self;
  45475. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  45476. },
  45477. args: [],
  45478. 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).",
  45479. referencedClasses: [],
  45480. messageSends: ["should:return:"]
  45481. }),
  45482. $globals.CodeGeneratorTest);
  45483. $core.addMethod(
  45484. $core.method({
  45485. selector: "testDynamicDictionaryElementsOrdered",
  45486. protocol: 'tests',
  45487. fn: function (){
  45488. var self=this;
  45489. return $core.withContext(function($ctx1) {
  45490. 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)]));
  45491. return self;
  45492. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  45493. },
  45494. args: [],
  45495. 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}.",
  45496. referencedClasses: [],
  45497. messageSends: ["should:return:"]
  45498. }),
  45499. $globals.CodeGeneratorTest);
  45500. $core.addMethod(
  45501. $core.method({
  45502. selector: "testDynamicDictionaryWithMoreArrows",
  45503. protocol: 'tests',
  45504. fn: function (){
  45505. var self=this;
  45506. return $core.withContext(function($ctx1) {
  45507. var $2,$1;
  45508. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  45509. $ctx1.sendIdx["->"]=1;
  45510. $1=$recv($globals.HashedCollection)._with_($2);
  45511. self._should_return_("foo ^ #{1->2->3}",$1);
  45512. return self;
  45513. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  45514. },
  45515. args: [],
  45516. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  45517. referencedClasses: ["HashedCollection"],
  45518. messageSends: ["should:return:", "with:", "->"]
  45519. }),
  45520. $globals.CodeGeneratorTest);
  45521. $core.addMethod(
  45522. $core.method({
  45523. selector: "testGlobalVar",
  45524. protocol: 'tests',
  45525. fn: function (){
  45526. var self=this;
  45527. return $core.withContext(function($ctx1) {
  45528. self._should_return_("foo ^ eval class",$globals.BlockClosure);
  45529. $ctx1.sendIdx["should:return:"]=1;
  45530. self._should_return_("foo ^ Math cos: 0",(1));
  45531. $ctx1.sendIdx["should:return:"]=2;
  45532. self._should_return_("foo ^ NonExistingVar",nil);
  45533. return self;
  45534. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  45535. },
  45536. args: [],
  45537. 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",
  45538. referencedClasses: ["BlockClosure"],
  45539. messageSends: ["should:return:"]
  45540. }),
  45541. $globals.CodeGeneratorTest);
  45542. $core.addMethod(
  45543. $core.method({
  45544. selector: "testInnerTemporalDependentElementsOrdered",
  45545. protocol: 'tests',
  45546. fn: function (){
  45547. var self=this;
  45548. return $core.withContext(function($ctx1) {
  45549. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  45550. $2="foo".__minus_gt($globals.Array);
  45551. $ctx1.sendIdx["->"]=1;
  45552. $3="bar".__minus_gt((2));
  45553. $ctx1.sendIdx["->"]=2;
  45554. $1=[$2,$3];
  45555. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  45556. $ctx1.sendIdx["should:return:"]=1;
  45557. $5="foo".__minus_gt($globals.Array);
  45558. $ctx1.sendIdx["->"]=3;
  45559. $6="bar".__minus_gt((2));
  45560. $ctx1.sendIdx["->"]=4;
  45561. $4=[$5,$6];
  45562. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  45563. $ctx1.sendIdx["should:return:"]=2;
  45564. $8="foo".__minus_gt((1));
  45565. $ctx1.sendIdx["->"]=5;
  45566. $9="bar".__minus_gt((2));
  45567. $ctx1.sendIdx["->"]=6;
  45568. $7=[$8,$9];
  45569. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  45570. $ctx1.sendIdx["should:return:"]=3;
  45571. $11="foo".__minus_gt((1));
  45572. $ctx1.sendIdx["->"]=7;
  45573. $10=[$11,"bar".__minus_gt((2))];
  45574. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  45575. $ctx1.sendIdx["should:return:"]=4;
  45576. 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)]));
  45577. return self;
  45578. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  45579. },
  45580. args: [],
  45581. 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}.",
  45582. referencedClasses: ["Array"],
  45583. messageSends: ["should:return:", "->"]
  45584. }),
  45585. $globals.CodeGeneratorTest);
  45586. $core.addMethod(
  45587. $core.method({
  45588. selector: "testJSStatement",
  45589. protocol: 'tests',
  45590. fn: function (){
  45591. var self=this;
  45592. return $core.withContext(function($ctx1) {
  45593. self._should_return_("foo <return 2+3>",(5));
  45594. return self;
  45595. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  45596. },
  45597. args: [],
  45598. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  45599. referencedClasses: [],
  45600. messageSends: ["should:return:"]
  45601. }),
  45602. $globals.CodeGeneratorTest);
  45603. $core.addMethod(
  45604. $core.method({
  45605. selector: "testLexicalScope",
  45606. protocol: 'tests',
  45607. fn: function (){
  45608. var self=this;
  45609. return $core.withContext(function($ctx1) {
  45610. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  45611. return self;
  45612. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  45613. },
  45614. args: [],
  45615. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  45616. referencedClasses: [],
  45617. messageSends: ["should:return:"]
  45618. }),
  45619. $globals.CodeGeneratorTest);
  45620. $core.addMethod(
  45621. $core.method({
  45622. selector: "testLiterals",
  45623. protocol: 'tests',
  45624. fn: function (){
  45625. var self=this;
  45626. return $core.withContext(function($ctx1) {
  45627. self._should_return_("foo ^ 1",(1));
  45628. $ctx1.sendIdx["should:return:"]=1;
  45629. self._should_return_("foo ^ 'hello'","hello");
  45630. $ctx1.sendIdx["should:return:"]=2;
  45631. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  45632. $ctx1.sendIdx["should:return:"]=3;
  45633. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  45634. $ctx1.sendIdx["should:return:"]=4;
  45635. self._should_return_("foo ^ true",true);
  45636. $ctx1.sendIdx["should:return:"]=5;
  45637. self._should_return_("foo ^ false",false);
  45638. $ctx1.sendIdx["should:return:"]=6;
  45639. self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  45640. $ctx1.sendIdx["should:return:"]=7;
  45641. self._should_return_("foo ^ #hello","hello");
  45642. $ctx1.sendIdx["should:return:"]=8;
  45643. self._should_return_("foo ^ $h","h");
  45644. $ctx1.sendIdx["should:return:"]=9;
  45645. self._should_return_("foo ^ -123.456",(-123.456));
  45646. $ctx1.sendIdx["should:return:"]=10;
  45647. self._should_return_("foo ^ -2.5e4",(-25000));
  45648. return self;
  45649. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  45650. },
  45651. args: [],
  45652. 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.",
  45653. referencedClasses: [],
  45654. messageSends: ["should:return:"]
  45655. }),
  45656. $globals.CodeGeneratorTest);
  45657. $core.addMethod(
  45658. $core.method({
  45659. selector: "testLocalReturn",
  45660. protocol: 'tests',
  45661. fn: function (){
  45662. var self=this;
  45663. return $core.withContext(function($ctx1) {
  45664. self._should_return_("foo ^ 1",(1));
  45665. $ctx1.sendIdx["should:return:"]=1;
  45666. self._should_return_("foo ^ 1 + 1",(2));
  45667. $ctx1.sendIdx["should:return:"]=2;
  45668. self._should_return_("foo ",self["@receiver"]);
  45669. $ctx1.sendIdx["should:return:"]=3;
  45670. self._should_return_("foo self asString",self["@receiver"]);
  45671. $ctx1.sendIdx["should:return:"]=4;
  45672. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  45673. return self;
  45674. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  45675. },
  45676. args: [],
  45677. 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",
  45678. referencedClasses: [],
  45679. messageSends: ["should:return:"]
  45680. }),
  45681. $globals.CodeGeneratorTest);
  45682. $core.addMethod(
  45683. $core.method({
  45684. selector: "testMessageSends",
  45685. protocol: 'tests',
  45686. fn: function (){
  45687. var self=this;
  45688. return $core.withContext(function($ctx1) {
  45689. self._should_return_("foo ^ 1 asString","1");
  45690. $ctx1.sendIdx["should:return:"]=1;
  45691. self._should_return_("foo ^ 1 + 1",(2));
  45692. $ctx1.sendIdx["should:return:"]=2;
  45693. self._should_return_("foo ^ 1 + 2 * 3",(9));
  45694. $ctx1.sendIdx["should:return:"]=3;
  45695. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  45696. $ctx1.sendIdx["should:return:"]=4;
  45697. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  45698. return self;
  45699. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  45700. },
  45701. args: [],
  45702. 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)",
  45703. referencedClasses: [],
  45704. messageSends: ["should:return:"]
  45705. }),
  45706. $globals.CodeGeneratorTest);
  45707. $core.addMethod(
  45708. $core.method({
  45709. selector: "testMultipleSequences",
  45710. protocol: 'tests',
  45711. fn: function (){
  45712. var self=this;
  45713. return $core.withContext(function($ctx1) {
  45714. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  45715. return self;
  45716. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  45717. },
  45718. args: [],
  45719. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  45720. referencedClasses: [],
  45721. messageSends: ["should:return:"]
  45722. }),
  45723. $globals.CodeGeneratorTest);
  45724. $core.addMethod(
  45725. $core.method({
  45726. selector: "testMutableLiterals",
  45727. protocol: 'tests',
  45728. fn: function (){
  45729. var self=this;
  45730. return $core.withContext(function($ctx1) {
  45731. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  45732. return self;
  45733. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  45734. },
  45735. args: [],
  45736. 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)",
  45737. referencedClasses: [],
  45738. messageSends: ["should:return:"]
  45739. }),
  45740. $globals.CodeGeneratorTest);
  45741. $core.addMethod(
  45742. $core.method({
  45743. selector: "testNestedIfTrue",
  45744. protocol: 'tests',
  45745. fn: function (){
  45746. var self=this;
  45747. return $core.withContext(function($ctx1) {
  45748. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  45749. $ctx1.sendIdx["should:return:"]=1;
  45750. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  45751. $ctx1.sendIdx["should:return:"]=2;
  45752. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  45753. $ctx1.sendIdx["should:return:"]=3;
  45754. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  45755. return self;
  45756. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  45757. },
  45758. args: [],
  45759. 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.",
  45760. referencedClasses: [],
  45761. messageSends: ["should:return:"]
  45762. }),
  45763. $globals.CodeGeneratorTest);
  45764. $core.addMethod(
  45765. $core.method({
  45766. selector: "testNestedSends",
  45767. protocol: 'tests',
  45768. fn: function (){
  45769. var self=this;
  45770. return $core.withContext(function($ctx1) {
  45771. 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());
  45772. return self;
  45773. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  45774. },
  45775. args: [],
  45776. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  45777. referencedClasses: ["Point"],
  45778. messageSends: ["should:return:", "asString", "x:y:", "@"]
  45779. }),
  45780. $globals.CodeGeneratorTest);
  45781. $core.addMethod(
  45782. $core.method({
  45783. selector: "testNonLocalReturn",
  45784. protocol: 'tests',
  45785. fn: function (){
  45786. var self=this;
  45787. return $core.withContext(function($ctx1) {
  45788. self._should_return_("foo [ ^ 1 ] value",(1));
  45789. $ctx1.sendIdx["should:return:"]=1;
  45790. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  45791. $ctx1.sendIdx["should:return:"]=2;
  45792. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  45793. $ctx1.sendIdx["should:return:"]=3;
  45794. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  45795. return self;
  45796. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  45797. },
  45798. args: [],
  45799. 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",
  45800. referencedClasses: [],
  45801. messageSends: ["should:return:"]
  45802. }),
  45803. $globals.CodeGeneratorTest);
  45804. $core.addMethod(
  45805. $core.method({
  45806. selector: "testPascalCaseGlobal",
  45807. protocol: 'tests',
  45808. fn: function (){
  45809. var self=this;
  45810. return $core.withContext(function($ctx1) {
  45811. self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  45812. $ctx1.sendIdx["should:return:"]=1;
  45813. self._should_return_("foo ^NonExistent",nil);
  45814. return self;
  45815. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  45816. },
  45817. args: [],
  45818. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  45819. referencedClasses: ["Smalltalk"],
  45820. messageSends: ["should:return:", "at:", "globals"]
  45821. }),
  45822. $globals.CodeGeneratorTest);
  45823. $core.addMethod(
  45824. $core.method({
  45825. selector: "testPragmaJSStatement",
  45826. protocol: 'tests',
  45827. fn: function (){
  45828. var self=this;
  45829. return $core.withContext(function($ctx1) {
  45830. self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  45831. return self;
  45832. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  45833. },
  45834. args: [],
  45835. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  45836. referencedClasses: [],
  45837. messageSends: ["should:return:"]
  45838. }),
  45839. $globals.CodeGeneratorTest);
  45840. $core.addMethod(
  45841. $core.method({
  45842. selector: "testRootSuperSend",
  45843. protocol: 'tests',
  45844. fn: function (){
  45845. var self=this;
  45846. return $core.withContext(function($ctx1) {
  45847. self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  45848. return self;
  45849. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  45850. },
  45851. args: [],
  45852. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  45853. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  45854. messageSends: ["should:receiver:raise:", "new"]
  45855. }),
  45856. $globals.CodeGeneratorTest);
  45857. $core.addMethod(
  45858. $core.method({
  45859. selector: "testSendReceiverAndArgumentsOrdered",
  45860. protocol: 'tests',
  45861. fn: function (){
  45862. var self=this;
  45863. return $core.withContext(function($ctx1) {
  45864. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  45865. $ctx1.sendIdx["should:return:"]=1;
  45866. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  45867. return self;
  45868. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  45869. },
  45870. args: [],
  45871. 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}.",
  45872. referencedClasses: ["Array"],
  45873. messageSends: ["should:return:"]
  45874. }),
  45875. $globals.CodeGeneratorTest);
  45876. $core.addMethod(
  45877. $core.method({
  45878. selector: "testSuperSend",
  45879. protocol: 'tests',
  45880. fn: function (){
  45881. var self=this;
  45882. return $core.withContext(function($ctx1) {
  45883. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  45884. return self;
  45885. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  45886. },
  45887. args: [],
  45888. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  45889. referencedClasses: [],
  45890. messageSends: ["should:receiver:return:"]
  45891. }),
  45892. $globals.CodeGeneratorTest);
  45893. $core.addMethod(
  45894. $core.method({
  45895. selector: "testTempVariables",
  45896. protocol: 'tests',
  45897. fn: function (){
  45898. var self=this;
  45899. return $core.withContext(function($ctx1) {
  45900. self._should_return_("foo | a | ^ a",nil);
  45901. $ctx1.sendIdx["should:return:"]=1;
  45902. self._should_return_("foo | AVariable | ^ AVariable",nil);
  45903. $ctx1.sendIdx["should:return:"]=2;
  45904. self._should_return_("foo | a b c | ^ c",nil);
  45905. $ctx1.sendIdx["should:return:"]=3;
  45906. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  45907. $ctx1.sendIdx["should:return:"]=4;
  45908. self._should_return_("foo | a | a:= 1. ^ a",(1));
  45909. $ctx1.sendIdx["should:return:"]=5;
  45910. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  45911. return self;
  45912. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  45913. },
  45914. args: [],
  45915. 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.",
  45916. referencedClasses: [],
  45917. messageSends: ["should:return:"]
  45918. }),
  45919. $globals.CodeGeneratorTest);
  45920. $core.addMethod(
  45921. $core.method({
  45922. selector: "testThisContext",
  45923. protocol: 'tests',
  45924. fn: function (){
  45925. var self=this;
  45926. return $core.withContext(function($ctx1) {
  45927. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  45928. return self;
  45929. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  45930. },
  45931. args: [],
  45932. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  45933. referencedClasses: [],
  45934. messageSends: ["should:return:"]
  45935. }),
  45936. $globals.CodeGeneratorTest);
  45937. $core.addMethod(
  45938. $core.method({
  45939. selector: "testifFalse",
  45940. protocol: 'tests',
  45941. fn: function (){
  45942. var self=this;
  45943. return $core.withContext(function($ctx1) {
  45944. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  45945. $ctx1.sendIdx["should:return:"]=1;
  45946. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  45947. $ctx1.sendIdx["should:return:"]=2;
  45948. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  45949. $ctx1.sendIdx["should:return:"]=3;
  45950. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  45951. return self;
  45952. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  45953. },
  45954. args: [],
  45955. 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.",
  45956. referencedClasses: [],
  45957. messageSends: ["should:return:"]
  45958. }),
  45959. $globals.CodeGeneratorTest);
  45960. $core.addMethod(
  45961. $core.method({
  45962. selector: "testifFalseIfTrue",
  45963. protocol: 'tests',
  45964. fn: function (){
  45965. var self=this;
  45966. return $core.withContext(function($ctx1) {
  45967. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  45968. $ctx1.sendIdx["should:return:"]=1;
  45969. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  45970. $ctx1.sendIdx["should:return:"]=2;
  45971. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  45972. $ctx1.sendIdx["should:return:"]=3;
  45973. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  45974. return self;
  45975. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  45976. },
  45977. args: [],
  45978. 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.",
  45979. referencedClasses: [],
  45980. messageSends: ["should:return:"]
  45981. }),
  45982. $globals.CodeGeneratorTest);
  45983. $core.addMethod(
  45984. $core.method({
  45985. selector: "testifNil",
  45986. protocol: 'tests',
  45987. fn: function (){
  45988. var self=this;
  45989. return $core.withContext(function($ctx1) {
  45990. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  45991. $ctx1.sendIdx["should:return:"]=1;
  45992. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  45993. $ctx1.sendIdx["should:return:"]=2;
  45994. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  45995. $ctx1.sendIdx["should:return:"]=3;
  45996. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  45997. return self;
  45998. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  45999. },
  46000. args: [],
  46001. 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.",
  46002. referencedClasses: [],
  46003. messageSends: ["should:return:"]
  46004. }),
  46005. $globals.CodeGeneratorTest);
  46006. $core.addMethod(
  46007. $core.method({
  46008. selector: "testifNilIfNotNil",
  46009. protocol: 'tests',
  46010. fn: function (){
  46011. var self=this;
  46012. return $core.withContext(function($ctx1) {
  46013. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  46014. $ctx1.sendIdx["should:return:"]=1;
  46015. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  46016. $ctx1.sendIdx["should:return:"]=2;
  46017. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  46018. $ctx1.sendIdx["should:return:"]=3;
  46019. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  46020. return self;
  46021. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  46022. },
  46023. args: [],
  46024. 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.",
  46025. referencedClasses: [],
  46026. messageSends: ["should:return:"]
  46027. }),
  46028. $globals.CodeGeneratorTest);
  46029. $core.addMethod(
  46030. $core.method({
  46031. selector: "testifNotNil",
  46032. protocol: 'tests',
  46033. fn: function (){
  46034. var self=this;
  46035. return $core.withContext(function($ctx1) {
  46036. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  46037. $ctx1.sendIdx["should:return:"]=1;
  46038. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  46039. $ctx1.sendIdx["should:return:"]=2;
  46040. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  46041. $ctx1.sendIdx["should:return:"]=3;
  46042. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  46043. return self;
  46044. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  46045. },
  46046. args: [],
  46047. 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.",
  46048. referencedClasses: [],
  46049. messageSends: ["should:return:"]
  46050. }),
  46051. $globals.CodeGeneratorTest);
  46052. $core.addMethod(
  46053. $core.method({
  46054. selector: "testifNotNilWithArgument",
  46055. protocol: 'tests',
  46056. fn: function (){
  46057. var self=this;
  46058. return $core.withContext(function($ctx1) {
  46059. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  46060. $ctx1.sendIdx["should:return:"]=1;
  46061. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  46062. $ctx1.sendIdx["should:return:"]=2;
  46063. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  46064. $ctx1.sendIdx["should:return:"]=3;
  46065. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  46066. $ctx1.sendIdx["should:return:"]=4;
  46067. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  46068. $ctx1.sendIdx["should:return:"]=5;
  46069. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  46070. return self;
  46071. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  46072. },
  46073. args: [],
  46074. 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",
  46075. referencedClasses: [],
  46076. messageSends: ["should:return:"]
  46077. }),
  46078. $globals.CodeGeneratorTest);
  46079. $core.addMethod(
  46080. $core.method({
  46081. selector: "testifTrue",
  46082. protocol: 'tests',
  46083. fn: function (){
  46084. var self=this;
  46085. return $core.withContext(function($ctx1) {
  46086. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  46087. $ctx1.sendIdx["should:return:"]=1;
  46088. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  46089. $ctx1.sendIdx["should:return:"]=2;
  46090. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  46091. $ctx1.sendIdx["should:return:"]=3;
  46092. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  46093. return self;
  46094. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  46095. },
  46096. args: [],
  46097. 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.",
  46098. referencedClasses: [],
  46099. messageSends: ["should:return:"]
  46100. }),
  46101. $globals.CodeGeneratorTest);
  46102. $core.addMethod(
  46103. $core.method({
  46104. selector: "testifTrueIfFalse",
  46105. protocol: 'tests',
  46106. fn: function (){
  46107. var self=this;
  46108. return $core.withContext(function($ctx1) {
  46109. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  46110. $ctx1.sendIdx["should:return:"]=1;
  46111. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  46112. $ctx1.sendIdx["should:return:"]=2;
  46113. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  46114. $ctx1.sendIdx["should:return:"]=3;
  46115. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  46116. return self;
  46117. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  46118. },
  46119. args: [],
  46120. 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.",
  46121. referencedClasses: [],
  46122. messageSends: ["should:return:"]
  46123. }),
  46124. $globals.CodeGeneratorTest);
  46125. $core.addClass('ASTInterpreterTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  46126. $core.addMethod(
  46127. $core.method({
  46128. selector: "analyze:forClass:",
  46129. protocol: 'parsing',
  46130. fn: function (aNode,aClass){
  46131. var self=this;
  46132. return $core.withContext(function($ctx1) {
  46133. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  46134. return aNode;
  46135. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  46136. },
  46137. args: ["aNode", "aClass"],
  46138. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  46139. referencedClasses: ["SemanticAnalyzer"],
  46140. messageSends: ["visit:", "on:"]
  46141. }),
  46142. $globals.ASTInterpreterTest);
  46143. $core.addMethod(
  46144. $core.method({
  46145. selector: "interpret:receiver:withArguments:",
  46146. protocol: 'private',
  46147. fn: function (aString,anObject,aDictionary){
  46148. var self=this;
  46149. var ctx,ast,interpreter;
  46150. return $core.withContext(function($ctx1) {
  46151. var $1,$2,$3,$receiver;
  46152. interpreter=$recv($globals.ASTInterpreter)._new();
  46153. $ctx1.sendIdx["new"]=1;
  46154. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  46155. $1=$recv($globals.AIContext)._new();
  46156. $recv($1)._receiver_(anObject);
  46157. $recv($1)._interpreter_(interpreter);
  46158. ctx=$recv($1)._yourself();
  46159. $2=$recv(ast)._sequenceNode();
  46160. if(($receiver = $2) == null || $receiver.isNil){
  46161. $2;
  46162. } else {
  46163. var sequence;
  46164. sequence=$receiver;
  46165. $recv($recv(sequence)._temps())._do_((function(each){
  46166. return $core.withContext(function($ctx2) {
  46167. return $recv(ctx)._defineLocal_(each);
  46168. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  46169. }));
  46170. };
  46171. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  46172. return $core.withContext(function($ctx2) {
  46173. return $recv(ctx)._localAt_put_(key,value);
  46174. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  46175. }));
  46176. $3=interpreter;
  46177. $recv($3)._context_(ctx);
  46178. $recv($3)._node_(ast);
  46179. $recv($3)._enterNode();
  46180. $recv($3)._proceed();
  46181. return $recv($3)._result();
  46182. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  46183. },
  46184. args: ["aString", "anObject", "aDictionary"],
  46185. 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",
  46186. referencedClasses: ["ASTInterpreter", "AIContext"],
  46187. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  46188. }),
  46189. $globals.ASTInterpreterTest);
  46190. $core.addMethod(
  46191. $core.method({
  46192. selector: "parse:",
  46193. protocol: 'parsing',
  46194. fn: function (aString){
  46195. var self=this;
  46196. return $core.withContext(function($ctx1) {
  46197. return $recv($globals.Smalltalk)._parse_(aString);
  46198. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  46199. },
  46200. args: ["aString"],
  46201. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  46202. referencedClasses: ["Smalltalk"],
  46203. messageSends: ["parse:"]
  46204. }),
  46205. $globals.ASTInterpreterTest);
  46206. $core.addMethod(
  46207. $core.method({
  46208. selector: "parse:forClass:",
  46209. protocol: 'parsing',
  46210. fn: function (aString,aClass){
  46211. var self=this;
  46212. return $core.withContext(function($ctx1) {
  46213. return self._analyze_forClass_(self._parse_(aString),aClass);
  46214. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  46215. },
  46216. args: ["aString", "aClass"],
  46217. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  46218. referencedClasses: [],
  46219. messageSends: ["analyze:forClass:", "parse:"]
  46220. }),
  46221. $globals.ASTInterpreterTest);
  46222. $core.addMethod(
  46223. $core.method({
  46224. selector: "should:receiver:return:",
  46225. protocol: 'testing',
  46226. fn: function (aString,anObject,aResult){
  46227. var self=this;
  46228. return $core.withContext(function($ctx1) {
  46229. self["@receiver"]=anObject;
  46230. return self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  46231. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  46232. },
  46233. args: ["aString", "anObject", "aResult"],
  46234. 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",
  46235. referencedClasses: [],
  46236. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  46237. }),
  46238. $globals.ASTInterpreterTest);
  46239. $core.addClass('ASTDebuggerTest', $globals.ASTInterpreterTest, [], 'Compiler-Tests');
  46240. $core.addMethod(
  46241. $core.method({
  46242. selector: "interpret:receiver:withArguments:",
  46243. protocol: 'private',
  46244. fn: function (aString,anObject,aDictionary){
  46245. var self=this;
  46246. var ctx,ast,debugger_;
  46247. return $core.withContext(function($ctx1) {
  46248. var $1,$2,$3,$4,$5,$receiver;
  46249. $1=$recv($globals.AIContext)._new();
  46250. $ctx1.sendIdx["new"]=1;
  46251. $recv($1)._receiver_(anObject);
  46252. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  46253. ctx=$recv($1)._yourself();
  46254. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  46255. $2=$recv(ast)._sequenceNode();
  46256. if(($receiver = $2) == null || $receiver.isNil){
  46257. $2;
  46258. } else {
  46259. var sequence;
  46260. sequence=$receiver;
  46261. $recv($recv(sequence)._temps())._do_((function(each){
  46262. return $core.withContext(function($ctx2) {
  46263. return $recv(ctx)._defineLocal_(each);
  46264. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  46265. }));
  46266. };
  46267. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  46268. return $core.withContext(function($ctx2) {
  46269. return $recv(ctx)._localAt_put_(key,value);
  46270. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  46271. }));
  46272. $3=$recv(ctx)._interpreter();
  46273. $ctx1.sendIdx["interpreter"]=1;
  46274. $recv($3)._context_(ctx);
  46275. $ctx1.sendIdx["context:"]=1;
  46276. $4=$recv(ctx)._interpreter();
  46277. $recv($4)._node_(ast);
  46278. $recv($4)._enterNode();
  46279. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  46280. $5=debugger_;
  46281. $recv($5)._proceed();
  46282. return $recv($5)._result();
  46283. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  46284. },
  46285. args: ["aString", "anObject", "aDictionary"],
  46286. 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",
  46287. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  46288. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  46289. }),
  46290. $globals.ASTDebuggerTest);
  46291. $core.addClass('InliningCodeGeneratorTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  46292. $core.addMethod(
  46293. $core.method({
  46294. selector: "codeGeneratorClass",
  46295. protocol: 'accessing',
  46296. fn: function (){
  46297. var self=this;
  46298. return $globals.InliningCodeGenerator;
  46299. },
  46300. args: [],
  46301. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  46302. referencedClasses: ["InliningCodeGenerator"],
  46303. messageSends: []
  46304. }),
  46305. $globals.InliningCodeGeneratorTest);
  46306. $core.addClass('ScopeVarTest', $globals.TestCase, [], 'Compiler-Tests');
  46307. $core.addMethod(
  46308. $core.method({
  46309. selector: "testClassRefVar",
  46310. protocol: 'tests',
  46311. fn: function (){
  46312. var self=this;
  46313. var node;
  46314. return $core.withContext(function($ctx1) {
  46315. var $1,$2;
  46316. $1=$recv($globals.VariableNode)._new();
  46317. $ctx1.sendIdx["new"]=1;
  46318. $recv($1)._value_("Object");
  46319. node=$recv($1)._yourself();
  46320. $2=$recv($globals.SemanticAnalyzer)._new();
  46321. $ctx1.sendIdx["new"]=2;
  46322. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  46323. $recv($2)._visit_(node);
  46324. self._assert_($recv($recv(node)._binding())._isClassRefVar());
  46325. return self;
  46326. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  46327. },
  46328. args: [],
  46329. 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",
  46330. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  46331. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  46332. }),
  46333. $globals.ScopeVarTest);
  46334. $core.addMethod(
  46335. $core.method({
  46336. selector: "testInstanceVar",
  46337. protocol: 'tests',
  46338. fn: function (){
  46339. var self=this;
  46340. var node,scope;
  46341. return $core.withContext(function($ctx1) {
  46342. var $1;
  46343. $1=$recv($globals.VariableNode)._new();
  46344. $ctx1.sendIdx["new"]=1;
  46345. $recv($1)._value_("bzzz");
  46346. node=$recv($1)._yourself();
  46347. scope=$recv($globals.MethodLexicalScope)._new();
  46348. $recv(scope)._addIVar_("bzzz");
  46349. self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  46350. return self;
  46351. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  46352. },
  46353. args: [],
  46354. 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",
  46355. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46356. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  46357. }),
  46358. $globals.ScopeVarTest);
  46359. $core.addMethod(
  46360. $core.method({
  46361. selector: "testPseudoVar",
  46362. protocol: 'tests',
  46363. fn: function (){
  46364. var self=this;
  46365. var node,pseudoVars;
  46366. return $core.withContext(function($ctx1) {
  46367. var $1;
  46368. pseudoVars=["self", "super", "true", "false", "nil"];
  46369. $recv(pseudoVars)._do_((function(each){
  46370. return $core.withContext(function($ctx2) {
  46371. $1=$recv($globals.VariableNode)._new();
  46372. $ctx2.sendIdx["new"]=1;
  46373. $recv($1)._value_(each);
  46374. node=$recv($1)._yourself();
  46375. node;
  46376. return self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  46377. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46378. }));
  46379. return self;
  46380. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  46381. },
  46382. args: [],
  46383. 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]",
  46384. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46385. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  46386. }),
  46387. $globals.ScopeVarTest);
  46388. $core.addMethod(
  46389. $core.method({
  46390. selector: "testTempVar",
  46391. protocol: 'tests',
  46392. fn: function (){
  46393. var self=this;
  46394. var node,scope;
  46395. return $core.withContext(function($ctx1) {
  46396. var $1;
  46397. $1=$recv($globals.VariableNode)._new();
  46398. $ctx1.sendIdx["new"]=1;
  46399. $recv($1)._value_("bzzz");
  46400. node=$recv($1)._yourself();
  46401. scope=$recv($globals.MethodLexicalScope)._new();
  46402. $recv(scope)._addTemp_("bzzz");
  46403. self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  46404. return self;
  46405. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  46406. },
  46407. args: [],
  46408. 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",
  46409. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46410. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  46411. }),
  46412. $globals.ScopeVarTest);
  46413. $core.addMethod(
  46414. $core.method({
  46415. selector: "testUnknownVar",
  46416. protocol: 'tests',
  46417. fn: function (){
  46418. var self=this;
  46419. var node;
  46420. return $core.withContext(function($ctx1) {
  46421. var $1;
  46422. $1=$recv($globals.VariableNode)._new();
  46423. $ctx1.sendIdx["new"]=1;
  46424. $recv($1)._value_("bzzz");
  46425. node=$recv($1)._yourself();
  46426. self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  46427. return self;
  46428. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  46429. },
  46430. args: [],
  46431. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  46432. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46433. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  46434. }),
  46435. $globals.ScopeVarTest);
  46436. $core.addClass('SemanticAnalyzerTest', $globals.TestCase, ['analyzer'], 'Compiler-Tests');
  46437. $core.addMethod(
  46438. $core.method({
  46439. selector: "setUp",
  46440. protocol: 'running',
  46441. fn: function (){
  46442. var self=this;
  46443. return $core.withContext(function($ctx1) {
  46444. self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  46445. return self;
  46446. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  46447. },
  46448. args: [],
  46449. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  46450. referencedClasses: ["SemanticAnalyzer", "Object"],
  46451. messageSends: ["on:"]
  46452. }),
  46453. $globals.SemanticAnalyzerTest);
  46454. $core.addMethod(
  46455. $core.method({
  46456. selector: "testAssignment",
  46457. protocol: 'tests',
  46458. fn: function (){
  46459. var self=this;
  46460. var src,ast;
  46461. return $core.withContext(function($ctx1) {
  46462. src="foo self := 1";
  46463. ast=$recv($globals.Smalltalk)._parse_(src);
  46464. self._should_raise_((function(){
  46465. return $core.withContext(function($ctx2) {
  46466. return $recv(self["@analyzer"])._visit_(ast);
  46467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46468. }),$globals.InvalidAssignmentError);
  46469. return self;
  46470. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46471. },
  46472. args: [],
  46473. 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",
  46474. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  46475. messageSends: ["parse:", "should:raise:", "visit:"]
  46476. }),
  46477. $globals.SemanticAnalyzerTest);
  46478. $core.addMethod(
  46479. $core.method({
  46480. selector: "testNonLocalReturn",
  46481. protocol: 'tests',
  46482. fn: function (){
  46483. var self=this;
  46484. var src,ast;
  46485. return $core.withContext(function($ctx1) {
  46486. src="foo | a | a + 1. ^ a";
  46487. ast=$recv($globals.Smalltalk)._parse_(src);
  46488. $recv(self["@analyzer"])._visit_(ast);
  46489. self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  46490. return self;
  46491. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46492. },
  46493. args: [],
  46494. 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",
  46495. referencedClasses: ["Smalltalk"],
  46496. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  46497. }),
  46498. $globals.SemanticAnalyzerTest);
  46499. $core.addMethod(
  46500. $core.method({
  46501. selector: "testNonLocalReturn2",
  46502. protocol: 'tests',
  46503. fn: function (){
  46504. var self=this;
  46505. var src,ast;
  46506. return $core.withContext(function($ctx1) {
  46507. src="foo | a | a + 1. [ [ ^ a] ]";
  46508. ast=$recv($globals.Smalltalk)._parse_(src);
  46509. $recv(self["@analyzer"])._visit_(ast);
  46510. self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  46511. return self;
  46512. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46513. },
  46514. args: [],
  46515. 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",
  46516. referencedClasses: ["Smalltalk"],
  46517. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  46518. }),
  46519. $globals.SemanticAnalyzerTest);
  46520. $core.addMethod(
  46521. $core.method({
  46522. selector: "testScope",
  46523. protocol: 'tests',
  46524. fn: function (){
  46525. var self=this;
  46526. var src,ast;
  46527. return $core.withContext(function($ctx1) {
  46528. var $4,$3,$2,$1;
  46529. src="foo | a | a + 1. [ | b | b := a ]";
  46530. ast=$recv($globals.Smalltalk)._parse_(src);
  46531. $recv(self["@analyzer"])._visit_(ast);
  46532. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  46533. $ctx1.sendIdx["dagChildren"]=1;
  46534. $3=$recv($4)._last();
  46535. $2=$recv($3)._scope();
  46536. $ctx1.sendIdx["scope"]=1;
  46537. $1=$recv($2).__eq_eq($recv(ast)._scope());
  46538. self._deny_($1);
  46539. return self;
  46540. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46541. },
  46542. args: [],
  46543. 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.",
  46544. referencedClasses: ["Smalltalk"],
  46545. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  46546. }),
  46547. $globals.SemanticAnalyzerTest);
  46548. $core.addMethod(
  46549. $core.method({
  46550. selector: "testScope2",
  46551. protocol: 'tests',
  46552. fn: function (){
  46553. var self=this;
  46554. var src,ast;
  46555. return $core.withContext(function($ctx1) {
  46556. var $8,$7,$6,$5,$4,$3,$2,$1;
  46557. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  46558. ast=$recv($globals.Smalltalk)._parse_(src);
  46559. $recv(self["@analyzer"])._visit_(ast);
  46560. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  46561. $ctx1.sendIdx["dagChildren"]=3;
  46562. $7=$recv($8)._last();
  46563. $6=$recv($7)._dagChildren();
  46564. $ctx1.sendIdx["dagChildren"]=2;
  46565. $5=$recv($6)._first();
  46566. $ctx1.sendIdx["first"]=2;
  46567. $4=$recv($5)._dagChildren();
  46568. $ctx1.sendIdx["dagChildren"]=1;
  46569. $3=$recv($4)._first();
  46570. $ctx1.sendIdx["first"]=1;
  46571. $2=$recv($3)._scope();
  46572. $ctx1.sendIdx["scope"]=1;
  46573. $1=$recv($2).__eq_eq($recv(ast)._scope());
  46574. self._deny_($1);
  46575. return self;
  46576. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46577. },
  46578. args: [],
  46579. 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.",
  46580. referencedClasses: ["Smalltalk"],
  46581. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  46582. }),
  46583. $globals.SemanticAnalyzerTest);
  46584. $core.addMethod(
  46585. $core.method({
  46586. selector: "testScopeLevel",
  46587. protocol: 'tests',
  46588. fn: function (){
  46589. var self=this;
  46590. var src,ast;
  46591. return $core.withContext(function($ctx1) {
  46592. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  46593. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  46594. ast=$recv($globals.Smalltalk)._parse_(src);
  46595. $recv(self["@analyzer"])._visit_(ast);
  46596. $2=$recv(ast)._scope();
  46597. $ctx1.sendIdx["scope"]=1;
  46598. $1=$recv($2)._scopeLevel();
  46599. $ctx1.sendIdx["scopeLevel"]=1;
  46600. self._assert_equals_($1,(1));
  46601. $ctx1.sendIdx["assert:equals:"]=1;
  46602. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  46603. $ctx1.sendIdx["dagChildren"]=3;
  46604. $9=$recv($10)._last();
  46605. $8=$recv($9)._dagChildren();
  46606. $ctx1.sendIdx["dagChildren"]=2;
  46607. $7=$recv($8)._first();
  46608. $ctx1.sendIdx["first"]=2;
  46609. $6=$recv($7)._dagChildren();
  46610. $ctx1.sendIdx["dagChildren"]=1;
  46611. $5=$recv($6)._first();
  46612. $ctx1.sendIdx["first"]=1;
  46613. $4=$recv($5)._scope();
  46614. $3=$recv($4)._scopeLevel();
  46615. self._assert_equals_($3,(3));
  46616. return self;
  46617. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46618. },
  46619. args: [],
  46620. 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",
  46621. referencedClasses: ["Smalltalk"],
  46622. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  46623. }),
  46624. $globals.SemanticAnalyzerTest);
  46625. $core.addMethod(
  46626. $core.method({
  46627. selector: "testUnknownVariables",
  46628. protocol: 'tests',
  46629. fn: function (){
  46630. var self=this;
  46631. var src,ast;
  46632. return $core.withContext(function($ctx1) {
  46633. src="foo | a | b + a";
  46634. ast=$recv($globals.Smalltalk)._parse_(src);
  46635. self._should_raise_((function(){
  46636. return $core.withContext(function($ctx2) {
  46637. return $recv(self["@analyzer"])._visit_(ast);
  46638. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46639. }),$globals.UnknownVariableError);
  46640. return self;
  46641. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46642. },
  46643. args: [],
  46644. 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",
  46645. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46646. messageSends: ["parse:", "should:raise:", "visit:"]
  46647. }),
  46648. $globals.SemanticAnalyzerTest);
  46649. $core.addMethod(
  46650. $core.method({
  46651. selector: "testUnknownVariablesWithScope",
  46652. protocol: 'tests',
  46653. fn: function (){
  46654. var self=this;
  46655. var src,ast;
  46656. return $core.withContext(function($ctx1) {
  46657. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  46658. ast=$recv($globals.Smalltalk)._parse_(src);
  46659. self._should_raise_((function(){
  46660. return $core.withContext(function($ctx2) {
  46661. return $recv(self["@analyzer"])._visit_(ast);
  46662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46663. }),$globals.UnknownVariableError);
  46664. return self;
  46665. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46666. },
  46667. args: [],
  46668. 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",
  46669. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46670. messageSends: ["parse:", "should:raise:", "visit:"]
  46671. }),
  46672. $globals.SemanticAnalyzerTest);
  46673. $core.addMethod(
  46674. $core.method({
  46675. selector: "testVariableShadowing",
  46676. protocol: 'tests',
  46677. fn: function (){
  46678. var self=this;
  46679. var src,ast;
  46680. return $core.withContext(function($ctx1) {
  46681. src="foo | a | a + 1";
  46682. ast=$recv($globals.Smalltalk)._parse_(src);
  46683. $recv(self["@analyzer"])._visit_(ast);
  46684. return self;
  46685. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46686. },
  46687. args: [],
  46688. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46689. referencedClasses: ["Smalltalk"],
  46690. messageSends: ["parse:", "visit:"]
  46691. }),
  46692. $globals.SemanticAnalyzerTest);
  46693. $core.addMethod(
  46694. $core.method({
  46695. selector: "testVariableShadowing2",
  46696. protocol: 'tests',
  46697. fn: function (){
  46698. var self=this;
  46699. var src,ast;
  46700. return $core.withContext(function($ctx1) {
  46701. src="foo | a | a + 1. [ | a | a := 2 ]";
  46702. ast=$recv($globals.Smalltalk)._parse_(src);
  46703. self._should_raise_((function(){
  46704. return $core.withContext(function($ctx2) {
  46705. return $recv(self["@analyzer"])._visit_(ast);
  46706. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46707. }),$globals.ShadowingVariableError);
  46708. return self;
  46709. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46710. },
  46711. args: [],
  46712. 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",
  46713. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  46714. messageSends: ["parse:", "should:raise:", "visit:"]
  46715. }),
  46716. $globals.SemanticAnalyzerTest);
  46717. $core.addMethod(
  46718. $core.method({
  46719. selector: "testVariableShadowing3",
  46720. protocol: 'tests',
  46721. fn: function (){
  46722. var self=this;
  46723. var src,ast;
  46724. return $core.withContext(function($ctx1) {
  46725. src="foo | a | a + 1. [ | b | b := 2 ]";
  46726. ast=$recv($globals.Smalltalk)._parse_(src);
  46727. $recv(self["@analyzer"])._visit_(ast);
  46728. return self;
  46729. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46730. },
  46731. args: [],
  46732. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46733. referencedClasses: ["Smalltalk"],
  46734. messageSends: ["parse:", "visit:"]
  46735. }),
  46736. $globals.SemanticAnalyzerTest);
  46737. $core.addMethod(
  46738. $core.method({
  46739. selector: "testVariableShadowing4",
  46740. protocol: 'tests',
  46741. fn: function (){
  46742. var self=this;
  46743. var src,ast;
  46744. return $core.withContext(function($ctx1) {
  46745. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  46746. ast=$recv($globals.Smalltalk)._parse_(src);
  46747. $recv(self["@analyzer"])._visit_(ast);
  46748. return self;
  46749. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46750. },
  46751. args: [],
  46752. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46753. referencedClasses: ["Smalltalk"],
  46754. messageSends: ["parse:", "visit:"]
  46755. }),
  46756. $globals.SemanticAnalyzerTest);
  46757. $core.addMethod(
  46758. $core.method({
  46759. selector: "testVariableShadowing5",
  46760. protocol: 'tests',
  46761. fn: function (){
  46762. var self=this;
  46763. var src,ast;
  46764. return $core.withContext(function($ctx1) {
  46765. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  46766. ast=$recv($globals.Smalltalk)._parse_(src);
  46767. self._should_raise_((function(){
  46768. return $core.withContext(function($ctx2) {
  46769. return $recv(self["@analyzer"])._visit_(ast);
  46770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46771. }),$globals.ShadowingVariableError);
  46772. return self;
  46773. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46774. },
  46775. args: [],
  46776. 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",
  46777. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  46778. messageSends: ["parse:", "should:raise:", "visit:"]
  46779. }),
  46780. $globals.SemanticAnalyzerTest);
  46781. $core.addMethod(
  46782. $core.method({
  46783. selector: "testVariablesLookup",
  46784. protocol: 'tests',
  46785. fn: function (){
  46786. var self=this;
  46787. var src,ast;
  46788. return $core.withContext(function($ctx1) {
  46789. 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;
  46790. src="foo | a | a + 1. [ | b | b := a ]";
  46791. ast=$recv($globals.Smalltalk)._parse_(src);
  46792. $recv(self["@analyzer"])._visit_(ast);
  46793. $7=$recv(ast)._dagChildren();
  46794. $ctx1.sendIdx["dagChildren"]=2;
  46795. $6=$recv($7)._first();
  46796. $ctx1.sendIdx["first"]=2;
  46797. $5=$recv($6)._dagChildren();
  46798. $ctx1.sendIdx["dagChildren"]=1;
  46799. $4=$recv($5)._first();
  46800. $ctx1.sendIdx["first"]=1;
  46801. $3=$recv($4)._receiver();
  46802. $ctx1.sendIdx["receiver"]=1;
  46803. $2=$recv($3)._binding();
  46804. $ctx1.sendIdx["binding"]=1;
  46805. $1=$recv($2)._isTempVar();
  46806. $ctx1.sendIdx["isTempVar"]=1;
  46807. self._assert_($1);
  46808. $ctx1.sendIdx["assert:"]=1;
  46809. $15=$recv(ast)._dagChildren();
  46810. $ctx1.sendIdx["dagChildren"]=4;
  46811. $14=$recv($15)._first();
  46812. $ctx1.sendIdx["first"]=4;
  46813. $13=$recv($14)._dagChildren();
  46814. $ctx1.sendIdx["dagChildren"]=3;
  46815. $12=$recv($13)._first();
  46816. $ctx1.sendIdx["first"]=3;
  46817. $11=$recv($12)._receiver();
  46818. $10=$recv($11)._binding();
  46819. $ctx1.sendIdx["binding"]=2;
  46820. $9=$recv($10)._scope();
  46821. $ctx1.sendIdx["scope"]=1;
  46822. $16=$recv(ast)._scope();
  46823. $ctx1.sendIdx["scope"]=2;
  46824. $8=$recv($9).__eq_eq($16);
  46825. $ctx1.sendIdx["=="]=1;
  46826. self._assert_($8);
  46827. $ctx1.sendIdx["assert:"]=2;
  46828. $27=$recv(ast)._dagChildren();
  46829. $ctx1.sendIdx["dagChildren"]=8;
  46830. $26=$recv($27)._first();
  46831. $ctx1.sendIdx["first"]=7;
  46832. $25=$recv($26)._dagChildren();
  46833. $ctx1.sendIdx["dagChildren"]=7;
  46834. $24=$recv($25)._last();
  46835. $ctx1.sendIdx["last"]=1;
  46836. $23=$recv($24)._dagChildren();
  46837. $ctx1.sendIdx["dagChildren"]=6;
  46838. $22=$recv($23)._first();
  46839. $ctx1.sendIdx["first"]=6;
  46840. $21=$recv($22)._dagChildren();
  46841. $ctx1.sendIdx["dagChildren"]=5;
  46842. $20=$recv($21)._first();
  46843. $ctx1.sendIdx["first"]=5;
  46844. $19=$recv($20)._left();
  46845. $ctx1.sendIdx["left"]=1;
  46846. $18=$recv($19)._binding();
  46847. $ctx1.sendIdx["binding"]=3;
  46848. $17=$recv($18)._isTempVar();
  46849. self._assert_($17);
  46850. $ctx1.sendIdx["assert:"]=3;
  46851. $39=$recv(ast)._dagChildren();
  46852. $ctx1.sendIdx["dagChildren"]=12;
  46853. $38=$recv($39)._first();
  46854. $ctx1.sendIdx["first"]=10;
  46855. $37=$recv($38)._dagChildren();
  46856. $ctx1.sendIdx["dagChildren"]=11;
  46857. $36=$recv($37)._last();
  46858. $ctx1.sendIdx["last"]=2;
  46859. $35=$recv($36)._dagChildren();
  46860. $ctx1.sendIdx["dagChildren"]=10;
  46861. $34=$recv($35)._first();
  46862. $ctx1.sendIdx["first"]=9;
  46863. $33=$recv($34)._dagChildren();
  46864. $ctx1.sendIdx["dagChildren"]=9;
  46865. $32=$recv($33)._first();
  46866. $ctx1.sendIdx["first"]=8;
  46867. $31=$recv($32)._left();
  46868. $30=$recv($31)._binding();
  46869. $29=$recv($30)._scope();
  46870. $ctx1.sendIdx["scope"]=3;
  46871. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  46872. $ctx1.sendIdx["dagChildren"]=13;
  46873. $41=$recv($42)._last();
  46874. $40=$recv($41)._scope();
  46875. $28=$recv($29).__eq_eq($40);
  46876. self._assert_($28);
  46877. return self;
  46878. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46879. },
  46880. args: [],
  46881. 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.",
  46882. referencedClasses: ["Smalltalk"],
  46883. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  46884. }),
  46885. $globals.SemanticAnalyzerTest);
  46886. $core.addClass('AISemanticAnalyzerTest', $globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
  46887. $core.addMethod(
  46888. $core.method({
  46889. selector: "setUp",
  46890. protocol: 'running',
  46891. fn: function (){
  46892. var self=this;
  46893. return $core.withContext(function($ctx1) {
  46894. var $1,$3,$4,$2;
  46895. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  46896. $3=$recv($globals.AIContext)._new();
  46897. $recv($3)._defineLocal_("local");
  46898. $recv($3)._localAt_put_("local",(3));
  46899. $4=$recv($3)._yourself();
  46900. $ctx1.sendIdx["yourself"]=1;
  46901. $2=$4;
  46902. $recv($1)._context_($2);
  46903. self["@analyzer"]=$recv($1)._yourself();
  46904. return self;
  46905. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  46906. },
  46907. args: [],
  46908. 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",
  46909. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  46910. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  46911. }),
  46912. $globals.AISemanticAnalyzerTest);
  46913. $core.addMethod(
  46914. $core.method({
  46915. selector: "testContextVariables",
  46916. protocol: 'tests',
  46917. fn: function (){
  46918. var self=this;
  46919. var src,ast;
  46920. return $core.withContext(function($ctx1) {
  46921. src="foo | a | local + a";
  46922. ast=$recv($globals.Smalltalk)._parse_(src);
  46923. self._shouldnt_raise_((function(){
  46924. return $core.withContext(function($ctx2) {
  46925. return $recv(self["@analyzer"])._visit_(ast);
  46926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46927. }),$globals.UnknownVariableError);
  46928. return self;
  46929. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  46930. },
  46931. args: [],
  46932. 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",
  46933. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46934. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  46935. }),
  46936. $globals.AISemanticAnalyzerTest);
  46937. });
  46938. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  46939. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  46940. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  46941. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  46942. $core.addPackage('Kernel-Tests');
  46943. $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  46944. $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46945. $core.addClass('AnnouncementSubscriptionTest', $globals.TestCase, [], 'Kernel-Tests');
  46946. $core.addMethod(
  46947. $core.method({
  46948. selector: "testAddExtensionMethod",
  46949. protocol: 'tests',
  46950. fn: function (){
  46951. var self=this;
  46952. var method,dirty;
  46953. return $core.withContext(function($ctx1) {
  46954. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  46955. $2=self._class();
  46956. $ctx1.sendIdx["class"]=1;
  46957. $1=$recv($2)._package();
  46958. $ctx1.sendIdx["package"]=1;
  46959. dirty=$recv($1)._isDirty();
  46960. $ctx1.sendIdx["isDirty"]=1;
  46961. $4=self._class();
  46962. $ctx1.sendIdx["class"]=2;
  46963. $3=$recv($4)._package();
  46964. $ctx1.sendIdx["package"]=2;
  46965. $recv($3)._beClean();
  46966. $5=self._class();
  46967. $ctx1.sendIdx["class"]=3;
  46968. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  46969. $8=self._class();
  46970. $ctx1.sendIdx["class"]=4;
  46971. $7=$recv($8)._package();
  46972. $ctx1.sendIdx["package"]=3;
  46973. $6=$recv($7)._isDirty();
  46974. self._deny_($6);
  46975. $9=self._class();
  46976. $ctx1.sendIdx["class"]=5;
  46977. $recv($9)._removeCompiledMethod_(method);
  46978. $10=dirty;
  46979. if($core.assert($10)){
  46980. $recv($recv(self._class())._package())._beDirty();
  46981. };
  46982. return self;
  46983. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  46984. },
  46985. args: [],
  46986. 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 ]",
  46987. referencedClasses: [],
  46988. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  46989. }),
  46990. $globals.AnnouncementSubscriptionTest);
  46991. $core.addMethod(
  46992. $core.method({
  46993. selector: "testHandlesAnnouncement",
  46994. protocol: 'tests',
  46995. fn: function (){
  46996. var self=this;
  46997. var subscription,announcementClass1,announcementClass2,classBuilder;
  46998. return $core.withContext(function($ctx1) {
  46999. var $1,$2;
  47000. classBuilder=$recv($globals.ClassBuilder)._new();
  47001. $ctx1.sendIdx["new"]=1;
  47002. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  47003. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  47004. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  47005. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  47006. self._assert_equals_($1,true);
  47007. $ctx1.sendIdx["assert:equals:"]=1;
  47008. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  47009. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  47010. self._assert_equals_($2,true);
  47011. $ctx1.sendIdx["assert:equals:"]=2;
  47012. self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  47013. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  47014. return self;
  47015. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  47016. },
  47017. args: [],
  47018. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  47019. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  47020. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  47021. }),
  47022. $globals.AnnouncementSubscriptionTest);
  47023. $core.addClass('AnnouncerTest', $globals.TestCase, [], 'Kernel-Tests');
  47024. $core.addMethod(
  47025. $core.method({
  47026. selector: "testOnDo",
  47027. protocol: 'tests',
  47028. fn: function (){
  47029. var self=this;
  47030. var counter,announcer;
  47031. return $core.withContext(function($ctx1) {
  47032. var $1,$2;
  47033. counter=(0);
  47034. announcer=$recv($globals.Announcer)._new();
  47035. $ctx1.sendIdx["new"]=1;
  47036. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  47037. return $core.withContext(function($ctx2) {
  47038. counter=$recv(counter).__plus((1));
  47039. return counter;
  47040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47041. }));
  47042. $1=announcer;
  47043. $2=$recv($globals.SystemAnnouncement)._new();
  47044. $ctx1.sendIdx["new"]=2;
  47045. $recv($1)._announce_($2);
  47046. $ctx1.sendIdx["announce:"]=1;
  47047. self._assert_equals_(counter,(1));
  47048. $ctx1.sendIdx["assert:equals:"]=1;
  47049. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47050. self._assert_equals_(counter,(2));
  47051. return self;
  47052. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47053. },
  47054. args: [],
  47055. 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.",
  47056. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47057. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  47058. }),
  47059. $globals.AnnouncerTest);
  47060. $core.addMethod(
  47061. $core.method({
  47062. selector: "testOnDoFor",
  47063. protocol: 'tests',
  47064. fn: function (){
  47065. var self=this;
  47066. var counter,announcer;
  47067. return $core.withContext(function($ctx1) {
  47068. var $1,$2,$3,$4;
  47069. counter=(0);
  47070. announcer=$recv($globals.Announcer)._new();
  47071. $ctx1.sendIdx["new"]=1;
  47072. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  47073. return $core.withContext(function($ctx2) {
  47074. counter=$recv(counter).__plus((1));
  47075. return counter;
  47076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47077. }),self);
  47078. $1=announcer;
  47079. $2=$recv($globals.SystemAnnouncement)._new();
  47080. $ctx1.sendIdx["new"]=2;
  47081. $recv($1)._announce_($2);
  47082. $ctx1.sendIdx["announce:"]=1;
  47083. self._assert_equals_(counter,(1));
  47084. $ctx1.sendIdx["assert:equals:"]=1;
  47085. $3=announcer;
  47086. $4=$recv($globals.SystemAnnouncement)._new();
  47087. $ctx1.sendIdx["new"]=3;
  47088. $recv($3)._announce_($4);
  47089. $ctx1.sendIdx["announce:"]=2;
  47090. self._assert_equals_(counter,(2));
  47091. $ctx1.sendIdx["assert:equals:"]=2;
  47092. $recv(announcer)._unsubscribe_(self);
  47093. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47094. self._assert_equals_(counter,(2));
  47095. return self;
  47096. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47097. },
  47098. args: [],
  47099. 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.",
  47100. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47101. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  47102. }),
  47103. $globals.AnnouncerTest);
  47104. $core.addMethod(
  47105. $core.method({
  47106. selector: "testOnDoOnce",
  47107. protocol: 'tests',
  47108. fn: function (){
  47109. var self=this;
  47110. var counter,announcer;
  47111. return $core.withContext(function($ctx1) {
  47112. var $1,$2;
  47113. counter=(0);
  47114. announcer=$recv($globals.Announcer)._new();
  47115. $ctx1.sendIdx["new"]=1;
  47116. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  47117. return $core.withContext(function($ctx2) {
  47118. counter=$recv(counter).__plus((1));
  47119. return counter;
  47120. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47121. }));
  47122. $1=announcer;
  47123. $2=$recv($globals.SystemAnnouncement)._new();
  47124. $ctx1.sendIdx["new"]=2;
  47125. $recv($1)._announce_($2);
  47126. $ctx1.sendIdx["announce:"]=1;
  47127. self._assert_equals_(counter,(1));
  47128. $ctx1.sendIdx["assert:equals:"]=1;
  47129. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47130. self._assert_equals_(counter,(1));
  47131. return self;
  47132. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47133. },
  47134. args: [],
  47135. 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.",
  47136. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47137. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  47138. }),
  47139. $globals.AnnouncerTest);
  47140. $core.addClass('BlockClosureTest', $globals.TestCase, [], 'Kernel-Tests');
  47141. $core.addMethod(
  47142. $core.method({
  47143. selector: "localReturnOnDoCatch",
  47144. protocol: 'fixture',
  47145. fn: function (){
  47146. var self=this;
  47147. return $core.withContext(function($ctx1) {
  47148. var $early={};
  47149. try {
  47150. $recv((function(){
  47151. throw $early=[(2)];
  47152. }))._on_do_($globals.Error,(function(){
  47153. }));
  47154. return (3);
  47155. }
  47156. catch(e) {if(e===$early)return e[0]; throw e}
  47157. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  47158. },
  47159. args: [],
  47160. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  47161. referencedClasses: ["Error"],
  47162. messageSends: ["on:do:"]
  47163. }),
  47164. $globals.BlockClosureTest);
  47165. $core.addMethod(
  47166. $core.method({
  47167. selector: "localReturnOnDoMiss",
  47168. protocol: 'fixture',
  47169. fn: function (){
  47170. var self=this;
  47171. return $core.withContext(function($ctx1) {
  47172. var $early={};
  47173. try {
  47174. $recv((function(){
  47175. throw $early=[(2)];
  47176. }))._on_do_($globals.Class,(function(){
  47177. }));
  47178. return (3);
  47179. }
  47180. catch(e) {if(e===$early)return e[0]; throw e}
  47181. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  47182. },
  47183. args: [],
  47184. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  47185. referencedClasses: ["Class"],
  47186. messageSends: ["on:do:"]
  47187. }),
  47188. $globals.BlockClosureTest);
  47189. $core.addMethod(
  47190. $core.method({
  47191. selector: "testCanClearInterval",
  47192. protocol: 'tests',
  47193. fn: function (){
  47194. var self=this;
  47195. return $core.withContext(function($ctx1) {
  47196. self._shouldnt_raise_((function(){
  47197. return $core.withContext(function($ctx2) {
  47198. return $recv($recv((function(){
  47199. return $core.withContext(function($ctx3) {
  47200. return $recv($recv($globals.Error)._new())._signal();
  47201. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47202. }))._valueWithInterval_((0)))._clearInterval();
  47203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47204. }),$globals.Error);
  47205. return self;
  47206. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  47207. },
  47208. args: [],
  47209. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  47210. referencedClasses: ["Error"],
  47211. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  47212. }),
  47213. $globals.BlockClosureTest);
  47214. $core.addMethod(
  47215. $core.method({
  47216. selector: "testCanClearTimeout",
  47217. protocol: 'tests',
  47218. fn: function (){
  47219. var self=this;
  47220. return $core.withContext(function($ctx1) {
  47221. self._shouldnt_raise_((function(){
  47222. return $core.withContext(function($ctx2) {
  47223. return $recv($recv((function(){
  47224. return $core.withContext(function($ctx3) {
  47225. return $recv($recv($globals.Error)._new())._signal();
  47226. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47227. }))._valueWithTimeout_((0)))._clearTimeout();
  47228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47229. }),$globals.Error);
  47230. return self;
  47231. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  47232. },
  47233. args: [],
  47234. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  47235. referencedClasses: ["Error"],
  47236. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  47237. }),
  47238. $globals.BlockClosureTest);
  47239. $core.addMethod(
  47240. $core.method({
  47241. selector: "testCompiledSource",
  47242. protocol: 'tests',
  47243. fn: function (){
  47244. var self=this;
  47245. return $core.withContext(function($ctx1) {
  47246. self._assert_($recv($recv((function(){
  47247. return $core.withContext(function($ctx2) {
  47248. return (1).__plus((1));
  47249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47250. }))._compiledSource())._includesSubString_("function"));
  47251. return self;
  47252. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  47253. },
  47254. args: [],
  47255. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  47256. referencedClasses: [],
  47257. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  47258. }),
  47259. $globals.BlockClosureTest);
  47260. $core.addMethod(
  47261. $core.method({
  47262. selector: "testCurrySelf",
  47263. protocol: 'tests',
  47264. fn: function (){
  47265. var self=this;
  47266. var curriedMethod,array;
  47267. return $core.withContext(function($ctx1) {
  47268. curriedMethod=$recv($recv((function(selfarg,x){
  47269. return $core.withContext(function($ctx2) {
  47270. return $recv(selfarg)._at_(x);
  47271. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  47272. }))._currySelf())._asCompiledMethod_("foo:");
  47273. array=[(3), (1), (4)];
  47274. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  47275. $recv((function(){
  47276. return $core.withContext(function($ctx2) {
  47277. return self._assert_equals_($recv(array)._foo_((2)),(1));
  47278. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47279. }))._ensure_((function(){
  47280. return $core.withContext(function($ctx2) {
  47281. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  47282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47283. }));
  47284. return self;
  47285. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  47286. },
  47287. args: [],
  47288. 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 ]",
  47289. referencedClasses: ["ClassBuilder", "Array"],
  47290. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  47291. }),
  47292. $globals.BlockClosureTest);
  47293. $core.addMethod(
  47294. $core.method({
  47295. selector: "testEnsure",
  47296. protocol: 'tests',
  47297. fn: function (){
  47298. var self=this;
  47299. return $core.withContext(function($ctx1) {
  47300. self._assert_equals_($recv((function(){
  47301. return (3);
  47302. }))._ensure_((function(){
  47303. return (4);
  47304. })),(3));
  47305. return self;
  47306. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  47307. },
  47308. args: [],
  47309. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  47310. referencedClasses: [],
  47311. messageSends: ["assert:equals:", "ensure:"]
  47312. }),
  47313. $globals.BlockClosureTest);
  47314. $core.addMethod(
  47315. $core.method({
  47316. selector: "testEnsureRaises",
  47317. protocol: 'tests',
  47318. fn: function (){
  47319. var self=this;
  47320. return $core.withContext(function($ctx1) {
  47321. self._should_raise_((function(){
  47322. return $core.withContext(function($ctx2) {
  47323. return $recv((function(){
  47324. return $core.withContext(function($ctx3) {
  47325. return $recv($recv($globals.Error)._new())._signal();
  47326. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47327. }))._ensure_((function(){
  47328. return true;
  47329. }));
  47330. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47331. }),$globals.Error);
  47332. return self;
  47333. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  47334. },
  47335. args: [],
  47336. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  47337. referencedClasses: ["Error"],
  47338. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  47339. }),
  47340. $globals.BlockClosureTest);
  47341. $core.addMethod(
  47342. $core.method({
  47343. selector: "testExceptionSemantics",
  47344. protocol: 'tests',
  47345. fn: function (){
  47346. var self=this;
  47347. return $core.withContext(function($ctx1) {
  47348. self._timeout_((100));
  47349. $recv(self._async_((function(){
  47350. return $core.withContext(function($ctx2) {
  47351. return $recv((function(){
  47352. return $core.withContext(function($ctx3) {
  47353. self._assert_(true);
  47354. $recv($globals.Error)._signal();
  47355. self._deny_(true);
  47356. return self._finished();
  47357. $ctx3.sendIdx["finished"]=1;
  47358. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47359. }))._on_do_($globals.Error,(function(ex){
  47360. return $core.withContext(function($ctx3) {
  47361. return self._finished();
  47362. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  47363. }));
  47364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47365. })))._valueWithTimeout_((0));
  47366. return self;
  47367. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  47368. },
  47369. args: [],
  47370. 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",
  47371. referencedClasses: ["Error"],
  47372. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  47373. }),
  47374. $globals.BlockClosureTest);
  47375. $core.addMethod(
  47376. $core.method({
  47377. selector: "testLocalReturnOnDoCatch",
  47378. protocol: 'tests',
  47379. fn: function (){
  47380. var self=this;
  47381. return $core.withContext(function($ctx1) {
  47382. self._assert_equals_(self._localReturnOnDoCatch(),(2));
  47383. return self;
  47384. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  47385. },
  47386. args: [],
  47387. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  47388. referencedClasses: [],
  47389. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  47390. }),
  47391. $globals.BlockClosureTest);
  47392. $core.addMethod(
  47393. $core.method({
  47394. selector: "testLocalReturnOnDoMiss",
  47395. protocol: 'tests',
  47396. fn: function (){
  47397. var self=this;
  47398. return $core.withContext(function($ctx1) {
  47399. self._assert_equals_(self._localReturnOnDoMiss(),(2));
  47400. return self;
  47401. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  47402. },
  47403. args: [],
  47404. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  47405. referencedClasses: [],
  47406. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  47407. }),
  47408. $globals.BlockClosureTest);
  47409. $core.addMethod(
  47410. $core.method({
  47411. selector: "testNewWithValues",
  47412. protocol: 'tests',
  47413. fn: function (){
  47414. var self=this;
  47415. return $core.withContext(function($ctx1) {
  47416. function TestConstructor(arg1, arg2, arg3) {}
  47417. TestConstructor.prototype.name = "theTestPrototype";
  47418. var wrappedConstructor = $recv(TestConstructor);
  47419. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  47420. self._assert_(result instanceof TestConstructor);
  47421. self._assert_equals_(result.name, "theTestPrototype");
  47422. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  47423. self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  47424. return self;
  47425. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  47426. },
  47427. args: [],
  47428. 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\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._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\x09self._should_raise_(function () {wrappedConstructor._newWithValues_(\x22single argument\x22);}, $globals.Error);\x0a'>",
  47429. referencedClasses: [],
  47430. messageSends: []
  47431. }),
  47432. $globals.BlockClosureTest);
  47433. $core.addMethod(
  47434. $core.method({
  47435. selector: "testNumArgs",
  47436. protocol: 'tests',
  47437. fn: function (){
  47438. var self=this;
  47439. return $core.withContext(function($ctx1) {
  47440. var $1;
  47441. $1=$recv((function(){
  47442. }))._numArgs();
  47443. $ctx1.sendIdx["numArgs"]=1;
  47444. self._assert_equals_($1,(0));
  47445. $ctx1.sendIdx["assert:equals:"]=1;
  47446. self._assert_equals_($recv((function(a,b){
  47447. }))._numArgs(),(2));
  47448. return self;
  47449. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  47450. },
  47451. args: [],
  47452. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  47453. referencedClasses: [],
  47454. messageSends: ["assert:equals:", "numArgs"]
  47455. }),
  47456. $globals.BlockClosureTest);
  47457. $core.addMethod(
  47458. $core.method({
  47459. selector: "testOnDo",
  47460. protocol: 'tests',
  47461. fn: function (){
  47462. var self=this;
  47463. return $core.withContext(function($ctx1) {
  47464. self._assert_($recv((function(){
  47465. return $core.withContext(function($ctx2) {
  47466. return $recv($recv($globals.Error)._new())._signal();
  47467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47468. }))._on_do_($globals.Error,(function(ex){
  47469. return true;
  47470. })));
  47471. return self;
  47472. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  47473. },
  47474. args: [],
  47475. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  47476. referencedClasses: ["Error"],
  47477. messageSends: ["assert:", "on:do:", "signal", "new"]
  47478. }),
  47479. $globals.BlockClosureTest);
  47480. $core.addMethod(
  47481. $core.method({
  47482. selector: "testValue",
  47483. protocol: 'tests',
  47484. fn: function (){
  47485. var self=this;
  47486. return $core.withContext(function($ctx1) {
  47487. var $1;
  47488. $1=$recv((function(){
  47489. return $core.withContext(function($ctx2) {
  47490. return (1).__plus((1));
  47491. $ctx2.sendIdx["+"]=1;
  47492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47493. }))._value();
  47494. $ctx1.sendIdx["value"]=1;
  47495. self._assert_equals_($1,(2));
  47496. $ctx1.sendIdx["assert:equals:"]=1;
  47497. self._assert_equals_($recv((function(x){
  47498. return $core.withContext(function($ctx2) {
  47499. return $recv(x).__plus((1));
  47500. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  47501. }))._value_((2)),(3));
  47502. $ctx1.sendIdx["assert:equals:"]=2;
  47503. self._assert_equals_($recv((function(x,y){
  47504. return $core.withContext(function($ctx2) {
  47505. return $recv(x).__star(y);
  47506. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  47507. }))._value_value_((2),(4)),(8));
  47508. $ctx1.sendIdx["assert:equals:"]=3;
  47509. self._assert_equals_($recv((function(a,b,c){
  47510. return (1);
  47511. }))._value(),(1));
  47512. return self;
  47513. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  47514. },
  47515. args: [],
  47516. 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",
  47517. referencedClasses: [],
  47518. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  47519. }),
  47520. $globals.BlockClosureTest);
  47521. $core.addMethod(
  47522. $core.method({
  47523. selector: "testValueWithPossibleArguments",
  47524. protocol: 'tests',
  47525. fn: function (){
  47526. var self=this;
  47527. return $core.withContext(function($ctx1) {
  47528. var $1,$2;
  47529. $1=$recv((function(){
  47530. return (1);
  47531. }))._valueWithPossibleArguments_([(3), (4)]);
  47532. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  47533. self._assert_equals_($1,(1));
  47534. $ctx1.sendIdx["assert:equals:"]=1;
  47535. $2=$recv((function(a){
  47536. return $core.withContext(function($ctx2) {
  47537. return $recv(a).__plus((4));
  47538. $ctx2.sendIdx["+"]=1;
  47539. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  47540. }))._valueWithPossibleArguments_([(3), (4)]);
  47541. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  47542. self._assert_equals_($2,(7));
  47543. $ctx1.sendIdx["assert:equals:"]=2;
  47544. self._assert_equals_($recv((function(a,b){
  47545. return $core.withContext(function($ctx2) {
  47546. return $recv(a).__plus(b);
  47547. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  47548. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  47549. return self;
  47550. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  47551. },
  47552. args: [],
  47553. 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.",
  47554. referencedClasses: [],
  47555. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  47556. }),
  47557. $globals.BlockClosureTest);
  47558. $core.addMethod(
  47559. $core.method({
  47560. selector: "testWhileFalse",
  47561. protocol: 'tests',
  47562. fn: function (){
  47563. var self=this;
  47564. var i;
  47565. return $core.withContext(function($ctx1) {
  47566. i=(0);
  47567. $recv((function(){
  47568. return $core.withContext(function($ctx2) {
  47569. return $recv(i).__gt((5));
  47570. $ctx2.sendIdx[">"]=1;
  47571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47572. }))._whileFalse_((function(){
  47573. return $core.withContext(function($ctx2) {
  47574. i=$recv(i).__plus((1));
  47575. $ctx2.sendIdx["+"]=1;
  47576. return i;
  47577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47578. }));
  47579. self._assert_equals_(i,(6));
  47580. $ctx1.sendIdx["assert:equals:"]=1;
  47581. i=(0);
  47582. $recv((function(){
  47583. return $core.withContext(function($ctx2) {
  47584. i=$recv(i).__plus((1));
  47585. i;
  47586. return $recv(i).__gt((5));
  47587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47588. }))._whileFalse();
  47589. self._assert_equals_(i,(6));
  47590. return self;
  47591. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  47592. },
  47593. args: [],
  47594. 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",
  47595. referencedClasses: [],
  47596. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  47597. }),
  47598. $globals.BlockClosureTest);
  47599. $core.addMethod(
  47600. $core.method({
  47601. selector: "testWhileTrue",
  47602. protocol: 'tests',
  47603. fn: function (){
  47604. var self=this;
  47605. var i;
  47606. return $core.withContext(function($ctx1) {
  47607. i=(0);
  47608. $recv((function(){
  47609. return $core.withContext(function($ctx2) {
  47610. return $recv(i).__lt((5));
  47611. $ctx2.sendIdx["<"]=1;
  47612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47613. }))._whileTrue_((function(){
  47614. return $core.withContext(function($ctx2) {
  47615. i=$recv(i).__plus((1));
  47616. $ctx2.sendIdx["+"]=1;
  47617. return i;
  47618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47619. }));
  47620. self._assert_equals_(i,(5));
  47621. $ctx1.sendIdx["assert:equals:"]=1;
  47622. i=(0);
  47623. $recv((function(){
  47624. return $core.withContext(function($ctx2) {
  47625. i=$recv(i).__plus((1));
  47626. i;
  47627. return $recv(i).__lt((5));
  47628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47629. }))._whileTrue();
  47630. self._assert_equals_(i,(5));
  47631. return self;
  47632. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  47633. },
  47634. args: [],
  47635. 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",
  47636. referencedClasses: [],
  47637. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  47638. }),
  47639. $globals.BlockClosureTest);
  47640. $core.addClass('BooleanTest', $globals.TestCase, [], 'Kernel-Tests');
  47641. $core.addMethod(
  47642. $core.method({
  47643. selector: "testEquality",
  47644. protocol: 'tests',
  47645. fn: function (){
  47646. var self=this;
  47647. return $core.withContext(function($ctx1) {
  47648. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  47649. $1=(0).__eq(false);
  47650. $ctx1.sendIdx["="]=1;
  47651. self._deny_($1);
  47652. $ctx1.sendIdx["deny:"]=1;
  47653. $2=false.__eq((0));
  47654. $ctx1.sendIdx["="]=2;
  47655. self._deny_($2);
  47656. $ctx1.sendIdx["deny:"]=2;
  47657. $3="".__eq(false);
  47658. $ctx1.sendIdx["="]=3;
  47659. self._deny_($3);
  47660. $ctx1.sendIdx["deny:"]=3;
  47661. $4=false.__eq("");
  47662. $ctx1.sendIdx["="]=4;
  47663. self._deny_($4);
  47664. $ctx1.sendIdx["deny:"]=4;
  47665. $5=true.__eq(true);
  47666. $ctx1.sendIdx["="]=5;
  47667. self._assert_($5);
  47668. $ctx1.sendIdx["assert:"]=1;
  47669. $6=false.__eq(true);
  47670. $ctx1.sendIdx["="]=6;
  47671. self._deny_($6);
  47672. $ctx1.sendIdx["deny:"]=5;
  47673. $7=true.__eq(false);
  47674. $ctx1.sendIdx["="]=7;
  47675. self._deny_($7);
  47676. $8=false.__eq(false);
  47677. $ctx1.sendIdx["="]=8;
  47678. self._assert_($8);
  47679. $ctx1.sendIdx["assert:"]=2;
  47680. $10=true._yourself();
  47681. $ctx1.sendIdx["yourself"]=1;
  47682. $9=$recv($10).__eq(true);
  47683. $ctx1.sendIdx["="]=9;
  47684. self._assert_($9);
  47685. $ctx1.sendIdx["assert:"]=3;
  47686. $12=true._yourself();
  47687. $ctx1.sendIdx["yourself"]=2;
  47688. $11=$recv($12).__eq(true._yourself());
  47689. self._assert_($11);
  47690. return self;
  47691. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  47692. },
  47693. args: [],
  47694. 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)",
  47695. referencedClasses: [],
  47696. messageSends: ["deny:", "=", "assert:", "yourself"]
  47697. }),
  47698. $globals.BooleanTest);
  47699. $core.addMethod(
  47700. $core.method({
  47701. selector: "testIdentity",
  47702. protocol: 'tests',
  47703. fn: function (){
  47704. var self=this;
  47705. return $core.withContext(function($ctx1) {
  47706. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  47707. $1=(0).__eq_eq(false);
  47708. $ctx1.sendIdx["=="]=1;
  47709. self._deny_($1);
  47710. $ctx1.sendIdx["deny:"]=1;
  47711. $2=false.__eq_eq((0));
  47712. $ctx1.sendIdx["=="]=2;
  47713. self._deny_($2);
  47714. $ctx1.sendIdx["deny:"]=2;
  47715. $3="".__eq_eq(false);
  47716. $ctx1.sendIdx["=="]=3;
  47717. self._deny_($3);
  47718. $ctx1.sendIdx["deny:"]=3;
  47719. $4=false.__eq_eq("");
  47720. $ctx1.sendIdx["=="]=4;
  47721. self._deny_($4);
  47722. $ctx1.sendIdx["deny:"]=4;
  47723. $5=true.__eq_eq(true);
  47724. $ctx1.sendIdx["=="]=5;
  47725. self._assert_($5);
  47726. $ctx1.sendIdx["assert:"]=1;
  47727. $6=false.__eq_eq(true);
  47728. $ctx1.sendIdx["=="]=6;
  47729. self._deny_($6);
  47730. $ctx1.sendIdx["deny:"]=5;
  47731. $7=true.__eq_eq(false);
  47732. $ctx1.sendIdx["=="]=7;
  47733. self._deny_($7);
  47734. $8=false.__eq_eq(false);
  47735. $ctx1.sendIdx["=="]=8;
  47736. self._assert_($8);
  47737. $ctx1.sendIdx["assert:"]=2;
  47738. $10=true._yourself();
  47739. $ctx1.sendIdx["yourself"]=1;
  47740. $9=$recv($10).__eq_eq(true);
  47741. $ctx1.sendIdx["=="]=9;
  47742. self._assert_($9);
  47743. $ctx1.sendIdx["assert:"]=3;
  47744. $12=true._yourself();
  47745. $ctx1.sendIdx["yourself"]=2;
  47746. $11=$recv($12).__eq_eq(true._yourself());
  47747. self._assert_($11);
  47748. return self;
  47749. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  47750. },
  47751. args: [],
  47752. 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",
  47753. referencedClasses: [],
  47754. messageSends: ["deny:", "==", "assert:", "yourself"]
  47755. }),
  47756. $globals.BooleanTest);
  47757. $core.addMethod(
  47758. $core.method({
  47759. selector: "testIfTrueIfFalse",
  47760. protocol: 'tests',
  47761. fn: function (){
  47762. var self=this;
  47763. return $core.withContext(function($ctx1) {
  47764. var $1,$2,$3,$4,$5,$6,$7,$8;
  47765. if($core.assert(true)){
  47766. $1="alternative block";
  47767. };
  47768. self._assert_equals_($1,"alternative block");
  47769. $ctx1.sendIdx["assert:equals:"]=1;
  47770. if(!$core.assert(true)){
  47771. $2="alternative block";
  47772. };
  47773. self._assert_equals_($2,nil);
  47774. $ctx1.sendIdx["assert:equals:"]=2;
  47775. if($core.assert(false)){
  47776. $3="alternative block";
  47777. };
  47778. self._assert_equals_($3,nil);
  47779. $ctx1.sendIdx["assert:equals:"]=3;
  47780. if(!$core.assert(false)){
  47781. $4="alternative block";
  47782. };
  47783. self._assert_equals_($4,"alternative block");
  47784. $ctx1.sendIdx["assert:equals:"]=4;
  47785. if($core.assert(false)){
  47786. $5="alternative block";
  47787. } else {
  47788. $5="alternative block2";
  47789. };
  47790. self._assert_equals_($5,"alternative block2");
  47791. $ctx1.sendIdx["assert:equals:"]=5;
  47792. if($core.assert(false)){
  47793. $6="alternative block2";
  47794. } else {
  47795. $6="alternative block";
  47796. };
  47797. self._assert_equals_($6,"alternative block");
  47798. $ctx1.sendIdx["assert:equals:"]=6;
  47799. if($core.assert(true)){
  47800. $7="alternative block";
  47801. } else {
  47802. $7="alternative block2";
  47803. };
  47804. self._assert_equals_($7,"alternative block");
  47805. $ctx1.sendIdx["assert:equals:"]=7;
  47806. if($core.assert(true)){
  47807. $8="alternative block2";
  47808. } else {
  47809. $8="alternative block";
  47810. };
  47811. self._assert_equals_($8,"alternative block2");
  47812. return self;
  47813. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  47814. },
  47815. args: [],
  47816. 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'.",
  47817. referencedClasses: [],
  47818. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  47819. }),
  47820. $globals.BooleanTest);
  47821. $core.addMethod(
  47822. $core.method({
  47823. selector: "testIfTrueIfFalseWithBoxing",
  47824. protocol: 'tests',
  47825. fn: function (){
  47826. var self=this;
  47827. return $core.withContext(function($ctx1) {
  47828. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  47829. $2=true._yourself();
  47830. $ctx1.sendIdx["yourself"]=1;
  47831. if($core.assert($2)){
  47832. $1="alternative block";
  47833. };
  47834. self._assert_equals_($1,"alternative block");
  47835. $ctx1.sendIdx["assert:equals:"]=1;
  47836. $4=true._yourself();
  47837. $ctx1.sendIdx["yourself"]=2;
  47838. if(!$core.assert($4)){
  47839. $3="alternative block";
  47840. };
  47841. self._assert_equals_($3,nil);
  47842. $ctx1.sendIdx["assert:equals:"]=2;
  47843. $6=false._yourself();
  47844. $ctx1.sendIdx["yourself"]=3;
  47845. if($core.assert($6)){
  47846. $5="alternative block";
  47847. };
  47848. self._assert_equals_($5,nil);
  47849. $ctx1.sendIdx["assert:equals:"]=3;
  47850. $8=false._yourself();
  47851. $ctx1.sendIdx["yourself"]=4;
  47852. if(!$core.assert($8)){
  47853. $7="alternative block";
  47854. };
  47855. self._assert_equals_($7,"alternative block");
  47856. $ctx1.sendIdx["assert:equals:"]=4;
  47857. $10=false._yourself();
  47858. $ctx1.sendIdx["yourself"]=5;
  47859. if($core.assert($10)){
  47860. $9="alternative block";
  47861. } else {
  47862. $9="alternative block2";
  47863. };
  47864. self._assert_equals_($9,"alternative block2");
  47865. $ctx1.sendIdx["assert:equals:"]=5;
  47866. $12=false._yourself();
  47867. $ctx1.sendIdx["yourself"]=6;
  47868. if($core.assert($12)){
  47869. $11="alternative block2";
  47870. } else {
  47871. $11="alternative block";
  47872. };
  47873. self._assert_equals_($11,"alternative block");
  47874. $ctx1.sendIdx["assert:equals:"]=6;
  47875. $14=true._yourself();
  47876. $ctx1.sendIdx["yourself"]=7;
  47877. if($core.assert($14)){
  47878. $13="alternative block";
  47879. } else {
  47880. $13="alternative block2";
  47881. };
  47882. self._assert_equals_($13,"alternative block");
  47883. $ctx1.sendIdx["assert:equals:"]=7;
  47884. $16=true._yourself();
  47885. if($core.assert($16)){
  47886. $15="alternative block2";
  47887. } else {
  47888. $15="alternative block";
  47889. };
  47890. self._assert_equals_($15,"alternative block2");
  47891. return self;
  47892. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  47893. },
  47894. args: [],
  47895. 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'.",
  47896. referencedClasses: [],
  47897. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  47898. }),
  47899. $globals.BooleanTest);
  47900. $core.addMethod(
  47901. $core.method({
  47902. selector: "testLogic",
  47903. protocol: 'tests',
  47904. fn: function (){
  47905. var self=this;
  47906. return $core.withContext(function($ctx1) {
  47907. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  47908. $1=true.__and(true);
  47909. $ctx1.sendIdx["&"]=1;
  47910. self._assert_($1);
  47911. $ctx1.sendIdx["assert:"]=1;
  47912. $2=true.__and(false);
  47913. $ctx1.sendIdx["&"]=2;
  47914. self._deny_($2);
  47915. $ctx1.sendIdx["deny:"]=1;
  47916. $3=false.__and(true);
  47917. $ctx1.sendIdx["&"]=3;
  47918. self._deny_($3);
  47919. $ctx1.sendIdx["deny:"]=2;
  47920. $5=false.__and(false);
  47921. $ctx1.sendIdx["&"]=4;
  47922. $4=self._deny_($5);
  47923. $ctx1.sendIdx["deny:"]=3;
  47924. $6=true.__or(true);
  47925. $ctx1.sendIdx["|"]=1;
  47926. self._assert_($6);
  47927. $ctx1.sendIdx["assert:"]=2;
  47928. $7=true.__or(false);
  47929. $ctx1.sendIdx["|"]=2;
  47930. self._assert_($7);
  47931. $ctx1.sendIdx["assert:"]=3;
  47932. $8=false.__or(true);
  47933. $ctx1.sendIdx["|"]=3;
  47934. self._assert_($8);
  47935. $ctx1.sendIdx["assert:"]=4;
  47936. $10=false.__or(false);
  47937. $ctx1.sendIdx["|"]=4;
  47938. $9=self._deny_($10);
  47939. $ctx1.sendIdx["deny:"]=4;
  47940. $12=(1).__gt((0));
  47941. $ctx1.sendIdx[">"]=1;
  47942. $11=true.__and($12);
  47943. $ctx1.sendIdx["&"]=5;
  47944. self._assert_($11);
  47945. $ctx1.sendIdx["assert:"]=5;
  47946. $14=(1).__gt((0));
  47947. $ctx1.sendIdx[">"]=2;
  47948. $13=$recv($14).__and(false);
  47949. $ctx1.sendIdx["&"]=6;
  47950. self._deny_($13);
  47951. $ctx1.sendIdx["deny:"]=5;
  47952. $16=(1).__gt((0));
  47953. $ctx1.sendIdx[">"]=3;
  47954. $17=(1).__gt((2));
  47955. $ctx1.sendIdx[">"]=4;
  47956. $15=$recv($16).__and($17);
  47957. self._deny_($15);
  47958. $19=(1).__gt((0));
  47959. $ctx1.sendIdx[">"]=5;
  47960. $18=false.__or($19);
  47961. $ctx1.sendIdx["|"]=5;
  47962. self._assert_($18);
  47963. $ctx1.sendIdx["assert:"]=6;
  47964. $21=(1).__gt((0));
  47965. $ctx1.sendIdx[">"]=6;
  47966. $20=$recv($21).__or(false);
  47967. $ctx1.sendIdx["|"]=6;
  47968. self._assert_($20);
  47969. $ctx1.sendIdx["assert:"]=7;
  47970. $23=(1).__gt((0));
  47971. $ctx1.sendIdx[">"]=7;
  47972. $22=$recv($23).__or((1).__gt((2)));
  47973. self._assert_($22);
  47974. return self;
  47975. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  47976. },
  47977. args: [],
  47978. 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))",
  47979. referencedClasses: [],
  47980. messageSends: ["assert:", "&", "deny:", "|", ">"]
  47981. }),
  47982. $globals.BooleanTest);
  47983. $core.addMethod(
  47984. $core.method({
  47985. selector: "testLogicKeywords",
  47986. protocol: 'tests',
  47987. fn: function (){
  47988. var self=this;
  47989. return $core.withContext(function($ctx1) {
  47990. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  47991. $1=true._and_((function(){
  47992. return true;
  47993. }));
  47994. $ctx1.sendIdx["and:"]=1;
  47995. self._assert_($1);
  47996. $ctx1.sendIdx["assert:"]=1;
  47997. $2=true._and_((function(){
  47998. return false;
  47999. }));
  48000. $ctx1.sendIdx["and:"]=2;
  48001. self._deny_($2);
  48002. $ctx1.sendIdx["deny:"]=1;
  48003. $3=false._and_((function(){
  48004. return true;
  48005. }));
  48006. $ctx1.sendIdx["and:"]=3;
  48007. self._deny_($3);
  48008. $ctx1.sendIdx["deny:"]=2;
  48009. $5=false._and_((function(){
  48010. return false;
  48011. }));
  48012. $ctx1.sendIdx["and:"]=4;
  48013. $4=self._deny_($5);
  48014. $ctx1.sendIdx["deny:"]=3;
  48015. $6=true._or_((function(){
  48016. return true;
  48017. }));
  48018. $ctx1.sendIdx["or:"]=1;
  48019. self._assert_($6);
  48020. $ctx1.sendIdx["assert:"]=2;
  48021. $7=true._or_((function(){
  48022. return false;
  48023. }));
  48024. $ctx1.sendIdx["or:"]=2;
  48025. self._assert_($7);
  48026. $ctx1.sendIdx["assert:"]=3;
  48027. $8=false._or_((function(){
  48028. return true;
  48029. }));
  48030. $ctx1.sendIdx["or:"]=3;
  48031. self._assert_($8);
  48032. $ctx1.sendIdx["assert:"]=4;
  48033. $10=false._or_((function(){
  48034. return false;
  48035. }));
  48036. $ctx1.sendIdx["or:"]=4;
  48037. $9=self._deny_($10);
  48038. $ctx1.sendIdx["deny:"]=4;
  48039. $11=true._and_((function(){
  48040. return $core.withContext(function($ctx2) {
  48041. return (1).__gt((0));
  48042. $ctx2.sendIdx[">"]=1;
  48043. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  48044. }));
  48045. $ctx1.sendIdx["and:"]=5;
  48046. self._assert_($11);
  48047. $ctx1.sendIdx["assert:"]=5;
  48048. $13=(1).__gt((0));
  48049. $ctx1.sendIdx[">"]=2;
  48050. $12=$recv($13)._and_((function(){
  48051. return false;
  48052. }));
  48053. $ctx1.sendIdx["and:"]=6;
  48054. self._deny_($12);
  48055. $ctx1.sendIdx["deny:"]=5;
  48056. $15=(1).__gt((0));
  48057. $ctx1.sendIdx[">"]=3;
  48058. $14=$recv($15)._and_((function(){
  48059. return $core.withContext(function($ctx2) {
  48060. return (1).__gt((2));
  48061. $ctx2.sendIdx[">"]=4;
  48062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  48063. }));
  48064. self._deny_($14);
  48065. $16=false._or_((function(){
  48066. return $core.withContext(function($ctx2) {
  48067. return (1).__gt((0));
  48068. $ctx2.sendIdx[">"]=5;
  48069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  48070. }));
  48071. $ctx1.sendIdx["or:"]=5;
  48072. self._assert_($16);
  48073. $ctx1.sendIdx["assert:"]=6;
  48074. $18=(1).__gt((0));
  48075. $ctx1.sendIdx[">"]=6;
  48076. $17=$recv($18)._or_((function(){
  48077. return false;
  48078. }));
  48079. $ctx1.sendIdx["or:"]=6;
  48080. self._assert_($17);
  48081. $ctx1.sendIdx["assert:"]=7;
  48082. $20=(1).__gt((0));
  48083. $ctx1.sendIdx[">"]=7;
  48084. $19=$recv($20)._or_((function(){
  48085. return $core.withContext(function($ctx2) {
  48086. return (1).__gt((2));
  48087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  48088. }));
  48089. self._assert_($19);
  48090. return self;
  48091. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  48092. },
  48093. args: [],
  48094. 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 ])",
  48095. referencedClasses: [],
  48096. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  48097. }),
  48098. $globals.BooleanTest);
  48099. $core.addMethod(
  48100. $core.method({
  48101. selector: "testNonBooleanError",
  48102. protocol: 'tests',
  48103. fn: function (){
  48104. var self=this;
  48105. return $core.withContext(function($ctx1) {
  48106. self._should_raise_((function(){
  48107. return $core.withContext(function($ctx2) {
  48108. if($core.assert("")){
  48109. } else {
  48110. };
  48111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48112. }),$globals.NonBooleanReceiver);
  48113. return self;
  48114. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  48115. },
  48116. args: [],
  48117. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  48118. referencedClasses: ["NonBooleanReceiver"],
  48119. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  48120. }),
  48121. $globals.BooleanTest);
  48122. $core.addClass('ClassBuilderTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  48123. $core.addMethod(
  48124. $core.method({
  48125. selector: "setUp",
  48126. protocol: 'running',
  48127. fn: function (){
  48128. var self=this;
  48129. return $core.withContext(function($ctx1) {
  48130. self["@builder"]=$recv($globals.ClassBuilder)._new();
  48131. return self;
  48132. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  48133. },
  48134. args: [],
  48135. source: "setUp\x0a\x09builder := ClassBuilder new",
  48136. referencedClasses: ["ClassBuilder"],
  48137. messageSends: ["new"]
  48138. }),
  48139. $globals.ClassBuilderTest);
  48140. $core.addMethod(
  48141. $core.method({
  48142. selector: "tearDown",
  48143. protocol: 'running',
  48144. fn: function (){
  48145. var self=this;
  48146. return $core.withContext(function($ctx1) {
  48147. var $1,$receiver;
  48148. $1=self["@theClass"];
  48149. if(($receiver = $1) == null || $receiver.isNil){
  48150. $1;
  48151. } else {
  48152. $recv($globals.Smalltalk)._removeClass_(self["@theClass"]);
  48153. self["@theClass"]=nil;
  48154. self["@theClass"];
  48155. };
  48156. return self;
  48157. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  48158. },
  48159. args: [],
  48160. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  48161. referencedClasses: ["Smalltalk"],
  48162. messageSends: ["ifNotNil:", "removeClass:"]
  48163. }),
  48164. $globals.ClassBuilderTest);
  48165. $core.addMethod(
  48166. $core.method({
  48167. selector: "testClassCopy",
  48168. protocol: 'tests',
  48169. fn: function (){
  48170. var self=this;
  48171. return $core.withContext(function($ctx1) {
  48172. var $2,$1,$4,$3,$6,$5,$8,$7;
  48173. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48174. $2=$recv(self["@theClass"])._superclass();
  48175. $ctx1.sendIdx["superclass"]=1;
  48176. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48177. $ctx1.sendIdx["=="]=1;
  48178. self._assert_($1);
  48179. $ctx1.sendIdx["assert:"]=1;
  48180. $4=$recv(self["@theClass"])._instanceVariableNames();
  48181. $ctx1.sendIdx["instanceVariableNames"]=1;
  48182. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48183. $ctx1.sendIdx["=="]=2;
  48184. self._assert_($3);
  48185. $ctx1.sendIdx["assert:"]=2;
  48186. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48187. $ctx1.sendIdx["assert:equals:"]=1;
  48188. $6=$recv(self["@theClass"])._package();
  48189. $ctx1.sendIdx["package"]=1;
  48190. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48191. self._assert_($5);
  48192. $8=$recv(self["@theClass"])._methodDictionary();
  48193. $ctx1.sendIdx["methodDictionary"]=1;
  48194. $7=$recv($8)._keys();
  48195. $ctx1.sendIdx["keys"]=1;
  48196. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48197. return self;
  48198. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  48199. },
  48200. args: [],
  48201. 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 methodDictionary keys equals: ObjectMock methodDictionary keys",
  48202. referencedClasses: ["ObjectMock"],
  48203. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  48204. }),
  48205. $globals.ClassBuilderTest);
  48206. $core.addMethod(
  48207. $core.method({
  48208. selector: "testClassMigration",
  48209. protocol: 'tests',
  48210. fn: function (){
  48211. var self=this;
  48212. var instance,oldClass;
  48213. return $core.withContext(function($ctx1) {
  48214. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  48215. oldClass=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48216. $2=$recv($globals.Smalltalk)._globals();
  48217. $ctx1.sendIdx["globals"]=1;
  48218. $1=$recv($2)._at_("ObjectMock2");
  48219. $ctx1.sendIdx["at:"]=1;
  48220. instance=$recv($1)._new();
  48221. $4=$recv($globals.Smalltalk)._globals();
  48222. $ctx1.sendIdx["globals"]=2;
  48223. $3=$recv($4)._at_("ObjectMock2");
  48224. $ctx1.sendIdx["at:"]=2;
  48225. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  48226. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  48227. $ctx1.sendIdx["=="]=1;
  48228. self._deny_($5);
  48229. $ctx1.sendIdx["deny:"]=1;
  48230. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  48231. $ctx1.sendIdx["=="]=2;
  48232. self._assert_($6);
  48233. $ctx1.sendIdx["assert:"]=1;
  48234. self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  48235. $ctx1.sendIdx["assert:"]=2;
  48236. $7=$recv($globals.ObjectMock2)._selectors();
  48237. $ctx1.sendIdx["selectors"]=1;
  48238. self._assert_equals_($7,$recv(oldClass)._selectors());
  48239. $ctx1.sendIdx["assert:equals:"]=1;
  48240. $8=$recv($globals.ObjectMock2)._comment();
  48241. $ctx1.sendIdx["comment"]=1;
  48242. self._assert_equals_($8,$recv(oldClass)._comment());
  48243. $ctx1.sendIdx["assert:equals:"]=2;
  48244. $9=$recv($recv($globals.ObjectMock2)._package())._name();
  48245. $ctx1.sendIdx["name"]=1;
  48246. self._assert_equals_($9,"Kernel-Tests");
  48247. $11=$recv(instance)._class();
  48248. $ctx1.sendIdx["class"]=1;
  48249. $10=$recv($11).__eq_eq($globals.ObjectMock2);
  48250. self._deny_($10);
  48251. self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  48252. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  48253. return self;
  48254. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  48255. },
  48256. args: [],
  48257. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\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",
  48258. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  48259. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  48260. }),
  48261. $globals.ClassBuilderTest);
  48262. $core.addMethod(
  48263. $core.method({
  48264. selector: "testClassMigrationWithClassInstanceVariables",
  48265. protocol: 'tests',
  48266. fn: function (){
  48267. var self=this;
  48268. return $core.withContext(function($ctx1) {
  48269. var $1;
  48270. $recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48271. $1=$recv($globals.ObjectMock2)._class();
  48272. $ctx1.sendIdx["class"]=1;
  48273. $recv($1)._instanceVariableNames_("foo bar");
  48274. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  48275. self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  48276. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  48277. return self;
  48278. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  48279. },
  48280. args: [],
  48281. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  48282. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  48283. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  48284. }),
  48285. $globals.ClassBuilderTest);
  48286. $core.addMethod(
  48287. $core.method({
  48288. selector: "testClassMigrationWithSubclasses",
  48289. protocol: 'tests',
  48290. fn: function (){
  48291. var self=this;
  48292. return $core.withContext(function($ctx1) {
  48293. var $2,$1,$4,$3;
  48294. $recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48295. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  48296. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  48297. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  48298. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  48299. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  48300. $2=$recv($globals.ObjectMock)._subclasses();
  48301. $ctx1.sendIdx["subclasses"]=1;
  48302. $1=$recv($2)._includes_($globals.ObjectMock2);
  48303. $ctx1.sendIdx["includes:"]=1;
  48304. self._assert_($1);
  48305. $ctx1.sendIdx["assert:"]=1;
  48306. $4=$recv($globals.ObjectMock2)._subclasses();
  48307. $ctx1.sendIdx["subclasses"]=2;
  48308. $3=$recv($4)._includes_($globals.ObjectMock3);
  48309. $ctx1.sendIdx["includes:"]=2;
  48310. self._assert_($3);
  48311. $ctx1.sendIdx["assert:"]=2;
  48312. self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  48313. $recv($recv($globals.ObjectMock)._allSubclasses())._do_((function(each){
  48314. return $core.withContext(function($ctx2) {
  48315. return $recv($globals.Smalltalk)._removeClass_(each);
  48316. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48317. }));
  48318. return self;
  48319. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  48320. },
  48321. args: [],
  48322. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk removeClass: each ]",
  48323. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  48324. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"]
  48325. }),
  48326. $globals.ClassBuilderTest);
  48327. $core.addMethod(
  48328. $core.method({
  48329. selector: "testInstanceVariableNames",
  48330. protocol: 'tests',
  48331. fn: function (){
  48332. var self=this;
  48333. return $core.withContext(function($ctx1) {
  48334. self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  48335. return self;
  48336. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  48337. },
  48338. args: [],
  48339. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  48340. referencedClasses: [],
  48341. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  48342. }),
  48343. $globals.ClassBuilderTest);
  48344. $core.addClass('ClassTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  48345. $core.addMethod(
  48346. $core.method({
  48347. selector: "jsConstructor",
  48348. protocol: 'running',
  48349. fn: function (){
  48350. var self=this;
  48351. return $core.withContext(function($ctx1) {
  48352. function Foo(){}
  48353. Foo.prototype.valueOf = function () {return 4;};
  48354. return Foo;
  48355. ;
  48356. return self;
  48357. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  48358. },
  48359. args: [],
  48360. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  48361. referencedClasses: [],
  48362. messageSends: []
  48363. }),
  48364. $globals.ClassTest);
  48365. $core.addMethod(
  48366. $core.method({
  48367. selector: "setUp",
  48368. protocol: 'running',
  48369. fn: function (){
  48370. var self=this;
  48371. return $core.withContext(function($ctx1) {
  48372. self["@builder"]=$recv($globals.ClassBuilder)._new();
  48373. return self;
  48374. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  48375. },
  48376. args: [],
  48377. source: "setUp\x0a\x09builder := ClassBuilder new",
  48378. referencedClasses: ["ClassBuilder"],
  48379. messageSends: ["new"]
  48380. }),
  48381. $globals.ClassTest);
  48382. $core.addMethod(
  48383. $core.method({
  48384. selector: "tearDown",
  48385. protocol: 'running',
  48386. fn: function (){
  48387. var self=this;
  48388. return $core.withContext(function($ctx1) {
  48389. var $1,$receiver;
  48390. $1=self["@theClass"];
  48391. if(($receiver = $1) == null || $receiver.isNil){
  48392. $1;
  48393. } else {
  48394. $recv($globals.Smalltalk)._removeClass_(self["@theClass"]);
  48395. self["@theClass"]=nil;
  48396. self["@theClass"];
  48397. };
  48398. return self;
  48399. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  48400. },
  48401. args: [],
  48402. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  48403. referencedClasses: ["Smalltalk"],
  48404. messageSends: ["ifNotNil:", "removeClass:"]
  48405. }),
  48406. $globals.ClassTest);
  48407. $core.addMethod(
  48408. $core.method({
  48409. selector: "testAllSubclasses",
  48410. protocol: 'tests',
  48411. fn: function (){
  48412. var self=this;
  48413. var subclasses,index;
  48414. return $core.withContext(function($ctx1) {
  48415. subclasses=$recv($globals.Object)._subclasses();
  48416. $ctx1.sendIdx["subclasses"]=1;
  48417. index=(1);
  48418. $recv((function(){
  48419. return $core.withContext(function($ctx2) {
  48420. return $recv(index).__gt($recv(subclasses)._size());
  48421. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48422. }))._whileFalse_((function(){
  48423. return $core.withContext(function($ctx2) {
  48424. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  48425. index=$recv(index).__plus((1));
  48426. return index;
  48427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48428. }));
  48429. self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  48430. return self;
  48431. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  48432. },
  48433. args: [],
  48434. 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",
  48435. referencedClasses: ["Object"],
  48436. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  48437. }),
  48438. $globals.ClassTest);
  48439. $core.addMethod(
  48440. $core.method({
  48441. selector: "testMetaclassSubclasses",
  48442. protocol: 'tests',
  48443. fn: function (){
  48444. var self=this;
  48445. var subclasses;
  48446. return $core.withContext(function($ctx1) {
  48447. var $4,$3,$2,$1;
  48448. $4=$recv($globals.Object)._class();
  48449. $ctx1.sendIdx["class"]=1;
  48450. $3=$recv($4)._instanceClass();
  48451. $2=$recv($3)._subclasses();
  48452. $ctx1.sendIdx["subclasses"]=1;
  48453. $1=$recv($2)._select_((function(each){
  48454. return $core.withContext(function($ctx2) {
  48455. return $recv($recv(each)._isMetaclass())._not();
  48456. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48457. }));
  48458. subclasses=$recv($1)._collect_((function(each){
  48459. return $core.withContext(function($ctx2) {
  48460. return $recv(each)._theMetaClass();
  48461. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48462. }));
  48463. self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  48464. return self;
  48465. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  48466. },
  48467. args: [],
  48468. 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",
  48469. referencedClasses: ["Object"],
  48470. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  48471. }),
  48472. $globals.ClassTest);
  48473. $core.addMethod(
  48474. $core.method({
  48475. selector: "testSetJavaScriptConstructor",
  48476. protocol: 'tests',
  48477. fn: function (){
  48478. var self=this;
  48479. var instance;
  48480. return $core.withContext(function($ctx1) {
  48481. var $2,$1,$4,$3,$6,$5,$8,$7;
  48482. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48483. $recv(self["@theClass"])._javascriptConstructor_(self._jsConstructor());
  48484. $2=$recv(self["@theClass"])._superclass();
  48485. $ctx1.sendIdx["superclass"]=1;
  48486. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48487. $ctx1.sendIdx["=="]=1;
  48488. self._assert_($1);
  48489. $ctx1.sendIdx["assert:"]=1;
  48490. $4=$recv(self["@theClass"])._instanceVariableNames();
  48491. $ctx1.sendIdx["instanceVariableNames"]=1;
  48492. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48493. $ctx1.sendIdx["=="]=2;
  48494. self._assert_($3);
  48495. $ctx1.sendIdx["assert:"]=2;
  48496. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48497. $ctx1.sendIdx["assert:equals:"]=1;
  48498. $6=$recv(self["@theClass"])._package();
  48499. $ctx1.sendIdx["package"]=1;
  48500. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48501. $ctx1.sendIdx["=="]=3;
  48502. self._assert_($5);
  48503. $ctx1.sendIdx["assert:"]=3;
  48504. $8=$recv(self["@theClass"])._methodDictionary();
  48505. $ctx1.sendIdx["methodDictionary"]=1;
  48506. $7=$recv($8)._keys();
  48507. $ctx1.sendIdx["keys"]=1;
  48508. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48509. $ctx1.sendIdx["assert:equals:"]=2;
  48510. instance=$recv(self["@theClass"])._new();
  48511. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  48512. self._assert_equals_($recv(instance)._value(),(4));
  48513. $ctx1.sendIdx["assert:equals:"]=3;
  48514. self._shouldnt_raise_((function(){
  48515. return $core.withContext(function($ctx2) {
  48516. return $recv(instance)._foo_((9));
  48517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48518. }),$globals.Error);
  48519. self._assert_equals_($recv(instance)._foo(),(9));
  48520. return self;
  48521. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  48522. },
  48523. args: [],
  48524. 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",
  48525. referencedClasses: ["ObjectMock", "Error"],
  48526. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  48527. }),
  48528. $globals.ClassTest);
  48529. $core.addMethod(
  48530. $core.method({
  48531. selector: "testTrickySetJavaScriptConstructor",
  48532. protocol: 'tests',
  48533. fn: function (){
  48534. var self=this;
  48535. var instance;
  48536. return $core.withContext(function($ctx1) {
  48537. var $2,$1,$4,$3,$6,$5,$8,$7;
  48538. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48539. $recv(self["@theClass"])._javascriptConstructor_(self._trickyJsConstructor());
  48540. $2=$recv(self["@theClass"])._superclass();
  48541. $ctx1.sendIdx["superclass"]=1;
  48542. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48543. $ctx1.sendIdx["=="]=1;
  48544. self._assert_($1);
  48545. $ctx1.sendIdx["assert:"]=1;
  48546. $4=$recv(self["@theClass"])._instanceVariableNames();
  48547. $ctx1.sendIdx["instanceVariableNames"]=1;
  48548. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48549. $ctx1.sendIdx["=="]=2;
  48550. self._assert_($3);
  48551. $ctx1.sendIdx["assert:"]=2;
  48552. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48553. $ctx1.sendIdx["assert:equals:"]=1;
  48554. $6=$recv(self["@theClass"])._package();
  48555. $ctx1.sendIdx["package"]=1;
  48556. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48557. $ctx1.sendIdx["=="]=3;
  48558. self._assert_($5);
  48559. $ctx1.sendIdx["assert:"]=3;
  48560. $8=$recv(self["@theClass"])._methodDictionary();
  48561. $ctx1.sendIdx["methodDictionary"]=1;
  48562. $7=$recv($8)._keys();
  48563. $ctx1.sendIdx["keys"]=1;
  48564. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48565. $ctx1.sendIdx["assert:equals:"]=2;
  48566. instance=$recv(self["@theClass"])._new();
  48567. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  48568. self._assert_equals_($recv(instance)._value(),(4));
  48569. $ctx1.sendIdx["assert:equals:"]=3;
  48570. self._shouldnt_raise_((function(){
  48571. return $core.withContext(function($ctx2) {
  48572. return $recv(instance)._foo_((9));
  48573. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48574. }),$globals.Error);
  48575. self._assert_equals_($recv(instance)._foo(),(9));
  48576. return self;
  48577. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  48578. },
  48579. args: [],
  48580. 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",
  48581. referencedClasses: ["ObjectMock", "Error"],
  48582. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  48583. }),
  48584. $globals.ClassTest);
  48585. $core.addMethod(
  48586. $core.method({
  48587. selector: "trickyJsConstructor",
  48588. protocol: 'running',
  48589. fn: function (){
  48590. var self=this;
  48591. return $core.withContext(function($ctx1) {
  48592. function Foo(){}
  48593. Foo.prototype.valueOf = function () {return 4;};
  48594. Foo.prototype._foo = function () {return "bar";};
  48595. return Foo;
  48596. ;
  48597. return self;
  48598. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  48599. },
  48600. args: [],
  48601. 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'>",
  48602. referencedClasses: [],
  48603. messageSends: []
  48604. }),
  48605. $globals.ClassTest);
  48606. $core.addClass('CollectionTest', $globals.TestCase, ['sampleBlock'], 'Kernel-Tests');
  48607. $core.addMethod(
  48608. $core.method({
  48609. selector: "assertSameContents:as:",
  48610. protocol: 'convenience',
  48611. fn: function (aCollection,anotherCollection){
  48612. var self=this;
  48613. return $core.withContext(function($ctx1) {
  48614. var $2,$1,$4,$3;
  48615. $2=$recv(aCollection)._size();
  48616. $ctx1.sendIdx["size"]=1;
  48617. $1=$recv($2).__eq($recv(anotherCollection)._size());
  48618. $ctx1.sendIdx["="]=1;
  48619. self._assert_($1);
  48620. $ctx1.sendIdx["assert:"]=1;
  48621. $recv(aCollection)._do_((function(each){
  48622. return $core.withContext(function($ctx2) {
  48623. $4=$recv(aCollection)._occurrencesOf_(each);
  48624. $ctx2.sendIdx["occurrencesOf:"]=1;
  48625. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  48626. return self._assert_($3);
  48627. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48628. }));
  48629. return self;
  48630. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  48631. },
  48632. args: ["aCollection", "anotherCollection"],
  48633. 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)) ]",
  48634. referencedClasses: [],
  48635. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  48636. }),
  48637. $globals.CollectionTest);
  48638. $core.addMethod(
  48639. $core.method({
  48640. selector: "collection",
  48641. protocol: 'fixture',
  48642. fn: function (){
  48643. var self=this;
  48644. return $core.withContext(function($ctx1) {
  48645. self._subclassResponsibility();
  48646. return self;
  48647. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  48648. },
  48649. args: [],
  48650. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  48651. referencedClasses: [],
  48652. messageSends: ["subclassResponsibility"]
  48653. }),
  48654. $globals.CollectionTest);
  48655. $core.addMethod(
  48656. $core.method({
  48657. selector: "collectionClass",
  48658. protocol: 'fixture',
  48659. fn: function (){
  48660. var self=this;
  48661. return $core.withContext(function($ctx1) {
  48662. return $recv(self._class())._collectionClass();
  48663. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  48664. },
  48665. args: [],
  48666. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  48667. referencedClasses: [],
  48668. messageSends: ["collectionClass", "class"]
  48669. }),
  48670. $globals.CollectionTest);
  48671. $core.addMethod(
  48672. $core.method({
  48673. selector: "collectionOfPrintStrings",
  48674. protocol: 'fixture',
  48675. fn: function (){
  48676. var self=this;
  48677. return $core.withContext(function($ctx1) {
  48678. self._subclassResponsibility();
  48679. return self;
  48680. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  48681. },
  48682. args: [],
  48683. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  48684. referencedClasses: [],
  48685. messageSends: ["subclassResponsibility"]
  48686. }),
  48687. $globals.CollectionTest);
  48688. $core.addMethod(
  48689. $core.method({
  48690. selector: "collectionSize",
  48691. protocol: 'fixture',
  48692. fn: function (){
  48693. var self=this;
  48694. return $core.withContext(function($ctx1) {
  48695. self._subclassResponsibility();
  48696. return self;
  48697. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  48698. },
  48699. args: [],
  48700. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  48701. referencedClasses: [],
  48702. messageSends: ["subclassResponsibility"]
  48703. }),
  48704. $globals.CollectionTest);
  48705. $core.addMethod(
  48706. $core.method({
  48707. selector: "collectionWithDuplicates",
  48708. protocol: 'fixture',
  48709. fn: function (){
  48710. var self=this;
  48711. return $core.withContext(function($ctx1) {
  48712. self._subclassResponsibility();
  48713. return self;
  48714. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  48715. },
  48716. args: [],
  48717. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  48718. referencedClasses: [],
  48719. messageSends: ["subclassResponsibility"]
  48720. }),
  48721. $globals.CollectionTest);
  48722. $core.addMethod(
  48723. $core.method({
  48724. selector: "collectionWithNewValue",
  48725. protocol: 'fixture',
  48726. fn: function (){
  48727. var self=this;
  48728. return $core.withContext(function($ctx1) {
  48729. self._subclassResponsibility();
  48730. return self;
  48731. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  48732. },
  48733. args: [],
  48734. 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",
  48735. referencedClasses: [],
  48736. messageSends: ["subclassResponsibility"]
  48737. }),
  48738. $globals.CollectionTest);
  48739. $core.addMethod(
  48740. $core.method({
  48741. selector: "initialize",
  48742. protocol: 'initialization',
  48743. fn: function (){
  48744. var self=this;
  48745. return $core.withContext(function($ctx1) {
  48746. (
  48747. $ctx1.supercall = true,
  48748. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  48749. $ctx1.supercall = false;
  48750. self["@sampleBlock"]=(function(){
  48751. });
  48752. return self;
  48753. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  48754. },
  48755. args: [],
  48756. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  48757. referencedClasses: [],
  48758. messageSends: ["initialize"]
  48759. }),
  48760. $globals.CollectionTest);
  48761. $core.addMethod(
  48762. $core.method({
  48763. selector: "isCollectionReadOnly",
  48764. protocol: 'testing',
  48765. fn: function (){
  48766. var self=this;
  48767. return false;
  48768. },
  48769. args: [],
  48770. source: "isCollectionReadOnly\x0a\x09^ false",
  48771. referencedClasses: [],
  48772. messageSends: []
  48773. }),
  48774. $globals.CollectionTest);
  48775. $core.addMethod(
  48776. $core.method({
  48777. selector: "sampleNewValue",
  48778. protocol: 'fixture',
  48779. fn: function (){
  48780. var self=this;
  48781. return "N";
  48782. },
  48783. args: [],
  48784. 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'",
  48785. referencedClasses: [],
  48786. messageSends: []
  48787. }),
  48788. $globals.CollectionTest);
  48789. $core.addMethod(
  48790. $core.method({
  48791. selector: "sampleNewValueAsCollection",
  48792. protocol: 'fixture',
  48793. fn: function (){
  48794. var self=this;
  48795. return $core.withContext(function($ctx1) {
  48796. return $recv(self._collectionClass())._with_(self._sampleNewValue());
  48797. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  48798. },
  48799. args: [],
  48800. 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",
  48801. referencedClasses: [],
  48802. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  48803. }),
  48804. $globals.CollectionTest);
  48805. $core.addMethod(
  48806. $core.method({
  48807. selector: "testAddAll",
  48808. protocol: 'tests',
  48809. fn: function (){
  48810. var self=this;
  48811. return $core.withContext(function($ctx1) {
  48812. 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;
  48813. $2=self._collection();
  48814. $ctx1.sendIdx["collection"]=1;
  48815. $4=self._collectionClass();
  48816. $ctx1.sendIdx["collectionClass"]=1;
  48817. $3=$recv($4)._new();
  48818. $ctx1.sendIdx["new"]=1;
  48819. $recv($2)._addAll_($3);
  48820. $ctx1.sendIdx["addAll:"]=1;
  48821. $5=$recv($2)._yourself();
  48822. $ctx1.sendIdx["yourself"]=1;
  48823. $1=$5;
  48824. $6=self._collection();
  48825. $ctx1.sendIdx["collection"]=2;
  48826. self._assert_equals_($1,$6);
  48827. $ctx1.sendIdx["assert:equals:"]=1;
  48828. $9=self._collectionClass();
  48829. $ctx1.sendIdx["collectionClass"]=2;
  48830. $8=$recv($9)._new();
  48831. $ctx1.sendIdx["new"]=2;
  48832. $10=self._collection();
  48833. $ctx1.sendIdx["collection"]=3;
  48834. $recv($8)._addAll_($10);
  48835. $ctx1.sendIdx["addAll:"]=2;
  48836. $11=$recv($8)._yourself();
  48837. $ctx1.sendIdx["yourself"]=2;
  48838. $7=$11;
  48839. $12=self._collection();
  48840. $ctx1.sendIdx["collection"]=4;
  48841. self._assert_equals_($7,$12);
  48842. $ctx1.sendIdx["assert:equals:"]=2;
  48843. $15=self._collectionClass();
  48844. $ctx1.sendIdx["collectionClass"]=3;
  48845. $14=$recv($15)._new();
  48846. $ctx1.sendIdx["new"]=3;
  48847. $17=self._collectionClass();
  48848. $ctx1.sendIdx["collectionClass"]=4;
  48849. $16=$recv($17)._new();
  48850. $ctx1.sendIdx["new"]=4;
  48851. $recv($14)._addAll_($16);
  48852. $ctx1.sendIdx["addAll:"]=3;
  48853. $18=$recv($14)._yourself();
  48854. $ctx1.sendIdx["yourself"]=3;
  48855. $13=$18;
  48856. self._assert_equals_($13,$recv(self._collectionClass())._new());
  48857. $ctx1.sendIdx["assert:equals:"]=3;
  48858. $20=self._collection();
  48859. $ctx1.sendIdx["collection"]=5;
  48860. $21=self._sampleNewValueAsCollection();
  48861. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  48862. $recv($20)._addAll_($21);
  48863. $ctx1.sendIdx["addAll:"]=4;
  48864. $22=$recv($20)._yourself();
  48865. $ctx1.sendIdx["yourself"]=4;
  48866. $19=$22;
  48867. $23=self._collectionWithNewValue();
  48868. $ctx1.sendIdx["collectionWithNewValue"]=1;
  48869. self._assert_equals_($19,$23);
  48870. $25=self._sampleNewValueAsCollection();
  48871. $recv($25)._addAll_(self._collection());
  48872. $24=$recv($25)._yourself();
  48873. self._assertSameContents_as_($24,self._collectionWithNewValue());
  48874. return self;
  48875. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  48876. },
  48877. args: [],
  48878. 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",
  48879. referencedClasses: [],
  48880. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  48881. }),
  48882. $globals.CollectionTest);
  48883. $core.addMethod(
  48884. $core.method({
  48885. selector: "testAllSatisfy",
  48886. protocol: 'tests',
  48887. fn: function (){
  48888. var self=this;
  48889. var collection,anyOne;
  48890. return $core.withContext(function($ctx1) {
  48891. var $1;
  48892. collection=self._collection();
  48893. anyOne=$recv(collection)._anyOne();
  48894. $1=$recv(collection)._allSatisfy_((function(each){
  48895. return $core.withContext(function($ctx2) {
  48896. return $recv(collection)._includes_(each);
  48897. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48898. }));
  48899. $ctx1.sendIdx["allSatisfy:"]=1;
  48900. self._assert_($1);
  48901. self._deny_($recv(collection)._allSatisfy_((function(each){
  48902. return $core.withContext(function($ctx2) {
  48903. return $recv(each).__tild_eq(anyOne);
  48904. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48905. })));
  48906. return self;
  48907. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  48908. },
  48909. args: [],
  48910. 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 ])",
  48911. referencedClasses: [],
  48912. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  48913. }),
  48914. $globals.CollectionTest);
  48915. $core.addMethod(
  48916. $core.method({
  48917. selector: "testAnyOne",
  48918. protocol: 'tests',
  48919. fn: function (){
  48920. var self=this;
  48921. return $core.withContext(function($ctx1) {
  48922. var $2,$1;
  48923. self._should_raise_((function(){
  48924. return $core.withContext(function($ctx2) {
  48925. return $recv($recv(self._collectionClass())._new())._anyOne();
  48926. $ctx2.sendIdx["anyOne"]=1;
  48927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48928. }),$globals.Error);
  48929. $2=self._collection();
  48930. $ctx1.sendIdx["collection"]=1;
  48931. $1=$recv($2)._includes_($recv(self._collection())._anyOne());
  48932. self._assert_($1);
  48933. return self;
  48934. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  48935. },
  48936. args: [],
  48937. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  48938. referencedClasses: ["Error"],
  48939. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  48940. }),
  48941. $globals.CollectionTest);
  48942. $core.addMethod(
  48943. $core.method({
  48944. selector: "testAnySatisfy",
  48945. protocol: 'tests',
  48946. fn: function (){
  48947. var self=this;
  48948. var anyOne;
  48949. return $core.withContext(function($ctx1) {
  48950. var $1,$3,$2;
  48951. $1=self._collection();
  48952. $ctx1.sendIdx["collection"]=1;
  48953. anyOne=$recv($1)._anyOne();
  48954. $3=self._collection();
  48955. $ctx1.sendIdx["collection"]=2;
  48956. $2=$recv($3)._anySatisfy_((function(each){
  48957. return $core.withContext(function($ctx2) {
  48958. return $recv(each).__eq(anyOne);
  48959. $ctx2.sendIdx["="]=1;
  48960. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48961. }));
  48962. $ctx1.sendIdx["anySatisfy:"]=1;
  48963. self._assert_($2);
  48964. self._deny_($recv(self._collection())._anySatisfy_((function(each){
  48965. return $core.withContext(function($ctx2) {
  48966. return $recv(each).__eq($recv($globals.Object)._new());
  48967. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48968. })));
  48969. return self;
  48970. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  48971. },
  48972. args: [],
  48973. 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 ])",
  48974. referencedClasses: ["Object"],
  48975. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  48976. }),
  48977. $globals.CollectionTest);
  48978. $core.addMethod(
  48979. $core.method({
  48980. selector: "testAsArray",
  48981. protocol: 'tests',
  48982. fn: function (){
  48983. var self=this;
  48984. return $core.withContext(function($ctx1) {
  48985. var $1;
  48986. $1=self._collection();
  48987. $ctx1.sendIdx["collection"]=1;
  48988. self._assertSameContents_as_($1,$recv(self._collection())._asArray());
  48989. return self;
  48990. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  48991. },
  48992. args: [],
  48993. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  48994. referencedClasses: [],
  48995. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  48996. }),
  48997. $globals.CollectionTest);
  48998. $core.addMethod(
  48999. $core.method({
  49000. selector: "testAsOrderedCollection",
  49001. protocol: 'tests',
  49002. fn: function (){
  49003. var self=this;
  49004. return $core.withContext(function($ctx1) {
  49005. var $1;
  49006. $1=self._collection();
  49007. $ctx1.sendIdx["collection"]=1;
  49008. self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection());
  49009. return self;
  49010. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  49011. },
  49012. args: [],
  49013. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  49014. referencedClasses: [],
  49015. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  49016. }),
  49017. $globals.CollectionTest);
  49018. $core.addMethod(
  49019. $core.method({
  49020. selector: "testAsSet",
  49021. protocol: 'tests',
  49022. fn: function (){
  49023. var self=this;
  49024. var c,set;
  49025. return $core.withContext(function($ctx1) {
  49026. c=self._collectionWithDuplicates();
  49027. set=$recv(c)._asSet();
  49028. self._assert_equals_($recv(set)._size(),(6));
  49029. $recv(c)._do_((function(each){
  49030. return $core.withContext(function($ctx2) {
  49031. return self._assert_($recv(set)._includes_(each));
  49032. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49033. }));
  49034. return self;
  49035. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  49036. },
  49037. args: [],
  49038. 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) ]",
  49039. referencedClasses: [],
  49040. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  49041. }),
  49042. $globals.CollectionTest);
  49043. $core.addMethod(
  49044. $core.method({
  49045. selector: "testCollect",
  49046. protocol: 'tests',
  49047. fn: function (){
  49048. var self=this;
  49049. return $core.withContext(function($ctx1) {
  49050. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  49051. $2=self._collection();
  49052. $ctx1.sendIdx["collection"]=1;
  49053. $1=$recv($2)._collect_((function(each){
  49054. return each;
  49055. }));
  49056. $ctx1.sendIdx["collect:"]=1;
  49057. $3=self._collection();
  49058. $ctx1.sendIdx["collection"]=2;
  49059. self._assert_equals_($1,$3);
  49060. $ctx1.sendIdx["assert:equals:"]=1;
  49061. $5=self._collectionWithNewValue();
  49062. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49063. $4=$recv($5)._collect_((function(each){
  49064. return each;
  49065. }));
  49066. $ctx1.sendIdx["collect:"]=2;
  49067. self._assert_equals_($4,self._collectionWithNewValue());
  49068. $ctx1.sendIdx["assert:equals:"]=2;
  49069. $8=self._collectionClass();
  49070. $ctx1.sendIdx["collectionClass"]=1;
  49071. $7=$recv($8)._new();
  49072. $ctx1.sendIdx["new"]=1;
  49073. $6=$recv($7)._collect_((function(each){
  49074. return $core.withContext(function($ctx2) {
  49075. return $recv(each)._printString();
  49076. $ctx2.sendIdx["printString"]=1;
  49077. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  49078. }));
  49079. $ctx1.sendIdx["collect:"]=3;
  49080. self._assert_equals_($6,$recv(self._collectionClass())._new());
  49081. $ctx1.sendIdx["assert:equals:"]=3;
  49082. $11=self._collection();
  49083. $ctx1.sendIdx["collection"]=3;
  49084. $10=$recv($11)._collect_((function(){
  49085. return $core.withContext(function($ctx2) {
  49086. return self._sampleNewValue();
  49087. $ctx2.sendIdx["sampleNewValue"]=1;
  49088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  49089. }));
  49090. $ctx1.sendIdx["collect:"]=4;
  49091. $9=$recv($10)._detect_((function(){
  49092. return true;
  49093. }));
  49094. self._assert_equals_($9,self._sampleNewValue());
  49095. $ctx1.sendIdx["assert:equals:"]=4;
  49096. self._assert_equals_($recv(self._collection())._collect_((function(each){
  49097. return $core.withContext(function($ctx2) {
  49098. return $recv(each)._printString();
  49099. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49100. })),self._collectionOfPrintStrings());
  49101. return self;
  49102. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  49103. },
  49104. args: [],
  49105. 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",
  49106. referencedClasses: [],
  49107. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  49108. }),
  49109. $globals.CollectionTest);
  49110. $core.addMethod(
  49111. $core.method({
  49112. selector: "testComma",
  49113. protocol: 'tests',
  49114. fn: function (){
  49115. var self=this;
  49116. return $core.withContext(function($ctx1) {
  49117. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  49118. $2=self._collection();
  49119. $ctx1.sendIdx["collection"]=1;
  49120. $4=self._collectionClass();
  49121. $ctx1.sendIdx["collectionClass"]=1;
  49122. $3=$recv($4)._new();
  49123. $ctx1.sendIdx["new"]=1;
  49124. $1=$recv($2).__comma($3);
  49125. $ctx1.sendIdx[","]=1;
  49126. $5=self._collection();
  49127. $ctx1.sendIdx["collection"]=2;
  49128. self._assert_equals_($1,$5);
  49129. $ctx1.sendIdx["assert:equals:"]=1;
  49130. $8=self._collectionClass();
  49131. $ctx1.sendIdx["collectionClass"]=2;
  49132. $7=$recv($8)._new();
  49133. $ctx1.sendIdx["new"]=2;
  49134. $9=self._collection();
  49135. $ctx1.sendIdx["collection"]=3;
  49136. $6=$recv($7).__comma($9);
  49137. $ctx1.sendIdx[","]=2;
  49138. $10=self._collection();
  49139. $ctx1.sendIdx["collection"]=4;
  49140. self._assert_equals_($6,$10);
  49141. $ctx1.sendIdx["assert:equals:"]=2;
  49142. $13=self._collectionClass();
  49143. $ctx1.sendIdx["collectionClass"]=3;
  49144. $12=$recv($13)._new();
  49145. $ctx1.sendIdx["new"]=3;
  49146. $15=self._collectionClass();
  49147. $ctx1.sendIdx["collectionClass"]=4;
  49148. $14=$recv($15)._new();
  49149. $ctx1.sendIdx["new"]=4;
  49150. $11=$recv($12).__comma($14);
  49151. $ctx1.sendIdx[","]=3;
  49152. self._assert_equals_($11,$recv(self._collectionClass())._new());
  49153. $ctx1.sendIdx["assert:equals:"]=3;
  49154. $17=self._collection();
  49155. $ctx1.sendIdx["collection"]=5;
  49156. $18=self._sampleNewValueAsCollection();
  49157. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  49158. $16=$recv($17).__comma($18);
  49159. $ctx1.sendIdx[","]=4;
  49160. $19=self._collectionWithNewValue();
  49161. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49162. self._assert_equals_($16,$19);
  49163. self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  49164. return self;
  49165. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  49166. },
  49167. args: [],
  49168. 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",
  49169. referencedClasses: [],
  49170. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  49171. }),
  49172. $globals.CollectionTest);
  49173. $core.addMethod(
  49174. $core.method({
  49175. selector: "testCopy",
  49176. protocol: 'tests',
  49177. fn: function (){
  49178. var self=this;
  49179. return $core.withContext(function($ctx1) {
  49180. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  49181. $3=self._collectionClass();
  49182. $ctx1.sendIdx["collectionClass"]=1;
  49183. $2=$recv($3)._new();
  49184. $ctx1.sendIdx["new"]=1;
  49185. $1=$recv($2)._copy();
  49186. $ctx1.sendIdx["copy"]=1;
  49187. $5=self._collectionClass();
  49188. $ctx1.sendIdx["collectionClass"]=2;
  49189. $4=$recv($5)._new();
  49190. $ctx1.sendIdx["new"]=2;
  49191. self._assert_equals_($1,$4);
  49192. $ctx1.sendIdx["assert:equals:"]=1;
  49193. $7=self._collection();
  49194. $ctx1.sendIdx["collection"]=1;
  49195. $6=$recv($7)._copy();
  49196. $ctx1.sendIdx["copy"]=2;
  49197. $8=self._collection();
  49198. $ctx1.sendIdx["collection"]=2;
  49199. self._assert_equals_($6,$8);
  49200. $ctx1.sendIdx["assert:equals:"]=2;
  49201. $10=self._collectionWithNewValue();
  49202. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49203. $9=$recv($10)._copy();
  49204. $ctx1.sendIdx["copy"]=3;
  49205. $11=self._collectionWithNewValue();
  49206. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49207. self._assert_equals_($9,$11);
  49208. $15=self._collectionClass();
  49209. $ctx1.sendIdx["collectionClass"]=3;
  49210. $14=$recv($15)._new();
  49211. $ctx1.sendIdx["new"]=3;
  49212. $13=$recv($14)._copy();
  49213. $ctx1.sendIdx["copy"]=4;
  49214. $16=self._collection();
  49215. $ctx1.sendIdx["collection"]=3;
  49216. $12=$recv($13).__eq($16);
  49217. $ctx1.sendIdx["="]=1;
  49218. self._deny_($12);
  49219. $ctx1.sendIdx["deny:"]=1;
  49220. $19=self._collection();
  49221. $ctx1.sendIdx["collection"]=4;
  49222. $18=$recv($19)._copy();
  49223. $ctx1.sendIdx["copy"]=5;
  49224. $17=$recv($18).__eq($recv(self._collectionClass())._new());
  49225. $ctx1.sendIdx["="]=2;
  49226. self._deny_($17);
  49227. $ctx1.sendIdx["deny:"]=2;
  49228. self._deny_($recv($recv(self._collection())._copy()).__eq(self._collectionWithNewValue()));
  49229. return self;
  49230. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  49231. },
  49232. args: [],
  49233. 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",
  49234. referencedClasses: [],
  49235. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  49236. }),
  49237. $globals.CollectionTest);
  49238. $core.addMethod(
  49239. $core.method({
  49240. selector: "testCopySeparates",
  49241. protocol: 'tests',
  49242. fn: function (){
  49243. var self=this;
  49244. var original,copy;
  49245. return $core.withContext(function($ctx1) {
  49246. original=self._collection();
  49247. $ctx1.sendIdx["collection"]=1;
  49248. copy=$recv(original)._copy();
  49249. $recv(copy)._addAll_(self._sampleNewValueAsCollection());
  49250. self._assert_($recv(original).__eq(self._collection()));
  49251. return self;
  49252. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  49253. },
  49254. args: [],
  49255. 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",
  49256. referencedClasses: [],
  49257. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  49258. }),
  49259. $globals.CollectionTest);
  49260. $core.addMethod(
  49261. $core.method({
  49262. selector: "testDetect",
  49263. protocol: 'tests',
  49264. fn: function (){
  49265. var self=this;
  49266. return $core.withContext(function($ctx1) {
  49267. var $1,$2,$3,$4,$6,$5,$7;
  49268. self._shouldnt_raise_((function(){
  49269. return $core.withContext(function($ctx2) {
  49270. $1=self._collection();
  49271. $ctx2.sendIdx["collection"]=1;
  49272. return $recv($1)._detect_((function(){
  49273. return true;
  49274. }));
  49275. $ctx2.sendIdx["detect:"]=1;
  49276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49277. }),$globals.Error);
  49278. self._should_raise_((function(){
  49279. return $core.withContext(function($ctx2) {
  49280. $2=self._collection();
  49281. $ctx2.sendIdx["collection"]=2;
  49282. return $recv($2)._detect_((function(){
  49283. return false;
  49284. }));
  49285. $ctx2.sendIdx["detect:"]=2;
  49286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49287. }),$globals.Error);
  49288. $ctx1.sendIdx["should:raise:"]=1;
  49289. $3=$recv(self._sampleNewValueAsCollection())._detect_((function(){
  49290. return true;
  49291. }));
  49292. $ctx1.sendIdx["detect:"]=3;
  49293. $4=self._sampleNewValue();
  49294. $ctx1.sendIdx["sampleNewValue"]=1;
  49295. self._assert_equals_($3,$4);
  49296. $ctx1.sendIdx["assert:equals:"]=1;
  49297. $5=$recv(self._collectionWithNewValue())._detect_((function(each){
  49298. return $core.withContext(function($ctx2) {
  49299. $6=self._sampleNewValue();
  49300. $ctx2.sendIdx["sampleNewValue"]=2;
  49301. return $recv(each).__eq($6);
  49302. $ctx2.sendIdx["="]=1;
  49303. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49304. }));
  49305. $ctx1.sendIdx["detect:"]=4;
  49306. $7=self._sampleNewValue();
  49307. $ctx1.sendIdx["sampleNewValue"]=3;
  49308. self._assert_equals_($5,$7);
  49309. self._should_raise_((function(){
  49310. return $core.withContext(function($ctx2) {
  49311. return $recv(self._collection())._detect_((function(each){
  49312. return $core.withContext(function($ctx3) {
  49313. return $recv(each).__eq(self._sampleNewValue());
  49314. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  49315. }));
  49316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  49317. }),$globals.Error);
  49318. return self;
  49319. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  49320. },
  49321. args: [],
  49322. 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",
  49323. referencedClasses: ["Error"],
  49324. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  49325. }),
  49326. $globals.CollectionTest);
  49327. $core.addMethod(
  49328. $core.method({
  49329. selector: "testDetectIfNone",
  49330. protocol: 'tests',
  49331. fn: function (){
  49332. var self=this;
  49333. var sentinel;
  49334. return $core.withContext(function($ctx1) {
  49335. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  49336. sentinel=$recv($globals.Object)._new();
  49337. $3=self._collection();
  49338. $ctx1.sendIdx["collection"]=1;
  49339. $2=$recv($3)._detect_ifNone_((function(){
  49340. return true;
  49341. }),(function(){
  49342. return sentinel;
  49343. }));
  49344. $ctx1.sendIdx["detect:ifNone:"]=1;
  49345. $1=$recv($2).__tild_eq(sentinel);
  49346. self._assert_($1);
  49347. $5=self._collection();
  49348. $ctx1.sendIdx["collection"]=2;
  49349. $4=$recv($5)._detect_ifNone_((function(){
  49350. return false;
  49351. }),(function(){
  49352. return sentinel;
  49353. }));
  49354. $ctx1.sendIdx["detect:ifNone:"]=2;
  49355. self._assert_equals_($4,sentinel);
  49356. $ctx1.sendIdx["assert:equals:"]=1;
  49357. $6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  49358. return true;
  49359. }),(function(){
  49360. return sentinel;
  49361. }));
  49362. $ctx1.sendIdx["detect:ifNone:"]=3;
  49363. $7=self._sampleNewValue();
  49364. $ctx1.sendIdx["sampleNewValue"]=1;
  49365. self._assert_equals_($6,$7);
  49366. $ctx1.sendIdx["assert:equals:"]=2;
  49367. $8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){
  49368. return $core.withContext(function($ctx2) {
  49369. $9=self._sampleNewValue();
  49370. $ctx2.sendIdx["sampleNewValue"]=2;
  49371. return $recv(each).__eq($9);
  49372. $ctx2.sendIdx["="]=1;
  49373. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  49374. }),(function(){
  49375. return sentinel;
  49376. }));
  49377. $ctx1.sendIdx["detect:ifNone:"]=4;
  49378. $10=self._sampleNewValue();
  49379. $ctx1.sendIdx["sampleNewValue"]=3;
  49380. self._assert_equals_($8,$10);
  49381. $ctx1.sendIdx["assert:equals:"]=3;
  49382. self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){
  49383. return $core.withContext(function($ctx2) {
  49384. return $recv(each).__eq(self._sampleNewValue());
  49385. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  49386. }),(function(){
  49387. return sentinel;
  49388. })),sentinel);
  49389. return self;
  49390. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  49391. },
  49392. args: [],
  49393. 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",
  49394. referencedClasses: ["Object"],
  49395. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  49396. }),
  49397. $globals.CollectionTest);
  49398. $core.addMethod(
  49399. $core.method({
  49400. selector: "testDo",
  49401. protocol: 'tests',
  49402. fn: function (){
  49403. var self=this;
  49404. var newCollection;
  49405. return $core.withContext(function($ctx1) {
  49406. var $1,$2;
  49407. newCollection=$recv($globals.OrderedCollection)._new();
  49408. $ctx1.sendIdx["new"]=1;
  49409. $1=self._collection();
  49410. $ctx1.sendIdx["collection"]=1;
  49411. $recv($1)._do_((function(each){
  49412. return $core.withContext(function($ctx2) {
  49413. return $recv(newCollection)._add_(each);
  49414. $ctx2.sendIdx["add:"]=1;
  49415. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49416. }));
  49417. $ctx1.sendIdx["do:"]=1;
  49418. self._assertSameContents_as_(self._collection(),newCollection);
  49419. $ctx1.sendIdx["assertSameContents:as:"]=1;
  49420. newCollection=$recv($globals.OrderedCollection)._new();
  49421. $2=self._collectionWithDuplicates();
  49422. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  49423. $recv($2)._do_((function(each){
  49424. return $core.withContext(function($ctx2) {
  49425. return $recv(newCollection)._add_(each);
  49426. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49427. }));
  49428. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  49429. return self;
  49430. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  49431. },
  49432. args: [],
  49433. 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",
  49434. referencedClasses: ["OrderedCollection"],
  49435. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  49436. }),
  49437. $globals.CollectionTest);
  49438. $core.addMethod(
  49439. $core.method({
  49440. selector: "testEquality",
  49441. protocol: 'tests',
  49442. fn: function (){
  49443. var self=this;
  49444. return $core.withContext(function($ctx1) {
  49445. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  49446. $2=self._collectionClass();
  49447. $ctx1.sendIdx["collectionClass"]=1;
  49448. $1=$recv($2)._new();
  49449. $ctx1.sendIdx["new"]=1;
  49450. $4=self._collectionClass();
  49451. $ctx1.sendIdx["collectionClass"]=2;
  49452. $3=$recv($4)._new();
  49453. $ctx1.sendIdx["new"]=2;
  49454. self._assert_equals_($1,$3);
  49455. $ctx1.sendIdx["assert:equals:"]=1;
  49456. $5=self._collection();
  49457. $ctx1.sendIdx["collection"]=1;
  49458. $6=self._collection();
  49459. $ctx1.sendIdx["collection"]=2;
  49460. self._assert_equals_($5,$6);
  49461. $ctx1.sendIdx["assert:equals:"]=2;
  49462. $7=self._collectionWithNewValue();
  49463. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49464. $8=self._collectionWithNewValue();
  49465. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49466. self._assert_equals_($7,$8);
  49467. $11=self._collectionClass();
  49468. $ctx1.sendIdx["collectionClass"]=3;
  49469. $10=$recv($11)._new();
  49470. $ctx1.sendIdx["new"]=3;
  49471. $12=self._collection();
  49472. $ctx1.sendIdx["collection"]=3;
  49473. $9=$recv($10).__eq($12);
  49474. $ctx1.sendIdx["="]=1;
  49475. self._deny_($9);
  49476. $ctx1.sendIdx["deny:"]=1;
  49477. $14=self._collection();
  49478. $ctx1.sendIdx["collection"]=4;
  49479. $13=$recv($14).__eq($recv(self._collectionClass())._new());
  49480. $ctx1.sendIdx["="]=2;
  49481. self._deny_($13);
  49482. $ctx1.sendIdx["deny:"]=2;
  49483. self._deny_($recv(self._collection()).__eq(self._collectionWithNewValue()));
  49484. return self;
  49485. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  49486. },
  49487. args: [],
  49488. 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",
  49489. referencedClasses: [],
  49490. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  49491. }),
  49492. $globals.CollectionTest);
  49493. $core.addMethod(
  49494. $core.method({
  49495. selector: "testIfEmptyFamily",
  49496. protocol: 'tests',
  49497. fn: function (){
  49498. var self=this;
  49499. return $core.withContext(function($ctx1) {
  49500. 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;
  49501. $3=self._collectionClass();
  49502. $ctx1.sendIdx["collectionClass"]=1;
  49503. $2=$recv($3)._new();
  49504. $ctx1.sendIdx["new"]=1;
  49505. $1=$recv($2)._ifEmpty_((function(){
  49506. return (42);
  49507. }));
  49508. $ctx1.sendIdx["ifEmpty:"]=1;
  49509. self._assert_equals_($1,(42));
  49510. $ctx1.sendIdx["assert:equals:"]=1;
  49511. $5=self._collection();
  49512. $ctx1.sendIdx["collection"]=1;
  49513. $4=$recv($5)._ifEmpty_((function(){
  49514. return (42);
  49515. }));
  49516. $6=self._collection();
  49517. $ctx1.sendIdx["collection"]=2;
  49518. self._assert_equals_($4,$6);
  49519. $ctx1.sendIdx["assert:equals:"]=2;
  49520. $9=self._collectionClass();
  49521. $ctx1.sendIdx["collectionClass"]=2;
  49522. $8=$recv($9)._new();
  49523. $ctx1.sendIdx["new"]=2;
  49524. $7=$recv($8)._ifNotEmpty_((function(){
  49525. return (42);
  49526. }));
  49527. $ctx1.sendIdx["ifNotEmpty:"]=1;
  49528. $11=self._collectionClass();
  49529. $ctx1.sendIdx["collectionClass"]=3;
  49530. $10=$recv($11)._new();
  49531. $ctx1.sendIdx["new"]=3;
  49532. self._assert_equals_($7,$10);
  49533. $ctx1.sendIdx["assert:equals:"]=3;
  49534. $13=self._collection();
  49535. $ctx1.sendIdx["collection"]=3;
  49536. $12=$recv($13)._ifNotEmpty_((function(){
  49537. return (42);
  49538. }));
  49539. $ctx1.sendIdx["ifNotEmpty:"]=2;
  49540. self._assert_equals_($12,(42));
  49541. $ctx1.sendIdx["assert:equals:"]=4;
  49542. $15=self._collection();
  49543. $ctx1.sendIdx["collection"]=4;
  49544. $14=$recv($15)._ifNotEmpty_((function(col){
  49545. return col;
  49546. }));
  49547. $16=self._collection();
  49548. $ctx1.sendIdx["collection"]=5;
  49549. self._assert_equals_($14,$16);
  49550. $ctx1.sendIdx["assert:equals:"]=5;
  49551. $19=self._collectionClass();
  49552. $ctx1.sendIdx["collectionClass"]=4;
  49553. $18=$recv($19)._new();
  49554. $ctx1.sendIdx["new"]=4;
  49555. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  49556. return (42);
  49557. }),(function(){
  49558. return (999);
  49559. }));
  49560. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  49561. self._assert_equals_($17,(42));
  49562. $ctx1.sendIdx["assert:equals:"]=6;
  49563. $21=self._collection();
  49564. $ctx1.sendIdx["collection"]=6;
  49565. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  49566. return (42);
  49567. }),(function(){
  49568. return (999);
  49569. }));
  49570. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  49571. self._assert_equals_($20,(999));
  49572. $ctx1.sendIdx["assert:equals:"]=7;
  49573. $23=self._collection();
  49574. $ctx1.sendIdx["collection"]=7;
  49575. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  49576. return (42);
  49577. }),(function(col){
  49578. return col;
  49579. }));
  49580. $24=self._collection();
  49581. $ctx1.sendIdx["collection"]=8;
  49582. self._assert_equals_($22,$24);
  49583. $ctx1.sendIdx["assert:equals:"]=8;
  49584. $25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  49585. return (42);
  49586. }),(function(){
  49587. return (999);
  49588. }));
  49589. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  49590. self._assert_equals_($25,(999));
  49591. $ctx1.sendIdx["assert:equals:"]=9;
  49592. $27=self._collection();
  49593. $ctx1.sendIdx["collection"]=9;
  49594. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  49595. return (42);
  49596. }),(function(){
  49597. return (999);
  49598. }));
  49599. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  49600. self._assert_equals_($26,(42));
  49601. $ctx1.sendIdx["assert:equals:"]=10;
  49602. $29=self._collection();
  49603. $ctx1.sendIdx["collection"]=10;
  49604. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  49605. return col;
  49606. }),(function(){
  49607. return (999);
  49608. }));
  49609. self._assert_equals_($28,self._collection());
  49610. return self;
  49611. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  49612. },
  49613. args: [],
  49614. 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.",
  49615. referencedClasses: [],
  49616. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  49617. }),
  49618. $globals.CollectionTest);
  49619. $core.addMethod(
  49620. $core.method({
  49621. selector: "testIsEmpty",
  49622. protocol: 'tests',
  49623. fn: function (){
  49624. var self=this;
  49625. return $core.withContext(function($ctx1) {
  49626. var $1;
  49627. $1=$recv($recv(self._collectionClass())._new())._isEmpty();
  49628. $ctx1.sendIdx["isEmpty"]=1;
  49629. self._assert_($1);
  49630. self._deny_($recv(self._collection())._isEmpty());
  49631. return self;
  49632. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  49633. },
  49634. args: [],
  49635. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  49636. referencedClasses: [],
  49637. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  49638. }),
  49639. $globals.CollectionTest);
  49640. $core.addMethod(
  49641. $core.method({
  49642. selector: "testNoneSatisfy",
  49643. protocol: 'tests',
  49644. fn: function (){
  49645. var self=this;
  49646. var anyOne;
  49647. return $core.withContext(function($ctx1) {
  49648. var $1,$3,$2;
  49649. $1=self._collection();
  49650. $ctx1.sendIdx["collection"]=1;
  49651. anyOne=$recv($1)._anyOne();
  49652. $3=self._collection();
  49653. $ctx1.sendIdx["collection"]=2;
  49654. $2=$recv($3)._noneSatisfy_((function(each){
  49655. return $core.withContext(function($ctx2) {
  49656. return $recv(each).__eq(anyOne);
  49657. $ctx2.sendIdx["="]=1;
  49658. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49659. }));
  49660. $ctx1.sendIdx["noneSatisfy:"]=1;
  49661. self._deny_($2);
  49662. self._assert_($recv(self._collection())._noneSatisfy_((function(each){
  49663. return $core.withContext(function($ctx2) {
  49664. return $recv(each).__eq($recv($globals.Object)._new());
  49665. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49666. })));
  49667. return self;
  49668. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  49669. },
  49670. args: [],
  49671. 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 ])",
  49672. referencedClasses: ["Object"],
  49673. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  49674. }),
  49675. $globals.CollectionTest);
  49676. $core.addMethod(
  49677. $core.method({
  49678. selector: "testRemoveAll",
  49679. protocol: 'tests',
  49680. fn: function (){
  49681. var self=this;
  49682. return $core.withContext(function($ctx1) {
  49683. var $2,$1;
  49684. $2=self._collection();
  49685. $recv($2)._removeAll();
  49686. $1=$recv($2)._yourself();
  49687. self._assert_equals_($1,$recv(self._collectionClass())._new());
  49688. return self;
  49689. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  49690. },
  49691. args: [],
  49692. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  49693. referencedClasses: [],
  49694. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  49695. }),
  49696. $globals.CollectionTest);
  49697. $core.addMethod(
  49698. $core.method({
  49699. selector: "testSelect",
  49700. protocol: 'tests',
  49701. fn: function (){
  49702. var self=this;
  49703. return $core.withContext(function($ctx1) {
  49704. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  49705. $2=self._collection();
  49706. $ctx1.sendIdx["collection"]=1;
  49707. $1=$recv($2)._select_((function(){
  49708. return false;
  49709. }));
  49710. $ctx1.sendIdx["select:"]=1;
  49711. $4=self._collectionClass();
  49712. $ctx1.sendIdx["collectionClass"]=1;
  49713. $3=$recv($4)._new();
  49714. $ctx1.sendIdx["new"]=1;
  49715. self._assert_equals_($1,$3);
  49716. $ctx1.sendIdx["assert:equals:"]=1;
  49717. $6=self._collection();
  49718. $ctx1.sendIdx["collection"]=2;
  49719. $5=$recv($6)._select_((function(){
  49720. return true;
  49721. }));
  49722. $ctx1.sendIdx["select:"]=2;
  49723. $7=self._collection();
  49724. $ctx1.sendIdx["collection"]=3;
  49725. self._assert_equals_($5,$7);
  49726. $ctx1.sendIdx["assert:equals:"]=2;
  49727. $9=self._collectionWithNewValue();
  49728. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49729. $8=$recv($9)._select_((function(each){
  49730. return $core.withContext(function($ctx2) {
  49731. $10=self._sampleNewValue();
  49732. $ctx2.sendIdx["sampleNewValue"]=1;
  49733. return $recv(each).__eq($10);
  49734. $ctx2.sendIdx["="]=1;
  49735. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  49736. }));
  49737. $ctx1.sendIdx["select:"]=3;
  49738. self._assert_equals_($8,self._sampleNewValueAsCollection());
  49739. $ctx1.sendIdx["assert:equals:"]=3;
  49740. $12=self._collectionWithNewValue();
  49741. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49742. $11=$recv($12)._select_((function(each){
  49743. return $core.withContext(function($ctx2) {
  49744. $13=self._sampleNewValue();
  49745. $ctx2.sendIdx["sampleNewValue"]=2;
  49746. return $recv(each).__tild_eq($13);
  49747. $ctx2.sendIdx["~="]=1;
  49748. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  49749. }));
  49750. $ctx1.sendIdx["select:"]=4;
  49751. $14=self._collection();
  49752. $ctx1.sendIdx["collection"]=4;
  49753. self._assert_equals_($11,$14);
  49754. $ctx1.sendIdx["assert:equals:"]=4;
  49755. $16=self._collection();
  49756. $ctx1.sendIdx["collection"]=5;
  49757. $15=$recv($16)._select_((function(each){
  49758. return $core.withContext(function($ctx2) {
  49759. $17=self._sampleNewValue();
  49760. $ctx2.sendIdx["sampleNewValue"]=3;
  49761. return $recv(each).__eq($17);
  49762. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  49763. }));
  49764. $ctx1.sendIdx["select:"]=5;
  49765. self._assert_equals_($15,$recv(self._collectionClass())._new());
  49766. $ctx1.sendIdx["assert:equals:"]=5;
  49767. self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){
  49768. return $core.withContext(function($ctx2) {
  49769. return $recv(each).__tild_eq(self._sampleNewValue());
  49770. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49771. })),self._collection());
  49772. return self;
  49773. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  49774. },
  49775. args: [],
  49776. 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",
  49777. referencedClasses: [],
  49778. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  49779. }),
  49780. $globals.CollectionTest);
  49781. $core.addMethod(
  49782. $core.method({
  49783. selector: "testSingle",
  49784. protocol: 'tests',
  49785. fn: function (){
  49786. var self=this;
  49787. return $core.withContext(function($ctx1) {
  49788. self._should_raise_((function(){
  49789. return $core.withContext(function($ctx2) {
  49790. return $recv($recv(self._collectionClass())._new())._single();
  49791. $ctx2.sendIdx["single"]=1;
  49792. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49793. }),$globals.Error);
  49794. $ctx1.sendIdx["should:raise:"]=1;
  49795. self._should_raise_((function(){
  49796. return $core.withContext(function($ctx2) {
  49797. return $recv(self._collection())._single();
  49798. $ctx2.sendIdx["single"]=2;
  49799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49800. }),$globals.Error);
  49801. self._assert_equals_($recv(self._sampleNewValueAsCollection())._single(),self._sampleNewValue());
  49802. return self;
  49803. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  49804. },
  49805. args: [],
  49806. 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",
  49807. referencedClasses: ["Error"],
  49808. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  49809. }),
  49810. $globals.CollectionTest);
  49811. $core.addMethod(
  49812. $core.method({
  49813. selector: "testSize",
  49814. protocol: 'tests',
  49815. fn: function (){
  49816. var self=this;
  49817. return $core.withContext(function($ctx1) {
  49818. var $1,$2;
  49819. $1=$recv($recv(self._collectionClass())._new())._size();
  49820. $ctx1.sendIdx["size"]=1;
  49821. self._assert_equals_($1,(0));
  49822. $ctx1.sendIdx["assert:equals:"]=1;
  49823. $2=$recv(self._sampleNewValueAsCollection())._size();
  49824. $ctx1.sendIdx["size"]=2;
  49825. self._assert_equals_($2,(1));
  49826. $ctx1.sendIdx["assert:equals:"]=2;
  49827. self._assert_equals_($recv(self._collection())._size(),self._collectionSize());
  49828. return self;
  49829. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  49830. },
  49831. args: [],
  49832. 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",
  49833. referencedClasses: [],
  49834. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  49835. }),
  49836. $globals.CollectionTest);
  49837. $core.addMethod(
  49838. $core.method({
  49839. selector: "collectionClass",
  49840. protocol: 'fixture',
  49841. fn: function (){
  49842. var self=this;
  49843. return nil;
  49844. },
  49845. args: [],
  49846. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  49847. referencedClasses: [],
  49848. messageSends: []
  49849. }),
  49850. $globals.CollectionTest.klass);
  49851. $core.addMethod(
  49852. $core.method({
  49853. selector: "isAbstract",
  49854. protocol: 'testing',
  49855. fn: function (){
  49856. var self=this;
  49857. return $core.withContext(function($ctx1) {
  49858. return $recv(self._collectionClass())._isNil();
  49859. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)});
  49860. },
  49861. args: [],
  49862. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  49863. referencedClasses: [],
  49864. messageSends: ["isNil", "collectionClass"]
  49865. }),
  49866. $globals.CollectionTest.klass);
  49867. $core.addClass('IndexableCollectionTest', $globals.CollectionTest, [], 'Kernel-Tests');
  49868. $core.addMethod(
  49869. $core.method({
  49870. selector: "collectionWithNewValue",
  49871. protocol: 'fixture',
  49872. fn: function (){
  49873. var self=this;
  49874. return $core.withContext(function($ctx1) {
  49875. self._subclassResponsibility();
  49876. return self;
  49877. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  49878. },
  49879. args: [],
  49880. 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",
  49881. referencedClasses: [],
  49882. messageSends: ["subclassResponsibility"]
  49883. }),
  49884. $globals.IndexableCollectionTest);
  49885. $core.addMethod(
  49886. $core.method({
  49887. selector: "sampleNewIndex",
  49888. protocol: 'fixture',
  49889. fn: function (){
  49890. var self=this;
  49891. return $core.withContext(function($ctx1) {
  49892. self._subclassResponsibility();
  49893. return self;
  49894. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  49895. },
  49896. args: [],
  49897. 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",
  49898. referencedClasses: [],
  49899. messageSends: ["subclassResponsibility"]
  49900. }),
  49901. $globals.IndexableCollectionTest);
  49902. $core.addMethod(
  49903. $core.method({
  49904. selector: "sampleNonIndexesDo:",
  49905. protocol: 'fixture',
  49906. fn: function (aBlock){
  49907. var self=this;
  49908. return $core.withContext(function($ctx1) {
  49909. self._subclassResponsibility();
  49910. return self;
  49911. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  49912. },
  49913. args: ["aBlock"],
  49914. source: "sampleNonIndexesDo: 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",
  49915. referencedClasses: [],
  49916. messageSends: ["subclassResponsibility"]
  49917. }),
  49918. $globals.IndexableCollectionTest);
  49919. $core.addMethod(
  49920. $core.method({
  49921. selector: "samplesDo:",
  49922. protocol: 'fixture',
  49923. fn: function (aBlock){
  49924. var self=this;
  49925. return $core.withContext(function($ctx1) {
  49926. self._subclassResponsibility();
  49927. return self;
  49928. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  49929. },
  49930. args: ["aBlock"],
  49931. 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",
  49932. referencedClasses: [],
  49933. messageSends: ["subclassResponsibility"]
  49934. }),
  49935. $globals.IndexableCollectionTest);
  49936. $core.addMethod(
  49937. $core.method({
  49938. selector: "testAt",
  49939. protocol: 'tests',
  49940. fn: function (){
  49941. var self=this;
  49942. return $core.withContext(function($ctx1) {
  49943. var $1;
  49944. self._nonIndexesDo_((function(each){
  49945. return $core.withContext(function($ctx2) {
  49946. return self._should_raise_((function(){
  49947. return $core.withContext(function($ctx3) {
  49948. $1=self._collection();
  49949. $ctx3.sendIdx["collection"]=1;
  49950. return $recv($1)._at_(each);
  49951. $ctx3.sendIdx["at:"]=1;
  49952. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49953. }),$globals.Error);
  49954. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49955. }));
  49956. self._samplesDo_((function(index,value){
  49957. return $core.withContext(function($ctx2) {
  49958. return self._assert_equals_($recv(self._collection())._at_(index),value);
  49959. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  49960. }));
  49961. return self;
  49962. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  49963. },
  49964. args: [],
  49965. 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 ]",
  49966. referencedClasses: ["Error"],
  49967. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  49968. }),
  49969. $globals.IndexableCollectionTest);
  49970. $core.addMethod(
  49971. $core.method({
  49972. selector: "testAtIfAbsent",
  49973. protocol: 'tests',
  49974. fn: function (){
  49975. var self=this;
  49976. return $core.withContext(function($ctx1) {
  49977. var $2,$1,$3;
  49978. self._nonIndexesDo_((function(each){
  49979. return $core.withContext(function($ctx2) {
  49980. $2=self._collection();
  49981. $ctx2.sendIdx["collection"]=1;
  49982. $1=$recv($2)._at_ifAbsent_(each,(function(){
  49983. return $core.withContext(function($ctx3) {
  49984. return self._sampleNewValue();
  49985. $ctx3.sendIdx["sampleNewValue"]=1;
  49986. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49987. }));
  49988. $ctx2.sendIdx["at:ifAbsent:"]=1;
  49989. $3=self._sampleNewValue();
  49990. $ctx2.sendIdx["sampleNewValue"]=2;
  49991. return self._assert_equals_($1,$3);
  49992. $ctx2.sendIdx["assert:equals:"]=1;
  49993. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49994. }));
  49995. self._samplesDo_((function(index,value){
  49996. return $core.withContext(function($ctx2) {
  49997. return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){
  49998. return $core.withContext(function($ctx3) {
  49999. return self._sampleNewValue();
  50000. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  50001. })),value);
  50002. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50003. }));
  50004. return self;
  50005. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  50006. },
  50007. args: [],
  50008. 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 ].",
  50009. referencedClasses: [],
  50010. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  50011. }),
  50012. $globals.IndexableCollectionTest);
  50013. $core.addMethod(
  50014. $core.method({
  50015. selector: "testAtIfAbsentPut",
  50016. protocol: 'tests',
  50017. fn: function (){
  50018. var self=this;
  50019. var newCollection;
  50020. return $core.withContext(function($ctx1) {
  50021. var $1;
  50022. newCollection=self._collection();
  50023. $ctx1.sendIdx["collection"]=1;
  50024. self._samplesDo_((function(index,value){
  50025. return $core.withContext(function($ctx2) {
  50026. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  50027. return $core.withContext(function($ctx3) {
  50028. return self._sampleNewValue();
  50029. $ctx3.sendIdx["sampleNewValue"]=1;
  50030. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50031. }));
  50032. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  50033. return self._assert_equals_($1,value);
  50034. $ctx2.sendIdx["assert:equals:"]=1;
  50035. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50036. }));
  50037. self._assert_equals_(newCollection,self._collection());
  50038. $ctx1.sendIdx["assert:equals:"]=2;
  50039. self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  50040. return $core.withContext(function($ctx2) {
  50041. return self._sampleNewValue();
  50042. $ctx2.sendIdx["sampleNewValue"]=2;
  50043. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50044. })),self._sampleNewValue());
  50045. $ctx1.sendIdx["assert:equals:"]=3;
  50046. self._assert_equals_(newCollection,self._collectionWithNewValue());
  50047. return self;
  50048. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  50049. },
  50050. args: [],
  50051. 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",
  50052. referencedClasses: [],
  50053. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  50054. }),
  50055. $globals.IndexableCollectionTest);
  50056. $core.addMethod(
  50057. $core.method({
  50058. selector: "testAtIfPresent",
  50059. protocol: 'tests',
  50060. fn: function (){
  50061. var self=this;
  50062. var visited,sentinel;
  50063. return $core.withContext(function($ctx1) {
  50064. var $2,$1,$4,$3;
  50065. sentinel=$recv($globals.Object)._new();
  50066. self._nonIndexesDo_((function(each){
  50067. return $core.withContext(function($ctx2) {
  50068. visited=nil;
  50069. visited;
  50070. $2=self._collection();
  50071. $ctx2.sendIdx["collection"]=1;
  50072. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  50073. visited=value1;
  50074. visited;
  50075. return sentinel;
  50076. }));
  50077. $ctx2.sendIdx["at:ifPresent:"]=1;
  50078. self._assert_equals_($1,nil);
  50079. $ctx2.sendIdx["assert:equals:"]=1;
  50080. return self._assert_($recv(visited)._isNil());
  50081. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50082. }));
  50083. self._samplesDo_((function(index,value){
  50084. return $core.withContext(function($ctx2) {
  50085. visited=nil;
  50086. visited;
  50087. $4=self._collection();
  50088. $ctx2.sendIdx["collection"]=2;
  50089. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  50090. visited=value2;
  50091. visited;
  50092. return sentinel;
  50093. }));
  50094. self._assert_equals_($3,sentinel);
  50095. $ctx2.sendIdx["assert:equals:"]=2;
  50096. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  50097. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50098. }));
  50099. return self;
  50100. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  50101. },
  50102. args: [],
  50103. 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) ]",
  50104. referencedClasses: ["Object"],
  50105. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  50106. }),
  50107. $globals.IndexableCollectionTest);
  50108. $core.addMethod(
  50109. $core.method({
  50110. selector: "testAtIfPresentIfAbsent",
  50111. protocol: 'tests',
  50112. fn: function (){
  50113. var self=this;
  50114. var visited,sentinel;
  50115. return $core.withContext(function($ctx1) {
  50116. var $2,$1,$3,$5,$4;
  50117. sentinel=$recv($globals.Object)._new();
  50118. self._nonIndexesDo_((function(each){
  50119. return $core.withContext(function($ctx2) {
  50120. visited=nil;
  50121. visited;
  50122. $2=self._collection();
  50123. $ctx2.sendIdx["collection"]=1;
  50124. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  50125. visited=value1;
  50126. visited;
  50127. return sentinel;
  50128. }),(function(){
  50129. return $core.withContext(function($ctx3) {
  50130. return self._sampleNewValue();
  50131. $ctx3.sendIdx["sampleNewValue"]=1;
  50132. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  50133. }));
  50134. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  50135. $3=self._sampleNewValue();
  50136. $ctx2.sendIdx["sampleNewValue"]=2;
  50137. self._assert_equals_($1,$3);
  50138. $ctx2.sendIdx["assert:equals:"]=1;
  50139. return self._assert_($recv(visited)._isNil());
  50140. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50141. }));
  50142. self._samplesDo_((function(index,value){
  50143. return $core.withContext(function($ctx2) {
  50144. visited=nil;
  50145. visited;
  50146. $5=self._collection();
  50147. $ctx2.sendIdx["collection"]=2;
  50148. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  50149. visited=value2;
  50150. visited;
  50151. return sentinel;
  50152. }),(function(){
  50153. return $core.withContext(function($ctx3) {
  50154. return self._sampleNewValue();
  50155. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  50156. }));
  50157. self._assert_equals_($4,sentinel);
  50158. $ctx2.sendIdx["assert:equals:"]=2;
  50159. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  50160. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  50161. }));
  50162. return self;
  50163. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  50164. },
  50165. args: [],
  50166. 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) ]",
  50167. referencedClasses: ["Object"],
  50168. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  50169. }),
  50170. $globals.IndexableCollectionTest);
  50171. $core.addMethod(
  50172. $core.method({
  50173. selector: "testAtPut",
  50174. protocol: 'tests',
  50175. fn: function (){
  50176. var self=this;
  50177. var newCollection;
  50178. return $core.withContext(function($ctx1) {
  50179. newCollection=self._collection();
  50180. $ctx1.sendIdx["collection"]=1;
  50181. self._samplesDo_((function(index,value){
  50182. return $core.withContext(function($ctx2) {
  50183. return $recv(newCollection)._at_put_(index,value);
  50184. $ctx2.sendIdx["at:put:"]=1;
  50185. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50186. }));
  50187. self._assert_equals_(newCollection,self._collection());
  50188. $ctx1.sendIdx["assert:equals:"]=1;
  50189. $recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  50190. self._assert_equals_(newCollection,self._collectionWithNewValue());
  50191. return self;
  50192. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  50193. },
  50194. args: [],
  50195. 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",
  50196. referencedClasses: [],
  50197. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  50198. }),
  50199. $globals.IndexableCollectionTest);
  50200. $core.addMethod(
  50201. $core.method({
  50202. selector: "testIndexOf",
  50203. protocol: 'tests',
  50204. fn: function (){
  50205. var self=this;
  50206. return $core.withContext(function($ctx1) {
  50207. var $1;
  50208. self._should_raise_((function(){
  50209. return $core.withContext(function($ctx2) {
  50210. $1=self._collection();
  50211. $ctx2.sendIdx["collection"]=1;
  50212. return $recv($1)._indexOf_(self._sampleNewValue());
  50213. $ctx2.sendIdx["indexOf:"]=1;
  50214. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50215. }),$globals.Error);
  50216. self._samplesDo_((function(index,value){
  50217. return $core.withContext(function($ctx2) {
  50218. return self._assert_equals_($recv(self._collection())._indexOf_(value),index);
  50219. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  50220. }));
  50221. return self;
  50222. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  50223. },
  50224. args: [],
  50225. 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 ]",
  50226. referencedClasses: ["Error"],
  50227. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  50228. }),
  50229. $globals.IndexableCollectionTest);
  50230. $core.addMethod(
  50231. $core.method({
  50232. selector: "testIndexOfWithNull",
  50233. protocol: 'tests',
  50234. fn: function (){
  50235. var self=this;
  50236. var jsNull;
  50237. return $core.withContext(function($ctx1) {
  50238. var $2,$1;
  50239. jsNull=$recv($globals.JSON)._parse_("null");
  50240. self._samplesDo_((function(index,value){
  50241. return $core.withContext(function($ctx2) {
  50242. $2=self._collection();
  50243. $recv($2)._at_put_(index,jsNull);
  50244. $1=$recv($2)._indexOf_(jsNull);
  50245. return self._assert_equals_($1,index);
  50246. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50247. }));
  50248. return self;
  50249. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  50250. },
  50251. args: [],
  50252. 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 ]",
  50253. referencedClasses: ["JSON"],
  50254. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  50255. }),
  50256. $globals.IndexableCollectionTest);
  50257. $core.addMethod(
  50258. $core.method({
  50259. selector: "testWithIndexDo",
  50260. protocol: 'tests',
  50261. fn: function (){
  50262. var self=this;
  50263. var collection;
  50264. return $core.withContext(function($ctx1) {
  50265. collection=self._collection();
  50266. $ctx1.sendIdx["collection"]=1;
  50267. $recv(self._collection())._withIndexDo_((function(each,index){
  50268. return $core.withContext(function($ctx2) {
  50269. return self._assert_equals_($recv(collection)._at_(index),each);
  50270. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  50271. }));
  50272. return self;
  50273. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  50274. },
  50275. args: [],
  50276. 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 ]",
  50277. referencedClasses: [],
  50278. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  50279. }),
  50280. $globals.IndexableCollectionTest);
  50281. $core.addClass('AssociativeCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  50282. $core.addMethod(
  50283. $core.method({
  50284. selector: "collectionKeys",
  50285. protocol: 'fixture',
  50286. fn: function (){
  50287. var self=this;
  50288. return $core.withContext(function($ctx1) {
  50289. self._subclassResponsibility();
  50290. return self;
  50291. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  50292. },
  50293. args: [],
  50294. source: "collectionKeys\x0a\x09self subclassResponsibility",
  50295. referencedClasses: [],
  50296. messageSends: ["subclassResponsibility"]
  50297. }),
  50298. $globals.AssociativeCollectionTest);
  50299. $core.addMethod(
  50300. $core.method({
  50301. selector: "collectionValues",
  50302. protocol: 'fixture',
  50303. fn: function (){
  50304. var self=this;
  50305. return $core.withContext(function($ctx1) {
  50306. self._subclassResponsibility();
  50307. return self;
  50308. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  50309. },
  50310. args: [],
  50311. source: "collectionValues\x0a\x09self subclassResponsibility",
  50312. referencedClasses: [],
  50313. messageSends: ["subclassResponsibility"]
  50314. }),
  50315. $globals.AssociativeCollectionTest);
  50316. $core.addMethod(
  50317. $core.method({
  50318. selector: "nonIndexesDo:",
  50319. protocol: 'fixture',
  50320. fn: function (aBlock){
  50321. var self=this;
  50322. return $core.withContext(function($ctx1) {
  50323. $recv(aBlock)._value_((5));
  50324. $ctx1.sendIdx["value:"]=1;
  50325. $recv(aBlock)._value_((function(){
  50326. }));
  50327. $ctx1.sendIdx["value:"]=2;
  50328. $recv(aBlock)._value_($recv($globals.Object)._new());
  50329. $ctx1.sendIdx["value:"]=3;
  50330. $recv(aBlock)._value_("z");
  50331. return self;
  50332. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  50333. },
  50334. args: ["aBlock"],
  50335. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  50336. referencedClasses: ["Object"],
  50337. messageSends: ["value:", "new"]
  50338. }),
  50339. $globals.AssociativeCollectionTest);
  50340. $core.addMethod(
  50341. $core.method({
  50342. selector: "sampleNewIndex",
  50343. protocol: 'fixture',
  50344. fn: function (){
  50345. var self=this;
  50346. return "new";
  50347. },
  50348. args: [],
  50349. source: "sampleNewIndex\x0a\x09^ 'new'",
  50350. referencedClasses: [],
  50351. messageSends: []
  50352. }),
  50353. $globals.AssociativeCollectionTest);
  50354. $core.addMethod(
  50355. $core.method({
  50356. selector: "samplesDo:",
  50357. protocol: 'fixture',
  50358. fn: function (aBlock){
  50359. var self=this;
  50360. return $core.withContext(function($ctx1) {
  50361. $recv(aBlock)._value_value_("a",(2));
  50362. return self;
  50363. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  50364. },
  50365. args: ["aBlock"],
  50366. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  50367. referencedClasses: [],
  50368. messageSends: ["value:value:"]
  50369. }),
  50370. $globals.AssociativeCollectionTest);
  50371. $core.addMethod(
  50372. $core.method({
  50373. selector: "testAddAll",
  50374. protocol: 'tests',
  50375. fn: function (){
  50376. var self=this;
  50377. return $core.withContext(function($ctx1) {
  50378. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  50379. (
  50380. $ctx1.supercall = true,
  50381. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($recv(self), []));
  50382. $ctx1.supercall = false;
  50383. $2=self._collection();
  50384. $ctx1.sendIdx["collection"]=1;
  50385. $3=self._collection();
  50386. $ctx1.sendIdx["collection"]=2;
  50387. $recv($2)._addAll_($3);
  50388. $ctx1.sendIdx["addAll:"]=1;
  50389. $4=$recv($2)._yourself();
  50390. $ctx1.sendIdx["yourself"]=1;
  50391. $1=$4;
  50392. $5=self._collection();
  50393. $ctx1.sendIdx["collection"]=3;
  50394. self._assert_equals_($1,$5);
  50395. $ctx1.sendIdx["assert:equals:"]=1;
  50396. $7=self._collection();
  50397. $ctx1.sendIdx["collection"]=4;
  50398. $8=self._collectionWithNewValue();
  50399. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50400. $recv($7)._addAll_($8);
  50401. $ctx1.sendIdx["addAll:"]=2;
  50402. $9=$recv($7)._yourself();
  50403. $ctx1.sendIdx["yourself"]=2;
  50404. $6=$9;
  50405. $10=self._collectionWithNewValue();
  50406. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50407. self._assert_equals_($6,$10);
  50408. $ctx1.sendIdx["assert:equals:"]=2;
  50409. $12=self._collectionWithNewValue();
  50410. $ctx1.sendIdx["collectionWithNewValue"]=3;
  50411. $recv($12)._addAll_(self._collection());
  50412. $11=$recv($12)._yourself();
  50413. self._assert_equals_($11,self._collectionWithNewValue());
  50414. return self;
  50415. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  50416. },
  50417. args: [],
  50418. 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",
  50419. referencedClasses: [],
  50420. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  50421. }),
  50422. $globals.AssociativeCollectionTest);
  50423. $core.addMethod(
  50424. $core.method({
  50425. selector: "testAsDictionary",
  50426. protocol: 'tests',
  50427. fn: function (){
  50428. var self=this;
  50429. return $core.withContext(function($ctx1) {
  50430. self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  50431. return self;
  50432. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  50433. },
  50434. args: [],
  50435. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  50436. referencedClasses: ["Dictionary"],
  50437. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  50438. }),
  50439. $globals.AssociativeCollectionTest);
  50440. $core.addMethod(
  50441. $core.method({
  50442. selector: "testAsHashedCollection",
  50443. protocol: 'tests',
  50444. fn: function (){
  50445. var self=this;
  50446. return $core.withContext(function($ctx1) {
  50447. self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  50448. return self;
  50449. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  50450. },
  50451. args: [],
  50452. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  50453. referencedClasses: ["HashedCollection"],
  50454. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  50455. }),
  50456. $globals.AssociativeCollectionTest);
  50457. $core.addMethod(
  50458. $core.method({
  50459. selector: "testComma",
  50460. protocol: 'tests',
  50461. fn: function (){
  50462. var self=this;
  50463. return $core.withContext(function($ctx1) {
  50464. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  50465. (
  50466. $ctx1.supercall = true,
  50467. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($recv(self), []));
  50468. $ctx1.supercall = false;
  50469. $2=self._collection();
  50470. $ctx1.sendIdx["collection"]=1;
  50471. $3=self._collection();
  50472. $ctx1.sendIdx["collection"]=2;
  50473. $1=$recv($2).__comma($3);
  50474. $ctx1.sendIdx[","]=1;
  50475. $4=self._collection();
  50476. $ctx1.sendIdx["collection"]=3;
  50477. self._assert_equals_($1,$4);
  50478. $ctx1.sendIdx["assert:equals:"]=1;
  50479. $6=self._collection();
  50480. $ctx1.sendIdx["collection"]=4;
  50481. $7=self._collectionWithNewValue();
  50482. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50483. $5=$recv($6).__comma($7);
  50484. $ctx1.sendIdx[","]=2;
  50485. $8=self._collectionWithNewValue();
  50486. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50487. self._assert_equals_($5,$8);
  50488. $ctx1.sendIdx["assert:equals:"]=2;
  50489. $10=self._collectionWithNewValue();
  50490. $ctx1.sendIdx["collectionWithNewValue"]=3;
  50491. $9=$recv($10).__comma(self._collection());
  50492. self._assert_equals_($9,self._collectionWithNewValue());
  50493. return self;
  50494. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  50495. },
  50496. args: [],
  50497. 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",
  50498. referencedClasses: [],
  50499. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  50500. }),
  50501. $globals.AssociativeCollectionTest);
  50502. $core.addMethod(
  50503. $core.method({
  50504. selector: "testFrom",
  50505. protocol: 'tests',
  50506. fn: function (){
  50507. var self=this;
  50508. var associations;
  50509. return $core.withContext(function($ctx1) {
  50510. var $1;
  50511. $1="a".__minus_gt((1));
  50512. $ctx1.sendIdx["->"]=1;
  50513. associations=[$1,"b".__minus_gt((2))];
  50514. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  50515. return self;
  50516. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  50517. },
  50518. args: [],
  50519. 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 }.",
  50520. referencedClasses: [],
  50521. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  50522. }),
  50523. $globals.AssociativeCollectionTest);
  50524. $core.addMethod(
  50525. $core.method({
  50526. selector: "testKeys",
  50527. protocol: 'tests',
  50528. fn: function (){
  50529. var self=this;
  50530. return $core.withContext(function($ctx1) {
  50531. var $2,$1,$3,$4;
  50532. $2=$recv($recv(self._collectionClass())._new())._keys();
  50533. $ctx1.sendIdx["keys"]=1;
  50534. $1=$recv($2)._isEmpty();
  50535. self._assert_($1);
  50536. $3=$recv(self._collection())._keys();
  50537. $ctx1.sendIdx["keys"]=2;
  50538. $4=self._collectionKeys();
  50539. $ctx1.sendIdx["collectionKeys"]=1;
  50540. self._assertSameContents_as_($3,$4);
  50541. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50542. self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  50543. return self;
  50544. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  50545. },
  50546. args: [],
  50547. 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 }",
  50548. referencedClasses: [],
  50549. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  50550. }),
  50551. $globals.AssociativeCollectionTest);
  50552. $core.addMethod(
  50553. $core.method({
  50554. selector: "testNewFromPairs",
  50555. protocol: 'tests',
  50556. fn: function (){
  50557. var self=this;
  50558. var flattenedAssociations;
  50559. return $core.withContext(function($ctx1) {
  50560. flattenedAssociations=["a",(1),"b",(2)];
  50561. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  50562. return self;
  50563. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  50564. },
  50565. args: [],
  50566. 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 }.",
  50567. referencedClasses: [],
  50568. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  50569. }),
  50570. $globals.AssociativeCollectionTest);
  50571. $core.addMethod(
  50572. $core.method({
  50573. selector: "testPrintString",
  50574. protocol: 'tests',
  50575. fn: function (){
  50576. var self=this;
  50577. return $core.withContext(function($ctx1) {
  50578. var $3,$2,$1,$4;
  50579. $3=self._collectionClass();
  50580. $ctx1.sendIdx["collectionClass"]=1;
  50581. $2=$recv($3)._new();
  50582. $recv($2)._at_put_("firstname","James");
  50583. $ctx1.sendIdx["at:put:"]=1;
  50584. $recv($2)._at_put_("lastname","Bond");
  50585. $1=$recv($2)._printString();
  50586. $4=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  50587. $ctx1.sendIdx[","]=1;
  50588. self._assert_equals_($1,$4);
  50589. return self;
  50590. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  50591. },
  50592. args: [],
  50593. 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'')'",
  50594. referencedClasses: [],
  50595. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  50596. }),
  50597. $globals.AssociativeCollectionTest);
  50598. $core.addMethod(
  50599. $core.method({
  50600. selector: "testRemoveKey",
  50601. protocol: 'tests',
  50602. fn: function (){
  50603. var self=this;
  50604. return $core.withContext(function($ctx1) {
  50605. var $1,$2,$3,$5,$6,$4,$8,$7;
  50606. self._nonIndexesDo_((function(each){
  50607. var collection;
  50608. return $core.withContext(function($ctx2) {
  50609. collection=self._collection();
  50610. $ctx2.sendIdx["collection"]=1;
  50611. collection;
  50612. self._should_raise_((function(){
  50613. return $core.withContext(function($ctx3) {
  50614. return $recv(collection)._removeKey_(each);
  50615. $ctx3.sendIdx["removeKey:"]=1;
  50616. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50617. }),$globals.Error);
  50618. $1=collection;
  50619. $2=self._collection();
  50620. $ctx2.sendIdx["collection"]=2;
  50621. return self._assert_equals_($1,$2);
  50622. $ctx2.sendIdx["assert:equals:"]=1;
  50623. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  50624. }));
  50625. self._samplesDo_((function(index,value){
  50626. var collection;
  50627. return $core.withContext(function($ctx2) {
  50628. collection=self._collection();
  50629. $ctx2.sendIdx["collection"]=3;
  50630. collection;
  50631. $3=$recv(collection)._removeKey_(index);
  50632. $ctx2.sendIdx["removeKey:"]=2;
  50633. self._assert_equals_($3,value);
  50634. $ctx2.sendIdx["assert:equals:"]=2;
  50635. $5=collection;
  50636. $6=self._collection();
  50637. $ctx2.sendIdx["collection"]=4;
  50638. $4=$recv($5).__eq($6);
  50639. return self._deny_($4);
  50640. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  50641. }));
  50642. $8=self._collectionWithNewValue();
  50643. $recv($8)._removeKey_(self._sampleNewIndex());
  50644. $7=$recv($8)._yourself();
  50645. self._assert_equals_($7,self._collection());
  50646. return self;
  50647. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  50648. },
  50649. args: [],
  50650. 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",
  50651. referencedClasses: ["Error"],
  50652. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  50653. }),
  50654. $globals.AssociativeCollectionTest);
  50655. $core.addMethod(
  50656. $core.method({
  50657. selector: "testRemoveKeyIfAbsent",
  50658. protocol: 'tests',
  50659. fn: function (){
  50660. var self=this;
  50661. return $core.withContext(function($ctx1) {
  50662. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  50663. self._nonIndexesDo_((function(each){
  50664. var collection;
  50665. return $core.withContext(function($ctx2) {
  50666. collection=self._collection();
  50667. $ctx2.sendIdx["collection"]=1;
  50668. collection;
  50669. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  50670. return $core.withContext(function($ctx3) {
  50671. return self._sampleNewValue();
  50672. $ctx3.sendIdx["sampleNewValue"]=1;
  50673. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50674. }));
  50675. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  50676. $2=self._sampleNewValue();
  50677. $ctx2.sendIdx["sampleNewValue"]=2;
  50678. self._assert_equals_($1,$2);
  50679. $ctx2.sendIdx["assert:equals:"]=1;
  50680. $3=collection;
  50681. $4=self._collection();
  50682. $ctx2.sendIdx["collection"]=2;
  50683. return self._assert_equals_($3,$4);
  50684. $ctx2.sendIdx["assert:equals:"]=2;
  50685. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  50686. }));
  50687. self._samplesDo_((function(index,value){
  50688. var collection;
  50689. return $core.withContext(function($ctx2) {
  50690. collection=self._collection();
  50691. $ctx2.sendIdx["collection"]=3;
  50692. collection;
  50693. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  50694. return $core.withContext(function($ctx3) {
  50695. return self._sampleNewValue();
  50696. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  50697. }));
  50698. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  50699. self._assert_equals_($5,value);
  50700. $ctx2.sendIdx["assert:equals:"]=3;
  50701. $7=collection;
  50702. $8=self._collection();
  50703. $ctx2.sendIdx["collection"]=4;
  50704. $6=$recv($7).__eq($8);
  50705. return self._deny_($6);
  50706. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  50707. }));
  50708. $10=self._collectionWithNewValue();
  50709. $recv($10)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  50710. return $core.withContext(function($ctx2) {
  50711. return self._assert_(false);
  50712. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  50713. }));
  50714. $9=$recv($10)._yourself();
  50715. self._assert_equals_($9,self._collection());
  50716. return self;
  50717. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  50718. },
  50719. args: [],
  50720. 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",
  50721. referencedClasses: [],
  50722. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  50723. }),
  50724. $globals.AssociativeCollectionTest);
  50725. $core.addMethod(
  50726. $core.method({
  50727. selector: "testValues",
  50728. protocol: 'tests',
  50729. fn: function (){
  50730. var self=this;
  50731. return $core.withContext(function($ctx1) {
  50732. var $2,$1,$3,$4;
  50733. $2=$recv($recv(self._collectionClass())._new())._values();
  50734. $ctx1.sendIdx["values"]=1;
  50735. $1=$recv($2)._isEmpty();
  50736. self._assert_($1);
  50737. $3=$recv(self._collection())._values();
  50738. $ctx1.sendIdx["values"]=2;
  50739. $4=self._collectionValues();
  50740. $ctx1.sendIdx["collectionValues"]=1;
  50741. self._assertSameContents_as_($3,$4);
  50742. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50743. self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()]));
  50744. return self;
  50745. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  50746. },
  50747. args: [],
  50748. 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 }",
  50749. referencedClasses: [],
  50750. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  50751. }),
  50752. $globals.AssociativeCollectionTest);
  50753. $core.addClass('DictionaryTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  50754. $core.addMethod(
  50755. $core.method({
  50756. selector: "collection",
  50757. protocol: 'fixture',
  50758. fn: function (){
  50759. var self=this;
  50760. return $core.withContext(function($ctx1) {
  50761. var $1;
  50762. $1=$recv($globals.Dictionary)._new();
  50763. $recv($1)._at_put_((1),(1));
  50764. $ctx1.sendIdx["at:put:"]=1;
  50765. $recv($1)._at_put_("a",(2));
  50766. $ctx1.sendIdx["at:put:"]=2;
  50767. $recv($1)._at_put_(true,(3));
  50768. $ctx1.sendIdx["at:put:"]=3;
  50769. $recv($1)._at_put_((1).__at((3)),(-4));
  50770. $ctx1.sendIdx["at:put:"]=4;
  50771. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50772. return $recv($1)._yourself();
  50773. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  50774. },
  50775. args: [],
  50776. 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",
  50777. referencedClasses: ["Dictionary"],
  50778. messageSends: ["at:put:", "new", "@", "yourself"]
  50779. }),
  50780. $globals.DictionaryTest);
  50781. $core.addMethod(
  50782. $core.method({
  50783. selector: "collectionKeys",
  50784. protocol: 'fixture',
  50785. fn: function (){
  50786. var self=this;
  50787. return $core.withContext(function($ctx1) {
  50788. return [(1),"a",true,(1).__at((3)),self["@sampleBlock"]];
  50789. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  50790. },
  50791. args: [],
  50792. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  50793. referencedClasses: [],
  50794. messageSends: ["@"]
  50795. }),
  50796. $globals.DictionaryTest);
  50797. $core.addMethod(
  50798. $core.method({
  50799. selector: "collectionOfPrintStrings",
  50800. protocol: 'fixture',
  50801. fn: function (){
  50802. var self=this;
  50803. return $core.withContext(function($ctx1) {
  50804. var $1;
  50805. $1=$recv($globals.Dictionary)._new();
  50806. $recv($1)._at_put_((1),"1");
  50807. $ctx1.sendIdx["at:put:"]=1;
  50808. $recv($1)._at_put_("a","2");
  50809. $ctx1.sendIdx["at:put:"]=2;
  50810. $recv($1)._at_put_(true,"3");
  50811. $ctx1.sendIdx["at:put:"]=3;
  50812. $recv($1)._at_put_((1).__at((3)),"-4");
  50813. $ctx1.sendIdx["at:put:"]=4;
  50814. $recv($1)._at_put_(self["@sampleBlock"],"9");
  50815. return $recv($1)._yourself();
  50816. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  50817. },
  50818. args: [],
  50819. 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",
  50820. referencedClasses: ["Dictionary"],
  50821. messageSends: ["at:put:", "new", "@", "yourself"]
  50822. }),
  50823. $globals.DictionaryTest);
  50824. $core.addMethod(
  50825. $core.method({
  50826. selector: "collectionSize",
  50827. protocol: 'fixture',
  50828. fn: function (){
  50829. var self=this;
  50830. return (5);
  50831. },
  50832. args: [],
  50833. source: "collectionSize\x0a\x09^ 5",
  50834. referencedClasses: [],
  50835. messageSends: []
  50836. }),
  50837. $globals.DictionaryTest);
  50838. $core.addMethod(
  50839. $core.method({
  50840. selector: "collectionValues",
  50841. protocol: 'fixture',
  50842. fn: function (){
  50843. var self=this;
  50844. return [(1),(2),(3),(-4),(9)];
  50845. },
  50846. args: [],
  50847. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  50848. referencedClasses: [],
  50849. messageSends: []
  50850. }),
  50851. $globals.DictionaryTest);
  50852. $core.addMethod(
  50853. $core.method({
  50854. selector: "collectionWithDuplicates",
  50855. protocol: 'fixture',
  50856. fn: function (){
  50857. var self=this;
  50858. return $core.withContext(function($ctx1) {
  50859. var $1;
  50860. $1=$recv($globals.Dictionary)._new();
  50861. $recv($1)._at_put_((1),(1));
  50862. $ctx1.sendIdx["at:put:"]=1;
  50863. $recv($1)._at_put_("a",(2));
  50864. $ctx1.sendIdx["at:put:"]=2;
  50865. $recv($1)._at_put_(true,(3));
  50866. $ctx1.sendIdx["at:put:"]=3;
  50867. $recv($1)._at_put_((4),(-4));
  50868. $ctx1.sendIdx["at:put:"]=4;
  50869. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50870. $ctx1.sendIdx["at:put:"]=5;
  50871. $recv($1)._at_put_("b",(1));
  50872. $ctx1.sendIdx["at:put:"]=6;
  50873. $recv($1)._at_put_((3),(3));
  50874. $ctx1.sendIdx["at:put:"]=7;
  50875. $recv($1)._at_put_(false,(12));
  50876. return $recv($1)._yourself();
  50877. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  50878. },
  50879. args: [],
  50880. 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",
  50881. referencedClasses: ["Dictionary"],
  50882. messageSends: ["at:put:", "new", "yourself"]
  50883. }),
  50884. $globals.DictionaryTest);
  50885. $core.addMethod(
  50886. $core.method({
  50887. selector: "collectionWithNewValue",
  50888. protocol: 'fixture',
  50889. fn: function (){
  50890. var self=this;
  50891. return $core.withContext(function($ctx1) {
  50892. var $1;
  50893. $1=$recv($globals.Dictionary)._new();
  50894. $recv($1)._at_put_((1),(1));
  50895. $ctx1.sendIdx["at:put:"]=1;
  50896. $recv($1)._at_put_("a",(2));
  50897. $ctx1.sendIdx["at:put:"]=2;
  50898. $recv($1)._at_put_(true,(3));
  50899. $ctx1.sendIdx["at:put:"]=3;
  50900. $recv($1)._at_put_((1).__at((3)),(-4));
  50901. $ctx1.sendIdx["at:put:"]=4;
  50902. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50903. $ctx1.sendIdx["at:put:"]=5;
  50904. $recv($1)._at_put_("new","N");
  50905. return $recv($1)._yourself();
  50906. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  50907. },
  50908. args: [],
  50909. 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",
  50910. referencedClasses: ["Dictionary"],
  50911. messageSends: ["at:put:", "new", "@", "yourself"]
  50912. }),
  50913. $globals.DictionaryTest);
  50914. $core.addMethod(
  50915. $core.method({
  50916. selector: "sampleNewValueAsCollection",
  50917. protocol: 'fixture',
  50918. fn: function (){
  50919. var self=this;
  50920. return $core.withContext(function($ctx1) {
  50921. var $1;
  50922. $1=$recv($globals.Dictionary)._new();
  50923. $recv($1)._at_put_("new","N");
  50924. return $recv($1)._yourself();
  50925. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  50926. },
  50927. args: [],
  50928. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  50929. referencedClasses: ["Dictionary"],
  50930. messageSends: ["at:put:", "new", "yourself"]
  50931. }),
  50932. $globals.DictionaryTest);
  50933. $core.addMethod(
  50934. $core.method({
  50935. selector: "samplesDo:",
  50936. protocol: 'fixture',
  50937. fn: function (aBlock){
  50938. var self=this;
  50939. return $core.withContext(function($ctx1) {
  50940. (
  50941. $ctx1.supercall = true,
  50942. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  50943. $ctx1.supercall = false;
  50944. $recv(aBlock)._value_value_(true,(3));
  50945. $ctx1.sendIdx["value:value:"]=1;
  50946. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  50947. $ctx1.sendIdx["value:value:"]=2;
  50948. $recv(aBlock)._value_value_(self["@sampleBlock"],(9));
  50949. return self;
  50950. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  50951. },
  50952. args: ["aBlock"],
  50953. 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",
  50954. referencedClasses: [],
  50955. messageSends: ["samplesDo:", "value:value:", "@"]
  50956. }),
  50957. $globals.DictionaryTest);
  50958. $core.addMethod(
  50959. $core.method({
  50960. selector: "testAccessing",
  50961. protocol: 'tests',
  50962. fn: function (){
  50963. var self=this;
  50964. var d;
  50965. return $core.withContext(function($ctx1) {
  50966. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  50967. d=$recv($globals.Dictionary)._new();
  50968. $recv(d)._at_put_("hello","world");
  50969. $ctx1.sendIdx["at:put:"]=1;
  50970. $1=$recv(d)._at_("hello");
  50971. $ctx1.sendIdx["at:"]=1;
  50972. self._assert_equals_($1,"world");
  50973. $ctx1.sendIdx["assert:equals:"]=1;
  50974. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  50975. return nil;
  50976. }));
  50977. $ctx1.sendIdx["at:ifAbsent:"]=1;
  50978. self._assert_equals_($2,"world");
  50979. $ctx1.sendIdx["assert:equals:"]=2;
  50980. self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  50981. return nil;
  50982. }))).__eq("world"));
  50983. $ctx1.sendIdx["deny:"]=1;
  50984. $3=$recv(d)._includesKey_("hello");
  50985. $ctx1.sendIdx["includesKey:"]=1;
  50986. self._assert_($3);
  50987. $ctx1.sendIdx["assert:"]=1;
  50988. $4=$recv(d)._includesKey_("foo");
  50989. $ctx1.sendIdx["includesKey:"]=2;
  50990. self._deny_($4);
  50991. $ctx1.sendIdx["deny:"]=2;
  50992. $recv(d)._at_put_((1),(2));
  50993. $ctx1.sendIdx["at:put:"]=2;
  50994. $5=$recv(d)._at_((1));
  50995. $ctx1.sendIdx["at:"]=2;
  50996. self._assert_equals_($5,(2));
  50997. $ctx1.sendIdx["assert:equals:"]=3;
  50998. $6=d;
  50999. $7=(1).__at((3));
  51000. $ctx1.sendIdx["@"]=1;
  51001. $recv($6)._at_put_($7,(3));
  51002. $9=d;
  51003. $10=(1).__at((3));
  51004. $ctx1.sendIdx["@"]=2;
  51005. $8=$recv($9)._at_($10);
  51006. self._assert_equals_($8,(3));
  51007. $12=d;
  51008. $13=(1).__at((3));
  51009. $ctx1.sendIdx["@"]=3;
  51010. $11=$recv($12)._includesKey_($13);
  51011. $ctx1.sendIdx["includesKey:"]=3;
  51012. self._assert_($11);
  51013. self._deny_($recv(d)._includesKey_((3).__at((1))));
  51014. return self;
  51015. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  51016. },
  51017. args: [],
  51018. 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)",
  51019. referencedClasses: ["Dictionary"],
  51020. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  51021. }),
  51022. $globals.DictionaryTest);
  51023. $core.addMethod(
  51024. $core.method({
  51025. selector: "testDynamicDictionaries",
  51026. protocol: 'tests',
  51027. fn: function (){
  51028. var self=this;
  51029. return $core.withContext(function($ctx1) {
  51030. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  51031. return self;
  51032. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  51033. },
  51034. args: [],
  51035. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  51036. referencedClasses: ["Dictionary"],
  51037. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  51038. }),
  51039. $globals.DictionaryTest);
  51040. $core.addMethod(
  51041. $core.method({
  51042. selector: "collectionClass",
  51043. protocol: 'fixture',
  51044. fn: function (){
  51045. var self=this;
  51046. return $globals.Dictionary;
  51047. },
  51048. args: [],
  51049. source: "collectionClass\x0a\x09^ Dictionary",
  51050. referencedClasses: ["Dictionary"],
  51051. messageSends: []
  51052. }),
  51053. $globals.DictionaryTest.klass);
  51054. $core.addClass('HashedCollectionTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  51055. $core.addMethod(
  51056. $core.method({
  51057. selector: "collection",
  51058. protocol: 'fixture',
  51059. fn: function (){
  51060. var self=this;
  51061. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  51062. },
  51063. args: [],
  51064. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  51065. referencedClasses: [],
  51066. messageSends: []
  51067. }),
  51068. $globals.HashedCollectionTest);
  51069. $core.addMethod(
  51070. $core.method({
  51071. selector: "collectionKeys",
  51072. protocol: 'fixture',
  51073. fn: function (){
  51074. var self=this;
  51075. return ["b","a","c","d"];
  51076. },
  51077. args: [],
  51078. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  51079. referencedClasses: [],
  51080. messageSends: []
  51081. }),
  51082. $globals.HashedCollectionTest);
  51083. $core.addMethod(
  51084. $core.method({
  51085. selector: "collectionOfPrintStrings",
  51086. protocol: 'fixture',
  51087. fn: function (){
  51088. var self=this;
  51089. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  51090. },
  51091. args: [],
  51092. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  51093. referencedClasses: [],
  51094. messageSends: []
  51095. }),
  51096. $globals.HashedCollectionTest);
  51097. $core.addMethod(
  51098. $core.method({
  51099. selector: "collectionSize",
  51100. protocol: 'fixture',
  51101. fn: function (){
  51102. var self=this;
  51103. return (4);
  51104. },
  51105. args: [],
  51106. source: "collectionSize\x0a\x09^ 4",
  51107. referencedClasses: [],
  51108. messageSends: []
  51109. }),
  51110. $globals.HashedCollectionTest);
  51111. $core.addMethod(
  51112. $core.method({
  51113. selector: "collectionValues",
  51114. protocol: 'fixture',
  51115. fn: function (){
  51116. var self=this;
  51117. return [(1),(2),(3),(-4)];
  51118. },
  51119. args: [],
  51120. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  51121. referencedClasses: [],
  51122. messageSends: []
  51123. }),
  51124. $globals.HashedCollectionTest);
  51125. $core.addMethod(
  51126. $core.method({
  51127. selector: "collectionWithDuplicates",
  51128. protocol: 'fixture',
  51129. fn: function (){
  51130. var self=this;
  51131. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  51132. },
  51133. args: [],
  51134. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  51135. referencedClasses: [],
  51136. messageSends: []
  51137. }),
  51138. $globals.HashedCollectionTest);
  51139. $core.addMethod(
  51140. $core.method({
  51141. selector: "collectionWithNewValue",
  51142. protocol: 'fixture',
  51143. fn: function (){
  51144. var self=this;
  51145. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  51146. },
  51147. args: [],
  51148. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  51149. referencedClasses: [],
  51150. messageSends: []
  51151. }),
  51152. $globals.HashedCollectionTest);
  51153. $core.addMethod(
  51154. $core.method({
  51155. selector: "sampleNewValueAsCollection",
  51156. protocol: 'fixture',
  51157. fn: function (){
  51158. var self=this;
  51159. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  51160. },
  51161. args: [],
  51162. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  51163. referencedClasses: [],
  51164. messageSends: []
  51165. }),
  51166. $globals.HashedCollectionTest);
  51167. $core.addMethod(
  51168. $core.method({
  51169. selector: "testDynamicDictionaries",
  51170. protocol: 'tests',
  51171. fn: function (){
  51172. var self=this;
  51173. return $core.withContext(function($ctx1) {
  51174. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  51175. return self;
  51176. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  51177. },
  51178. args: [],
  51179. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  51180. referencedClasses: ["HashedCollection"],
  51181. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  51182. }),
  51183. $globals.HashedCollectionTest);
  51184. $core.addMethod(
  51185. $core.method({
  51186. selector: "collectionClass",
  51187. protocol: 'fixture',
  51188. fn: function (){
  51189. var self=this;
  51190. return $globals.HashedCollection;
  51191. },
  51192. args: [],
  51193. source: "collectionClass\x0a\x09^ HashedCollection",
  51194. referencedClasses: ["HashedCollection"],
  51195. messageSends: []
  51196. }),
  51197. $globals.HashedCollectionTest.klass);
  51198. $core.addClass('SequenceableCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  51199. $core.addMethod(
  51200. $core.method({
  51201. selector: "collectionFirst",
  51202. protocol: 'fixture',
  51203. fn: function (){
  51204. var self=this;
  51205. return $core.withContext(function($ctx1) {
  51206. self._subclassResponsibility();
  51207. return self;
  51208. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  51209. },
  51210. args: [],
  51211. source: "collectionFirst\x0a\x09self subclassResponsibility",
  51212. referencedClasses: [],
  51213. messageSends: ["subclassResponsibility"]
  51214. }),
  51215. $globals.SequenceableCollectionTest);
  51216. $core.addMethod(
  51217. $core.method({
  51218. selector: "collectionFirstTwo",
  51219. protocol: 'fixture',
  51220. fn: function (){
  51221. var self=this;
  51222. return $core.withContext(function($ctx1) {
  51223. self._subclassResponsibility();
  51224. return self;
  51225. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  51226. },
  51227. args: [],
  51228. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  51229. referencedClasses: [],
  51230. messageSends: ["subclassResponsibility"]
  51231. }),
  51232. $globals.SequenceableCollectionTest);
  51233. $core.addMethod(
  51234. $core.method({
  51235. selector: "collectionLast",
  51236. protocol: 'fixture',
  51237. fn: function (){
  51238. var self=this;
  51239. return $core.withContext(function($ctx1) {
  51240. self._subclassResponsibility();
  51241. return self;
  51242. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  51243. },
  51244. args: [],
  51245. source: "collectionLast\x0a\x09self subclassResponsibility",
  51246. referencedClasses: [],
  51247. messageSends: ["subclassResponsibility"]
  51248. }),
  51249. $globals.SequenceableCollectionTest);
  51250. $core.addMethod(
  51251. $core.method({
  51252. selector: "collectionLastTwo",
  51253. protocol: 'fixture',
  51254. fn: function (){
  51255. var self=this;
  51256. return $core.withContext(function($ctx1) {
  51257. self._subclassResponsibility();
  51258. return self;
  51259. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  51260. },
  51261. args: [],
  51262. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  51263. referencedClasses: [],
  51264. messageSends: ["subclassResponsibility"]
  51265. }),
  51266. $globals.SequenceableCollectionTest);
  51267. $core.addMethod(
  51268. $core.method({
  51269. selector: "nonIndexesDo:",
  51270. protocol: 'fixture',
  51271. fn: function (aBlock){
  51272. var self=this;
  51273. return $core.withContext(function($ctx1) {
  51274. $recv(aBlock)._value_((0));
  51275. $ctx1.sendIdx["value:"]=1;
  51276. $recv(aBlock)._value_($recv(self._collectionSize()).__plus((1)));
  51277. $ctx1.sendIdx["value:"]=2;
  51278. $recv(aBlock)._value_("z");
  51279. return self;
  51280. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  51281. },
  51282. args: ["aBlock"],
  51283. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  51284. referencedClasses: [],
  51285. messageSends: ["value:", "+", "collectionSize"]
  51286. }),
  51287. $globals.SequenceableCollectionTest);
  51288. $core.addMethod(
  51289. $core.method({
  51290. selector: "samplesDo:",
  51291. protocol: 'fixture',
  51292. fn: function (aBlock){
  51293. var self=this;
  51294. return $core.withContext(function($ctx1) {
  51295. $recv(aBlock)._value_value_((1),self._collectionFirst());
  51296. $ctx1.sendIdx["value:value:"]=1;
  51297. $recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  51298. return self;
  51299. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  51300. },
  51301. args: ["aBlock"],
  51302. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  51303. referencedClasses: [],
  51304. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  51305. }),
  51306. $globals.SequenceableCollectionTest);
  51307. $core.addMethod(
  51308. $core.method({
  51309. selector: "testBeginsWith",
  51310. protocol: 'tests',
  51311. fn: function (){
  51312. var self=this;
  51313. return $core.withContext(function($ctx1) {
  51314. var $2,$1,$4,$5,$3,$7,$6;
  51315. $2=self._collection();
  51316. $ctx1.sendIdx["collection"]=1;
  51317. $1=$recv($2)._beginsWith_($recv(self._collectionClass())._new());
  51318. $ctx1.sendIdx["beginsWith:"]=1;
  51319. self._assert_($1);
  51320. $ctx1.sendIdx["assert:"]=1;
  51321. $4=self._collection();
  51322. $ctx1.sendIdx["collection"]=2;
  51323. $5=self._collection();
  51324. $ctx1.sendIdx["collection"]=3;
  51325. $3=$recv($4)._beginsWith_($5);
  51326. $ctx1.sendIdx["beginsWith:"]=2;
  51327. self._assert_($3);
  51328. $ctx1.sendIdx["assert:"]=2;
  51329. $7=self._collection();
  51330. $ctx1.sendIdx["collection"]=4;
  51331. $6=$recv($7)._beginsWith_(self._collectionFirstTwo());
  51332. $ctx1.sendIdx["beginsWith:"]=3;
  51333. self._assert_($6);
  51334. self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo()));
  51335. return self;
  51336. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  51337. },
  51338. args: [],
  51339. 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)",
  51340. referencedClasses: [],
  51341. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  51342. }),
  51343. $globals.SequenceableCollectionTest);
  51344. $core.addMethod(
  51345. $core.method({
  51346. selector: "testEndsWith",
  51347. protocol: 'tests',
  51348. fn: function (){
  51349. var self=this;
  51350. return $core.withContext(function($ctx1) {
  51351. var $2,$1,$4,$5,$3,$7,$6;
  51352. $2=self._collection();
  51353. $ctx1.sendIdx["collection"]=1;
  51354. $1=$recv($2)._endsWith_($recv(self._collectionClass())._new());
  51355. $ctx1.sendIdx["endsWith:"]=1;
  51356. self._assert_($1);
  51357. $ctx1.sendIdx["assert:"]=1;
  51358. $4=self._collection();
  51359. $ctx1.sendIdx["collection"]=2;
  51360. $5=self._collection();
  51361. $ctx1.sendIdx["collection"]=3;
  51362. $3=$recv($4)._endsWith_($5);
  51363. $ctx1.sendIdx["endsWith:"]=2;
  51364. self._assert_($3);
  51365. $ctx1.sendIdx["assert:"]=2;
  51366. $7=self._collection();
  51367. $ctx1.sendIdx["collection"]=4;
  51368. $6=$recv($7)._endsWith_(self._collectionLastTwo());
  51369. $ctx1.sendIdx["endsWith:"]=3;
  51370. self._assert_($6);
  51371. self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo()));
  51372. return self;
  51373. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  51374. },
  51375. args: [],
  51376. 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)",
  51377. referencedClasses: [],
  51378. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  51379. }),
  51380. $globals.SequenceableCollectionTest);
  51381. $core.addMethod(
  51382. $core.method({
  51383. selector: "testFirst",
  51384. protocol: 'tests',
  51385. fn: function (){
  51386. var self=this;
  51387. return $core.withContext(function($ctx1) {
  51388. self._assert_equals_($recv(self._collection())._first(),self._collectionFirst());
  51389. return self;
  51390. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  51391. },
  51392. args: [],
  51393. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  51394. referencedClasses: [],
  51395. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  51396. }),
  51397. $globals.SequenceableCollectionTest);
  51398. $core.addMethod(
  51399. $core.method({
  51400. selector: "testFirstN",
  51401. protocol: 'tests',
  51402. fn: function (){
  51403. var self=this;
  51404. return $core.withContext(function($ctx1) {
  51405. var $2,$1,$4,$3,$6,$5,$7;
  51406. $2=self._collection();
  51407. $ctx1.sendIdx["collection"]=1;
  51408. $1=$recv($2)._first_((2));
  51409. $ctx1.sendIdx["first:"]=1;
  51410. self._assert_equals_($1,self._collectionFirstTwo());
  51411. $ctx1.sendIdx["assert:equals:"]=1;
  51412. $4=self._collection();
  51413. $ctx1.sendIdx["collection"]=2;
  51414. $3=$recv($4)._first_((0));
  51415. $ctx1.sendIdx["first:"]=2;
  51416. self._assert_equals_($3,$recv(self._collectionClass())._new());
  51417. $ctx1.sendIdx["assert:equals:"]=2;
  51418. $6=self._collection();
  51419. $ctx1.sendIdx["collection"]=3;
  51420. $5=$recv($6)._first_(self._collectionSize());
  51421. $ctx1.sendIdx["first:"]=3;
  51422. $7=self._collection();
  51423. $ctx1.sendIdx["collection"]=4;
  51424. self._assert_equals_($5,$7);
  51425. self._should_raise_((function(){
  51426. return $core.withContext(function($ctx2) {
  51427. return $recv(self._collection())._first_((33));
  51428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51429. }),$globals.Error);
  51430. return self;
  51431. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  51432. },
  51433. args: [],
  51434. 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",
  51435. referencedClasses: ["Error"],
  51436. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  51437. }),
  51438. $globals.SequenceableCollectionTest);
  51439. $core.addMethod(
  51440. $core.method({
  51441. selector: "testFourth",
  51442. protocol: 'tests',
  51443. fn: function (){
  51444. var self=this;
  51445. return $core.withContext(function($ctx1) {
  51446. var $2,$1;
  51447. $2=self._collection();
  51448. $ctx1.sendIdx["collection"]=1;
  51449. $1=$recv($2)._fourth();
  51450. self._assert_equals_($1,$recv(self._collection())._at_((4)));
  51451. return self;
  51452. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  51453. },
  51454. args: [],
  51455. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  51456. referencedClasses: [],
  51457. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  51458. }),
  51459. $globals.SequenceableCollectionTest);
  51460. $core.addMethod(
  51461. $core.method({
  51462. selector: "testIndexOfStartingAt",
  51463. protocol: 'tests',
  51464. fn: function (){
  51465. var self=this;
  51466. var jsNull;
  51467. return $core.withContext(function($ctx1) {
  51468. var $2,$1,$4,$3;
  51469. jsNull=$recv($globals.JSON)._parse_("null");
  51470. self._samplesDo_((function(index,value){
  51471. return $core.withContext(function($ctx2) {
  51472. $2=self._collection();
  51473. $ctx2.sendIdx["collection"]=1;
  51474. $1=$recv($2)._indexOf_startingAt_(value,(1));
  51475. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  51476. self._assert_equals_($1,index);
  51477. $ctx2.sendIdx["assert:equals:"]=1;
  51478. $4=self._collection();
  51479. $ctx2.sendIdx["collection"]=2;
  51480. $3=$recv($4)._indexOf_startingAt_(value,index);
  51481. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  51482. self._assert_equals_($3,index);
  51483. $ctx2.sendIdx["assert:equals:"]=2;
  51484. return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  51485. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51486. }));
  51487. return self;
  51488. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  51489. },
  51490. args: [],
  51491. 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 ]",
  51492. referencedClasses: ["JSON"],
  51493. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  51494. }),
  51495. $globals.SequenceableCollectionTest);
  51496. $core.addMethod(
  51497. $core.method({
  51498. selector: "testIndexOfStartingAtWithNull",
  51499. protocol: 'tests',
  51500. fn: function (){
  51501. var self=this;
  51502. var jsNull;
  51503. return $core.withContext(function($ctx1) {
  51504. var $1,$2;
  51505. jsNull=$recv($globals.JSON)._parse_("null");
  51506. self._samplesDo_((function(index,value){
  51507. var collection;
  51508. return $core.withContext(function($ctx2) {
  51509. collection=self._collection();
  51510. collection;
  51511. $recv(collection)._at_put_(index,jsNull);
  51512. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  51513. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  51514. self._assert_equals_($1,index);
  51515. $ctx2.sendIdx["assert:equals:"]=1;
  51516. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  51517. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  51518. self._assert_equals_($2,index);
  51519. $ctx2.sendIdx["assert:equals:"]=2;
  51520. return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  51521. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  51522. }));
  51523. return self;
  51524. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  51525. },
  51526. args: [],
  51527. 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 ]",
  51528. referencedClasses: ["JSON"],
  51529. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  51530. }),
  51531. $globals.SequenceableCollectionTest);
  51532. $core.addMethod(
  51533. $core.method({
  51534. selector: "testLast",
  51535. protocol: 'tests',
  51536. fn: function (){
  51537. var self=this;
  51538. return $core.withContext(function($ctx1) {
  51539. self._assert_equals_($recv(self._collection())._last(),self._collectionLast());
  51540. return self;
  51541. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  51542. },
  51543. args: [],
  51544. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  51545. referencedClasses: [],
  51546. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  51547. }),
  51548. $globals.SequenceableCollectionTest);
  51549. $core.addMethod(
  51550. $core.method({
  51551. selector: "testLastN",
  51552. protocol: 'tests',
  51553. fn: function (){
  51554. var self=this;
  51555. return $core.withContext(function($ctx1) {
  51556. var $2,$1,$4,$3,$6,$5,$7;
  51557. $2=self._collection();
  51558. $ctx1.sendIdx["collection"]=1;
  51559. $1=$recv($2)._last_((2));
  51560. $ctx1.sendIdx["last:"]=1;
  51561. self._assert_equals_($1,self._collectionLastTwo());
  51562. $ctx1.sendIdx["assert:equals:"]=1;
  51563. $4=self._collection();
  51564. $ctx1.sendIdx["collection"]=2;
  51565. $3=$recv($4)._last_((0));
  51566. $ctx1.sendIdx["last:"]=2;
  51567. self._assert_equals_($3,$recv(self._collectionClass())._new());
  51568. $ctx1.sendIdx["assert:equals:"]=2;
  51569. $6=self._collection();
  51570. $ctx1.sendIdx["collection"]=3;
  51571. $5=$recv($6)._last_(self._collectionSize());
  51572. $ctx1.sendIdx["last:"]=3;
  51573. $7=self._collection();
  51574. $ctx1.sendIdx["collection"]=4;
  51575. self._assert_equals_($5,$7);
  51576. self._should_raise_((function(){
  51577. return $core.withContext(function($ctx2) {
  51578. return $recv(self._collection())._last_((33));
  51579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51580. }),$globals.Error);
  51581. return self;
  51582. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  51583. },
  51584. args: [],
  51585. 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",
  51586. referencedClasses: ["Error"],
  51587. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  51588. }),
  51589. $globals.SequenceableCollectionTest);
  51590. $core.addMethod(
  51591. $core.method({
  51592. selector: "testSecond",
  51593. protocol: 'tests',
  51594. fn: function (){
  51595. var self=this;
  51596. return $core.withContext(function($ctx1) {
  51597. var $2,$1;
  51598. $2=self._collection();
  51599. $ctx1.sendIdx["collection"]=1;
  51600. $1=$recv($2)._second();
  51601. self._assert_equals_($1,$recv(self._collection())._at_((2)));
  51602. return self;
  51603. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  51604. },
  51605. args: [],
  51606. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  51607. referencedClasses: [],
  51608. messageSends: ["assert:equals:", "second", "collection", "at:"]
  51609. }),
  51610. $globals.SequenceableCollectionTest);
  51611. $core.addMethod(
  51612. $core.method({
  51613. selector: "testThird",
  51614. protocol: 'tests',
  51615. fn: function (){
  51616. var self=this;
  51617. return $core.withContext(function($ctx1) {
  51618. var $2,$1;
  51619. $2=self._collection();
  51620. $ctx1.sendIdx["collection"]=1;
  51621. $1=$recv($2)._third();
  51622. self._assert_equals_($1,$recv(self._collection())._at_((3)));
  51623. return self;
  51624. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  51625. },
  51626. args: [],
  51627. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  51628. referencedClasses: [],
  51629. messageSends: ["assert:equals:", "third", "collection", "at:"]
  51630. }),
  51631. $globals.SequenceableCollectionTest);
  51632. $core.addClass('ArrayTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  51633. $core.addMethod(
  51634. $core.method({
  51635. selector: "collection",
  51636. protocol: 'fixture',
  51637. fn: function (){
  51638. var self=this;
  51639. return [(1), (2), (3), (-4)];
  51640. },
  51641. args: [],
  51642. source: "collection\x0a\x09^ #(1 2 3 -4)",
  51643. referencedClasses: [],
  51644. messageSends: []
  51645. }),
  51646. $globals.ArrayTest);
  51647. $core.addMethod(
  51648. $core.method({
  51649. selector: "collectionFirst",
  51650. protocol: 'fixture',
  51651. fn: function (){
  51652. var self=this;
  51653. return (1);
  51654. },
  51655. args: [],
  51656. source: "collectionFirst\x0a\x09^ 1",
  51657. referencedClasses: [],
  51658. messageSends: []
  51659. }),
  51660. $globals.ArrayTest);
  51661. $core.addMethod(
  51662. $core.method({
  51663. selector: "collectionFirstTwo",
  51664. protocol: 'fixture',
  51665. fn: function (){
  51666. var self=this;
  51667. return [(1), (2)];
  51668. },
  51669. args: [],
  51670. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  51671. referencedClasses: [],
  51672. messageSends: []
  51673. }),
  51674. $globals.ArrayTest);
  51675. $core.addMethod(
  51676. $core.method({
  51677. selector: "collectionLast",
  51678. protocol: 'fixture',
  51679. fn: function (){
  51680. var self=this;
  51681. return (-4);
  51682. },
  51683. args: [],
  51684. source: "collectionLast\x0a\x09^ -4",
  51685. referencedClasses: [],
  51686. messageSends: []
  51687. }),
  51688. $globals.ArrayTest);
  51689. $core.addMethod(
  51690. $core.method({
  51691. selector: "collectionLastTwo",
  51692. protocol: 'fixture',
  51693. fn: function (){
  51694. var self=this;
  51695. return [(3), (-4)];
  51696. },
  51697. args: [],
  51698. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  51699. referencedClasses: [],
  51700. messageSends: []
  51701. }),
  51702. $globals.ArrayTest);
  51703. $core.addMethod(
  51704. $core.method({
  51705. selector: "collectionOfPrintStrings",
  51706. protocol: 'fixture',
  51707. fn: function (){
  51708. var self=this;
  51709. return ["1", "2", "3", "-4"];
  51710. },
  51711. args: [],
  51712. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  51713. referencedClasses: [],
  51714. messageSends: []
  51715. }),
  51716. $globals.ArrayTest);
  51717. $core.addMethod(
  51718. $core.method({
  51719. selector: "collectionSize",
  51720. protocol: 'fixture',
  51721. fn: function (){
  51722. var self=this;
  51723. return (4);
  51724. },
  51725. args: [],
  51726. source: "collectionSize\x0a\x09^ 4",
  51727. referencedClasses: [],
  51728. messageSends: []
  51729. }),
  51730. $globals.ArrayTest);
  51731. $core.addMethod(
  51732. $core.method({
  51733. selector: "collectionWithDuplicates",
  51734. protocol: 'fixture',
  51735. fn: function (){
  51736. var self=this;
  51737. return ["a", "b", "c", (1), (2), (1), "a", []];
  51738. },
  51739. args: [],
  51740. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  51741. referencedClasses: [],
  51742. messageSends: []
  51743. }),
  51744. $globals.ArrayTest);
  51745. $core.addMethod(
  51746. $core.method({
  51747. selector: "collectionWithNewValue",
  51748. protocol: 'fixture',
  51749. fn: function (){
  51750. var self=this;
  51751. return [(1), (2), (3), (-4), "N"];
  51752. },
  51753. args: [],
  51754. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  51755. referencedClasses: [],
  51756. messageSends: []
  51757. }),
  51758. $globals.ArrayTest);
  51759. $core.addMethod(
  51760. $core.method({
  51761. selector: "sampleNewIndex",
  51762. protocol: 'fixture',
  51763. fn: function (){
  51764. var self=this;
  51765. return (5);
  51766. },
  51767. args: [],
  51768. source: "sampleNewIndex\x0a\x09^ 5",
  51769. referencedClasses: [],
  51770. messageSends: []
  51771. }),
  51772. $globals.ArrayTest);
  51773. $core.addMethod(
  51774. $core.method({
  51775. selector: "samplesDo:",
  51776. protocol: 'fixture',
  51777. fn: function (aBlock){
  51778. var self=this;
  51779. return $core.withContext(function($ctx1) {
  51780. (
  51781. $ctx1.supercall = true,
  51782. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  51783. $ctx1.supercall = false;
  51784. $recv(aBlock)._value_value_((3),(3));
  51785. return self;
  51786. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  51787. },
  51788. args: ["aBlock"],
  51789. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  51790. referencedClasses: [],
  51791. messageSends: ["samplesDo:", "value:value:"]
  51792. }),
  51793. $globals.ArrayTest);
  51794. $core.addMethod(
  51795. $core.method({
  51796. selector: "testAdd",
  51797. protocol: 'tests',
  51798. fn: function (){
  51799. var self=this;
  51800. var array;
  51801. return $core.withContext(function($ctx1) {
  51802. array=self._collection();
  51803. $recv(array)._add_((6));
  51804. self._assert_equals_($recv(array)._last(),(6));
  51805. return self;
  51806. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  51807. },
  51808. args: [],
  51809. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  51810. referencedClasses: [],
  51811. messageSends: ["collection", "add:", "assert:equals:", "last"]
  51812. }),
  51813. $globals.ArrayTest);
  51814. $core.addMethod(
  51815. $core.method({
  51816. selector: "testAddFirst",
  51817. protocol: 'tests',
  51818. fn: function (){
  51819. var self=this;
  51820. return $core.withContext(function($ctx1) {
  51821. var $3,$2,$1;
  51822. $3=self._collection();
  51823. $recv($3)._addFirst_((0));
  51824. $2=$recv($3)._yourself();
  51825. $1=$recv($2)._first();
  51826. self._assert_equals_($1,(0));
  51827. return self;
  51828. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  51829. },
  51830. args: [],
  51831. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  51832. referencedClasses: [],
  51833. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  51834. }),
  51835. $globals.ArrayTest);
  51836. $core.addMethod(
  51837. $core.method({
  51838. selector: "testPrintString",
  51839. protocol: 'tests',
  51840. fn: function (){
  51841. var self=this;
  51842. var array;
  51843. return $core.withContext(function($ctx1) {
  51844. var $1,$2,$3,$4,$5,$6,$7,$8;
  51845. array=$recv($globals.Array)._new();
  51846. $1=$recv(array)._printString();
  51847. $ctx1.sendIdx["printString"]=1;
  51848. self._assert_equals_($1,"an Array ()");
  51849. $ctx1.sendIdx["assert:equals:"]=1;
  51850. $2=array;
  51851. $recv($2)._add_((1));
  51852. $ctx1.sendIdx["add:"]=1;
  51853. $3=$recv($2)._add_((3));
  51854. $ctx1.sendIdx["add:"]=2;
  51855. $4=$recv(array)._printString();
  51856. $ctx1.sendIdx["printString"]=2;
  51857. self._assert_equals_($4,"an Array (1 3)");
  51858. $ctx1.sendIdx["assert:equals:"]=2;
  51859. $recv(array)._add_("foo");
  51860. $5=$recv(array)._printString();
  51861. $ctx1.sendIdx["printString"]=3;
  51862. self._assert_equals_($5,"an Array (1 3 'foo')");
  51863. $ctx1.sendIdx["assert:equals:"]=3;
  51864. $6=array;
  51865. $recv($6)._remove_((1));
  51866. $ctx1.sendIdx["remove:"]=1;
  51867. $recv($6)._remove_((3));
  51868. $7=$recv(array)._printString();
  51869. $ctx1.sendIdx["printString"]=4;
  51870. self._assert_equals_($7,"an Array ('foo')");
  51871. $ctx1.sendIdx["assert:equals:"]=4;
  51872. $recv(array)._addLast_((3));
  51873. $ctx1.sendIdx["addLast:"]=1;
  51874. $8=$recv(array)._printString();
  51875. $ctx1.sendIdx["printString"]=5;
  51876. self._assert_equals_($8,"an Array ('foo' 3)");
  51877. $ctx1.sendIdx["assert:equals:"]=5;
  51878. $recv(array)._addLast_((3));
  51879. self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  51880. return self;
  51881. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  51882. },
  51883. args: [],
  51884. 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)'.",
  51885. referencedClasses: ["Array"],
  51886. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  51887. }),
  51888. $globals.ArrayTest);
  51889. $core.addMethod(
  51890. $core.method({
  51891. selector: "testRemove",
  51892. protocol: 'tests',
  51893. fn: function (){
  51894. var self=this;
  51895. var array;
  51896. return $core.withContext(function($ctx1) {
  51897. array=[(1), (2), (3), (4), (5)];
  51898. $recv(array)._remove_((3));
  51899. $ctx1.sendIdx["remove:"]=1;
  51900. self._assert_equals_(array,[(1), (2), (4), (5)]);
  51901. self._should_raise_((function(){
  51902. return $core.withContext(function($ctx2) {
  51903. return $recv(array)._remove_((3));
  51904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51905. }),$globals.Error);
  51906. return self;
  51907. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  51908. },
  51909. args: [],
  51910. 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",
  51911. referencedClasses: ["Error"],
  51912. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  51913. }),
  51914. $globals.ArrayTest);
  51915. $core.addMethod(
  51916. $core.method({
  51917. selector: "testRemoveFromTo",
  51918. protocol: 'tests',
  51919. fn: function (){
  51920. var self=this;
  51921. return $core.withContext(function($ctx1) {
  51922. var $1,$2;
  51923. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  51924. $ctx1.sendIdx["removeFrom:to:"]=1;
  51925. self._assert_equals_($1,[(4)]);
  51926. $ctx1.sendIdx["assert:equals:"]=1;
  51927. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  51928. $ctx1.sendIdx["removeFrom:to:"]=2;
  51929. self._assert_equals_($2,[(1), (4)]);
  51930. $ctx1.sendIdx["assert:equals:"]=2;
  51931. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  51932. return self;
  51933. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  51934. },
  51935. args: [],
  51936. 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)",
  51937. referencedClasses: [],
  51938. messageSends: ["assert:equals:", "removeFrom:to:"]
  51939. }),
  51940. $globals.ArrayTest);
  51941. $core.addMethod(
  51942. $core.method({
  51943. selector: "testRemoveIndex",
  51944. protocol: 'tests',
  51945. fn: function (){
  51946. var self=this;
  51947. return $core.withContext(function($ctx1) {
  51948. var $1,$2;
  51949. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  51950. $ctx1.sendIdx["removeIndex:"]=1;
  51951. self._assert_equals_($1,[(1), (3), (4)]);
  51952. $ctx1.sendIdx["assert:equals:"]=1;
  51953. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  51954. $ctx1.sendIdx["removeIndex:"]=2;
  51955. self._assert_equals_($2,[(2), (3), (4)]);
  51956. $ctx1.sendIdx["assert:equals:"]=2;
  51957. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  51958. return self;
  51959. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  51960. },
  51961. args: [],
  51962. 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: #()",
  51963. referencedClasses: [],
  51964. messageSends: ["assert:equals:", "removeIndex:"]
  51965. }),
  51966. $globals.ArrayTest);
  51967. $core.addMethod(
  51968. $core.method({
  51969. selector: "testRemoveLast",
  51970. protocol: 'tests',
  51971. fn: function (){
  51972. var self=this;
  51973. var array;
  51974. return $core.withContext(function($ctx1) {
  51975. array=[(1), (2)];
  51976. $recv(array)._removeLast();
  51977. self._assert_equals_($recv(array)._last(),(1));
  51978. return self;
  51979. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  51980. },
  51981. args: [],
  51982. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  51983. referencedClasses: [],
  51984. messageSends: ["removeLast", "assert:equals:", "last"]
  51985. }),
  51986. $globals.ArrayTest);
  51987. $core.addMethod(
  51988. $core.method({
  51989. selector: "testReversed",
  51990. protocol: 'tests',
  51991. fn: function (){
  51992. var self=this;
  51993. var array;
  51994. return $core.withContext(function($ctx1) {
  51995. array=[(5), (4), (3), (2), (1)];
  51996. self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  51997. return self;
  51998. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  51999. },
  52000. args: [],
  52001. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  52002. referencedClasses: [],
  52003. messageSends: ["assert:equals:", "reversed"]
  52004. }),
  52005. $globals.ArrayTest);
  52006. $core.addMethod(
  52007. $core.method({
  52008. selector: "testSort",
  52009. protocol: 'tests',
  52010. fn: function (){
  52011. var self=this;
  52012. var array;
  52013. return $core.withContext(function($ctx1) {
  52014. array=[(10), (1), (5)];
  52015. $recv(array)._sort();
  52016. self._assert_equals_(array,[(1), (5), (10)]);
  52017. return self;
  52018. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  52019. },
  52020. args: [],
  52021. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  52022. referencedClasses: [],
  52023. messageSends: ["sort", "assert:equals:"]
  52024. }),
  52025. $globals.ArrayTest);
  52026. $core.addMethod(
  52027. $core.method({
  52028. selector: "collectionClass",
  52029. protocol: 'fixture',
  52030. fn: function (){
  52031. var self=this;
  52032. return $globals.Array;
  52033. },
  52034. args: [],
  52035. source: "collectionClass\x0a\x09^ Array",
  52036. referencedClasses: ["Array"],
  52037. messageSends: []
  52038. }),
  52039. $globals.ArrayTest.klass);
  52040. $core.addClass('StringTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  52041. $core.addMethod(
  52042. $core.method({
  52043. selector: "collection",
  52044. protocol: 'fixture',
  52045. fn: function (){
  52046. var self=this;
  52047. return "helLo";
  52048. },
  52049. args: [],
  52050. source: "collection\x0a\x09^ 'helLo'",
  52051. referencedClasses: [],
  52052. messageSends: []
  52053. }),
  52054. $globals.StringTest);
  52055. $core.addMethod(
  52056. $core.method({
  52057. selector: "collectionFirst",
  52058. protocol: 'fixture',
  52059. fn: function (){
  52060. var self=this;
  52061. return "h";
  52062. },
  52063. args: [],
  52064. source: "collectionFirst\x0a\x09^ 'h'",
  52065. referencedClasses: [],
  52066. messageSends: []
  52067. }),
  52068. $globals.StringTest);
  52069. $core.addMethod(
  52070. $core.method({
  52071. selector: "collectionFirstTwo",
  52072. protocol: 'fixture',
  52073. fn: function (){
  52074. var self=this;
  52075. return "he";
  52076. },
  52077. args: [],
  52078. source: "collectionFirstTwo\x0a\x09^ 'he'",
  52079. referencedClasses: [],
  52080. messageSends: []
  52081. }),
  52082. $globals.StringTest);
  52083. $core.addMethod(
  52084. $core.method({
  52085. selector: "collectionLast",
  52086. protocol: 'fixture',
  52087. fn: function (){
  52088. var self=this;
  52089. return "o";
  52090. },
  52091. args: [],
  52092. source: "collectionLast\x0a\x09^ 'o'",
  52093. referencedClasses: [],
  52094. messageSends: []
  52095. }),
  52096. $globals.StringTest);
  52097. $core.addMethod(
  52098. $core.method({
  52099. selector: "collectionLastTwo",
  52100. protocol: 'fixture',
  52101. fn: function (){
  52102. var self=this;
  52103. return "Lo";
  52104. },
  52105. args: [],
  52106. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  52107. referencedClasses: [],
  52108. messageSends: []
  52109. }),
  52110. $globals.StringTest);
  52111. $core.addMethod(
  52112. $core.method({
  52113. selector: "collectionOfPrintStrings",
  52114. protocol: 'fixture',
  52115. fn: function (){
  52116. var self=this;
  52117. return "'h''e''l''L''o'";
  52118. },
  52119. args: [],
  52120. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  52121. referencedClasses: [],
  52122. messageSends: []
  52123. }),
  52124. $globals.StringTest);
  52125. $core.addMethod(
  52126. $core.method({
  52127. selector: "collectionSize",
  52128. protocol: 'fixture',
  52129. fn: function (){
  52130. var self=this;
  52131. return (5);
  52132. },
  52133. args: [],
  52134. source: "collectionSize\x0a\x09^ 5",
  52135. referencedClasses: [],
  52136. messageSends: []
  52137. }),
  52138. $globals.StringTest);
  52139. $core.addMethod(
  52140. $core.method({
  52141. selector: "collectionWithDuplicates",
  52142. protocol: 'fixture',
  52143. fn: function (){
  52144. var self=this;
  52145. return "abbaerten";
  52146. },
  52147. args: [],
  52148. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  52149. referencedClasses: [],
  52150. messageSends: []
  52151. }),
  52152. $globals.StringTest);
  52153. $core.addMethod(
  52154. $core.method({
  52155. selector: "collectionWithNewValue",
  52156. protocol: 'fixture',
  52157. fn: function (){
  52158. var self=this;
  52159. return "helLoN";
  52160. },
  52161. args: [],
  52162. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  52163. referencedClasses: [],
  52164. messageSends: []
  52165. }),
  52166. $globals.StringTest);
  52167. $core.addMethod(
  52168. $core.method({
  52169. selector: "sampleNewValueAsCollection",
  52170. protocol: 'fixture',
  52171. fn: function (){
  52172. var self=this;
  52173. return "N";
  52174. },
  52175. args: [],
  52176. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  52177. referencedClasses: [],
  52178. messageSends: []
  52179. }),
  52180. $globals.StringTest);
  52181. $core.addMethod(
  52182. $core.method({
  52183. selector: "samplesDo:",
  52184. protocol: 'fixture',
  52185. fn: function (aBlock){
  52186. var self=this;
  52187. return $core.withContext(function($ctx1) {
  52188. (
  52189. $ctx1.supercall = true,
  52190. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  52191. $ctx1.supercall = false;
  52192. $recv(aBlock)._value_value_((3),"l");
  52193. return self;
  52194. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  52195. },
  52196. args: ["aBlock"],
  52197. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  52198. referencedClasses: [],
  52199. messageSends: ["samplesDo:", "value:value:"]
  52200. }),
  52201. $globals.StringTest);
  52202. $core.addMethod(
  52203. $core.method({
  52204. selector: "testAddAll",
  52205. protocol: 'tests',
  52206. fn: function (){
  52207. var self=this;
  52208. return $core.withContext(function($ctx1) {
  52209. var $1;
  52210. self._should_raise_((function(){
  52211. return $core.withContext(function($ctx2) {
  52212. $1=self._collection();
  52213. $ctx2.sendIdx["collection"]=1;
  52214. return $recv($1)._addAll_(self._collection());
  52215. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52216. }),$globals.Error);
  52217. return self;
  52218. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  52219. },
  52220. args: [],
  52221. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  52222. referencedClasses: ["Error"],
  52223. messageSends: ["should:raise:", "addAll:", "collection"]
  52224. }),
  52225. $globals.StringTest);
  52226. $core.addMethod(
  52227. $core.method({
  52228. selector: "testAddRemove",
  52229. protocol: 'tests',
  52230. fn: function (){
  52231. var self=this;
  52232. return $core.withContext(function($ctx1) {
  52233. self._should_raise_((function(){
  52234. return $core.withContext(function($ctx2) {
  52235. return "hello"._add_("a");
  52236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52237. }),$globals.Error);
  52238. $ctx1.sendIdx["should:raise:"]=1;
  52239. self._should_raise_((function(){
  52240. return $core.withContext(function($ctx2) {
  52241. return "hello"._remove_("h");
  52242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  52243. }),$globals.Error);
  52244. return self;
  52245. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  52246. },
  52247. args: [],
  52248. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  52249. referencedClasses: ["Error"],
  52250. messageSends: ["should:raise:", "add:", "remove:"]
  52251. }),
  52252. $globals.StringTest);
  52253. $core.addMethod(
  52254. $core.method({
  52255. selector: "testAsArray",
  52256. protocol: 'tests',
  52257. fn: function (){
  52258. var self=this;
  52259. return $core.withContext(function($ctx1) {
  52260. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  52261. return self;
  52262. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  52263. },
  52264. args: [],
  52265. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  52266. referencedClasses: [],
  52267. messageSends: ["assert:equals:", "asArray"]
  52268. }),
  52269. $globals.StringTest);
  52270. $core.addMethod(
  52271. $core.method({
  52272. selector: "testAsLowerCase",
  52273. protocol: 'tests',
  52274. fn: function (){
  52275. var self=this;
  52276. return $core.withContext(function($ctx1) {
  52277. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  52278. return self;
  52279. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  52280. },
  52281. args: [],
  52282. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  52283. referencedClasses: [],
  52284. messageSends: ["assert:equals:", "asLowercase"]
  52285. }),
  52286. $globals.StringTest);
  52287. $core.addMethod(
  52288. $core.method({
  52289. selector: "testAsNumber",
  52290. protocol: 'tests',
  52291. fn: function (){
  52292. var self=this;
  52293. return $core.withContext(function($ctx1) {
  52294. var $1,$2;
  52295. $1="3"._asNumber();
  52296. $ctx1.sendIdx["asNumber"]=1;
  52297. self._assert_equals_($1,(3));
  52298. $ctx1.sendIdx["assert:equals:"]=1;
  52299. $2="-3"._asNumber();
  52300. $ctx1.sendIdx["asNumber"]=2;
  52301. self._assert_equals_($2,(-3));
  52302. $ctx1.sendIdx["assert:equals:"]=2;
  52303. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  52304. return self;
  52305. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  52306. },
  52307. args: [],
  52308. 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.",
  52309. referencedClasses: [],
  52310. messageSends: ["assert:equals:", "asNumber"]
  52311. }),
  52312. $globals.StringTest);
  52313. $core.addMethod(
  52314. $core.method({
  52315. selector: "testAsUpperCase",
  52316. protocol: 'tests',
  52317. fn: function (){
  52318. var self=this;
  52319. return $core.withContext(function($ctx1) {
  52320. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  52321. return self;
  52322. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  52323. },
  52324. args: [],
  52325. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  52326. referencedClasses: [],
  52327. messageSends: ["assert:equals:", "asUppercase"]
  52328. }),
  52329. $globals.StringTest);
  52330. $core.addMethod(
  52331. $core.method({
  52332. selector: "testAsciiValue",
  52333. protocol: 'tests',
  52334. fn: function (){
  52335. var self=this;
  52336. var characterA,characterU;
  52337. return $core.withContext(function($ctx1) {
  52338. var $1;
  52339. characterA="A";
  52340. characterU="U";
  52341. $1=$recv(characterA)._asciiValue();
  52342. $ctx1.sendIdx["asciiValue"]=1;
  52343. self._assert_equals_($1,(65));
  52344. $ctx1.sendIdx["assert:equals:"]=1;
  52345. self._assert_equals_($recv(characterU)._asciiValue(),(85));
  52346. return self;
  52347. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  52348. },
  52349. args: [],
  52350. 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",
  52351. referencedClasses: [],
  52352. messageSends: ["assert:equals:", "asciiValue"]
  52353. }),
  52354. $globals.StringTest);
  52355. $core.addMethod(
  52356. $core.method({
  52357. selector: "testAtIfAbsentPut",
  52358. protocol: 'tests',
  52359. fn: function (){
  52360. var self=this;
  52361. return $core.withContext(function($ctx1) {
  52362. self._should_raise_((function(){
  52363. return $core.withContext(function($ctx2) {
  52364. return "hello"._at_ifAbsentPut_((6),(function(){
  52365. return "a";
  52366. }));
  52367. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52368. }),$globals.Error);
  52369. return self;
  52370. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  52371. },
  52372. args: [],
  52373. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  52374. referencedClasses: ["Error"],
  52375. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  52376. }),
  52377. $globals.StringTest);
  52378. $core.addMethod(
  52379. $core.method({
  52380. selector: "testAtPut",
  52381. protocol: 'tests',
  52382. fn: function (){
  52383. var self=this;
  52384. return $core.withContext(function($ctx1) {
  52385. self._should_raise_((function(){
  52386. return $core.withContext(function($ctx2) {
  52387. return "hello"._at_put_((1),"a");
  52388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52389. }),$globals.Error);
  52390. return self;
  52391. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  52392. },
  52393. args: [],
  52394. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  52395. referencedClasses: ["Error"],
  52396. messageSends: ["should:raise:", "at:put:"]
  52397. }),
  52398. $globals.StringTest);
  52399. $core.addMethod(
  52400. $core.method({
  52401. selector: "testCapitalized",
  52402. protocol: 'tests',
  52403. fn: function (){
  52404. var self=this;
  52405. return $core.withContext(function($ctx1) {
  52406. var $1,$2,$3;
  52407. $1="test"._capitalized();
  52408. $ctx1.sendIdx["capitalized"]=1;
  52409. self._assert_equals_($1,"Test");
  52410. $ctx1.sendIdx["assert:equals:"]=1;
  52411. $2="Test"._capitalized();
  52412. $ctx1.sendIdx["capitalized"]=2;
  52413. self._assert_equals_($2,"Test");
  52414. $ctx1.sendIdx["assert:equals:"]=2;
  52415. self._assert_equals_(""._capitalized(),"");
  52416. $ctx1.sendIdx["assert:equals:"]=3;
  52417. $3="Test"._isCapitalized();
  52418. $ctx1.sendIdx["isCapitalized"]=1;
  52419. self._assert_equals_($3,true);
  52420. $ctx1.sendIdx["assert:equals:"]=4;
  52421. self._assert_equals_("test"._isCapitalized(),false);
  52422. return self;
  52423. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  52424. },
  52425. args: [],
  52426. 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.",
  52427. referencedClasses: [],
  52428. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  52429. }),
  52430. $globals.StringTest);
  52431. $core.addMethod(
  52432. $core.method({
  52433. selector: "testCharCodeAt",
  52434. protocol: 'tests',
  52435. fn: function (){
  52436. var self=this;
  52437. return $core.withContext(function($ctx1) {
  52438. var $1,$2,$3,$4,$5;
  52439. $1="jackie"._charCodeAt_((1));
  52440. $ctx1.sendIdx["charCodeAt:"]=1;
  52441. self._assert_equals_($1,(106));
  52442. $ctx1.sendIdx["assert:equals:"]=1;
  52443. $2="jackie"._charCodeAt_((2));
  52444. $ctx1.sendIdx["charCodeAt:"]=2;
  52445. self._assert_equals_($2,(97));
  52446. $ctx1.sendIdx["assert:equals:"]=2;
  52447. $3="jackie"._charCodeAt_((3));
  52448. $ctx1.sendIdx["charCodeAt:"]=3;
  52449. self._assert_equals_($3,(99));
  52450. $ctx1.sendIdx["assert:equals:"]=3;
  52451. $4="jackie"._charCodeAt_((4));
  52452. $ctx1.sendIdx["charCodeAt:"]=4;
  52453. self._assert_equals_($4,(107));
  52454. $ctx1.sendIdx["assert:equals:"]=4;
  52455. $5="jackie"._charCodeAt_((5));
  52456. $ctx1.sendIdx["charCodeAt:"]=5;
  52457. self._assert_equals_($5,(105));
  52458. $ctx1.sendIdx["assert:equals:"]=5;
  52459. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  52460. return self;
  52461. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  52462. },
  52463. args: [],
  52464. 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",
  52465. referencedClasses: [],
  52466. messageSends: ["assert:equals:", "charCodeAt:"]
  52467. }),
  52468. $globals.StringTest);
  52469. $core.addMethod(
  52470. $core.method({
  52471. selector: "testCopyFromTo",
  52472. protocol: 'tests',
  52473. fn: function (){
  52474. var self=this;
  52475. return $core.withContext(function($ctx1) {
  52476. var $1;
  52477. $1="jackie"._copyFrom_to_((1),(3));
  52478. $ctx1.sendIdx["copyFrom:to:"]=1;
  52479. self._assert_equals_($1,"jac");
  52480. $ctx1.sendIdx["assert:equals:"]=1;
  52481. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  52482. return self;
  52483. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  52484. },
  52485. args: [],
  52486. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  52487. referencedClasses: [],
  52488. messageSends: ["assert:equals:", "copyFrom:to:"]
  52489. }),
  52490. $globals.StringTest);
  52491. $core.addMethod(
  52492. $core.method({
  52493. selector: "testCopySeparates",
  52494. protocol: 'tests',
  52495. fn: function (){
  52496. var self=this;
  52497. return $core.withContext(function($ctx1) {
  52498. var $3,$2,$1;
  52499. $3=self._collection();
  52500. $ctx1.sendIdx["collection"]=1;
  52501. $2=$recv($3)._copy();
  52502. $1=$recv($2).__eq_eq(self._collection());
  52503. self._assert_($1);
  52504. return self;
  52505. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  52506. },
  52507. args: [],
  52508. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  52509. referencedClasses: [],
  52510. messageSends: ["assert:", "==", "copy", "collection"]
  52511. }),
  52512. $globals.StringTest);
  52513. $core.addMethod(
  52514. $core.method({
  52515. selector: "testCopyWithoutAll",
  52516. protocol: 'tests',
  52517. fn: function (){
  52518. var self=this;
  52519. return $core.withContext(function($ctx1) {
  52520. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  52521. return self;
  52522. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  52523. },
  52524. args: [],
  52525. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  52526. referencedClasses: [],
  52527. messageSends: ["assert:equals:", "copyWithoutAll:"]
  52528. }),
  52529. $globals.StringTest);
  52530. $core.addMethod(
  52531. $core.method({
  52532. selector: "testEquality",
  52533. protocol: 'tests',
  52534. fn: function (){
  52535. var self=this;
  52536. return $core.withContext(function($ctx1) {
  52537. var $1,$2,$3;
  52538. self._assert_equals_("hello","hello");
  52539. $ctx1.sendIdx["assert:equals:"]=1;
  52540. $1="hello".__eq("world");
  52541. $ctx1.sendIdx["="]=1;
  52542. self._deny_($1);
  52543. $ctx1.sendIdx["deny:"]=1;
  52544. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  52545. })));
  52546. $ctx1.sendIdx["="]=2;
  52547. self._deny_($2);
  52548. $ctx1.sendIdx["deny:"]=2;
  52549. $3="hello"._yourself();
  52550. $ctx1.sendIdx["yourself"]=1;
  52551. self._assert_equals_("hello",$3);
  52552. $ctx1.sendIdx["assert:equals:"]=2;
  52553. self._assert_equals_("hello"._yourself(),"hello");
  52554. self._deny_("".__eq((0)));
  52555. return self;
  52556. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  52557. },
  52558. args: [],
  52559. 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",
  52560. referencedClasses: [],
  52561. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  52562. }),
  52563. $globals.StringTest);
  52564. $core.addMethod(
  52565. $core.method({
  52566. selector: "testIdentity",
  52567. protocol: 'tests',
  52568. fn: function (){
  52569. var self=this;
  52570. return $core.withContext(function($ctx1) {
  52571. var $1,$2,$4,$3,$5;
  52572. $1="hello".__eq_eq("hello");
  52573. $ctx1.sendIdx["=="]=1;
  52574. self._assert_($1);
  52575. $ctx1.sendIdx["assert:"]=1;
  52576. $2="hello".__eq_eq("world");
  52577. $ctx1.sendIdx["=="]=2;
  52578. self._deny_($2);
  52579. $ctx1.sendIdx["deny:"]=1;
  52580. $4="hello"._yourself();
  52581. $ctx1.sendIdx["yourself"]=1;
  52582. $3="hello".__eq_eq($4);
  52583. $ctx1.sendIdx["=="]=3;
  52584. self._assert_($3);
  52585. $ctx1.sendIdx["assert:"]=2;
  52586. $5=$recv("hello"._yourself()).__eq_eq("hello");
  52587. $ctx1.sendIdx["=="]=4;
  52588. self._assert_($5);
  52589. self._deny_("".__eq_eq((0)));
  52590. return self;
  52591. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  52592. },
  52593. args: [],
  52594. 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",
  52595. referencedClasses: [],
  52596. messageSends: ["assert:", "==", "deny:", "yourself"]
  52597. }),
  52598. $globals.StringTest);
  52599. $core.addMethod(
  52600. $core.method({
  52601. selector: "testIncludesSubString",
  52602. protocol: 'tests',
  52603. fn: function (){
  52604. var self=this;
  52605. return $core.withContext(function($ctx1) {
  52606. var $1;
  52607. $1="amber"._includesSubString_("ber");
  52608. $ctx1.sendIdx["includesSubString:"]=1;
  52609. self._assert_($1);
  52610. self._deny_("amber"._includesSubString_("zork"));
  52611. return self;
  52612. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  52613. },
  52614. args: [],
  52615. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  52616. referencedClasses: [],
  52617. messageSends: ["assert:", "includesSubString:", "deny:"]
  52618. }),
  52619. $globals.StringTest);
  52620. $core.addMethod(
  52621. $core.method({
  52622. selector: "testIndexOfStartingAtWithNull",
  52623. protocol: 'tests',
  52624. fn: function (){
  52625. var self=this;
  52626. return self;
  52627. },
  52628. args: [],
  52629. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  52630. referencedClasses: [],
  52631. messageSends: []
  52632. }),
  52633. $globals.StringTest);
  52634. $core.addMethod(
  52635. $core.method({
  52636. selector: "testIndexOfWithNull",
  52637. protocol: 'tests',
  52638. fn: function (){
  52639. var self=this;
  52640. return self;
  52641. },
  52642. args: [],
  52643. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  52644. referencedClasses: [],
  52645. messageSends: []
  52646. }),
  52647. $globals.StringTest);
  52648. $core.addMethod(
  52649. $core.method({
  52650. selector: "testIsVowel",
  52651. protocol: 'tests',
  52652. fn: function (){
  52653. var self=this;
  52654. var vowel,consonant;
  52655. return $core.withContext(function($ctx1) {
  52656. var $1;
  52657. vowel="u";
  52658. consonant="z";
  52659. $1=$recv(vowel)._isVowel();
  52660. $ctx1.sendIdx["isVowel"]=1;
  52661. self._assert_equals_($1,true);
  52662. $ctx1.sendIdx["assert:equals:"]=1;
  52663. self._assert_equals_($recv(consonant)._isVowel(),false);
  52664. return self;
  52665. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  52666. },
  52667. args: [],
  52668. 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",
  52669. referencedClasses: [],
  52670. messageSends: ["assert:equals:", "isVowel"]
  52671. }),
  52672. $globals.StringTest);
  52673. $core.addMethod(
  52674. $core.method({
  52675. selector: "testJoin",
  52676. protocol: 'tests',
  52677. fn: function (){
  52678. var self=this;
  52679. return $core.withContext(function($ctx1) {
  52680. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  52681. return self;
  52682. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  52683. },
  52684. args: [],
  52685. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  52686. referencedClasses: [],
  52687. messageSends: ["assert:equals:", "join:"]
  52688. }),
  52689. $globals.StringTest);
  52690. $core.addMethod(
  52691. $core.method({
  52692. selector: "testRemoveAll",
  52693. protocol: 'tests',
  52694. fn: function (){
  52695. var self=this;
  52696. return $core.withContext(function($ctx1) {
  52697. self._should_raise_((function(){
  52698. return $core.withContext(function($ctx2) {
  52699. return $recv(self._collection())._removeAll();
  52700. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52701. }),$globals.Error);
  52702. return self;
  52703. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  52704. },
  52705. args: [],
  52706. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  52707. referencedClasses: ["Error"],
  52708. messageSends: ["should:raise:", "removeAll", "collection"]
  52709. }),
  52710. $globals.StringTest);
  52711. $core.addMethod(
  52712. $core.method({
  52713. selector: "testReversed",
  52714. protocol: 'tests',
  52715. fn: function (){
  52716. var self=this;
  52717. return $core.withContext(function($ctx1) {
  52718. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  52719. return self;
  52720. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  52721. },
  52722. args: [],
  52723. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  52724. referencedClasses: [],
  52725. messageSends: ["assert:equals:", "reversed"]
  52726. }),
  52727. $globals.StringTest);
  52728. $core.addMethod(
  52729. $core.method({
  52730. selector: "testStreamContents",
  52731. protocol: 'tests',
  52732. fn: function (){
  52733. var self=this;
  52734. return $core.withContext(function($ctx1) {
  52735. self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  52736. return $core.withContext(function($ctx2) {
  52737. $recv(aStream)._nextPutAll_("hello");
  52738. $ctx2.sendIdx["nextPutAll:"]=1;
  52739. $recv(aStream)._space();
  52740. return $recv(aStream)._nextPutAll_("world");
  52741. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  52742. })),"hello world");
  52743. return self;
  52744. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  52745. },
  52746. args: [],
  52747. 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'",
  52748. referencedClasses: ["String"],
  52749. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  52750. }),
  52751. $globals.StringTest);
  52752. $core.addMethod(
  52753. $core.method({
  52754. selector: "testSubStrings",
  52755. protocol: 'tests',
  52756. fn: function (){
  52757. var self=this;
  52758. return $core.withContext(function($ctx1) {
  52759. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  52760. return self;
  52761. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  52762. },
  52763. args: [],
  52764. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  52765. referencedClasses: [],
  52766. messageSends: ["assert:equals:", "subStrings:"]
  52767. }),
  52768. $globals.StringTest);
  52769. $core.addMethod(
  52770. $core.method({
  52771. selector: "testTrim",
  52772. protocol: 'tests',
  52773. fn: function (){
  52774. var self=this;
  52775. return $core.withContext(function($ctx1) {
  52776. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  52777. $ctx1.sendIdx["assert:equals:"]=1;
  52778. self._assert_equals_("jackie "._trimRight(),"jackie");
  52779. return self;
  52780. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  52781. },
  52782. args: [],
  52783. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  52784. referencedClasses: [],
  52785. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  52786. }),
  52787. $globals.StringTest);
  52788. $core.addMethod(
  52789. $core.method({
  52790. selector: "testValue",
  52791. protocol: 'tests',
  52792. fn: function (){
  52793. var self=this;
  52794. return $core.withContext(function($ctx1) {
  52795. self._assert_equals_("asString"._value_((1)),"1");
  52796. $ctx1.sendIdx["assert:equals:"]=1;
  52797. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  52798. return self;
  52799. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  52800. },
  52801. args: [],
  52802. 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')",
  52803. referencedClasses: [],
  52804. messageSends: ["assert:equals:", "value:", "collect:"]
  52805. }),
  52806. $globals.StringTest);
  52807. $core.addMethod(
  52808. $core.method({
  52809. selector: "collectionClass",
  52810. protocol: 'fixture',
  52811. fn: function (){
  52812. var self=this;
  52813. return $globals.String;
  52814. },
  52815. args: [],
  52816. source: "collectionClass\x0a\x09^ String",
  52817. referencedClasses: ["String"],
  52818. messageSends: []
  52819. }),
  52820. $globals.StringTest.klass);
  52821. $core.addClass('SetTest', $globals.CollectionTest, [], 'Kernel-Tests');
  52822. $core.addMethod(
  52823. $core.method({
  52824. selector: "collection",
  52825. protocol: 'fixture',
  52826. fn: function (){
  52827. var self=this;
  52828. return $core.withContext(function($ctx1) {
  52829. var $1;
  52830. $1=$recv($globals.Set)._new();
  52831. $recv($1)._add_($globals.Smalltalk);
  52832. $ctx1.sendIdx["add:"]=1;
  52833. $recv($1)._add_(nil);
  52834. $ctx1.sendIdx["add:"]=2;
  52835. $recv($1)._add_((3).__at((3)));
  52836. $ctx1.sendIdx["add:"]=3;
  52837. $recv($1)._add_(false);
  52838. $ctx1.sendIdx["add:"]=4;
  52839. $recv($1)._add_(self["@sampleBlock"]);
  52840. return $recv($1)._yourself();
  52841. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  52842. },
  52843. args: [],
  52844. 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",
  52845. referencedClasses: ["Set", "Smalltalk"],
  52846. messageSends: ["add:", "new", "@", "yourself"]
  52847. }),
  52848. $globals.SetTest);
  52849. $core.addMethod(
  52850. $core.method({
  52851. selector: "collectionOfPrintStrings",
  52852. protocol: 'fixture',
  52853. fn: function (){
  52854. var self=this;
  52855. return $core.withContext(function($ctx1) {
  52856. var $1;
  52857. $1=$recv($globals.Set)._new();
  52858. $recv($1)._add_("a SmalltalkImage");
  52859. $ctx1.sendIdx["add:"]=1;
  52860. $recv($1)._add_("nil");
  52861. $ctx1.sendIdx["add:"]=2;
  52862. $recv($1)._add_("3@3");
  52863. $ctx1.sendIdx["add:"]=3;
  52864. $recv($1)._add_("false");
  52865. $ctx1.sendIdx["add:"]=4;
  52866. $recv($1)._add_("a BlockClosure");
  52867. return $recv($1)._yourself();
  52868. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  52869. },
  52870. args: [],
  52871. 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",
  52872. referencedClasses: ["Set"],
  52873. messageSends: ["add:", "new", "yourself"]
  52874. }),
  52875. $globals.SetTest);
  52876. $core.addMethod(
  52877. $core.method({
  52878. selector: "collectionSize",
  52879. protocol: 'fixture',
  52880. fn: function (){
  52881. var self=this;
  52882. return (5);
  52883. },
  52884. args: [],
  52885. source: "collectionSize\x0a\x09^ 5",
  52886. referencedClasses: [],
  52887. messageSends: []
  52888. }),
  52889. $globals.SetTest);
  52890. $core.addMethod(
  52891. $core.method({
  52892. selector: "collectionWithDuplicates",
  52893. protocol: 'fixture',
  52894. fn: function (){
  52895. var self=this;
  52896. return $core.withContext(function($ctx1) {
  52897. var $1;
  52898. $1=self._collection();
  52899. $recv($1)._add_((0));
  52900. return $recv($1)._yourself();
  52901. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  52902. },
  52903. args: [],
  52904. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  52905. referencedClasses: [],
  52906. messageSends: ["add:", "collection", "yourself"]
  52907. }),
  52908. $globals.SetTest);
  52909. $core.addMethod(
  52910. $core.method({
  52911. selector: "collectionWithNewValue",
  52912. protocol: 'fixture',
  52913. fn: function (){
  52914. var self=this;
  52915. return $core.withContext(function($ctx1) {
  52916. var $1;
  52917. $1=$recv($globals.Set)._new();
  52918. $recv($1)._add_($globals.Smalltalk);
  52919. $ctx1.sendIdx["add:"]=1;
  52920. $recv($1)._add_(nil);
  52921. $ctx1.sendIdx["add:"]=2;
  52922. $recv($1)._add_((3).__at((3)));
  52923. $ctx1.sendIdx["add:"]=3;
  52924. $recv($1)._add_("N");
  52925. $ctx1.sendIdx["add:"]=4;
  52926. $recv($1)._add_(false);
  52927. $ctx1.sendIdx["add:"]=5;
  52928. $recv($1)._add_(self["@sampleBlock"]);
  52929. return $recv($1)._yourself();
  52930. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  52931. },
  52932. args: [],
  52933. 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",
  52934. referencedClasses: ["Set", "Smalltalk"],
  52935. messageSends: ["add:", "new", "@", "yourself"]
  52936. }),
  52937. $globals.SetTest);
  52938. $core.addMethod(
  52939. $core.method({
  52940. selector: "testAddAll",
  52941. protocol: 'tests',
  52942. fn: function (){
  52943. var self=this;
  52944. return $core.withContext(function($ctx1) {
  52945. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  52946. (
  52947. $ctx1.supercall = true,
  52948. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($recv(self), []));
  52949. $ctx1.supercall = false;
  52950. $2=self._collection();
  52951. $ctx1.sendIdx["collection"]=1;
  52952. $3=self._collection();
  52953. $ctx1.sendIdx["collection"]=2;
  52954. $recv($2)._addAll_($3);
  52955. $ctx1.sendIdx["addAll:"]=1;
  52956. $4=$recv($2)._yourself();
  52957. $ctx1.sendIdx["yourself"]=1;
  52958. $1=$4;
  52959. $5=self._collection();
  52960. $ctx1.sendIdx["collection"]=3;
  52961. self._assert_equals_($1,$5);
  52962. $ctx1.sendIdx["assert:equals:"]=1;
  52963. $7=self._collection();
  52964. $ctx1.sendIdx["collection"]=4;
  52965. $8=self._collectionWithNewValue();
  52966. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52967. $recv($7)._addAll_($8);
  52968. $ctx1.sendIdx["addAll:"]=2;
  52969. $9=$recv($7)._yourself();
  52970. $ctx1.sendIdx["yourself"]=2;
  52971. $6=$9;
  52972. $10=self._collectionWithNewValue();
  52973. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52974. self._assert_equals_($6,$10);
  52975. $ctx1.sendIdx["assert:equals:"]=2;
  52976. $12=self._collectionWithNewValue();
  52977. $ctx1.sendIdx["collectionWithNewValue"]=3;
  52978. $recv($12)._addAll_(self._collection());
  52979. $11=$recv($12)._yourself();
  52980. self._assert_equals_($11,self._collectionWithNewValue());
  52981. return self;
  52982. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  52983. },
  52984. args: [],
  52985. 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",
  52986. referencedClasses: [],
  52987. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  52988. }),
  52989. $globals.SetTest);
  52990. $core.addMethod(
  52991. $core.method({
  52992. selector: "testAddRemove",
  52993. protocol: 'tests',
  52994. fn: function (){
  52995. var self=this;
  52996. var set;
  52997. return $core.withContext(function($ctx1) {
  52998. var $1,$2;
  52999. set=$recv($globals.Set)._new();
  53000. self._assert_($recv(set)._isEmpty());
  53001. $ctx1.sendIdx["assert:"]=1;
  53002. $recv(set)._add_((3));
  53003. $ctx1.sendIdx["add:"]=1;
  53004. $1=$recv(set)._includes_((3));
  53005. $ctx1.sendIdx["includes:"]=1;
  53006. self._assert_($1);
  53007. $ctx1.sendIdx["assert:"]=2;
  53008. $recv(set)._add_((5));
  53009. $2=$recv(set)._includes_((5));
  53010. $ctx1.sendIdx["includes:"]=2;
  53011. self._assert_($2);
  53012. $recv(set)._remove_((3));
  53013. self._deny_($recv(set)._includes_((3)));
  53014. return self;
  53015. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  53016. },
  53017. args: [],
  53018. 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)",
  53019. referencedClasses: ["Set"],
  53020. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  53021. }),
  53022. $globals.SetTest);
  53023. $core.addMethod(
  53024. $core.method({
  53025. selector: "testAt",
  53026. protocol: 'tests',
  53027. fn: function (){
  53028. var self=this;
  53029. return $core.withContext(function($ctx1) {
  53030. self._should_raise_((function(){
  53031. return $core.withContext(function($ctx2) {
  53032. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  53033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53034. }),$globals.Error);
  53035. return self;
  53036. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  53037. },
  53038. args: [],
  53039. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  53040. referencedClasses: ["Set", "Error"],
  53041. messageSends: ["should:raise:", "at:put:", "new"]
  53042. }),
  53043. $globals.SetTest);
  53044. $core.addMethod(
  53045. $core.method({
  53046. selector: "testCollect",
  53047. protocol: 'tests',
  53048. fn: function (){
  53049. var self=this;
  53050. return $core.withContext(function($ctx1) {
  53051. var $2,$1;
  53052. (
  53053. $ctx1.supercall = true,
  53054. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($recv(self), []));
  53055. $ctx1.supercall = false;
  53056. $2=[(5), (6), (8)]._asSet();
  53057. $ctx1.sendIdx["asSet"]=1;
  53058. $1=$recv($2)._collect_((function(x){
  53059. return $core.withContext(function($ctx2) {
  53060. return $recv(x).__backslash_backslash((3));
  53061. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53062. }));
  53063. self._assert_equals_($1,[(0), (2)]._asSet());
  53064. return self;
  53065. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  53066. },
  53067. args: [],
  53068. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  53069. referencedClasses: [],
  53070. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  53071. }),
  53072. $globals.SetTest);
  53073. $core.addMethod(
  53074. $core.method({
  53075. selector: "testComma",
  53076. protocol: 'tests',
  53077. fn: function (){
  53078. var self=this;
  53079. return $core.withContext(function($ctx1) {
  53080. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  53081. (
  53082. $ctx1.supercall = true,
  53083. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($recv(self), []));
  53084. $ctx1.supercall = false;
  53085. $2=self._collection();
  53086. $ctx1.sendIdx["collection"]=1;
  53087. $3=self._collection();
  53088. $ctx1.sendIdx["collection"]=2;
  53089. $1=$recv($2).__comma($3);
  53090. $ctx1.sendIdx[","]=1;
  53091. $4=self._collection();
  53092. $ctx1.sendIdx["collection"]=3;
  53093. self._assert_equals_($1,$4);
  53094. $ctx1.sendIdx["assert:equals:"]=1;
  53095. $6=self._collection();
  53096. $ctx1.sendIdx["collection"]=4;
  53097. $7=self._collectionWithNewValue();
  53098. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53099. $5=$recv($6).__comma($7);
  53100. $ctx1.sendIdx[","]=2;
  53101. $8=self._collectionWithNewValue();
  53102. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53103. self._assert_equals_($5,$8);
  53104. $ctx1.sendIdx["assert:equals:"]=2;
  53105. $10=self._collectionWithNewValue();
  53106. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53107. $9=$recv($10).__comma(self._collection());
  53108. self._assert_equals_($9,self._collectionWithNewValue());
  53109. return self;
  53110. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  53111. },
  53112. args: [],
  53113. 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",
  53114. referencedClasses: [],
  53115. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  53116. }),
  53117. $globals.SetTest);
  53118. $core.addMethod(
  53119. $core.method({
  53120. selector: "testComparing",
  53121. protocol: 'tests',
  53122. fn: function (){
  53123. var self=this;
  53124. return $core.withContext(function($ctx1) {
  53125. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  53126. $1=[(0), (2)]._asSet();
  53127. $ctx1.sendIdx["asSet"]=1;
  53128. $2=[(0), (2)]._asSet();
  53129. $ctx1.sendIdx["asSet"]=2;
  53130. self._assert_equals_($1,$2);
  53131. $ctx1.sendIdx["assert:equals:"]=1;
  53132. $3=[(2), (0)]._asSet();
  53133. $ctx1.sendIdx["asSet"]=3;
  53134. $4=[(0), (2)]._asSet();
  53135. $ctx1.sendIdx["asSet"]=4;
  53136. self._assert_equals_($3,$4);
  53137. $6=[(0), (2), (3)]._asSet();
  53138. $ctx1.sendIdx["asSet"]=5;
  53139. $7=[(0), (2)]._asSet();
  53140. $ctx1.sendIdx["asSet"]=6;
  53141. $5=$recv($6).__eq($7);
  53142. $ctx1.sendIdx["="]=1;
  53143. self._deny_($5);
  53144. $ctx1.sendIdx["deny:"]=1;
  53145. $9=[(1), (2)]._asSet();
  53146. $ctx1.sendIdx["asSet"]=7;
  53147. $8=$recv($9).__eq([(0), (2)]._asSet());
  53148. self._deny_($8);
  53149. return self;
  53150. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  53151. },
  53152. args: [],
  53153. 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",
  53154. referencedClasses: [],
  53155. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  53156. }),
  53157. $globals.SetTest);
  53158. $core.addMethod(
  53159. $core.method({
  53160. selector: "testPrintString",
  53161. protocol: 'tests',
  53162. fn: function (){
  53163. var self=this;
  53164. var set;
  53165. return $core.withContext(function($ctx1) {
  53166. var $1,$2,$3,$4,$5,$6,$7,$8;
  53167. set=$recv($globals.Set)._new();
  53168. $1=$recv(set)._printString();
  53169. $ctx1.sendIdx["printString"]=1;
  53170. self._assert_equals_($1,"a Set ()");
  53171. $ctx1.sendIdx["assert:equals:"]=1;
  53172. $2=set;
  53173. $recv($2)._add_((1));
  53174. $ctx1.sendIdx["add:"]=1;
  53175. $3=$recv($2)._add_((3));
  53176. $ctx1.sendIdx["add:"]=2;
  53177. $4=$recv(set)._printString();
  53178. $ctx1.sendIdx["printString"]=2;
  53179. self._assert_equals_($4,"a Set (1 3)");
  53180. $ctx1.sendIdx["assert:equals:"]=2;
  53181. $recv(set)._add_("foo");
  53182. $ctx1.sendIdx["add:"]=3;
  53183. $5=$recv(set)._printString();
  53184. $ctx1.sendIdx["printString"]=3;
  53185. self._assert_equals_($5,"a Set (1 3 'foo')");
  53186. $ctx1.sendIdx["assert:equals:"]=3;
  53187. $6=set;
  53188. $recv($6)._remove_((1));
  53189. $ctx1.sendIdx["remove:"]=1;
  53190. $recv($6)._remove_((3));
  53191. $7=$recv(set)._printString();
  53192. $ctx1.sendIdx["printString"]=4;
  53193. self._assert_equals_($7,"a Set ('foo')");
  53194. $ctx1.sendIdx["assert:equals:"]=4;
  53195. $recv(set)._add_((3));
  53196. $ctx1.sendIdx["add:"]=4;
  53197. $8=$recv(set)._printString();
  53198. $ctx1.sendIdx["printString"]=5;
  53199. self._assert_equals_($8,"a Set (3 'foo')");
  53200. $ctx1.sendIdx["assert:equals:"]=5;
  53201. $recv(set)._add_((3));
  53202. self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  53203. return self;
  53204. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  53205. },
  53206. args: [],
  53207. 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'')'",
  53208. referencedClasses: ["Set"],
  53209. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  53210. }),
  53211. $globals.SetTest);
  53212. $core.addMethod(
  53213. $core.method({
  53214. selector: "testUnboxedObjects",
  53215. protocol: 'tests',
  53216. fn: function (){
  53217. var self=this;
  53218. return $core.withContext(function($ctx1) {
  53219. var $4,$3,$2,$1;
  53220. $4="foo"._yourself();
  53221. $ctx1.sendIdx["yourself"]=1;
  53222. $3=[$4,"foo"._yourself()];
  53223. $2=$recv($3)._asSet();
  53224. $1=$recv($2)._asArray();
  53225. self._assert_equals_($1,["foo"]);
  53226. return self;
  53227. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  53228. },
  53229. args: [],
  53230. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  53231. referencedClasses: [],
  53232. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  53233. }),
  53234. $globals.SetTest);
  53235. $core.addMethod(
  53236. $core.method({
  53237. selector: "testUnicity",
  53238. protocol: 'tests',
  53239. fn: function (){
  53240. var self=this;
  53241. var set;
  53242. return $core.withContext(function($ctx1) {
  53243. var $1;
  53244. set=$recv($globals.Set)._new();
  53245. $recv(set)._add_((21));
  53246. $ctx1.sendIdx["add:"]=1;
  53247. $recv(set)._add_("hello");
  53248. $ctx1.sendIdx["add:"]=2;
  53249. $recv(set)._add_((21));
  53250. $ctx1.sendIdx["add:"]=3;
  53251. $1=$recv(set)._size();
  53252. $ctx1.sendIdx["size"]=1;
  53253. self._assert_equals_($1,(2));
  53254. $ctx1.sendIdx["assert:equals:"]=1;
  53255. $recv(set)._add_("hello");
  53256. self._assert_equals_($recv(set)._size(),(2));
  53257. $ctx1.sendIdx["assert:equals:"]=2;
  53258. self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  53259. return self;
  53260. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  53261. },
  53262. args: [],
  53263. 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')",
  53264. referencedClasses: ["Set"],
  53265. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  53266. }),
  53267. $globals.SetTest);
  53268. $core.addMethod(
  53269. $core.method({
  53270. selector: "collectionClass",
  53271. protocol: 'fixture',
  53272. fn: function (){
  53273. var self=this;
  53274. return $globals.Set;
  53275. },
  53276. args: [],
  53277. source: "collectionClass\x0a\x09^ Set",
  53278. referencedClasses: ["Set"],
  53279. messageSends: []
  53280. }),
  53281. $globals.SetTest.klass);
  53282. $core.addClass('ConsoleTranscriptTest', $globals.TestCase, [], 'Kernel-Tests');
  53283. $core.addMethod(
  53284. $core.method({
  53285. selector: "testShow",
  53286. protocol: 'tests',
  53287. fn: function (){
  53288. var self=this;
  53289. var originalTranscript;
  53290. return $core.withContext(function($ctx1) {
  53291. originalTranscript=$recv($globals.Transcript)._current();
  53292. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  53293. $ctx1.sendIdx["register:"]=1;
  53294. self._shouldnt_raise_((function(){
  53295. return $core.withContext(function($ctx2) {
  53296. return $recv($globals.Transcript)._show_("Hello console!");
  53297. $ctx2.sendIdx["show:"]=1;
  53298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53299. }),$globals.Error);
  53300. $ctx1.sendIdx["shouldnt:raise:"]=1;
  53301. self._shouldnt_raise_((function(){
  53302. return $core.withContext(function($ctx2) {
  53303. return $recv($globals.Transcript)._show_(console);
  53304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53305. }),$globals.Error);
  53306. $recv($globals.Transcript)._register_(originalTranscript);
  53307. return self;
  53308. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  53309. },
  53310. args: [],
  53311. 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.",
  53312. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  53313. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  53314. }),
  53315. $globals.ConsoleTranscriptTest);
  53316. $core.addClass('DateTest', $globals.TestCase, [], 'Kernel-Tests');
  53317. $core.addMethod(
  53318. $core.method({
  53319. selector: "testEquality",
  53320. protocol: 'tests',
  53321. fn: function (){
  53322. var self=this;
  53323. var now;
  53324. return $core.withContext(function($ctx1) {
  53325. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  53326. now=$recv($globals.Date)._new();
  53327. $1=$recv(now).__eq(now);
  53328. $ctx1.sendIdx["="]=1;
  53329. self._assert_($1);
  53330. $ctx1.sendIdx["assert:"]=1;
  53331. $3=now;
  53332. $4=$recv($globals.Date)._fromMilliseconds_((0));
  53333. $ctx1.sendIdx["fromMilliseconds:"]=1;
  53334. $2=$recv($3).__eq($4);
  53335. $ctx1.sendIdx["="]=2;
  53336. self._deny_($2);
  53337. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  53338. $ctx1.sendIdx["fromMilliseconds:"]=2;
  53339. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  53340. $ctx1.sendIdx["fromMilliseconds:"]=3;
  53341. $5=$recv($6).__eq($7);
  53342. $ctx1.sendIdx["="]=3;
  53343. self._assert_($5);
  53344. $ctx1.sendIdx["assert:"]=2;
  53345. $9=now;
  53346. $11=$recv(now)._asMilliseconds();
  53347. $ctx1.sendIdx["asMilliseconds"]=1;
  53348. $10=$recv($globals.Date)._fromMilliseconds_($11);
  53349. $ctx1.sendIdx["fromMilliseconds:"]=4;
  53350. $8=$recv($9).__eq($10);
  53351. $ctx1.sendIdx["="]=4;
  53352. self._assert_($8);
  53353. $ctx1.sendIdx["assert:"]=3;
  53354. self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  53355. return self;
  53356. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  53357. },
  53358. args: [],
  53359. 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",
  53360. referencedClasses: ["Date"],
  53361. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  53362. }),
  53363. $globals.DateTest);
  53364. $core.addMethod(
  53365. $core.method({
  53366. selector: "testIdentity",
  53367. protocol: 'tests',
  53368. fn: function (){
  53369. var self=this;
  53370. var now;
  53371. return $core.withContext(function($ctx1) {
  53372. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  53373. now=$recv($globals.Date)._new();
  53374. $1=$recv(now).__eq_eq(now);
  53375. $ctx1.sendIdx["=="]=1;
  53376. self._assert_($1);
  53377. $3=now;
  53378. $4=$recv($globals.Date)._fromMilliseconds_((0));
  53379. $ctx1.sendIdx["fromMilliseconds:"]=1;
  53380. $2=$recv($3).__eq_eq($4);
  53381. $ctx1.sendIdx["=="]=2;
  53382. self._deny_($2);
  53383. $ctx1.sendIdx["deny:"]=1;
  53384. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  53385. $ctx1.sendIdx["fromMilliseconds:"]=2;
  53386. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  53387. $ctx1.sendIdx["fromMilliseconds:"]=3;
  53388. $5=$recv($6).__eq_eq($7);
  53389. $ctx1.sendIdx["=="]=3;
  53390. self._deny_($5);
  53391. $ctx1.sendIdx["deny:"]=2;
  53392. $9=now;
  53393. $11=$recv(now)._asMilliseconds();
  53394. $ctx1.sendIdx["asMilliseconds"]=1;
  53395. $10=$recv($globals.Date)._fromMilliseconds_($11);
  53396. $ctx1.sendIdx["fromMilliseconds:"]=4;
  53397. $8=$recv($9).__eq_eq($10);
  53398. $ctx1.sendIdx["=="]=4;
  53399. self._deny_($8);
  53400. $ctx1.sendIdx["deny:"]=3;
  53401. self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  53402. return self;
  53403. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  53404. },
  53405. args: [],
  53406. 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",
  53407. referencedClasses: ["Date"],
  53408. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  53409. }),
  53410. $globals.DateTest);
  53411. $core.addClass('JSObjectProxyTest', $globals.TestCase, [], 'Kernel-Tests');
  53412. $core.addMethod(
  53413. $core.method({
  53414. selector: "jsNull",
  53415. protocol: 'accessing',
  53416. fn: function (){
  53417. var self=this;
  53418. return $core.withContext(function($ctx1) {
  53419. return null;
  53420. return self;
  53421. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  53422. },
  53423. args: [],
  53424. source: "jsNull\x0a\x09<inlineJS: 'return null'>",
  53425. referencedClasses: [],
  53426. messageSends: []
  53427. }),
  53428. $globals.JSObjectProxyTest);
  53429. $core.addMethod(
  53430. $core.method({
  53431. selector: "jsObject",
  53432. protocol: 'accessing',
  53433. fn: function (){
  53434. var self=this;
  53435. return $core.withContext(function($ctx1) {
  53436. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  53437. return self;
  53438. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  53439. },
  53440. args: [],
  53441. 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}'>",
  53442. referencedClasses: [],
  53443. messageSends: []
  53444. }),
  53445. $globals.JSObjectProxyTest);
  53446. $core.addMethod(
  53447. $core.method({
  53448. selector: "jsUndefined",
  53449. protocol: 'accessing',
  53450. fn: function (){
  53451. var self=this;
  53452. return $core.withContext(function($ctx1) {
  53453. return;
  53454. return self;
  53455. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  53456. },
  53457. args: [],
  53458. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  53459. referencedClasses: [],
  53460. messageSends: []
  53461. }),
  53462. $globals.JSObjectProxyTest);
  53463. $core.addMethod(
  53464. $core.method({
  53465. selector: "testAtIfAbsent",
  53466. protocol: 'tests',
  53467. fn: function (){
  53468. var self=this;
  53469. var testObject;
  53470. return $core.withContext(function($ctx1) {
  53471. var $1,$2,$3;
  53472. testObject=self._jsObject();
  53473. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  53474. return "Property does not exist";
  53475. }));
  53476. $ctx1.sendIdx["at:ifAbsent:"]=1;
  53477. self._assert_equals_($1,"Property does not exist");
  53478. $ctx1.sendIdx["assert:equals:"]=1;
  53479. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  53480. return "Property does not exist";
  53481. }));
  53482. $ctx1.sendIdx["at:ifAbsent:"]=2;
  53483. self._assert_equals_($2,nil);
  53484. $ctx1.sendIdx["assert:equals:"]=2;
  53485. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  53486. return "Property does not exist";
  53487. }));
  53488. $ctx1.sendIdx["at:ifAbsent:"]=3;
  53489. self._assert_equals_($3,(1));
  53490. $ctx1.sendIdx["assert:equals:"]=3;
  53491. self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  53492. return "Property does not exist";
  53493. })),nil);
  53494. return self;
  53495. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53496. },
  53497. args: [],
  53498. 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.",
  53499. referencedClasses: [],
  53500. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  53501. }),
  53502. $globals.JSObjectProxyTest);
  53503. $core.addMethod(
  53504. $core.method({
  53505. selector: "testAtIfPresent",
  53506. protocol: 'tests',
  53507. fn: function (){
  53508. var self=this;
  53509. var testObject;
  53510. return $core.withContext(function($ctx1) {
  53511. var $2,$1,$4,$3,$6,$5;
  53512. testObject=self._jsObject();
  53513. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  53514. return $core.withContext(function($ctx2) {
  53515. $2=$recv(x)._asString();
  53516. $ctx2.sendIdx["asString"]=1;
  53517. return "hello ".__comma($2);
  53518. $ctx2.sendIdx[","]=1;
  53519. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53520. }));
  53521. $ctx1.sendIdx["at:ifPresent:"]=1;
  53522. self._assert_equals_($1,nil);
  53523. $ctx1.sendIdx["assert:equals:"]=1;
  53524. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  53525. return $core.withContext(function($ctx2) {
  53526. $4=$recv(x)._asString();
  53527. $ctx2.sendIdx["asString"]=2;
  53528. return "hello ".__comma($4);
  53529. $ctx2.sendIdx[","]=2;
  53530. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  53531. }));
  53532. $ctx1.sendIdx["at:ifPresent:"]=2;
  53533. self._assert_equals_($3,"hello nil");
  53534. $ctx1.sendIdx["assert:equals:"]=2;
  53535. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  53536. return $core.withContext(function($ctx2) {
  53537. $6=$recv(x)._asString();
  53538. $ctx2.sendIdx["asString"]=3;
  53539. return "hello ".__comma($6);
  53540. $ctx2.sendIdx[","]=3;
  53541. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  53542. }));
  53543. $ctx1.sendIdx["at:ifPresent:"]=3;
  53544. self._assert_equals_($5,"hello 1");
  53545. $ctx1.sendIdx["assert:equals:"]=3;
  53546. self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  53547. return $core.withContext(function($ctx2) {
  53548. return "hello ".__comma($recv(x)._asString());
  53549. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  53550. })),"hello nil");
  53551. return self;
  53552. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53553. },
  53554. args: [],
  53555. 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'.",
  53556. referencedClasses: [],
  53557. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  53558. }),
  53559. $globals.JSObjectProxyTest);
  53560. $core.addMethod(
  53561. $core.method({
  53562. selector: "testAtIfPresentIfAbsent",
  53563. protocol: 'tests',
  53564. fn: function (){
  53565. var self=this;
  53566. var testObject;
  53567. return $core.withContext(function($ctx1) {
  53568. var $2,$1,$4,$3,$6,$5;
  53569. testObject=self._jsObject();
  53570. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  53571. return $core.withContext(function($ctx2) {
  53572. $2=$recv(x)._asString();
  53573. $ctx2.sendIdx["asString"]=1;
  53574. return "hello ".__comma($2);
  53575. $ctx2.sendIdx[","]=1;
  53576. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53577. }),(function(){
  53578. return "not present";
  53579. }));
  53580. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  53581. self._assert_equals_($1,"not present");
  53582. $ctx1.sendIdx["assert:equals:"]=1;
  53583. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  53584. return $core.withContext(function($ctx2) {
  53585. $4=$recv(x)._asString();
  53586. $ctx2.sendIdx["asString"]=2;
  53587. return "hello ".__comma($4);
  53588. $ctx2.sendIdx[","]=2;
  53589. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  53590. }),(function(){
  53591. return "not present";
  53592. }));
  53593. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  53594. self._assert_equals_($3,"hello nil");
  53595. $ctx1.sendIdx["assert:equals:"]=2;
  53596. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  53597. return $core.withContext(function($ctx2) {
  53598. $6=$recv(x)._asString();
  53599. $ctx2.sendIdx["asString"]=3;
  53600. return "hello ".__comma($6);
  53601. $ctx2.sendIdx[","]=3;
  53602. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  53603. }),(function(){
  53604. return "not present";
  53605. }));
  53606. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  53607. self._assert_equals_($5,"hello 1");
  53608. $ctx1.sendIdx["assert:equals:"]=3;
  53609. self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  53610. return $core.withContext(function($ctx2) {
  53611. return "hello ".__comma($recv(x)._asString());
  53612. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  53613. }),(function(){
  53614. return "not present";
  53615. })),"hello nil");
  53616. return self;
  53617. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53618. },
  53619. args: [],
  53620. 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'.",
  53621. referencedClasses: [],
  53622. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  53623. }),
  53624. $globals.JSObjectProxyTest);
  53625. $core.addMethod(
  53626. $core.method({
  53627. selector: "testAtPut",
  53628. protocol: 'tests',
  53629. fn: function (){
  53630. var self=this;
  53631. var testObject;
  53632. return $core.withContext(function($ctx1) {
  53633. var $2,$1;
  53634. testObject=self._jsObject();
  53635. $2=$recv(testObject)._at_("abc");
  53636. $ctx1.sendIdx["at:"]=1;
  53637. $1=$recv($2).__tild_eq("xyz");
  53638. self._assert_($1);
  53639. self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  53640. $ctx1.sendIdx["assert:equals:"]=1;
  53641. self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  53642. return self;
  53643. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  53644. },
  53645. args: [],
  53646. 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'",
  53647. referencedClasses: [],
  53648. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  53649. }),
  53650. $globals.JSObjectProxyTest);
  53651. $core.addMethod(
  53652. $core.method({
  53653. selector: "testComparison",
  53654. protocol: 'tests',
  53655. fn: function (){
  53656. var self=this;
  53657. return $core.withContext(function($ctx1) {
  53658. var $1,$2;
  53659. self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  53660. $1=$recv(console).__eq(console);
  53661. $ctx1.sendIdx["="]=1;
  53662. self._assert_($1);
  53663. $2=$recv(console).__eq($recv($globals.Object)._new());
  53664. $ctx1.sendIdx["="]=2;
  53665. self._deny_($2);
  53666. $ctx1.sendIdx["deny:"]=1;
  53667. self._deny_($recv(console).__eq(self._jsObject()));
  53668. return self;
  53669. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  53670. },
  53671. args: [],
  53672. 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",
  53673. referencedClasses: ["Object"],
  53674. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  53675. }),
  53676. $globals.JSObjectProxyTest);
  53677. $core.addMethod(
  53678. $core.method({
  53679. selector: "testDNU",
  53680. protocol: 'tests',
  53681. fn: function (){
  53682. var self=this;
  53683. return $core.withContext(function($ctx1) {
  53684. self._should_raise_((function(){
  53685. return $core.withContext(function($ctx2) {
  53686. return $recv(self._jsObject())._foo();
  53687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53688. }),$globals.MessageNotUnderstood);
  53689. return self;
  53690. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  53691. },
  53692. args: [],
  53693. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  53694. referencedClasses: ["MessageNotUnderstood"],
  53695. messageSends: ["should:raise:", "foo", "jsObject"]
  53696. }),
  53697. $globals.JSObjectProxyTest);
  53698. $core.addMethod(
  53699. $core.method({
  53700. selector: "testDNURegression1057",
  53701. protocol: 'tests',
  53702. fn: function (){
  53703. var self=this;
  53704. var jsObject;
  53705. return $core.withContext(function($ctx1) {
  53706. var $1;
  53707. jsObject=[];
  53708. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53709. $ctx1.sendIdx["basicAt:put:"]=1;
  53710. $recv(jsObject)._basicAt_put_("foo",(3));
  53711. self._shouldnt_raise_((function(){
  53712. return $core.withContext(function($ctx2) {
  53713. return $recv(jsObject)._foo();
  53714. $ctx2.sendIdx["foo"]=1;
  53715. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53716. }),$globals.Error);
  53717. $ctx1.sendIdx["shouldnt:raise:"]=1;
  53718. $1=$recv(jsObject)._foo();
  53719. $ctx1.sendIdx["foo"]=2;
  53720. self._assert_equals_($1,(3));
  53721. $ctx1.sendIdx["assert:equals:"]=1;
  53722. self._shouldnt_raise_((function(){
  53723. return $core.withContext(function($ctx2) {
  53724. return $recv(jsObject)._foo_((4));
  53725. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53726. }),$globals.Error);
  53727. self._assert_equals_($recv(jsObject)._foo(),(4));
  53728. return self;
  53729. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53730. },
  53731. args: [],
  53732. source: "testDNURegression1057\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'foo' put: 3.\x0a\x09self shouldnt: [ jsObject foo ] raise: Error.\x0a\x09self assert: jsObject foo equals: 3.\x0a\x09self shouldnt: [ jsObject foo: 4 ] raise: Error.\x0a\x09self assert: jsObject foo equals: 4",
  53733. referencedClasses: ["Error"],
  53734. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
  53735. }),
  53736. $globals.JSObjectProxyTest);
  53737. $core.addMethod(
  53738. $core.method({
  53739. selector: "testDNURegression1059",
  53740. protocol: 'tests',
  53741. fn: function (){
  53742. var self=this;
  53743. var jsObject;
  53744. return $core.withContext(function($ctx1) {
  53745. jsObject=[];
  53746. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53747. $ctx1.sendIdx["basicAt:put:"]=1;
  53748. $recv(jsObject)._basicAt_put_("x",(3));
  53749. $ctx1.sendIdx["basicAt:put:"]=2;
  53750. $recv(jsObject)._basicAt_put_("x:",(function(){
  53751. return $core.withContext(function($ctx2) {
  53752. return self._error();
  53753. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53754. }));
  53755. self._shouldnt_raise_((function(){
  53756. return $core.withContext(function($ctx2) {
  53757. return $recv(jsObject)._x_((4));
  53758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53759. }),$globals.Error);
  53760. self._assert_equals_($recv(jsObject)._x(),(4));
  53761. return self;
  53762. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53763. },
  53764. args: [],
  53765. source: "testDNURegression1059\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: 3.\x0a\x09jsObject basicAt: 'x:' put: [ self error ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: jsObject x equals: 4",
  53766. referencedClasses: ["Error"],
  53767. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
  53768. }),
  53769. $globals.JSObjectProxyTest);
  53770. $core.addMethod(
  53771. $core.method({
  53772. selector: "testDNURegression1062",
  53773. protocol: 'tests',
  53774. fn: function (){
  53775. var self=this;
  53776. var jsObject,stored;
  53777. return $core.withContext(function($ctx1) {
  53778. jsObject=[];
  53779. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53780. $ctx1.sendIdx["basicAt:put:"]=1;
  53781. $recv(jsObject)._basicAt_put_("x",(function(v){
  53782. stored=v;
  53783. return stored;
  53784. }));
  53785. self._shouldnt_raise_((function(){
  53786. return $core.withContext(function($ctx2) {
  53787. return $recv(jsObject)._x_((4));
  53788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53789. }),$globals.Error);
  53790. self._assert_equals_(stored,(4));
  53791. return self;
  53792. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)});
  53793. },
  53794. args: [],
  53795. source: "testDNURegression1062\x0a\x09| jsObject stored |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: [ :v | stored := v ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: stored equals: 4",
  53796. referencedClasses: ["Error"],
  53797. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
  53798. }),
  53799. $globals.JSObjectProxyTest);
  53800. $core.addMethod(
  53801. $core.method({
  53802. selector: "testDNUWithAllowJavaScriptCalls",
  53803. protocol: 'tests',
  53804. fn: function (){
  53805. var self=this;
  53806. var jsObject;
  53807. return $core.withContext(function($ctx1) {
  53808. jsObject=[];
  53809. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53810. self._should_raise_((function(){
  53811. return $core.withContext(function($ctx2) {
  53812. return $recv(jsObject)._foo();
  53813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53814. }),$globals.MessageNotUnderstood);
  53815. return self;
  53816. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53817. },
  53818. args: [],
  53819. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  53820. referencedClasses: ["MessageNotUnderstood"],
  53821. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  53822. }),
  53823. $globals.JSObjectProxyTest);
  53824. $core.addMethod(
  53825. $core.method({
  53826. selector: "testMessageSend",
  53827. protocol: 'tests',
  53828. fn: function (){
  53829. var self=this;
  53830. return $core.withContext(function($ctx1) {
  53831. var $2,$1,$4,$3;
  53832. $2=self._jsObject();
  53833. $ctx1.sendIdx["jsObject"]=1;
  53834. $1=$recv($2)._a();
  53835. self._assert_equals_($1,(1));
  53836. $ctx1.sendIdx["assert:equals:"]=1;
  53837. $4=self._jsObject();
  53838. $ctx1.sendIdx["jsObject"]=2;
  53839. $3=$recv($4)._b();
  53840. self._assert_equals_($3,(2));
  53841. $ctx1.sendIdx["assert:equals:"]=2;
  53842. self._assert_equals_($recv(self._jsObject())._c_((3)),(3));
  53843. return self;
  53844. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  53845. },
  53846. args: [],
  53847. 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",
  53848. referencedClasses: [],
  53849. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  53850. }),
  53851. $globals.JSObjectProxyTest);
  53852. $core.addMethod(
  53853. $core.method({
  53854. selector: "testMethodWithArguments",
  53855. protocol: 'tests',
  53856. fn: function (){
  53857. var self=this;
  53858. return $core.withContext(function($ctx1) {
  53859. self._assert_equals_($recv(self._jsObject())._c_((1)),(1));
  53860. return self;
  53861. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  53862. },
  53863. args: [],
  53864. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  53865. referencedClasses: [],
  53866. messageSends: ["assert:equals:", "c:", "jsObject"]
  53867. }),
  53868. $globals.JSObjectProxyTest);
  53869. $core.addMethod(
  53870. $core.method({
  53871. selector: "testPrinting",
  53872. protocol: 'tests',
  53873. fn: function (){
  53874. var self=this;
  53875. return $core.withContext(function($ctx1) {
  53876. self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]");
  53877. return self;
  53878. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  53879. },
  53880. args: [],
  53881. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  53882. referencedClasses: [],
  53883. messageSends: ["assert:equals:", "printString", "jsObject"]
  53884. }),
  53885. $globals.JSObjectProxyTest);
  53886. $core.addMethod(
  53887. $core.method({
  53888. selector: "testPropertyThatReturnsEmptyString",
  53889. protocol: 'tests',
  53890. fn: function (){
  53891. var self=this;
  53892. var object;
  53893. return $core.withContext(function($ctx1) {
  53894. var $1;
  53895. object=self._jsObject();
  53896. $1=$recv(object)._d();
  53897. $ctx1.sendIdx["d"]=1;
  53898. self._assert_equals_($1,"");
  53899. $ctx1.sendIdx["assert:equals:"]=1;
  53900. $recv(object)._d_("hello");
  53901. self._assert_equals_($recv(object)._d(),"hello");
  53902. return self;
  53903. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  53904. },
  53905. args: [],
  53906. 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'",
  53907. referencedClasses: [],
  53908. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  53909. }),
  53910. $globals.JSObjectProxyTest);
  53911. $core.addMethod(
  53912. $core.method({
  53913. selector: "testPropertyThatReturnsUndefined",
  53914. protocol: 'tests',
  53915. fn: function (){
  53916. var self=this;
  53917. var object;
  53918. return $core.withContext(function($ctx1) {
  53919. object=self._jsObject();
  53920. self._shouldnt_raise_((function(){
  53921. return $core.withContext(function($ctx2) {
  53922. return $recv(object)._e();
  53923. $ctx2.sendIdx["e"]=1;
  53924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53925. }),$globals.MessageNotUnderstood);
  53926. self._assert_($recv($recv(object)._e())._isNil());
  53927. return self;
  53928. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  53929. },
  53930. args: [],
  53931. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  53932. referencedClasses: ["MessageNotUnderstood"],
  53933. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  53934. }),
  53935. $globals.JSObjectProxyTest);
  53936. $core.addMethod(
  53937. $core.method({
  53938. selector: "testSetPropertyWithFalsyValue",
  53939. protocol: 'tests',
  53940. fn: function (){
  53941. var self=this;
  53942. var jsObject;
  53943. return $core.withContext(function($ctx1) {
  53944. var $1,$2,$3,$4,$5;
  53945. jsObject=self._jsObject();
  53946. $1=$recv(jsObject)._a();
  53947. $ctx1.sendIdx["a"]=1;
  53948. self._assert_equals_($1,(1));
  53949. $ctx1.sendIdx["assert:equals:"]=1;
  53950. $recv(jsObject)._a_(self._jsNull());
  53951. $ctx1.sendIdx["a:"]=1;
  53952. $2=$recv(jsObject)._a();
  53953. $ctx1.sendIdx["a"]=2;
  53954. self._assert_equals_($2,nil);
  53955. $ctx1.sendIdx["assert:equals:"]=2;
  53956. $recv(jsObject)._a_((0));
  53957. $ctx1.sendIdx["a:"]=2;
  53958. $3=$recv(jsObject)._a();
  53959. $ctx1.sendIdx["a"]=3;
  53960. self._assert_equals_($3,(0));
  53961. $ctx1.sendIdx["assert:equals:"]=3;
  53962. $recv(jsObject)._a_(self._jsUndefined());
  53963. $ctx1.sendIdx["a:"]=3;
  53964. $4=$recv(jsObject)._a();
  53965. $ctx1.sendIdx["a"]=4;
  53966. self._assert_equals_($4,nil);
  53967. $ctx1.sendIdx["assert:equals:"]=4;
  53968. $recv(jsObject)._a_("");
  53969. $ctx1.sendIdx["a:"]=4;
  53970. $5=$recv(jsObject)._a();
  53971. $ctx1.sendIdx["a"]=5;
  53972. self._assert_equals_($5,"");
  53973. $ctx1.sendIdx["assert:equals:"]=5;
  53974. $recv(jsObject)._a_(false);
  53975. self._assert_equals_($recv(jsObject)._a(),false);
  53976. return self;
  53977. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53978. },
  53979. args: [],
  53980. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  53981. referencedClasses: [],
  53982. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  53983. }),
  53984. $globals.JSObjectProxyTest);
  53985. $core.addMethod(
  53986. $core.method({
  53987. selector: "testValue",
  53988. protocol: 'tests',
  53989. fn: function (){
  53990. var self=this;
  53991. var testObject;
  53992. return $core.withContext(function($ctx1) {
  53993. testObject=self._jsObject();
  53994. $recv(testObject)._at_put_("value","aValue");
  53995. self._assert_equals_($recv(testObject)._value(),"aValue");
  53996. return self;
  53997. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  53998. },
  53999. args: [],
  54000. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  54001. referencedClasses: [],
  54002. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  54003. }),
  54004. $globals.JSObjectProxyTest);
  54005. $core.addMethod(
  54006. $core.method({
  54007. selector: "testYourself",
  54008. protocol: 'tests',
  54009. fn: function (){
  54010. var self=this;
  54011. var object;
  54012. return $core.withContext(function($ctx1) {
  54013. var $1;
  54014. $1=self._jsObject();
  54015. $recv($1)._d_("test");
  54016. object=$recv($1)._yourself();
  54017. self._assert_equals_($recv(object)._d(),"test");
  54018. return self;
  54019. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  54020. },
  54021. args: [],
  54022. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  54023. referencedClasses: [],
  54024. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  54025. }),
  54026. $globals.JSObjectProxyTest);
  54027. $core.addClass('JavaScriptExceptionTest', $globals.TestCase, [], 'Kernel-Tests');
  54028. $core.addMethod(
  54029. $core.method({
  54030. selector: "testCatchingException",
  54031. protocol: 'tests',
  54032. fn: function (){
  54033. var self=this;
  54034. return $core.withContext(function($ctx1) {
  54035. $recv((function(){
  54036. return $core.withContext(function($ctx2) {
  54037. return self._throwException();
  54038. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54039. }))._on_do_($globals.Error,(function(error){
  54040. return $core.withContext(function($ctx2) {
  54041. return self._assert_($recv($recv(error)._exception()).__eq("test"));
  54042. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  54043. }));
  54044. return self;
  54045. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  54046. },
  54047. args: [],
  54048. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  54049. referencedClasses: ["Error"],
  54050. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  54051. }),
  54052. $globals.JavaScriptExceptionTest);
  54053. $core.addMethod(
  54054. $core.method({
  54055. selector: "testRaisingException",
  54056. protocol: 'tests',
  54057. fn: function (){
  54058. var self=this;
  54059. return $core.withContext(function($ctx1) {
  54060. self._should_raise_((function(){
  54061. return $core.withContext(function($ctx2) {
  54062. return self._throwException();
  54063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54064. }),$globals.JavaScriptException);
  54065. return self;
  54066. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  54067. },
  54068. args: [],
  54069. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  54070. referencedClasses: ["JavaScriptException"],
  54071. messageSends: ["should:raise:", "throwException"]
  54072. }),
  54073. $globals.JavaScriptExceptionTest);
  54074. $core.addMethod(
  54075. $core.method({
  54076. selector: "throwException",
  54077. protocol: 'helpers',
  54078. fn: function (){
  54079. var self=this;
  54080. return $core.withContext(function($ctx1) {
  54081. throw "test";
  54082. return self;
  54083. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  54084. },
  54085. args: [],
  54086. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  54087. referencedClasses: [],
  54088. messageSends: []
  54089. }),
  54090. $globals.JavaScriptExceptionTest);
  54091. $core.addClass('MessageSendTest', $globals.TestCase, [], 'Kernel-Tests');
  54092. $core.addMethod(
  54093. $core.method({
  54094. selector: "testValue",
  54095. protocol: 'tests',
  54096. fn: function (){
  54097. var self=this;
  54098. var messageSend;
  54099. return $core.withContext(function($ctx1) {
  54100. var $1;
  54101. $1=$recv($globals.MessageSend)._new();
  54102. $ctx1.sendIdx["new"]=1;
  54103. $recv($1)._receiver_($recv($globals.Object)._new());
  54104. $recv($1)._selector_("asString");
  54105. messageSend=$recv($1)._yourself();
  54106. self._assert_equals_($recv(messageSend)._value(),"an Object");
  54107. return self;
  54108. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  54109. },
  54110. args: [],
  54111. 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'",
  54112. referencedClasses: ["MessageSend", "Object"],
  54113. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  54114. }),
  54115. $globals.MessageSendTest);
  54116. $core.addMethod(
  54117. $core.method({
  54118. selector: "testValueWithArguments",
  54119. protocol: 'tests',
  54120. fn: function (){
  54121. var self=this;
  54122. var messageSend;
  54123. return $core.withContext(function($ctx1) {
  54124. var $1;
  54125. $1=$recv($globals.MessageSend)._new();
  54126. $recv($1)._receiver_((2));
  54127. $recv($1)._selector_("+");
  54128. messageSend=$recv($1)._yourself();
  54129. self._assert_equals_($recv(messageSend)._value_((3)),(5));
  54130. $ctx1.sendIdx["assert:equals:"]=1;
  54131. self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  54132. return self;
  54133. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  54134. },
  54135. args: [],
  54136. 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",
  54137. referencedClasses: ["MessageSend"],
  54138. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  54139. }),
  54140. $globals.MessageSendTest);
  54141. $core.addClass('MethodInheritanceTest', $globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  54142. $core.addMethod(
  54143. $core.method({
  54144. selector: "codeGeneratorClass",
  54145. protocol: 'accessing',
  54146. fn: function (){
  54147. var self=this;
  54148. return $globals.CodeGenerator;
  54149. },
  54150. args: [],
  54151. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  54152. referencedClasses: ["CodeGenerator"],
  54153. messageSends: []
  54154. }),
  54155. $globals.MethodInheritanceTest);
  54156. $core.addMethod(
  54157. $core.method({
  54158. selector: "compiler",
  54159. protocol: 'factory',
  54160. fn: function (){
  54161. var self=this;
  54162. return $core.withContext(function($ctx1) {
  54163. var $1;
  54164. $1=$recv($globals.Compiler)._new();
  54165. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  54166. return $recv($1)._yourself();
  54167. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  54168. },
  54169. args: [],
  54170. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  54171. referencedClasses: ["Compiler"],
  54172. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  54173. }),
  54174. $globals.MethodInheritanceTest);
  54175. $core.addMethod(
  54176. $core.method({
  54177. selector: "deinstallBottom",
  54178. protocol: 'testing',
  54179. fn: function (){
  54180. var self=this;
  54181. return $core.withContext(function($ctx1) {
  54182. $recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  54183. return self;
  54184. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  54185. },
  54186. args: [],
  54187. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  54188. referencedClasses: [],
  54189. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  54190. }),
  54191. $globals.MethodInheritanceTest);
  54192. $core.addMethod(
  54193. $core.method({
  54194. selector: "deinstallMiddle",
  54195. protocol: 'testing',
  54196. fn: function (){
  54197. var self=this;
  54198. return $core.withContext(function($ctx1) {
  54199. $recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  54200. return self;
  54201. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  54202. },
  54203. args: [],
  54204. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  54205. referencedClasses: [],
  54206. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  54207. }),
  54208. $globals.MethodInheritanceTest);
  54209. $core.addMethod(
  54210. $core.method({
  54211. selector: "deinstallTop",
  54212. protocol: 'testing',
  54213. fn: function (){
  54214. var self=this;
  54215. return $core.withContext(function($ctx1) {
  54216. $recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  54217. return self;
  54218. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  54219. },
  54220. args: [],
  54221. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  54222. referencedClasses: [],
  54223. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  54224. }),
  54225. $globals.MethodInheritanceTest);
  54226. $core.addMethod(
  54227. $core.method({
  54228. selector: "installBottom:",
  54229. protocol: 'testing',
  54230. fn: function (aString){
  54231. var self=this;
  54232. return $core.withContext(function($ctx1) {
  54233. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  54234. return self;
  54235. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  54236. },
  54237. args: ["aString"],
  54238. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  54239. referencedClasses: [],
  54240. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  54241. }),
  54242. $globals.MethodInheritanceTest);
  54243. $core.addMethod(
  54244. $core.method({
  54245. selector: "installMiddle:",
  54246. protocol: 'testing',
  54247. fn: function (aString){
  54248. var self=this;
  54249. return $core.withContext(function($ctx1) {
  54250. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  54251. return self;
  54252. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  54253. },
  54254. args: ["aString"],
  54255. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  54256. referencedClasses: [],
  54257. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  54258. }),
  54259. $globals.MethodInheritanceTest);
  54260. $core.addMethod(
  54261. $core.method({
  54262. selector: "installTop:",
  54263. protocol: 'testing',
  54264. fn: function (aString){
  54265. var self=this;
  54266. return $core.withContext(function($ctx1) {
  54267. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  54268. return self;
  54269. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  54270. },
  54271. args: ["aString"],
  54272. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  54273. referencedClasses: [],
  54274. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  54275. }),
  54276. $globals.MethodInheritanceTest);
  54277. $core.addMethod(
  54278. $core.method({
  54279. selector: "setUp",
  54280. protocol: 'initialization',
  54281. fn: function (){
  54282. var self=this;
  54283. return $core.withContext(function($ctx1) {
  54284. self["@receiverTop"]=$recv(self._targetClassTop())._new();
  54285. $ctx1.sendIdx["new"]=1;
  54286. self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new();
  54287. $ctx1.sendIdx["new"]=2;
  54288. self["@receiverBottom"]=$recv(self._targetClassBottom())._new();
  54289. self["@method"]=nil;
  54290. self["@performBlock"]=(function(){
  54291. return $core.withContext(function($ctx2) {
  54292. return self._error_("performBlock not initialized");
  54293. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54294. });
  54295. return self;
  54296. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  54297. },
  54298. args: [],
  54299. 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' ]",
  54300. referencedClasses: [],
  54301. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  54302. }),
  54303. $globals.MethodInheritanceTest);
  54304. $core.addMethod(
  54305. $core.method({
  54306. selector: "shouldMNU",
  54307. protocol: 'testing',
  54308. fn: function (){
  54309. var self=this;
  54310. return $core.withContext(function($ctx1) {
  54311. self._shouldMNUTop();
  54312. self._shouldMNUMiddle();
  54313. self._shouldMNUBottom();
  54314. return self;
  54315. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  54316. },
  54317. args: [],
  54318. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  54319. referencedClasses: [],
  54320. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  54321. }),
  54322. $globals.MethodInheritanceTest);
  54323. $core.addMethod(
  54324. $core.method({
  54325. selector: "shouldMNUBottom",
  54326. protocol: 'testing',
  54327. fn: function (){
  54328. var self=this;
  54329. return $core.withContext(function($ctx1) {
  54330. self._should_raise_((function(){
  54331. return $core.withContext(function($ctx2) {
  54332. return $recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54334. }),$globals.MessageNotUnderstood);
  54335. return self;
  54336. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  54337. },
  54338. args: [],
  54339. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  54340. referencedClasses: ["MessageNotUnderstood"],
  54341. messageSends: ["should:raise:", "value:"]
  54342. }),
  54343. $globals.MethodInheritanceTest);
  54344. $core.addMethod(
  54345. $core.method({
  54346. selector: "shouldMNUMiddle",
  54347. protocol: 'testing',
  54348. fn: function (){
  54349. var self=this;
  54350. return $core.withContext(function($ctx1) {
  54351. self._should_raise_((function(){
  54352. return $core.withContext(function($ctx2) {
  54353. return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54355. }),$globals.MessageNotUnderstood);
  54356. return self;
  54357. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  54358. },
  54359. args: [],
  54360. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  54361. referencedClasses: ["MessageNotUnderstood"],
  54362. messageSends: ["should:raise:", "value:"]
  54363. }),
  54364. $globals.MethodInheritanceTest);
  54365. $core.addMethod(
  54366. $core.method({
  54367. selector: "shouldMNUTop",
  54368. protocol: 'testing',
  54369. fn: function (){
  54370. var self=this;
  54371. return $core.withContext(function($ctx1) {
  54372. self._should_raise_((function(){
  54373. return $core.withContext(function($ctx2) {
  54374. return $recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54376. }),$globals.MessageNotUnderstood);
  54377. return self;
  54378. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  54379. },
  54380. args: [],
  54381. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  54382. referencedClasses: ["MessageNotUnderstood"],
  54383. messageSends: ["should:raise:", "value:"]
  54384. }),
  54385. $globals.MethodInheritanceTest);
  54386. $core.addMethod(
  54387. $core.method({
  54388. selector: "shouldReturn:",
  54389. protocol: 'testing',
  54390. fn: function (anObject){
  54391. var self=this;
  54392. var result;
  54393. return $core.withContext(function($ctx1) {
  54394. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54395. $ctx1.sendIdx["value:"]=1;
  54396. self._assert_equals_(["top",anObject],["top",result]);
  54397. $ctx1.sendIdx["assert:equals:"]=1;
  54398. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54399. $ctx1.sendIdx["value:"]=2;
  54400. self._assert_equals_(["middle",anObject],["middle",result]);
  54401. $ctx1.sendIdx["assert:equals:"]=2;
  54402. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54403. self._assert_equals_(["bottom",anObject],["bottom",result]);
  54404. return self;
  54405. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  54406. },
  54407. args: ["anObject"],
  54408. 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 }",
  54409. referencedClasses: [],
  54410. messageSends: ["value:", "assert:equals:"]
  54411. }),
  54412. $globals.MethodInheritanceTest);
  54413. $core.addMethod(
  54414. $core.method({
  54415. selector: "shouldReturn:and:and:",
  54416. protocol: 'testing',
  54417. fn: function (anObject,anObject2,anObject3){
  54418. var self=this;
  54419. var result;
  54420. return $core.withContext(function($ctx1) {
  54421. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54422. $ctx1.sendIdx["value:"]=1;
  54423. self._assert_equals_(["top",anObject],["top",result]);
  54424. $ctx1.sendIdx["assert:equals:"]=1;
  54425. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54426. $ctx1.sendIdx["value:"]=2;
  54427. self._assert_equals_(["middle",anObject2],["middle",result]);
  54428. $ctx1.sendIdx["assert:equals:"]=2;
  54429. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54430. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  54431. return self;
  54432. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  54433. },
  54434. args: ["anObject", "anObject2", "anObject3"],
  54435. 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 }",
  54436. referencedClasses: [],
  54437. messageSends: ["value:", "assert:equals:"]
  54438. }),
  54439. $globals.MethodInheritanceTest);
  54440. $core.addMethod(
  54441. $core.method({
  54442. selector: "targetClassBottom",
  54443. protocol: 'accessing',
  54444. fn: function (){
  54445. var self=this;
  54446. return $globals.JavaScriptException;
  54447. },
  54448. args: [],
  54449. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  54450. referencedClasses: ["JavaScriptException"],
  54451. messageSends: []
  54452. }),
  54453. $globals.MethodInheritanceTest);
  54454. $core.addMethod(
  54455. $core.method({
  54456. selector: "targetClassMiddle",
  54457. protocol: 'accessing',
  54458. fn: function (){
  54459. var self=this;
  54460. return $globals.Error;
  54461. },
  54462. args: [],
  54463. source: "targetClassMiddle\x0a\x09^ Error",
  54464. referencedClasses: ["Error"],
  54465. messageSends: []
  54466. }),
  54467. $globals.MethodInheritanceTest);
  54468. $core.addMethod(
  54469. $core.method({
  54470. selector: "targetClassTop",
  54471. protocol: 'accessing',
  54472. fn: function (){
  54473. var self=this;
  54474. return $globals.Object;
  54475. },
  54476. args: [],
  54477. source: "targetClassTop\x0a\x09^ Object",
  54478. referencedClasses: ["Object"],
  54479. messageSends: []
  54480. }),
  54481. $globals.MethodInheritanceTest);
  54482. $core.addMethod(
  54483. $core.method({
  54484. selector: "tearDown",
  54485. protocol: 'initialization',
  54486. fn: function (){
  54487. var self=this;
  54488. return $core.withContext(function($ctx1) {
  54489. $recv((function(){
  54490. return $core.withContext(function($ctx2) {
  54491. return self._deinstallTop();
  54492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54493. }))._on_do_($globals.Error,(function(){
  54494. }));
  54495. $ctx1.sendIdx["on:do:"]=1;
  54496. $recv((function(){
  54497. return $core.withContext(function($ctx2) {
  54498. return self._deinstallMiddle();
  54499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  54500. }))._on_do_($globals.Error,(function(){
  54501. }));
  54502. $ctx1.sendIdx["on:do:"]=2;
  54503. $recv((function(){
  54504. return $core.withContext(function($ctx2) {
  54505. return self._deinstallBottom();
  54506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54507. }))._on_do_($globals.Error,(function(){
  54508. }));
  54509. return self;
  54510. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  54511. },
  54512. args: [],
  54513. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  54514. referencedClasses: ["Error"],
  54515. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  54516. }),
  54517. $globals.MethodInheritanceTest);
  54518. $core.addMethod(
  54519. $core.method({
  54520. selector: "testMNU11",
  54521. protocol: 'tests',
  54522. fn: function (){
  54523. var self=this;
  54524. return $core.withContext(function($ctx1) {
  54525. self["@performBlock"]=(function(x){
  54526. return $core.withContext(function($ctx2) {
  54527. return $recv(x)._foo();
  54528. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54529. });
  54530. self._shouldMNU();
  54531. $ctx1.sendIdx["shouldMNU"]=1;
  54532. self._installTop_("foo ^ false");
  54533. $ctx1.sendIdx["installTop:"]=1;
  54534. self._installTop_("foo ^ true");
  54535. self._deinstallTop();
  54536. self._shouldMNU();
  54537. return self;
  54538. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  54539. },
  54540. args: [],
  54541. 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",
  54542. referencedClasses: [],
  54543. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  54544. }),
  54545. $globals.MethodInheritanceTest);
  54546. $core.addMethod(
  54547. $core.method({
  54548. selector: "testMNU22",
  54549. protocol: 'tests',
  54550. fn: function (){
  54551. var self=this;
  54552. return $core.withContext(function($ctx1) {
  54553. self["@performBlock"]=(function(x){
  54554. return $core.withContext(function($ctx2) {
  54555. return $recv(x)._foo();
  54556. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54557. });
  54558. self._shouldMNU();
  54559. $ctx1.sendIdx["shouldMNU"]=1;
  54560. self._installMiddle_("foo ^ false");
  54561. $ctx1.sendIdx["installMiddle:"]=1;
  54562. self._installMiddle_("foo ^ true");
  54563. self._deinstallMiddle();
  54564. self._shouldMNU();
  54565. return self;
  54566. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  54567. },
  54568. args: [],
  54569. 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",
  54570. referencedClasses: [],
  54571. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  54572. }),
  54573. $globals.MethodInheritanceTest);
  54574. $core.addMethod(
  54575. $core.method({
  54576. selector: "testReturns1",
  54577. protocol: 'tests',
  54578. fn: function (){
  54579. var self=this;
  54580. return $core.withContext(function($ctx1) {
  54581. self["@performBlock"]=(function(x){
  54582. return $core.withContext(function($ctx2) {
  54583. return $recv(x)._foo();
  54584. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54585. });
  54586. self._installTop_("foo ^ false");
  54587. $ctx1.sendIdx["installTop:"]=1;
  54588. self._shouldReturn_(false);
  54589. $ctx1.sendIdx["shouldReturn:"]=1;
  54590. self._installTop_("foo ^ true");
  54591. self._shouldReturn_(true);
  54592. return self;
  54593. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  54594. },
  54595. args: [],
  54596. 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",
  54597. referencedClasses: [],
  54598. messageSends: ["foo", "installTop:", "shouldReturn:"]
  54599. }),
  54600. $globals.MethodInheritanceTest);
  54601. $core.addClass('NumberTest', $globals.TestCase, [], 'Kernel-Tests');
  54602. $core.addMethod(
  54603. $core.method({
  54604. selector: "testAbs",
  54605. protocol: 'tests',
  54606. fn: function (){
  54607. var self=this;
  54608. return $core.withContext(function($ctx1) {
  54609. var $1;
  54610. $1=(4)._abs();
  54611. $ctx1.sendIdx["abs"]=1;
  54612. self._assert_equals_($1,(4));
  54613. $ctx1.sendIdx["assert:equals:"]=1;
  54614. self._assert_equals_((-4)._abs(),(4));
  54615. return self;
  54616. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  54617. },
  54618. args: [],
  54619. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  54620. referencedClasses: [],
  54621. messageSends: ["assert:equals:", "abs"]
  54622. }),
  54623. $globals.NumberTest);
  54624. $core.addMethod(
  54625. $core.method({
  54626. selector: "testArithmetic",
  54627. protocol: 'tests',
  54628. fn: function (){
  54629. var self=this;
  54630. return $core.withContext(function($ctx1) {
  54631. var $1,$2,$3,$5,$4;
  54632. $1=(1.5).__plus((1));
  54633. $ctx1.sendIdx["+"]=1;
  54634. self._assert_equals_($1,(2.5));
  54635. $ctx1.sendIdx["assert:equals:"]=1;
  54636. $2=(2).__minus((1));
  54637. $ctx1.sendIdx["-"]=1;
  54638. self._assert_equals_($2,(1));
  54639. $ctx1.sendIdx["assert:equals:"]=2;
  54640. self._assert_equals_((-2).__minus((1)),(-3));
  54641. $ctx1.sendIdx["assert:equals:"]=3;
  54642. self._assert_equals_((12).__slash((2)),(6));
  54643. $ctx1.sendIdx["assert:equals:"]=4;
  54644. $3=(3).__star((4));
  54645. $ctx1.sendIdx["*"]=1;
  54646. self._assert_equals_($3,(12));
  54647. $ctx1.sendIdx["assert:equals:"]=5;
  54648. self._assert_equals_((7).__slash_slash((2)),(3));
  54649. $ctx1.sendIdx["assert:equals:"]=6;
  54650. self._assert_equals_((7).__backslash_backslash((2)),(1));
  54651. $ctx1.sendIdx["assert:equals:"]=7;
  54652. $5=(1).__plus((2));
  54653. $ctx1.sendIdx["+"]=2;
  54654. $4=$recv($5).__star((3));
  54655. $ctx1.sendIdx["*"]=2;
  54656. self._assert_equals_($4,(9));
  54657. $ctx1.sendIdx["assert:equals:"]=8;
  54658. self._assert_equals_((1).__plus((2).__star((3))),(7));
  54659. return self;
  54660. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  54661. },
  54662. args: [],
  54663. 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",
  54664. referencedClasses: [],
  54665. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  54666. }),
  54667. $globals.NumberTest);
  54668. $core.addMethod(
  54669. $core.method({
  54670. selector: "testAsNumber",
  54671. protocol: 'tests',
  54672. fn: function (){
  54673. var self=this;
  54674. return $core.withContext(function($ctx1) {
  54675. self._assert_equals_((3)._asNumber(),(3));
  54676. return self;
  54677. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  54678. },
  54679. args: [],
  54680. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  54681. referencedClasses: [],
  54682. messageSends: ["assert:equals:", "asNumber"]
  54683. }),
  54684. $globals.NumberTest);
  54685. $core.addMethod(
  54686. $core.method({
  54687. selector: "testCeiling",
  54688. protocol: 'tests',
  54689. fn: function (){
  54690. var self=this;
  54691. return $core.withContext(function($ctx1) {
  54692. var $1,$2;
  54693. $1=(1.2)._ceiling();
  54694. $ctx1.sendIdx["ceiling"]=1;
  54695. self._assert_equals_($1,(2));
  54696. $ctx1.sendIdx["assert:equals:"]=1;
  54697. $2=(-1.2)._ceiling();
  54698. $ctx1.sendIdx["ceiling"]=2;
  54699. self._assert_equals_($2,(-1));
  54700. $ctx1.sendIdx["assert:equals:"]=2;
  54701. self._assert_equals_((1)._ceiling(),(1));
  54702. return self;
  54703. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  54704. },
  54705. args: [],
  54706. 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.",
  54707. referencedClasses: [],
  54708. messageSends: ["assert:equals:", "ceiling"]
  54709. }),
  54710. $globals.NumberTest);
  54711. $core.addMethod(
  54712. $core.method({
  54713. selector: "testComparison",
  54714. protocol: 'tests',
  54715. fn: function (){
  54716. var self=this;
  54717. return $core.withContext(function($ctx1) {
  54718. var $1,$2,$3,$4;
  54719. $1=(3).__gt((2));
  54720. $ctx1.sendIdx[">"]=1;
  54721. self._assert_($1);
  54722. $ctx1.sendIdx["assert:"]=1;
  54723. $2=(2).__lt((3));
  54724. $ctx1.sendIdx["<"]=1;
  54725. self._assert_($2);
  54726. $ctx1.sendIdx["assert:"]=2;
  54727. self._deny_((3).__lt((2)));
  54728. $ctx1.sendIdx["deny:"]=1;
  54729. self._deny_((2).__gt((3)));
  54730. $3=(3).__gt_eq((3));
  54731. $ctx1.sendIdx[">="]=1;
  54732. self._assert_($3);
  54733. $ctx1.sendIdx["assert:"]=3;
  54734. self._assert_((3.1).__gt_eq((3)));
  54735. $ctx1.sendIdx["assert:"]=4;
  54736. $4=(3).__lt_eq((3));
  54737. $ctx1.sendIdx["<="]=1;
  54738. self._assert_($4);
  54739. $ctx1.sendIdx["assert:"]=5;
  54740. self._assert_((3).__lt_eq((3.1)));
  54741. return self;
  54742. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  54743. },
  54744. args: [],
  54745. 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",
  54746. referencedClasses: [],
  54747. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  54748. }),
  54749. $globals.NumberTest);
  54750. $core.addMethod(
  54751. $core.method({
  54752. selector: "testCopying",
  54753. protocol: 'tests',
  54754. fn: function (){
  54755. var self=this;
  54756. return $core.withContext(function($ctx1) {
  54757. var $1;
  54758. $1=$recv((1)._copy()).__eq_eq((1));
  54759. $ctx1.sendIdx["=="]=1;
  54760. self._assert_($1);
  54761. $ctx1.sendIdx["assert:"]=1;
  54762. self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  54763. return self;
  54764. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  54765. },
  54766. args: [],
  54767. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  54768. referencedClasses: [],
  54769. messageSends: ["assert:", "==", "copy", "deepCopy"]
  54770. }),
  54771. $globals.NumberTest);
  54772. $core.addMethod(
  54773. $core.method({
  54774. selector: "testEquality",
  54775. protocol: 'tests',
  54776. fn: function (){
  54777. var self=this;
  54778. return $core.withContext(function($ctx1) {
  54779. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  54780. $1=(1).__eq((1));
  54781. $ctx1.sendIdx["="]=1;
  54782. self._assert_($1);
  54783. $ctx1.sendIdx["assert:"]=1;
  54784. $2=(0).__eq((0));
  54785. $ctx1.sendIdx["="]=2;
  54786. self._assert_($2);
  54787. $ctx1.sendIdx["assert:"]=2;
  54788. $3=(1).__eq((0));
  54789. $ctx1.sendIdx["="]=3;
  54790. self._deny_($3);
  54791. $ctx1.sendIdx["deny:"]=1;
  54792. $5=(1)._yourself();
  54793. $ctx1.sendIdx["yourself"]=1;
  54794. $4=$recv($5).__eq((1));
  54795. $ctx1.sendIdx["="]=4;
  54796. self._assert_($4);
  54797. $ctx1.sendIdx["assert:"]=3;
  54798. $7=(1)._yourself();
  54799. $ctx1.sendIdx["yourself"]=2;
  54800. $6=(1).__eq($7);
  54801. $ctx1.sendIdx["="]=5;
  54802. self._assert_($6);
  54803. $ctx1.sendIdx["assert:"]=4;
  54804. $9=(1)._yourself();
  54805. $ctx1.sendIdx["yourself"]=3;
  54806. $8=$recv($9).__eq((1)._yourself());
  54807. $ctx1.sendIdx["="]=6;
  54808. self._assert_($8);
  54809. $10=(0).__eq(false);
  54810. $ctx1.sendIdx["="]=7;
  54811. self._deny_($10);
  54812. $ctx1.sendIdx["deny:"]=2;
  54813. $11=false.__eq((0));
  54814. $ctx1.sendIdx["="]=8;
  54815. self._deny_($11);
  54816. $ctx1.sendIdx["deny:"]=3;
  54817. $12="".__eq((0));
  54818. $ctx1.sendIdx["="]=9;
  54819. self._deny_($12);
  54820. $ctx1.sendIdx["deny:"]=4;
  54821. self._deny_((0).__eq(""));
  54822. return self;
  54823. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  54824. },
  54825. args: [],
  54826. 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 = ''",
  54827. referencedClasses: [],
  54828. messageSends: ["assert:", "=", "deny:", "yourself"]
  54829. }),
  54830. $globals.NumberTest);
  54831. $core.addMethod(
  54832. $core.method({
  54833. selector: "testFloor",
  54834. protocol: 'tests',
  54835. fn: function (){
  54836. var self=this;
  54837. return $core.withContext(function($ctx1) {
  54838. var $1,$2;
  54839. $1=(1.2)._floor();
  54840. $ctx1.sendIdx["floor"]=1;
  54841. self._assert_equals_($1,(1));
  54842. $ctx1.sendIdx["assert:equals:"]=1;
  54843. $2=(-1.2)._floor();
  54844. $ctx1.sendIdx["floor"]=2;
  54845. self._assert_equals_($2,(-2));
  54846. $ctx1.sendIdx["assert:equals:"]=2;
  54847. self._assert_equals_((1)._floor(),(1));
  54848. return self;
  54849. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  54850. },
  54851. args: [],
  54852. 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.",
  54853. referencedClasses: [],
  54854. messageSends: ["assert:equals:", "floor"]
  54855. }),
  54856. $globals.NumberTest);
  54857. $core.addMethod(
  54858. $core.method({
  54859. selector: "testHexNumbers",
  54860. protocol: 'tests',
  54861. fn: function (){
  54862. var self=this;
  54863. return $core.withContext(function($ctx1) {
  54864. var $1,$2,$3,$4,$5;
  54865. self._assert_equals_((9),(9));
  54866. $ctx1.sendIdx["assert:equals:"]=1;
  54867. $1=(10)._truncated();
  54868. $ctx1.sendIdx["truncated"]=1;
  54869. self._assert_equals_($1,(10));
  54870. $ctx1.sendIdx["assert:equals:"]=2;
  54871. $2=(11)._truncated();
  54872. $ctx1.sendIdx["truncated"]=2;
  54873. self._assert_equals_($2,(11));
  54874. $ctx1.sendIdx["assert:equals:"]=3;
  54875. $3=(12)._truncated();
  54876. $ctx1.sendIdx["truncated"]=3;
  54877. self._assert_equals_($3,(12));
  54878. $ctx1.sendIdx["assert:equals:"]=4;
  54879. $4=(13)._truncated();
  54880. $ctx1.sendIdx["truncated"]=4;
  54881. self._assert_equals_($4,(13));
  54882. $ctx1.sendIdx["assert:equals:"]=5;
  54883. $5=(14)._truncated();
  54884. $ctx1.sendIdx["truncated"]=5;
  54885. self._assert_equals_($5,(14));
  54886. $ctx1.sendIdx["assert:equals:"]=6;
  54887. self._assert_equals_((15)._truncated(),(15));
  54888. return self;
  54889. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  54890. },
  54891. args: [],
  54892. 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",
  54893. referencedClasses: [],
  54894. messageSends: ["assert:equals:", "truncated"]
  54895. }),
  54896. $globals.NumberTest);
  54897. $core.addMethod(
  54898. $core.method({
  54899. selector: "testIdentity",
  54900. protocol: 'tests',
  54901. fn: function (){
  54902. var self=this;
  54903. return $core.withContext(function($ctx1) {
  54904. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  54905. $1=(1).__eq_eq((1));
  54906. $ctx1.sendIdx["=="]=1;
  54907. self._assert_($1);
  54908. $ctx1.sendIdx["assert:"]=1;
  54909. $2=(0).__eq_eq((0));
  54910. $ctx1.sendIdx["=="]=2;
  54911. self._assert_($2);
  54912. $ctx1.sendIdx["assert:"]=2;
  54913. $3=(1).__eq_eq((0));
  54914. $ctx1.sendIdx["=="]=3;
  54915. self._deny_($3);
  54916. $ctx1.sendIdx["deny:"]=1;
  54917. $5=(1)._yourself();
  54918. $ctx1.sendIdx["yourself"]=1;
  54919. $4=$recv($5).__eq_eq((1));
  54920. $ctx1.sendIdx["=="]=4;
  54921. self._assert_($4);
  54922. $ctx1.sendIdx["assert:"]=3;
  54923. $7=(1)._yourself();
  54924. $ctx1.sendIdx["yourself"]=2;
  54925. $6=(1).__eq_eq($7);
  54926. $ctx1.sendIdx["=="]=5;
  54927. self._assert_($6);
  54928. $ctx1.sendIdx["assert:"]=4;
  54929. $9=(1)._yourself();
  54930. $ctx1.sendIdx["yourself"]=3;
  54931. $8=$recv($9).__eq_eq((1)._yourself());
  54932. $ctx1.sendIdx["=="]=6;
  54933. self._assert_($8);
  54934. self._deny_((1).__eq_eq((2)));
  54935. return self;
  54936. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  54937. },
  54938. args: [],
  54939. 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",
  54940. referencedClasses: [],
  54941. messageSends: ["assert:", "==", "deny:", "yourself"]
  54942. }),
  54943. $globals.NumberTest);
  54944. $core.addMethod(
  54945. $core.method({
  54946. selector: "testInvalidHexNumbers",
  54947. protocol: 'tests',
  54948. fn: function (){
  54949. var self=this;
  54950. return $core.withContext(function($ctx1) {
  54951. self._should_raise_((function(){
  54952. return $core.withContext(function($ctx2) {
  54953. return (16)._rG();
  54954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54955. }),$globals.MessageNotUnderstood);
  54956. $ctx1.sendIdx["should:raise:"]=1;
  54957. self._should_raise_((function(){
  54958. return $core.withContext(function($ctx2) {
  54959. return (16)._rg();
  54960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54961. }),$globals.MessageNotUnderstood);
  54962. $ctx1.sendIdx["should:raise:"]=2;
  54963. self._should_raise_((function(){
  54964. return $core.withContext(function($ctx2) {
  54965. return (16)._rH();
  54966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  54967. }),$globals.MessageNotUnderstood);
  54968. $ctx1.sendIdx["should:raise:"]=3;
  54969. self._should_raise_((function(){
  54970. return $core.withContext(function($ctx2) {
  54971. return (16)._rh();
  54972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  54973. }),$globals.MessageNotUnderstood);
  54974. $ctx1.sendIdx["should:raise:"]=4;
  54975. self._should_raise_((function(){
  54976. return $core.withContext(function($ctx2) {
  54977. return (16)._rI();
  54978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54979. }),$globals.MessageNotUnderstood);
  54980. $ctx1.sendIdx["should:raise:"]=5;
  54981. self._should_raise_((function(){
  54982. return $core.withContext(function($ctx2) {
  54983. return (16)._ri();
  54984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  54985. }),$globals.MessageNotUnderstood);
  54986. $ctx1.sendIdx["should:raise:"]=6;
  54987. self._should_raise_((function(){
  54988. return $core.withContext(function($ctx2) {
  54989. return (16)._rJ();
  54990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  54991. }),$globals.MessageNotUnderstood);
  54992. $ctx1.sendIdx["should:raise:"]=7;
  54993. self._should_raise_((function(){
  54994. return $core.withContext(function($ctx2) {
  54995. return (16)._rj();
  54996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  54997. }),$globals.MessageNotUnderstood);
  54998. $ctx1.sendIdx["should:raise:"]=8;
  54999. self._should_raise_((function(){
  55000. return $core.withContext(function($ctx2) {
  55001. return (16)._rK();
  55002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  55003. }),$globals.MessageNotUnderstood);
  55004. $ctx1.sendIdx["should:raise:"]=9;
  55005. self._should_raise_((function(){
  55006. return $core.withContext(function($ctx2) {
  55007. return (16)._rk();
  55008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  55009. }),$globals.MessageNotUnderstood);
  55010. $ctx1.sendIdx["should:raise:"]=10;
  55011. self._should_raise_((function(){
  55012. return $core.withContext(function($ctx2) {
  55013. return (16)._rL();
  55014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  55015. }),$globals.MessageNotUnderstood);
  55016. $ctx1.sendIdx["should:raise:"]=11;
  55017. self._should_raise_((function(){
  55018. return $core.withContext(function($ctx2) {
  55019. return (16)._rl();
  55020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  55021. }),$globals.MessageNotUnderstood);
  55022. $ctx1.sendIdx["should:raise:"]=12;
  55023. self._should_raise_((function(){
  55024. return $core.withContext(function($ctx2) {
  55025. return (16)._rM();
  55026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  55027. }),$globals.MessageNotUnderstood);
  55028. $ctx1.sendIdx["should:raise:"]=13;
  55029. self._should_raise_((function(){
  55030. return $core.withContext(function($ctx2) {
  55031. return (16)._rm();
  55032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  55033. }),$globals.MessageNotUnderstood);
  55034. $ctx1.sendIdx["should:raise:"]=14;
  55035. self._should_raise_((function(){
  55036. return $core.withContext(function($ctx2) {
  55037. return (16)._rN();
  55038. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  55039. }),$globals.MessageNotUnderstood);
  55040. $ctx1.sendIdx["should:raise:"]=15;
  55041. self._should_raise_((function(){
  55042. return $core.withContext(function($ctx2) {
  55043. return (16)._rn();
  55044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  55045. }),$globals.MessageNotUnderstood);
  55046. $ctx1.sendIdx["should:raise:"]=16;
  55047. self._should_raise_((function(){
  55048. return $core.withContext(function($ctx2) {
  55049. return (16)._rO();
  55050. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  55051. }),$globals.MessageNotUnderstood);
  55052. $ctx1.sendIdx["should:raise:"]=17;
  55053. self._should_raise_((function(){
  55054. return $core.withContext(function($ctx2) {
  55055. return (16)._ro();
  55056. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  55057. }),$globals.MessageNotUnderstood);
  55058. $ctx1.sendIdx["should:raise:"]=18;
  55059. self._should_raise_((function(){
  55060. return $core.withContext(function($ctx2) {
  55061. return (16)._rP();
  55062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  55063. }),$globals.MessageNotUnderstood);
  55064. $ctx1.sendIdx["should:raise:"]=19;
  55065. self._should_raise_((function(){
  55066. return $core.withContext(function($ctx2) {
  55067. return (16)._rp();
  55068. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  55069. }),$globals.MessageNotUnderstood);
  55070. $ctx1.sendIdx["should:raise:"]=20;
  55071. self._should_raise_((function(){
  55072. return $core.withContext(function($ctx2) {
  55073. return (16)._rQ();
  55074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  55075. }),$globals.MessageNotUnderstood);
  55076. $ctx1.sendIdx["should:raise:"]=21;
  55077. self._should_raise_((function(){
  55078. return $core.withContext(function($ctx2) {
  55079. return (16)._rq();
  55080. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  55081. }),$globals.MessageNotUnderstood);
  55082. $ctx1.sendIdx["should:raise:"]=22;
  55083. self._should_raise_((function(){
  55084. return $core.withContext(function($ctx2) {
  55085. return (16)._rR();
  55086. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  55087. }),$globals.MessageNotUnderstood);
  55088. $ctx1.sendIdx["should:raise:"]=23;
  55089. self._should_raise_((function(){
  55090. return $core.withContext(function($ctx2) {
  55091. return (16)._rr();
  55092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  55093. }),$globals.MessageNotUnderstood);
  55094. $ctx1.sendIdx["should:raise:"]=24;
  55095. self._should_raise_((function(){
  55096. return $core.withContext(function($ctx2) {
  55097. return (16)._rS();
  55098. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  55099. }),$globals.MessageNotUnderstood);
  55100. $ctx1.sendIdx["should:raise:"]=25;
  55101. self._should_raise_((function(){
  55102. return $core.withContext(function($ctx2) {
  55103. return (16)._rs();
  55104. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  55105. }),$globals.MessageNotUnderstood);
  55106. $ctx1.sendIdx["should:raise:"]=26;
  55107. self._should_raise_((function(){
  55108. return $core.withContext(function($ctx2) {
  55109. return (16)._rT();
  55110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  55111. }),$globals.MessageNotUnderstood);
  55112. $ctx1.sendIdx["should:raise:"]=27;
  55113. self._should_raise_((function(){
  55114. return $core.withContext(function($ctx2) {
  55115. return (16)._rt();
  55116. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  55117. }),$globals.MessageNotUnderstood);
  55118. $ctx1.sendIdx["should:raise:"]=28;
  55119. self._should_raise_((function(){
  55120. return $core.withContext(function($ctx2) {
  55121. return (16)._rU();
  55122. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  55123. }),$globals.MessageNotUnderstood);
  55124. $ctx1.sendIdx["should:raise:"]=29;
  55125. self._should_raise_((function(){
  55126. return $core.withContext(function($ctx2) {
  55127. return (16)._ru();
  55128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  55129. }),$globals.MessageNotUnderstood);
  55130. $ctx1.sendIdx["should:raise:"]=30;
  55131. self._should_raise_((function(){
  55132. return $core.withContext(function($ctx2) {
  55133. return (16)._rV();
  55134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  55135. }),$globals.MessageNotUnderstood);
  55136. $ctx1.sendIdx["should:raise:"]=31;
  55137. self._should_raise_((function(){
  55138. return $core.withContext(function($ctx2) {
  55139. return (16)._rv();
  55140. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  55141. }),$globals.MessageNotUnderstood);
  55142. $ctx1.sendIdx["should:raise:"]=32;
  55143. self._should_raise_((function(){
  55144. return $core.withContext(function($ctx2) {
  55145. return (16)._rW();
  55146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  55147. }),$globals.MessageNotUnderstood);
  55148. $ctx1.sendIdx["should:raise:"]=33;
  55149. self._should_raise_((function(){
  55150. return $core.withContext(function($ctx2) {
  55151. return (16)._rw();
  55152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  55153. }),$globals.MessageNotUnderstood);
  55154. $ctx1.sendIdx["should:raise:"]=34;
  55155. self._should_raise_((function(){
  55156. return $core.withContext(function($ctx2) {
  55157. return (16)._rX();
  55158. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  55159. }),$globals.MessageNotUnderstood);
  55160. $ctx1.sendIdx["should:raise:"]=35;
  55161. self._should_raise_((function(){
  55162. return $core.withContext(function($ctx2) {
  55163. return (16)._rx();
  55164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  55165. }),$globals.MessageNotUnderstood);
  55166. $ctx1.sendIdx["should:raise:"]=36;
  55167. self._should_raise_((function(){
  55168. return $core.withContext(function($ctx2) {
  55169. return (16)._rY();
  55170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  55171. }),$globals.MessageNotUnderstood);
  55172. $ctx1.sendIdx["should:raise:"]=37;
  55173. self._should_raise_((function(){
  55174. return $core.withContext(function($ctx2) {
  55175. return (16)._ry();
  55176. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  55177. }),$globals.MessageNotUnderstood);
  55178. $ctx1.sendIdx["should:raise:"]=38;
  55179. self._should_raise_((function(){
  55180. return $core.withContext(function($ctx2) {
  55181. return (16)._rZ();
  55182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  55183. }),$globals.MessageNotUnderstood);
  55184. $ctx1.sendIdx["should:raise:"]=39;
  55185. self._should_raise_((function(){
  55186. return $core.withContext(function($ctx2) {
  55187. return (16)._rz();
  55188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  55189. }),$globals.MessageNotUnderstood);
  55190. $ctx1.sendIdx["should:raise:"]=40;
  55191. self._should_raise_((function(){
  55192. return $core.withContext(function($ctx2) {
  55193. return (11259375)._Z();
  55194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  55195. }),$globals.MessageNotUnderstood);
  55196. return self;
  55197. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  55198. },
  55199. args: [],
  55200. 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.",
  55201. referencedClasses: ["MessageNotUnderstood"],
  55202. 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"]
  55203. }),
  55204. $globals.NumberTest);
  55205. $core.addMethod(
  55206. $core.method({
  55207. selector: "testLog",
  55208. protocol: 'tests',
  55209. fn: function (){
  55210. var self=this;
  55211. return $core.withContext(function($ctx1) {
  55212. self._assert_equals_((10000)._log(),(4));
  55213. $ctx1.sendIdx["assert:equals:"]=1;
  55214. self._assert_equals_((512)._log_((2)),(9));
  55215. $ctx1.sendIdx["assert:equals:"]=2;
  55216. self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  55217. return self;
  55218. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  55219. },
  55220. args: [],
  55221. 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.",
  55222. referencedClasses: ["Number"],
  55223. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  55224. }),
  55225. $globals.NumberTest);
  55226. $core.addMethod(
  55227. $core.method({
  55228. selector: "testMinMax",
  55229. protocol: 'tests',
  55230. fn: function (){
  55231. var self=this;
  55232. return $core.withContext(function($ctx1) {
  55233. self._assert_equals_((2)._max_((5)),(5));
  55234. $ctx1.sendIdx["assert:equals:"]=1;
  55235. self._assert_equals_((2)._min_((5)),(2));
  55236. return self;
  55237. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  55238. },
  55239. args: [],
  55240. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  55241. referencedClasses: [],
  55242. messageSends: ["assert:equals:", "max:", "min:"]
  55243. }),
  55244. $globals.NumberTest);
  55245. $core.addMethod(
  55246. $core.method({
  55247. selector: "testNegated",
  55248. protocol: 'tests',
  55249. fn: function (){
  55250. var self=this;
  55251. return $core.withContext(function($ctx1) {
  55252. var $1;
  55253. $1=(3)._negated();
  55254. $ctx1.sendIdx["negated"]=1;
  55255. self._assert_equals_($1,(-3));
  55256. $ctx1.sendIdx["assert:equals:"]=1;
  55257. self._assert_equals_((-3)._negated(),(3));
  55258. return self;
  55259. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  55260. },
  55261. args: [],
  55262. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  55263. referencedClasses: [],
  55264. messageSends: ["assert:equals:", "negated"]
  55265. }),
  55266. $globals.NumberTest);
  55267. $core.addMethod(
  55268. $core.method({
  55269. selector: "testPrintShowingDecimalPlaces",
  55270. protocol: 'tests',
  55271. fn: function (){
  55272. var self=this;
  55273. return $core.withContext(function($ctx1) {
  55274. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  55275. $1=(23)._printShowingDecimalPlaces_((2));
  55276. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  55277. self._assert_equals_($1,"23.00");
  55278. $ctx1.sendIdx["assert:equals:"]=1;
  55279. $2=(23.5698)._printShowingDecimalPlaces_((2));
  55280. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  55281. self._assert_equals_($2,"23.57");
  55282. $ctx1.sendIdx["assert:equals:"]=2;
  55283. $4=(234.567)._negated();
  55284. $ctx1.sendIdx["negated"]=1;
  55285. $3=$recv($4)._printShowingDecimalPlaces_((5));
  55286. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  55287. self._assert_equals_($3,"-234.56700");
  55288. $ctx1.sendIdx["assert:equals:"]=3;
  55289. $5=(23.4567)._printShowingDecimalPlaces_((0));
  55290. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  55291. self._assert_equals_($5,"23");
  55292. $ctx1.sendIdx["assert:equals:"]=4;
  55293. $6=(23.5567)._printShowingDecimalPlaces_((0));
  55294. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  55295. self._assert_equals_($6,"24");
  55296. $ctx1.sendIdx["assert:equals:"]=5;
  55297. $8=(23.4567)._negated();
  55298. $ctx1.sendIdx["negated"]=2;
  55299. $7=$recv($8)._printShowingDecimalPlaces_((0));
  55300. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  55301. self._assert_equals_($7,"-23");
  55302. $ctx1.sendIdx["assert:equals:"]=6;
  55303. $10=(23.5567)._negated();
  55304. $ctx1.sendIdx["negated"]=3;
  55305. $9=$recv($10)._printShowingDecimalPlaces_((0));
  55306. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  55307. self._assert_equals_($9,"-24");
  55308. $ctx1.sendIdx["assert:equals:"]=7;
  55309. $11=(100000000)._printShowingDecimalPlaces_((1));
  55310. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  55311. self._assert_equals_($11,"100000000.0");
  55312. $ctx1.sendIdx["assert:equals:"]=8;
  55313. $12=(0.98)._printShowingDecimalPlaces_((5));
  55314. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  55315. self._assert_equals_($12,"0.98000");
  55316. $ctx1.sendIdx["assert:equals:"]=9;
  55317. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  55318. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  55319. self._assert_equals_($13,"-0.98");
  55320. $ctx1.sendIdx["assert:equals:"]=10;
  55321. $14=(2.567)._printShowingDecimalPlaces_((2));
  55322. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  55323. self._assert_equals_($14,"2.57");
  55324. $ctx1.sendIdx["assert:equals:"]=11;
  55325. $15=(-2.567)._printShowingDecimalPlaces_((2));
  55326. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  55327. self._assert_equals_($15,"-2.57");
  55328. $ctx1.sendIdx["assert:equals:"]=12;
  55329. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  55330. return self;
  55331. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  55332. },
  55333. args: [],
  55334. 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'.",
  55335. referencedClasses: [],
  55336. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  55337. }),
  55338. $globals.NumberTest);
  55339. $core.addMethod(
  55340. $core.method({
  55341. selector: "testRaisedTo",
  55342. protocol: 'tests',
  55343. fn: function (){
  55344. var self=this;
  55345. return $core.withContext(function($ctx1) {
  55346. var $1,$2,$3;
  55347. $1=(2)._raisedTo_((4));
  55348. $ctx1.sendIdx["raisedTo:"]=1;
  55349. self._assert_equals_($1,(16));
  55350. $ctx1.sendIdx["assert:equals:"]=1;
  55351. $2=(2)._raisedTo_((0));
  55352. $ctx1.sendIdx["raisedTo:"]=2;
  55353. self._assert_equals_($2,(1));
  55354. $ctx1.sendIdx["assert:equals:"]=2;
  55355. $3=(2)._raisedTo_((-3));
  55356. $ctx1.sendIdx["raisedTo:"]=3;
  55357. self._assert_equals_($3,(0.125));
  55358. $ctx1.sendIdx["assert:equals:"]=3;
  55359. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  55360. $ctx1.sendIdx["assert:equals:"]=4;
  55361. self._assert_equals_((2).__star_star((4)),(16));
  55362. return self;
  55363. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  55364. },
  55365. args: [],
  55366. 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.",
  55367. referencedClasses: [],
  55368. messageSends: ["assert:equals:", "raisedTo:", "**"]
  55369. }),
  55370. $globals.NumberTest);
  55371. $core.addMethod(
  55372. $core.method({
  55373. selector: "testRounded",
  55374. protocol: 'tests',
  55375. fn: function (){
  55376. var self=this;
  55377. return $core.withContext(function($ctx1) {
  55378. var $1,$2;
  55379. $1=(3)._rounded();
  55380. $ctx1.sendIdx["rounded"]=1;
  55381. self._assert_equals_($1,(3));
  55382. $ctx1.sendIdx["assert:equals:"]=1;
  55383. $2=(3.212)._rounded();
  55384. $ctx1.sendIdx["rounded"]=2;
  55385. self._assert_equals_($2,(3));
  55386. $ctx1.sendIdx["assert:equals:"]=2;
  55387. self._assert_equals_((3.51)._rounded(),(4));
  55388. return self;
  55389. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  55390. },
  55391. args: [],
  55392. 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",
  55393. referencedClasses: [],
  55394. messageSends: ["assert:equals:", "rounded"]
  55395. }),
  55396. $globals.NumberTest);
  55397. $core.addMethod(
  55398. $core.method({
  55399. selector: "testSign",
  55400. protocol: 'tests',
  55401. fn: function (){
  55402. var self=this;
  55403. return $core.withContext(function($ctx1) {
  55404. var $1,$2;
  55405. $1=(5)._sign();
  55406. $ctx1.sendIdx["sign"]=1;
  55407. self._assert_equals_($1,(1));
  55408. $ctx1.sendIdx["assert:equals:"]=1;
  55409. $2=(0)._sign();
  55410. $ctx1.sendIdx["sign"]=2;
  55411. self._assert_equals_($2,(0));
  55412. $ctx1.sendIdx["assert:equals:"]=2;
  55413. self._assert_equals_((-1.4)._sign(),(-1));
  55414. return self;
  55415. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  55416. },
  55417. args: [],
  55418. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  55419. referencedClasses: [],
  55420. messageSends: ["assert:equals:", "sign"]
  55421. }),
  55422. $globals.NumberTest);
  55423. $core.addMethod(
  55424. $core.method({
  55425. selector: "testSqrt",
  55426. protocol: 'tests',
  55427. fn: function (){
  55428. var self=this;
  55429. return $core.withContext(function($ctx1) {
  55430. var $1;
  55431. $1=(4)._sqrt();
  55432. $ctx1.sendIdx["sqrt"]=1;
  55433. self._assert_equals_($1,(2));
  55434. $ctx1.sendIdx["assert:equals:"]=1;
  55435. self._assert_equals_((16)._sqrt(),(4));
  55436. return self;
  55437. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  55438. },
  55439. args: [],
  55440. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  55441. referencedClasses: [],
  55442. messageSends: ["assert:equals:", "sqrt"]
  55443. }),
  55444. $globals.NumberTest);
  55445. $core.addMethod(
  55446. $core.method({
  55447. selector: "testSquared",
  55448. protocol: 'tests',
  55449. fn: function (){
  55450. var self=this;
  55451. return $core.withContext(function($ctx1) {
  55452. self._assert_equals_((4)._squared(),(16));
  55453. return self;
  55454. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  55455. },
  55456. args: [],
  55457. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  55458. referencedClasses: [],
  55459. messageSends: ["assert:equals:", "squared"]
  55460. }),
  55461. $globals.NumberTest);
  55462. $core.addMethod(
  55463. $core.method({
  55464. selector: "testTimesRepeat",
  55465. protocol: 'tests',
  55466. fn: function (){
  55467. var self=this;
  55468. var i;
  55469. return $core.withContext(function($ctx1) {
  55470. i=(0);
  55471. (0)._timesRepeat_((function(){
  55472. return $core.withContext(function($ctx2) {
  55473. i=$recv(i).__plus((1));
  55474. $ctx2.sendIdx["+"]=1;
  55475. return i;
  55476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55477. }));
  55478. $ctx1.sendIdx["timesRepeat:"]=1;
  55479. self._assert_equals_(i,(0));
  55480. $ctx1.sendIdx["assert:equals:"]=1;
  55481. (5)._timesRepeat_((function(){
  55482. return $core.withContext(function($ctx2) {
  55483. i=$recv(i).__plus((1));
  55484. return i;
  55485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55486. }));
  55487. self._assert_equals_(i,(5));
  55488. return self;
  55489. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  55490. },
  55491. args: [],
  55492. 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",
  55493. referencedClasses: [],
  55494. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  55495. }),
  55496. $globals.NumberTest);
  55497. $core.addMethod(
  55498. $core.method({
  55499. selector: "testTo",
  55500. protocol: 'tests',
  55501. fn: function (){
  55502. var self=this;
  55503. return $core.withContext(function($ctx1) {
  55504. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  55505. return self;
  55506. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  55507. },
  55508. args: [],
  55509. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  55510. referencedClasses: [],
  55511. messageSends: ["assert:equals:", "to:"]
  55512. }),
  55513. $globals.NumberTest);
  55514. $core.addMethod(
  55515. $core.method({
  55516. selector: "testToBy",
  55517. protocol: 'tests',
  55518. fn: function (){
  55519. var self=this;
  55520. return $core.withContext(function($ctx1) {
  55521. var $1;
  55522. $1=(0)._to_by_((6),(2));
  55523. $ctx1.sendIdx["to:by:"]=1;
  55524. self._assert_equals_($1,[(0), (2), (4), (6)]);
  55525. self._should_raise_((function(){
  55526. return $core.withContext(function($ctx2) {
  55527. return (1)._to_by_((4),(0));
  55528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55529. }),$globals.Error);
  55530. return self;
  55531. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  55532. },
  55533. args: [],
  55534. 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",
  55535. referencedClasses: ["Error"],
  55536. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  55537. }),
  55538. $globals.NumberTest);
  55539. $core.addMethod(
  55540. $core.method({
  55541. selector: "testTrigonometry",
  55542. protocol: 'tests',
  55543. fn: function (){
  55544. var self=this;
  55545. return $core.withContext(function($ctx1) {
  55546. self._assert_equals_((0)._cos(),(1));
  55547. $ctx1.sendIdx["assert:equals:"]=1;
  55548. self._assert_equals_((0)._sin(),(0));
  55549. $ctx1.sendIdx["assert:equals:"]=2;
  55550. self._assert_equals_((0)._tan(),(0));
  55551. $ctx1.sendIdx["assert:equals:"]=3;
  55552. self._assert_equals_((1)._arcCos(),(0));
  55553. $ctx1.sendIdx["assert:equals:"]=4;
  55554. self._assert_equals_((0)._arcSin(),(0));
  55555. $ctx1.sendIdx["assert:equals:"]=5;
  55556. self._assert_equals_((0)._arcTan(),(0));
  55557. return self;
  55558. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  55559. },
  55560. args: [],
  55561. 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.",
  55562. referencedClasses: [],
  55563. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  55564. }),
  55565. $globals.NumberTest);
  55566. $core.addMethod(
  55567. $core.method({
  55568. selector: "testTruncated",
  55569. protocol: 'tests',
  55570. fn: function (){
  55571. var self=this;
  55572. return $core.withContext(function($ctx1) {
  55573. var $1,$2;
  55574. $1=(3)._truncated();
  55575. $ctx1.sendIdx["truncated"]=1;
  55576. self._assert_equals_($1,(3));
  55577. $ctx1.sendIdx["assert:equals:"]=1;
  55578. $2=(3.212)._truncated();
  55579. $ctx1.sendIdx["truncated"]=2;
  55580. self._assert_equals_($2,(3));
  55581. $ctx1.sendIdx["assert:equals:"]=2;
  55582. self._assert_equals_((3.51)._truncated(),(3));
  55583. return self;
  55584. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  55585. },
  55586. args: [],
  55587. 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",
  55588. referencedClasses: [],
  55589. messageSends: ["assert:equals:", "truncated"]
  55590. }),
  55591. $globals.NumberTest);
  55592. $core.addClass('ObjectMock', $globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  55593. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  55594. $core.addMethod(
  55595. $core.method({
  55596. selector: "foo",
  55597. protocol: 'not yet classified',
  55598. fn: function (){
  55599. var self=this;
  55600. return self["@foo"];
  55601. },
  55602. args: [],
  55603. source: "foo\x0a\x09^ foo",
  55604. referencedClasses: [],
  55605. messageSends: []
  55606. }),
  55607. $globals.ObjectMock);
  55608. $core.addMethod(
  55609. $core.method({
  55610. selector: "foo:",
  55611. protocol: 'not yet classified',
  55612. fn: function (anObject){
  55613. var self=this;
  55614. self["@foo"]=anObject;
  55615. return self;
  55616. },
  55617. args: ["anObject"],
  55618. source: "foo: anObject\x0a\x09foo := anObject",
  55619. referencedClasses: [],
  55620. messageSends: []
  55621. }),
  55622. $globals.ObjectMock);
  55623. $core.addClass('ObjectTest', $globals.TestCase, [], 'Kernel-Tests');
  55624. $core.addMethod(
  55625. $core.method({
  55626. selector: "notDefined",
  55627. protocol: 'tests',
  55628. fn: function (){
  55629. var self=this;
  55630. return $core.withContext(function($ctx1) {
  55631. return void 0;;
  55632. return self;
  55633. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  55634. },
  55635. args: [],
  55636. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  55637. referencedClasses: [],
  55638. messageSends: []
  55639. }),
  55640. $globals.ObjectTest);
  55641. $core.addMethod(
  55642. $core.method({
  55643. selector: "testBasicAccess",
  55644. protocol: 'tests',
  55645. fn: function (){
  55646. var self=this;
  55647. var o;
  55648. return $core.withContext(function($ctx1) {
  55649. var $1;
  55650. o=$recv($globals.Object)._new();
  55651. $recv(o)._basicAt_put_("a",(1));
  55652. $1=$recv(o)._basicAt_("a");
  55653. $ctx1.sendIdx["basicAt:"]=1;
  55654. self._assert_equals_($1,(1));
  55655. $ctx1.sendIdx["assert:equals:"]=1;
  55656. self._assert_equals_($recv(o)._basicAt_("b"),nil);
  55657. return self;
  55658. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  55659. },
  55660. args: [],
  55661. 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",
  55662. referencedClasses: ["Object"],
  55663. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  55664. }),
  55665. $globals.ObjectTest);
  55666. $core.addMethod(
  55667. $core.method({
  55668. selector: "testBasicPerform",
  55669. protocol: 'tests',
  55670. fn: function (){
  55671. var self=this;
  55672. var o;
  55673. return $core.withContext(function($ctx1) {
  55674. o=$recv($globals.Object)._new();
  55675. $recv(o)._basicAt_put_("func",(function(){
  55676. return "hello";
  55677. }));
  55678. $ctx1.sendIdx["basicAt:put:"]=1;
  55679. $recv(o)._basicAt_put_("func2",(function(a){
  55680. return $core.withContext(function($ctx2) {
  55681. return $recv(a).__plus((1));
  55682. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  55683. }));
  55684. self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  55685. $ctx1.sendIdx["assert:equals:"]=1;
  55686. self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  55687. return self;
  55688. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  55689. },
  55690. args: [],
  55691. 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",
  55692. referencedClasses: ["Object"],
  55693. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  55694. }),
  55695. $globals.ObjectTest);
  55696. $core.addMethod(
  55697. $core.method({
  55698. selector: "testDNU",
  55699. protocol: 'tests',
  55700. fn: function (){
  55701. var self=this;
  55702. return $core.withContext(function($ctx1) {
  55703. self._should_raise_((function(){
  55704. return $core.withContext(function($ctx2) {
  55705. return $recv($recv($globals.Object)._new())._foo();
  55706. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55707. }),$globals.MessageNotUnderstood);
  55708. return self;
  55709. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  55710. },
  55711. args: [],
  55712. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  55713. referencedClasses: ["Object", "MessageNotUnderstood"],
  55714. messageSends: ["should:raise:", "foo", "new"]
  55715. }),
  55716. $globals.ObjectTest);
  55717. $core.addMethod(
  55718. $core.method({
  55719. selector: "testEquality",
  55720. protocol: 'tests',
  55721. fn: function (){
  55722. var self=this;
  55723. var o;
  55724. return $core.withContext(function($ctx1) {
  55725. var $1,$2,$4,$3;
  55726. o=$recv($globals.Object)._new();
  55727. $ctx1.sendIdx["new"]=1;
  55728. $1=$recv(o).__eq($recv($globals.Object)._new());
  55729. $ctx1.sendIdx["="]=1;
  55730. self._deny_($1);
  55731. $2=$recv(o).__eq(o);
  55732. $ctx1.sendIdx["="]=2;
  55733. self._assert_($2);
  55734. $ctx1.sendIdx["assert:"]=1;
  55735. $4=$recv(o)._yourself();
  55736. $ctx1.sendIdx["yourself"]=1;
  55737. $3=$recv($4).__eq(o);
  55738. $ctx1.sendIdx["="]=3;
  55739. self._assert_($3);
  55740. $ctx1.sendIdx["assert:"]=2;
  55741. self._assert_($recv(o).__eq($recv(o)._yourself()));
  55742. return self;
  55743. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  55744. },
  55745. args: [],
  55746. 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)",
  55747. referencedClasses: ["Object"],
  55748. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  55749. }),
  55750. $globals.ObjectTest);
  55751. $core.addMethod(
  55752. $core.method({
  55753. selector: "testHalt",
  55754. protocol: 'tests',
  55755. fn: function (){
  55756. var self=this;
  55757. return $core.withContext(function($ctx1) {
  55758. self._should_raise_((function(){
  55759. return $core.withContext(function($ctx2) {
  55760. return $recv($recv($globals.Object)._new())._halt();
  55761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55762. }),$globals.Error);
  55763. return self;
  55764. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  55765. },
  55766. args: [],
  55767. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  55768. referencedClasses: ["Object", "Error"],
  55769. messageSends: ["should:raise:", "halt", "new"]
  55770. }),
  55771. $globals.ObjectTest);
  55772. $core.addMethod(
  55773. $core.method({
  55774. selector: "testIdentity",
  55775. protocol: 'tests',
  55776. fn: function (){
  55777. var self=this;
  55778. var o;
  55779. return $core.withContext(function($ctx1) {
  55780. var $1,$2,$4,$3;
  55781. o=$recv($globals.Object)._new();
  55782. $ctx1.sendIdx["new"]=1;
  55783. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  55784. $ctx1.sendIdx["=="]=1;
  55785. self._deny_($1);
  55786. $2=$recv(o).__eq_eq(o);
  55787. $ctx1.sendIdx["=="]=2;
  55788. self._assert_($2);
  55789. $ctx1.sendIdx["assert:"]=1;
  55790. $4=$recv(o)._yourself();
  55791. $ctx1.sendIdx["yourself"]=1;
  55792. $3=$recv($4).__eq_eq(o);
  55793. $ctx1.sendIdx["=="]=3;
  55794. self._assert_($3);
  55795. $ctx1.sendIdx["assert:"]=2;
  55796. self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  55797. return self;
  55798. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  55799. },
  55800. args: [],
  55801. 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",
  55802. referencedClasses: ["Object"],
  55803. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  55804. }),
  55805. $globals.ObjectTest);
  55806. $core.addMethod(
  55807. $core.method({
  55808. selector: "testIfNil",
  55809. protocol: 'tests',
  55810. fn: function (){
  55811. var self=this;
  55812. return $core.withContext(function($ctx1) {
  55813. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  55814. $2=$recv($globals.Object)._new();
  55815. $ctx1.sendIdx["new"]=1;
  55816. $1=$recv($2)._isNil();
  55817. self._deny_($1);
  55818. $ctx1.sendIdx["deny:"]=1;
  55819. $5=$recv($globals.Object)._new();
  55820. $ctx1.sendIdx["new"]=2;
  55821. if(($receiver = $5) == null || $receiver.isNil){
  55822. $4=true;
  55823. } else {
  55824. $4=$5;
  55825. };
  55826. $3=$recv($4).__eq(true);
  55827. self._deny_($3);
  55828. $7=$recv($globals.Object)._new();
  55829. $ctx1.sendIdx["new"]=3;
  55830. if(($receiver = $7) == null || $receiver.isNil){
  55831. $6=$7;
  55832. } else {
  55833. $6=true;
  55834. };
  55835. self._assert_equals_($6,true);
  55836. $ctx1.sendIdx["assert:equals:"]=1;
  55837. $9=$recv($globals.Object)._new();
  55838. $ctx1.sendIdx["new"]=4;
  55839. if(($receiver = $9) == null || $receiver.isNil){
  55840. $8=false;
  55841. } else {
  55842. $8=true;
  55843. };
  55844. self._assert_equals_($8,true);
  55845. $ctx1.sendIdx["assert:equals:"]=2;
  55846. $11=$recv($globals.Object)._new();
  55847. if(($receiver = $11) == null || $receiver.isNil){
  55848. $10=false;
  55849. } else {
  55850. $10=true;
  55851. };
  55852. self._assert_equals_($10,true);
  55853. return self;
  55854. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  55855. },
  55856. args: [],
  55857. 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",
  55858. referencedClasses: ["Object"],
  55859. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  55860. }),
  55861. $globals.ObjectTest);
  55862. $core.addMethod(
  55863. $core.method({
  55864. selector: "testInstVars",
  55865. protocol: 'tests',
  55866. fn: function (){
  55867. var self=this;
  55868. var o;
  55869. return $core.withContext(function($ctx1) {
  55870. var $1,$2;
  55871. o=$recv($globals.ObjectMock)._new();
  55872. $1=$recv(o)._instVarAt_("foo");
  55873. $ctx1.sendIdx["instVarAt:"]=1;
  55874. self._assert_equals_($1,nil);
  55875. $ctx1.sendIdx["assert:equals:"]=1;
  55876. $recv(o)._instVarAt_put_("foo",(1));
  55877. $2=$recv(o)._instVarAt_("foo");
  55878. $ctx1.sendIdx["instVarAt:"]=2;
  55879. self._assert_equals_($2,(1));
  55880. $ctx1.sendIdx["assert:equals:"]=2;
  55881. self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  55882. return self;
  55883. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  55884. },
  55885. args: [],
  55886. 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",
  55887. referencedClasses: ["ObjectMock"],
  55888. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  55889. }),
  55890. $globals.ObjectTest);
  55891. $core.addMethod(
  55892. $core.method({
  55893. selector: "testNilUndefined",
  55894. protocol: 'tests',
  55895. fn: function (){
  55896. var self=this;
  55897. return $core.withContext(function($ctx1) {
  55898. self._assert_equals_(self._notDefined(),nil);
  55899. return self;
  55900. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  55901. },
  55902. args: [],
  55903. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  55904. referencedClasses: [],
  55905. messageSends: ["assert:equals:", "notDefined"]
  55906. }),
  55907. $globals.ObjectTest);
  55908. $core.addMethod(
  55909. $core.method({
  55910. selector: "testYourself",
  55911. protocol: 'tests',
  55912. fn: function (){
  55913. var self=this;
  55914. var o;
  55915. return $core.withContext(function($ctx1) {
  55916. o=$recv($globals.ObjectMock)._new();
  55917. self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  55918. return self;
  55919. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  55920. },
  55921. args: [],
  55922. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  55923. referencedClasses: ["ObjectMock"],
  55924. messageSends: ["new", "assert:", "==", "yourself"]
  55925. }),
  55926. $globals.ObjectTest);
  55927. $core.addMethod(
  55928. $core.method({
  55929. selector: "testidentityHash",
  55930. protocol: 'tests',
  55931. fn: function (){
  55932. var self=this;
  55933. var o1,o2;
  55934. return $core.withContext(function($ctx1) {
  55935. var $2,$3,$1,$5,$4;
  55936. o1=$recv($globals.Object)._new();
  55937. $ctx1.sendIdx["new"]=1;
  55938. o2=$recv($globals.Object)._new();
  55939. $2=$recv(o1)._identityHash();
  55940. $ctx1.sendIdx["identityHash"]=1;
  55941. $3=$recv(o1)._identityHash();
  55942. $ctx1.sendIdx["identityHash"]=2;
  55943. $1=$recv($2).__eq_eq($3);
  55944. $ctx1.sendIdx["=="]=1;
  55945. self._assert_($1);
  55946. $5=$recv(o1)._identityHash();
  55947. $ctx1.sendIdx["identityHash"]=3;
  55948. $4=$recv($5).__eq_eq($recv(o2)._identityHash());
  55949. self._deny_($4);
  55950. return self;
  55951. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)});
  55952. },
  55953. args: [],
  55954. source: "testidentityHash\x0a\x09| o1 o2 |\x0a\x09\x0a\x09o1 := Object new.\x0a\x09o2 := Object new.\x0a\x0a\x09self assert: o1 identityHash == o1 identityHash.\x0a\x09self deny: o1 identityHash == o2 identityHash",
  55955. referencedClasses: ["Object"],
  55956. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  55957. }),
  55958. $globals.ObjectTest);
  55959. $core.addClass('PointTest', $globals.TestCase, [], 'Kernel-Tests');
  55960. $core.addMethod(
  55961. $core.method({
  55962. selector: "testAccessing",
  55963. protocol: 'tests',
  55964. fn: function (){
  55965. var self=this;
  55966. return $core.withContext(function($ctx1) {
  55967. var $2,$1,$3,$6,$5,$4;
  55968. $2=$recv($globals.Point)._x_y_((3),(4));
  55969. $ctx1.sendIdx["x:y:"]=1;
  55970. $1=$recv($2)._x();
  55971. $ctx1.sendIdx["x"]=1;
  55972. self._assert_equals_($1,(3));
  55973. $ctx1.sendIdx["assert:equals:"]=1;
  55974. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  55975. $ctx1.sendIdx["y"]=1;
  55976. self._assert_equals_($3,(4));
  55977. $ctx1.sendIdx["assert:equals:"]=2;
  55978. $6=$recv($globals.Point)._new();
  55979. $ctx1.sendIdx["new"]=1;
  55980. $5=$recv($6)._x_((3));
  55981. $4=$recv($5)._x();
  55982. self._assert_equals_($4,(3));
  55983. $ctx1.sendIdx["assert:equals:"]=3;
  55984. self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  55985. return self;
  55986. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  55987. },
  55988. args: [],
  55989. 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",
  55990. referencedClasses: ["Point"],
  55991. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  55992. }),
  55993. $globals.PointTest);
  55994. $core.addMethod(
  55995. $core.method({
  55996. selector: "testArithmetic",
  55997. protocol: 'tests',
  55998. fn: function (){
  55999. var self=this;
  56000. return $core.withContext(function($ctx1) {
  56001. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  56002. $2=(3).__at((4));
  56003. $ctx1.sendIdx["@"]=1;
  56004. $3=(3).__at((4));
  56005. $ctx1.sendIdx["@"]=2;
  56006. $1=$recv($2).__star($3);
  56007. $4=$recv($globals.Point)._x_y_((9),(16));
  56008. $ctx1.sendIdx["x:y:"]=1;
  56009. self._assert_equals_($1,$4);
  56010. $ctx1.sendIdx["assert:equals:"]=1;
  56011. $6=(3).__at((4));
  56012. $ctx1.sendIdx["@"]=3;
  56013. $7=(3).__at((4));
  56014. $ctx1.sendIdx["@"]=4;
  56015. $5=$recv($6).__plus($7);
  56016. $8=$recv($globals.Point)._x_y_((6),(8));
  56017. $ctx1.sendIdx["x:y:"]=2;
  56018. self._assert_equals_($5,$8);
  56019. $ctx1.sendIdx["assert:equals:"]=2;
  56020. $10=(3).__at((4));
  56021. $ctx1.sendIdx["@"]=5;
  56022. $11=(3).__at((4));
  56023. $ctx1.sendIdx["@"]=6;
  56024. $9=$recv($10).__minus($11);
  56025. $12=$recv($globals.Point)._x_y_((0),(0));
  56026. $ctx1.sendIdx["x:y:"]=3;
  56027. self._assert_equals_($9,$12);
  56028. $ctx1.sendIdx["assert:equals:"]=3;
  56029. $14=(6).__at((8));
  56030. $ctx1.sendIdx["@"]=7;
  56031. $13=$recv($14).__slash((3).__at((4)));
  56032. self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  56033. return self;
  56034. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  56035. },
  56036. args: [],
  56037. 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)",
  56038. referencedClasses: ["Point"],
  56039. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  56040. }),
  56041. $globals.PointTest);
  56042. $core.addMethod(
  56043. $core.method({
  56044. selector: "testAt",
  56045. protocol: 'tests',
  56046. fn: function (){
  56047. var self=this;
  56048. return $core.withContext(function($ctx1) {
  56049. self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  56050. return self;
  56051. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  56052. },
  56053. args: [],
  56054. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  56055. referencedClasses: ["Point"],
  56056. messageSends: ["assert:equals:", "@", "x:y:"]
  56057. }),
  56058. $globals.PointTest);
  56059. $core.addMethod(
  56060. $core.method({
  56061. selector: "testComparison",
  56062. protocol: 'tests',
  56063. fn: function (){
  56064. var self=this;
  56065. return $core.withContext(function($ctx1) {
  56066. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  56067. $2=(3).__at((4));
  56068. $ctx1.sendIdx["@"]=1;
  56069. $3=(4).__at((5));
  56070. $ctx1.sendIdx["@"]=2;
  56071. $1=$recv($2).__lt($3);
  56072. $ctx1.sendIdx["<"]=1;
  56073. self._assert_($1);
  56074. $ctx1.sendIdx["assert:"]=1;
  56075. $5=(3).__at((4));
  56076. $ctx1.sendIdx["@"]=3;
  56077. $6=(4).__at((4));
  56078. $ctx1.sendIdx["@"]=4;
  56079. $4=$recv($5).__lt($6);
  56080. self._deny_($4);
  56081. $ctx1.sendIdx["deny:"]=1;
  56082. $8=(4).__at((5));
  56083. $ctx1.sendIdx["@"]=5;
  56084. $9=(4).__at((5));
  56085. $ctx1.sendIdx["@"]=6;
  56086. $7=$recv($8).__lt_eq($9);
  56087. $ctx1.sendIdx["<="]=1;
  56088. self._assert_($7);
  56089. $ctx1.sendIdx["assert:"]=2;
  56090. $11=(4).__at((5));
  56091. $ctx1.sendIdx["@"]=7;
  56092. $12=(3).__at((5));
  56093. $ctx1.sendIdx["@"]=8;
  56094. $10=$recv($11).__lt_eq($12);
  56095. self._deny_($10);
  56096. $ctx1.sendIdx["deny:"]=2;
  56097. $14=(5).__at((6));
  56098. $ctx1.sendIdx["@"]=9;
  56099. $15=(4).__at((5));
  56100. $ctx1.sendIdx["@"]=10;
  56101. $13=$recv($14).__gt($15);
  56102. $ctx1.sendIdx[">"]=1;
  56103. self._assert_($13);
  56104. $ctx1.sendIdx["assert:"]=3;
  56105. $17=(5).__at((6));
  56106. $ctx1.sendIdx["@"]=11;
  56107. $18=(6).__at((6));
  56108. $ctx1.sendIdx["@"]=12;
  56109. $16=$recv($17).__gt($18);
  56110. self._deny_($16);
  56111. $ctx1.sendIdx["deny:"]=3;
  56112. $20=(4).__at((5));
  56113. $ctx1.sendIdx["@"]=13;
  56114. $21=(4).__at((5));
  56115. $ctx1.sendIdx["@"]=14;
  56116. $19=$recv($20).__gt_eq($21);
  56117. $ctx1.sendIdx[">="]=1;
  56118. self._assert_($19);
  56119. $23=(4).__at((5));
  56120. $ctx1.sendIdx["@"]=15;
  56121. $22=$recv($23).__gt_eq((5).__at((5)));
  56122. self._deny_($22);
  56123. return self;
  56124. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  56125. },
  56126. args: [],
  56127. 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)",
  56128. referencedClasses: [],
  56129. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  56130. }),
  56131. $globals.PointTest);
  56132. $core.addMethod(
  56133. $core.method({
  56134. selector: "testEgality",
  56135. protocol: 'tests',
  56136. fn: function (){
  56137. var self=this;
  56138. return $core.withContext(function($ctx1) {
  56139. var $2,$3,$1,$5,$4;
  56140. $2=(3).__at((4));
  56141. $ctx1.sendIdx["@"]=1;
  56142. $3=(3).__at((4));
  56143. $ctx1.sendIdx["@"]=2;
  56144. $1=$recv($2).__eq($3);
  56145. $ctx1.sendIdx["="]=1;
  56146. self._assert_($1);
  56147. $5=(3).__at((5));
  56148. $ctx1.sendIdx["@"]=3;
  56149. $4=$recv($5).__eq((3).__at((6)));
  56150. self._deny_($4);
  56151. return self;
  56152. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  56153. },
  56154. args: [],
  56155. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  56156. referencedClasses: [],
  56157. messageSends: ["assert:", "=", "@", "deny:"]
  56158. }),
  56159. $globals.PointTest);
  56160. $core.addMethod(
  56161. $core.method({
  56162. selector: "testNew",
  56163. protocol: 'tests',
  56164. fn: function (){
  56165. var self=this;
  56166. return $core.withContext(function($ctx1) {
  56167. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  56168. $3=$recv($globals.Point)._new();
  56169. $ctx1.sendIdx["new"]=1;
  56170. $2=$recv($3)._x_((3));
  56171. $ctx1.sendIdx["x:"]=1;
  56172. $1=$recv($2)._y();
  56173. $ctx1.sendIdx["y"]=1;
  56174. self._assert_equals_($1,nil);
  56175. $ctx1.sendIdx["assert:equals:"]=1;
  56176. $7=$recv($globals.Point)._new();
  56177. $ctx1.sendIdx["new"]=2;
  56178. $6=$recv($7)._x_((3));
  56179. $5=$recv($6)._x();
  56180. $ctx1.sendIdx["x"]=1;
  56181. $4=$recv($5).__eq((0));
  56182. $ctx1.sendIdx["="]=1;
  56183. self._deny_($4);
  56184. $ctx1.sendIdx["deny:"]=1;
  56185. $10=$recv($globals.Point)._new();
  56186. $ctx1.sendIdx["new"]=3;
  56187. $9=$recv($10)._y_((4));
  56188. $ctx1.sendIdx["y:"]=1;
  56189. $8=$recv($9)._x();
  56190. self._assert_equals_($8,nil);
  56191. self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  56192. return self;
  56193. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  56194. },
  56195. args: [],
  56196. 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",
  56197. referencedClasses: ["Point"],
  56198. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  56199. }),
  56200. $globals.PointTest);
  56201. $core.addMethod(
  56202. $core.method({
  56203. selector: "testTranslateBy",
  56204. protocol: 'tests',
  56205. fn: function (){
  56206. var self=this;
  56207. return $core.withContext(function($ctx1) {
  56208. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  56209. $2=(3).__at((3));
  56210. $ctx1.sendIdx["@"]=1;
  56211. $3=(0).__at((1));
  56212. $ctx1.sendIdx["@"]=2;
  56213. $1=$recv($2)._translateBy_($3);
  56214. $ctx1.sendIdx["translateBy:"]=1;
  56215. $4=(3).__at((4));
  56216. $ctx1.sendIdx["@"]=3;
  56217. self._assert_equals_($1,$4);
  56218. $ctx1.sendIdx["assert:equals:"]=1;
  56219. $6=(3).__at((3));
  56220. $ctx1.sendIdx["@"]=4;
  56221. $8=(1)._negated();
  56222. $ctx1.sendIdx["negated"]=1;
  56223. $7=(0).__at($8);
  56224. $ctx1.sendIdx["@"]=5;
  56225. $5=$recv($6)._translateBy_($7);
  56226. $ctx1.sendIdx["translateBy:"]=2;
  56227. $9=(3).__at((2));
  56228. $ctx1.sendIdx["@"]=6;
  56229. self._assert_equals_($5,$9);
  56230. $ctx1.sendIdx["assert:equals:"]=2;
  56231. $11=(3).__at((3));
  56232. $ctx1.sendIdx["@"]=7;
  56233. $12=(2).__at((3));
  56234. $ctx1.sendIdx["@"]=8;
  56235. $10=$recv($11)._translateBy_($12);
  56236. $ctx1.sendIdx["translateBy:"]=3;
  56237. $13=(5).__at((6));
  56238. $ctx1.sendIdx["@"]=9;
  56239. self._assert_equals_($10,$13);
  56240. $ctx1.sendIdx["assert:equals:"]=3;
  56241. $15=(3).__at((3));
  56242. $ctx1.sendIdx["@"]=10;
  56243. $16=$recv((3)._negated()).__at((0));
  56244. $ctx1.sendIdx["@"]=11;
  56245. $14=$recv($15)._translateBy_($16);
  56246. self._assert_equals_($14,(0).__at((3)));
  56247. return self;
  56248. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  56249. },
  56250. args: [],
  56251. 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.",
  56252. referencedClasses: [],
  56253. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  56254. }),
  56255. $globals.PointTest);
  56256. $core.addClass('QueueTest', $globals.TestCase, [], 'Kernel-Tests');
  56257. $core.addMethod(
  56258. $core.method({
  56259. selector: "testNextIfAbsent",
  56260. protocol: 'tests',
  56261. fn: function (){
  56262. var self=this;
  56263. var queue;
  56264. return $core.withContext(function($ctx1) {
  56265. var $2,$1;
  56266. queue=$recv($globals.Queue)._new();
  56267. $recv(queue)._nextPut_("index1");
  56268. $2=$recv(queue)._nextIfAbsent_("empty");
  56269. $ctx1.sendIdx["nextIfAbsent:"]=1;
  56270. $1=$recv($2).__eq("index1");
  56271. $ctx1.sendIdx["="]=1;
  56272. self._assert_($1);
  56273. self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  56274. return self;
  56275. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  56276. },
  56277. args: [],
  56278. 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'",
  56279. referencedClasses: ["Queue"],
  56280. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  56281. }),
  56282. $globals.QueueTest);
  56283. $core.addMethod(
  56284. $core.method({
  56285. selector: "testQueueNext",
  56286. protocol: 'tests',
  56287. fn: function (){
  56288. var self=this;
  56289. var queue;
  56290. return $core.withContext(function($ctx1) {
  56291. var $1,$3,$2,$5,$4;
  56292. queue=$recv($globals.Queue)._new();
  56293. $1=queue;
  56294. $recv($1)._nextPut_("index1");
  56295. $ctx1.sendIdx["nextPut:"]=1;
  56296. $recv($1)._nextPut_("index2");
  56297. $3=$recv(queue)._next();
  56298. $ctx1.sendIdx["next"]=1;
  56299. $2=$recv($3).__eq("index1");
  56300. $ctx1.sendIdx["="]=1;
  56301. self._assert_($2);
  56302. $5=$recv(queue)._next();
  56303. $ctx1.sendIdx["next"]=2;
  56304. $4=$recv($5).__eq("index");
  56305. self._deny_($4);
  56306. self._should_raise_((function(){
  56307. return $core.withContext(function($ctx2) {
  56308. return $recv(queue)._next();
  56309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56310. }),$globals.Error);
  56311. return self;
  56312. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  56313. },
  56314. args: [],
  56315. 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",
  56316. referencedClasses: ["Queue", "Error"],
  56317. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  56318. }),
  56319. $globals.QueueTest);
  56320. $core.addClass('RandomTest', $globals.TestCase, [], 'Kernel-Tests');
  56321. $core.addMethod(
  56322. $core.method({
  56323. selector: "testAtRandomNumber",
  56324. protocol: 'tests',
  56325. fn: function (){
  56326. var self=this;
  56327. var val;
  56328. return $core.withContext(function($ctx1) {
  56329. (100)._timesRepeat_((function(){
  56330. return $core.withContext(function($ctx2) {
  56331. val=(10)._atRandom();
  56332. val;
  56333. self._assert_($recv(val).__gt((0)));
  56334. $ctx2.sendIdx["assert:"]=1;
  56335. return self._assert_($recv(val).__lt((11)));
  56336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56337. }));
  56338. return self;
  56339. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  56340. },
  56341. args: [],
  56342. 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]",
  56343. referencedClasses: [],
  56344. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  56345. }),
  56346. $globals.RandomTest);
  56347. $core.addMethod(
  56348. $core.method({
  56349. selector: "testAtRandomSequenceableCollection",
  56350. protocol: 'tests',
  56351. fn: function (){
  56352. var self=this;
  56353. var val;
  56354. return $core.withContext(function($ctx1) {
  56355. var $3,$4,$2,$1;
  56356. (100)._timesRepeat_((function(){
  56357. return $core.withContext(function($ctx2) {
  56358. val="abc"._atRandom();
  56359. val;
  56360. $3=$recv(val).__eq("a");
  56361. $ctx2.sendIdx["="]=1;
  56362. $4=$recv(val).__eq("b");
  56363. $ctx2.sendIdx["="]=2;
  56364. $2=$recv($3).__or($4);
  56365. $1=$recv($2).__or($recv(val).__eq("c"));
  56366. $ctx2.sendIdx["|"]=1;
  56367. return self._assert_($1);
  56368. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56369. }));
  56370. return self;
  56371. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  56372. },
  56373. args: [],
  56374. 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].",
  56375. referencedClasses: [],
  56376. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  56377. }),
  56378. $globals.RandomTest);
  56379. $core.addMethod(
  56380. $core.method({
  56381. selector: "textNext",
  56382. protocol: 'tests',
  56383. fn: function (){
  56384. var self=this;
  56385. return $core.withContext(function($ctx1) {
  56386. var $1;
  56387. (10000)._timesRepeat_((function(){
  56388. var current,next;
  56389. return $core.withContext(function($ctx2) {
  56390. next=$recv($recv($globals.Random)._new())._next();
  56391. next;
  56392. self._assert_($recv(next).__gt_eq((0)));
  56393. $ctx2.sendIdx["assert:"]=1;
  56394. self._assert_($recv(next).__lt((1)));
  56395. $1=$recv(current).__eq(next);
  56396. $ctx2.sendIdx["="]=1;
  56397. self._deny_($1);
  56398. return $recv(next).__eq(current);
  56399. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  56400. }));
  56401. return self;
  56402. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  56403. },
  56404. args: [],
  56405. 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 ]",
  56406. referencedClasses: ["Random"],
  56407. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  56408. }),
  56409. $globals.RandomTest);
  56410. $core.addClass('StreamTest', $globals.TestCase, [], 'Kernel-Tests');
  56411. $core.addMethod(
  56412. $core.method({
  56413. selector: "collectionClass",
  56414. protocol: 'accessing',
  56415. fn: function (){
  56416. var self=this;
  56417. return $core.withContext(function($ctx1) {
  56418. return $recv(self._class())._collectionClass();
  56419. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  56420. },
  56421. args: [],
  56422. source: "collectionClass\x0a\x09^ self class collectionClass",
  56423. referencedClasses: [],
  56424. messageSends: ["collectionClass", "class"]
  56425. }),
  56426. $globals.StreamTest);
  56427. $core.addMethod(
  56428. $core.method({
  56429. selector: "newCollection",
  56430. protocol: 'accessing',
  56431. fn: function (){
  56432. var self=this;
  56433. return $core.withContext(function($ctx1) {
  56434. return $recv(self._collectionClass())._new();
  56435. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  56436. },
  56437. args: [],
  56438. source: "newCollection\x0a\x09^ self collectionClass new",
  56439. referencedClasses: [],
  56440. messageSends: ["new", "collectionClass"]
  56441. }),
  56442. $globals.StreamTest);
  56443. $core.addMethod(
  56444. $core.method({
  56445. selector: "newStream",
  56446. protocol: 'accessing',
  56447. fn: function (){
  56448. var self=this;
  56449. return $core.withContext(function($ctx1) {
  56450. return $recv($recv(self._collectionClass())._new())._stream();
  56451. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  56452. },
  56453. args: [],
  56454. source: "newStream\x0a\x09^ self collectionClass new stream",
  56455. referencedClasses: [],
  56456. messageSends: ["stream", "new", "collectionClass"]
  56457. }),
  56458. $globals.StreamTest);
  56459. $core.addMethod(
  56460. $core.method({
  56461. selector: "testAtStartAtEnd",
  56462. protocol: 'tests',
  56463. fn: function (){
  56464. var self=this;
  56465. var stream;
  56466. return $core.withContext(function($ctx1) {
  56467. var $1,$2,$3,$4;
  56468. stream=self._newStream();
  56469. $1=$recv(stream)._atStart();
  56470. $ctx1.sendIdx["atStart"]=1;
  56471. self._assert_($1);
  56472. $ctx1.sendIdx["assert:"]=1;
  56473. $2=$recv(stream)._atEnd();
  56474. $ctx1.sendIdx["atEnd"]=1;
  56475. self._assert_($2);
  56476. $ctx1.sendIdx["assert:"]=2;
  56477. $recv(stream)._nextPutAll_(self._newCollection());
  56478. $3=$recv(stream)._atEnd();
  56479. $ctx1.sendIdx["atEnd"]=2;
  56480. self._assert_($3);
  56481. $4=$recv(stream)._atStart();
  56482. $ctx1.sendIdx["atStart"]=2;
  56483. self._deny_($4);
  56484. $ctx1.sendIdx["deny:"]=1;
  56485. $recv(stream)._position_((1));
  56486. self._deny_($recv(stream)._atEnd());
  56487. $ctx1.sendIdx["deny:"]=2;
  56488. self._deny_($recv(stream)._atStart());
  56489. return self;
  56490. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  56491. },
  56492. args: [],
  56493. 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",
  56494. referencedClasses: [],
  56495. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  56496. }),
  56497. $globals.StreamTest);
  56498. $core.addMethod(
  56499. $core.method({
  56500. selector: "testContents",
  56501. protocol: 'tests',
  56502. fn: function (){
  56503. var self=this;
  56504. var stream;
  56505. return $core.withContext(function($ctx1) {
  56506. var $1,$2;
  56507. stream=self._newStream();
  56508. $1=stream;
  56509. $2=self._newCollection();
  56510. $ctx1.sendIdx["newCollection"]=1;
  56511. $recv($1)._nextPutAll_($2);
  56512. self._assert_equals_($recv(stream)._contents(),self._newCollection());
  56513. return self;
  56514. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  56515. },
  56516. args: [],
  56517. 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",
  56518. referencedClasses: [],
  56519. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  56520. }),
  56521. $globals.StreamTest);
  56522. $core.addMethod(
  56523. $core.method({
  56524. selector: "testIsEmpty",
  56525. protocol: 'tests',
  56526. fn: function (){
  56527. var self=this;
  56528. var stream;
  56529. return $core.withContext(function($ctx1) {
  56530. var $1;
  56531. stream=self._newStream();
  56532. $1=$recv(stream)._isEmpty();
  56533. $ctx1.sendIdx["isEmpty"]=1;
  56534. self._assert_($1);
  56535. $recv(stream)._nextPutAll_(self._newCollection());
  56536. self._deny_($recv(stream)._isEmpty());
  56537. return self;
  56538. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  56539. },
  56540. args: [],
  56541. 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",
  56542. referencedClasses: [],
  56543. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  56544. }),
  56545. $globals.StreamTest);
  56546. $core.addMethod(
  56547. $core.method({
  56548. selector: "testPosition",
  56549. protocol: 'tests',
  56550. fn: function (){
  56551. var self=this;
  56552. var collection,stream;
  56553. return $core.withContext(function($ctx1) {
  56554. var $1,$2,$3;
  56555. collection=self._newCollection();
  56556. stream=self._newStream();
  56557. $recv(stream)._nextPutAll_(collection);
  56558. $1=$recv(stream)._position();
  56559. $ctx1.sendIdx["position"]=1;
  56560. self._assert_equals_($1,$recv(collection)._size());
  56561. $ctx1.sendIdx["assert:equals:"]=1;
  56562. $recv(stream)._position_((0));
  56563. $2=$recv(stream)._position();
  56564. $ctx1.sendIdx["position"]=2;
  56565. self._assert_equals_($2,(0));
  56566. $ctx1.sendIdx["assert:equals:"]=2;
  56567. $recv(stream)._next();
  56568. $ctx1.sendIdx["next"]=1;
  56569. $3=$recv(stream)._position();
  56570. $ctx1.sendIdx["position"]=3;
  56571. self._assert_equals_($3,(1));
  56572. $ctx1.sendIdx["assert:equals:"]=3;
  56573. $recv(stream)._next();
  56574. self._assert_equals_($recv(stream)._position(),(2));
  56575. return self;
  56576. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  56577. },
  56578. args: [],
  56579. 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",
  56580. referencedClasses: [],
  56581. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  56582. }),
  56583. $globals.StreamTest);
  56584. $core.addMethod(
  56585. $core.method({
  56586. selector: "testReading",
  56587. protocol: 'tests',
  56588. fn: function (){
  56589. var self=this;
  56590. var stream,collection;
  56591. return $core.withContext(function($ctx1) {
  56592. var $1,$2;
  56593. collection=self._newCollection();
  56594. stream=self._newStream();
  56595. $1=stream;
  56596. $recv($1)._nextPutAll_(collection);
  56597. $recv($1)._position_((0));
  56598. $recv(collection)._do_((function(each){
  56599. return $core.withContext(function($ctx2) {
  56600. $2=$recv(stream)._next();
  56601. $ctx2.sendIdx["next"]=1;
  56602. return self._assert_equals_($2,each);
  56603. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56604. }));
  56605. self._assert_($recv($recv(stream)._next())._isNil());
  56606. return self;
  56607. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  56608. },
  56609. args: [],
  56610. 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",
  56611. referencedClasses: [],
  56612. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  56613. }),
  56614. $globals.StreamTest);
  56615. $core.addMethod(
  56616. $core.method({
  56617. selector: "testStreamContents",
  56618. protocol: 'tests',
  56619. fn: function (){
  56620. var self=this;
  56621. return self;
  56622. },
  56623. args: [],
  56624. source: "testStreamContents",
  56625. referencedClasses: [],
  56626. messageSends: []
  56627. }),
  56628. $globals.StreamTest);
  56629. $core.addMethod(
  56630. $core.method({
  56631. selector: "testWrite",
  56632. protocol: 'tests',
  56633. fn: function (){
  56634. var self=this;
  56635. var stream,collection;
  56636. return $core.withContext(function($ctx1) {
  56637. collection=self._newCollection();
  56638. stream=self._newStream();
  56639. $recv(collection)._do_((function(each){
  56640. return $core.withContext(function($ctx2) {
  56641. return $recv(stream).__lt_lt(each);
  56642. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56643. }));
  56644. self._assert_equals_($recv(stream)._contents(),collection);
  56645. return self;
  56646. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  56647. },
  56648. args: [],
  56649. 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",
  56650. referencedClasses: [],
  56651. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  56652. }),
  56653. $globals.StreamTest);
  56654. $core.addMethod(
  56655. $core.method({
  56656. selector: "testWriting",
  56657. protocol: 'tests',
  56658. fn: function (){
  56659. var self=this;
  56660. var stream,collection;
  56661. return $core.withContext(function($ctx1) {
  56662. var $1;
  56663. collection=self._newCollection();
  56664. stream=self._newStream();
  56665. $ctx1.sendIdx["newStream"]=1;
  56666. $recv(collection)._do_((function(each){
  56667. return $core.withContext(function($ctx2) {
  56668. return $recv(stream)._nextPut_(each);
  56669. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56670. }));
  56671. $1=$recv(stream)._contents();
  56672. $ctx1.sendIdx["contents"]=1;
  56673. self._assert_equals_($1,collection);
  56674. $ctx1.sendIdx["assert:equals:"]=1;
  56675. stream=self._newStream();
  56676. $recv(stream)._nextPutAll_(collection);
  56677. self._assert_equals_($recv(stream)._contents(),collection);
  56678. return self;
  56679. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  56680. },
  56681. args: [],
  56682. 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",
  56683. referencedClasses: [],
  56684. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  56685. }),
  56686. $globals.StreamTest);
  56687. $core.addMethod(
  56688. $core.method({
  56689. selector: "collectionClass",
  56690. protocol: 'accessing',
  56691. fn: function (){
  56692. var self=this;
  56693. return nil;
  56694. },
  56695. args: [],
  56696. source: "collectionClass\x0a\x09^ nil",
  56697. referencedClasses: [],
  56698. messageSends: []
  56699. }),
  56700. $globals.StreamTest.klass);
  56701. $core.addMethod(
  56702. $core.method({
  56703. selector: "isAbstract",
  56704. protocol: 'testing',
  56705. fn: function (){
  56706. var self=this;
  56707. return $core.withContext(function($ctx1) {
  56708. return $recv(self._collectionClass())._isNil();
  56709. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)});
  56710. },
  56711. args: [],
  56712. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  56713. referencedClasses: [],
  56714. messageSends: ["isNil", "collectionClass"]
  56715. }),
  56716. $globals.StreamTest.klass);
  56717. $core.addClass('ArrayStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  56718. $core.addMethod(
  56719. $core.method({
  56720. selector: "newCollection",
  56721. protocol: 'accessing',
  56722. fn: function (){
  56723. var self=this;
  56724. return $core.withContext(function($ctx1) {
  56725. return [true,(1),(3).__at((4)),"foo"];
  56726. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  56727. },
  56728. args: [],
  56729. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  56730. referencedClasses: [],
  56731. messageSends: ["@"]
  56732. }),
  56733. $globals.ArrayStreamTest);
  56734. $core.addMethod(
  56735. $core.method({
  56736. selector: "collectionClass",
  56737. protocol: 'accessing',
  56738. fn: function (){
  56739. var self=this;
  56740. return $globals.Array;
  56741. },
  56742. args: [],
  56743. source: "collectionClass\x0a\x09^ Array",
  56744. referencedClasses: ["Array"],
  56745. messageSends: []
  56746. }),
  56747. $globals.ArrayStreamTest.klass);
  56748. $core.addClass('StringStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  56749. $core.addMethod(
  56750. $core.method({
  56751. selector: "newCollection",
  56752. protocol: 'accessing',
  56753. fn: function (){
  56754. var self=this;
  56755. return "hello world";
  56756. },
  56757. args: [],
  56758. source: "newCollection\x0a\x09^ 'hello world'",
  56759. referencedClasses: [],
  56760. messageSends: []
  56761. }),
  56762. $globals.StringStreamTest);
  56763. $core.addMethod(
  56764. $core.method({
  56765. selector: "collectionClass",
  56766. protocol: 'accessing',
  56767. fn: function (){
  56768. var self=this;
  56769. return $globals.String;
  56770. },
  56771. args: [],
  56772. source: "collectionClass\x0a\x09^ String",
  56773. referencedClasses: ["String"],
  56774. messageSends: []
  56775. }),
  56776. $globals.StringStreamTest.klass);
  56777. $core.addClass('UndefinedTest', $globals.TestCase, [], 'Kernel-Tests');
  56778. $core.addMethod(
  56779. $core.method({
  56780. selector: "testCopying",
  56781. protocol: 'tests',
  56782. fn: function (){
  56783. var self=this;
  56784. return $core.withContext(function($ctx1) {
  56785. self._assert_equals_(nil._copy(),nil);
  56786. return self;
  56787. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  56788. },
  56789. args: [],
  56790. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  56791. referencedClasses: [],
  56792. messageSends: ["assert:equals:", "copy"]
  56793. }),
  56794. $globals.UndefinedTest);
  56795. $core.addMethod(
  56796. $core.method({
  56797. selector: "testDeepCopy",
  56798. protocol: 'tests',
  56799. fn: function (){
  56800. var self=this;
  56801. return $core.withContext(function($ctx1) {
  56802. self._assert_($recv(nil._deepCopy()).__eq(nil));
  56803. return self;
  56804. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  56805. },
  56806. args: [],
  56807. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  56808. referencedClasses: [],
  56809. messageSends: ["assert:", "=", "deepCopy"]
  56810. }),
  56811. $globals.UndefinedTest);
  56812. $core.addMethod(
  56813. $core.method({
  56814. selector: "testIfNil",
  56815. protocol: 'tests',
  56816. fn: function (){
  56817. var self=this;
  56818. return $core.withContext(function($ctx1) {
  56819. var $1,$3,$2,$4,$6,$5,$receiver;
  56820. if(($receiver = nil) == null || $receiver.isNil){
  56821. $1=true;
  56822. } else {
  56823. $1=nil;
  56824. };
  56825. self._assert_equals_($1,true);
  56826. $ctx1.sendIdx["assert:equals:"]=1;
  56827. if(($receiver = nil) == null || $receiver.isNil){
  56828. $3=nil;
  56829. } else {
  56830. $3=true;
  56831. };
  56832. $2=$recv($3).__eq(true);
  56833. $ctx1.sendIdx["="]=1;
  56834. self._deny_($2);
  56835. $ctx1.sendIdx["deny:"]=1;
  56836. if(($receiver = nil) == null || $receiver.isNil){
  56837. $4=true;
  56838. } else {
  56839. $4=false;
  56840. };
  56841. self._assert_equals_($4,true);
  56842. if(($receiver = nil) == null || $receiver.isNil){
  56843. $6=false;
  56844. } else {
  56845. $6=true;
  56846. };
  56847. $5=$recv($6).__eq(true);
  56848. self._deny_($5);
  56849. return self;
  56850. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  56851. },
  56852. args: [],
  56853. 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",
  56854. referencedClasses: [],
  56855. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  56856. }),
  56857. $globals.UndefinedTest);
  56858. $core.addMethod(
  56859. $core.method({
  56860. selector: "testIsNil",
  56861. protocol: 'tests',
  56862. fn: function (){
  56863. var self=this;
  56864. return $core.withContext(function($ctx1) {
  56865. self._assert_(nil._isNil());
  56866. self._deny_(nil._notNil());
  56867. return self;
  56868. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  56869. },
  56870. args: [],
  56871. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  56872. referencedClasses: [],
  56873. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  56874. }),
  56875. $globals.UndefinedTest);
  56876. });
  56877. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  56878. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  56879. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  56880. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  56881. $core.addPackage('SUnit-Tests');
  56882. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  56883. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  56884. $core.addClass('ExampleSetTest', $globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
  56885. $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.";
  56886. $core.addMethod(
  56887. $core.method({
  56888. selector: "setUp",
  56889. protocol: 'running',
  56890. fn: function (){
  56891. var self=this;
  56892. return $core.withContext(function($ctx1) {
  56893. self["@empty"]=$recv($globals.Set)._new();
  56894. self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  56895. return self;
  56896. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  56897. },
  56898. args: [],
  56899. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  56900. referencedClasses: ["Set"],
  56901. messageSends: ["new", "with:with:"]
  56902. }),
  56903. $globals.ExampleSetTest);
  56904. $core.addMethod(
  56905. $core.method({
  56906. selector: "testAdd",
  56907. protocol: 'tests',
  56908. fn: function (){
  56909. var self=this;
  56910. return $core.withContext(function($ctx1) {
  56911. $recv(self["@empty"])._add_((5));
  56912. self._assert_($recv(self["@empty"])._includes_((5)));
  56913. return self;
  56914. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  56915. },
  56916. args: [],
  56917. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  56918. referencedClasses: [],
  56919. messageSends: ["add:", "assert:", "includes:"]
  56920. }),
  56921. $globals.ExampleSetTest);
  56922. $core.addMethod(
  56923. $core.method({
  56924. selector: "testGrow",
  56925. protocol: 'tests',
  56926. fn: function (){
  56927. var self=this;
  56928. return $core.withContext(function($ctx1) {
  56929. $recv(self["@empty"])._addAll_((1)._to_((100)));
  56930. self._assert_equals_($recv(self["@empty"])._size(),(100));
  56931. return self;
  56932. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  56933. },
  56934. args: [],
  56935. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  56936. referencedClasses: [],
  56937. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  56938. }),
  56939. $globals.ExampleSetTest);
  56940. $core.addMethod(
  56941. $core.method({
  56942. selector: "testIllegal",
  56943. protocol: 'tests',
  56944. fn: function (){
  56945. var self=this;
  56946. return $core.withContext(function($ctx1) {
  56947. self._should_raise_((function(){
  56948. return $core.withContext(function($ctx2) {
  56949. return $recv(self["@empty"])._at_((5));
  56950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56951. }),$globals.Error);
  56952. $ctx1.sendIdx["should:raise:"]=1;
  56953. self._should_raise_((function(){
  56954. return $core.withContext(function($ctx2) {
  56955. return $recv(self["@empty"])._at_put_((5),"abc");
  56956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56957. }),$globals.Error);
  56958. return self;
  56959. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  56960. },
  56961. args: [],
  56962. 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",
  56963. referencedClasses: ["Error"],
  56964. messageSends: ["should:raise:", "at:", "at:put:"]
  56965. }),
  56966. $globals.ExampleSetTest);
  56967. $core.addMethod(
  56968. $core.method({
  56969. selector: "testIncludes",
  56970. protocol: 'tests',
  56971. fn: function (){
  56972. var self=this;
  56973. return $core.withContext(function($ctx1) {
  56974. var $1;
  56975. $1=$recv(self["@full"])._includes_((5));
  56976. $ctx1.sendIdx["includes:"]=1;
  56977. self._assert_($1);
  56978. $ctx1.sendIdx["assert:"]=1;
  56979. self._assert_($recv(self["@full"])._includes_("abc"));
  56980. return self;
  56981. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  56982. },
  56983. args: [],
  56984. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  56985. referencedClasses: [],
  56986. messageSends: ["assert:", "includes:"]
  56987. }),
  56988. $globals.ExampleSetTest);
  56989. $core.addMethod(
  56990. $core.method({
  56991. selector: "testOccurrences",
  56992. protocol: 'tests',
  56993. fn: function (){
  56994. var self=this;
  56995. return $core.withContext(function($ctx1) {
  56996. var $1,$2;
  56997. $1=$recv(self["@empty"])._occurrencesOf_((0));
  56998. $ctx1.sendIdx["occurrencesOf:"]=1;
  56999. self._assert_equals_($1,(0));
  57000. $ctx1.sendIdx["assert:equals:"]=1;
  57001. $2=$recv(self["@full"])._occurrencesOf_((5));
  57002. $ctx1.sendIdx["occurrencesOf:"]=2;
  57003. self._assert_equals_($2,(1));
  57004. $ctx1.sendIdx["assert:equals:"]=2;
  57005. $recv(self["@full"])._add_((5));
  57006. self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1));
  57007. return self;
  57008. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  57009. },
  57010. args: [],
  57011. 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",
  57012. referencedClasses: [],
  57013. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  57014. }),
  57015. $globals.ExampleSetTest);
  57016. $core.addMethod(
  57017. $core.method({
  57018. selector: "testRemove",
  57019. protocol: 'tests',
  57020. fn: function (){
  57021. var self=this;
  57022. return $core.withContext(function($ctx1) {
  57023. var $1;
  57024. $recv(self["@full"])._remove_((5));
  57025. $1=$recv(self["@full"])._includes_("abc");
  57026. $ctx1.sendIdx["includes:"]=1;
  57027. self._assert_($1);
  57028. self._deny_($recv(self["@full"])._includes_((5)));
  57029. return self;
  57030. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  57031. },
  57032. args: [],
  57033. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  57034. referencedClasses: [],
  57035. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  57036. }),
  57037. $globals.ExampleSetTest);
  57038. $core.addClass('SUnitAsyncTest', $globals.TestCase, ['flag'], 'SUnit-Tests');
  57039. $core.addMethod(
  57040. $core.method({
  57041. selector: "fakeError",
  57042. protocol: 'helpers',
  57043. fn: function (){
  57044. var self=this;
  57045. return $core.withContext(function($ctx1) {
  57046. self["@flag"]="bad";
  57047. self._timeout_((30));
  57048. self["@flag"]=$recv(self._async_((function(){
  57049. return $core.withContext(function($ctx2) {
  57050. self["@flag"]="ok";
  57051. self["@flag"];
  57052. return self._error_("Intentional");
  57053. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57054. })))._valueWithTimeout_((20));
  57055. return self;
  57056. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  57057. },
  57058. args: [],
  57059. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  57060. referencedClasses: [],
  57061. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  57062. }),
  57063. $globals.SUnitAsyncTest);
  57064. $core.addMethod(
  57065. $core.method({
  57066. selector: "fakeErrorFailingInTearDown",
  57067. protocol: 'helpers',
  57068. fn: function (){
  57069. var self=this;
  57070. return $core.withContext(function($ctx1) {
  57071. self["@flag"]="bad";
  57072. self._timeout_((30));
  57073. self["@flag"]=$recv(self._async_((function(){
  57074. return $core.withContext(function($ctx2) {
  57075. return self._error_("Intentional");
  57076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57077. })))._valueWithTimeout_((20));
  57078. return self;
  57079. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  57080. },
  57081. args: [],
  57082. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  57083. referencedClasses: [],
  57084. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  57085. }),
  57086. $globals.SUnitAsyncTest);
  57087. $core.addMethod(
  57088. $core.method({
  57089. selector: "fakeFailure",
  57090. protocol: 'helpers',
  57091. fn: function (){
  57092. var self=this;
  57093. return $core.withContext(function($ctx1) {
  57094. self["@flag"]="bad";
  57095. self._timeout_((30));
  57096. self["@flag"]=$recv(self._async_((function(){
  57097. return $core.withContext(function($ctx2) {
  57098. self["@flag"]="ok";
  57099. self["@flag"];
  57100. return self._assert_(false);
  57101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57102. })))._valueWithTimeout_((20));
  57103. return self;
  57104. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  57105. },
  57106. args: [],
  57107. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  57108. referencedClasses: [],
  57109. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  57110. }),
  57111. $globals.SUnitAsyncTest);
  57112. $core.addMethod(
  57113. $core.method({
  57114. selector: "fakeMultipleTimeoutFailing",
  57115. protocol: 'helpers',
  57116. fn: function (){
  57117. var self=this;
  57118. return $core.withContext(function($ctx1) {
  57119. var $1;
  57120. self._timeout_((100));
  57121. $ctx1.sendIdx["timeout:"]=1;
  57122. $1=self._async_((function(){
  57123. return $core.withContext(function($ctx2) {
  57124. self._timeout_((20));
  57125. return $recv(self._async_((function(){
  57126. return $core.withContext(function($ctx3) {
  57127. return self._finished();
  57128. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57129. })))._valueWithTimeout_((30));
  57130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57131. }));
  57132. $ctx1.sendIdx["async:"]=1;
  57133. $recv($1)._valueWithTimeout_((20));
  57134. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57135. return self;
  57136. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  57137. },
  57138. args: [],
  57139. 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",
  57140. referencedClasses: [],
  57141. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  57142. }),
  57143. $globals.SUnitAsyncTest);
  57144. $core.addMethod(
  57145. $core.method({
  57146. selector: "fakeMultipleTimeoutPassing",
  57147. protocol: 'helpers',
  57148. fn: function (){
  57149. var self=this;
  57150. return $core.withContext(function($ctx1) {
  57151. var $1;
  57152. self._timeout_((20));
  57153. $ctx1.sendIdx["timeout:"]=1;
  57154. $1=self._async_((function(){
  57155. return $core.withContext(function($ctx2) {
  57156. self._timeout_((40));
  57157. return $recv(self._async_((function(){
  57158. return $core.withContext(function($ctx3) {
  57159. return self._finished();
  57160. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57161. })))._valueWithTimeout_((20));
  57162. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57163. }));
  57164. $ctx1.sendIdx["async:"]=1;
  57165. $recv($1)._valueWithTimeout_((10));
  57166. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57167. return self;
  57168. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  57169. },
  57170. args: [],
  57171. 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",
  57172. referencedClasses: [],
  57173. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  57174. }),
  57175. $globals.SUnitAsyncTest);
  57176. $core.addMethod(
  57177. $core.method({
  57178. selector: "fakeTimeout",
  57179. protocol: 'helpers',
  57180. fn: function (){
  57181. var self=this;
  57182. return $core.withContext(function($ctx1) {
  57183. self._timeout_((10));
  57184. $recv(self._async_((function(){
  57185. return $core.withContext(function($ctx2) {
  57186. return self._finished();
  57187. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57188. })))._valueWithTimeout_((20));
  57189. return self;
  57190. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  57191. },
  57192. args: [],
  57193. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  57194. referencedClasses: [],
  57195. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  57196. }),
  57197. $globals.SUnitAsyncTest);
  57198. $core.addMethod(
  57199. $core.method({
  57200. selector: "selectorSetOf:",
  57201. protocol: 'private',
  57202. fn: function (aCollection){
  57203. var self=this;
  57204. return $core.withContext(function($ctx1) {
  57205. return $recv($recv(aCollection)._collect_((function(each){
  57206. return $core.withContext(function($ctx2) {
  57207. return $recv(each)._selector();
  57208. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57209. })))._asSet();
  57210. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  57211. },
  57212. args: ["aCollection"],
  57213. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  57214. referencedClasses: [],
  57215. messageSends: ["asSet", "collect:", "selector"]
  57216. }),
  57217. $globals.SUnitAsyncTest);
  57218. $core.addMethod(
  57219. $core.method({
  57220. selector: "setUp",
  57221. protocol: 'running',
  57222. fn: function (){
  57223. var self=this;
  57224. self["@flag"]="ok";
  57225. return self;
  57226. },
  57227. args: [],
  57228. source: "setUp\x0a\x09flag := 'ok'",
  57229. referencedClasses: [],
  57230. messageSends: []
  57231. }),
  57232. $globals.SUnitAsyncTest);
  57233. $core.addMethod(
  57234. $core.method({
  57235. selector: "tearDown",
  57236. protocol: 'running',
  57237. fn: function (){
  57238. var self=this;
  57239. return $core.withContext(function($ctx1) {
  57240. self._assert_equals_("ok",self["@flag"]);
  57241. return self;
  57242. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  57243. },
  57244. args: [],
  57245. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  57246. referencedClasses: [],
  57247. messageSends: ["assert:equals:"]
  57248. }),
  57249. $globals.SUnitAsyncTest);
  57250. $core.addMethod(
  57251. $core.method({
  57252. selector: "testAsyncErrorsAndFailures",
  57253. protocol: 'tests',
  57254. fn: function (){
  57255. var self=this;
  57256. var suite,runner,result,assertBlock;
  57257. return $core.withContext(function($ctx1) {
  57258. var $1,$2,$3,$4;
  57259. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  57260. return $core.withContext(function($ctx2) {
  57261. return $recv(self._class())._selector_(each);
  57262. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57263. }));
  57264. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  57265. self._timeout_((200));
  57266. result=$recv(runner)._result();
  57267. $ctx1.sendIdx["result"]=1;
  57268. assertBlock=self._async_((function(){
  57269. return $core.withContext(function($ctx2) {
  57270. $1=self._selectorSetOf_($recv(result)._errors());
  57271. $ctx2.sendIdx["selectorSetOf:"]=1;
  57272. $2=["fakeError"]._asSet();
  57273. $ctx2.sendIdx["asSet"]=1;
  57274. self._assert_equals_($1,$2);
  57275. $ctx2.sendIdx["assert:equals:"]=1;
  57276. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  57277. return self._finished();
  57278. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57279. }));
  57280. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  57281. return $core.withContext(function($ctx2) {
  57282. $3=$recv($recv(ann)._result()).__eq_eq(result);
  57283. if($core.assert($3)){
  57284. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  57285. return $recv($4)._ifTrue_(assertBlock);
  57286. };
  57287. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  57288. }));
  57289. $recv(runner)._run();
  57290. return self;
  57291. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  57292. },
  57293. args: [],
  57294. 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",
  57295. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  57296. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  57297. }),
  57298. $globals.SUnitAsyncTest);
  57299. $core.addMethod(
  57300. $core.method({
  57301. selector: "testAsyncNeedsTimeout",
  57302. protocol: 'tests',
  57303. fn: function (){
  57304. var self=this;
  57305. return $core.withContext(function($ctx1) {
  57306. self._should_raise_((function(){
  57307. return $core.withContext(function($ctx2) {
  57308. return self._async_((function(){
  57309. }));
  57310. $ctx2.sendIdx["async:"]=1;
  57311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57312. }),$globals.Error);
  57313. self._timeout_((0));
  57314. self._shouldnt_raise_((function(){
  57315. return $core.withContext(function($ctx2) {
  57316. return self._async_((function(){
  57317. }));
  57318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  57319. }),$globals.Error);
  57320. self._finished();
  57321. return self;
  57322. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  57323. },
  57324. args: [],
  57325. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  57326. referencedClasses: ["Error"],
  57327. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  57328. }),
  57329. $globals.SUnitAsyncTest);
  57330. $core.addMethod(
  57331. $core.method({
  57332. selector: "testFinishedNeedsTimeout",
  57333. protocol: 'tests',
  57334. fn: function (){
  57335. var self=this;
  57336. return $core.withContext(function($ctx1) {
  57337. self._should_raise_((function(){
  57338. return $core.withContext(function($ctx2) {
  57339. return self._finished();
  57340. $ctx2.sendIdx["finished"]=1;
  57341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57342. }),$globals.Error);
  57343. self._timeout_((0));
  57344. self._shouldnt_raise_((function(){
  57345. return $core.withContext(function($ctx2) {
  57346. return self._finished();
  57347. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57348. }),$globals.Error);
  57349. return self;
  57350. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  57351. },
  57352. args: [],
  57353. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  57354. referencedClasses: ["Error"],
  57355. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  57356. }),
  57357. $globals.SUnitAsyncTest);
  57358. $core.addMethod(
  57359. $core.method({
  57360. selector: "testIsAsyncReturnsCorrectValues",
  57361. protocol: 'tests',
  57362. fn: function (){
  57363. var self=this;
  57364. return $core.withContext(function($ctx1) {
  57365. var $1,$2;
  57366. $1=self._isAsync();
  57367. $ctx1.sendIdx["isAsync"]=1;
  57368. self._deny_($1);
  57369. $ctx1.sendIdx["deny:"]=1;
  57370. self._timeout_((0));
  57371. $2=self._isAsync();
  57372. $ctx1.sendIdx["isAsync"]=2;
  57373. self._assert_($2);
  57374. self._finished();
  57375. self._deny_(self._isAsync());
  57376. return self;
  57377. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  57378. },
  57379. args: [],
  57380. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  57381. referencedClasses: [],
  57382. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  57383. }),
  57384. $globals.SUnitAsyncTest);
  57385. $core.addMethod(
  57386. $core.method({
  57387. selector: "testPass",
  57388. protocol: 'tests',
  57389. fn: function (){
  57390. var self=this;
  57391. return $core.withContext(function($ctx1) {
  57392. self["@flag"]="bad";
  57393. self._timeout_((10));
  57394. self["@flag"]=$recv(self._async_((function(){
  57395. return $core.withContext(function($ctx2) {
  57396. self._assert_(true);
  57397. self._finished();
  57398. self["@flag"]="ok";
  57399. return self["@flag"];
  57400. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57401. })))._valueWithTimeout_((5));
  57402. return self;
  57403. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  57404. },
  57405. args: [],
  57406. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  57407. referencedClasses: [],
  57408. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  57409. }),
  57410. $globals.SUnitAsyncTest);
  57411. $core.addMethod(
  57412. $core.method({
  57413. selector: "testTimeouts",
  57414. protocol: 'tests',
  57415. fn: function (){
  57416. var self=this;
  57417. var suite,runner,result,assertBlock;
  57418. return $core.withContext(function($ctx1) {
  57419. var $1,$2,$3;
  57420. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  57421. return $core.withContext(function($ctx2) {
  57422. return $recv(self._class())._selector_(each);
  57423. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57424. }));
  57425. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  57426. self._timeout_((200));
  57427. result=$recv(runner)._result();
  57428. $ctx1.sendIdx["result"]=1;
  57429. assertBlock=self._async_((function(){
  57430. return $core.withContext(function($ctx2) {
  57431. $1=self._selectorSetOf_($recv(result)._errors());
  57432. $ctx2.sendIdx["selectorSetOf:"]=1;
  57433. self._assert_equals_($1,$recv($globals.Set)._new());
  57434. $ctx2.sendIdx["assert:equals:"]=1;
  57435. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  57436. return self._finished();
  57437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57438. }));
  57439. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  57440. return $core.withContext(function($ctx2) {
  57441. $2=$recv($recv(ann)._result()).__eq_eq(result);
  57442. if($core.assert($2)){
  57443. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  57444. return $recv($3)._ifTrue_(assertBlock);
  57445. };
  57446. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  57447. }));
  57448. $recv(runner)._run();
  57449. return self;
  57450. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  57451. },
  57452. args: [],
  57453. 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",
  57454. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  57455. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  57456. }),
  57457. $globals.SUnitAsyncTest);
  57458. $core.addMethod(
  57459. $core.method({
  57460. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  57461. protocol: 'tests',
  57462. fn: function (){
  57463. var self=this;
  57464. var x;
  57465. return $core.withContext(function($ctx1) {
  57466. var $1;
  57467. self["@flag"]="bad";
  57468. self._timeout_((10));
  57469. x=(0);
  57470. $1=self._async_((function(){
  57471. return $core.withContext(function($ctx2) {
  57472. self._finished();
  57473. $ctx2.sendIdx["finished"]=1;
  57474. self["@flag"]="ok";
  57475. self["@flag"];
  57476. x=$recv(x).__plus((1));
  57477. $ctx2.sendIdx["+"]=1;
  57478. x;
  57479. return self._assert_equals_(x,(1));
  57480. $ctx2.sendIdx["assert:equals:"]=1;
  57481. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57482. }));
  57483. $ctx1.sendIdx["async:"]=1;
  57484. self["@flag"]=$recv($1)._valueWithTimeout_((0));
  57485. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57486. self["@flag"]=$recv(self._async_((function(){
  57487. return $core.withContext(function($ctx2) {
  57488. self._finished();
  57489. self["@flag"]="ok";
  57490. self["@flag"];
  57491. x=$recv(x).__plus((1));
  57492. x;
  57493. return self._assert_equals_(x,(1));
  57494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57495. })))._valueWithTimeout_((0));
  57496. return self;
  57497. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  57498. },
  57499. args: [],
  57500. 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.",
  57501. referencedClasses: [],
  57502. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  57503. }),
  57504. $globals.SUnitAsyncTest);
  57505. });
  57506. define('amber/devel',[
  57507. './lang',
  57508. './compatibility', // pre-fetch, dep of ./boot
  57509. './boot', // pre-fetch, dep of ./helpers
  57510. './helpers', // pre-fetch, dep of ./deploy
  57511. './deploy', // pre-fetch, dep of ./lang
  57512. // --- packages of the development only Amber begin here ---
  57513. 'amber_core/SUnit',
  57514. 'amber_core/Compiler-Tests',
  57515. 'amber_core/Kernel-Tests',
  57516. 'amber_core/SUnit-Tests'
  57517. // --- packages of the development only Amber end here ---
  57518. ], function (amber) { return amber; });
  57519. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  57520. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  57521. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  57522. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  57523. $core.addPackage('AmberCli');
  57524. $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
  57525. $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  57526. $core.addClass('AmberCli', $globals.Object, [], 'AmberCli');
  57527. $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.";
  57528. $core.addMethod(
  57529. $core.method({
  57530. selector: "commandLineSwitches",
  57531. protocol: 'commandline',
  57532. fn: function (){
  57533. var self=this;
  57534. var switches;
  57535. return $core.withContext(function($ctx1) {
  57536. switches=$recv($recv(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  57537. return $core.withContext(function($ctx2) {
  57538. return $recv(each)._selector();
  57539. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57540. }));
  57541. $ctx1.sendIdx["collect:"]=1;
  57542. switches=$recv(switches)._select_((function(each){
  57543. return $core.withContext(function($ctx2) {
  57544. return $recv(each)._match_("^[^:]*:$");
  57545. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  57546. }));
  57547. switches=$recv(switches)._collect_((function(each){
  57548. return $core.withContext(function($ctx2) {
  57549. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  57550. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  57551. }));
  57552. return switches;
  57553. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.klass)});
  57554. },
  57555. args: [],
  57556. 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",
  57557. referencedClasses: [],
  57558. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  57559. }),
  57560. $globals.AmberCli.klass);
  57561. $core.addMethod(
  57562. $core.method({
  57563. selector: "config:",
  57564. protocol: 'commands',
  57565. fn: function (args){
  57566. var self=this;
  57567. return $core.withContext(function($ctx1) {
  57568. $recv($recv($globals.Configurator)._new())._start();
  57569. return self;
  57570. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.klass)});
  57571. },
  57572. args: ["args"],
  57573. source: "config: args\x0a\x09Configurator new start",
  57574. referencedClasses: ["Configurator"],
  57575. messageSends: ["start", "new"]
  57576. }),
  57577. $globals.AmberCli.klass);
  57578. $core.addMethod(
  57579. $core.method({
  57580. selector: "handleArguments:",
  57581. protocol: 'commandline',
  57582. fn: function (args){
  57583. var self=this;
  57584. var selector;
  57585. return $core.withContext(function($ctx1) {
  57586. var $1;
  57587. $1=$recv(args)._first();
  57588. $ctx1.sendIdx["first"]=1;
  57589. selector=self._selectorForCommandLineSwitch_($1);
  57590. $recv(args)._remove_($recv(args)._first());
  57591. self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  57592. return self;
  57593. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.klass)});
  57594. },
  57595. args: ["args"],
  57596. 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)",
  57597. referencedClasses: ["Array"],
  57598. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  57599. }),
  57600. $globals.AmberCli.klass);
  57601. $core.addMethod(
  57602. $core.method({
  57603. selector: "help:",
  57604. protocol: 'commands',
  57605. fn: function (args){
  57606. var self=this;
  57607. return $core.withContext(function($ctx1) {
  57608. $recv($globals.Transcript)._show_("Available commands");
  57609. $recv(self._commandLineSwitches())._do_((function(each){
  57610. return $core.withContext(function($ctx2) {
  57611. return $recv(console)._log_(each);
  57612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57613. }));
  57614. return self;
  57615. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.klass)});
  57616. },
  57617. args: ["args"],
  57618. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  57619. referencedClasses: ["Transcript"],
  57620. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  57621. }),
  57622. $globals.AmberCli.klass);
  57623. $core.addMethod(
  57624. $core.method({
  57625. selector: "init:",
  57626. protocol: 'commands',
  57627. fn: function (args){
  57628. var self=this;
  57629. return $core.withContext(function($ctx1) {
  57630. $recv($recv($globals.Initer)._new())._start();
  57631. return self;
  57632. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.klass)});
  57633. },
  57634. args: ["args"],
  57635. source: "init: args\x0a\x09Initer new start",
  57636. referencedClasses: ["Initer"],
  57637. messageSends: ["start", "new"]
  57638. }),
  57639. $globals.AmberCli.klass);
  57640. $core.addMethod(
  57641. $core.method({
  57642. selector: "main",
  57643. protocol: 'startup',
  57644. fn: function (){
  57645. var self=this;
  57646. var args,packageJSON;
  57647. return $core.withContext(function($ctx1) {
  57648. var $7,$6,$5,$4,$3,$2,$1;
  57649. var $early={};
  57650. try {
  57651. packageJSON=$recv(require)._value_("../package.json");
  57652. $7=$recv(packageJSON)._version();
  57653. $ctx1.sendIdx["version"]=1;
  57654. $6="Welcome to Amber CLI version ".__comma($7);
  57655. $5=$recv($6).__comma(" (Amber ");
  57656. $ctx1.sendIdx[","]=5;
  57657. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  57658. $ctx1.sendIdx[","]=4;
  57659. $3=$recv($4).__comma(", NodeJS ");
  57660. $ctx1.sendIdx[","]=3;
  57661. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  57662. $ctx1.sendIdx[","]=2;
  57663. $1=$recv($2).__comma(").");
  57664. $ctx1.sendIdx[","]=1;
  57665. $recv($globals.Transcript)._show_($1);
  57666. args=$recv(process)._argv();
  57667. $recv(args)._removeFrom_to_((1),(2));
  57668. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  57669. return $core.withContext(function($ctx2) {
  57670. return self._help_(nil);
  57671. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57672. }),(function(){
  57673. return $core.withContext(function($ctx2) {
  57674. throw $early=[self._handleArguments_(args)];
  57675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57676. }));
  57677. return self;
  57678. }
  57679. catch(e) {if(e===$early)return e[0]; throw e}
  57680. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.klass)});
  57681. },
  57682. args: [],
  57683. 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]",
  57684. referencedClasses: ["Transcript", "Smalltalk"],
  57685. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  57686. }),
  57687. $globals.AmberCli.klass);
  57688. $core.addMethod(
  57689. $core.method({
  57690. selector: "repl:",
  57691. protocol: 'commands',
  57692. fn: function (args){
  57693. var self=this;
  57694. return $core.withContext(function($ctx1) {
  57695. return $recv($recv($globals.Repl)._new())._createInterface();
  57696. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.klass)});
  57697. },
  57698. args: ["args"],
  57699. source: "repl: args\x0a\x09^ Repl new createInterface",
  57700. referencedClasses: ["Repl"],
  57701. messageSends: ["createInterface", "new"]
  57702. }),
  57703. $globals.AmberCli.klass);
  57704. $core.addMethod(
  57705. $core.method({
  57706. selector: "selectorForCommandLineSwitch:",
  57707. protocol: 'commandline',
  57708. fn: function (aSwitch){
  57709. var self=this;
  57710. var command,selector;
  57711. return $core.withContext(function($ctx1) {
  57712. var $1;
  57713. $1=$recv(self._commandLineSwitches())._includes_(aSwitch);
  57714. if($core.assert($1)){
  57715. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  57716. return $core.withContext(function($ctx2) {
  57717. return $recv($recv(each)._second())._asUppercase();
  57718. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  57719. }))).__comma(":");
  57720. selector;
  57721. } else {
  57722. selector="help:";
  57723. selector;
  57724. };
  57725. return selector;
  57726. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.klass)});
  57727. },
  57728. args: ["aSwitch"],
  57729. 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",
  57730. referencedClasses: [],
  57731. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  57732. }),
  57733. $globals.AmberCli.klass);
  57734. $core.addMethod(
  57735. $core.method({
  57736. selector: "serve:",
  57737. protocol: 'commands',
  57738. fn: function (args){
  57739. var self=this;
  57740. return $core.withContext(function($ctx1) {
  57741. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  57742. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.klass)});
  57743. },
  57744. args: ["args"],
  57745. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  57746. referencedClasses: ["FileServer"],
  57747. messageSends: ["start", "createServerWithArguments:"]
  57748. }),
  57749. $globals.AmberCli.klass);
  57750. $core.addMethod(
  57751. $core.method({
  57752. selector: "version:",
  57753. protocol: 'commands',
  57754. fn: function (arguments_){
  57755. var self=this;
  57756. return self;
  57757. },
  57758. args: ["arguments"],
  57759. source: "version: arguments",
  57760. referencedClasses: [],
  57761. messageSends: []
  57762. }),
  57763. $globals.AmberCli.klass);
  57764. $core.addClass('BaseFileManipulator', $globals.Object, ['path', 'fs'], 'AmberCli');
  57765. $core.addMethod(
  57766. $core.method({
  57767. selector: "dirname",
  57768. protocol: 'private',
  57769. fn: function (){
  57770. var self=this;
  57771. return $core.withContext(function($ctx1) {
  57772. return __dirname;
  57773. return self;
  57774. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  57775. },
  57776. args: [],
  57777. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  57778. referencedClasses: [],
  57779. messageSends: []
  57780. }),
  57781. $globals.BaseFileManipulator);
  57782. $core.addMethod(
  57783. $core.method({
  57784. selector: "initialize",
  57785. protocol: 'initialization',
  57786. fn: function (){
  57787. var self=this;
  57788. return $core.withContext(function($ctx1) {
  57789. (
  57790. $ctx1.supercall = true,
  57791. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  57792. $ctx1.supercall = false;
  57793. self["@path"]=$recv(require)._value_("path");
  57794. $ctx1.sendIdx["value:"]=1;
  57795. self["@fs"]=$recv(require)._value_("fs");
  57796. return self;
  57797. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  57798. },
  57799. args: [],
  57800. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  57801. referencedClasses: [],
  57802. messageSends: ["initialize", "value:"]
  57803. }),
  57804. $globals.BaseFileManipulator);
  57805. $core.addMethod(
  57806. $core.method({
  57807. selector: "rootDirname",
  57808. protocol: 'private',
  57809. fn: function (){
  57810. var self=this;
  57811. return $core.withContext(function($ctx1) {
  57812. return $recv(self["@path"])._join_with_(self._dirname(),"..");
  57813. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  57814. },
  57815. args: [],
  57816. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  57817. referencedClasses: [],
  57818. messageSends: ["join:with:", "dirname"]
  57819. }),
  57820. $globals.BaseFileManipulator);
  57821. $core.addClass('Configurator', $globals.BaseFileManipulator, [], 'AmberCli');
  57822. $core.addMethod(
  57823. $core.method({
  57824. selector: "initialize",
  57825. protocol: 'initialization',
  57826. fn: function (){
  57827. var self=this;
  57828. return $core.withContext(function($ctx1) {
  57829. (
  57830. $ctx1.supercall = true,
  57831. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  57832. $ctx1.supercall = false;
  57833. return self;
  57834. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  57835. },
  57836. args: [],
  57837. source: "initialize\x0a\x09super initialize",
  57838. referencedClasses: [],
  57839. messageSends: ["initialize"]
  57840. }),
  57841. $globals.Configurator);
  57842. $core.addMethod(
  57843. $core.method({
  57844. selector: "start",
  57845. protocol: 'action',
  57846. fn: function (){
  57847. var self=this;
  57848. return $core.withContext(function($ctx1) {
  57849. var $receiver;
  57850. self._writeConfigThenDo_((function(err){
  57851. return $core.withContext(function($ctx2) {
  57852. if(($receiver = err) == null || $receiver.isNil){
  57853. return $recv(process)._exit();
  57854. } else {
  57855. return $recv(process)._exit_((111));
  57856. };
  57857. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  57858. }));
  57859. return self;
  57860. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  57861. },
  57862. args: [],
  57863. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  57864. referencedClasses: [],
  57865. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  57866. }),
  57867. $globals.Configurator);
  57868. $core.addMethod(
  57869. $core.method({
  57870. selector: "writeConfigThenDo:",
  57871. protocol: 'action',
  57872. fn: function (aBlock){
  57873. var self=this;
  57874. return $core.withContext(function($ctx1) {
  57875. $recv($recv($recv(require)._value_("amber-dev"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  57876. return self;
  57877. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  57878. },
  57879. args: ["aBlock"],
  57880. source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  57881. referencedClasses: [],
  57882. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  57883. }),
  57884. $globals.Configurator);
  57885. $core.addClass('FileServer', $globals.BaseFileManipulator, ['http', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  57886. $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.";
  57887. $core.addMethod(
  57888. $core.method({
  57889. selector: "base64Decode:",
  57890. protocol: 'private',
  57891. fn: function (aString){
  57892. var self=this;
  57893. return $core.withContext(function($ctx1) {
  57894. return (new Buffer(aString, "base64").toString());
  57895. return self;
  57896. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  57897. },
  57898. args: ["aString"],
  57899. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  57900. referencedClasses: [],
  57901. messageSends: []
  57902. }),
  57903. $globals.FileServer);
  57904. $core.addMethod(
  57905. $core.method({
  57906. selector: "basePath",
  57907. protocol: 'accessing',
  57908. fn: function (){
  57909. var self=this;
  57910. return $core.withContext(function($ctx1) {
  57911. var $1,$receiver;
  57912. $1=self["@basePath"];
  57913. if(($receiver = $1) == null || $receiver.isNil){
  57914. return $recv(self._class())._defaultBasePath();
  57915. } else {
  57916. return $1;
  57917. };
  57918. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  57919. },
  57920. args: [],
  57921. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  57922. referencedClasses: [],
  57923. messageSends: ["ifNil:", "defaultBasePath", "class"]
  57924. }),
  57925. $globals.FileServer);
  57926. $core.addMethod(
  57927. $core.method({
  57928. selector: "basePath:",
  57929. protocol: 'accessing',
  57930. fn: function (aString){
  57931. var self=this;
  57932. return $core.withContext(function($ctx1) {
  57933. self["@basePath"]=aString;
  57934. self._validateBasePath();
  57935. return self;
  57936. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  57937. },
  57938. args: ["aString"],
  57939. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  57940. referencedClasses: [],
  57941. messageSends: ["validateBasePath"]
  57942. }),
  57943. $globals.FileServer);
  57944. $core.addMethod(
  57945. $core.method({
  57946. selector: "checkDirectoryLayout",
  57947. protocol: 'initialization',
  57948. fn: function (){
  57949. var self=this;
  57950. return $core.withContext(function($ctx1) {
  57951. var $1;
  57952. $1=$recv(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  57953. if(!$core.assert($1)){
  57954. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  57955. $ctx1.sendIdx["warn:"]=1;
  57956. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  57957. $ctx1.sendIdx["warn:"]=2;
  57958. $recv(console)._warn_(" You can also specify a page to be served by default,");
  57959. $ctx1.sendIdx["warn:"]=3;
  57960. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  57961. };
  57962. return self;
  57963. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  57964. },
  57965. args: [],
  57966. 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.'].",
  57967. referencedClasses: [],
  57968. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  57969. }),
  57970. $globals.FileServer);
  57971. $core.addMethod(
  57972. $core.method({
  57973. selector: "fallbackPage",
  57974. protocol: 'accessing',
  57975. fn: function (){
  57976. var self=this;
  57977. return self["@fallbackPage"];
  57978. },
  57979. args: [],
  57980. source: "fallbackPage\x0a\x09^ fallbackPage",
  57981. referencedClasses: [],
  57982. messageSends: []
  57983. }),
  57984. $globals.FileServer);
  57985. $core.addMethod(
  57986. $core.method({
  57987. selector: "fallbackPage:",
  57988. protocol: 'accessing',
  57989. fn: function (aString){
  57990. var self=this;
  57991. self["@fallbackPage"]=aString;
  57992. return self;
  57993. },
  57994. args: ["aString"],
  57995. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  57996. referencedClasses: [],
  57997. messageSends: []
  57998. }),
  57999. $globals.FileServer);
  58000. $core.addMethod(
  58001. $core.method({
  58002. selector: "handleGETRequest:respondTo:",
  58003. protocol: 'request handling',
  58004. fn: function (aRequest,aResponse){
  58005. var self=this;
  58006. var uri,filename;
  58007. return $core.withContext(function($ctx1) {
  58008. var $1;
  58009. uri=$recv(self["@url"])._parse_($recv(aRequest)._url());
  58010. filename=$recv(self["@path"])._join_with_(self._basePath(),$recv(uri)._pathname());
  58011. $recv(self["@fs"])._exists_do_(filename,(function(aBoolean){
  58012. return $core.withContext(function($ctx2) {
  58013. if($core.assert(aBoolean)){
  58014. $1=$recv($recv(self["@fs"])._statSync_(filename))._isDirectory();
  58015. if($core.assert($1)){
  58016. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  58017. } else {
  58018. return self._respondFileNamed_to_(filename,aResponse);
  58019. };
  58020. } else {
  58021. return self._respondNotFoundTo_(aResponse);
  58022. };
  58023. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  58024. }));
  58025. return self;
  58026. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  58027. },
  58028. args: ["aRequest", "aResponse"],
  58029. 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]]]",
  58030. referencedClasses: [],
  58031. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  58032. }),
  58033. $globals.FileServer);
  58034. $core.addMethod(
  58035. $core.method({
  58036. selector: "handleOPTIONSRequest:respondTo:",
  58037. protocol: 'request handling',
  58038. fn: function (aRequest,aResponse){
  58039. var self=this;
  58040. return $core.withContext(function($ctx1) {
  58041. $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)]));
  58042. $recv(aResponse)._end();
  58043. return self;
  58044. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  58045. },
  58046. args: ["aRequest", "aResponse"],
  58047. 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",
  58048. referencedClasses: [],
  58049. messageSends: ["writeHead:options:", "end"]
  58050. }),
  58051. $globals.FileServer);
  58052. $core.addMethod(
  58053. $core.method({
  58054. selector: "handlePUTRequest:respondTo:",
  58055. protocol: 'request handling',
  58056. fn: function (aRequest,aResponse){
  58057. var self=this;
  58058. var file,stream;
  58059. return $core.withContext(function($ctx1) {
  58060. var $1,$2,$3,$4;
  58061. $1=self._isAuthenticated_(aRequest);
  58062. if(!$core.assert($1)){
  58063. self._respondAuthenticationRequiredTo_(aResponse);
  58064. return nil;
  58065. };
  58066. file=".".__comma($recv(aRequest)._url());
  58067. $ctx1.sendIdx[","]=1;
  58068. stream=$recv(self["@fs"])._createWriteStream_(file);
  58069. $recv(stream)._on_do_("error",(function(error){
  58070. return $core.withContext(function($ctx2) {
  58071. $2=console;
  58072. $3="Error creating WriteStream for file ".__comma(file);
  58073. $ctx2.sendIdx[","]=2;
  58074. $recv($2)._warn_($3);
  58075. $ctx2.sendIdx["warn:"]=1;
  58076. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  58077. $ctx2.sendIdx["warn:"]=2;
  58078. $recv(console)._warn_(" The exact error is: ".__comma(error));
  58079. return self._respondNotCreatedTo_(aResponse);
  58080. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  58081. }));
  58082. $ctx1.sendIdx["on:do:"]=1;
  58083. $recv(stream)._on_do_("close",(function(){
  58084. return $core.withContext(function($ctx2) {
  58085. return self._respondCreatedTo_(aResponse);
  58086. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58087. }));
  58088. $ctx1.sendIdx["on:do:"]=2;
  58089. $recv(aRequest)._setEncoding_("utf8");
  58090. $recv(aRequest)._on_do_("data",(function(data){
  58091. return $core.withContext(function($ctx2) {
  58092. return $recv(stream)._write_(data);
  58093. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  58094. }));
  58095. $ctx1.sendIdx["on:do:"]=3;
  58096. $recv(aRequest)._on_do_("end",(function(){
  58097. return $core.withContext(function($ctx2) {
  58098. $4=$recv(stream)._writable();
  58099. if($core.assert($4)){
  58100. return $recv(stream)._end();
  58101. };
  58102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58103. }));
  58104. return self;
  58105. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  58106. },
  58107. args: ["aRequest", "aResponse"],
  58108. 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]]",
  58109. referencedClasses: [],
  58110. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  58111. }),
  58112. $globals.FileServer);
  58113. $core.addMethod(
  58114. $core.method({
  58115. selector: "handleRequest:respondTo:",
  58116. protocol: 'request handling',
  58117. fn: function (aRequest,aResponse){
  58118. var self=this;
  58119. return $core.withContext(function($ctx1) {
  58120. var $2,$1,$4,$3,$5;
  58121. $2=$recv(aRequest)._method();
  58122. $ctx1.sendIdx["method"]=1;
  58123. $1=$recv($2).__eq("PUT");
  58124. $ctx1.sendIdx["="]=1;
  58125. if($core.assert($1)){
  58126. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  58127. };
  58128. $4=$recv(aRequest)._method();
  58129. $ctx1.sendIdx["method"]=2;
  58130. $3=$recv($4).__eq("GET");
  58131. $ctx1.sendIdx["="]=2;
  58132. if($core.assert($3)){
  58133. self._handleGETRequest_respondTo_(aRequest,aResponse);
  58134. };
  58135. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  58136. if($core.assert($5)){
  58137. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  58138. };
  58139. return self;
  58140. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  58141. },
  58142. args: ["aRequest", "aResponse"],
  58143. 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]",
  58144. referencedClasses: [],
  58145. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  58146. }),
  58147. $globals.FileServer);
  58148. $core.addMethod(
  58149. $core.method({
  58150. selector: "host",
  58151. protocol: 'accessing',
  58152. fn: function (){
  58153. var self=this;
  58154. return self["@host"];
  58155. },
  58156. args: [],
  58157. source: "host\x0a\x09^ host",
  58158. referencedClasses: [],
  58159. messageSends: []
  58160. }),
  58161. $globals.FileServer);
  58162. $core.addMethod(
  58163. $core.method({
  58164. selector: "host:",
  58165. protocol: 'accessing',
  58166. fn: function (hostname){
  58167. var self=this;
  58168. self["@host"]=hostname;
  58169. return self;
  58170. },
  58171. args: ["hostname"],
  58172. source: "host: hostname\x0a\x09host := hostname",
  58173. referencedClasses: [],
  58174. messageSends: []
  58175. }),
  58176. $globals.FileServer);
  58177. $core.addMethod(
  58178. $core.method({
  58179. selector: "initialize",
  58180. protocol: 'initialization',
  58181. fn: function (){
  58182. var self=this;
  58183. return $core.withContext(function($ctx1) {
  58184. var $1;
  58185. (
  58186. $ctx1.supercall = true,
  58187. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  58188. $ctx1.supercall = false;
  58189. self["@http"]=self._require_("http");
  58190. $ctx1.sendIdx["require:"]=1;
  58191. self["@util"]=self._require_("util");
  58192. $ctx1.sendIdx["require:"]=2;
  58193. self["@url"]=self._require_("url");
  58194. $1=self._class();
  58195. $ctx1.sendIdx["class"]=1;
  58196. self["@host"]=$recv($1)._defaultHost();
  58197. self["@port"]=$recv(self._class())._defaultPort();
  58198. self["@username"]=nil;
  58199. self["@password"]=nil;
  58200. self["@fallbackPage"]=nil;
  58201. return self;
  58202. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  58203. },
  58204. args: [],
  58205. 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.",
  58206. referencedClasses: [],
  58207. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  58208. }),
  58209. $globals.FileServer);
  58210. $core.addMethod(
  58211. $core.method({
  58212. selector: "isAuthenticated:",
  58213. protocol: 'private',
  58214. fn: function (aRequest){
  58215. var self=this;
  58216. var header,token,auth,parts;
  58217. return $core.withContext(function($ctx1) {
  58218. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  58219. var $early={};
  58220. try {
  58221. $2=$recv(self["@username"])._isNil();
  58222. $ctx1.sendIdx["isNil"]=1;
  58223. $1=$recv($2)._and_((function(){
  58224. return $core.withContext(function($ctx2) {
  58225. return $recv(self["@password"])._isNil();
  58226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58227. }));
  58228. $ctx1.sendIdx["and:"]=1;
  58229. if($core.assert($1)){
  58230. return true;
  58231. };
  58232. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  58233. $ctx1.sendIdx["at:"]=1;
  58234. if(($receiver = $3) == null || $receiver.isNil){
  58235. header="";
  58236. } else {
  58237. header=$3;
  58238. };
  58239. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  58240. throw $early=[false];
  58241. }),(function(){
  58242. return $core.withContext(function($ctx2) {
  58243. $4=$recv(header)._tokenize_(" ");
  58244. $ctx2.sendIdx["tokenize:"]=1;
  58245. if(($receiver = $4) == null || $receiver.isNil){
  58246. token="";
  58247. } else {
  58248. token=$4;
  58249. };
  58250. token;
  58251. $5=$recv(token)._at_((2));
  58252. $ctx2.sendIdx["at:"]=2;
  58253. auth=self._base64Decode_($5);
  58254. auth;
  58255. parts=$recv(auth)._tokenize_(":");
  58256. parts;
  58257. $8=self["@username"];
  58258. $9=$recv(parts)._at_((1));
  58259. $ctx2.sendIdx["at:"]=3;
  58260. $7=$recv($8).__eq($9);
  58261. $ctx2.sendIdx["="]=1;
  58262. $6=$recv($7)._and_((function(){
  58263. return $core.withContext(function($ctx3) {
  58264. return $recv(self["@password"]).__eq($recv(parts)._at_((2)));
  58265. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  58266. }));
  58267. if($core.assert($6)){
  58268. throw $early=[true];
  58269. } else {
  58270. throw $early=[false];
  58271. };
  58272. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58273. }));
  58274. return self;
  58275. }
  58276. catch(e) {if(e===$early)return e[0]; throw e}
  58277. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  58278. },
  58279. args: ["aRequest"],
  58280. 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].",
  58281. referencedClasses: [],
  58282. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  58283. }),
  58284. $globals.FileServer);
  58285. $core.addMethod(
  58286. $core.method({
  58287. selector: "password:",
  58288. protocol: 'accessing',
  58289. fn: function (aPassword){
  58290. var self=this;
  58291. self["@password"]=aPassword;
  58292. return self;
  58293. },
  58294. args: ["aPassword"],
  58295. source: "password: aPassword\x0a\x09password := aPassword.",
  58296. referencedClasses: [],
  58297. messageSends: []
  58298. }),
  58299. $globals.FileServer);
  58300. $core.addMethod(
  58301. $core.method({
  58302. selector: "port",
  58303. protocol: 'accessing',
  58304. fn: function (){
  58305. var self=this;
  58306. return self["@port"];
  58307. },
  58308. args: [],
  58309. source: "port\x0a\x09^ port",
  58310. referencedClasses: [],
  58311. messageSends: []
  58312. }),
  58313. $globals.FileServer);
  58314. $core.addMethod(
  58315. $core.method({
  58316. selector: "port:",
  58317. protocol: 'accessing',
  58318. fn: function (aNumber){
  58319. var self=this;
  58320. self["@port"]=aNumber;
  58321. return self;
  58322. },
  58323. args: ["aNumber"],
  58324. source: "port: aNumber\x0a\x09port := aNumber",
  58325. referencedClasses: [],
  58326. messageSends: []
  58327. }),
  58328. $globals.FileServer);
  58329. $core.addMethod(
  58330. $core.method({
  58331. selector: "require:",
  58332. protocol: 'private',
  58333. fn: function (aModuleString){
  58334. var self=this;
  58335. return $core.withContext(function($ctx1) {
  58336. return $recv(require)._value_(aModuleString);
  58337. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  58338. },
  58339. args: ["aModuleString"],
  58340. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  58341. referencedClasses: [],
  58342. messageSends: ["value:"]
  58343. }),
  58344. $globals.FileServer);
  58345. $core.addMethod(
  58346. $core.method({
  58347. selector: "respondAuthenticationRequiredTo:",
  58348. protocol: 'request handling',
  58349. fn: function (aResponse){
  58350. var self=this;
  58351. return $core.withContext(function($ctx1) {
  58352. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  58353. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  58354. $recv(aResponse)._end();
  58355. return self;
  58356. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  58357. },
  58358. args: ["aResponse"],
  58359. 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.",
  58360. referencedClasses: [],
  58361. messageSends: ["writeHead:options:", "write:", "end"]
  58362. }),
  58363. $globals.FileServer);
  58364. $core.addMethod(
  58365. $core.method({
  58366. selector: "respondCreatedTo:",
  58367. protocol: 'request handling',
  58368. fn: function (aResponse){
  58369. var self=this;
  58370. return $core.withContext(function($ctx1) {
  58371. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  58372. $recv(aResponse)._end();
  58373. return self;
  58374. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  58375. },
  58376. args: ["aResponse"],
  58377. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  58378. referencedClasses: [],
  58379. messageSends: ["writeHead:options:", "end"]
  58380. }),
  58381. $globals.FileServer);
  58382. $core.addMethod(
  58383. $core.method({
  58384. selector: "respondDirectoryNamed:from:to:",
  58385. protocol: 'request handling',
  58386. fn: function (aDirname,aUrl,aResponse){
  58387. var self=this;
  58388. return $core.withContext(function($ctx1) {
  58389. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  58390. $2=$recv(aUrl)._pathname();
  58391. $ctx1.sendIdx["pathname"]=1;
  58392. $1=$recv($2)._endsWith_("/");
  58393. if($core.assert($1)){
  58394. $3=$recv(aDirname).__comma("index.html");
  58395. $ctx1.sendIdx[","]=1;
  58396. self._respondFileNamed_to_($3,aResponse);
  58397. } else {
  58398. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  58399. $7=$recv(aUrl)._search();
  58400. if(($receiver = $7) == null || $receiver.isNil){
  58401. $6="";
  58402. } else {
  58403. $6=$7;
  58404. };
  58405. $4=$recv($5).__comma($6);
  58406. $ctx1.sendIdx[","]=2;
  58407. self._respondRedirect_to_($4,aResponse);
  58408. };
  58409. return self;
  58410. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  58411. },
  58412. args: ["aDirname", "aUrl", "aResponse"],
  58413. 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]",
  58414. referencedClasses: [],
  58415. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  58416. }),
  58417. $globals.FileServer);
  58418. $core.addMethod(
  58419. $core.method({
  58420. selector: "respondFileNamed:to:",
  58421. protocol: 'request handling',
  58422. fn: function (aFilename,aResponse){
  58423. var self=this;
  58424. var type,filename;
  58425. return $core.withContext(function($ctx1) {
  58426. var $1,$2,$3,$4;
  58427. filename=aFilename;
  58428. $recv(self["@fs"])._readFile_do_(filename,(function(ex,file){
  58429. return $core.withContext(function($ctx2) {
  58430. $1=$recv(ex)._notNil();
  58431. if($core.assert($1)){
  58432. $2=console;
  58433. $3=$recv(filename).__comma(" does not exist");
  58434. $ctx2.sendIdx[","]=1;
  58435. $recv($2)._log_($3);
  58436. return self._respondNotFoundTo_(aResponse);
  58437. } else {
  58438. type=$recv(self._class())._mimeTypeFor_(filename);
  58439. type;
  58440. $4=$recv(type).__eq("application/javascript");
  58441. if($core.assert($4)){
  58442. type=$recv(type).__comma(";charset=utf-8");
  58443. type;
  58444. };
  58445. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  58446. $recv(aResponse)._write_encoding_(file,"binary");
  58447. return $recv(aResponse)._end();
  58448. };
  58449. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  58450. }));
  58451. return self;
  58452. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  58453. },
  58454. args: ["aFilename", "aResponse"],
  58455. 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]]",
  58456. referencedClasses: [],
  58457. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  58458. }),
  58459. $globals.FileServer);
  58460. $core.addMethod(
  58461. $core.method({
  58462. selector: "respondInternalErrorTo:",
  58463. protocol: 'request handling',
  58464. fn: function (aResponse){
  58465. var self=this;
  58466. return $core.withContext(function($ctx1) {
  58467. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  58468. $recv(aResponse)._write_("500 Internal server error");
  58469. $recv(aResponse)._end();
  58470. return self;
  58471. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  58472. },
  58473. args: ["aResponse"],
  58474. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  58475. referencedClasses: [],
  58476. messageSends: ["writeHead:options:", "write:", "end"]
  58477. }),
  58478. $globals.FileServer);
  58479. $core.addMethod(
  58480. $core.method({
  58481. selector: "respondNotCreatedTo:",
  58482. protocol: 'request handling',
  58483. fn: function (aResponse){
  58484. var self=this;
  58485. return $core.withContext(function($ctx1) {
  58486. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  58487. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  58488. $recv(aResponse)._end();
  58489. return self;
  58490. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  58491. },
  58492. args: ["aResponse"],
  58493. 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.",
  58494. referencedClasses: [],
  58495. messageSends: ["writeHead:options:", "write:", "end"]
  58496. }),
  58497. $globals.FileServer);
  58498. $core.addMethod(
  58499. $core.method({
  58500. selector: "respondNotFoundTo:",
  58501. protocol: 'request handling',
  58502. fn: function (aResponse){
  58503. var self=this;
  58504. return $core.withContext(function($ctx1) {
  58505. var $2,$1;
  58506. $2=self._fallbackPage();
  58507. $ctx1.sendIdx["fallbackPage"]=1;
  58508. $1=$recv($2)._isNil();
  58509. if(!$core.assert($1)){
  58510. return self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  58511. };
  58512. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  58513. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  58514. $ctx1.sendIdx["write:"]=1;
  58515. $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>");
  58516. $ctx1.sendIdx["write:"]=2;
  58517. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  58518. $ctx1.sendIdx["write:"]=3;
  58519. $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>");
  58520. $ctx1.sendIdx["write:"]=4;
  58521. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  58522. $ctx1.sendIdx["write:"]=5;
  58523. $recv(aResponse)._write_("</ul></p></body></html>");
  58524. $recv(aResponse)._end();
  58525. return self;
  58526. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  58527. },
  58528. args: ["aResponse"],
  58529. 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",
  58530. referencedClasses: [],
  58531. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  58532. }),
  58533. $globals.FileServer);
  58534. $core.addMethod(
  58535. $core.method({
  58536. selector: "respondOKTo:",
  58537. protocol: 'request handling',
  58538. fn: function (aResponse){
  58539. var self=this;
  58540. return $core.withContext(function($ctx1) {
  58541. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  58542. $recv(aResponse)._end();
  58543. return self;
  58544. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  58545. },
  58546. args: ["aResponse"],
  58547. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  58548. referencedClasses: [],
  58549. messageSends: ["writeHead:options:", "end"]
  58550. }),
  58551. $globals.FileServer);
  58552. $core.addMethod(
  58553. $core.method({
  58554. selector: "respondRedirect:to:",
  58555. protocol: 'request handling',
  58556. fn: function (aString,aResponse){
  58557. var self=this;
  58558. return $core.withContext(function($ctx1) {
  58559. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  58560. $recv(aResponse)._end();
  58561. return self;
  58562. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  58563. },
  58564. args: ["aString", "aResponse"],
  58565. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  58566. referencedClasses: [],
  58567. messageSends: ["writeHead:options:", "end"]
  58568. }),
  58569. $globals.FileServer);
  58570. $core.addMethod(
  58571. $core.method({
  58572. selector: "start",
  58573. protocol: 'starting',
  58574. fn: function (){
  58575. var self=this;
  58576. return $core.withContext(function($ctx1) {
  58577. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  58578. self._checkDirectoryLayout();
  58579. $1=$recv(self["@http"])._createServer_((function(request,response){
  58580. return $core.withContext(function($ctx2) {
  58581. return self._handleRequest_respondTo_(request,response);
  58582. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  58583. }));
  58584. $recv($1)._on_do_("error",(function(error){
  58585. return $core.withContext(function($ctx2) {
  58586. $2=console;
  58587. $3="Error starting server: ".__comma(error);
  58588. $ctx2.sendIdx[","]=1;
  58589. return $recv($2)._log_($3);
  58590. $ctx2.sendIdx["log:"]=1;
  58591. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  58592. }));
  58593. $ctx1.sendIdx["on:do:"]=1;
  58594. $recv($1)._on_do_("listening",(function(){
  58595. return $core.withContext(function($ctx2) {
  58596. $4=console;
  58597. $8=self._host();
  58598. $ctx2.sendIdx["host"]=1;
  58599. $7="Starting file server on http://".__comma($8);
  58600. $6=$recv($7).__comma(":");
  58601. $ctx2.sendIdx[","]=3;
  58602. $10=self._port();
  58603. $ctx2.sendIdx["port"]=1;
  58604. $9=$recv($10)._asString();
  58605. $5=$recv($6).__comma($9);
  58606. $ctx2.sendIdx[","]=2;
  58607. return $recv($4)._log_($5);
  58608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58609. }));
  58610. $recv($1)._listen_host_(self._port(),self._host());
  58611. return self;
  58612. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  58613. },
  58614. args: [],
  58615. 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.",
  58616. referencedClasses: [],
  58617. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  58618. }),
  58619. $globals.FileServer);
  58620. $core.addMethod(
  58621. $core.method({
  58622. selector: "startOn:",
  58623. protocol: 'starting',
  58624. fn: function (aPort){
  58625. var self=this;
  58626. return $core.withContext(function($ctx1) {
  58627. self._port_(aPort);
  58628. self._start();
  58629. return self;
  58630. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  58631. },
  58632. args: ["aPort"],
  58633. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  58634. referencedClasses: [],
  58635. messageSends: ["port:", "start"]
  58636. }),
  58637. $globals.FileServer);
  58638. $core.addMethod(
  58639. $core.method({
  58640. selector: "username:",
  58641. protocol: 'accessing',
  58642. fn: function (aUsername){
  58643. var self=this;
  58644. self["@username"]=aUsername;
  58645. return self;
  58646. },
  58647. args: ["aUsername"],
  58648. source: "username: aUsername\x0a\x09username := aUsername.",
  58649. referencedClasses: [],
  58650. messageSends: []
  58651. }),
  58652. $globals.FileServer);
  58653. $core.addMethod(
  58654. $core.method({
  58655. selector: "validateBasePath",
  58656. protocol: 'private',
  58657. fn: function (){
  58658. var self=this;
  58659. return $core.withContext(function($ctx1) {
  58660. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  58661. $1=self["@fs"];
  58662. $2=self._basePath();
  58663. $ctx1.sendIdx["basePath"]=1;
  58664. $recv($1)._stat_then_($2,(function(err,stat){
  58665. return $core.withContext(function($ctx2) {
  58666. if(($receiver = err) == null || $receiver.isNil){
  58667. $3=$recv(stat)._isDirectory();
  58668. if(!$core.assert($3)){
  58669. $4=console;
  58670. $7=self._basePath();
  58671. $ctx2.sendIdx["basePath"]=2;
  58672. $6="Warning: --base-path parameter ".__comma($7);
  58673. $ctx2.sendIdx[","]=2;
  58674. $5=$recv($6).__comma(" is not a directory.");
  58675. $ctx2.sendIdx[","]=1;
  58676. return $recv($4)._warn_($5);
  58677. $ctx2.sendIdx["warn:"]=1;
  58678. };
  58679. } else {
  58680. $8=console;
  58681. $9=$recv("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  58682. $ctx2.sendIdx[","]=3;
  58683. return $recv($8)._warn_($9);
  58684. };
  58685. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  58686. }));
  58687. return self;
  58688. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  58689. },
  58690. args: [],
  58691. 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.' ]].",
  58692. referencedClasses: [],
  58693. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  58694. }),
  58695. $globals.FileServer);
  58696. $core.addMethod(
  58697. $core.method({
  58698. selector: "withBasePath:",
  58699. protocol: 'private',
  58700. fn: function (aBaseRelativePath){
  58701. var self=this;
  58702. return $core.withContext(function($ctx1) {
  58703. return $recv(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  58704. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  58705. },
  58706. args: ["aBaseRelativePath"],
  58707. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  58708. referencedClasses: [],
  58709. messageSends: ["join:with:", "basePath"]
  58710. }),
  58711. $globals.FileServer);
  58712. $core.addMethod(
  58713. $core.method({
  58714. selector: "writeData:toFileNamed:",
  58715. protocol: 'private',
  58716. fn: function (data,aFilename){
  58717. var self=this;
  58718. return $core.withContext(function($ctx1) {
  58719. $recv(console)._log_(aFilename);
  58720. return self;
  58721. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  58722. },
  58723. args: ["data", "aFilename"],
  58724. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  58725. referencedClasses: [],
  58726. messageSends: ["log:"]
  58727. }),
  58728. $globals.FileServer);
  58729. $globals.FileServer.klass.iVarNames = ['mimeTypes'];
  58730. $core.addMethod(
  58731. $core.method({
  58732. selector: "commandLineSwitches",
  58733. protocol: 'accessing',
  58734. fn: function (){
  58735. var self=this;
  58736. var switches;
  58737. return $core.withContext(function($ctx1) {
  58738. switches=$recv(self._methodsInProtocol_("accessing"))._collect_((function(each){
  58739. return $core.withContext(function($ctx2) {
  58740. return $recv(each)._selector();
  58741. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58742. }));
  58743. $ctx1.sendIdx["collect:"]=1;
  58744. switches=$recv(switches)._select_((function(each){
  58745. return $core.withContext(function($ctx2) {
  58746. return $recv(each)._match_("^[^:]*:$");
  58747. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  58748. }));
  58749. switches=$recv(switches)._collect_((function(each){
  58750. return $core.withContext(function($ctx2) {
  58751. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  58752. $ctx2.sendIdx["replace:with:"]=1;
  58753. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  58754. }));
  58755. return switches;
  58756. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.klass)});
  58757. },
  58758. args: [],
  58759. 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",
  58760. referencedClasses: [],
  58761. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  58762. }),
  58763. $globals.FileServer.klass);
  58764. $core.addMethod(
  58765. $core.method({
  58766. selector: "createServerWithArguments:",
  58767. protocol: 'initialization',
  58768. fn: function (options){
  58769. var self=this;
  58770. var server,popFront,front,optionName,optionValue,switches;
  58771. return $core.withContext(function($ctx1) {
  58772. var $1,$2,$3,$4,$5,$6,$7,$8;
  58773. var $early={};
  58774. try {
  58775. switches=self._commandLineSwitches();
  58776. server=self._new();
  58777. $recv(options)._ifEmpty_((function(){
  58778. throw $early=[server];
  58779. }));
  58780. $1=$recv($recv(options)._size())._even();
  58781. if(!$core.assert($1)){
  58782. $recv(console)._log_("Using default parameters.");
  58783. $ctx1.sendIdx["log:"]=1;
  58784. $2=console;
  58785. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  58786. $ctx1.sendIdx[","]=1;
  58787. $recv($2)._log_($3);
  58788. $ctx1.sendIdx["log:"]=2;
  58789. $4=console;
  58790. $5="Use any of the following ones: ".__comma(switches);
  58791. $ctx1.sendIdx[","]=2;
  58792. $recv($4)._log_($5);
  58793. $ctx1.sendIdx["log:"]=3;
  58794. return server;
  58795. };
  58796. popFront=(function(args){
  58797. return $core.withContext(function($ctx2) {
  58798. front=$recv(args)._first();
  58799. front;
  58800. $recv(args)._remove_(front);
  58801. return front;
  58802. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  58803. });
  58804. $recv((function(){
  58805. return $core.withContext(function($ctx2) {
  58806. return $recv(options)._notEmpty();
  58807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58808. }))._whileTrue_((function(){
  58809. return $core.withContext(function($ctx2) {
  58810. optionName=$recv(popFront)._value_(options);
  58811. $ctx2.sendIdx["value:"]=1;
  58812. optionName;
  58813. optionValue=$recv(popFront)._value_(options);
  58814. optionValue;
  58815. $6=$recv(switches)._includes_(optionName);
  58816. if($core.assert($6)){
  58817. optionName=self._selectorForCommandLineSwitch_(optionName);
  58818. optionName;
  58819. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  58820. } else {
  58821. $7=console;
  58822. $8=$recv(optionName).__comma(" is not a valid commandline option");
  58823. $ctx2.sendIdx[","]=3;
  58824. $recv($7)._log_($8);
  58825. $ctx2.sendIdx["log:"]=4;
  58826. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  58827. };
  58828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58829. }));
  58830. return server;
  58831. }
  58832. catch(e) {if(e===$early)return e[0]; throw e}
  58833. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.klass)});
  58834. },
  58835. args: ["options"],
  58836. 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.",
  58837. referencedClasses: ["Array"],
  58838. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  58839. }),
  58840. $globals.FileServer.klass);
  58841. $core.addMethod(
  58842. $core.method({
  58843. selector: "defaultBasePath",
  58844. protocol: 'accessing',
  58845. fn: function (){
  58846. var self=this;
  58847. return "./";
  58848. },
  58849. args: [],
  58850. source: "defaultBasePath\x0a\x09^ './'",
  58851. referencedClasses: [],
  58852. messageSends: []
  58853. }),
  58854. $globals.FileServer.klass);
  58855. $core.addMethod(
  58856. $core.method({
  58857. selector: "defaultHost",
  58858. protocol: 'accessing',
  58859. fn: function (){
  58860. var self=this;
  58861. return "127.0.0.1";
  58862. },
  58863. args: [],
  58864. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  58865. referencedClasses: [],
  58866. messageSends: []
  58867. }),
  58868. $globals.FileServer.klass);
  58869. $core.addMethod(
  58870. $core.method({
  58871. selector: "defaultMimeTypes",
  58872. protocol: 'accessing',
  58873. fn: function (){
  58874. var self=this;
  58875. 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"]);
  58876. },
  58877. args: [],
  58878. 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}",
  58879. referencedClasses: [],
  58880. messageSends: []
  58881. }),
  58882. $globals.FileServer.klass);
  58883. $core.addMethod(
  58884. $core.method({
  58885. selector: "defaultPort",
  58886. protocol: 'accessing',
  58887. fn: function (){
  58888. var self=this;
  58889. return (4000);
  58890. },
  58891. args: [],
  58892. source: "defaultPort\x0a\x09^ 4000",
  58893. referencedClasses: [],
  58894. messageSends: []
  58895. }),
  58896. $globals.FileServer.klass);
  58897. $core.addMethod(
  58898. $core.method({
  58899. selector: "main",
  58900. protocol: 'initialization',
  58901. fn: function (){
  58902. var self=this;
  58903. var fileServer,args;
  58904. return $core.withContext(function($ctx1) {
  58905. var $1;
  58906. var $early={};
  58907. try {
  58908. args=$recv(process)._argv();
  58909. $recv(args)._removeFrom_to_((1),(3));
  58910. $recv(args)._detect_ifNone_((function(each){
  58911. return $core.withContext(function($ctx2) {
  58912. $1=$recv(each).__eq("--help");
  58913. if($core.assert($1)){
  58914. return $recv($globals.FileServer)._printHelp();
  58915. };
  58916. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58917. }),(function(){
  58918. return $core.withContext(function($ctx2) {
  58919. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  58920. fileServer;
  58921. throw $early=[$recv(fileServer)._start()];
  58922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58923. }));
  58924. return self;
  58925. }
  58926. catch(e) {if(e===$early)return e[0]; throw e}
  58927. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.klass)});
  58928. },
  58929. args: [],
  58930. 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]",
  58931. referencedClasses: ["FileServer"],
  58932. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  58933. }),
  58934. $globals.FileServer.klass);
  58935. $core.addMethod(
  58936. $core.method({
  58937. selector: "mimeTypeFor:",
  58938. protocol: 'accessing',
  58939. fn: function (aString){
  58940. var self=this;
  58941. return $core.withContext(function($ctx1) {
  58942. return $recv(self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  58943. return "text/plain";
  58944. }));
  58945. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.klass)});
  58946. },
  58947. args: ["aString"],
  58948. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  58949. referencedClasses: [],
  58950. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  58951. }),
  58952. $globals.FileServer.klass);
  58953. $core.addMethod(
  58954. $core.method({
  58955. selector: "mimeTypes",
  58956. protocol: 'accessing',
  58957. fn: function (){
  58958. var self=this;
  58959. return $core.withContext(function($ctx1) {
  58960. var $1,$receiver;
  58961. $1=self["@mimeTypes"];
  58962. if(($receiver = $1) == null || $receiver.isNil){
  58963. self["@mimeTypes"]=self._defaultMimeTypes();
  58964. return self["@mimeTypes"];
  58965. } else {
  58966. return $1;
  58967. };
  58968. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.klass)});
  58969. },
  58970. args: [],
  58971. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  58972. referencedClasses: [],
  58973. messageSends: ["ifNil:", "defaultMimeTypes"]
  58974. }),
  58975. $globals.FileServer.klass);
  58976. $core.addMethod(
  58977. $core.method({
  58978. selector: "printHelp",
  58979. protocol: 'accessing',
  58980. fn: function (){
  58981. var self=this;
  58982. return $core.withContext(function($ctx1) {
  58983. $recv(console)._log_("Available commandline options are:");
  58984. $ctx1.sendIdx["log:"]=1;
  58985. $recv(console)._log_("--help");
  58986. $ctx1.sendIdx["log:"]=2;
  58987. $recv(self._commandLineSwitches())._do_((function(each){
  58988. return $core.withContext(function($ctx2) {
  58989. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  58990. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58991. }));
  58992. return self;
  58993. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.klass)});
  58994. },
  58995. args: [],
  58996. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  58997. referencedClasses: [],
  58998. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  58999. }),
  59000. $globals.FileServer.klass);
  59001. $core.addMethod(
  59002. $core.method({
  59003. selector: "selectorForCommandLineSwitch:",
  59004. protocol: 'accessing',
  59005. fn: function (aSwitch){
  59006. var self=this;
  59007. return $core.withContext(function($ctx1) {
  59008. var $1;
  59009. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  59010. return $core.withContext(function($ctx2) {
  59011. return $recv($recv(each)._second())._asUppercase();
  59012. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59013. }));
  59014. $ctx1.sendIdx["replace:with:"]=1;
  59015. return $recv($1).__comma(":");
  59016. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.klass)});
  59017. },
  59018. args: ["aSwitch"],
  59019. 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 ]), ':'",
  59020. referencedClasses: [],
  59021. messageSends: [",", "replace:with:", "asUppercase", "second"]
  59022. }),
  59023. $globals.FileServer.klass);
  59024. $core.addClass('Initer', $globals.BaseFileManipulator, ['childProcess', 'nmPath'], 'AmberCli');
  59025. $core.addMethod(
  59026. $core.method({
  59027. selector: "bowerInstallThenDo:",
  59028. protocol: 'action',
  59029. fn: function (aBlock){
  59030. var self=this;
  59031. var child;
  59032. return $core.withContext(function($ctx1) {
  59033. var $1,$3,$2;
  59034. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]);
  59035. $1=child;
  59036. $recv($1)._on_do_("error",aBlock);
  59037. $ctx1.sendIdx["on:do:"]=1;
  59038. $recv($1)._on_do_("close",(function(code){
  59039. return $core.withContext(function($ctx2) {
  59040. $3=$recv(code).__eq((0));
  59041. if($core.assert($3)){
  59042. $2=nil;
  59043. } else {
  59044. $2=code;
  59045. };
  59046. return $recv(aBlock)._value_($2);
  59047. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  59048. }));
  59049. return self;
  59050. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  59051. },
  59052. args: ["aBlock"],
  59053. source: "bowerInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'bower' named: 'bower')\x0a\x09\x09args: #('install').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  59054. referencedClasses: [],
  59055. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  59056. }),
  59057. $globals.Initer);
  59058. $core.addMethod(
  59059. $core.method({
  59060. selector: "finishMessage",
  59061. protocol: 'action',
  59062. fn: function (){
  59063. var self=this;
  59064. return $core.withContext(function($ctx1) {
  59065. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  59066. $recv((function(){
  59067. }))._valueWithTimeout_((600));
  59068. return self;
  59069. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  59070. },
  59071. args: [],
  59072. 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",
  59073. referencedClasses: ["String"],
  59074. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  59075. }),
  59076. $globals.Initer);
  59077. $core.addMethod(
  59078. $core.method({
  59079. selector: "gruntInitThenDo:",
  59080. protocol: 'action',
  59081. fn: function (aBlock){
  59082. var self=this;
  59083. var child,sanitizedTemplatePath;
  59084. return $core.withContext(function($ctx1) {
  59085. var $1,$3,$2;
  59086. sanitizedTemplatePath=$recv($recv($recv(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  59087. $ctx1.sendIdx["replace:with:"]=1;
  59088. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  59089. $1=child;
  59090. $recv($1)._on_do_("error",aBlock);
  59091. $ctx1.sendIdx["on:do:"]=1;
  59092. $recv($1)._on_do_("close",(function(code){
  59093. return $core.withContext(function($ctx2) {
  59094. $3=$recv(code).__eq((0));
  59095. if($core.assert($3)){
  59096. $2=nil;
  59097. } else {
  59098. $2=code;
  59099. };
  59100. return $recv(aBlock)._value_($2);
  59101. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  59102. }));
  59103. return self;
  59104. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  59105. },
  59106. args: ["aBlock"],
  59107. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: 'grunt-init-amber')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  59108. referencedClasses: [],
  59109. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  59110. }),
  59111. $globals.Initer);
  59112. $core.addMethod(
  59113. $core.method({
  59114. selector: "gruntThenDo:",
  59115. protocol: 'action',
  59116. fn: function (aBlock){
  59117. var self=this;
  59118. var child;
  59119. return $core.withContext(function($ctx1) {
  59120. var $1,$3,$2;
  59121. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  59122. $1=child;
  59123. $recv($1)._on_do_("error",aBlock);
  59124. $ctx1.sendIdx["on:do:"]=1;
  59125. $recv($1)._on_do_("close",(function(code){
  59126. return $core.withContext(function($ctx2) {
  59127. $3=$recv(code).__eq((0));
  59128. if($core.assert($3)){
  59129. $2=nil;
  59130. } else {
  59131. $2=code;
  59132. };
  59133. return $recv(aBlock)._value_($2);
  59134. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  59135. }));
  59136. return self;
  59137. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  59138. },
  59139. args: ["aBlock"],
  59140. source: "gruntThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-cli' named: 'grunt')\x0a\x09\x09args: #('default' 'devel').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  59141. referencedClasses: [],
  59142. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  59143. }),
  59144. $globals.Initer);
  59145. $core.addMethod(
  59146. $core.method({
  59147. selector: "initialize",
  59148. protocol: 'initialization',
  59149. fn: function (){
  59150. var self=this;
  59151. return $core.withContext(function($ctx1) {
  59152. (
  59153. $ctx1.supercall = true,
  59154. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  59155. $ctx1.supercall = false;
  59156. self["@childProcess"]=$recv(require)._value_("child_process");
  59157. self["@nmPath"]=$recv(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  59158. return self;
  59159. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  59160. },
  59161. args: [],
  59162. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  59163. referencedClasses: [],
  59164. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  59165. }),
  59166. $globals.Initer);
  59167. $core.addMethod(
  59168. $core.method({
  59169. selector: "npmInstallThenDo:",
  59170. protocol: 'action',
  59171. fn: function (aBlock){
  59172. var self=this;
  59173. var child;
  59174. return $core.withContext(function($ctx1) {
  59175. var $1;
  59176. child=$recv(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  59177. $1=$recv(child)._stdout();
  59178. $ctx1.sendIdx["stdout"]=1;
  59179. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  59180. return self;
  59181. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  59182. },
  59183. args: ["aBlock"],
  59184. source: "npmInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: 'npm install'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  59185. referencedClasses: [],
  59186. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  59187. }),
  59188. $globals.Initer);
  59189. $core.addMethod(
  59190. $core.method({
  59191. selector: "npmScriptForModule:named:",
  59192. protocol: 'npm',
  59193. fn: function (aString,anotherString){
  59194. var self=this;
  59195. var modulePath,packageJson,binSection,scriptPath;
  59196. return $core.withContext(function($ctx1) {
  59197. var $1,$3,$4,$2,$5;
  59198. $1=self["@path"];
  59199. $3=$recv($globals.JSObjectProxy)._on_(require);
  59200. $4=$recv(aString).__comma("/package.json");
  59201. $ctx1.sendIdx[","]=1;
  59202. $2=$recv($3)._resolve_($4);
  59203. modulePath=$recv($1)._dirname_($2);
  59204. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  59205. binSection=$recv(packageJson)._at_("bin");
  59206. $ctx1.sendIdx["at:"]=1;
  59207. $5=$recv(binSection)._isString();
  59208. if($core.assert($5)){
  59209. scriptPath=binSection;
  59210. } else {
  59211. scriptPath=$recv(binSection)._at_(anotherString);
  59212. };
  59213. return $recv(self["@path"])._join_with_(modulePath,scriptPath);
  59214. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  59215. },
  59216. args: ["aString", "anotherString"],
  59217. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09(JSObjectProxy on: require)\x0a\x09\x09\x09resolve: aString, '/package.json').\x0a\x09packageJson := Smalltalk readJSObject: (\x0a\x09\x09require value: aString, '/package.json').\x0a\x09binSection := packageJson at: 'bin'.\x0a\x09scriptPath := binSection isString\x0a\x09\x09ifTrue: [ binSection ]\x0a\x09\x09ifFalse: [ binSection at: anotherString ].\x0a\x09^ path join: modulePath with: scriptPath",
  59218. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  59219. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  59220. }),
  59221. $globals.Initer);
  59222. $core.addMethod(
  59223. $core.method({
  59224. selector: "start",
  59225. protocol: 'action',
  59226. fn: function (){
  59227. var self=this;
  59228. return $core.withContext(function($ctx1) {
  59229. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  59230. self._gruntInitThenDo_((function(error){
  59231. return $core.withContext(function($ctx2) {
  59232. if(($receiver = error) == null || $receiver.isNil){
  59233. return self._bowerInstallThenDo_((function(error2){
  59234. return $core.withContext(function($ctx3) {
  59235. if(($receiver = error2) == null || $receiver.isNil){
  59236. return self._npmInstallThenDo_((function(error3){
  59237. return $core.withContext(function($ctx4) {
  59238. if(($receiver = error3) == null || $receiver.isNil){
  59239. return self._gruntThenDo_((function(error4){
  59240. return $core.withContext(function($ctx5) {
  59241. if(($receiver = error4) == null || $receiver.isNil){
  59242. self._finishMessage();
  59243. return $recv(process)._exit();
  59244. } else {
  59245. $7=console;
  59246. $recv($7)._log_("grunt exec error:");
  59247. $ctx5.sendIdx["log:"]=7;
  59248. $recv($7)._log_(error4);
  59249. return $recv(process)._exit_((104));
  59250. };
  59251. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  59252. }));
  59253. } else {
  59254. $5=console;
  59255. $recv($5)._log_("npm install exec error:");
  59256. $ctx4.sendIdx["log:"]=5;
  59257. $6=$recv($5)._log_(error3);
  59258. $ctx4.sendIdx["log:"]=6;
  59259. $6;
  59260. return $recv(process)._exit_((103));
  59261. $ctx4.sendIdx["exit:"]=3;
  59262. };
  59263. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  59264. }));
  59265. } else {
  59266. $3=console;
  59267. $recv($3)._log_("bower install exec error:");
  59268. $ctx3.sendIdx["log:"]=3;
  59269. $4=$recv($3)._log_(error2);
  59270. $ctx3.sendIdx["log:"]=4;
  59271. $4;
  59272. return $recv(process)._exit_((102));
  59273. $ctx3.sendIdx["exit:"]=2;
  59274. };
  59275. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  59276. }));
  59277. } else {
  59278. $1=console;
  59279. $recv($1)._log_("grunt-init exec error:");
  59280. $ctx2.sendIdx["log:"]=1;
  59281. $2=$recv($1)._log_(error);
  59282. $ctx2.sendIdx["log:"]=2;
  59283. $2;
  59284. return $recv(process)._exit_((101));
  59285. $ctx2.sendIdx["exit:"]=1;
  59286. };
  59287. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  59288. }));
  59289. return self;
  59290. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  59291. },
  59292. args: [],
  59293. source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit: 101 ]\x0a\x09ifNil: [\x0a\x0a\x09self bowerInstallThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'bower install exec error:'; log: error2.\x0a\x09\x09process exit: 102 ]\x0a\x09ifNil: [\x0a\x0a\x09self npmInstallThenDo: [ :error3 | error3\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm install exec error:'; log: error3.\x0a\x09\x09process exit: 103 ]\x0a\x09ifNil: [\x0a\x0a\x09self gruntThenDo: [ :error4 | error4\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt exec error:'; log: error4.\x0a\x09\x09process exit: 104 ]\x0a\x09ifNil: [\x0a\x0a\x09self finishMessage.\x0a\x09process exit ]]]]]]]]",
  59294. referencedClasses: [],
  59295. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  59296. }),
  59297. $globals.Initer);
  59298. $core.addClass('Repl', $globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  59299. $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.";
  59300. $core.addMethod(
  59301. $core.method({
  59302. selector: "addVariableNamed:to:",
  59303. protocol: 'private',
  59304. fn: function (aString,anObject){
  59305. var self=this;
  59306. var newClass,newObject;
  59307. return $core.withContext(function($ctx1) {
  59308. newClass=self._subclass_withVariable_($recv(anObject)._class(),aString);
  59309. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  59310. newObject=$recv(newClass)._new();
  59311. self._setPreviousVariablesFor_from_(newObject,anObject);
  59312. return newObject;
  59313. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  59314. },
  59315. args: ["aString", "anObject"],
  59316. 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",
  59317. referencedClasses: [],
  59318. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  59319. }),
  59320. $globals.Repl);
  59321. $core.addMethod(
  59322. $core.method({
  59323. selector: "assignNewVariable:do:",
  59324. protocol: 'private',
  59325. fn: function (buffer,aBlock){
  59326. var self=this;
  59327. return $core.withContext(function($ctx1) {
  59328. var $2,$3,$1,$receiver;
  59329. return self._parseAssignment_do_(buffer,(function(name,expr){
  59330. var varName,value;
  59331. return $core.withContext(function($ctx2) {
  59332. if(($receiver = name) == null || $receiver.isNil){
  59333. varName=self._nextResultName();
  59334. } else {
  59335. varName=name;
  59336. };
  59337. varName;
  59338. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  59339. self["@session"];
  59340. $recv((function(){
  59341. return $core.withContext(function($ctx3) {
  59342. $2=$recv(varName).__comma(" := ");
  59343. if(($receiver = expr) == null || $receiver.isNil){
  59344. $3=buffer;
  59345. } else {
  59346. $3=expr;
  59347. };
  59348. $1=$recv($2).__comma($3);
  59349. $ctx3.sendIdx[","]=1;
  59350. value=self._eval_on_($1,self["@session"]);
  59351. return value;
  59352. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  59353. }))._on_do_($globals.Error,(function(e){
  59354. return $core.withContext(function($ctx3) {
  59355. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  59356. value=nil;
  59357. return value;
  59358. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  59359. }));
  59360. return $recv(aBlock)._value_value_(varName,value);
  59361. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  59362. }));
  59363. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  59364. },
  59365. args: ["buffer", "aBlock"],
  59366. 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]",
  59367. referencedClasses: ["Error", "ConsoleErrorHandler"],
  59368. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  59369. }),
  59370. $globals.Repl);
  59371. $core.addMethod(
  59372. $core.method({
  59373. selector: "clearScreen",
  59374. protocol: 'actions',
  59375. fn: function (){
  59376. var self=this;
  59377. var esc,cls;
  59378. return $core.withContext(function($ctx1) {
  59379. var $1;
  59380. esc=$recv($globals.String)._fromCharCode_((27));
  59381. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  59382. $ctx1.sendIdx[","]=2;
  59383. cls=$recv($1).__comma("[0;0f");
  59384. $ctx1.sendIdx[","]=1;
  59385. $recv($recv(process)._stdout())._write_(cls);
  59386. $recv(self["@interface"])._prompt();
  59387. return self;
  59388. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  59389. },
  59390. args: [],
  59391. 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",
  59392. referencedClasses: ["String"],
  59393. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  59394. }),
  59395. $globals.Repl);
  59396. $core.addMethod(
  59397. $core.method({
  59398. selector: "close",
  59399. protocol: 'actions',
  59400. fn: function (){
  59401. var self=this;
  59402. return $core.withContext(function($ctx1) {
  59403. $recv($recv(process)._stdin())._destroy();
  59404. return self;
  59405. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  59406. },
  59407. args: [],
  59408. source: "close\x0a\x09process stdin destroy",
  59409. referencedClasses: [],
  59410. messageSends: ["destroy", "stdin"]
  59411. }),
  59412. $globals.Repl);
  59413. $core.addMethod(
  59414. $core.method({
  59415. selector: "commands",
  59416. protocol: 'accessing',
  59417. fn: function (){
  59418. var self=this;
  59419. return self["@commands"];
  59420. },
  59421. args: [],
  59422. source: "commands\x0a\x09^ commands",
  59423. referencedClasses: [],
  59424. messageSends: []
  59425. }),
  59426. $globals.Repl);
  59427. $core.addMethod(
  59428. $core.method({
  59429. selector: "createInterface",
  59430. protocol: 'actions',
  59431. fn: function (){
  59432. var self=this;
  59433. return $core.withContext(function($ctx1) {
  59434. self["@interface"]=$recv(self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  59435. $recv(self["@interface"])._on_do_("line",(function(buffer){
  59436. return $core.withContext(function($ctx2) {
  59437. return self._processLine_(buffer);
  59438. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  59439. }));
  59440. $ctx1.sendIdx["on:do:"]=1;
  59441. $recv(self["@interface"])._on_do_("close",(function(){
  59442. return $core.withContext(function($ctx2) {
  59443. return self._close();
  59444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59445. }));
  59446. self._printWelcome();
  59447. self._setupHotkeys();
  59448. self._setPrompt();
  59449. $recv(self["@interface"])._prompt();
  59450. return self;
  59451. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  59452. },
  59453. args: [],
  59454. 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",
  59455. referencedClasses: [],
  59456. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  59457. }),
  59458. $globals.Repl);
  59459. $core.addMethod(
  59460. $core.method({
  59461. selector: "encapsulateVariable:withValue:in:",
  59462. protocol: 'private',
  59463. fn: function (aString,anObject,aClass){
  59464. var self=this;
  59465. var compiler;
  59466. return $core.withContext(function($ctx1) {
  59467. var $1,$4,$3,$2,$5,$6;
  59468. compiler=$recv($globals.Compiler)._new();
  59469. $1=compiler;
  59470. $4=$recv(aString).__comma(": anObject ^ ");
  59471. $ctx1.sendIdx[","]=3;
  59472. $3=$recv($4).__comma(aString);
  59473. $ctx1.sendIdx[","]=2;
  59474. $2=$recv($3).__comma(" := anObject");
  59475. $ctx1.sendIdx[","]=1;
  59476. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  59477. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  59478. $5=compiler;
  59479. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  59480. $ctx1.sendIdx[","]=4;
  59481. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  59482. return self;
  59483. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  59484. },
  59485. args: ["aString", "anObject", "aClass"],
  59486. 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'.",
  59487. referencedClasses: ["Compiler"],
  59488. messageSends: ["new", "install:forClass:protocol:", ","]
  59489. }),
  59490. $globals.Repl);
  59491. $core.addMethod(
  59492. $core.method({
  59493. selector: "eval:",
  59494. protocol: 'actions',
  59495. fn: function (buffer){
  59496. var self=this;
  59497. return $core.withContext(function($ctx1) {
  59498. return self._eval_on_(buffer,$recv($globals.DoIt)._new());
  59499. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  59500. },
  59501. args: ["buffer"],
  59502. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  59503. referencedClasses: ["DoIt"],
  59504. messageSends: ["eval:on:", "new"]
  59505. }),
  59506. $globals.Repl);
  59507. $core.addMethod(
  59508. $core.method({
  59509. selector: "eval:on:",
  59510. protocol: 'actions',
  59511. fn: function (buffer,anObject){
  59512. var self=this;
  59513. var result;
  59514. return $core.withContext(function($ctx1) {
  59515. var $1;
  59516. $recv(buffer)._ifNotEmpty_((function(){
  59517. return $core.withContext(function($ctx2) {
  59518. return $recv((function(){
  59519. return $core.withContext(function($ctx3) {
  59520. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  59521. return result;
  59522. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  59523. }))._tryCatch_((function(e){
  59524. return $core.withContext(function($ctx3) {
  59525. $1=$recv(e)._isSmalltalkError();
  59526. if($core.assert($1)){
  59527. return $recv(e)._resignal();
  59528. } else {
  59529. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  59530. };
  59531. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  59532. }));
  59533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59534. }));
  59535. return result;
  59536. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  59537. },
  59538. args: ["buffer", "anObject"],
  59539. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer ifNotEmpty: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09\x09ifTrue: [ e resignal ]\x0a\x09\x09\x09\x09\x09ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  59540. referencedClasses: ["Compiler"],
  59541. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  59542. }),
  59543. $globals.Repl);
  59544. $core.addMethod(
  59545. $core.method({
  59546. selector: "executeCommand:",
  59547. protocol: 'private',
  59548. fn: function (aString){
  59549. var self=this;
  59550. return $core.withContext(function($ctx1) {
  59551. var $1;
  59552. var $early={};
  59553. try {
  59554. $recv(self._commands())._keysAndValuesDo_((function(names,cmd){
  59555. return $core.withContext(function($ctx2) {
  59556. $1=$recv(names)._includes_(aString);
  59557. if($core.assert($1)){
  59558. $recv(cmd)._value();
  59559. throw $early=[true];
  59560. };
  59561. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  59562. }));
  59563. return false;
  59564. }
  59565. catch(e) {if(e===$early)return e[0]; throw e}
  59566. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  59567. },
  59568. args: ["aString"],
  59569. 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",
  59570. referencedClasses: [],
  59571. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  59572. }),
  59573. $globals.Repl);
  59574. $core.addMethod(
  59575. $core.method({
  59576. selector: "initialize",
  59577. protocol: 'initialization',
  59578. fn: function (){
  59579. var self=this;
  59580. return $core.withContext(function($ctx1) {
  59581. (
  59582. $ctx1.supercall = true,
  59583. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  59584. $ctx1.supercall = false;
  59585. self["@session"]=$recv($globals.DoIt)._new();
  59586. self["@readline"]=$recv(require)._value_("readline");
  59587. $ctx1.sendIdx["value:"]=1;
  59588. self["@util"]=$recv(require)._value_("util");
  59589. self._setupCommands();
  59590. return self;
  59591. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  59592. },
  59593. args: [],
  59594. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  59595. referencedClasses: ["DoIt"],
  59596. messageSends: ["initialize", "new", "value:", "setupCommands"]
  59597. }),
  59598. $globals.Repl);
  59599. $core.addMethod(
  59600. $core.method({
  59601. selector: "instanceVariableNamesFor:",
  59602. protocol: 'private',
  59603. fn: function (aClass){
  59604. var self=this;
  59605. return $core.withContext(function($ctx1) {
  59606. var $1,$2,$receiver;
  59607. $1=$recv(aClass)._superclass();
  59608. $ctx1.sendIdx["superclass"]=1;
  59609. if(($receiver = $1) == null || $receiver.isNil){
  59610. return $recv(aClass)._instanceVariableNames();
  59611. } else {
  59612. $2=$recv(aClass)._instanceVariableNames();
  59613. $ctx1.sendIdx["instanceVariableNames"]=1;
  59614. return $recv($2)._copyWithAll_(self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  59615. };
  59616. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  59617. },
  59618. args: ["aClass"],
  59619. 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]",
  59620. referencedClasses: [],
  59621. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  59622. }),
  59623. $globals.Repl);
  59624. $core.addMethod(
  59625. $core.method({
  59626. selector: "isIdentifier:",
  59627. protocol: 'private',
  59628. fn: function (aString){
  59629. var self=this;
  59630. return $core.withContext(function($ctx1) {
  59631. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  59632. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  59633. },
  59634. args: ["aString"],
  59635. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  59636. referencedClasses: [],
  59637. messageSends: ["match:", "asRegexp"]
  59638. }),
  59639. $globals.Repl);
  59640. $core.addMethod(
  59641. $core.method({
  59642. selector: "isVariableDefined:",
  59643. protocol: 'private',
  59644. fn: function (aString){
  59645. var self=this;
  59646. return $core.withContext(function($ctx1) {
  59647. return $recv(self._instanceVariableNamesFor_($recv(self["@session"])._class()))._includes_(aString);
  59648. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  59649. },
  59650. args: ["aString"],
  59651. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  59652. referencedClasses: [],
  59653. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  59654. }),
  59655. $globals.Repl);
  59656. $core.addMethod(
  59657. $core.method({
  59658. selector: "nextResultName",
  59659. protocol: 'private',
  59660. fn: function (){
  59661. var self=this;
  59662. return $core.withContext(function($ctx1) {
  59663. var $1,$receiver;
  59664. $1=self["@resultCount"];
  59665. if(($receiver = $1) == null || $receiver.isNil){
  59666. self["@resultCount"]=(1);
  59667. } else {
  59668. self["@resultCount"]=$recv(self["@resultCount"]).__plus((1));
  59669. };
  59670. return "res".__comma($recv(self["@resultCount"])._asString());
  59671. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  59672. },
  59673. args: [],
  59674. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  59675. referencedClasses: [],
  59676. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  59677. }),
  59678. $globals.Repl);
  59679. $core.addMethod(
  59680. $core.method({
  59681. selector: "onKeyPress:",
  59682. protocol: 'private',
  59683. fn: function (key){
  59684. var self=this;
  59685. return $core.withContext(function($ctx1) {
  59686. var $1;
  59687. $1=$recv($recv(key)._ctrl())._and_((function(){
  59688. return $core.withContext(function($ctx2) {
  59689. return $recv($recv(key)._name()).__eq("l");
  59690. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59691. }));
  59692. if($core.assert($1)){
  59693. self._clearScreen();
  59694. };
  59695. return self;
  59696. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  59697. },
  59698. args: ["key"],
  59699. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  59700. referencedClasses: [],
  59701. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  59702. }),
  59703. $globals.Repl);
  59704. $core.addMethod(
  59705. $core.method({
  59706. selector: "parseAssignment:do:",
  59707. protocol: 'private',
  59708. fn: function (aString,aBlock){
  59709. var self=this;
  59710. var assignment;
  59711. return $core.withContext(function($ctx1) {
  59712. var $2,$1;
  59713. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  59714. return $core.withContext(function($ctx2) {
  59715. return $recv(s)._trimBoth();
  59716. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  59717. }));
  59718. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  59719. return $core.withContext(function($ctx2) {
  59720. $2=$recv(assignment)._first();
  59721. $ctx2.sendIdx["first"]=1;
  59722. return self._isIdentifier_($2);
  59723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59724. }));
  59725. if($core.assert($1)){
  59726. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  59727. $ctx1.sendIdx["value:value:"]=1;
  59728. } else {
  59729. return $recv(aBlock)._value_value_(nil,nil);
  59730. };
  59731. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  59732. },
  59733. args: ["aString", "aBlock"],
  59734. 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 ]",
  59735. referencedClasses: [],
  59736. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  59737. }),
  59738. $globals.Repl);
  59739. $core.addMethod(
  59740. $core.method({
  59741. selector: "presentResultNamed:withValue:",
  59742. protocol: 'private',
  59743. fn: function (varName,value){
  59744. var self=this;
  59745. return $core.withContext(function($ctx1) {
  59746. var $3,$2,$1;
  59747. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  59748. $ctx1.sendIdx[","]=3;
  59749. $2=$recv($3).__comma(" = ");
  59750. $ctx1.sendIdx[","]=2;
  59751. $1=$recv($2).__comma($recv(value)._asString());
  59752. $ctx1.sendIdx[","]=1;
  59753. $recv($globals.Transcript)._show_($1);
  59754. $recv($globals.Transcript)._cr();
  59755. $recv(self["@interface"])._prompt();
  59756. return self;
  59757. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  59758. },
  59759. args: ["varName", "value"],
  59760. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  59761. referencedClasses: ["Transcript"],
  59762. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  59763. }),
  59764. $globals.Repl);
  59765. $core.addMethod(
  59766. $core.method({
  59767. selector: "printWelcome",
  59768. protocol: 'actions',
  59769. fn: function (){
  59770. var self=this;
  59771. return $core.withContext(function($ctx1) {
  59772. $recv($globals.Transcript)._show_("Type :q to exit.");
  59773. $recv($globals.Transcript)._cr();
  59774. return self;
  59775. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  59776. },
  59777. args: [],
  59778. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  59779. referencedClasses: ["Transcript"],
  59780. messageSends: ["show:", "cr"]
  59781. }),
  59782. $globals.Repl);
  59783. $core.addMethod(
  59784. $core.method({
  59785. selector: "processLine:",
  59786. protocol: 'private',
  59787. fn: function (buffer){
  59788. var self=this;
  59789. var show;
  59790. return $core.withContext(function($ctx1) {
  59791. var $1,$2;
  59792. show=(function(varName,value){
  59793. return $core.withContext(function($ctx2) {
  59794. return self._presentResultNamed_withValue_(varName,value);
  59795. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  59796. });
  59797. $1=self._executeCommand_(buffer);
  59798. if(!$core.assert($1)){
  59799. $2=self._isVariableDefined_(buffer);
  59800. if($core.assert($2)){
  59801. $recv(show)._value_value_(buffer,$recv(self["@session"])._perform_(buffer));
  59802. } else {
  59803. self._assignNewVariable_do_(buffer,show);
  59804. };
  59805. };
  59806. return self;
  59807. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  59808. },
  59809. args: ["buffer"],
  59810. 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]]",
  59811. referencedClasses: [],
  59812. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  59813. }),
  59814. $globals.Repl);
  59815. $core.addMethod(
  59816. $core.method({
  59817. selector: "prompt",
  59818. protocol: 'accessing',
  59819. fn: function (){
  59820. var self=this;
  59821. return "amber >> ";
  59822. },
  59823. args: [],
  59824. source: "prompt\x0a\x09^ 'amber >> '",
  59825. referencedClasses: [],
  59826. messageSends: []
  59827. }),
  59828. $globals.Repl);
  59829. $core.addMethod(
  59830. $core.method({
  59831. selector: "setPreviousVariablesFor:from:",
  59832. protocol: 'private',
  59833. fn: function (newObject,oldObject){
  59834. var self=this;
  59835. return $core.withContext(function($ctx1) {
  59836. $recv(self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  59837. return $core.withContext(function($ctx2) {
  59838. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  59839. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59840. }));
  59841. return self;
  59842. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  59843. },
  59844. args: ["newObject", "oldObject"],
  59845. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  59846. referencedClasses: [],
  59847. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  59848. }),
  59849. $globals.Repl);
  59850. $core.addMethod(
  59851. $core.method({
  59852. selector: "setPrompt",
  59853. protocol: 'actions',
  59854. fn: function (){
  59855. var self=this;
  59856. return $core.withContext(function($ctx1) {
  59857. $recv(self["@interface"])._setPrompt_(self._prompt());
  59858. return self;
  59859. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  59860. },
  59861. args: [],
  59862. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  59863. referencedClasses: [],
  59864. messageSends: ["setPrompt:", "prompt"]
  59865. }),
  59866. $globals.Repl);
  59867. $core.addMethod(
  59868. $core.method({
  59869. selector: "setupCommands",
  59870. protocol: 'initialization',
  59871. fn: function (){
  59872. var self=this;
  59873. return $core.withContext(function($ctx1) {
  59874. var $2,$1;
  59875. $2=$recv([":q"]).__minus_gt((function(){
  59876. return $core.withContext(function($ctx2) {
  59877. return $recv(process)._exit();
  59878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59879. }));
  59880. $ctx1.sendIdx["->"]=1;
  59881. $1=[$2,$recv([""]).__minus_gt((function(){
  59882. return $core.withContext(function($ctx2) {
  59883. return $recv(self["@interface"])._prompt();
  59884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59885. }))];
  59886. self["@commands"]=$recv($globals.Dictionary)._from_($1);
  59887. return self;
  59888. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  59889. },
  59890. args: [],
  59891. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  59892. referencedClasses: ["Dictionary"],
  59893. messageSends: ["from:", "->", "exit", "prompt"]
  59894. }),
  59895. $globals.Repl);
  59896. $core.addMethod(
  59897. $core.method({
  59898. selector: "setupHotkeys",
  59899. protocol: 'initialization',
  59900. fn: function (){
  59901. var self=this;
  59902. return $core.withContext(function($ctx1) {
  59903. var $receiver;
  59904. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  59905. return $core.withContext(function($ctx2) {
  59906. if(($receiver = key) == null || $receiver.isNil){
  59907. return key;
  59908. } else {
  59909. return self._onKeyPress_(key);
  59910. };
  59911. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  59912. }));
  59913. return self;
  59914. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  59915. },
  59916. args: [],
  59917. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  59918. referencedClasses: [],
  59919. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  59920. }),
  59921. $globals.Repl);
  59922. $core.addMethod(
  59923. $core.method({
  59924. selector: "subclass:withVariable:",
  59925. protocol: 'private',
  59926. fn: function (aClass,varName){
  59927. var self=this;
  59928. return $core.withContext(function($ctx1) {
  59929. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  59930. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  59931. },
  59932. args: ["aClass", "varName"],
  59933. 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'",
  59934. referencedClasses: ["ClassBuilder"],
  59935. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  59936. }),
  59937. $globals.Repl);
  59938. $core.addMethod(
  59939. $core.method({
  59940. selector: "subclassNameFor:",
  59941. protocol: 'private',
  59942. fn: function (aClass){
  59943. var self=this;
  59944. return $core.withContext(function($ctx1) {
  59945. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  59946. $2=$recv(aClass)._name();
  59947. $ctx1.sendIdx["name"]=1;
  59948. $1=$recv($2)._matchesOf_("\x5cd+$");
  59949. $ctx1.sendIdx["matchesOf:"]=1;
  59950. if(($receiver = $1) == null || $receiver.isNil){
  59951. return $recv($recv(aClass)._name()).__comma("2");
  59952. } else {
  59953. var counter;
  59954. $6=$recv(aClass)._name();
  59955. $ctx1.sendIdx["name"]=2;
  59956. $5=$recv($6)._matchesOf_("\x5cd+$");
  59957. $4=$recv($5)._first();
  59958. $3=$recv($4)._asNumber();
  59959. counter=$recv($3).__plus((1));
  59960. counter;
  59961. $7=$recv(aClass)._name();
  59962. $ctx1.sendIdx["name"]=3;
  59963. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  59964. };
  59965. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  59966. },
  59967. args: ["aClass"],
  59968. 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'].",
  59969. referencedClasses: [],
  59970. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  59971. }),
  59972. $globals.Repl);
  59973. $core.addMethod(
  59974. $core.method({
  59975. selector: "main",
  59976. protocol: 'initialization',
  59977. fn: function (){
  59978. var self=this;
  59979. return $core.withContext(function($ctx1) {
  59980. $recv(self._new())._createInterface();
  59981. return self;
  59982. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.klass)});
  59983. },
  59984. args: [],
  59985. source: "main\x0a\x09self new createInterface",
  59986. referencedClasses: [],
  59987. messageSends: ["createInterface", "new"]
  59988. }),
  59989. $globals.Repl.klass);
  59990. });
  59991. (function () {
  59992. define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) {
  59993. amber.initialize().then(function () {
  59994. amber.globals.AmberCli._main();
  59995. });
  59996. });
  59997. }());
  59998. //jshint eqnull:true
  59999. define('amber/kernel-runtime',[],function () {
  60000. "use strict";
  60001. DNUBrik.deps = ["selectors", "messageSend", "manipulation", "root"];
  60002. function DNUBrik(brikz, st) {
  60003. var selectorsBrik = brikz.selectors;
  60004. var messageNotUnderstood = brikz.messageSend.messageNotUnderstood;
  60005. var installJSMethod = brikz.manipulation.installJSMethod;
  60006. var nilAsClass = brikz.root.nilAsClass;
  60007. /* Method not implemented handlers */
  60008. function makeDnuHandler(pair, targetClasses) {
  60009. var jsSelector = pair.js;
  60010. var fn = createHandler(pair.st);
  60011. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  60012. targetClasses.forEach(function (target) {
  60013. installJSMethod(target.fn.prototype, jsSelector, fn);
  60014. });
  60015. }
  60016. this.makeDnuHandler = makeDnuHandler;
  60017. /* Dnu handler method */
  60018. function createHandler(stSelector) {
  60019. return function () {
  60020. return messageNotUnderstood(this, stSelector, arguments);
  60021. };
  60022. }
  60023. selectorsBrik.selectorPairs.forEach(function (pair) {
  60024. makeDnuHandler(pair, []);
  60025. });
  60026. }
  60027. function ManipulationBrik(brikz, st) {
  60028. function installJSMethod(obj, jsSelector, fn) {
  60029. Object.defineProperty(obj, jsSelector, {
  60030. value: fn,
  60031. enumerable: false, configurable: true, writable: true
  60032. });
  60033. }
  60034. function installMethod(method, klass) {
  60035. installJSMethod(klass.fn.prototype, method.jsSelector, method.fn);
  60036. }
  60037. this.installMethod = installMethod;
  60038. this.installJSMethod = installJSMethod;
  60039. }
  60040. RuntimeClassesBrik.deps = ["selectors", "dnu", "classes", "manipulation"];
  60041. function RuntimeClassesBrik(brikz, st) {
  60042. var selectors = brikz.selectors;
  60043. var classes = brikz.classes.classes;
  60044. var wireKlass = brikz.classes.wireKlass;
  60045. var installMethod = brikz.manipulation.installMethod;
  60046. var installJSMethod = brikz.manipulation.installJSMethod;
  60047. var detachedRootClasses = [];
  60048. function markClassDetachedRoot(klass) {
  60049. detachedRootClasses.addElement(klass);
  60050. klass.detachedRoot = true;
  60051. }
  60052. this.detachedRootClasses = function () {
  60053. return detachedRootClasses;
  60054. };
  60055. /* Initialize a class in its class hierarchy. Handle both classes and
  60056. metaclasses. */
  60057. function initClassAndMetaclass(klass) {
  60058. initClass(klass);
  60059. if (klass.klass && !klass.meta) {
  60060. initClass(klass.klass);
  60061. }
  60062. }
  60063. classes().forEach(initClassAndMetaclass);
  60064. st._classAdded = initClassAndMetaclass;
  60065. function initClass(klass) {
  60066. wireKlass(klass);
  60067. if (klass.detachedRoot) {
  60068. copySuperclass(klass);
  60069. }
  60070. installMethods(klass);
  60071. }
  60072. function copySuperclass(klass) {
  60073. var myproto = klass.fn.prototype,
  60074. superproto = klass.superclass.fn.prototype;
  60075. selectors.selectorPairs.forEach(function (selectorPair) {
  60076. var jsSelector = selectorPair.js;
  60077. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  60078. });
  60079. }
  60080. function installMethods(klass) {
  60081. var methods = klass.methods;
  60082. Object.keys(methods).forEach(function (selector) {
  60083. installMethod(methods[selector], klass);
  60084. });
  60085. }
  60086. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  60087. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  60088. markClassDetachedRoot(klass);
  60089. klass.fn = constructor;
  60090. initClass(klass);
  60091. };
  60092. }
  60093. FrameBindingBrik.deps=["globals", "runtimeClasses"];
  60094. function FrameBindingBrik(brikz, st) {
  60095. var globals = brikz.smalltalkGlobals.globals;
  60096. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  60097. setClassConstructor(globals.Number, Number);
  60098. setClassConstructor(globals.BlockClosure, Function);
  60099. setClassConstructor(globals.Boolean, Boolean);
  60100. setClassConstructor(globals.Date, Date);
  60101. setClassConstructor(globals.String, String);
  60102. setClassConstructor(globals.Array, Array);
  60103. setClassConstructor(globals.RegularExpression, RegExp);
  60104. setClassConstructor(globals.Error, Error);
  60105. setClassConstructor(globals.Promise, Promise);
  60106. }
  60107. RuntimeMethodsBrik.deps = ["manipulation", "dnu", "runtimeClasses"];
  60108. function RuntimeMethodsBrik(brikz, st) {
  60109. var installMethod = brikz.manipulation.installMethod;
  60110. var installJSMethod = brikz.manipulation.installJSMethod;
  60111. var makeDnuHandler = brikz.dnu.makeDnuHandler;
  60112. var detachedRootClasses = brikz.runtimeClasses.detachedRootClasses;
  60113. st._methodAdded = function (method, klass) {
  60114. installMethod(method, klass);
  60115. propagateMethodChange(klass, method, klass);
  60116. };
  60117. st._selectorsAdded = function (newSelectors) {
  60118. var targetClasses = detachedRootClasses();
  60119. newSelectors.forEach(function (pair) {
  60120. makeDnuHandler(pair, targetClasses);
  60121. });
  60122. };
  60123. st._methodRemoved = function (method, klass) {
  60124. delete klass.fn.prototype[method.jsSelector];
  60125. propagateMethodChange(klass, method, null);
  60126. };
  60127. function propagateMethodChange(klass, method, exclude) {
  60128. var selector = method.selector;
  60129. var jsSelector = method.jsSelector;
  60130. st.traverseClassTree(klass, function (subclass) {
  60131. if (subclass != exclude) {
  60132. initMethodInClass(subclass, selector, jsSelector);
  60133. }
  60134. });
  60135. }
  60136. function initMethodInClass(klass, selector, jsSelector) {
  60137. if (klass.detachedRoot && !klass.methods[selector]) {
  60138. installJSMethod(klass.fn.prototype, jsSelector, klass.superclass.fn.prototype[jsSelector]);
  60139. }
  60140. }
  60141. }
  60142. PrimitivesBrik.deps = ["smalltalkGlobals"];
  60143. function PrimitivesBrik(brikz, st) {
  60144. var globals = brikz.smalltalkGlobals.globals;
  60145. var oid = 0;
  60146. /* Unique ID number generator */
  60147. st.nextId = function () {
  60148. oid += 1;
  60149. return oid;
  60150. };
  60151. /* Converts a JavaScript object to valid Smalltalk Object */
  60152. st.readJSObject = function (js) {
  60153. if (js == null)
  60154. return null;
  60155. var readObject = js.constructor === Object;
  60156. var readArray = js.constructor === Array;
  60157. var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
  60158. for (var i in js) {
  60159. if (readObject) {
  60160. object._at_put_(i, st.readJSObject(js[i]));
  60161. }
  60162. if (readArray) {
  60163. object[i] = st.readJSObject(js[i]);
  60164. }
  60165. }
  60166. return object;
  60167. };
  60168. /* Boolean assertion */
  60169. st.assert = function (shouldBeBoolean) {
  60170. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  60171. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  60172. shouldBeBoolean = shouldBeBoolean.valueOf();
  60173. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  60174. }
  60175. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  60176. };
  60177. /* List of all reserved words in JavaScript. They may not be used as variables
  60178. in Smalltalk. */
  60179. // list of reserved JavaScript keywords as of
  60180. // http://es5.github.com/#x7.6.1.1
  60181. // and
  60182. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  60183. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  60184. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  60185. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  60186. 'try', 'typeof', 'var', 'void', 'while', 'with',
  60187. // Amber protected words: these should not be compiled as-is when in code
  60188. 'arguments',
  60189. // ES5: future use: http://es5.github.com/#x7.6.1.2
  60190. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  60191. // ES5: future use in strict mode
  60192. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  60193. 'public', 'static', 'yield'];
  60194. st.globalJsVariables = ['window', 'document', 'process', 'global'];
  60195. }
  60196. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  60197. function RuntimeBrik(brikz, st) {
  60198. var globals = brikz.smalltalkGlobals.globals;
  60199. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  60200. function SmalltalkMethodContext(home, setup) {
  60201. this.sendIdx = {};
  60202. this.homeContext = home;
  60203. this.setup = setup || function () {
  60204. };
  60205. this.supercall = false;
  60206. }
  60207. // Fallbacks
  60208. SmalltalkMethodContext.prototype.locals = {};
  60209. SmalltalkMethodContext.prototype.receiver = null;
  60210. SmalltalkMethodContext.prototype.selector = null;
  60211. SmalltalkMethodContext.prototype.lookupClass = null;
  60212. SmalltalkMethodContext.prototype.fill = function (receiver, selector, locals, lookupClass) {
  60213. this.receiver = receiver;
  60214. this.selector = selector;
  60215. this.locals = locals || {};
  60216. this.lookupClass = lookupClass;
  60217. if (this.homeContext) {
  60218. this.homeContext.evaluatedSelector = selector;
  60219. }
  60220. };
  60221. SmalltalkMethodContext.prototype.fillBlock = function (locals, ctx, index) {
  60222. this.locals = locals || {};
  60223. this.outerContext = ctx;
  60224. this.index = index || 0;
  60225. };
  60226. SmalltalkMethodContext.prototype.init = function () {
  60227. var home = this.homeContext;
  60228. if (home) {
  60229. home.init();
  60230. }
  60231. this.setup(this);
  60232. };
  60233. SmalltalkMethodContext.prototype.method = function () {
  60234. var method;
  60235. var lookup = this.lookupClass || this.receiver.klass;
  60236. while (!method && lookup) {
  60237. method = lookup.methods[st.js2st(this.selector)];
  60238. lookup = lookup.superclass;
  60239. }
  60240. return method;
  60241. };
  60242. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  60243. /* This is the current call context object.
  60244. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  60245. In JS code, use api.getThisContext() (see below).
  60246. */
  60247. var thisContext = null;
  60248. st.withContext = function (worker, setup) {
  60249. if (thisContext) {
  60250. return inContext(worker, setup);
  60251. } else {
  60252. return inContextWithErrorHandling(worker, setup);
  60253. }
  60254. };
  60255. /*
  60256. Runs worker function so that error handler is not set up
  60257. if there isn't one. This is accomplished by unconditional
  60258. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  60259. which then stops error handler setup (see st.withContext above).
  60260. The effect is, $core.seamless(fn)'s exceptions are not
  60261. handed into ST error handler and caller should process them.
  60262. */
  60263. st.seamless = function (worker) {
  60264. return inContext(worker, function (ctx) {
  60265. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  60266. });
  60267. };
  60268. function inContextWithErrorHandling(worker, setup) {
  60269. try {
  60270. return inContext(worker, setup);
  60271. } catch (error) {
  60272. handleError(error);
  60273. thisContext = null;
  60274. // Rethrow the error in any case.
  60275. error.amberHandled = true;
  60276. throw error;
  60277. }
  60278. }
  60279. function inContext(worker, setup) {
  60280. var oldContext = thisContext;
  60281. thisContext = new SmalltalkMethodContext(thisContext, setup);
  60282. var result = worker(thisContext);
  60283. thisContext = oldContext;
  60284. return result;
  60285. }
  60286. /* Wrap a JavaScript exception in a Smalltalk Exception.
  60287. In case of a RangeError, stub the stack after 100 contexts to
  60288. avoid another RangeError later when the stack is manipulated. */
  60289. function wrappedError(error) {
  60290. var errorWrapper = globals.JavaScriptException._on_(error);
  60291. // Add the error to the context, so it is visible in the stack
  60292. try {
  60293. errorWrapper._signal();
  60294. } catch (ex) {
  60295. }
  60296. var context = st.getThisContext();
  60297. if (isRangeError(error)) {
  60298. stubContextStack(context);
  60299. }
  60300. errorWrapper._context_(context);
  60301. return errorWrapper;
  60302. }
  60303. /* Stub the context stack after 100 contexts */
  60304. function stubContextStack(context) {
  60305. var currentContext = context;
  60306. var contexts = 0;
  60307. while (contexts < 100) {
  60308. if (currentContext) {
  60309. currentContext = currentContext.homeContext;
  60310. }
  60311. contexts++;
  60312. }
  60313. if (currentContext) {
  60314. currentContext.homeContext = undefined;
  60315. }
  60316. }
  60317. function isRangeError(error) {
  60318. return error instanceof RangeError;
  60319. }
  60320. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  60321. (See the Smalltalk class ErrorHandler and its subclasses */
  60322. function handleError(error) {
  60323. if (!error.smalltalkError) {
  60324. error = wrappedError(error);
  60325. }
  60326. globals.ErrorHandler._handleError_(error);
  60327. }
  60328. /* Handle thisContext pseudo variable */
  60329. st.getThisContext = function () {
  60330. if (thisContext) {
  60331. thisContext.init();
  60332. return thisContext;
  60333. } else {
  60334. return null;
  60335. }
  60336. };
  60337. }
  60338. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  60339. function MessageSendBrik(brikz, st) {
  60340. var globals = brikz.smalltalkGlobals.globals;
  60341. var nilAsReceiver = brikz.root.nilAsReceiver;
  60342. /* Send message programmatically. Used to implement #perform: & Co. */
  60343. st.send2 = function (receiver, selector, args, klass) {
  60344. var method, jsSelector = st.st2js(selector);
  60345. if (receiver == null) {
  60346. receiver = nilAsReceiver;
  60347. }
  60348. method = klass ? klass.fn.prototype[jsSelector] : receiver.klass && receiver[jsSelector];
  60349. if (method) {
  60350. return method.apply(receiver, args || []);
  60351. } else {
  60352. return messageNotUnderstood(receiver, selector, args);
  60353. }
  60354. };
  60355. function invokeDnuMethod(receiver, stSelector, args) {
  60356. return receiver._doesNotUnderstand_(
  60357. globals.Message._new()
  60358. ._selector_(stSelector)
  60359. ._arguments_([].slice.call(args))
  60360. );
  60361. }
  60362. /* Handles #dnu: *and* JavaScript method calls.
  60363. if the receiver has no klass, we consider it a JS object (outside of the
  60364. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  60365. function messageNotUnderstood(receiver, stSelector, args) {
  60366. if (receiver.klass != null && !receiver.allowJavaScriptCalls) {
  60367. return invokeDnuMethod(receiver, stSelector, args);
  60368. }
  60369. /* Call a method of a JS object, or answer a property if it exists.
  60370. Converts keyword-based selectors by using the first
  60371. keyword only, but keeping all message arguments.
  60372. Example:
  60373. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)"
  60374. Else try wrapping a JSObjectProxy around the receiver. */
  60375. var propertyName = st.st2prop(stSelector);
  60376. if (!(propertyName in receiver)) {
  60377. return invokeDnuMethod(globals.JSObjectProxy._on_(receiver), stSelector, args);
  60378. }
  60379. return accessJavaScript(receiver, propertyName, args);
  60380. }
  60381. /* If the object property is a function, then call it, except if it starts with
  60382. an uppercase character (we probably want to answer the function itself in this
  60383. case and send it #new from Amber).
  60384. */
  60385. function accessJavaScript(receiver, propertyName, args) {
  60386. var propertyValue = receiver[propertyName];
  60387. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  60388. return propertyValue.apply(receiver, args || []);
  60389. } else if (args.length > 0) {
  60390. receiver[propertyName] = args[0];
  60391. return receiver;
  60392. } else {
  60393. return propertyValue;
  60394. }
  60395. }
  60396. st.accessJavaScript = accessJavaScript;
  60397. this.messageNotUnderstood = messageNotUnderstood;
  60398. }
  60399. /* Making smalltalk that can run */
  60400. function configureWithRuntime(brikz) {
  60401. brikz.dnu = DNUBrik;
  60402. brikz.manipulation = ManipulationBrik;
  60403. brikz.runtimeClasses = RuntimeClassesBrik;
  60404. brikz.frameBinding = FrameBindingBrik;
  60405. brikz.runtimeMethods = RuntimeMethodsBrik;
  60406. brikz.messageSend = MessageSendBrik;
  60407. brikz.runtime = RuntimeBrik;
  60408. brikz.primitives = PrimitivesBrik;
  60409. brikz.rebuild();
  60410. }
  60411. return configureWithRuntime;
  60412. });
  60413. // Depend on each module that is loaded lazily.
  60414. // Add to packager tasks as dependency,
  60415. // so the lazy-loaded modules are included.
  60416. define('amber/lazypack',['./kernel-runtime'], {});
  60417. require(["app"]);
  60418. });
  60419. define.require('__wrap__');
  60420. }((function amdefine(module, requireFn) {
  60421. 'use strict';
  60422. var defineCache = {},
  60423. loaderCache = {},
  60424. alreadyCalled = false,
  60425. path = require('path'),
  60426. makeRequire, stringRequire;
  60427. /**
  60428. * Trims the . and .. from an array of path segments.
  60429. * It will keep a leading path segment if a .. will become
  60430. * the first path segment, to help with module name lookups,
  60431. * which act like paths, but can be remapped. But the end result,
  60432. * all paths that use this function should look normalized.
  60433. * NOTE: this method MODIFIES the input array.
  60434. * @param {Array} ary the array of path segments.
  60435. */
  60436. function trimDots(ary) {
  60437. var i, part;
  60438. for (i = 0; ary[i]; i+= 1) {
  60439. part = ary[i];
  60440. if (part === '.') {
  60441. ary.splice(i, 1);
  60442. i -= 1;
  60443. } else if (part === '..') {
  60444. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  60445. //End of the line. Keep at least one non-dot
  60446. //path segment at the front so it can be mapped
  60447. //correctly to disk. Otherwise, there is likely
  60448. //no path mapping for a path starting with '..'.
  60449. //This can still fail, but catches the most reasonable
  60450. //uses of ..
  60451. break;
  60452. } else if (i > 0) {
  60453. ary.splice(i - 1, 2);
  60454. i -= 2;
  60455. }
  60456. }
  60457. }
  60458. }
  60459. function normalize(name, baseName) {
  60460. var baseParts;
  60461. //Adjust any relative paths.
  60462. if (name && name.charAt(0) === '.') {
  60463. //If have a base name, try to normalize against it,
  60464. //otherwise, assume it is a top-level require that will
  60465. //be relative to baseUrl in the end.
  60466. if (baseName) {
  60467. baseParts = baseName.split('/');
  60468. baseParts = baseParts.slice(0, baseParts.length - 1);
  60469. baseParts = baseParts.concat(name.split('/'));
  60470. trimDots(baseParts);
  60471. name = baseParts.join('/');
  60472. }
  60473. }
  60474. return name;
  60475. }
  60476. /**
  60477. * Create the normalize() function passed to a loader plugin's
  60478. * normalize method.
  60479. */
  60480. function makeNormalize(relName) {
  60481. return function (name) {
  60482. return normalize(name, relName);
  60483. };
  60484. }
  60485. function makeLoad(id) {
  60486. function load(value) {
  60487. loaderCache[id] = value;
  60488. }
  60489. load.fromText = function (id, text) {
  60490. //This one is difficult because the text can/probably uses
  60491. //define, and any relative paths and requires should be relative
  60492. //to that id was it would be found on disk. But this would require
  60493. //bootstrapping a module/require fairly deeply from node core.
  60494. //Not sure how best to go about that yet.
  60495. throw new Error('amdefine does not implement load.fromText');
  60496. };
  60497. return load;
  60498. }
  60499. makeRequire = function (systemRequire, exports, module, relId) {
  60500. function amdRequire(deps, callback) {
  60501. if (typeof deps === 'string') {
  60502. //Synchronous, single module require('')
  60503. return stringRequire(systemRequire, exports, module, deps, relId);
  60504. } else {
  60505. //Array of dependencies with a callback.
  60506. //Convert the dependencies to modules.
  60507. deps = deps.map(function (depName) {
  60508. return stringRequire(systemRequire, exports, module, depName, relId);
  60509. });
  60510. //Wait for next tick to call back the require call.
  60511. if (callback) {
  60512. process.nextTick(function () {
  60513. callback.apply(null, deps);
  60514. });
  60515. }
  60516. }
  60517. }
  60518. amdRequire.toUrl = function (filePath) {
  60519. if (filePath.indexOf('.') === 0) {
  60520. return normalize(filePath, path.dirname(module.filename));
  60521. } else {
  60522. return filePath;
  60523. }
  60524. };
  60525. return amdRequire;
  60526. };
  60527. //Favor explicit value, passed in if the module wants to support Node 0.4.
  60528. requireFn = requireFn || function req() {
  60529. return module.require.apply(module, arguments);
  60530. };
  60531. function runFactory(id, deps, factory) {
  60532. var r, e, m, result;
  60533. if (id) {
  60534. e = loaderCache[id] = {};
  60535. m = {
  60536. id: id,
  60537. uri: __filename,
  60538. exports: e
  60539. };
  60540. r = makeRequire(requireFn, e, m, id);
  60541. } else {
  60542. //Only support one define call per file
  60543. if (alreadyCalled) {
  60544. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  60545. }
  60546. alreadyCalled = true;
  60547. //Use the real variables from node
  60548. //Use module.exports for exports, since
  60549. //the exports in here is amdefine exports.
  60550. e = module.exports;
  60551. m = module;
  60552. r = makeRequire(requireFn, e, m, module.id);
  60553. }
  60554. //If there are dependencies, they are strings, so need
  60555. //to convert them to dependency values.
  60556. if (deps) {
  60557. deps = deps.map(function (depName) {
  60558. return r(depName);
  60559. });
  60560. }
  60561. //Call the factory with the right dependencies.
  60562. if (typeof factory === 'function') {
  60563. result = factory.apply(m.exports, deps);
  60564. } else {
  60565. result = factory;
  60566. }
  60567. if (result !== undefined) {
  60568. m.exports = result;
  60569. if (id) {
  60570. loaderCache[id] = m.exports;
  60571. }
  60572. }
  60573. }
  60574. stringRequire = function (systemRequire, exports, module, id, relId) {
  60575. //Split the ID by a ! so that
  60576. var index = id.indexOf('!'),
  60577. originalId = id,
  60578. prefix, plugin;
  60579. if (index === -1) {
  60580. id = normalize(id, relId);
  60581. //Straight module lookup. If it is one of the special dependencies,
  60582. //deal with it, otherwise, delegate to node.
  60583. if (id === 'require') {
  60584. return makeRequire(systemRequire, exports, module, relId);
  60585. } else if (id === 'exports') {
  60586. return exports;
  60587. } else if (id === 'module') {
  60588. return module;
  60589. } else if (loaderCache.hasOwnProperty(id)) {
  60590. return loaderCache[id];
  60591. } else if (defineCache[id]) {
  60592. runFactory.apply(null, defineCache[id]);
  60593. return loaderCache[id];
  60594. } else {
  60595. if(systemRequire) {
  60596. return systemRequire(originalId);
  60597. } else {
  60598. throw new Error('No module with ID: ' + id);
  60599. }
  60600. }
  60601. } else {
  60602. //There is a plugin in play.
  60603. prefix = id.substring(0, index);
  60604. id = id.substring(index + 1, id.length);
  60605. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  60606. if (plugin.normalize) {
  60607. id = plugin.normalize(id, makeNormalize(relId));
  60608. } else {
  60609. //Normalize the ID normally.
  60610. id = normalize(id, relId);
  60611. }
  60612. if (loaderCache[id]) {
  60613. return loaderCache[id];
  60614. } else {
  60615. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  60616. return loaderCache[id];
  60617. }
  60618. }
  60619. };
  60620. //Create a define function specific to the module asking for amdefine.
  60621. function define(id, deps, factory) {
  60622. if (Array.isArray(id)) {
  60623. factory = deps;
  60624. deps = id;
  60625. id = undefined;
  60626. } else if (typeof id !== 'string') {
  60627. factory = id;
  60628. id = deps = undefined;
  60629. }
  60630. if (deps && !Array.isArray(deps)) {
  60631. factory = deps;
  60632. deps = undefined;
  60633. }
  60634. if (!deps) {
  60635. deps = ['require', 'exports', 'module'];
  60636. }
  60637. //Set up properties for this module. If an ID, then use
  60638. //internal cache. If no ID, then use the external variables
  60639. //for this node module.
  60640. if (id) {
  60641. //Put the module in deep freeze until there is a
  60642. //require call for it.
  60643. defineCache[id] = [id, deps, factory];
  60644. } else {
  60645. runFactory(id, deps, factory);
  60646. }
  60647. }
  60648. //define.require, which has access to all the values in the
  60649. //cache. Useful for AMD modules that all have IDs in the file,
  60650. //but need to finally export a value to node based on one of those
  60651. //IDs.
  60652. define.require = function (id) {
  60653. if (loaderCache[id]) {
  60654. return loaderCache[id];
  60655. }
  60656. if (defineCache[id]) {
  60657. runFactory.apply(null, defineCache[id]);
  60658. return loaderCache[id];
  60659. }
  60660. };
  60661. define.amd = {};
  60662. return define;
  60663. }(module)), require));