1
0

amber-cli.js 2.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define('__wrap__', function (requirejs) {
  4. requirejs.resolve = require.resolve;
  5. require = requirejs;
  6. // This file is used to make additional changes
  7. // when building an app to run in node.js.
  8. // Free to edit. You can break tests (cli test runner uses
  9. // this to build itself - it is a node executable).
  10. define("amber/Platform", ["amber_core/Platform-Node"], {});
  11. define("amber/compatibility", ["amber/node-compatibility"], {});
  12. define("jquery", {});
  13. define("config-node", function(){});
  14. define('amber/brikz',[], function () {
  15. return function Brikz(api, apiKey, initKey) {
  16. //jshint eqnull:true
  17. var brikz = this,
  18. backup = {};
  19. apiKey = apiKey || 'exports';
  20. initKey = initKey || '__init__';
  21. function mixin(src, target, what) {
  22. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  23. if (src == null) {
  24. target[keys[i]] = undefined;
  25. } else {
  26. var value = src[keys[i]];
  27. if (typeof value !== "undefined") {
  28. target[keys[i]] = value;
  29. }
  30. }
  31. }
  32. return target;
  33. }
  34. Object.defineProperties(this, {
  35. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  36. });
  37. var exclude = mixin(this, {});
  38. this.rebuild = function () {
  39. Object.keys(backup).forEach(function (key) {
  40. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  41. });
  42. var oapi = mixin(api, {}),
  43. order = [],
  44. chk = {};
  45. function ensure(key) {
  46. if (key in exclude) {
  47. return null;
  48. }
  49. var b = brikz[key],
  50. bak = backup[key];
  51. mixin(null, api, api);
  52. while (typeof b === "function") {
  53. (b.deps || []).forEach(ensure);
  54. b = new b(brikz, api, bak);
  55. }
  56. brikz[key] = b;
  57. if (b && !chk[key]) {
  58. chk[key] = true;
  59. order.push(b);
  60. }
  61. if (b && !b[apiKey]) {
  62. b[apiKey] = mixin(api, {});
  63. }
  64. }
  65. Object.keys(brikz).forEach(ensure);
  66. mixin(oapi, mixin(null, api, api));
  67. order.forEach(function (brik) {
  68. mixin(brik[apiKey] || {}, api);
  69. });
  70. order.forEach(function (brik) {
  71. if (brik[initKey]) {
  72. brik[initKey]();
  73. if (brik[initKey].once) {
  74. delete brik[initKey];
  75. }
  76. }
  77. });
  78. backup = mixin(brikz, {});
  79. };
  80. };
  81. });
  82. /*!
  83. * @overview es6-promise - a tiny implementation of Promises/A+.
  84. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  85. * @license Licensed under MIT license
  86. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  87. * @version 3.3.1
  88. */
  89. (function (global, factory) {
  90. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  91. typeof define === 'function' && define.amd ? define('amber/es6-promise',factory) :
  92. (global.ES6Promise = factory());
  93. }(this, (function () { 'use strict';
  94. function objectOrFunction(x) {
  95. return typeof x === 'function' || typeof x === 'object' && x !== null;
  96. }
  97. function isFunction(x) {
  98. return typeof x === 'function';
  99. }
  100. var _isArray = undefined;
  101. if (!Array.isArray) {
  102. _isArray = function (x) {
  103. return Object.prototype.toString.call(x) === '[object Array]';
  104. };
  105. } else {
  106. _isArray = Array.isArray;
  107. }
  108. var isArray = _isArray;
  109. var len = 0;
  110. var vertxNext = undefined;
  111. var customSchedulerFn = undefined;
  112. var asap = function asap(callback, arg) {
  113. queue[len] = callback;
  114. queue[len + 1] = arg;
  115. len += 2;
  116. if (len === 2) {
  117. // If len is 2, that means that we need to schedule an async flush.
  118. // If additional callbacks are queued before the queue is flushed, they
  119. // will be processed by this flush that we are scheduling.
  120. if (customSchedulerFn) {
  121. customSchedulerFn(flush);
  122. } else {
  123. scheduleFlush();
  124. }
  125. }
  126. };
  127. function setScheduler(scheduleFn) {
  128. customSchedulerFn = scheduleFn;
  129. }
  130. function setAsap(asapFn) {
  131. asap = asapFn;
  132. }
  133. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  134. var browserGlobal = browserWindow || {};
  135. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  136. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
  137. // test for web worker but not in IE10
  138. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  139. // node
  140. function useNextTick() {
  141. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  142. // see https://github.com/cujojs/when/issues/410 for details
  143. return function () {
  144. return process.nextTick(flush);
  145. };
  146. }
  147. // vertx
  148. function useVertxTimer() {
  149. return function () {
  150. vertxNext(flush);
  151. };
  152. }
  153. function useMutationObserver() {
  154. var iterations = 0;
  155. var observer = new BrowserMutationObserver(flush);
  156. var node = document.createTextNode('');
  157. observer.observe(node, { characterData: true });
  158. return function () {
  159. node.data = iterations = ++iterations % 2;
  160. };
  161. }
  162. // web worker
  163. function useMessageChannel() {
  164. var channel = new MessageChannel();
  165. channel.port1.onmessage = flush;
  166. return function () {
  167. return channel.port2.postMessage(0);
  168. };
  169. }
  170. function useSetTimeout() {
  171. // Store setTimeout reference so es6-promise will be unaffected by
  172. // other code modifying setTimeout (like sinon.useFakeTimers())
  173. var globalSetTimeout = setTimeout;
  174. return function () {
  175. return globalSetTimeout(flush, 1);
  176. };
  177. }
  178. var queue = new Array(1000);
  179. function flush() {
  180. for (var i = 0; i < len; i += 2) {
  181. var callback = queue[i];
  182. var arg = queue[i + 1];
  183. callback(arg);
  184. queue[i] = undefined;
  185. queue[i + 1] = undefined;
  186. }
  187. len = 0;
  188. }
  189. function attemptVertx() {
  190. try {
  191. var r = require;
  192. var vertx = r('vertx');
  193. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  194. return useVertxTimer();
  195. } catch (e) {
  196. return useSetTimeout();
  197. }
  198. }
  199. var scheduleFlush = undefined;
  200. // Decide what async method to use to triggering processing of queued callbacks:
  201. if (isNode) {
  202. scheduleFlush = useNextTick();
  203. } else if (BrowserMutationObserver) {
  204. scheduleFlush = useMutationObserver();
  205. } else if (isWorker) {
  206. scheduleFlush = useMessageChannel();
  207. } else if (browserWindow === undefined && typeof require === 'function') {
  208. scheduleFlush = attemptVertx();
  209. } else {
  210. scheduleFlush = useSetTimeout();
  211. }
  212. function then(onFulfillment, onRejection) {
  213. var _arguments = arguments;
  214. var parent = this;
  215. var child = new this.constructor(noop);
  216. if (child[PROMISE_ID] === undefined) {
  217. makePromise(child);
  218. }
  219. var _state = parent._state;
  220. if (_state) {
  221. (function () {
  222. var callback = _arguments[_state - 1];
  223. asap(function () {
  224. return invokeCallback(_state, child, callback, parent._result);
  225. });
  226. })();
  227. } else {
  228. subscribe(parent, child, onFulfillment, onRejection);
  229. }
  230. return child;
  231. }
  232. /**
  233. `Promise.resolve` returns a promise that will become resolved with the
  234. passed `value`. It is shorthand for the following:
  235. ```javascript
  236. let promise = new Promise(function(resolve, reject){
  237. resolve(1);
  238. });
  239. promise.then(function(value){
  240. // value === 1
  241. });
  242. ```
  243. Instead of writing the above, your code now simply becomes the following:
  244. ```javascript
  245. let promise = Promise.resolve(1);
  246. promise.then(function(value){
  247. // value === 1
  248. });
  249. ```
  250. @method resolve
  251. @static
  252. @param {Any} value value that the returned promise will be resolved with
  253. Useful for tooling.
  254. @return {Promise} a promise that will become fulfilled with the given
  255. `value`
  256. */
  257. function resolve(object) {
  258. /*jshint validthis:true */
  259. var Constructor = this;
  260. if (object && typeof object === 'object' && object.constructor === Constructor) {
  261. return object;
  262. }
  263. var promise = new Constructor(noop);
  264. _resolve(promise, object);
  265. return promise;
  266. }
  267. var PROMISE_ID = Math.random().toString(36).substring(16);
  268. function noop() {}
  269. var PENDING = void 0;
  270. var FULFILLED = 1;
  271. var REJECTED = 2;
  272. var GET_THEN_ERROR = new ErrorObject();
  273. function selfFulfillment() {
  274. return new TypeError("You cannot resolve a promise with itself");
  275. }
  276. function cannotReturnOwn() {
  277. return new TypeError('A promises callback cannot return that same promise.');
  278. }
  279. function getThen(promise) {
  280. try {
  281. return promise.then;
  282. } catch (error) {
  283. GET_THEN_ERROR.error = error;
  284. return GET_THEN_ERROR;
  285. }
  286. }
  287. function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  288. try {
  289. then.call(value, fulfillmentHandler, rejectionHandler);
  290. } catch (e) {
  291. return e;
  292. }
  293. }
  294. function handleForeignThenable(promise, thenable, then) {
  295. asap(function (promise) {
  296. var sealed = false;
  297. var error = tryThen(then, thenable, function (value) {
  298. if (sealed) {
  299. return;
  300. }
  301. sealed = true;
  302. if (thenable !== value) {
  303. _resolve(promise, value);
  304. } else {
  305. fulfill(promise, value);
  306. }
  307. }, function (reason) {
  308. if (sealed) {
  309. return;
  310. }
  311. sealed = true;
  312. _reject(promise, reason);
  313. }, 'Settle: ' + (promise._label || ' unknown promise'));
  314. if (!sealed && error) {
  315. sealed = true;
  316. _reject(promise, error);
  317. }
  318. }, promise);
  319. }
  320. function handleOwnThenable(promise, thenable) {
  321. if (thenable._state === FULFILLED) {
  322. fulfill(promise, thenable._result);
  323. } else if (thenable._state === REJECTED) {
  324. _reject(promise, thenable._result);
  325. } else {
  326. subscribe(thenable, undefined, function (value) {
  327. return _resolve(promise, value);
  328. }, function (reason) {
  329. return _reject(promise, reason);
  330. });
  331. }
  332. }
  333. function handleMaybeThenable(promise, maybeThenable, then$$) {
  334. if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
  335. handleOwnThenable(promise, maybeThenable);
  336. } else {
  337. if (then$$ === GET_THEN_ERROR) {
  338. _reject(promise, GET_THEN_ERROR.error);
  339. } else if (then$$ === undefined) {
  340. fulfill(promise, maybeThenable);
  341. } else if (isFunction(then$$)) {
  342. handleForeignThenable(promise, maybeThenable, then$$);
  343. } else {
  344. fulfill(promise, maybeThenable);
  345. }
  346. }
  347. }
  348. function _resolve(promise, value) {
  349. if (promise === value) {
  350. _reject(promise, selfFulfillment());
  351. } else if (objectOrFunction(value)) {
  352. handleMaybeThenable(promise, value, getThen(value));
  353. } else {
  354. fulfill(promise, value);
  355. }
  356. }
  357. function publishRejection(promise) {
  358. if (promise._onerror) {
  359. promise._onerror(promise._result);
  360. }
  361. publish(promise);
  362. }
  363. function fulfill(promise, value) {
  364. if (promise._state !== PENDING) {
  365. return;
  366. }
  367. promise._result = value;
  368. promise._state = FULFILLED;
  369. if (promise._subscribers.length !== 0) {
  370. asap(publish, promise);
  371. }
  372. }
  373. function _reject(promise, reason) {
  374. if (promise._state !== PENDING) {
  375. return;
  376. }
  377. promise._state = REJECTED;
  378. promise._result = reason;
  379. asap(publishRejection, promise);
  380. }
  381. function subscribe(parent, child, onFulfillment, onRejection) {
  382. var _subscribers = parent._subscribers;
  383. var length = _subscribers.length;
  384. parent._onerror = null;
  385. _subscribers[length] = child;
  386. _subscribers[length + FULFILLED] = onFulfillment;
  387. _subscribers[length + REJECTED] = onRejection;
  388. if (length === 0 && parent._state) {
  389. asap(publish, parent);
  390. }
  391. }
  392. function publish(promise) {
  393. var subscribers = promise._subscribers;
  394. var settled = promise._state;
  395. if (subscribers.length === 0) {
  396. return;
  397. }
  398. var child = undefined,
  399. callback = undefined,
  400. detail = promise._result;
  401. for (var i = 0; i < subscribers.length; i += 3) {
  402. child = subscribers[i];
  403. callback = subscribers[i + settled];
  404. if (child) {
  405. invokeCallback(settled, child, callback, detail);
  406. } else {
  407. callback(detail);
  408. }
  409. }
  410. promise._subscribers.length = 0;
  411. }
  412. function ErrorObject() {
  413. this.error = null;
  414. }
  415. var TRY_CATCH_ERROR = new ErrorObject();
  416. function tryCatch(callback, detail) {
  417. try {
  418. return callback(detail);
  419. } catch (e) {
  420. TRY_CATCH_ERROR.error = e;
  421. return TRY_CATCH_ERROR;
  422. }
  423. }
  424. function invokeCallback(settled, promise, callback, detail) {
  425. var hasCallback = isFunction(callback),
  426. value = undefined,
  427. error = undefined,
  428. succeeded = undefined,
  429. failed = undefined;
  430. if (hasCallback) {
  431. value = tryCatch(callback, detail);
  432. if (value === TRY_CATCH_ERROR) {
  433. failed = true;
  434. error = value.error;
  435. value = null;
  436. } else {
  437. succeeded = true;
  438. }
  439. if (promise === value) {
  440. _reject(promise, cannotReturnOwn());
  441. return;
  442. }
  443. } else {
  444. value = detail;
  445. succeeded = true;
  446. }
  447. if (promise._state !== PENDING) {
  448. // noop
  449. } else if (hasCallback && succeeded) {
  450. _resolve(promise, value);
  451. } else if (failed) {
  452. _reject(promise, error);
  453. } else if (settled === FULFILLED) {
  454. fulfill(promise, value);
  455. } else if (settled === REJECTED) {
  456. _reject(promise, value);
  457. }
  458. }
  459. function initializePromise(promise, resolver) {
  460. try {
  461. resolver(function resolvePromise(value) {
  462. _resolve(promise, value);
  463. }, function rejectPromise(reason) {
  464. _reject(promise, reason);
  465. });
  466. } catch (e) {
  467. _reject(promise, e);
  468. }
  469. }
  470. var id = 0;
  471. function nextId() {
  472. return id++;
  473. }
  474. function makePromise(promise) {
  475. promise[PROMISE_ID] = id++;
  476. promise._state = undefined;
  477. promise._result = undefined;
  478. promise._subscribers = [];
  479. }
  480. function Enumerator(Constructor, input) {
  481. this._instanceConstructor = Constructor;
  482. this.promise = new Constructor(noop);
  483. if (!this.promise[PROMISE_ID]) {
  484. makePromise(this.promise);
  485. }
  486. if (isArray(input)) {
  487. this._input = input;
  488. this.length = input.length;
  489. this._remaining = input.length;
  490. this._result = new Array(this.length);
  491. if (this.length === 0) {
  492. fulfill(this.promise, this._result);
  493. } else {
  494. this.length = this.length || 0;
  495. this._enumerate();
  496. if (this._remaining === 0) {
  497. fulfill(this.promise, this._result);
  498. }
  499. }
  500. } else {
  501. _reject(this.promise, validationError());
  502. }
  503. }
  504. function validationError() {
  505. return new Error('Array Methods must be provided an Array');
  506. };
  507. Enumerator.prototype._enumerate = function () {
  508. var length = this.length;
  509. var _input = this._input;
  510. for (var i = 0; this._state === PENDING && i < length; i++) {
  511. this._eachEntry(_input[i], i);
  512. }
  513. };
  514. Enumerator.prototype._eachEntry = function (entry, i) {
  515. var c = this._instanceConstructor;
  516. var resolve$$ = c.resolve;
  517. if (resolve$$ === resolve) {
  518. var _then = getThen(entry);
  519. if (_then === then && entry._state !== PENDING) {
  520. this._settledAt(entry._state, i, entry._result);
  521. } else if (typeof _then !== 'function') {
  522. this._remaining--;
  523. this._result[i] = entry;
  524. } else if (c === Promise) {
  525. var promise = new c(noop);
  526. handleMaybeThenable(promise, entry, _then);
  527. this._willSettleAt(promise, i);
  528. } else {
  529. this._willSettleAt(new c(function (resolve$$) {
  530. return resolve$$(entry);
  531. }), i);
  532. }
  533. } else {
  534. this._willSettleAt(resolve$$(entry), i);
  535. }
  536. };
  537. Enumerator.prototype._settledAt = function (state, i, value) {
  538. var promise = this.promise;
  539. if (promise._state === PENDING) {
  540. this._remaining--;
  541. if (state === REJECTED) {
  542. _reject(promise, value);
  543. } else {
  544. this._result[i] = value;
  545. }
  546. }
  547. if (this._remaining === 0) {
  548. fulfill(promise, this._result);
  549. }
  550. };
  551. Enumerator.prototype._willSettleAt = function (promise, i) {
  552. var enumerator = this;
  553. subscribe(promise, undefined, function (value) {
  554. return enumerator._settledAt(FULFILLED, i, value);
  555. }, function (reason) {
  556. return enumerator._settledAt(REJECTED, i, reason);
  557. });
  558. };
  559. /**
  560. `Promise.all` accepts an array of promises, and returns a new promise which
  561. is fulfilled with an array of fulfillment values for the passed promises, or
  562. rejected with the reason of the first passed promise to be rejected. It casts all
  563. elements of the passed iterable to promises as it runs this algorithm.
  564. Example:
  565. ```javascript
  566. let promise1 = resolve(1);
  567. let promise2 = resolve(2);
  568. let promise3 = resolve(3);
  569. let promises = [ promise1, promise2, promise3 ];
  570. Promise.all(promises).then(function(array){
  571. // The array here would be [ 1, 2, 3 ];
  572. });
  573. ```
  574. If any of the `promises` given to `all` are rejected, the first promise
  575. that is rejected will be given as an argument to the returned promises's
  576. rejection handler. For example:
  577. Example:
  578. ```javascript
  579. let promise1 = resolve(1);
  580. let promise2 = reject(new Error("2"));
  581. let promise3 = reject(new Error("3"));
  582. let promises = [ promise1, promise2, promise3 ];
  583. Promise.all(promises).then(function(array){
  584. // Code here never runs because there are rejected promises!
  585. }, function(error) {
  586. // error.message === "2"
  587. });
  588. ```
  589. @method all
  590. @static
  591. @param {Array} entries array of promises
  592. @param {String} label optional string for labeling the promise.
  593. Useful for tooling.
  594. @return {Promise} promise that is fulfilled when all `promises` have been
  595. fulfilled, or rejected if any of them become rejected.
  596. @static
  597. */
  598. function all(entries) {
  599. return new Enumerator(this, entries).promise;
  600. }
  601. /**
  602. `Promise.race` returns a new promise which is settled in the same way as the
  603. first passed promise to settle.
  604. Example:
  605. ```javascript
  606. let promise1 = new Promise(function(resolve, reject){
  607. setTimeout(function(){
  608. resolve('promise 1');
  609. }, 200);
  610. });
  611. let promise2 = new Promise(function(resolve, reject){
  612. setTimeout(function(){
  613. resolve('promise 2');
  614. }, 100);
  615. });
  616. Promise.race([promise1, promise2]).then(function(result){
  617. // result === 'promise 2' because it was resolved before promise1
  618. // was resolved.
  619. });
  620. ```
  621. `Promise.race` is deterministic in that only the state of the first
  622. settled promise matters. For example, even if other promises given to the
  623. `promises` array argument are resolved, but the first settled promise has
  624. become rejected before the other promises became fulfilled, the returned
  625. promise will become rejected:
  626. ```javascript
  627. let promise1 = new Promise(function(resolve, reject){
  628. setTimeout(function(){
  629. resolve('promise 1');
  630. }, 200);
  631. });
  632. let promise2 = new Promise(function(resolve, reject){
  633. setTimeout(function(){
  634. reject(new Error('promise 2'));
  635. }, 100);
  636. });
  637. Promise.race([promise1, promise2]).then(function(result){
  638. // Code here never runs
  639. }, function(reason){
  640. // reason.message === 'promise 2' because promise 2 became rejected before
  641. // promise 1 became fulfilled
  642. });
  643. ```
  644. An example real-world use case is implementing timeouts:
  645. ```javascript
  646. Promise.race([ajax('foo.json'), timeout(5000)])
  647. ```
  648. @method race
  649. @static
  650. @param {Array} promises array of promises to observe
  651. Useful for tooling.
  652. @return {Promise} a promise which settles in the same way as the first passed
  653. promise to settle.
  654. */
  655. function race(entries) {
  656. /*jshint validthis:true */
  657. var Constructor = this;
  658. if (!isArray(entries)) {
  659. return new Constructor(function (_, reject) {
  660. return reject(new TypeError('You must pass an array to race.'));
  661. });
  662. } else {
  663. return new Constructor(function (resolve, reject) {
  664. var length = entries.length;
  665. for (var i = 0; i < length; i++) {
  666. Constructor.resolve(entries[i]).then(resolve, reject);
  667. }
  668. });
  669. }
  670. }
  671. /**
  672. `Promise.reject` returns a promise rejected with the passed `reason`.
  673. It is shorthand for the following:
  674. ```javascript
  675. let promise = new Promise(function(resolve, reject){
  676. reject(new Error('WHOOPS'));
  677. });
  678. promise.then(function(value){
  679. // Code here doesn't run because the promise is rejected!
  680. }, function(reason){
  681. // reason.message === 'WHOOPS'
  682. });
  683. ```
  684. Instead of writing the above, your code now simply becomes the following:
  685. ```javascript
  686. let promise = Promise.reject(new Error('WHOOPS'));
  687. promise.then(function(value){
  688. // Code here doesn't run because the promise is rejected!
  689. }, function(reason){
  690. // reason.message === 'WHOOPS'
  691. });
  692. ```
  693. @method reject
  694. @static
  695. @param {Any} reason value that the returned promise will be rejected with.
  696. Useful for tooling.
  697. @return {Promise} a promise rejected with the given `reason`.
  698. */
  699. function reject(reason) {
  700. /*jshint validthis:true */
  701. var Constructor = this;
  702. var promise = new Constructor(noop);
  703. _reject(promise, reason);
  704. return promise;
  705. }
  706. function needsResolver() {
  707. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  708. }
  709. function needsNew() {
  710. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  711. }
  712. /**
  713. Promise objects represent the eventual result of an asynchronous operation. The
  714. primary way of interacting with a promise is through its `then` method, which
  715. registers callbacks to receive either a promise's eventual value or the reason
  716. why the promise cannot be fulfilled.
  717. Terminology
  718. -----------
  719. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  720. - `thenable` is an object or function that defines a `then` method.
  721. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  722. - `exception` is a value that is thrown using the throw statement.
  723. - `reason` is a value that indicates why a promise was rejected.
  724. - `settled` the final resting state of a promise, fulfilled or rejected.
  725. A promise can be in one of three states: pending, fulfilled, or rejected.
  726. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  727. state. Promises that are rejected have a rejection reason and are in the
  728. rejected state. A fulfillment value is never a thenable.
  729. Promises can also be said to *resolve* a value. If this value is also a
  730. promise, then the original promise's settled state will match the value's
  731. settled state. So a promise that *resolves* a promise that rejects will
  732. itself reject, and a promise that *resolves* a promise that fulfills will
  733. itself fulfill.
  734. Basic Usage:
  735. ------------
  736. ```js
  737. let promise = new Promise(function(resolve, reject) {
  738. // on success
  739. resolve(value);
  740. // on failure
  741. reject(reason);
  742. });
  743. promise.then(function(value) {
  744. // on fulfillment
  745. }, function(reason) {
  746. // on rejection
  747. });
  748. ```
  749. Advanced Usage:
  750. ---------------
  751. Promises shine when abstracting away asynchronous interactions such as
  752. `XMLHttpRequest`s.
  753. ```js
  754. function getJSON(url) {
  755. return new Promise(function(resolve, reject){
  756. let xhr = new XMLHttpRequest();
  757. xhr.open('GET', url);
  758. xhr.onreadystatechange = handler;
  759. xhr.responseType = 'json';
  760. xhr.setRequestHeader('Accept', 'application/json');
  761. xhr.send();
  762. function handler() {
  763. if (this.readyState === this.DONE) {
  764. if (this.status === 200) {
  765. resolve(this.response);
  766. } else {
  767. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  768. }
  769. }
  770. };
  771. });
  772. }
  773. getJSON('/posts.json').then(function(json) {
  774. // on fulfillment
  775. }, function(reason) {
  776. // on rejection
  777. });
  778. ```
  779. Unlike callbacks, promises are great composable primitives.
  780. ```js
  781. Promise.all([
  782. getJSON('/posts'),
  783. getJSON('/comments')
  784. ]).then(function(values){
  785. values[0] // => postsJSON
  786. values[1] // => commentsJSON
  787. return values;
  788. });
  789. ```
  790. @class Promise
  791. @param {function} resolver
  792. Useful for tooling.
  793. @constructor
  794. */
  795. function Promise(resolver) {
  796. this[PROMISE_ID] = nextId();
  797. this._result = this._state = undefined;
  798. this._subscribers = [];
  799. if (noop !== resolver) {
  800. typeof resolver !== 'function' && needsResolver();
  801. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  802. }
  803. }
  804. Promise.all = all;
  805. Promise.race = race;
  806. Promise.resolve = resolve;
  807. Promise.reject = reject;
  808. Promise._setScheduler = setScheduler;
  809. Promise._setAsap = setAsap;
  810. Promise._asap = asap;
  811. Promise.prototype = {
  812. constructor: Promise,
  813. /**
  814. The primary way of interacting with a promise is through its `then` method,
  815. which registers callbacks to receive either a promise's eventual value or the
  816. reason why the promise cannot be fulfilled.
  817. ```js
  818. findUser().then(function(user){
  819. // user is available
  820. }, function(reason){
  821. // user is unavailable, and you are given the reason why
  822. });
  823. ```
  824. Chaining
  825. --------
  826. The return value of `then` is itself a promise. This second, 'downstream'
  827. promise is resolved with the return value of the first promise's fulfillment
  828. or rejection handler, or rejected if the handler throws an exception.
  829. ```js
  830. findUser().then(function (user) {
  831. return user.name;
  832. }, function (reason) {
  833. return 'default name';
  834. }).then(function (userName) {
  835. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  836. // will be `'default name'`
  837. });
  838. findUser().then(function (user) {
  839. throw new Error('Found user, but still unhappy');
  840. }, function (reason) {
  841. throw new Error('`findUser` rejected and we're unhappy');
  842. }).then(function (value) {
  843. // never reached
  844. }, function (reason) {
  845. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  846. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  847. });
  848. ```
  849. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  850. ```js
  851. findUser().then(function (user) {
  852. throw new PedagogicalException('Upstream error');
  853. }).then(function (value) {
  854. // never reached
  855. }).then(function (value) {
  856. // never reached
  857. }, function (reason) {
  858. // The `PedgagocialException` is propagated all the way down to here
  859. });
  860. ```
  861. Assimilation
  862. ------------
  863. Sometimes the value you want to propagate to a downstream promise can only be
  864. retrieved asynchronously. This can be achieved by returning a promise in the
  865. fulfillment or rejection handler. The downstream promise will then be pending
  866. until the returned promise is settled. This is called *assimilation*.
  867. ```js
  868. findUser().then(function (user) {
  869. return findCommentsByAuthor(user);
  870. }).then(function (comments) {
  871. // The user's comments are now available
  872. });
  873. ```
  874. If the assimliated promise rejects, then the downstream promise will also reject.
  875. ```js
  876. findUser().then(function (user) {
  877. return findCommentsByAuthor(user);
  878. }).then(function (comments) {
  879. // If `findCommentsByAuthor` fulfills, we'll have the value here
  880. }, function (reason) {
  881. // If `findCommentsByAuthor` rejects, we'll have the reason here
  882. });
  883. ```
  884. Simple Example
  885. --------------
  886. Synchronous Example
  887. ```javascript
  888. let result;
  889. try {
  890. result = findResult();
  891. // success
  892. } catch(reason) {
  893. // failure
  894. }
  895. ```
  896. Errback Example
  897. ```js
  898. findResult(function(result, err){
  899. if (err) {
  900. // failure
  901. } else {
  902. // success
  903. }
  904. });
  905. ```
  906. Promise Example;
  907. ```javascript
  908. findResult().then(function(result){
  909. // success
  910. }, function(reason){
  911. // failure
  912. });
  913. ```
  914. Advanced Example
  915. --------------
  916. Synchronous Example
  917. ```javascript
  918. let author, books;
  919. try {
  920. author = findAuthor();
  921. books = findBooksByAuthor(author);
  922. // success
  923. } catch(reason) {
  924. // failure
  925. }
  926. ```
  927. Errback Example
  928. ```js
  929. function foundBooks(books) {
  930. }
  931. function failure(reason) {
  932. }
  933. findAuthor(function(author, err){
  934. if (err) {
  935. failure(err);
  936. // failure
  937. } else {
  938. try {
  939. findBoooksByAuthor(author, function(books, err) {
  940. if (err) {
  941. failure(err);
  942. } else {
  943. try {
  944. foundBooks(books);
  945. } catch(reason) {
  946. failure(reason);
  947. }
  948. }
  949. });
  950. } catch(error) {
  951. failure(err);
  952. }
  953. // success
  954. }
  955. });
  956. ```
  957. Promise Example;
  958. ```javascript
  959. findAuthor().
  960. then(findBooksByAuthor).
  961. then(function(books){
  962. // found books
  963. }).catch(function(reason){
  964. // something went wrong
  965. });
  966. ```
  967. @method then
  968. @param {Function} onFulfilled
  969. @param {Function} onRejected
  970. Useful for tooling.
  971. @return {Promise}
  972. */
  973. then: then,
  974. /**
  975. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  976. as the catch block of a try/catch statement.
  977. ```js
  978. function findAuthor(){
  979. throw new Error('couldn't find that author');
  980. }
  981. // synchronous
  982. try {
  983. findAuthor();
  984. } catch(reason) {
  985. // something went wrong
  986. }
  987. // async with promises
  988. findAuthor().catch(function(reason){
  989. // something went wrong
  990. });
  991. ```
  992. @method catch
  993. @param {Function} onRejection
  994. Useful for tooling.
  995. @return {Promise}
  996. */
  997. 'catch': function _catch(onRejection) {
  998. return this.then(null, onRejection);
  999. }
  1000. };
  1001. function polyfill() {
  1002. var local = undefined;
  1003. if (typeof global !== 'undefined') {
  1004. local = global;
  1005. } else if (typeof self !== 'undefined') {
  1006. local = self;
  1007. } else {
  1008. try {
  1009. local = Function('return this')();
  1010. } catch (e) {
  1011. throw new Error('polyfill failed because global object is unavailable in this environment');
  1012. }
  1013. }
  1014. var P = local.Promise;
  1015. if (P) {
  1016. var promiseToString = null;
  1017. try {
  1018. promiseToString = Object.prototype.toString.call(P.resolve());
  1019. } catch (e) {
  1020. // silently ignored
  1021. }
  1022. if (promiseToString === '[object Promise]' && !P.cast) {
  1023. return;
  1024. }
  1025. }
  1026. local.Promise = Promise;
  1027. }
  1028. polyfill();
  1029. // Strange compat..
  1030. Promise.polyfill = polyfill;
  1031. Promise.Promise = Promise;
  1032. return Promise;
  1033. })));
  1034. //# sourceMappingURL=es6-promise.map;
  1035. define('amber/es2015-polyfills',['amber/es6-promise'], function (promiseLib) {
  1036. promiseLib.polyfill();
  1037. });
  1038. // This file is injected dependencies by amber-compat-xxx modules.
  1039. // Therefore it is important that it _does_not_have_ define call.
  1040. ;
  1041. define("amber/node-compatibility", ["./es2015-polyfills"], function(){});
  1042. /* ====================================================================
  1043. |
  1044. | Amber Smalltalk
  1045. | http://amber-lang.net
  1046. |
  1047. ======================================================================
  1048. ======================================================================
  1049. |
  1050. | Copyright (c) 2010-2014
  1051. | Nicolas Petton <petton.nicolas@gmail.com>
  1052. |
  1053. | Copyright (c) 2012-2016
  1054. | The Amber team https://lolg.it/org/amber/members
  1055. | Amber contributors (see /CONTRIBUTORS)
  1056. |
  1057. | Amber is released under the MIT license
  1058. |
  1059. | Permission is hereby granted, free of charge, to any person obtaining
  1060. | a copy of this software and associated documentation files (the
  1061. | 'Software'), to deal in the Software without restriction, including
  1062. | without limitation the rights to use, copy, modify, merge, publish,
  1063. | distribute, sublicense, and/or sell copies of the Software, and to
  1064. | permit persons to whom the Software is furnished to do so, subject to
  1065. | the following conditions:
  1066. |
  1067. | The above copyright notice and this permission notice shall be
  1068. | included in all copies or substantial portions of the Software.
  1069. |
  1070. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1071. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1072. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1073. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1074. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1075. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1076. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1077. |
  1078. ==================================================================== */
  1079. //jshint eqnull:true
  1080. define('amber/boot',['require', './brikz', './compatibility'], function (require, Brikz) {
  1081. function inherits(child, parent) {
  1082. child.prototype = Object.create(parent.prototype, {
  1083. constructor: {
  1084. value: child,
  1085. enumerable: false, configurable: true, writable: true
  1086. }
  1087. });
  1088. return child;
  1089. }
  1090. function SmalltalkGlobalsBrik(brikz, st) {
  1091. // jshint evil:true
  1092. var jsGlobals = new Function("return this")();
  1093. var globals = Object.create(jsGlobals);
  1094. globals.SmalltalkSettings = {};
  1095. this.globals = globals;
  1096. }
  1097. function RootBrik(brikz, st) {
  1098. /* Smalltalk foundational objects */
  1099. /* SmalltalkRoot is the hidden root of the Amber hierarchy.
  1100. All objects including `Object` inherit from SmalltalkRoot */
  1101. function SmalltalkRoot() {
  1102. }
  1103. function SmalltalkProtoObject() {
  1104. }
  1105. function SmalltalkObject() {
  1106. }
  1107. function SmalltalkNil() {
  1108. }
  1109. inherits(SmalltalkProtoObject, SmalltalkRoot);
  1110. inherits(SmalltalkObject, SmalltalkProtoObject);
  1111. inherits(SmalltalkNil, SmalltalkObject);
  1112. this.Object = SmalltalkObject;
  1113. this.nil = new SmalltalkNil();
  1114. // Adds an `isNil` property to the `nil` object. When sending
  1115. // nil objects from one environment to another, doing
  1116. // `anObject == nil` (in JavaScript) does not always answer
  1117. // true as the referenced nil object might come from the other
  1118. // environment.
  1119. Object.defineProperty(this.nil, 'isNil', {
  1120. value: true,
  1121. enumerable: false, configurable: false, writable: false
  1122. });
  1123. // Hidden root class of the system.
  1124. this.rootAsClass = {fn: SmalltalkRoot};
  1125. this.__init__ = function () {
  1126. var globals = brikz.smalltalkGlobals.globals;
  1127. var addCoupledClass = brikz.classes.addCoupledClass;
  1128. st.addPackage("Kernel-Objects");
  1129. addCoupledClass("ProtoObject", undefined, "Kernel-Objects", SmalltalkProtoObject);
  1130. addCoupledClass("Object", globals.ProtoObject, "Kernel-Objects", SmalltalkObject);
  1131. addCoupledClass("UndefinedObject", globals.Object, "Kernel-Objects", SmalltalkNil);
  1132. };
  1133. this.__init__.once = true;
  1134. }
  1135. OrganizeBrik.deps = ["augments", "root"];
  1136. function OrganizeBrik(brikz, st) {
  1137. var SmalltalkObject = brikz.root.Object;
  1138. function SmalltalkOrganizer() {
  1139. }
  1140. function SmalltalkPackageOrganizer() {
  1141. this.elements = [];
  1142. }
  1143. function SmalltalkClassOrganizer() {
  1144. this.elements = [];
  1145. }
  1146. inherits(SmalltalkOrganizer, SmalltalkObject);
  1147. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  1148. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  1149. this.__init__ = function () {
  1150. var globals = brikz.smalltalkGlobals.globals;
  1151. var addCoupledClass = brikz.classes.addCoupledClass;
  1152. st.addPackage("Kernel-Infrastructure");
  1153. addCoupledClass("Organizer", globals.Object, "Kernel-Infrastructure", SmalltalkOrganizer);
  1154. addCoupledClass("PackageOrganizer", globals.Organizer, "Kernel-Infrastructure", SmalltalkPackageOrganizer);
  1155. addCoupledClass("ClassOrganizer", globals.Organizer, "Kernel-Infrastructure", SmalltalkClassOrganizer);
  1156. };
  1157. this.__init__.once = true;
  1158. this.setupClassOrganization = function (klass) {
  1159. klass.organization = new SmalltalkClassOrganizer();
  1160. klass.organization.theClass = klass;
  1161. };
  1162. this.setupPackageOrganization = function (pkg) {
  1163. pkg.organization = new SmalltalkPackageOrganizer();
  1164. };
  1165. this.addOrganizationElement = function (owner, element) {
  1166. owner.organization.elements.addElement(element);
  1167. };
  1168. this.removeOrganizationElement = function (owner, element) {
  1169. owner.organization.elements.removeElement(element);
  1170. };
  1171. }
  1172. SelectorsBrik.deps = ["selectorConversion"];
  1173. function SelectorsBrik(brikz, st) {
  1174. var selectorSet = Object.create(null);
  1175. var selectors = this.selectors = [];
  1176. var selectorPairs = this.selectorPairs = [];
  1177. this.registerSelector = function (stSelector) {
  1178. if (selectorSet[stSelector]) return null;
  1179. var jsSelector = st.st2js(stSelector);
  1180. selectorSet[stSelector] = true;
  1181. selectors.push(stSelector);
  1182. var pair = {st: stSelector, js: jsSelector};
  1183. selectorPairs.push(pair);
  1184. return pair;
  1185. };
  1186. /* Answer all method selectors based on dnu handlers */
  1187. st.allSelectors = function () {
  1188. return selectors;
  1189. };
  1190. }
  1191. PackagesBrik.deps = ["organize", "root"];
  1192. function PackagesBrik(brikz, st) {
  1193. var setupPackageOrganization = brikz.organize.setupPackageOrganization;
  1194. var SmalltalkObject = brikz.root.Object;
  1195. function SmalltalkPackage() {
  1196. }
  1197. inherits(SmalltalkPackage, SmalltalkObject);
  1198. this.__init__ = function () {
  1199. var globals = brikz.smalltalkGlobals.globals;
  1200. var addCoupledClass = brikz.classes.addCoupledClass;
  1201. st.addPackage("Kernel-Infrastructure");
  1202. addCoupledClass("Package", globals.Object, "Kernel-Infrastructure", SmalltalkPackage);
  1203. };
  1204. this.__init__.once = true;
  1205. st.packages = {};
  1206. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  1207. function pkg(spec) {
  1208. var that = new SmalltalkPackage();
  1209. that.pkgName = spec.pkgName;
  1210. setupPackageOrganization(that);
  1211. that.properties = spec.properties || {};
  1212. return that;
  1213. }
  1214. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  1215. If pkgName is null or empty we return nil, which is an allowed package for a class.
  1216. If package already exists we still update the properties of it. */
  1217. st.addPackage = function (pkgName, properties) {
  1218. if (!pkgName) {
  1219. return null;
  1220. }
  1221. if (!(st.packages[pkgName])) {
  1222. st.packages[pkgName] = pkg({
  1223. pkgName: pkgName,
  1224. properties: properties
  1225. });
  1226. } else {
  1227. if (properties) {
  1228. st.packages[pkgName].properties = properties;
  1229. }
  1230. }
  1231. return st.packages[pkgName];
  1232. };
  1233. }
  1234. ClassesBrik.deps = ["organize", "root", "smalltalkGlobals"];
  1235. function ClassesBrik(brikz, st) {
  1236. var setupClassOrganization = brikz.organize.setupClassOrganization;
  1237. var addOrganizationElement = brikz.organize.addOrganizationElement;
  1238. var removeOrganizationElement = brikz.organize.removeOrganizationElement;
  1239. var globals = brikz.smalltalkGlobals.globals;
  1240. var rootAsClass = brikz.root.rootAsClass;
  1241. var SmalltalkObject = brikz.root.Object;
  1242. rootAsClass.klass = {fn: SmalltalkClass};
  1243. function SmalltalkBehavior() {
  1244. }
  1245. function SmalltalkClass() {
  1246. }
  1247. function SmalltalkMetaclass() {
  1248. }
  1249. inherits(SmalltalkBehavior, SmalltalkObject);
  1250. inherits(SmalltalkClass, SmalltalkBehavior);
  1251. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  1252. SmalltalkBehavior.prototype.toString = function () {
  1253. return 'Smalltalk ' + this.className;
  1254. };
  1255. SmalltalkMetaclass.prototype.meta = true;
  1256. this.__init__ = function () {
  1257. var globals = brikz.smalltalkGlobals.globals;
  1258. var addCoupledClass = brikz.classes.addCoupledClass;
  1259. st.addPackage("Kernel-Classes");
  1260. addCoupledClass("Behavior", globals.Object, "Kernel-Classes", SmalltalkBehavior);
  1261. addCoupledClass("Metaclass", globals.Behavior, "Kernel-Classes", SmalltalkMetaclass);
  1262. addCoupledClass("Class", globals.Behavior, "Kernel-Classes", SmalltalkClass);
  1263. // Manually bootstrap the metaclass hierarchy
  1264. globals.ProtoObject.klass.superclass = rootAsClass.klass = globals.Class;
  1265. addSubclass(globals.ProtoObject.klass);
  1266. };
  1267. this.__init__.once = true;
  1268. /* Smalltalk classes */
  1269. var classes = [];
  1270. /* Smalltalk class creation. A class is an instance of an automatically
  1271. created metaclass object. Newly created classes (not their metaclass)
  1272. should be added to the smalltalk object, see smalltalk.addClass().
  1273. Superclass linking is *not* handled here, see smalltalk.init() */
  1274. function klass(spec) {
  1275. var setSuperClass = spec.superclass;
  1276. if (!spec.superclass) {
  1277. spec.superclass = rootAsClass;
  1278. }
  1279. var meta = metaclass(spec);
  1280. var that = meta.instanceClass;
  1281. that.superclass = setSuperClass;
  1282. that.fn = spec.fn || inherits(function () {
  1283. }, spec.superclass.fn);
  1284. that.subclasses = [];
  1285. setupClass(that, spec);
  1286. that.className = spec.className;
  1287. meta.className = spec.className + ' class';
  1288. meta.superclass = spec.superclass.klass;
  1289. return that;
  1290. }
  1291. function metaclass(spec) {
  1292. var that = new SmalltalkMetaclass();
  1293. that.fn = inherits(function () {
  1294. }, spec.superclass.klass.fn);
  1295. wireKlass(that);
  1296. that.instanceClass = new that.fn();
  1297. setupClass(that, {});
  1298. return that;
  1299. }
  1300. function setupClass(klass, spec) {
  1301. klass.iVarNames = spec.iVarNames || [];
  1302. if (spec.pkg) {
  1303. klass.pkg = spec.pkg;
  1304. }
  1305. setupClassOrganization(klass);
  1306. Object.defineProperty(klass, "methods", {
  1307. value: Object.create(null),
  1308. enumerable: false, configurable: true, writable: true
  1309. });
  1310. }
  1311. function wireKlass(klass) {
  1312. Object.defineProperty(klass.fn.prototype, "klass", {
  1313. value: klass,
  1314. enumerable: false, configurable: true, writable: true
  1315. });
  1316. }
  1317. this.wireKlass = wireKlass;
  1318. /* Add a class to the smalltalk object, creating a new one if needed.
  1319. A Package is lazily created if it does not exist with given name. */
  1320. st.addClass = function (className, superclass, iVarNames, pkgName) {
  1321. // While subclassing nil is allowed, it might be an error, so
  1322. // warn about it.
  1323. if (typeof superclass == 'undefined' || superclass && superclass.isNil) {
  1324. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  1325. }
  1326. return rawAddClass(pkgName, className, superclass, iVarNames, null);
  1327. };
  1328. function rawAddClass(pkgName, className, superclass, iVarNames, fn) {
  1329. var pkg = st.packages[pkgName];
  1330. if (!pkg) {
  1331. throw new Error("Missing package " + pkgName);
  1332. }
  1333. if (superclass == null || superclass.isNil) {
  1334. superclass = null;
  1335. }
  1336. var theClass = globals.hasOwnProperty(className) && globals[className];
  1337. if (theClass && theClass.superclass == superclass && !fn) {
  1338. if (iVarNames) theClass.iVarNames = iVarNames;
  1339. if (pkg) theClass.pkg = pkg;
  1340. } else {
  1341. if (theClass) {
  1342. iVarNames = iVarNames || theClass.iVarNames;
  1343. st.removeClass(theClass);
  1344. }
  1345. theClass = globals[className] = klass({
  1346. className: className,
  1347. superclass: superclass,
  1348. pkg: pkg,
  1349. iVarNames: iVarNames,
  1350. fn: fn
  1351. });
  1352. addSubclass(theClass);
  1353. }
  1354. classes.addElement(theClass);
  1355. addOrganizationElement(pkg, theClass);
  1356. if (st._classAdded) st._classAdded(theClass);
  1357. return theClass;
  1358. }
  1359. st.removeClass = function (klass) {
  1360. removeOrganizationElement(klass.pkg, klass);
  1361. classes.removeElement(klass);
  1362. removeSubclass(klass);
  1363. delete globals[klass.className];
  1364. };
  1365. function addSubclass(klass) {
  1366. if (klass.superclass) {
  1367. klass.superclass.subclasses.addElement(klass);
  1368. }
  1369. }
  1370. function removeSubclass(klass) {
  1371. if (klass.superclass) {
  1372. klass.superclass.subclasses.removeElement(klass);
  1373. }
  1374. }
  1375. /* Create a new class coupling with a JavaScript constructor,
  1376. and add it to the global smalltalk object.*/
  1377. this.addCoupledClass = function (className, superclass, pkgName, fn) {
  1378. return rawAddClass(pkgName, className, superclass, null, fn);
  1379. };
  1380. /* Create an alias for an existing class */
  1381. st.alias = function (klass, alias) {
  1382. globals[alias] = klass;
  1383. };
  1384. /* Answer all registered Smalltalk classes */
  1385. //TODO: remove the function and make smalltalk.classes an array
  1386. st.classes = this.classes = function () {
  1387. return classes;
  1388. };
  1389. function metaSubclasses(metaclass) {
  1390. return metaclass.instanceClass.subclasses
  1391. .filter(function (each) {
  1392. return !each.meta;
  1393. })
  1394. .map(function (each) {
  1395. return each.klass;
  1396. });
  1397. }
  1398. st.metaSubclasses = metaSubclasses;
  1399. st.traverseClassTree = function (klass, fn) {
  1400. var queue = [klass];
  1401. for (var i = 0; i < queue.length; ++i) {
  1402. var item = queue[i];
  1403. fn(item);
  1404. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  1405. queue.push.apply(queue, subclasses);
  1406. }
  1407. };
  1408. }
  1409. MethodsBrik.deps = ["organize", "selectors", "root", "selectorConversion"];
  1410. function MethodsBrik(brikz, st) {
  1411. var addOrganizationElement = brikz.organize.addOrganizationElement;
  1412. var registerSelector = brikz.selectors.registerSelector;
  1413. var SmalltalkObject = brikz.root.Object;
  1414. function SmalltalkMethod() {
  1415. }
  1416. inherits(SmalltalkMethod, SmalltalkObject);
  1417. this.__init__ = function () {
  1418. var globals = brikz.smalltalkGlobals.globals;
  1419. var addCoupledClass = brikz.classes.addCoupledClass;
  1420. st.addPackage("Kernel-Methods");
  1421. addCoupledClass("CompiledMethod", globals.Object, "Kernel-Methods", SmalltalkMethod);
  1422. };
  1423. this.__init__.once = true;
  1424. /* Smalltalk method object. To add a method to a class,
  1425. use smalltalk.addMethod() */
  1426. st.method = function (spec) {
  1427. var that = new SmalltalkMethod();
  1428. var selector = spec.selector;
  1429. that.selector = selector;
  1430. that.jsSelector = st.st2js(selector);
  1431. that.args = spec.args || {};
  1432. that.protocol = spec.protocol;
  1433. that.source = spec.source;
  1434. that.messageSends = spec.messageSends || [];
  1435. that.referencedClasses = spec.referencedClasses || [];
  1436. that.fn = spec.fn;
  1437. return that;
  1438. };
  1439. /* Add/remove a method to/from a class */
  1440. st.addMethod = function (method, klass) {
  1441. klass.methods[method.selector] = method;
  1442. method.methodClass = klass;
  1443. // During the bootstrap, #addCompiledMethod is not used.
  1444. // Therefore we populate the organizer here too
  1445. addOrganizationElement(klass, method.protocol);
  1446. var newSelectors = [];
  1447. function selectorInUse(stSelector) {
  1448. var pair = registerSelector(stSelector);
  1449. if (pair) {
  1450. newSelectors.push(pair);
  1451. }
  1452. }
  1453. selectorInUse(method.selector);
  1454. method.messageSends.forEach(selectorInUse);
  1455. if (st._methodAdded) st._methodAdded(method, klass);
  1456. if (st._selectorsAdded) st._selectorsAdded(newSelectors);
  1457. };
  1458. st.removeMethod = function (method, klass) {
  1459. if (klass !== method.methodClass) {
  1460. throw new Error(
  1461. "Refusing to remove method " +
  1462. method.methodClass.className + ">>" + method.selector +
  1463. " from different class " +
  1464. klass.className);
  1465. }
  1466. delete klass.methods[method.selector];
  1467. if (st._methodRemoved) st._methodRemoved(method, klass);
  1468. // Do *not* delete protocols from here.
  1469. // This is handled by #removeCompiledMethod
  1470. };
  1471. }
  1472. function AugmentsBrik(brikz, st) {
  1473. /* Array extensions */
  1474. Array.prototype.addElement = function (el) {
  1475. if (typeof el === 'undefined') {
  1476. return;
  1477. }
  1478. if (this.indexOf(el) == -1) {
  1479. this.push(el);
  1480. }
  1481. };
  1482. Array.prototype.removeElement = function (el) {
  1483. var i = this.indexOf(el);
  1484. if (i !== -1) {
  1485. this.splice(i, 1);
  1486. }
  1487. };
  1488. }
  1489. SmalltalkInitBrik.deps = ["globals", "classes"];
  1490. function SmalltalkInitBrik(brikz, st) {
  1491. var globals = brikz.smalltalkGlobals.globals;
  1492. var initialized = false;
  1493. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  1494. require(['./kernel-runtime'], resolve, reject);
  1495. });
  1496. /* Smalltalk initialization. Called on page load */
  1497. st.initialize = function () {
  1498. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  1499. if (initialized) {
  1500. return;
  1501. }
  1502. configureWithRuntime(brikz);
  1503. /* Alias definitions */
  1504. st.alias(globals.Array, "OrderedCollection");
  1505. st.alias(globals.Date, "Time");
  1506. st.classes().forEach(function (klass) {
  1507. klass._initialize();
  1508. });
  1509. initialized = true;
  1510. });
  1511. };
  1512. }
  1513. function SelectorConversionBrik(brikz, st) {
  1514. /* Convert a Smalltalk selector into a JS selector */
  1515. st.st2js = function (string) {
  1516. return '_' + string
  1517. .replace(/:/g, '_')
  1518. .replace(/[\&]/g, '_and')
  1519. .replace(/[\|]/g, '_or')
  1520. .replace(/[+]/g, '_plus')
  1521. .replace(/-/g, '_minus')
  1522. .replace(/[*]/g, '_star')
  1523. .replace(/[\/]/g, '_slash')
  1524. .replace(/[\\]/g, '_backslash')
  1525. .replace(/[\~]/g, '_tild')
  1526. .replace(/>/g, '_gt')
  1527. .replace(/</g, '_lt')
  1528. .replace(/=/g, '_eq')
  1529. .replace(/,/g, '_comma')
  1530. .replace(/[@]/g, '_at');
  1531. };
  1532. /* Convert a string to a valid smalltalk selector.
  1533. if you modify the following functions, also change st2js
  1534. accordingly */
  1535. st.js2st = function (selector) {
  1536. if (selector.match(/^__/)) {
  1537. return binaryJsToSt(selector);
  1538. } else {
  1539. return keywordJsToSt(selector);
  1540. }
  1541. };
  1542. function keywordJsToSt(selector) {
  1543. return selector.replace(/^_/, '').replace(/_/g, ':');
  1544. }
  1545. function binaryJsToSt(selector) {
  1546. return selector
  1547. .replace(/^_/, '')
  1548. .replace(/_and/g, '&')
  1549. .replace(/_or/g, '|')
  1550. .replace(/_plus/g, '+')
  1551. .replace(/_minus/g, '-')
  1552. .replace(/_star/g, '*')
  1553. .replace(/_slash/g, '/')
  1554. .replace(/_backslash/g, '\\')
  1555. .replace(/_tild/g, '~')
  1556. .replace(/_gt/g, '>')
  1557. .replace(/_lt/g, '<')
  1558. .replace(/_eq/g, '=')
  1559. .replace(/_comma/g, ',')
  1560. .replace(/_at/g, '@');
  1561. }
  1562. st.st2prop = function (stSelector) {
  1563. var colonPosition = stSelector.indexOf(':');
  1564. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1565. };
  1566. }
  1567. /* Adds AMD and requirejs related methods to the smalltalk object */
  1568. function AMDBrik(brikz, st) {
  1569. st.amdRequire = require;
  1570. st.defaultTransportType = st.defaultTransportType || "amd";
  1571. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  1572. }
  1573. /* Defines asReceiver to be present at load time */
  1574. /* (logically it belongs more to PrimitiveBrik) */
  1575. AsReceiverBrik.deps = ["smalltalkGlobals", "root"];
  1576. function AsReceiverBrik(brikz, st) {
  1577. var globals = brikz.smalltalkGlobals.globals;
  1578. var nil = brikz.root.nil;
  1579. /**
  1580. * This function is used all over the compiled amber code.
  1581. * It takes any value (JavaScript or Smalltalk)
  1582. * and returns a proper Amber Smalltalk receiver.
  1583. *
  1584. * null or undefined -> nil,
  1585. * plain JS object -> wrapped JS object,
  1586. * otherwise unchanged
  1587. */
  1588. this.asReceiver = function (o) {
  1589. if (o == null) return nil;
  1590. if (typeof o === "object" || typeof o === "function") {
  1591. return o.klass != null ? o : globals.JSObjectProxy._on_(o);
  1592. }
  1593. // IMPORTANT: This optimization (return o if typeof !== "object")
  1594. // assumes all primitive types are coupled with some
  1595. // (detached root) Smalltalk class so they can be returned as-is,
  1596. // without boxing and looking for .klass.
  1597. // KEEP THE primitives-are-coupled INVARIANT!
  1598. return o;
  1599. };
  1600. }
  1601. var api = {};
  1602. var brikz = new Brikz(api);
  1603. /* Making smalltalk that can load */
  1604. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1605. brikz.root = RootBrik;
  1606. brikz.selectors = SelectorsBrik;
  1607. brikz.organize = OrganizeBrik;
  1608. brikz.selectorConversion = SelectorConversionBrik;
  1609. brikz.packages = PackagesBrik;
  1610. brikz.classes = ClassesBrik;
  1611. brikz.methods = MethodsBrik;
  1612. brikz.stInit = SmalltalkInitBrik;
  1613. brikz.augments = AugmentsBrik;
  1614. brikz.asReceiver = AsReceiverBrik;
  1615. brikz.amd = AMDBrik;
  1616. brikz.rebuild();
  1617. return {
  1618. api: api,
  1619. nil: brikz.root.nil,
  1620. dnu: brikz.root.rootAsClass,
  1621. globals: brikz.smalltalkGlobals.globals,
  1622. asReceiver: brikz.asReceiver.asReceiver
  1623. };
  1624. });
  1625. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  1626. var globals = boot.globals,
  1627. exports = {},
  1628. api = boot.api,
  1629. nil = boot.nil;
  1630. // API
  1631. exports.popupHelios = function () {
  1632. require(['helios/index'], function (helios) {
  1633. helios.popup();
  1634. }, function (err) {
  1635. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  1636. });
  1637. };
  1638. Object.defineProperty(exports, "api", {
  1639. value: api,
  1640. enumerable: true, configurable: true, writable: false
  1641. });
  1642. Object.defineProperty(exports, "globals", {
  1643. value: globals,
  1644. enumerable: true, configurable: true, writable: false
  1645. });
  1646. Object.defineProperty(exports, "nil", {
  1647. value: nil,
  1648. enumerable: true, configurable: true, writable: false
  1649. });
  1650. function mixinToSettings(source) {
  1651. var settings = globals.SmalltalkSettings;
  1652. Object.keys(source).forEach(function (key) {
  1653. settings[key] = source[key];
  1654. });
  1655. }
  1656. function settingsInLocalStorage() {
  1657. //jshint evil:true
  1658. var global = new Function('return this')(),
  1659. storage = 'localStorage' in global && global.localStorage;
  1660. if (storage) {
  1661. var fromStorage;
  1662. try {
  1663. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  1664. } catch (ex) {
  1665. // pass
  1666. }
  1667. mixinToSettings(fromStorage || {});
  1668. if (typeof window !== "undefined") {
  1669. requirejs(['jquery'], function ($) {
  1670. $(window).on('beforeunload', function () {
  1671. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  1672. });
  1673. });
  1674. }
  1675. }
  1676. }
  1677. exports.initialize = function (options) {
  1678. return Promise.resolve()
  1679. .then(function () {
  1680. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  1681. })
  1682. .then(settingsInLocalStorage)
  1683. .then(function () {
  1684. return options || {};
  1685. })
  1686. .then(mixinToSettings)
  1687. .then(function () {
  1688. return api.initialize();
  1689. });
  1690. };
  1691. // Exports
  1692. return exports;
  1693. });
  1694. define("amber_core/Kernel-Objects", ["amber/boot"], function($boot){"use strict";
  1695. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  1696. $core.addPackage('Kernel-Objects');
  1697. $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  1698. $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  1699. $core.addClass('ProtoObject', null, [], 'Kernel-Objects');
  1700. $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.";
  1701. $core.addMethod(
  1702. $core.method({
  1703. selector: "=",
  1704. protocol: 'comparing',
  1705. fn: function (anObject){
  1706. var self=this;
  1707. return $core.withContext(function($ctx1) {
  1708. return self.__eq_eq(anObject);
  1709. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  1710. },
  1711. args: ["anObject"],
  1712. source: "= anObject\x0a\x09^ self == anObject",
  1713. referencedClasses: [],
  1714. messageSends: ["=="]
  1715. }),
  1716. $globals.ProtoObject);
  1717. $core.addMethod(
  1718. $core.method({
  1719. selector: "==",
  1720. protocol: 'comparing',
  1721. fn: function (anObject){
  1722. var self=this;
  1723. return $core.withContext(function($ctx1) {
  1724. return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject);
  1725. return self;
  1726. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  1727. },
  1728. args: ["anObject"],
  1729. source: "== anObject\x0a<return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject)>",
  1730. referencedClasses: [],
  1731. messageSends: []
  1732. }),
  1733. $globals.ProtoObject);
  1734. $core.addMethod(
  1735. $core.method({
  1736. selector: "asString",
  1737. protocol: 'converting',
  1738. fn: function (){
  1739. var self=this;
  1740. return $core.withContext(function($ctx1) {
  1741. return self._printString();
  1742. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  1743. },
  1744. args: [],
  1745. source: "asString\x0a\x09^ self printString",
  1746. referencedClasses: [],
  1747. messageSends: ["printString"]
  1748. }),
  1749. $globals.ProtoObject);
  1750. $core.addMethod(
  1751. $core.method({
  1752. selector: "class",
  1753. protocol: 'accessing',
  1754. fn: function (){
  1755. var self=this;
  1756. return $core.withContext(function($ctx1) {
  1757. return self.klass;
  1758. return self;
  1759. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  1760. },
  1761. args: [],
  1762. source: "class\x0a\x09<return self.klass>",
  1763. referencedClasses: [],
  1764. messageSends: []
  1765. }),
  1766. $globals.ProtoObject);
  1767. $core.addMethod(
  1768. $core.method({
  1769. selector: "doesNotUnderstand:",
  1770. protocol: 'error handling',
  1771. fn: function (aMessage){
  1772. var self=this;
  1773. return $core.withContext(function($ctx1) {
  1774. var $1;
  1775. $1=$recv($globals.MessageNotUnderstood)._new();
  1776. $recv($1)._receiver_(self);
  1777. $recv($1)._message_(aMessage);
  1778. $recv($1)._signal();
  1779. return self;
  1780. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  1781. },
  1782. args: ["aMessage"],
  1783. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1784. referencedClasses: ["MessageNotUnderstood"],
  1785. messageSends: ["receiver:", "new", "message:", "signal"]
  1786. }),
  1787. $globals.ProtoObject);
  1788. $core.addMethod(
  1789. $core.method({
  1790. selector: "evaluate:on:",
  1791. protocol: 'evaluating',
  1792. fn: function (aString,anEvaluator){
  1793. var self=this;
  1794. return $core.withContext(function($ctx1) {
  1795. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  1796. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  1797. },
  1798. args: ["aString", "anEvaluator"],
  1799. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  1800. referencedClasses: [],
  1801. messageSends: ["evaluate:receiver:"]
  1802. }),
  1803. $globals.ProtoObject);
  1804. $core.addMethod(
  1805. $core.method({
  1806. selector: "identityHash",
  1807. protocol: 'accessing',
  1808. fn: function (){
  1809. var self=this;
  1810. return $core.withContext(function($ctx1) {
  1811. var hash=self.identityHash;
  1812. if (hash) return hash;
  1813. hash=$core.nextId();
  1814. Object.defineProperty(self, 'identityHash', {value:hash});
  1815. return hash;
  1816. ;
  1817. return self;
  1818. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  1819. },
  1820. args: [],
  1821. source: "identityHash\x0a\x09<\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>",
  1822. referencedClasses: [],
  1823. messageSends: []
  1824. }),
  1825. $globals.ProtoObject);
  1826. $core.addMethod(
  1827. $core.method({
  1828. selector: "ifNil:",
  1829. protocol: 'testing',
  1830. fn: function (aBlock){
  1831. var self=this;
  1832. return self;
  1833. },
  1834. args: ["aBlock"],
  1835. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  1836. referencedClasses: [],
  1837. messageSends: []
  1838. }),
  1839. $globals.ProtoObject);
  1840. $core.addMethod(
  1841. $core.method({
  1842. selector: "ifNil:ifNotNil:",
  1843. protocol: 'testing',
  1844. fn: function (aBlock,anotherBlock){
  1845. var self=this;
  1846. return $core.withContext(function($ctx1) {
  1847. return $recv(anotherBlock)._value_(self);
  1848. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1849. },
  1850. args: ["aBlock", "anotherBlock"],
  1851. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  1852. referencedClasses: [],
  1853. messageSends: ["value:"]
  1854. }),
  1855. $globals.ProtoObject);
  1856. $core.addMethod(
  1857. $core.method({
  1858. selector: "ifNotNil:",
  1859. protocol: 'testing',
  1860. fn: function (aBlock){
  1861. var self=this;
  1862. return $core.withContext(function($ctx1) {
  1863. return $recv(aBlock)._value_(self);
  1864. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  1865. },
  1866. args: ["aBlock"],
  1867. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1868. referencedClasses: [],
  1869. messageSends: ["value:"]
  1870. }),
  1871. $globals.ProtoObject);
  1872. $core.addMethod(
  1873. $core.method({
  1874. selector: "ifNotNil:ifNil:",
  1875. protocol: 'testing',
  1876. fn: function (aBlock,anotherBlock){
  1877. var self=this;
  1878. return $core.withContext(function($ctx1) {
  1879. return $recv(aBlock)._value_(self);
  1880. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1881. },
  1882. args: ["aBlock", "anotherBlock"],
  1883. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1884. referencedClasses: [],
  1885. messageSends: ["value:"]
  1886. }),
  1887. $globals.ProtoObject);
  1888. $core.addMethod(
  1889. $core.method({
  1890. selector: "initialize",
  1891. protocol: 'initialization',
  1892. fn: function (){
  1893. var self=this;
  1894. return self;
  1895. },
  1896. args: [],
  1897. source: "initialize",
  1898. referencedClasses: [],
  1899. messageSends: []
  1900. }),
  1901. $globals.ProtoObject);
  1902. $core.addMethod(
  1903. $core.method({
  1904. selector: "inspect",
  1905. protocol: 'inspecting',
  1906. fn: function (){
  1907. var self=this;
  1908. return $core.withContext(function($ctx1) {
  1909. $recv($globals.Inspector)._inspect_(self);
  1910. return self;
  1911. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  1912. },
  1913. args: [],
  1914. source: "inspect\x0a\x09Inspector inspect: self",
  1915. referencedClasses: ["Inspector"],
  1916. messageSends: ["inspect:"]
  1917. }),
  1918. $globals.ProtoObject);
  1919. $core.addMethod(
  1920. $core.method({
  1921. selector: "inspectOn:",
  1922. protocol: 'inspecting',
  1923. fn: function (anInspector){
  1924. var self=this;
  1925. return self;
  1926. },
  1927. args: ["anInspector"],
  1928. source: "inspectOn: anInspector",
  1929. referencedClasses: [],
  1930. messageSends: []
  1931. }),
  1932. $globals.ProtoObject);
  1933. $core.addMethod(
  1934. $core.method({
  1935. selector: "instVarAt:",
  1936. protocol: 'accessing',
  1937. fn: function (aString){
  1938. var self=this;
  1939. return $core.withContext(function($ctx1) {
  1940. return self['@'+aString] ;
  1941. return self;
  1942. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  1943. },
  1944. args: ["aString"],
  1945. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  1946. referencedClasses: [],
  1947. messageSends: []
  1948. }),
  1949. $globals.ProtoObject);
  1950. $core.addMethod(
  1951. $core.method({
  1952. selector: "instVarAt:put:",
  1953. protocol: 'accessing',
  1954. fn: function (aString,anObject){
  1955. var self=this;
  1956. return $core.withContext(function($ctx1) {
  1957. self['@' + aString] = anObject ;
  1958. return self;
  1959. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  1960. },
  1961. args: ["aString", "anObject"],
  1962. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  1963. referencedClasses: [],
  1964. messageSends: []
  1965. }),
  1966. $globals.ProtoObject);
  1967. $core.addMethod(
  1968. $core.method({
  1969. selector: "isKindOf:",
  1970. protocol: 'testing',
  1971. fn: function (aClass){
  1972. var self=this;
  1973. return $core.withContext(function($ctx1) {
  1974. var $1;
  1975. $1=self._isMemberOf_(aClass);
  1976. if($core.assert($1)){
  1977. return true;
  1978. } else {
  1979. return $recv(self._class())._inheritsFrom_(aClass);
  1980. };
  1981. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  1982. },
  1983. args: ["aClass"],
  1984. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  1985. referencedClasses: [],
  1986. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  1987. }),
  1988. $globals.ProtoObject);
  1989. $core.addMethod(
  1990. $core.method({
  1991. selector: "isNil",
  1992. protocol: 'testing',
  1993. fn: function (){
  1994. var self=this;
  1995. return false;
  1996. },
  1997. args: [],
  1998. source: "isNil\x0a\x09^ false",
  1999. referencedClasses: [],
  2000. messageSends: []
  2001. }),
  2002. $globals.ProtoObject);
  2003. $core.addMethod(
  2004. $core.method({
  2005. selector: "isSameInstanceAs:",
  2006. protocol: 'comparing',
  2007. fn: function (anObject){
  2008. var self=this;
  2009. return $core.withContext(function($ctx1) {
  2010. var $1;
  2011. $1=self._identityHash();
  2012. $ctx1.sendIdx["identityHash"]=1;
  2013. return $recv($1).__eq($recv(anObject)._identityHash());
  2014. }, function($ctx1) {$ctx1.fill(self,"isSameInstanceAs:",{anObject:anObject},$globals.ProtoObject)});
  2015. },
  2016. args: ["anObject"],
  2017. source: "isSameInstanceAs: anObject\x0a\x09^ self identityHash = anObject identityHash",
  2018. referencedClasses: [],
  2019. messageSends: ["=", "identityHash"]
  2020. }),
  2021. $globals.ProtoObject);
  2022. $core.addMethod(
  2023. $core.method({
  2024. selector: "notNil",
  2025. protocol: 'testing',
  2026. fn: function (){
  2027. var self=this;
  2028. return $core.withContext(function($ctx1) {
  2029. return $recv(self._isNil())._not();
  2030. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2031. },
  2032. args: [],
  2033. source: "notNil\x0a\x09^ self isNil not",
  2034. referencedClasses: [],
  2035. messageSends: ["not", "isNil"]
  2036. }),
  2037. $globals.ProtoObject);
  2038. $core.addMethod(
  2039. $core.method({
  2040. selector: "perform:",
  2041. protocol: 'message handling',
  2042. fn: function (aString){
  2043. var self=this;
  2044. return $core.withContext(function($ctx1) {
  2045. return self._perform_withArguments_(aString,[]);
  2046. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2047. },
  2048. args: ["aString"],
  2049. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2050. referencedClasses: [],
  2051. messageSends: ["perform:withArguments:"]
  2052. }),
  2053. $globals.ProtoObject);
  2054. $core.addMethod(
  2055. $core.method({
  2056. selector: "perform:withArguments:",
  2057. protocol: 'message handling',
  2058. fn: function (aString,aCollection){
  2059. var self=this;
  2060. return $core.withContext(function($ctx1) {
  2061. return $core.send2(self, aString, aCollection);
  2062. return self;
  2063. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2064. },
  2065. args: ["aString", "aCollection"],
  2066. source: "perform: aString withArguments: aCollection\x0a\x09<return $core.send2(self, aString, aCollection)>",
  2067. referencedClasses: [],
  2068. messageSends: []
  2069. }),
  2070. $globals.ProtoObject);
  2071. $core.addMethod(
  2072. $core.method({
  2073. selector: "printOn:",
  2074. protocol: 'printing',
  2075. fn: function (aStream){
  2076. var self=this;
  2077. return $core.withContext(function($ctx1) {
  2078. var $5,$4,$3,$2,$1;
  2079. $5=self._class();
  2080. $ctx1.sendIdx["class"]=1;
  2081. $4=$recv($5)._name();
  2082. $ctx1.sendIdx["name"]=1;
  2083. $3=$recv($4)._first();
  2084. $2=$recv($3)._isVowel();
  2085. if($core.assert($2)){
  2086. $1="an ";
  2087. } else {
  2088. $1="a ";
  2089. };
  2090. $recv(aStream)._nextPutAll_($1);
  2091. $ctx1.sendIdx["nextPutAll:"]=1;
  2092. $recv(aStream)._nextPutAll_($recv(self._class())._name());
  2093. return self;
  2094. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  2095. },
  2096. args: ["aStream"],
  2097. 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",
  2098. referencedClasses: [],
  2099. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  2100. }),
  2101. $globals.ProtoObject);
  2102. $core.addMethod(
  2103. $core.method({
  2104. selector: "printString",
  2105. protocol: 'printing',
  2106. fn: function (){
  2107. var self=this;
  2108. return $core.withContext(function($ctx1) {
  2109. return $recv($globals.String)._streamContents_((function(str){
  2110. return $core.withContext(function($ctx2) {
  2111. return self._printOn_(str);
  2112. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  2113. }));
  2114. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  2115. },
  2116. args: [],
  2117. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  2118. referencedClasses: ["String"],
  2119. messageSends: ["streamContents:", "printOn:"]
  2120. }),
  2121. $globals.ProtoObject);
  2122. $core.addMethod(
  2123. $core.method({
  2124. selector: "yourself",
  2125. protocol: 'accessing',
  2126. fn: function (){
  2127. var self=this;
  2128. return self;
  2129. },
  2130. args: [],
  2131. source: "yourself\x0a\x09^ self",
  2132. referencedClasses: [],
  2133. messageSends: []
  2134. }),
  2135. $globals.ProtoObject);
  2136. $core.addMethod(
  2137. $core.method({
  2138. selector: "~=",
  2139. protocol: 'comparing',
  2140. fn: function (anObject){
  2141. var self=this;
  2142. return $core.withContext(function($ctx1) {
  2143. var $1;
  2144. $1=$recv(self.__eq(anObject)).__eq(false);
  2145. $ctx1.sendIdx["="]=1;
  2146. return $1;
  2147. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  2148. },
  2149. args: ["anObject"],
  2150. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  2151. referencedClasses: [],
  2152. messageSends: ["="]
  2153. }),
  2154. $globals.ProtoObject);
  2155. $core.addMethod(
  2156. $core.method({
  2157. selector: "~~",
  2158. protocol: 'comparing',
  2159. fn: function (anObject){
  2160. var self=this;
  2161. return $core.withContext(function($ctx1) {
  2162. return $recv(self.__eq_eq(anObject)).__eq(false);
  2163. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  2164. },
  2165. args: ["anObject"],
  2166. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  2167. referencedClasses: [],
  2168. messageSends: ["=", "=="]
  2169. }),
  2170. $globals.ProtoObject);
  2171. $core.addMethod(
  2172. $core.method({
  2173. selector: "initialize",
  2174. protocol: 'initialization',
  2175. fn: function (){
  2176. var self=this;
  2177. return self;
  2178. },
  2179. args: [],
  2180. source: "initialize",
  2181. referencedClasses: [],
  2182. messageSends: []
  2183. }),
  2184. $globals.ProtoObject.klass);
  2185. $core.addClass('Object', $globals.ProtoObject, [], 'Kernel-Objects');
  2186. $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.";
  2187. $core.addMethod(
  2188. $core.method({
  2189. selector: "->",
  2190. protocol: 'converting',
  2191. fn: function (anObject){
  2192. var self=this;
  2193. return $core.withContext(function($ctx1) {
  2194. return $recv($globals.Association)._key_value_(self,anObject);
  2195. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  2196. },
  2197. args: ["anObject"],
  2198. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  2199. referencedClasses: ["Association"],
  2200. messageSends: ["key:value:"]
  2201. }),
  2202. $globals.Object);
  2203. $core.addMethod(
  2204. $core.method({
  2205. selector: "asJSON",
  2206. protocol: 'converting',
  2207. fn: function (){
  2208. var self=this;
  2209. var variables;
  2210. return $core.withContext(function($ctx1) {
  2211. variables=$recv($globals.HashedCollection)._new();
  2212. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  2213. return $core.withContext(function($ctx2) {
  2214. return $recv(variables)._at_put_(each,$recv(self._instVarAt_(each))._asJSON());
  2215. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2216. }));
  2217. return variables;
  2218. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},$globals.Object)});
  2219. },
  2220. args: [],
  2221. 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",
  2222. referencedClasses: ["HashedCollection"],
  2223. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"]
  2224. }),
  2225. $globals.Object);
  2226. $core.addMethod(
  2227. $core.method({
  2228. selector: "asJSONString",
  2229. protocol: 'converting',
  2230. fn: function (){
  2231. var self=this;
  2232. return $core.withContext(function($ctx1) {
  2233. return $recv($globals.JSON)._stringify_(self._asJSON());
  2234. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  2235. },
  2236. args: [],
  2237. source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
  2238. referencedClasses: ["JSON"],
  2239. messageSends: ["stringify:", "asJSON"]
  2240. }),
  2241. $globals.Object);
  2242. $core.addMethod(
  2243. $core.method({
  2244. selector: "asJavascript",
  2245. protocol: 'converting',
  2246. fn: function (){
  2247. var self=this;
  2248. return $core.withContext(function($ctx1) {
  2249. return self._asString();
  2250. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Object)});
  2251. },
  2252. args: [],
  2253. source: "asJavascript\x0a\x09^ self asString",
  2254. referencedClasses: [],
  2255. messageSends: ["asString"]
  2256. }),
  2257. $globals.Object);
  2258. $core.addMethod(
  2259. $core.method({
  2260. selector: "basicAt:",
  2261. protocol: 'accessing',
  2262. fn: function (aString){
  2263. var self=this;
  2264. return $core.withContext(function($ctx1) {
  2265. return self[aString];
  2266. return self;
  2267. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  2268. },
  2269. args: ["aString"],
  2270. source: "basicAt: aString\x0a\x09<return self[aString]>",
  2271. referencedClasses: [],
  2272. messageSends: []
  2273. }),
  2274. $globals.Object);
  2275. $core.addMethod(
  2276. $core.method({
  2277. selector: "basicAt:put:",
  2278. protocol: 'accessing',
  2279. fn: function (aString,anObject){
  2280. var self=this;
  2281. return $core.withContext(function($ctx1) {
  2282. return self[aString] = anObject;
  2283. return self;
  2284. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  2285. },
  2286. args: ["aString", "anObject"],
  2287. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  2288. referencedClasses: [],
  2289. messageSends: []
  2290. }),
  2291. $globals.Object);
  2292. $core.addMethod(
  2293. $core.method({
  2294. selector: "basicDelete:",
  2295. protocol: 'accessing',
  2296. fn: function (aString){
  2297. var self=this;
  2298. return $core.withContext(function($ctx1) {
  2299. delete self[aString]; return aString;
  2300. return self;
  2301. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  2302. },
  2303. args: ["aString"],
  2304. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  2305. referencedClasses: [],
  2306. messageSends: []
  2307. }),
  2308. $globals.Object);
  2309. $core.addMethod(
  2310. $core.method({
  2311. selector: "basicPerform:",
  2312. protocol: 'message handling',
  2313. fn: function (aString){
  2314. var self=this;
  2315. return $core.withContext(function($ctx1) {
  2316. return self._basicPerform_withArguments_(aString,[]);
  2317. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  2318. },
  2319. args: ["aString"],
  2320. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  2321. referencedClasses: [],
  2322. messageSends: ["basicPerform:withArguments:"]
  2323. }),
  2324. $globals.Object);
  2325. $core.addMethod(
  2326. $core.method({
  2327. selector: "basicPerform:withArguments:",
  2328. protocol: 'message handling',
  2329. fn: function (aString,aCollection){
  2330. var self=this;
  2331. return $core.withContext(function($ctx1) {
  2332. return self[aString].apply(self, aCollection);;
  2333. return self;
  2334. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  2335. },
  2336. args: ["aString", "aCollection"],
  2337. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  2338. referencedClasses: [],
  2339. messageSends: []
  2340. }),
  2341. $globals.Object);
  2342. $core.addMethod(
  2343. $core.method({
  2344. selector: "browse",
  2345. protocol: 'browsing',
  2346. fn: function (){
  2347. var self=this;
  2348. return $core.withContext(function($ctx1) {
  2349. $recv($globals.Finder)._findClass_(self._class());
  2350. return self;
  2351. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  2352. },
  2353. args: [],
  2354. source: "browse\x0a\x09Finder findClass: self class",
  2355. referencedClasses: ["Finder"],
  2356. messageSends: ["findClass:", "class"]
  2357. }),
  2358. $globals.Object);
  2359. $core.addMethod(
  2360. $core.method({
  2361. selector: "copy",
  2362. protocol: 'copying',
  2363. fn: function (){
  2364. var self=this;
  2365. return $core.withContext(function($ctx1) {
  2366. return $recv(self._shallowCopy())._postCopy();
  2367. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  2368. },
  2369. args: [],
  2370. source: "copy\x0a\x09^ self shallowCopy postCopy",
  2371. referencedClasses: [],
  2372. messageSends: ["postCopy", "shallowCopy"]
  2373. }),
  2374. $globals.Object);
  2375. $core.addMethod(
  2376. $core.method({
  2377. selector: "deepCopy",
  2378. protocol: 'copying',
  2379. fn: function (){
  2380. var self=this;
  2381. return $core.withContext(function($ctx1) {
  2382. var copy = self.klass._new();
  2383. Object.keys(self).forEach(function (i) {
  2384. if(/^@.+/.test(i)) {
  2385. copy[i] = self[i]._deepCopy();
  2386. }
  2387. });
  2388. return copy;
  2389. ;
  2390. return self;
  2391. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  2392. },
  2393. args: [],
  2394. source: "deepCopy\x0a\x09<\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>",
  2395. referencedClasses: [],
  2396. messageSends: []
  2397. }),
  2398. $globals.Object);
  2399. $core.addMethod(
  2400. $core.method({
  2401. selector: "deprecatedAPI",
  2402. protocol: 'error handling',
  2403. fn: function (){
  2404. var self=this;
  2405. return $core.withContext(function($ctx1) {
  2406. var $1,$6,$5,$4,$8,$7,$3,$2;
  2407. $1=console;
  2408. $6=$core.getThisContext()._home();
  2409. $ctx1.sendIdx["home"]=1;
  2410. $5=$recv($6)._asString();
  2411. $ctx1.sendIdx["asString"]=1;
  2412. $4=$recv($5).__comma(" is deprecated! (in ");
  2413. $8=$recv($core.getThisContext()._home())._home();
  2414. $ctx1.sendIdx["home"]=2;
  2415. $7=$recv($8)._asString();
  2416. $3=$recv($4).__comma($7);
  2417. $ctx1.sendIdx[","]=2;
  2418. $2=$recv($3).__comma(")");
  2419. $ctx1.sendIdx[","]=1;
  2420. $recv($1)._warn_($2);
  2421. return self;
  2422. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  2423. },
  2424. args: [],
  2425. 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, ')'.",
  2426. referencedClasses: [],
  2427. messageSends: ["warn:", ",", "asString", "home"]
  2428. }),
  2429. $globals.Object);
  2430. $core.addMethod(
  2431. $core.method({
  2432. selector: "deprecatedAPI:",
  2433. protocol: 'error handling',
  2434. fn: function (aString){
  2435. var self=this;
  2436. return $core.withContext(function($ctx1) {
  2437. var $1,$6,$5,$4,$8,$7,$3,$2;
  2438. $1=console;
  2439. $6=$core.getThisContext()._home();
  2440. $ctx1.sendIdx["home"]=1;
  2441. $5=$recv($6)._asString();
  2442. $ctx1.sendIdx["asString"]=1;
  2443. $4=$recv($5).__comma(" is deprecated! (in ");
  2444. $8=$recv($core.getThisContext()._home())._home();
  2445. $ctx1.sendIdx["home"]=2;
  2446. $7=$recv($8)._asString();
  2447. $3=$recv($4).__comma($7);
  2448. $ctx1.sendIdx[","]=2;
  2449. $2=$recv($3).__comma(")");
  2450. $ctx1.sendIdx[","]=1;
  2451. $recv($1)._warn_($2);
  2452. $ctx1.sendIdx["warn:"]=1;
  2453. $recv(console)._warn_(aString);
  2454. return self;
  2455. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  2456. },
  2457. args: ["aString"],
  2458. 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",
  2459. referencedClasses: [],
  2460. messageSends: ["warn:", ",", "asString", "home"]
  2461. }),
  2462. $globals.Object);
  2463. $core.addMethod(
  2464. $core.method({
  2465. selector: "error:",
  2466. protocol: 'error handling',
  2467. fn: function (aString){
  2468. var self=this;
  2469. return $core.withContext(function($ctx1) {
  2470. $recv($globals.Error)._signal_(aString);
  2471. return self;
  2472. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  2473. },
  2474. args: ["aString"],
  2475. source: "error: aString\x0a\x09Error signal: aString",
  2476. referencedClasses: ["Error"],
  2477. messageSends: ["signal:"]
  2478. }),
  2479. $globals.Object);
  2480. $core.addMethod(
  2481. $core.method({
  2482. selector: "halt",
  2483. protocol: 'error handling',
  2484. fn: function (){
  2485. var self=this;
  2486. return $core.withContext(function($ctx1) {
  2487. $recv($globals.Halt)._signal();
  2488. return self;
  2489. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  2490. },
  2491. args: [],
  2492. source: "halt\x0a\x09Halt signal",
  2493. referencedClasses: ["Halt"],
  2494. messageSends: ["signal"]
  2495. }),
  2496. $globals.Object);
  2497. $core.addMethod(
  2498. $core.method({
  2499. selector: "in:",
  2500. protocol: 'evaluating',
  2501. fn: function (aValuable){
  2502. var self=this;
  2503. return $core.withContext(function($ctx1) {
  2504. return $recv(aValuable)._value_(self);
  2505. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  2506. },
  2507. args: ["aValuable"],
  2508. source: "in: aValuable\x0a\x09^ aValuable value: self",
  2509. referencedClasses: [],
  2510. messageSends: ["value:"]
  2511. }),
  2512. $globals.Object);
  2513. $core.addMethod(
  2514. $core.method({
  2515. selector: "isBehavior",
  2516. protocol: 'testing',
  2517. fn: function (){
  2518. var self=this;
  2519. return false;
  2520. },
  2521. args: [],
  2522. source: "isBehavior\x0a\x09^ false",
  2523. referencedClasses: [],
  2524. messageSends: []
  2525. }),
  2526. $globals.Object);
  2527. $core.addMethod(
  2528. $core.method({
  2529. selector: "isBoolean",
  2530. protocol: 'testing',
  2531. fn: function (){
  2532. var self=this;
  2533. return false;
  2534. },
  2535. args: [],
  2536. source: "isBoolean\x0a\x09^ false",
  2537. referencedClasses: [],
  2538. messageSends: []
  2539. }),
  2540. $globals.Object);
  2541. $core.addMethod(
  2542. $core.method({
  2543. selector: "isClass",
  2544. protocol: 'testing',
  2545. fn: function (){
  2546. var self=this;
  2547. return false;
  2548. },
  2549. args: [],
  2550. source: "isClass\x0a\x09^ false",
  2551. referencedClasses: [],
  2552. messageSends: []
  2553. }),
  2554. $globals.Object);
  2555. $core.addMethod(
  2556. $core.method({
  2557. selector: "isCompiledMethod",
  2558. protocol: 'testing',
  2559. fn: function (){
  2560. var self=this;
  2561. return false;
  2562. },
  2563. args: [],
  2564. source: "isCompiledMethod\x0a\x09^ false",
  2565. referencedClasses: [],
  2566. messageSends: []
  2567. }),
  2568. $globals.Object);
  2569. $core.addMethod(
  2570. $core.method({
  2571. selector: "isImmutable",
  2572. protocol: 'testing',
  2573. fn: function (){
  2574. var self=this;
  2575. return false;
  2576. },
  2577. args: [],
  2578. source: "isImmutable\x0a\x09^ false",
  2579. referencedClasses: [],
  2580. messageSends: []
  2581. }),
  2582. $globals.Object);
  2583. $core.addMethod(
  2584. $core.method({
  2585. selector: "isMemberOf:",
  2586. protocol: 'testing',
  2587. fn: function (aClass){
  2588. var self=this;
  2589. return $core.withContext(function($ctx1) {
  2590. return $recv(self._class()).__eq(aClass);
  2591. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  2592. },
  2593. args: ["aClass"],
  2594. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  2595. referencedClasses: [],
  2596. messageSends: ["=", "class"]
  2597. }),
  2598. $globals.Object);
  2599. $core.addMethod(
  2600. $core.method({
  2601. selector: "isMetaclass",
  2602. protocol: 'testing',
  2603. fn: function (){
  2604. var self=this;
  2605. return false;
  2606. },
  2607. args: [],
  2608. source: "isMetaclass\x0a\x09^ false",
  2609. referencedClasses: [],
  2610. messageSends: []
  2611. }),
  2612. $globals.Object);
  2613. $core.addMethod(
  2614. $core.method({
  2615. selector: "isNumber",
  2616. protocol: 'testing',
  2617. fn: function (){
  2618. var self=this;
  2619. return false;
  2620. },
  2621. args: [],
  2622. source: "isNumber\x0a\x09^ false",
  2623. referencedClasses: [],
  2624. messageSends: []
  2625. }),
  2626. $globals.Object);
  2627. $core.addMethod(
  2628. $core.method({
  2629. selector: "isPackage",
  2630. protocol: 'testing',
  2631. fn: function (){
  2632. var self=this;
  2633. return false;
  2634. },
  2635. args: [],
  2636. source: "isPackage\x0a\x09^ false",
  2637. referencedClasses: [],
  2638. messageSends: []
  2639. }),
  2640. $globals.Object);
  2641. $core.addMethod(
  2642. $core.method({
  2643. selector: "isParseFailure",
  2644. protocol: 'testing',
  2645. fn: function (){
  2646. var self=this;
  2647. return false;
  2648. },
  2649. args: [],
  2650. source: "isParseFailure\x0a\x09^ false",
  2651. referencedClasses: [],
  2652. messageSends: []
  2653. }),
  2654. $globals.Object);
  2655. $core.addMethod(
  2656. $core.method({
  2657. selector: "isString",
  2658. protocol: 'testing',
  2659. fn: function (){
  2660. var self=this;
  2661. return false;
  2662. },
  2663. args: [],
  2664. source: "isString\x0a\x09^ false",
  2665. referencedClasses: [],
  2666. messageSends: []
  2667. }),
  2668. $globals.Object);
  2669. $core.addMethod(
  2670. $core.method({
  2671. selector: "isSymbol",
  2672. protocol: 'testing',
  2673. fn: function (){
  2674. var self=this;
  2675. return false;
  2676. },
  2677. args: [],
  2678. source: "isSymbol\x0a\x09^ false",
  2679. referencedClasses: [],
  2680. messageSends: []
  2681. }),
  2682. $globals.Object);
  2683. $core.addMethod(
  2684. $core.method({
  2685. selector: "postCopy",
  2686. protocol: 'copying',
  2687. fn: function (){
  2688. var self=this;
  2689. return self;
  2690. },
  2691. args: [],
  2692. source: "postCopy",
  2693. referencedClasses: [],
  2694. messageSends: []
  2695. }),
  2696. $globals.Object);
  2697. $core.addMethod(
  2698. $core.method({
  2699. selector: "putOn:",
  2700. protocol: 'streaming',
  2701. fn: function (aStream){
  2702. var self=this;
  2703. return $core.withContext(function($ctx1) {
  2704. $recv(aStream)._nextPut_(self);
  2705. return self;
  2706. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  2707. },
  2708. args: ["aStream"],
  2709. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  2710. referencedClasses: [],
  2711. messageSends: ["nextPut:"]
  2712. }),
  2713. $globals.Object);
  2714. $core.addMethod(
  2715. $core.method({
  2716. selector: "respondsTo:",
  2717. protocol: 'testing',
  2718. fn: function (aSelector){
  2719. var self=this;
  2720. return $core.withContext(function($ctx1) {
  2721. return $recv(self._class())._canUnderstand_(aSelector);
  2722. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  2723. },
  2724. args: ["aSelector"],
  2725. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  2726. referencedClasses: [],
  2727. messageSends: ["canUnderstand:", "class"]
  2728. }),
  2729. $globals.Object);
  2730. $core.addMethod(
  2731. $core.method({
  2732. selector: "shallowCopy",
  2733. protocol: 'copying',
  2734. fn: function (){
  2735. var self=this;
  2736. return $core.withContext(function($ctx1) {
  2737. var copy = self.klass._new();
  2738. Object.keys(self).forEach(function(i) {
  2739. if(/^@.+/.test(i)) {
  2740. copy[i] = self[i];
  2741. }
  2742. });
  2743. return copy;
  2744. ;
  2745. return self;
  2746. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  2747. },
  2748. args: [],
  2749. source: "shallowCopy\x0a\x09<\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>",
  2750. referencedClasses: [],
  2751. messageSends: []
  2752. }),
  2753. $globals.Object);
  2754. $core.addMethod(
  2755. $core.method({
  2756. selector: "shouldNotImplement",
  2757. protocol: 'error handling',
  2758. fn: function (){
  2759. var self=this;
  2760. return $core.withContext(function($ctx1) {
  2761. self._error_("This method should not be implemented in ".__comma($recv(self._class())._name()));
  2762. return self;
  2763. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  2764. },
  2765. args: [],
  2766. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  2767. referencedClasses: [],
  2768. messageSends: ["error:", ",", "name", "class"]
  2769. }),
  2770. $globals.Object);
  2771. $core.addMethod(
  2772. $core.method({
  2773. selector: "size",
  2774. protocol: 'accessing',
  2775. fn: function (){
  2776. var self=this;
  2777. return $core.withContext(function($ctx1) {
  2778. self._error_("Object not indexable");
  2779. return self;
  2780. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  2781. },
  2782. args: [],
  2783. source: "size\x0a\x09self error: 'Object not indexable'",
  2784. referencedClasses: [],
  2785. messageSends: ["error:"]
  2786. }),
  2787. $globals.Object);
  2788. $core.addMethod(
  2789. $core.method({
  2790. selector: "subclassResponsibility",
  2791. protocol: 'error handling',
  2792. fn: function (){
  2793. var self=this;
  2794. return $core.withContext(function($ctx1) {
  2795. self._error_("This method is a responsibility of a subclass");
  2796. return self;
  2797. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  2798. },
  2799. args: [],
  2800. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  2801. referencedClasses: [],
  2802. messageSends: ["error:"]
  2803. }),
  2804. $globals.Object);
  2805. $core.addMethod(
  2806. $core.method({
  2807. selector: "throw:",
  2808. protocol: 'error handling',
  2809. fn: function (anObject){
  2810. var self=this;
  2811. return $core.withContext(function($ctx1) {
  2812. throw anObject ;
  2813. return self;
  2814. }, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},$globals.Object)});
  2815. },
  2816. args: ["anObject"],
  2817. source: "throw: anObject\x0a\x09< throw anObject >",
  2818. referencedClasses: [],
  2819. messageSends: []
  2820. }),
  2821. $globals.Object);
  2822. $core.addMethod(
  2823. $core.method({
  2824. selector: "value",
  2825. protocol: 'evaluating',
  2826. fn: function (){
  2827. var self=this;
  2828. return $core.withContext(function($ctx1) {
  2829. return self.valueOf();
  2830. return self;
  2831. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  2832. },
  2833. args: [],
  2834. source: "value\x0a\x09<return self.valueOf()>",
  2835. referencedClasses: [],
  2836. messageSends: []
  2837. }),
  2838. $globals.Object);
  2839. $core.addMethod(
  2840. $core.method({
  2841. selector: "accessorProtocolWith:",
  2842. protocol: 'helios',
  2843. fn: function (aGenerator){
  2844. var self=this;
  2845. return $core.withContext(function($ctx1) {
  2846. $recv(aGenerator)._accessorProtocolForObject();
  2847. return self;
  2848. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2849. },
  2850. args: ["aGenerator"],
  2851. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  2852. referencedClasses: [],
  2853. messageSends: ["accessorProtocolForObject"]
  2854. }),
  2855. $globals.Object.klass);
  2856. $core.addMethod(
  2857. $core.method({
  2858. selector: "accessorsSourceCodesWith:",
  2859. protocol: 'helios',
  2860. fn: function (aGenerator){
  2861. var self=this;
  2862. return $core.withContext(function($ctx1) {
  2863. $recv(aGenerator)._accessorsForObject();
  2864. return self;
  2865. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2866. },
  2867. args: ["aGenerator"],
  2868. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  2869. referencedClasses: [],
  2870. messageSends: ["accessorsForObject"]
  2871. }),
  2872. $globals.Object.klass);
  2873. $core.addMethod(
  2874. $core.method({
  2875. selector: "initialize",
  2876. protocol: 'initialization',
  2877. fn: function (){
  2878. var self=this;
  2879. return self;
  2880. },
  2881. args: [],
  2882. source: "initialize\x0a\x09\x22no op\x22",
  2883. referencedClasses: [],
  2884. messageSends: []
  2885. }),
  2886. $globals.Object.klass);
  2887. $core.addMethod(
  2888. $core.method({
  2889. selector: "initializeProtocolWith:",
  2890. protocol: 'helios',
  2891. fn: function (aGenerator){
  2892. var self=this;
  2893. return $core.withContext(function($ctx1) {
  2894. $recv(aGenerator)._initializeProtocolForObject();
  2895. return self;
  2896. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2897. },
  2898. args: ["aGenerator"],
  2899. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  2900. referencedClasses: [],
  2901. messageSends: ["initializeProtocolForObject"]
  2902. }),
  2903. $globals.Object.klass);
  2904. $core.addMethod(
  2905. $core.method({
  2906. selector: "initializeSourceCodesWith:",
  2907. protocol: 'helios',
  2908. fn: function (aGenerator){
  2909. var self=this;
  2910. return $core.withContext(function($ctx1) {
  2911. $recv(aGenerator)._initializeForObject();
  2912. return self;
  2913. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2914. },
  2915. args: ["aGenerator"],
  2916. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  2917. referencedClasses: [],
  2918. messageSends: ["initializeForObject"]
  2919. }),
  2920. $globals.Object.klass);
  2921. $core.addClass('Boolean', $globals.Object, [], 'Kernel-Objects');
  2922. $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: [ ... ]";
  2923. $core.addMethod(
  2924. $core.method({
  2925. selector: "&",
  2926. protocol: 'controlling',
  2927. fn: function (aBoolean){
  2928. var self=this;
  2929. return $core.withContext(function($ctx1) {
  2930. if(self == true) {
  2931. return aBoolean;
  2932. } else {
  2933. return false;
  2934. }
  2935. ;
  2936. return self;
  2937. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  2938. },
  2939. args: ["aBoolean"],
  2940. source: "& aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09>",
  2941. referencedClasses: [],
  2942. messageSends: []
  2943. }),
  2944. $globals.Boolean);
  2945. $core.addMethod(
  2946. $core.method({
  2947. selector: "==",
  2948. protocol: 'comparing',
  2949. fn: function (aBoolean){
  2950. var self=this;
  2951. return $core.withContext(function($ctx1) {
  2952. if (typeof aBoolean === "boolean") return self.valueOf() === aBoolean;
  2953. else if (aBoolean != null && typeof aBoolean === "object") return self.valueOf() === aBoolean.valueOf();
  2954. else return false;;
  2955. return self;
  2956. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  2957. },
  2958. args: ["aBoolean"],
  2959. source: "== aBoolean\x0a<\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>",
  2960. referencedClasses: [],
  2961. messageSends: []
  2962. }),
  2963. $globals.Boolean);
  2964. $core.addMethod(
  2965. $core.method({
  2966. selector: "and:",
  2967. protocol: 'controlling',
  2968. fn: function (aBlock){
  2969. var self=this;
  2970. return $core.withContext(function($ctx1) {
  2971. var $1;
  2972. $1=self.__eq(true);
  2973. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  2974. return false;
  2975. }));
  2976. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  2977. },
  2978. args: ["aBlock"],
  2979. source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]",
  2980. referencedClasses: [],
  2981. messageSends: ["ifTrue:ifFalse:", "="]
  2982. }),
  2983. $globals.Boolean);
  2984. $core.addMethod(
  2985. $core.method({
  2986. selector: "asBit",
  2987. protocol: 'converting',
  2988. fn: function (){
  2989. var self=this;
  2990. return $core.withContext(function($ctx1) {
  2991. if($core.assert(self)){
  2992. return (1);
  2993. } else {
  2994. return (0);
  2995. };
  2996. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  2997. },
  2998. args: [],
  2999. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3000. referencedClasses: [],
  3001. messageSends: ["ifTrue:ifFalse:"]
  3002. }),
  3003. $globals.Boolean);
  3004. $core.addMethod(
  3005. $core.method({
  3006. selector: "asJSON",
  3007. protocol: 'converting',
  3008. fn: function (){
  3009. var self=this;
  3010. return self;
  3011. },
  3012. args: [],
  3013. source: "asJSON\x0a\x09^ self",
  3014. referencedClasses: [],
  3015. messageSends: []
  3016. }),
  3017. $globals.Boolean);
  3018. $core.addMethod(
  3019. $core.method({
  3020. selector: "asString",
  3021. protocol: 'converting',
  3022. fn: function (){
  3023. var self=this;
  3024. return $core.withContext(function($ctx1) {
  3025. return self.toString() ;
  3026. return self;
  3027. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3028. },
  3029. args: [],
  3030. source: "asString\x0a\x09< return self.toString() >",
  3031. referencedClasses: [],
  3032. messageSends: []
  3033. }),
  3034. $globals.Boolean);
  3035. $core.addMethod(
  3036. $core.method({
  3037. selector: "deepCopy",
  3038. protocol: 'copying',
  3039. fn: function (){
  3040. var self=this;
  3041. return self;
  3042. },
  3043. args: [],
  3044. source: "deepCopy\x0a\x09^ self",
  3045. referencedClasses: [],
  3046. messageSends: []
  3047. }),
  3048. $globals.Boolean);
  3049. $core.addMethod(
  3050. $core.method({
  3051. selector: "ifFalse:",
  3052. protocol: 'controlling',
  3053. fn: function (aBlock){
  3054. var self=this;
  3055. return $core.withContext(function($ctx1) {
  3056. return self._ifTrue_ifFalse_((function(){
  3057. }),aBlock);
  3058. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3059. },
  3060. args: ["aBlock"],
  3061. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3062. referencedClasses: [],
  3063. messageSends: ["ifTrue:ifFalse:"]
  3064. }),
  3065. $globals.Boolean);
  3066. $core.addMethod(
  3067. $core.method({
  3068. selector: "ifFalse:ifTrue:",
  3069. protocol: 'controlling',
  3070. fn: function (aBlock,anotherBlock){
  3071. var self=this;
  3072. return $core.withContext(function($ctx1) {
  3073. return self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3074. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3075. },
  3076. args: ["aBlock", "anotherBlock"],
  3077. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3078. referencedClasses: [],
  3079. messageSends: ["ifTrue:ifFalse:"]
  3080. }),
  3081. $globals.Boolean);
  3082. $core.addMethod(
  3083. $core.method({
  3084. selector: "ifTrue:",
  3085. protocol: 'controlling',
  3086. fn: function (aBlock){
  3087. var self=this;
  3088. return $core.withContext(function($ctx1) {
  3089. return self._ifTrue_ifFalse_(aBlock,(function(){
  3090. }));
  3091. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3092. },
  3093. args: ["aBlock"],
  3094. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3095. referencedClasses: [],
  3096. messageSends: ["ifTrue:ifFalse:"]
  3097. }),
  3098. $globals.Boolean);
  3099. $core.addMethod(
  3100. $core.method({
  3101. selector: "ifTrue:ifFalse:",
  3102. protocol: 'controlling',
  3103. fn: function (aBlock,anotherBlock){
  3104. var self=this;
  3105. return $core.withContext(function($ctx1) {
  3106. if(self == true) {
  3107. return aBlock._value();
  3108. } else {
  3109. return anotherBlock._value();
  3110. }
  3111. ;
  3112. return self;
  3113. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3114. },
  3115. args: ["aBlock", "anotherBlock"],
  3116. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock._value();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock._value();\x0a\x09\x09}\x0a\x09>",
  3117. referencedClasses: [],
  3118. messageSends: []
  3119. }),
  3120. $globals.Boolean);
  3121. $core.addMethod(
  3122. $core.method({
  3123. selector: "isBoolean",
  3124. protocol: 'testing',
  3125. fn: function (){
  3126. var self=this;
  3127. return true;
  3128. },
  3129. args: [],
  3130. source: "isBoolean\x0a\x09^ true",
  3131. referencedClasses: [],
  3132. messageSends: []
  3133. }),
  3134. $globals.Boolean);
  3135. $core.addMethod(
  3136. $core.method({
  3137. selector: "isImmutable",
  3138. protocol: 'testing',
  3139. fn: function (){
  3140. var self=this;
  3141. return true;
  3142. },
  3143. args: [],
  3144. source: "isImmutable\x0a\x09^ true",
  3145. referencedClasses: [],
  3146. messageSends: []
  3147. }),
  3148. $globals.Boolean);
  3149. $core.addMethod(
  3150. $core.method({
  3151. selector: "not",
  3152. protocol: 'controlling',
  3153. fn: function (){
  3154. var self=this;
  3155. return $core.withContext(function($ctx1) {
  3156. return self.__eq(false);
  3157. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  3158. },
  3159. args: [],
  3160. source: "not\x0a\x09^ self = false",
  3161. referencedClasses: [],
  3162. messageSends: ["="]
  3163. }),
  3164. $globals.Boolean);
  3165. $core.addMethod(
  3166. $core.method({
  3167. selector: "or:",
  3168. protocol: 'controlling',
  3169. fn: function (aBlock){
  3170. var self=this;
  3171. return $core.withContext(function($ctx1) {
  3172. var $1;
  3173. $1=self.__eq(true);
  3174. return $recv($1)._ifTrue_ifFalse_((function(){
  3175. return true;
  3176. }),aBlock);
  3177. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  3178. },
  3179. args: ["aBlock"],
  3180. source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock",
  3181. referencedClasses: [],
  3182. messageSends: ["ifTrue:ifFalse:", "="]
  3183. }),
  3184. $globals.Boolean);
  3185. $core.addMethod(
  3186. $core.method({
  3187. selector: "printOn:",
  3188. protocol: 'printing',
  3189. fn: function (aStream){
  3190. var self=this;
  3191. return $core.withContext(function($ctx1) {
  3192. $recv(aStream)._nextPutAll_(self._asString());
  3193. return self;
  3194. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  3195. },
  3196. args: ["aStream"],
  3197. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3198. referencedClasses: [],
  3199. messageSends: ["nextPutAll:", "asString"]
  3200. }),
  3201. $globals.Boolean);
  3202. $core.addMethod(
  3203. $core.method({
  3204. selector: "shallowCopy",
  3205. protocol: 'copying',
  3206. fn: function (){
  3207. var self=this;
  3208. return self;
  3209. },
  3210. args: [],
  3211. source: "shallowCopy\x0a\x09^ self",
  3212. referencedClasses: [],
  3213. messageSends: []
  3214. }),
  3215. $globals.Boolean);
  3216. $core.addMethod(
  3217. $core.method({
  3218. selector: "|",
  3219. protocol: 'controlling',
  3220. fn: function (aBoolean){
  3221. var self=this;
  3222. return $core.withContext(function($ctx1) {
  3223. if(self == true) {
  3224. return true;
  3225. } else {
  3226. return aBoolean;
  3227. }
  3228. ;
  3229. return self;
  3230. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  3231. },
  3232. args: ["aBoolean"],
  3233. source: "| aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09>",
  3234. referencedClasses: [],
  3235. messageSends: []
  3236. }),
  3237. $globals.Boolean);
  3238. $core.addClass('Date', $globals.Object, [], 'Kernel-Objects');
  3239. $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.).";
  3240. $core.addMethod(
  3241. $core.method({
  3242. selector: "+",
  3243. protocol: 'arithmetic',
  3244. fn: function (aDate){
  3245. var self=this;
  3246. return $core.withContext(function($ctx1) {
  3247. return self + aDate;
  3248. return self;
  3249. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  3250. },
  3251. args: ["aDate"],
  3252. source: "+ aDate\x0a\x09<return self + aDate>",
  3253. referencedClasses: [],
  3254. messageSends: []
  3255. }),
  3256. $globals.Date);
  3257. $core.addMethod(
  3258. $core.method({
  3259. selector: "-",
  3260. protocol: 'arithmetic',
  3261. fn: function (aDate){
  3262. var self=this;
  3263. return $core.withContext(function($ctx1) {
  3264. return self - aDate;
  3265. return self;
  3266. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  3267. },
  3268. args: ["aDate"],
  3269. source: "- aDate\x0a\x09<return self - aDate>",
  3270. referencedClasses: [],
  3271. messageSends: []
  3272. }),
  3273. $globals.Date);
  3274. $core.addMethod(
  3275. $core.method({
  3276. selector: "<",
  3277. protocol: 'comparing',
  3278. fn: function (aDate){
  3279. var self=this;
  3280. return $core.withContext(function($ctx1) {
  3281. return self < aDate;
  3282. return self;
  3283. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  3284. },
  3285. args: ["aDate"],
  3286. source: "< aDate\x0a\x09<return self < aDate>",
  3287. referencedClasses: [],
  3288. messageSends: []
  3289. }),
  3290. $globals.Date);
  3291. $core.addMethod(
  3292. $core.method({
  3293. selector: "<=",
  3294. protocol: 'comparing',
  3295. fn: function (aDate){
  3296. var self=this;
  3297. return $core.withContext(function($ctx1) {
  3298. return self <= aDate;
  3299. return self;
  3300. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  3301. },
  3302. args: ["aDate"],
  3303. source: "<= aDate\x0a\x09<return self <= aDate>",
  3304. referencedClasses: [],
  3305. messageSends: []
  3306. }),
  3307. $globals.Date);
  3308. $core.addMethod(
  3309. $core.method({
  3310. selector: "=",
  3311. protocol: 'comparing',
  3312. fn: function (aDate){
  3313. var self=this;
  3314. return $core.withContext(function($ctx1) {
  3315. var $2,$1,$3;
  3316. $2=$recv(aDate)._class();
  3317. $ctx1.sendIdx["class"]=1;
  3318. $1=$recv($2).__eq_eq(self._class());
  3319. $ctx1.sendIdx["=="]=1;
  3320. return $recv($1)._and_((function(){
  3321. return $core.withContext(function($ctx2) {
  3322. $3=self._asMilliseconds();
  3323. $ctx2.sendIdx["asMilliseconds"]=1;
  3324. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  3325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3326. }));
  3327. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  3328. },
  3329. args: ["aDate"],
  3330. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  3331. referencedClasses: [],
  3332. messageSends: ["and:", "==", "class", "asMilliseconds"]
  3333. }),
  3334. $globals.Date);
  3335. $core.addMethod(
  3336. $core.method({
  3337. selector: ">",
  3338. protocol: 'comparing',
  3339. fn: function (aDate){
  3340. var self=this;
  3341. return $core.withContext(function($ctx1) {
  3342. return self > aDate;
  3343. return self;
  3344. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  3345. },
  3346. args: ["aDate"],
  3347. source: "> aDate\x0a\x09<return self >> aDate>",
  3348. referencedClasses: [],
  3349. messageSends: []
  3350. }),
  3351. $globals.Date);
  3352. $core.addMethod(
  3353. $core.method({
  3354. selector: ">=",
  3355. protocol: 'comparing',
  3356. fn: function (aDate){
  3357. var self=this;
  3358. return $core.withContext(function($ctx1) {
  3359. return self >= aDate;
  3360. return self;
  3361. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  3362. },
  3363. args: ["aDate"],
  3364. source: ">= aDate\x0a\x09<return self >>= aDate>",
  3365. referencedClasses: [],
  3366. messageSends: []
  3367. }),
  3368. $globals.Date);
  3369. $core.addMethod(
  3370. $core.method({
  3371. selector: "asDateString",
  3372. protocol: 'converting',
  3373. fn: function (){
  3374. var self=this;
  3375. return $core.withContext(function($ctx1) {
  3376. return self.toDateString();
  3377. return self;
  3378. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  3379. },
  3380. args: [],
  3381. source: "asDateString\x0a\x09<return self.toDateString()>",
  3382. referencedClasses: [],
  3383. messageSends: []
  3384. }),
  3385. $globals.Date);
  3386. $core.addMethod(
  3387. $core.method({
  3388. selector: "asLocaleString",
  3389. protocol: 'converting',
  3390. fn: function (){
  3391. var self=this;
  3392. return $core.withContext(function($ctx1) {
  3393. return self.toLocaleString();
  3394. return self;
  3395. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  3396. },
  3397. args: [],
  3398. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  3399. referencedClasses: [],
  3400. messageSends: []
  3401. }),
  3402. $globals.Date);
  3403. $core.addMethod(
  3404. $core.method({
  3405. selector: "asMilliseconds",
  3406. protocol: 'converting',
  3407. fn: function (){
  3408. var self=this;
  3409. return $core.withContext(function($ctx1) {
  3410. return self._time();
  3411. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  3412. },
  3413. args: [],
  3414. source: "asMilliseconds\x0a\x09^ self time",
  3415. referencedClasses: [],
  3416. messageSends: ["time"]
  3417. }),
  3418. $globals.Date);
  3419. $core.addMethod(
  3420. $core.method({
  3421. selector: "asNumber",
  3422. protocol: 'converting',
  3423. fn: function (){
  3424. var self=this;
  3425. return $core.withContext(function($ctx1) {
  3426. return self._asMilliseconds();
  3427. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  3428. },
  3429. args: [],
  3430. source: "asNumber\x0a\x09^ self asMilliseconds",
  3431. referencedClasses: [],
  3432. messageSends: ["asMilliseconds"]
  3433. }),
  3434. $globals.Date);
  3435. $core.addMethod(
  3436. $core.method({
  3437. selector: "asString",
  3438. protocol: 'converting',
  3439. fn: function (){
  3440. var self=this;
  3441. return $core.withContext(function($ctx1) {
  3442. return self.toString();
  3443. return self;
  3444. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  3445. },
  3446. args: [],
  3447. source: "asString\x0a\x09<return self.toString()>",
  3448. referencedClasses: [],
  3449. messageSends: []
  3450. }),
  3451. $globals.Date);
  3452. $core.addMethod(
  3453. $core.method({
  3454. selector: "asTimeString",
  3455. protocol: 'converting',
  3456. fn: function (){
  3457. var self=this;
  3458. return $core.withContext(function($ctx1) {
  3459. return self.toTimeString();
  3460. return self;
  3461. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  3462. },
  3463. args: [],
  3464. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  3465. referencedClasses: [],
  3466. messageSends: []
  3467. }),
  3468. $globals.Date);
  3469. $core.addMethod(
  3470. $core.method({
  3471. selector: "day",
  3472. protocol: 'accessing',
  3473. fn: function (){
  3474. var self=this;
  3475. return $core.withContext(function($ctx1) {
  3476. return self._dayOfWeek();
  3477. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  3478. },
  3479. args: [],
  3480. source: "day\x0a\x09^ self dayOfWeek",
  3481. referencedClasses: [],
  3482. messageSends: ["dayOfWeek"]
  3483. }),
  3484. $globals.Date);
  3485. $core.addMethod(
  3486. $core.method({
  3487. selector: "day:",
  3488. protocol: 'accessing',
  3489. fn: function (aNumber){
  3490. var self=this;
  3491. return $core.withContext(function($ctx1) {
  3492. self._dayOfWeek_(aNumber);
  3493. return self;
  3494. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  3495. },
  3496. args: ["aNumber"],
  3497. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  3498. referencedClasses: [],
  3499. messageSends: ["dayOfWeek:"]
  3500. }),
  3501. $globals.Date);
  3502. $core.addMethod(
  3503. $core.method({
  3504. selector: "dayOfMonth",
  3505. protocol: 'accessing',
  3506. fn: function (){
  3507. var self=this;
  3508. return $core.withContext(function($ctx1) {
  3509. return self.getDate();
  3510. return self;
  3511. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  3512. },
  3513. args: [],
  3514. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  3515. referencedClasses: [],
  3516. messageSends: []
  3517. }),
  3518. $globals.Date);
  3519. $core.addMethod(
  3520. $core.method({
  3521. selector: "dayOfMonth:",
  3522. protocol: 'accessing',
  3523. fn: function (aNumber){
  3524. var self=this;
  3525. return $core.withContext(function($ctx1) {
  3526. self.setDate(aNumber);
  3527. return self;
  3528. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  3529. },
  3530. args: ["aNumber"],
  3531. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  3532. referencedClasses: [],
  3533. messageSends: []
  3534. }),
  3535. $globals.Date);
  3536. $core.addMethod(
  3537. $core.method({
  3538. selector: "dayOfWeek",
  3539. protocol: 'accessing',
  3540. fn: function (){
  3541. var self=this;
  3542. return $core.withContext(function($ctx1) {
  3543. return self.getDay() + 1;
  3544. return self;
  3545. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  3546. },
  3547. args: [],
  3548. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  3549. referencedClasses: [],
  3550. messageSends: []
  3551. }),
  3552. $globals.Date);
  3553. $core.addMethod(
  3554. $core.method({
  3555. selector: "dayOfWeek:",
  3556. protocol: 'accessing',
  3557. fn: function (aNumber){
  3558. var self=this;
  3559. return $core.withContext(function($ctx1) {
  3560. return self.setDay(aNumber - 1);
  3561. return self;
  3562. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  3563. },
  3564. args: ["aNumber"],
  3565. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  3566. referencedClasses: [],
  3567. messageSends: []
  3568. }),
  3569. $globals.Date);
  3570. $core.addMethod(
  3571. $core.method({
  3572. selector: "hours",
  3573. protocol: 'accessing',
  3574. fn: function (){
  3575. var self=this;
  3576. return $core.withContext(function($ctx1) {
  3577. return self.getHours();
  3578. return self;
  3579. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  3580. },
  3581. args: [],
  3582. source: "hours\x0a\x09<return self.getHours()>",
  3583. referencedClasses: [],
  3584. messageSends: []
  3585. }),
  3586. $globals.Date);
  3587. $core.addMethod(
  3588. $core.method({
  3589. selector: "hours:",
  3590. protocol: 'accessing',
  3591. fn: function (aNumber){
  3592. var self=this;
  3593. return $core.withContext(function($ctx1) {
  3594. self.setHours(aNumber);
  3595. return self;
  3596. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  3597. },
  3598. args: ["aNumber"],
  3599. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  3600. referencedClasses: [],
  3601. messageSends: []
  3602. }),
  3603. $globals.Date);
  3604. $core.addMethod(
  3605. $core.method({
  3606. selector: "milliseconds",
  3607. protocol: 'accessing',
  3608. fn: function (){
  3609. var self=this;
  3610. return $core.withContext(function($ctx1) {
  3611. return self.getMilliseconds();
  3612. return self;
  3613. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  3614. },
  3615. args: [],
  3616. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  3617. referencedClasses: [],
  3618. messageSends: []
  3619. }),
  3620. $globals.Date);
  3621. $core.addMethod(
  3622. $core.method({
  3623. selector: "milliseconds:",
  3624. protocol: 'accessing',
  3625. fn: function (aNumber){
  3626. var self=this;
  3627. return $core.withContext(function($ctx1) {
  3628. self.setMilliseconds(aNumber);
  3629. return self;
  3630. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  3631. },
  3632. args: ["aNumber"],
  3633. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  3634. referencedClasses: [],
  3635. messageSends: []
  3636. }),
  3637. $globals.Date);
  3638. $core.addMethod(
  3639. $core.method({
  3640. selector: "minutes",
  3641. protocol: 'accessing',
  3642. fn: function (){
  3643. var self=this;
  3644. return $core.withContext(function($ctx1) {
  3645. return self.getMinutes();
  3646. return self;
  3647. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  3648. },
  3649. args: [],
  3650. source: "minutes\x0a\x09<return self.getMinutes()>",
  3651. referencedClasses: [],
  3652. messageSends: []
  3653. }),
  3654. $globals.Date);
  3655. $core.addMethod(
  3656. $core.method({
  3657. selector: "minutes:",
  3658. protocol: 'accessing',
  3659. fn: function (aNumber){
  3660. var self=this;
  3661. return $core.withContext(function($ctx1) {
  3662. self.setMinutes(aNumber);
  3663. return self;
  3664. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  3665. },
  3666. args: ["aNumber"],
  3667. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  3668. referencedClasses: [],
  3669. messageSends: []
  3670. }),
  3671. $globals.Date);
  3672. $core.addMethod(
  3673. $core.method({
  3674. selector: "month",
  3675. protocol: 'accessing',
  3676. fn: function (){
  3677. var self=this;
  3678. return $core.withContext(function($ctx1) {
  3679. return self.getMonth() + 1;
  3680. return self;
  3681. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  3682. },
  3683. args: [],
  3684. source: "month\x0a\x09<return self.getMonth() + 1>",
  3685. referencedClasses: [],
  3686. messageSends: []
  3687. }),
  3688. $globals.Date);
  3689. $core.addMethod(
  3690. $core.method({
  3691. selector: "month:",
  3692. protocol: 'accessing',
  3693. fn: function (aNumber){
  3694. var self=this;
  3695. return $core.withContext(function($ctx1) {
  3696. self.setMonth(aNumber - 1);
  3697. return self;
  3698. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  3699. },
  3700. args: ["aNumber"],
  3701. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  3702. referencedClasses: [],
  3703. messageSends: []
  3704. }),
  3705. $globals.Date);
  3706. $core.addMethod(
  3707. $core.method({
  3708. selector: "printOn:",
  3709. protocol: 'printing',
  3710. fn: function (aStream){
  3711. var self=this;
  3712. return $core.withContext(function($ctx1) {
  3713. $recv(aStream)._nextPutAll_(self._asString());
  3714. return self;
  3715. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  3716. },
  3717. args: ["aStream"],
  3718. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3719. referencedClasses: [],
  3720. messageSends: ["nextPutAll:", "asString"]
  3721. }),
  3722. $globals.Date);
  3723. $core.addMethod(
  3724. $core.method({
  3725. selector: "seconds",
  3726. protocol: 'accessing',
  3727. fn: function (){
  3728. var self=this;
  3729. return $core.withContext(function($ctx1) {
  3730. return self.getSeconds();
  3731. return self;
  3732. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  3733. },
  3734. args: [],
  3735. source: "seconds\x0a\x09<return self.getSeconds()>",
  3736. referencedClasses: [],
  3737. messageSends: []
  3738. }),
  3739. $globals.Date);
  3740. $core.addMethod(
  3741. $core.method({
  3742. selector: "seconds:",
  3743. protocol: 'accessing',
  3744. fn: function (aNumber){
  3745. var self=this;
  3746. return $core.withContext(function($ctx1) {
  3747. self.setSeconds(aNumber);
  3748. return self;
  3749. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  3750. },
  3751. args: ["aNumber"],
  3752. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  3753. referencedClasses: [],
  3754. messageSends: []
  3755. }),
  3756. $globals.Date);
  3757. $core.addMethod(
  3758. $core.method({
  3759. selector: "time",
  3760. protocol: 'accessing',
  3761. fn: function (){
  3762. var self=this;
  3763. return $core.withContext(function($ctx1) {
  3764. return self.getTime();
  3765. return self;
  3766. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  3767. },
  3768. args: [],
  3769. source: "time\x0a\x09<return self.getTime()>",
  3770. referencedClasses: [],
  3771. messageSends: []
  3772. }),
  3773. $globals.Date);
  3774. $core.addMethod(
  3775. $core.method({
  3776. selector: "time:",
  3777. protocol: 'accessing',
  3778. fn: function (aNumber){
  3779. var self=this;
  3780. return $core.withContext(function($ctx1) {
  3781. self.setTime(aNumber);
  3782. return self;
  3783. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  3784. },
  3785. args: ["aNumber"],
  3786. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  3787. referencedClasses: [],
  3788. messageSends: []
  3789. }),
  3790. $globals.Date);
  3791. $core.addMethod(
  3792. $core.method({
  3793. selector: "year",
  3794. protocol: 'accessing',
  3795. fn: function (){
  3796. var self=this;
  3797. return $core.withContext(function($ctx1) {
  3798. return self.getFullYear();
  3799. return self;
  3800. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  3801. },
  3802. args: [],
  3803. source: "year\x0a\x09<return self.getFullYear()>",
  3804. referencedClasses: [],
  3805. messageSends: []
  3806. }),
  3807. $globals.Date);
  3808. $core.addMethod(
  3809. $core.method({
  3810. selector: "year:",
  3811. protocol: 'accessing',
  3812. fn: function (aNumber){
  3813. var self=this;
  3814. return $core.withContext(function($ctx1) {
  3815. self.setFullYear(aNumber);
  3816. return self;
  3817. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  3818. },
  3819. args: ["aNumber"],
  3820. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  3821. referencedClasses: [],
  3822. messageSends: []
  3823. }),
  3824. $globals.Date);
  3825. $core.addMethod(
  3826. $core.method({
  3827. selector: "classTag",
  3828. protocol: 'accessing',
  3829. fn: function (){
  3830. var self=this;
  3831. return "magnitude";
  3832. },
  3833. args: [],
  3834. 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'",
  3835. referencedClasses: [],
  3836. messageSends: []
  3837. }),
  3838. $globals.Date.klass);
  3839. $core.addMethod(
  3840. $core.method({
  3841. selector: "fromMilliseconds:",
  3842. protocol: 'instance creation',
  3843. fn: function (aNumber){
  3844. var self=this;
  3845. return $core.withContext(function($ctx1) {
  3846. return self._new_(aNumber);
  3847. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.klass)});
  3848. },
  3849. args: ["aNumber"],
  3850. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  3851. referencedClasses: [],
  3852. messageSends: ["new:"]
  3853. }),
  3854. $globals.Date.klass);
  3855. $core.addMethod(
  3856. $core.method({
  3857. selector: "fromSeconds:",
  3858. protocol: 'instance creation',
  3859. fn: function (aNumber){
  3860. var self=this;
  3861. return $core.withContext(function($ctx1) {
  3862. return self._fromMilliseconds_($recv(aNumber).__star((1000)));
  3863. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.klass)});
  3864. },
  3865. args: ["aNumber"],
  3866. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  3867. referencedClasses: [],
  3868. messageSends: ["fromMilliseconds:", "*"]
  3869. }),
  3870. $globals.Date.klass);
  3871. $core.addMethod(
  3872. $core.method({
  3873. selector: "fromString:",
  3874. protocol: 'instance creation',
  3875. fn: function (aString){
  3876. var self=this;
  3877. return $core.withContext(function($ctx1) {
  3878. return self._new_(aString);
  3879. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.klass)});
  3880. },
  3881. args: ["aString"],
  3882. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  3883. referencedClasses: [],
  3884. messageSends: ["new:"]
  3885. }),
  3886. $globals.Date.klass);
  3887. $core.addMethod(
  3888. $core.method({
  3889. selector: "millisecondsToRun:",
  3890. protocol: 'instance creation',
  3891. fn: function (aBlock){
  3892. var self=this;
  3893. var t;
  3894. return $core.withContext(function($ctx1) {
  3895. t=$recv($globals.Date)._now();
  3896. $ctx1.sendIdx["now"]=1;
  3897. $recv(aBlock)._value();
  3898. return $recv($recv($globals.Date)._now()).__minus(t);
  3899. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.klass)});
  3900. },
  3901. args: ["aBlock"],
  3902. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  3903. referencedClasses: ["Date"],
  3904. messageSends: ["now", "value", "-"]
  3905. }),
  3906. $globals.Date.klass);
  3907. $core.addMethod(
  3908. $core.method({
  3909. selector: "new:",
  3910. protocol: 'instance creation',
  3911. fn: function (anObject){
  3912. var self=this;
  3913. return $core.withContext(function($ctx1) {
  3914. return new Date(anObject);
  3915. return self;
  3916. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.klass)});
  3917. },
  3918. args: ["anObject"],
  3919. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  3920. referencedClasses: [],
  3921. messageSends: []
  3922. }),
  3923. $globals.Date.klass);
  3924. $core.addMethod(
  3925. $core.method({
  3926. selector: "now",
  3927. protocol: 'instance creation',
  3928. fn: function (){
  3929. var self=this;
  3930. return $core.withContext(function($ctx1) {
  3931. return self._today();
  3932. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.klass)});
  3933. },
  3934. args: [],
  3935. source: "now\x0a\x09^ self today",
  3936. referencedClasses: [],
  3937. messageSends: ["today"]
  3938. }),
  3939. $globals.Date.klass);
  3940. $core.addMethod(
  3941. $core.method({
  3942. selector: "today",
  3943. protocol: 'instance creation',
  3944. fn: function (){
  3945. var self=this;
  3946. return $core.withContext(function($ctx1) {
  3947. return self._new();
  3948. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.klass)});
  3949. },
  3950. args: [],
  3951. source: "today\x0a\x09^ self new",
  3952. referencedClasses: [],
  3953. messageSends: ["new"]
  3954. }),
  3955. $globals.Date.klass);
  3956. $core.addClass('Number', $globals.Object, [], 'Kernel-Objects');
  3957. $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 ].";
  3958. $core.addMethod(
  3959. $core.method({
  3960. selector: "&",
  3961. protocol: 'converting',
  3962. fn: function (aNumber){
  3963. var self=this;
  3964. return $core.withContext(function($ctx1) {
  3965. return self & aNumber;
  3966. return self;
  3967. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  3968. },
  3969. args: ["aNumber"],
  3970. source: "& aNumber\x0a\x09<return self & aNumber>",
  3971. referencedClasses: [],
  3972. messageSends: []
  3973. }),
  3974. $globals.Number);
  3975. $core.addMethod(
  3976. $core.method({
  3977. selector: "*",
  3978. protocol: 'arithmetic',
  3979. fn: function (aNumber){
  3980. var self=this;
  3981. return $core.withContext(function($ctx1) {
  3982. return self * aNumber;
  3983. return self;
  3984. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  3985. },
  3986. args: ["aNumber"],
  3987. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  3988. referencedClasses: [],
  3989. messageSends: []
  3990. }),
  3991. $globals.Number);
  3992. $core.addMethod(
  3993. $core.method({
  3994. selector: "**",
  3995. protocol: 'mathematical functions',
  3996. fn: function (exponent){
  3997. var self=this;
  3998. return $core.withContext(function($ctx1) {
  3999. return self._raisedTo_(exponent);
  4000. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4001. },
  4002. args: ["exponent"],
  4003. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4004. referencedClasses: [],
  4005. messageSends: ["raisedTo:"]
  4006. }),
  4007. $globals.Number);
  4008. $core.addMethod(
  4009. $core.method({
  4010. selector: "+",
  4011. protocol: 'arithmetic',
  4012. fn: function (aNumber){
  4013. var self=this;
  4014. return $core.withContext(function($ctx1) {
  4015. return self + aNumber;
  4016. return self;
  4017. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4018. },
  4019. args: ["aNumber"],
  4020. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  4021. referencedClasses: [],
  4022. messageSends: []
  4023. }),
  4024. $globals.Number);
  4025. $core.addMethod(
  4026. $core.method({
  4027. selector: "-",
  4028. protocol: 'arithmetic',
  4029. fn: function (aNumber){
  4030. var self=this;
  4031. return $core.withContext(function($ctx1) {
  4032. return self - aNumber;
  4033. return self;
  4034. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4035. },
  4036. args: ["aNumber"],
  4037. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  4038. referencedClasses: [],
  4039. messageSends: []
  4040. }),
  4041. $globals.Number);
  4042. $core.addMethod(
  4043. $core.method({
  4044. selector: "/",
  4045. protocol: 'arithmetic',
  4046. fn: function (aNumber){
  4047. var self=this;
  4048. return $core.withContext(function($ctx1) {
  4049. return self / aNumber;
  4050. return self;
  4051. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4052. },
  4053. args: ["aNumber"],
  4054. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  4055. referencedClasses: [],
  4056. messageSends: []
  4057. }),
  4058. $globals.Number);
  4059. $core.addMethod(
  4060. $core.method({
  4061. selector: "//",
  4062. protocol: 'arithmetic',
  4063. fn: function (aNumber){
  4064. var self=this;
  4065. return $core.withContext(function($ctx1) {
  4066. return $recv(self.__slash(aNumber))._floor();
  4067. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4068. },
  4069. args: ["aNumber"],
  4070. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4071. referencedClasses: [],
  4072. messageSends: ["floor", "/"]
  4073. }),
  4074. $globals.Number);
  4075. $core.addMethod(
  4076. $core.method({
  4077. selector: "<",
  4078. protocol: 'comparing',
  4079. fn: function (aNumber){
  4080. var self=this;
  4081. return $core.withContext(function($ctx1) {
  4082. return self < aNumber;
  4083. return self;
  4084. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4085. },
  4086. args: ["aNumber"],
  4087. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  4088. referencedClasses: [],
  4089. messageSends: []
  4090. }),
  4091. $globals.Number);
  4092. $core.addMethod(
  4093. $core.method({
  4094. selector: "<=",
  4095. protocol: 'comparing',
  4096. fn: function (aNumber){
  4097. var self=this;
  4098. return $core.withContext(function($ctx1) {
  4099. return self <= aNumber;
  4100. return self;
  4101. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  4102. },
  4103. args: ["aNumber"],
  4104. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  4105. referencedClasses: [],
  4106. messageSends: []
  4107. }),
  4108. $globals.Number);
  4109. $core.addMethod(
  4110. $core.method({
  4111. selector: "==",
  4112. protocol: 'comparing',
  4113. fn: function (aNumber){
  4114. var self=this;
  4115. return $core.withContext(function($ctx1) {
  4116. if (typeof aNumber === "number") return Number(self) === aNumber;
  4117. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  4118. else return false;;
  4119. return self;
  4120. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  4121. },
  4122. args: ["aNumber"],
  4123. source: "== aNumber\x0a<\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>",
  4124. referencedClasses: [],
  4125. messageSends: []
  4126. }),
  4127. $globals.Number);
  4128. $core.addMethod(
  4129. $core.method({
  4130. selector: ">",
  4131. protocol: 'comparing',
  4132. fn: function (aNumber){
  4133. var self=this;
  4134. return $core.withContext(function($ctx1) {
  4135. return self > aNumber;
  4136. return self;
  4137. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  4138. },
  4139. args: ["aNumber"],
  4140. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  4141. referencedClasses: [],
  4142. messageSends: []
  4143. }),
  4144. $globals.Number);
  4145. $core.addMethod(
  4146. $core.method({
  4147. selector: ">=",
  4148. protocol: 'comparing',
  4149. fn: function (aNumber){
  4150. var self=this;
  4151. return $core.withContext(function($ctx1) {
  4152. return self >= aNumber;
  4153. return self;
  4154. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  4155. },
  4156. args: ["aNumber"],
  4157. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  4158. referencedClasses: [],
  4159. messageSends: []
  4160. }),
  4161. $globals.Number);
  4162. $core.addMethod(
  4163. $core.method({
  4164. selector: "@",
  4165. protocol: 'converting',
  4166. fn: function (aNumber){
  4167. var self=this;
  4168. return $core.withContext(function($ctx1) {
  4169. return $recv($globals.Point)._x_y_(self,aNumber);
  4170. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  4171. },
  4172. args: ["aNumber"],
  4173. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  4174. referencedClasses: ["Point"],
  4175. messageSends: ["x:y:"]
  4176. }),
  4177. $globals.Number);
  4178. $core.addMethod(
  4179. $core.method({
  4180. selector: "\x5c\x5c",
  4181. protocol: 'arithmetic',
  4182. fn: function (aNumber){
  4183. var self=this;
  4184. return $core.withContext(function($ctx1) {
  4185. return self % aNumber;
  4186. return self;
  4187. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  4188. },
  4189. args: ["aNumber"],
  4190. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  4191. referencedClasses: [],
  4192. messageSends: []
  4193. }),
  4194. $globals.Number);
  4195. $core.addMethod(
  4196. $core.method({
  4197. selector: "abs",
  4198. protocol: 'arithmetic',
  4199. fn: function (){
  4200. var self=this;
  4201. return $core.withContext(function($ctx1) {
  4202. return Math.abs(self);;
  4203. return self;
  4204. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  4205. },
  4206. args: [],
  4207. source: "abs\x0a\x09<return Math.abs(self);>",
  4208. referencedClasses: [],
  4209. messageSends: []
  4210. }),
  4211. $globals.Number);
  4212. $core.addMethod(
  4213. $core.method({
  4214. selector: "arcCos",
  4215. protocol: 'mathematical functions',
  4216. fn: function (){
  4217. var self=this;
  4218. return $core.withContext(function($ctx1) {
  4219. return Math.acos(self);;
  4220. return self;
  4221. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  4222. },
  4223. args: [],
  4224. source: "arcCos\x0a\x09<return Math.acos(self);>",
  4225. referencedClasses: [],
  4226. messageSends: []
  4227. }),
  4228. $globals.Number);
  4229. $core.addMethod(
  4230. $core.method({
  4231. selector: "arcSin",
  4232. protocol: 'mathematical functions',
  4233. fn: function (){
  4234. var self=this;
  4235. return $core.withContext(function($ctx1) {
  4236. return Math.asin(self);;
  4237. return self;
  4238. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  4239. },
  4240. args: [],
  4241. source: "arcSin\x0a\x09<return Math.asin(self);>",
  4242. referencedClasses: [],
  4243. messageSends: []
  4244. }),
  4245. $globals.Number);
  4246. $core.addMethod(
  4247. $core.method({
  4248. selector: "arcTan",
  4249. protocol: 'mathematical functions',
  4250. fn: function (){
  4251. var self=this;
  4252. return $core.withContext(function($ctx1) {
  4253. return Math.atan(self);;
  4254. return self;
  4255. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  4256. },
  4257. args: [],
  4258. source: "arcTan\x0a\x09<return Math.atan(self);>",
  4259. referencedClasses: [],
  4260. messageSends: []
  4261. }),
  4262. $globals.Number);
  4263. $core.addMethod(
  4264. $core.method({
  4265. selector: "asJSON",
  4266. protocol: 'converting',
  4267. fn: function (){
  4268. var self=this;
  4269. return self;
  4270. },
  4271. args: [],
  4272. source: "asJSON\x0a\x09^ self",
  4273. referencedClasses: [],
  4274. messageSends: []
  4275. }),
  4276. $globals.Number);
  4277. $core.addMethod(
  4278. $core.method({
  4279. selector: "asJavascript",
  4280. protocol: 'converting',
  4281. fn: function (){
  4282. var self=this;
  4283. return $core.withContext(function($ctx1) {
  4284. var $1;
  4285. $1=$recv("(".__comma(self._printString())).__comma(")");
  4286. $ctx1.sendIdx[","]=1;
  4287. return $1;
  4288. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Number)});
  4289. },
  4290. args: [],
  4291. source: "asJavascript\x0a\x09^ '(', self printString, ')'",
  4292. referencedClasses: [],
  4293. messageSends: [",", "printString"]
  4294. }),
  4295. $globals.Number);
  4296. $core.addMethod(
  4297. $core.method({
  4298. selector: "asNumber",
  4299. protocol: 'converting',
  4300. fn: function (){
  4301. var self=this;
  4302. return self;
  4303. },
  4304. args: [],
  4305. source: "asNumber\x0a\x09^ self",
  4306. referencedClasses: [],
  4307. messageSends: []
  4308. }),
  4309. $globals.Number);
  4310. $core.addMethod(
  4311. $core.method({
  4312. selector: "asPoint",
  4313. protocol: 'converting',
  4314. fn: function (){
  4315. var self=this;
  4316. return $core.withContext(function($ctx1) {
  4317. return $recv($globals.Point)._x_y_(self,self);
  4318. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  4319. },
  4320. args: [],
  4321. source: "asPoint\x0a\x09^ Point x: self y: self",
  4322. referencedClasses: ["Point"],
  4323. messageSends: ["x:y:"]
  4324. }),
  4325. $globals.Number);
  4326. $core.addMethod(
  4327. $core.method({
  4328. selector: "asString",
  4329. protocol: 'converting',
  4330. fn: function (){
  4331. var self=this;
  4332. return $core.withContext(function($ctx1) {
  4333. return String(self) ;
  4334. return self;
  4335. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  4336. },
  4337. args: [],
  4338. source: "asString\x0a\x09< return String(self) >",
  4339. referencedClasses: [],
  4340. messageSends: []
  4341. }),
  4342. $globals.Number);
  4343. $core.addMethod(
  4344. $core.method({
  4345. selector: "atRandom",
  4346. protocol: 'converting',
  4347. fn: function (){
  4348. var self=this;
  4349. return $core.withContext(function($ctx1) {
  4350. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  4351. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  4352. },
  4353. args: [],
  4354. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  4355. referencedClasses: ["Random"],
  4356. messageSends: ["+", "truncated", "*", "next", "new"]
  4357. }),
  4358. $globals.Number);
  4359. $core.addMethod(
  4360. $core.method({
  4361. selector: "ceiling",
  4362. protocol: 'converting',
  4363. fn: function (){
  4364. var self=this;
  4365. return $core.withContext(function($ctx1) {
  4366. return Math.ceil(self);;
  4367. return self;
  4368. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  4369. },
  4370. args: [],
  4371. source: "ceiling\x0a\x09<return Math.ceil(self);>",
  4372. referencedClasses: [],
  4373. messageSends: []
  4374. }),
  4375. $globals.Number);
  4376. $core.addMethod(
  4377. $core.method({
  4378. selector: "copy",
  4379. protocol: 'copying',
  4380. fn: function (){
  4381. var self=this;
  4382. return self;
  4383. },
  4384. args: [],
  4385. source: "copy\x0a\x09^ self",
  4386. referencedClasses: [],
  4387. messageSends: []
  4388. }),
  4389. $globals.Number);
  4390. $core.addMethod(
  4391. $core.method({
  4392. selector: "cos",
  4393. protocol: 'mathematical functions',
  4394. fn: function (){
  4395. var self=this;
  4396. return $core.withContext(function($ctx1) {
  4397. return Math.cos(self);;
  4398. return self;
  4399. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  4400. },
  4401. args: [],
  4402. source: "cos\x0a\x09<return Math.cos(self);>",
  4403. referencedClasses: [],
  4404. messageSends: []
  4405. }),
  4406. $globals.Number);
  4407. $core.addMethod(
  4408. $core.method({
  4409. selector: "deepCopy",
  4410. protocol: 'copying',
  4411. fn: function (){
  4412. var self=this;
  4413. return $core.withContext(function($ctx1) {
  4414. return self._copy();
  4415. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  4416. },
  4417. args: [],
  4418. source: "deepCopy\x0a\x09^ self copy",
  4419. referencedClasses: [],
  4420. messageSends: ["copy"]
  4421. }),
  4422. $globals.Number);
  4423. $core.addMethod(
  4424. $core.method({
  4425. selector: "even",
  4426. protocol: 'testing',
  4427. fn: function (){
  4428. var self=this;
  4429. return $core.withContext(function($ctx1) {
  4430. return (0).__eq(self.__backslash_backslash((2)));
  4431. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  4432. },
  4433. args: [],
  4434. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  4435. referencedClasses: [],
  4436. messageSends: ["=", "\x5c\x5c"]
  4437. }),
  4438. $globals.Number);
  4439. $core.addMethod(
  4440. $core.method({
  4441. selector: "floor",
  4442. protocol: 'converting',
  4443. fn: function (){
  4444. var self=this;
  4445. return $core.withContext(function($ctx1) {
  4446. return Math.floor(self);;
  4447. return self;
  4448. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  4449. },
  4450. args: [],
  4451. source: "floor\x0a\x09<return Math.floor(self);>",
  4452. referencedClasses: [],
  4453. messageSends: []
  4454. }),
  4455. $globals.Number);
  4456. $core.addMethod(
  4457. $core.method({
  4458. selector: "isImmutable",
  4459. protocol: 'testing',
  4460. fn: function (){
  4461. var self=this;
  4462. return true;
  4463. },
  4464. args: [],
  4465. source: "isImmutable\x0a\x09^ true",
  4466. referencedClasses: [],
  4467. messageSends: []
  4468. }),
  4469. $globals.Number);
  4470. $core.addMethod(
  4471. $core.method({
  4472. selector: "isNumber",
  4473. protocol: 'testing',
  4474. fn: function (){
  4475. var self=this;
  4476. return true;
  4477. },
  4478. args: [],
  4479. source: "isNumber\x0a\x09^ true",
  4480. referencedClasses: [],
  4481. messageSends: []
  4482. }),
  4483. $globals.Number);
  4484. $core.addMethod(
  4485. $core.method({
  4486. selector: "isZero",
  4487. protocol: 'testing',
  4488. fn: function (){
  4489. var self=this;
  4490. return $core.withContext(function($ctx1) {
  4491. return self.__eq((0));
  4492. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  4493. },
  4494. args: [],
  4495. source: "isZero\x0a\x09^ self = 0",
  4496. referencedClasses: [],
  4497. messageSends: ["="]
  4498. }),
  4499. $globals.Number);
  4500. $core.addMethod(
  4501. $core.method({
  4502. selector: "ln",
  4503. protocol: 'mathematical functions',
  4504. fn: function (){
  4505. var self=this;
  4506. return $core.withContext(function($ctx1) {
  4507. return Math.log(self);;
  4508. return self;
  4509. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  4510. },
  4511. args: [],
  4512. source: "ln\x0a\x09<return Math.log(self);>",
  4513. referencedClasses: [],
  4514. messageSends: []
  4515. }),
  4516. $globals.Number);
  4517. $core.addMethod(
  4518. $core.method({
  4519. selector: "log",
  4520. protocol: 'mathematical functions',
  4521. fn: function (){
  4522. var self=this;
  4523. return $core.withContext(function($ctx1) {
  4524. return Math.log(self) / Math.LN10;;
  4525. return self;
  4526. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  4527. },
  4528. args: [],
  4529. source: "log\x0a\x09<return Math.log(self) / Math.LN10;>",
  4530. referencedClasses: [],
  4531. messageSends: []
  4532. }),
  4533. $globals.Number);
  4534. $core.addMethod(
  4535. $core.method({
  4536. selector: "log:",
  4537. protocol: 'mathematical functions',
  4538. fn: function (aNumber){
  4539. var self=this;
  4540. return $core.withContext(function($ctx1) {
  4541. return Math.log(self) / Math.log(aNumber);;
  4542. return self;
  4543. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  4544. },
  4545. args: ["aNumber"],
  4546. source: "log: aNumber\x0a\x09<return Math.log(self) / Math.log(aNumber);>",
  4547. referencedClasses: [],
  4548. messageSends: []
  4549. }),
  4550. $globals.Number);
  4551. $core.addMethod(
  4552. $core.method({
  4553. selector: "max:",
  4554. protocol: 'arithmetic',
  4555. fn: function (aNumber){
  4556. var self=this;
  4557. return $core.withContext(function($ctx1) {
  4558. return Math.max(self, aNumber);;
  4559. return self;
  4560. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  4561. },
  4562. args: ["aNumber"],
  4563. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  4564. referencedClasses: [],
  4565. messageSends: []
  4566. }),
  4567. $globals.Number);
  4568. $core.addMethod(
  4569. $core.method({
  4570. selector: "min:",
  4571. protocol: 'arithmetic',
  4572. fn: function (aNumber){
  4573. var self=this;
  4574. return $core.withContext(function($ctx1) {
  4575. return Math.min(self, aNumber);;
  4576. return self;
  4577. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  4578. },
  4579. args: ["aNumber"],
  4580. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  4581. referencedClasses: [],
  4582. messageSends: []
  4583. }),
  4584. $globals.Number);
  4585. $core.addMethod(
  4586. $core.method({
  4587. selector: "negated",
  4588. protocol: 'arithmetic',
  4589. fn: function (){
  4590. var self=this;
  4591. return $core.withContext(function($ctx1) {
  4592. return (0).__minus(self);
  4593. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  4594. },
  4595. args: [],
  4596. source: "negated\x0a\x09^ 0 - self",
  4597. referencedClasses: [],
  4598. messageSends: ["-"]
  4599. }),
  4600. $globals.Number);
  4601. $core.addMethod(
  4602. $core.method({
  4603. selector: "negative",
  4604. protocol: 'testing',
  4605. fn: function (){
  4606. var self=this;
  4607. return $core.withContext(function($ctx1) {
  4608. return self.__lt((0));
  4609. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  4610. },
  4611. args: [],
  4612. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  4613. referencedClasses: [],
  4614. messageSends: ["<"]
  4615. }),
  4616. $globals.Number);
  4617. $core.addMethod(
  4618. $core.method({
  4619. selector: "odd",
  4620. protocol: 'testing',
  4621. fn: function (){
  4622. var self=this;
  4623. return $core.withContext(function($ctx1) {
  4624. return $recv(self._even())._not();
  4625. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  4626. },
  4627. args: [],
  4628. source: "odd\x0a\x09^ self even not",
  4629. referencedClasses: [],
  4630. messageSends: ["not", "even"]
  4631. }),
  4632. $globals.Number);
  4633. $core.addMethod(
  4634. $core.method({
  4635. selector: "positive",
  4636. protocol: 'testing',
  4637. fn: function (){
  4638. var self=this;
  4639. return $core.withContext(function($ctx1) {
  4640. return self.__gt_eq((0));
  4641. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  4642. },
  4643. args: [],
  4644. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4645. referencedClasses: [],
  4646. messageSends: [">="]
  4647. }),
  4648. $globals.Number);
  4649. $core.addMethod(
  4650. $core.method({
  4651. selector: "printOn:",
  4652. protocol: 'printing',
  4653. fn: function (aStream){
  4654. var self=this;
  4655. return $core.withContext(function($ctx1) {
  4656. $recv(aStream)._nextPutAll_(self._asString());
  4657. return self;
  4658. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  4659. },
  4660. args: ["aStream"],
  4661. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4662. referencedClasses: [],
  4663. messageSends: ["nextPutAll:", "asString"]
  4664. }),
  4665. $globals.Number);
  4666. $core.addMethod(
  4667. $core.method({
  4668. selector: "printShowingDecimalPlaces:",
  4669. protocol: 'printing',
  4670. fn: function (placesDesired){
  4671. var self=this;
  4672. return $core.withContext(function($ctx1) {
  4673. return self.toFixed(placesDesired);
  4674. return self;
  4675. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  4676. },
  4677. args: ["placesDesired"],
  4678. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  4679. referencedClasses: [],
  4680. messageSends: []
  4681. }),
  4682. $globals.Number);
  4683. $core.addMethod(
  4684. $core.method({
  4685. selector: "raisedTo:",
  4686. protocol: 'mathematical functions',
  4687. fn: function (exponent){
  4688. var self=this;
  4689. return $core.withContext(function($ctx1) {
  4690. return Math.pow(self, exponent);;
  4691. return self;
  4692. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  4693. },
  4694. args: ["exponent"],
  4695. source: "raisedTo: exponent\x0a\x09<return Math.pow(self, exponent);>",
  4696. referencedClasses: [],
  4697. messageSends: []
  4698. }),
  4699. $globals.Number);
  4700. $core.addMethod(
  4701. $core.method({
  4702. selector: "rounded",
  4703. protocol: 'converting',
  4704. fn: function (){
  4705. var self=this;
  4706. return $core.withContext(function($ctx1) {
  4707. return Math.round(self);;
  4708. return self;
  4709. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  4710. },
  4711. args: [],
  4712. source: "rounded\x0a\x09<return Math.round(self);>",
  4713. referencedClasses: [],
  4714. messageSends: []
  4715. }),
  4716. $globals.Number);
  4717. $core.addMethod(
  4718. $core.method({
  4719. selector: "sign",
  4720. protocol: 'mathematical functions',
  4721. fn: function (){
  4722. var self=this;
  4723. return $core.withContext(function($ctx1) {
  4724. var $1,$2;
  4725. $1=self._isZero();
  4726. if($core.assert($1)){
  4727. return (0);
  4728. };
  4729. $2=self._positive();
  4730. if($core.assert($2)){
  4731. return (1);
  4732. } else {
  4733. return (-1);
  4734. };
  4735. return self;
  4736. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  4737. },
  4738. args: [],
  4739. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  4740. referencedClasses: [],
  4741. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  4742. }),
  4743. $globals.Number);
  4744. $core.addMethod(
  4745. $core.method({
  4746. selector: "sin",
  4747. protocol: 'mathematical functions',
  4748. fn: function (){
  4749. var self=this;
  4750. return $core.withContext(function($ctx1) {
  4751. return Math.sin(self);;
  4752. return self;
  4753. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  4754. },
  4755. args: [],
  4756. source: "sin\x0a\x09<return Math.sin(self);>",
  4757. referencedClasses: [],
  4758. messageSends: []
  4759. }),
  4760. $globals.Number);
  4761. $core.addMethod(
  4762. $core.method({
  4763. selector: "sqrt",
  4764. protocol: 'mathematical functions',
  4765. fn: function (){
  4766. var self=this;
  4767. return $core.withContext(function($ctx1) {
  4768. return Math.sqrt(self);
  4769. return self;
  4770. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  4771. },
  4772. args: [],
  4773. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  4774. referencedClasses: [],
  4775. messageSends: []
  4776. }),
  4777. $globals.Number);
  4778. $core.addMethod(
  4779. $core.method({
  4780. selector: "squared",
  4781. protocol: 'mathematical functions',
  4782. fn: function (){
  4783. var self=this;
  4784. return $core.withContext(function($ctx1) {
  4785. return self.__star(self);
  4786. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  4787. },
  4788. args: [],
  4789. source: "squared\x0a\x09^ self * self",
  4790. referencedClasses: [],
  4791. messageSends: ["*"]
  4792. }),
  4793. $globals.Number);
  4794. $core.addMethod(
  4795. $core.method({
  4796. selector: "tan",
  4797. protocol: 'mathematical functions',
  4798. fn: function (){
  4799. var self=this;
  4800. return $core.withContext(function($ctx1) {
  4801. return Math.tan(self);;
  4802. return self;
  4803. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  4804. },
  4805. args: [],
  4806. source: "tan\x0a\x09<return Math.tan(self);>",
  4807. referencedClasses: [],
  4808. messageSends: []
  4809. }),
  4810. $globals.Number);
  4811. $core.addMethod(
  4812. $core.method({
  4813. selector: "timesRepeat:",
  4814. protocol: 'enumerating',
  4815. fn: function (aBlock){
  4816. var self=this;
  4817. var count;
  4818. return $core.withContext(function($ctx1) {
  4819. count=(1);
  4820. $recv((function(){
  4821. return $core.withContext(function($ctx2) {
  4822. return $recv(count).__gt(self);
  4823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4824. }))._whileFalse_((function(){
  4825. return $core.withContext(function($ctx2) {
  4826. $recv(aBlock)._value();
  4827. count=$recv(count).__plus((1));
  4828. return count;
  4829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4830. }));
  4831. return self;
  4832. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  4833. },
  4834. args: ["aBlock"],
  4835. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  4836. referencedClasses: [],
  4837. messageSends: ["whileFalse:", ">", "value", "+"]
  4838. }),
  4839. $globals.Number);
  4840. $core.addMethod(
  4841. $core.method({
  4842. selector: "to:",
  4843. protocol: 'converting',
  4844. fn: function (aNumber){
  4845. var self=this;
  4846. var array,first,last,count;
  4847. return $core.withContext(function($ctx1) {
  4848. first=self._truncated();
  4849. $ctx1.sendIdx["truncated"]=1;
  4850. last=$recv($recv(aNumber)._truncated()).__plus((1));
  4851. $ctx1.sendIdx["+"]=1;
  4852. count=(1);
  4853. array=$recv($globals.Array)._new();
  4854. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  4855. return $core.withContext(function($ctx2) {
  4856. $recv(array)._at_put_(count,first);
  4857. count=$recv(count).__plus((1));
  4858. $ctx2.sendIdx["+"]=2;
  4859. count;
  4860. first=$recv(first).__plus((1));
  4861. return first;
  4862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4863. }));
  4864. return array;
  4865. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  4866. },
  4867. args: ["aNumber"],
  4868. 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",
  4869. referencedClasses: ["Array"],
  4870. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  4871. }),
  4872. $globals.Number);
  4873. $core.addMethod(
  4874. $core.method({
  4875. selector: "to:by:",
  4876. protocol: 'converting',
  4877. fn: function (stop,step){
  4878. var self=this;
  4879. var array,value,pos;
  4880. return $core.withContext(function($ctx1) {
  4881. var $1,$2;
  4882. value=self;
  4883. array=$recv($globals.Array)._new();
  4884. pos=(1);
  4885. $1=$recv(step).__eq((0));
  4886. if($core.assert($1)){
  4887. self._error_("step must be non-zero");
  4888. };
  4889. $2=$recv(step).__lt((0));
  4890. if($core.assert($2)){
  4891. $recv((function(){
  4892. return $core.withContext(function($ctx2) {
  4893. return $recv(value).__gt_eq(stop);
  4894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4895. }))._whileTrue_((function(){
  4896. return $core.withContext(function($ctx2) {
  4897. $recv(array)._at_put_(pos,value);
  4898. $ctx2.sendIdx["at:put:"]=1;
  4899. pos=$recv(pos).__plus((1));
  4900. $ctx2.sendIdx["+"]=1;
  4901. pos;
  4902. value=$recv(value).__plus(step);
  4903. $ctx2.sendIdx["+"]=2;
  4904. return value;
  4905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4906. }));
  4907. $ctx1.sendIdx["whileTrue:"]=1;
  4908. } else {
  4909. $recv((function(){
  4910. return $core.withContext(function($ctx2) {
  4911. return $recv(value).__lt_eq(stop);
  4912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4913. }))._whileTrue_((function(){
  4914. return $core.withContext(function($ctx2) {
  4915. $recv(array)._at_put_(pos,value);
  4916. pos=$recv(pos).__plus((1));
  4917. $ctx2.sendIdx["+"]=3;
  4918. pos;
  4919. value=$recv(value).__plus(step);
  4920. return value;
  4921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4922. }));
  4923. };
  4924. return array;
  4925. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  4926. },
  4927. args: ["stop", "step"],
  4928. 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",
  4929. referencedClasses: ["Array"],
  4930. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  4931. }),
  4932. $globals.Number);
  4933. $core.addMethod(
  4934. $core.method({
  4935. selector: "to:by:do:",
  4936. protocol: 'enumerating',
  4937. fn: function (stop,step,aBlock){
  4938. var self=this;
  4939. var value;
  4940. return $core.withContext(function($ctx1) {
  4941. var $1,$2;
  4942. value=self;
  4943. $1=$recv(step).__eq((0));
  4944. if($core.assert($1)){
  4945. self._error_("step must be non-zero");
  4946. };
  4947. $2=$recv(step).__lt((0));
  4948. if($core.assert($2)){
  4949. $recv((function(){
  4950. return $core.withContext(function($ctx2) {
  4951. return $recv(value).__gt_eq(stop);
  4952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4953. }))._whileTrue_((function(){
  4954. return $core.withContext(function($ctx2) {
  4955. $recv(aBlock)._value_(value);
  4956. $ctx2.sendIdx["value:"]=1;
  4957. value=$recv(value).__plus(step);
  4958. $ctx2.sendIdx["+"]=1;
  4959. return value;
  4960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4961. }));
  4962. $ctx1.sendIdx["whileTrue:"]=1;
  4963. } else {
  4964. $recv((function(){
  4965. return $core.withContext(function($ctx2) {
  4966. return $recv(value).__lt_eq(stop);
  4967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4968. }))._whileTrue_((function(){
  4969. return $core.withContext(function($ctx2) {
  4970. $recv(aBlock)._value_(value);
  4971. value=$recv(value).__plus(step);
  4972. return value;
  4973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4974. }));
  4975. };
  4976. return self;
  4977. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  4978. },
  4979. args: ["stop", "step", "aBlock"],
  4980. 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 ]]",
  4981. referencedClasses: [],
  4982. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  4983. }),
  4984. $globals.Number);
  4985. $core.addMethod(
  4986. $core.method({
  4987. selector: "to:do:",
  4988. protocol: 'enumerating',
  4989. fn: function (stop,aBlock){
  4990. var self=this;
  4991. var nextValue;
  4992. return $core.withContext(function($ctx1) {
  4993. nextValue=self;
  4994. $recv((function(){
  4995. return $core.withContext(function($ctx2) {
  4996. return $recv(nextValue).__lt_eq(stop);
  4997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4998. }))._whileTrue_((function(){
  4999. return $core.withContext(function($ctx2) {
  5000. $recv(aBlock)._value_(nextValue);
  5001. nextValue=$recv(nextValue).__plus((1));
  5002. return nextValue;
  5003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5004. }));
  5005. return self;
  5006. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  5007. },
  5008. args: ["stop", "aBlock"],
  5009. 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 ]",
  5010. referencedClasses: [],
  5011. messageSends: ["whileTrue:", "<=", "value:", "+"]
  5012. }),
  5013. $globals.Number);
  5014. $core.addMethod(
  5015. $core.method({
  5016. selector: "truncated",
  5017. protocol: 'converting',
  5018. fn: function (){
  5019. var self=this;
  5020. return $core.withContext(function($ctx1) {
  5021. if(self >= 0) {
  5022. return Math.floor(self);
  5023. } else {
  5024. return Math.floor(self * (-1)) * (-1);
  5025. };
  5026. ;
  5027. return self;
  5028. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  5029. },
  5030. args: [],
  5031. source: "truncated\x0a\x09<\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>",
  5032. referencedClasses: [],
  5033. messageSends: []
  5034. }),
  5035. $globals.Number);
  5036. $core.addMethod(
  5037. $core.method({
  5038. selector: "|",
  5039. protocol: 'converting',
  5040. fn: function (aNumber){
  5041. var self=this;
  5042. return $core.withContext(function($ctx1) {
  5043. return self | aNumber;
  5044. return self;
  5045. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  5046. },
  5047. args: ["aNumber"],
  5048. source: "| aNumber\x0a\x09<return self | aNumber>",
  5049. referencedClasses: [],
  5050. messageSends: []
  5051. }),
  5052. $globals.Number);
  5053. $core.addMethod(
  5054. $core.method({
  5055. selector: "classTag",
  5056. protocol: 'accessing',
  5057. fn: function (){
  5058. var self=this;
  5059. return "magnitude";
  5060. },
  5061. args: [],
  5062. 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'",
  5063. referencedClasses: [],
  5064. messageSends: []
  5065. }),
  5066. $globals.Number.klass);
  5067. $core.addMethod(
  5068. $core.method({
  5069. selector: "e",
  5070. protocol: 'instance creation',
  5071. fn: function (){
  5072. var self=this;
  5073. return $core.withContext(function($ctx1) {
  5074. return Math.E;;
  5075. return self;
  5076. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.klass)});
  5077. },
  5078. args: [],
  5079. source: "e\x0a\x09<return Math.E;>",
  5080. referencedClasses: [],
  5081. messageSends: []
  5082. }),
  5083. $globals.Number.klass);
  5084. $core.addMethod(
  5085. $core.method({
  5086. selector: "pi",
  5087. protocol: 'instance creation',
  5088. fn: function (){
  5089. var self=this;
  5090. return $core.withContext(function($ctx1) {
  5091. return Math.PI;
  5092. return self;
  5093. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.klass)});
  5094. },
  5095. args: [],
  5096. source: "pi\x0a\x09<return Math.PI>",
  5097. referencedClasses: [],
  5098. messageSends: []
  5099. }),
  5100. $globals.Number.klass);
  5101. $core.addClass('Point', $globals.Object, ['x', 'y'], 'Kernel-Objects');
  5102. $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";
  5103. $core.addMethod(
  5104. $core.method({
  5105. selector: "*",
  5106. protocol: 'arithmetic',
  5107. fn: function (aPoint){
  5108. var self=this;
  5109. return $core.withContext(function($ctx1) {
  5110. var $2,$4,$3,$1,$6,$5;
  5111. $2=self._x();
  5112. $ctx1.sendIdx["x"]=1;
  5113. $4=$recv(aPoint)._asPoint();
  5114. $ctx1.sendIdx["asPoint"]=1;
  5115. $3=$recv($4)._x();
  5116. $1=$recv($2).__star($3);
  5117. $ctx1.sendIdx["*"]=1;
  5118. $6=self._y();
  5119. $ctx1.sendIdx["y"]=1;
  5120. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  5121. return $recv($globals.Point)._x_y_($1,$5);
  5122. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  5123. },
  5124. args: ["aPoint"],
  5125. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  5126. referencedClasses: ["Point"],
  5127. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  5128. }),
  5129. $globals.Point);
  5130. $core.addMethod(
  5131. $core.method({
  5132. selector: "+",
  5133. protocol: 'arithmetic',
  5134. fn: function (aPoint){
  5135. var self=this;
  5136. return $core.withContext(function($ctx1) {
  5137. var $2,$4,$3,$1,$6,$5;
  5138. $2=self._x();
  5139. $ctx1.sendIdx["x"]=1;
  5140. $4=$recv(aPoint)._asPoint();
  5141. $ctx1.sendIdx["asPoint"]=1;
  5142. $3=$recv($4)._x();
  5143. $1=$recv($2).__plus($3);
  5144. $ctx1.sendIdx["+"]=1;
  5145. $6=self._y();
  5146. $ctx1.sendIdx["y"]=1;
  5147. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  5148. return $recv($globals.Point)._x_y_($1,$5);
  5149. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  5150. },
  5151. args: ["aPoint"],
  5152. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  5153. referencedClasses: ["Point"],
  5154. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  5155. }),
  5156. $globals.Point);
  5157. $core.addMethod(
  5158. $core.method({
  5159. selector: "-",
  5160. protocol: 'arithmetic',
  5161. fn: function (aPoint){
  5162. var self=this;
  5163. return $core.withContext(function($ctx1) {
  5164. var $2,$4,$3,$1,$6,$5;
  5165. $2=self._x();
  5166. $ctx1.sendIdx["x"]=1;
  5167. $4=$recv(aPoint)._asPoint();
  5168. $ctx1.sendIdx["asPoint"]=1;
  5169. $3=$recv($4)._x();
  5170. $1=$recv($2).__minus($3);
  5171. $ctx1.sendIdx["-"]=1;
  5172. $6=self._y();
  5173. $ctx1.sendIdx["y"]=1;
  5174. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  5175. return $recv($globals.Point)._x_y_($1,$5);
  5176. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  5177. },
  5178. args: ["aPoint"],
  5179. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  5180. referencedClasses: ["Point"],
  5181. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  5182. }),
  5183. $globals.Point);
  5184. $core.addMethod(
  5185. $core.method({
  5186. selector: "/",
  5187. protocol: 'arithmetic',
  5188. fn: function (aPoint){
  5189. var self=this;
  5190. return $core.withContext(function($ctx1) {
  5191. var $2,$4,$3,$1,$6,$5;
  5192. $2=self._x();
  5193. $ctx1.sendIdx["x"]=1;
  5194. $4=$recv(aPoint)._asPoint();
  5195. $ctx1.sendIdx["asPoint"]=1;
  5196. $3=$recv($4)._x();
  5197. $1=$recv($2).__slash($3);
  5198. $ctx1.sendIdx["/"]=1;
  5199. $6=self._y();
  5200. $ctx1.sendIdx["y"]=1;
  5201. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  5202. return $recv($globals.Point)._x_y_($1,$5);
  5203. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  5204. },
  5205. args: ["aPoint"],
  5206. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  5207. referencedClasses: ["Point"],
  5208. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  5209. }),
  5210. $globals.Point);
  5211. $core.addMethod(
  5212. $core.method({
  5213. selector: "<",
  5214. protocol: 'comparing',
  5215. fn: function (aPoint){
  5216. var self=this;
  5217. return $core.withContext(function($ctx1) {
  5218. var $2,$1,$3;
  5219. $2=self._x();
  5220. $ctx1.sendIdx["x"]=1;
  5221. $1=$recv($2).__lt($recv(aPoint)._x());
  5222. $ctx1.sendIdx["<"]=1;
  5223. return $recv($1)._and_((function(){
  5224. return $core.withContext(function($ctx2) {
  5225. $3=self._y();
  5226. $ctx2.sendIdx["y"]=1;
  5227. return $recv($3).__lt($recv(aPoint)._y());
  5228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5229. }));
  5230. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  5231. },
  5232. args: ["aPoint"],
  5233. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  5234. referencedClasses: [],
  5235. messageSends: ["and:", "<", "x", "y"]
  5236. }),
  5237. $globals.Point);
  5238. $core.addMethod(
  5239. $core.method({
  5240. selector: "<=",
  5241. protocol: 'comparing',
  5242. fn: function (aPoint){
  5243. var self=this;
  5244. return $core.withContext(function($ctx1) {
  5245. var $2,$1,$3;
  5246. $2=self._x();
  5247. $ctx1.sendIdx["x"]=1;
  5248. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  5249. $ctx1.sendIdx["<="]=1;
  5250. return $recv($1)._and_((function(){
  5251. return $core.withContext(function($ctx2) {
  5252. $3=self._y();
  5253. $ctx2.sendIdx["y"]=1;
  5254. return $recv($3).__lt_eq($recv(aPoint)._y());
  5255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5256. }));
  5257. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  5258. },
  5259. args: ["aPoint"],
  5260. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  5261. referencedClasses: [],
  5262. messageSends: ["and:", "<=", "x", "y"]
  5263. }),
  5264. $globals.Point);
  5265. $core.addMethod(
  5266. $core.method({
  5267. selector: "=",
  5268. protocol: 'comparing',
  5269. fn: function (aPoint){
  5270. var self=this;
  5271. return $core.withContext(function($ctx1) {
  5272. var $2,$1,$4,$3,$6,$5;
  5273. $2=$recv(aPoint)._class();
  5274. $ctx1.sendIdx["class"]=1;
  5275. $1=$recv($2).__eq(self._class());
  5276. $ctx1.sendIdx["="]=1;
  5277. return $recv($1)._and_((function(){
  5278. return $core.withContext(function($ctx2) {
  5279. $4=$recv(aPoint)._x();
  5280. $ctx2.sendIdx["x"]=1;
  5281. $3=$recv($4).__eq(self._x());
  5282. $ctx2.sendIdx["="]=2;
  5283. $6=$recv(aPoint)._y();
  5284. $ctx2.sendIdx["y"]=1;
  5285. $5=$recv($6).__eq(self._y());
  5286. return $recv($3).__and($5);
  5287. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5288. }));
  5289. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  5290. },
  5291. args: ["aPoint"],
  5292. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  5293. referencedClasses: [],
  5294. messageSends: ["and:", "=", "class", "&", "x", "y"]
  5295. }),
  5296. $globals.Point);
  5297. $core.addMethod(
  5298. $core.method({
  5299. selector: ">",
  5300. protocol: 'comparing',
  5301. fn: function (aPoint){
  5302. var self=this;
  5303. return $core.withContext(function($ctx1) {
  5304. var $2,$1,$3;
  5305. $2=self._x();
  5306. $ctx1.sendIdx["x"]=1;
  5307. $1=$recv($2).__gt($recv(aPoint)._x());
  5308. $ctx1.sendIdx[">"]=1;
  5309. return $recv($1)._and_((function(){
  5310. return $core.withContext(function($ctx2) {
  5311. $3=self._y();
  5312. $ctx2.sendIdx["y"]=1;
  5313. return $recv($3).__gt($recv(aPoint)._y());
  5314. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5315. }));
  5316. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  5317. },
  5318. args: ["aPoint"],
  5319. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  5320. referencedClasses: [],
  5321. messageSends: ["and:", ">", "x", "y"]
  5322. }),
  5323. $globals.Point);
  5324. $core.addMethod(
  5325. $core.method({
  5326. selector: ">=",
  5327. protocol: 'comparing',
  5328. fn: function (aPoint){
  5329. var self=this;
  5330. return $core.withContext(function($ctx1) {
  5331. var $2,$1,$3;
  5332. $2=self._x();
  5333. $ctx1.sendIdx["x"]=1;
  5334. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  5335. $ctx1.sendIdx[">="]=1;
  5336. return $recv($1)._and_((function(){
  5337. return $core.withContext(function($ctx2) {
  5338. $3=self._y();
  5339. $ctx2.sendIdx["y"]=1;
  5340. return $recv($3).__gt_eq($recv(aPoint)._y());
  5341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5342. }));
  5343. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  5344. },
  5345. args: ["aPoint"],
  5346. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  5347. referencedClasses: [],
  5348. messageSends: ["and:", ">=", "x", "y"]
  5349. }),
  5350. $globals.Point);
  5351. $core.addMethod(
  5352. $core.method({
  5353. selector: "asPoint",
  5354. protocol: 'converting',
  5355. fn: function (){
  5356. var self=this;
  5357. return self;
  5358. },
  5359. args: [],
  5360. source: "asPoint\x0a\x09^ self",
  5361. referencedClasses: [],
  5362. messageSends: []
  5363. }),
  5364. $globals.Point);
  5365. $core.addMethod(
  5366. $core.method({
  5367. selector: "dist:",
  5368. protocol: 'transforming',
  5369. fn: function (aPoint){
  5370. var self=this;
  5371. var dx,dy;
  5372. return $core.withContext(function($ctx1) {
  5373. var $2,$1;
  5374. dx=$recv($recv(aPoint)._x()).__minus(self["@x"]);
  5375. $ctx1.sendIdx["-"]=1;
  5376. dy=$recv($recv(aPoint)._y()).__minus(self["@y"]);
  5377. $2=$recv(dx).__star(dx);
  5378. $ctx1.sendIdx["*"]=1;
  5379. $1=$recv($2).__plus($recv(dy).__star(dy));
  5380. return $recv($1)._sqrt();
  5381. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  5382. },
  5383. args: ["aPoint"],
  5384. 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",
  5385. referencedClasses: [],
  5386. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  5387. }),
  5388. $globals.Point);
  5389. $core.addMethod(
  5390. $core.method({
  5391. selector: "printOn:",
  5392. protocol: 'printing',
  5393. fn: function (aStream){
  5394. var self=this;
  5395. return $core.withContext(function($ctx1) {
  5396. var $1;
  5397. $recv(self["@x"])._printOn_(aStream);
  5398. $ctx1.sendIdx["printOn:"]=1;
  5399. $recv(aStream)._nextPutAll_("@");
  5400. $1=$recv($recv(self["@y"])._notNil())._and_((function(){
  5401. return $core.withContext(function($ctx2) {
  5402. return $recv(self["@y"])._negative();
  5403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5404. }));
  5405. if($core.assert($1)){
  5406. $recv(aStream)._space();
  5407. };
  5408. $recv(self["@y"])._printOn_(aStream);
  5409. return self;
  5410. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  5411. },
  5412. args: ["aStream"],
  5413. 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",
  5414. referencedClasses: [],
  5415. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  5416. }),
  5417. $globals.Point);
  5418. $core.addMethod(
  5419. $core.method({
  5420. selector: "translateBy:",
  5421. protocol: 'transforming',
  5422. fn: function (delta){
  5423. var self=this;
  5424. return $core.withContext(function($ctx1) {
  5425. var $1;
  5426. $1=$recv($recv(delta)._x()).__plus(self["@x"]);
  5427. $ctx1.sendIdx["+"]=1;
  5428. return $recv($1).__at($recv($recv(delta)._y()).__plus(self["@y"]));
  5429. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  5430. },
  5431. args: ["delta"],
  5432. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  5433. referencedClasses: [],
  5434. messageSends: ["@", "+", "x", "y"]
  5435. }),
  5436. $globals.Point);
  5437. $core.addMethod(
  5438. $core.method({
  5439. selector: "x",
  5440. protocol: 'accessing',
  5441. fn: function (){
  5442. var self=this;
  5443. return self["@x"];
  5444. },
  5445. args: [],
  5446. source: "x\x0a\x09^ x",
  5447. referencedClasses: [],
  5448. messageSends: []
  5449. }),
  5450. $globals.Point);
  5451. $core.addMethod(
  5452. $core.method({
  5453. selector: "x:",
  5454. protocol: 'accessing',
  5455. fn: function (aNumber){
  5456. var self=this;
  5457. self["@x"]=aNumber;
  5458. return self;
  5459. },
  5460. args: ["aNumber"],
  5461. source: "x: aNumber\x0a\x09x := aNumber",
  5462. referencedClasses: [],
  5463. messageSends: []
  5464. }),
  5465. $globals.Point);
  5466. $core.addMethod(
  5467. $core.method({
  5468. selector: "y",
  5469. protocol: 'accessing',
  5470. fn: function (){
  5471. var self=this;
  5472. return self["@y"];
  5473. },
  5474. args: [],
  5475. source: "y\x0a\x09^ y",
  5476. referencedClasses: [],
  5477. messageSends: []
  5478. }),
  5479. $globals.Point);
  5480. $core.addMethod(
  5481. $core.method({
  5482. selector: "y:",
  5483. protocol: 'accessing',
  5484. fn: function (aNumber){
  5485. var self=this;
  5486. self["@y"]=aNumber;
  5487. return self;
  5488. },
  5489. args: ["aNumber"],
  5490. source: "y: aNumber\x0a\x09y := aNumber",
  5491. referencedClasses: [],
  5492. messageSends: []
  5493. }),
  5494. $globals.Point);
  5495. $core.addMethod(
  5496. $core.method({
  5497. selector: "classTag",
  5498. protocol: 'accessing',
  5499. fn: function (){
  5500. var self=this;
  5501. return "magnitude";
  5502. },
  5503. args: [],
  5504. 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'",
  5505. referencedClasses: [],
  5506. messageSends: []
  5507. }),
  5508. $globals.Point.klass);
  5509. $core.addMethod(
  5510. $core.method({
  5511. selector: "x:y:",
  5512. protocol: 'instance creation',
  5513. fn: function (aNumber,anotherNumber){
  5514. var self=this;
  5515. return $core.withContext(function($ctx1) {
  5516. var $1;
  5517. $1=self._new();
  5518. $recv($1)._x_(aNumber);
  5519. $recv($1)._y_(anotherNumber);
  5520. return $recv($1)._yourself();
  5521. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.klass)});
  5522. },
  5523. args: ["aNumber", "anotherNumber"],
  5524. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  5525. referencedClasses: [],
  5526. messageSends: ["x:", "new", "y:", "yourself"]
  5527. }),
  5528. $globals.Point.klass);
  5529. $core.addClass('Random', $globals.Object, [], 'Kernel-Objects');
  5530. $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'`.";
  5531. $core.addMethod(
  5532. $core.method({
  5533. selector: "next",
  5534. protocol: 'accessing',
  5535. fn: function (){
  5536. var self=this;
  5537. return $core.withContext(function($ctx1) {
  5538. return Math.random();
  5539. return self;
  5540. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  5541. },
  5542. args: [],
  5543. source: "next\x0a\x09<return Math.random()>",
  5544. referencedClasses: [],
  5545. messageSends: []
  5546. }),
  5547. $globals.Random);
  5548. $core.addMethod(
  5549. $core.method({
  5550. selector: "next:",
  5551. protocol: 'accessing',
  5552. fn: function (anInteger){
  5553. var self=this;
  5554. return $core.withContext(function($ctx1) {
  5555. return $recv((1)._to_(anInteger))._collect_((function(each){
  5556. return $core.withContext(function($ctx2) {
  5557. return self._next();
  5558. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5559. }));
  5560. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  5561. },
  5562. args: ["anInteger"],
  5563. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  5564. referencedClasses: [],
  5565. messageSends: ["collect:", "to:", "next"]
  5566. }),
  5567. $globals.Random);
  5568. $core.addClass('UndefinedObject', $globals.Object, [], 'Kernel-Objects');
  5569. $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`.";
  5570. $core.addMethod(
  5571. $core.method({
  5572. selector: "asJSON",
  5573. protocol: 'converting',
  5574. fn: function (){
  5575. var self=this;
  5576. return null;
  5577. },
  5578. args: [],
  5579. source: "asJSON\x0a\x09^ null",
  5580. referencedClasses: [],
  5581. messageSends: []
  5582. }),
  5583. $globals.UndefinedObject);
  5584. $core.addMethod(
  5585. $core.method({
  5586. selector: "deepCopy",
  5587. protocol: 'copying',
  5588. fn: function (){
  5589. var self=this;
  5590. return self;
  5591. },
  5592. args: [],
  5593. source: "deepCopy\x0a\x09^ self",
  5594. referencedClasses: [],
  5595. messageSends: []
  5596. }),
  5597. $globals.UndefinedObject);
  5598. $core.addMethod(
  5599. $core.method({
  5600. selector: "ifNil:",
  5601. protocol: 'testing',
  5602. fn: function (aBlock){
  5603. var self=this;
  5604. return $core.withContext(function($ctx1) {
  5605. return self._ifNil_ifNotNil_(aBlock,(function(){
  5606. }));
  5607. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  5608. },
  5609. args: ["aBlock"],
  5610. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  5611. referencedClasses: [],
  5612. messageSends: ["ifNil:ifNotNil:"]
  5613. }),
  5614. $globals.UndefinedObject);
  5615. $core.addMethod(
  5616. $core.method({
  5617. selector: "ifNil:ifNotNil:",
  5618. protocol: 'testing',
  5619. fn: function (aBlock,anotherBlock){
  5620. var self=this;
  5621. return $core.withContext(function($ctx1) {
  5622. return $recv(aBlock)._value();
  5623. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5624. },
  5625. args: ["aBlock", "anotherBlock"],
  5626. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  5627. referencedClasses: [],
  5628. messageSends: ["value"]
  5629. }),
  5630. $globals.UndefinedObject);
  5631. $core.addMethod(
  5632. $core.method({
  5633. selector: "ifNotNil:",
  5634. protocol: 'testing',
  5635. fn: function (aBlock){
  5636. var self=this;
  5637. return self;
  5638. },
  5639. args: ["aBlock"],
  5640. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  5641. referencedClasses: [],
  5642. messageSends: []
  5643. }),
  5644. $globals.UndefinedObject);
  5645. $core.addMethod(
  5646. $core.method({
  5647. selector: "ifNotNil:ifNil:",
  5648. protocol: 'testing',
  5649. fn: function (aBlock,anotherBlock){
  5650. var self=this;
  5651. return $core.withContext(function($ctx1) {
  5652. return $recv(anotherBlock)._value();
  5653. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5654. },
  5655. args: ["aBlock", "anotherBlock"],
  5656. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  5657. referencedClasses: [],
  5658. messageSends: ["value"]
  5659. }),
  5660. $globals.UndefinedObject);
  5661. $core.addMethod(
  5662. $core.method({
  5663. selector: "isImmutable",
  5664. protocol: 'testing',
  5665. fn: function (){
  5666. var self=this;
  5667. return true;
  5668. },
  5669. args: [],
  5670. source: "isImmutable\x0a\x09^ true",
  5671. referencedClasses: [],
  5672. messageSends: []
  5673. }),
  5674. $globals.UndefinedObject);
  5675. $core.addMethod(
  5676. $core.method({
  5677. selector: "isNil",
  5678. protocol: 'testing',
  5679. fn: function (){
  5680. var self=this;
  5681. return true;
  5682. },
  5683. args: [],
  5684. source: "isNil\x0a\x09^ true",
  5685. referencedClasses: [],
  5686. messageSends: []
  5687. }),
  5688. $globals.UndefinedObject);
  5689. $core.addMethod(
  5690. $core.method({
  5691. selector: "notNil",
  5692. protocol: 'testing',
  5693. fn: function (){
  5694. var self=this;
  5695. return false;
  5696. },
  5697. args: [],
  5698. source: "notNil\x0a\x09^ false",
  5699. referencedClasses: [],
  5700. messageSends: []
  5701. }),
  5702. $globals.UndefinedObject);
  5703. $core.addMethod(
  5704. $core.method({
  5705. selector: "printOn:",
  5706. protocol: 'printing',
  5707. fn: function (aStream){
  5708. var self=this;
  5709. return $core.withContext(function($ctx1) {
  5710. $recv(aStream)._nextPutAll_("nil");
  5711. return self;
  5712. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  5713. },
  5714. args: ["aStream"],
  5715. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  5716. referencedClasses: [],
  5717. messageSends: ["nextPutAll:"]
  5718. }),
  5719. $globals.UndefinedObject);
  5720. $core.addMethod(
  5721. $core.method({
  5722. selector: "shallowCopy",
  5723. protocol: 'copying',
  5724. fn: function (){
  5725. var self=this;
  5726. return self;
  5727. },
  5728. args: [],
  5729. source: "shallowCopy\x0a\x09^ self",
  5730. referencedClasses: [],
  5731. messageSends: []
  5732. }),
  5733. $globals.UndefinedObject);
  5734. $core.addMethod(
  5735. $core.method({
  5736. selector: "subclass:instanceVariableNames:",
  5737. protocol: 'class creation',
  5738. fn: function (aString,anotherString){
  5739. var self=this;
  5740. return $core.withContext(function($ctx1) {
  5741. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5742. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.UndefinedObject)});
  5743. },
  5744. args: ["aString", "anotherString"],
  5745. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  5746. referencedClasses: [],
  5747. messageSends: ["subclass:instanceVariableNames:package:"]
  5748. }),
  5749. $globals.UndefinedObject);
  5750. $core.addMethod(
  5751. $core.method({
  5752. selector: "subclass:instanceVariableNames:category:",
  5753. protocol: 'class creation',
  5754. fn: function (aString,aString2,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:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5759. },
  5760. args: ["aString", "aString2", "aString3"],
  5761. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\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:classVariableNames:poolDictionaries:category:",
  5769. protocol: 'class creation',
  5770. fn: function (aString,aString2,classVars,pools,aString3){
  5771. var self=this;
  5772. return $core.withContext(function($ctx1) {
  5773. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5774. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
  5775. },
  5776. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  5777. 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",
  5778. referencedClasses: [],
  5779. messageSends: ["subclass:instanceVariableNames:package:"]
  5780. }),
  5781. $globals.UndefinedObject);
  5782. $core.addMethod(
  5783. $core.method({
  5784. selector: "subclass:instanceVariableNames:package:",
  5785. protocol: 'class creation',
  5786. fn: function (aString,aString2,aString3){
  5787. var self=this;
  5788. return $core.withContext(function($ctx1) {
  5789. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  5790. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5791. },
  5792. args: ["aString", "aString2", "aString3"],
  5793. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5794. referencedClasses: ["ClassBuilder"],
  5795. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  5796. }),
  5797. $globals.UndefinedObject);
  5798. $core.addMethod(
  5799. $core.method({
  5800. selector: "new",
  5801. protocol: 'instance creation',
  5802. fn: function (){
  5803. var self=this;
  5804. return $core.withContext(function($ctx1) {
  5805. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  5806. return self;
  5807. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.klass)});
  5808. },
  5809. args: [],
  5810. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  5811. referencedClasses: [],
  5812. messageSends: ["error:"]
  5813. }),
  5814. $globals.UndefinedObject.klass);
  5815. });
  5816. define("amber_core/Kernel-Classes", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  5817. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  5818. $core.addPackage('Kernel-Classes');
  5819. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  5820. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5821. $core.addClass('Behavior', $globals.Object, [], 'Kernel-Classes');
  5822. $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.";
  5823. $core.addMethod(
  5824. $core.method({
  5825. selector: ">>",
  5826. protocol: 'accessing',
  5827. fn: function (aString){
  5828. var self=this;
  5829. return $core.withContext(function($ctx1) {
  5830. return self._methodAt_(aString);
  5831. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.Behavior)});
  5832. },
  5833. args: ["aString"],
  5834. source: ">> aString\x0a\x09^ self methodAt: aString",
  5835. referencedClasses: [],
  5836. messageSends: ["methodAt:"]
  5837. }),
  5838. $globals.Behavior);
  5839. $core.addMethod(
  5840. $core.method({
  5841. selector: "addCompiledMethod:",
  5842. protocol: 'compiling',
  5843. fn: function (aMethod){
  5844. var self=this;
  5845. var oldMethod,announcement;
  5846. return $core.withContext(function($ctx1) {
  5847. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$receiver;
  5848. oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  5849. return nil;
  5850. }));
  5851. $2=self._protocols();
  5852. $3=$recv(aMethod)._protocol();
  5853. $ctx1.sendIdx["protocol"]=1;
  5854. $1=$recv($2)._includes_($3);
  5855. if(!$core.assert($1)){
  5856. $4=self._organization();
  5857. $5=$recv(aMethod)._protocol();
  5858. $ctx1.sendIdx["protocol"]=2;
  5859. $recv($4)._addElement_($5);
  5860. };
  5861. self._basicAddCompiledMethod_(aMethod);
  5862. $6=oldMethod;
  5863. if(($receiver = $6) == null || $receiver.isNil){
  5864. $6;
  5865. } else {
  5866. self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  5867. };
  5868. $7=oldMethod;
  5869. if(($receiver = $7) == null || $receiver.isNil){
  5870. $8=$recv($globals.MethodAdded)._new();
  5871. $ctx1.sendIdx["new"]=1;
  5872. $recv($8)._method_(aMethod);
  5873. $ctx1.sendIdx["method:"]=1;
  5874. $9=$recv($8)._yourself();
  5875. $ctx1.sendIdx["yourself"]=1;
  5876. announcement=$9;
  5877. } else {
  5878. $10=$recv($globals.MethodModified)._new();
  5879. $recv($10)._oldMethod_(oldMethod);
  5880. $recv($10)._method_(aMethod);
  5881. announcement=$recv($10)._yourself();
  5882. };
  5883. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  5884. return self;
  5885. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.Behavior)});
  5886. },
  5887. args: ["aMethod"],
  5888. 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",
  5889. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  5890. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  5891. }),
  5892. $globals.Behavior);
  5893. $core.addMethod(
  5894. $core.method({
  5895. selector: "allInstanceVariableNames",
  5896. protocol: 'accessing',
  5897. fn: function (){
  5898. var self=this;
  5899. var result;
  5900. return $core.withContext(function($ctx1) {
  5901. var $1,$receiver;
  5902. result=$recv(self._instanceVariableNames())._copy();
  5903. $1=self._superclass();
  5904. $ctx1.sendIdx["superclass"]=1;
  5905. if(($receiver = $1) == null || $receiver.isNil){
  5906. $1;
  5907. } else {
  5908. $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
  5909. };
  5910. return result;
  5911. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  5912. },
  5913. args: [],
  5914. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  5915. referencedClasses: [],
  5916. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  5917. }),
  5918. $globals.Behavior);
  5919. $core.addMethod(
  5920. $core.method({
  5921. selector: "allSelectors",
  5922. protocol: 'accessing',
  5923. fn: function (){
  5924. var self=this;
  5925. return $core.withContext(function($ctx1) {
  5926. var $1,$2;
  5927. $1=self._allSuperclasses();
  5928. $2=self._selectors();
  5929. $ctx1.sendIdx["selectors"]=1;
  5930. return $recv($1)._inject_into_($2,(function(acc,each){
  5931. return $core.withContext(function($ctx2) {
  5932. $recv(acc)._addAll_($recv(each)._selectors());
  5933. return $recv(acc)._yourself();
  5934. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  5935. }));
  5936. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  5937. },
  5938. args: [],
  5939. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  5940. referencedClasses: [],
  5941. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  5942. }),
  5943. $globals.Behavior);
  5944. $core.addMethod(
  5945. $core.method({
  5946. selector: "allSubclasses",
  5947. protocol: 'accessing',
  5948. fn: function (){
  5949. var self=this;
  5950. return $core.withContext(function($ctx1) {
  5951. return $recv($globals.Array)._streamContents_((function(str){
  5952. return $core.withContext(function($ctx2) {
  5953. return self._allSubclassesDo_((function(each){
  5954. return $core.withContext(function($ctx3) {
  5955. return $recv(str)._nextPut_(each);
  5956. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5957. }));
  5958. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  5959. }));
  5960. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  5961. },
  5962. args: [],
  5963. 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 ] ]",
  5964. referencedClasses: ["Array"],
  5965. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  5966. }),
  5967. $globals.Behavior);
  5968. $core.addMethod(
  5969. $core.method({
  5970. selector: "allSubclassesDo:",
  5971. protocol: 'enumerating',
  5972. fn: function (aBlock){
  5973. var self=this;
  5974. return $core.withContext(function($ctx1) {
  5975. $core.traverseClassTree(self, function(subclass) {
  5976. if (subclass !== self) aBlock._value_(subclass);
  5977. });
  5978. return self;
  5979. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  5980. },
  5981. args: ["aBlock"],
  5982. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a<$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})>",
  5983. referencedClasses: [],
  5984. messageSends: []
  5985. }),
  5986. $globals.Behavior);
  5987. $core.addMethod(
  5988. $core.method({
  5989. selector: "allSuperclasses",
  5990. protocol: 'accessing',
  5991. fn: function (){
  5992. var self=this;
  5993. return $core.withContext(function($ctx1) {
  5994. var $1,$3,$2,$receiver;
  5995. $1=self._superclass();
  5996. $ctx1.sendIdx["superclass"]=1;
  5997. if(($receiver = $1) == null || $receiver.isNil){
  5998. return [];
  5999. } else {
  6000. $1;
  6001. };
  6002. $3=self._superclass();
  6003. $ctx1.sendIdx["superclass"]=2;
  6004. $2=$recv($globals.OrderedCollection)._with_($3);
  6005. $recv($2)._addAll_($recv(self._superclass())._allSuperclasses());
  6006. return $recv($2)._yourself();
  6007. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  6008. },
  6009. args: [],
  6010. 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",
  6011. referencedClasses: ["OrderedCollection"],
  6012. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  6013. }),
  6014. $globals.Behavior);
  6015. $core.addMethod(
  6016. $core.method({
  6017. selector: "basicAddCompiledMethod:",
  6018. protocol: 'private',
  6019. fn: function (aMethod){
  6020. var self=this;
  6021. return $core.withContext(function($ctx1) {
  6022. $core.addMethod(aMethod, self);
  6023. return self;
  6024. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6025. },
  6026. args: ["aMethod"],
  6027. source: "basicAddCompiledMethod: aMethod\x0a\x09<$core.addMethod(aMethod, self)>",
  6028. referencedClasses: [],
  6029. messageSends: []
  6030. }),
  6031. $globals.Behavior);
  6032. $core.addMethod(
  6033. $core.method({
  6034. selector: "basicNew",
  6035. protocol: 'instance creation',
  6036. fn: function (){
  6037. var self=this;
  6038. return $core.withContext(function($ctx1) {
  6039. return new self.fn();
  6040. return self;
  6041. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  6042. },
  6043. args: [],
  6044. source: "basicNew\x0a\x09<return new self.fn()>",
  6045. referencedClasses: [],
  6046. messageSends: []
  6047. }),
  6048. $globals.Behavior);
  6049. $core.addMethod(
  6050. $core.method({
  6051. selector: "basicRemoveCompiledMethod:",
  6052. protocol: 'private',
  6053. fn: function (aMethod){
  6054. var self=this;
  6055. return $core.withContext(function($ctx1) {
  6056. $core.removeMethod(aMethod,self);
  6057. return self;
  6058. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6059. },
  6060. args: ["aMethod"],
  6061. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<$core.removeMethod(aMethod,self)>",
  6062. referencedClasses: [],
  6063. messageSends: []
  6064. }),
  6065. $globals.Behavior);
  6066. $core.addMethod(
  6067. $core.method({
  6068. selector: "canUnderstand:",
  6069. protocol: 'testing',
  6070. fn: function (aSelector){
  6071. var self=this;
  6072. return $core.withContext(function($ctx1) {
  6073. var $2,$1;
  6074. return $recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  6075. return $core.withContext(function($ctx2) {
  6076. $2=self._superclass();
  6077. $ctx2.sendIdx["superclass"]=1;
  6078. $1=$recv($2)._notNil();
  6079. return $recv($1)._and_((function(){
  6080. return $core.withContext(function($ctx3) {
  6081. return $recv(self._superclass())._canUnderstand_(aSelector);
  6082. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6083. }));
  6084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6085. }));
  6086. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  6087. },
  6088. args: ["aSelector"],
  6089. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  6090. referencedClasses: [],
  6091. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  6092. }),
  6093. $globals.Behavior);
  6094. $core.addMethod(
  6095. $core.method({
  6096. selector: "comment",
  6097. protocol: 'accessing',
  6098. fn: function (){
  6099. var self=this;
  6100. return $core.withContext(function($ctx1) {
  6101. var $1,$receiver;
  6102. $1=self._basicAt_("comment");
  6103. if(($receiver = $1) == null || $receiver.isNil){
  6104. return "";
  6105. } else {
  6106. return $1;
  6107. };
  6108. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.Behavior)});
  6109. },
  6110. args: [],
  6111. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  6112. referencedClasses: [],
  6113. messageSends: ["ifNil:", "basicAt:"]
  6114. }),
  6115. $globals.Behavior);
  6116. $core.addMethod(
  6117. $core.method({
  6118. selector: "comment:",
  6119. protocol: 'accessing',
  6120. fn: function (aString){
  6121. var self=this;
  6122. return $core.withContext(function($ctx1) {
  6123. var $1,$3,$2;
  6124. self._basicAt_put_("comment",aString);
  6125. $1=$recv($globals.SystemAnnouncer)._current();
  6126. $3=$recv($globals.ClassCommentChanged)._new();
  6127. $recv($3)._theClass_(self);
  6128. $2=$recv($3)._yourself();
  6129. $recv($1)._announce_($2);
  6130. return self;
  6131. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.Behavior)});
  6132. },
  6133. args: ["aString"],
  6134. 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)",
  6135. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  6136. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  6137. }),
  6138. $globals.Behavior);
  6139. $core.addMethod(
  6140. $core.method({
  6141. selector: "compile:protocol:",
  6142. protocol: 'compiling',
  6143. fn: function (aString,anotherString){
  6144. var self=this;
  6145. return $core.withContext(function($ctx1) {
  6146. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  6147. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.Behavior)});
  6148. },
  6149. args: ["aString", "anotherString"],
  6150. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  6151. referencedClasses: ["Compiler"],
  6152. messageSends: ["install:forClass:protocol:", "new"]
  6153. }),
  6154. $globals.Behavior);
  6155. $core.addMethod(
  6156. $core.method({
  6157. selector: "definition",
  6158. protocol: 'accessing',
  6159. fn: function (){
  6160. var self=this;
  6161. return "";
  6162. },
  6163. args: [],
  6164. source: "definition\x0a\x09^ ''",
  6165. referencedClasses: [],
  6166. messageSends: []
  6167. }),
  6168. $globals.Behavior);
  6169. $core.addMethod(
  6170. $core.method({
  6171. selector: "includesBehavior:",
  6172. protocol: 'testing',
  6173. fn: function (aClass){
  6174. var self=this;
  6175. return $core.withContext(function($ctx1) {
  6176. return $recv(self.__eq_eq(aClass))._or_((function(){
  6177. return $core.withContext(function($ctx2) {
  6178. return self._inheritsFrom_(aClass);
  6179. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6180. }));
  6181. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  6182. },
  6183. args: ["aClass"],
  6184. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  6185. referencedClasses: [],
  6186. messageSends: ["or:", "==", "inheritsFrom:"]
  6187. }),
  6188. $globals.Behavior);
  6189. $core.addMethod(
  6190. $core.method({
  6191. selector: "includesSelector:",
  6192. protocol: 'testing',
  6193. fn: function (aString){
  6194. var self=this;
  6195. return $core.withContext(function($ctx1) {
  6196. return $recv(self._methodDictionary())._includesKey_(aString);
  6197. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.Behavior)});
  6198. },
  6199. args: ["aString"],
  6200. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  6201. referencedClasses: [],
  6202. messageSends: ["includesKey:", "methodDictionary"]
  6203. }),
  6204. $globals.Behavior);
  6205. $core.addMethod(
  6206. $core.method({
  6207. selector: "inheritsFrom:",
  6208. protocol: 'testing',
  6209. fn: function (aClass){
  6210. var self=this;
  6211. return $core.withContext(function($ctx1) {
  6212. var $1,$3,$2,$receiver;
  6213. $1=self._superclass();
  6214. $ctx1.sendIdx["superclass"]=1;
  6215. if(($receiver = $1) == null || $receiver.isNil){
  6216. return false;
  6217. } else {
  6218. $1;
  6219. };
  6220. $3=self._superclass();
  6221. $ctx1.sendIdx["superclass"]=2;
  6222. $2=$recv(aClass).__eq_eq($3);
  6223. return $recv($2)._or_((function(){
  6224. return $core.withContext(function($ctx2) {
  6225. return $recv(self._superclass())._inheritsFrom_(aClass);
  6226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6227. }));
  6228. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  6229. },
  6230. args: ["aClass"],
  6231. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  6232. referencedClasses: [],
  6233. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  6234. }),
  6235. $globals.Behavior);
  6236. $core.addMethod(
  6237. $core.method({
  6238. selector: "instanceVariableNames",
  6239. protocol: 'accessing',
  6240. fn: function (){
  6241. var self=this;
  6242. return $core.withContext(function($ctx1) {
  6243. return self.iVarNames;
  6244. return self;
  6245. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  6246. },
  6247. args: [],
  6248. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  6249. referencedClasses: [],
  6250. messageSends: []
  6251. }),
  6252. $globals.Behavior);
  6253. $core.addMethod(
  6254. $core.method({
  6255. selector: "isBehavior",
  6256. protocol: 'testing',
  6257. fn: function (){
  6258. var self=this;
  6259. return true;
  6260. },
  6261. args: [],
  6262. source: "isBehavior\x0a\x09^ true",
  6263. referencedClasses: [],
  6264. messageSends: []
  6265. }),
  6266. $globals.Behavior);
  6267. $core.addMethod(
  6268. $core.method({
  6269. selector: "javascriptConstructor",
  6270. protocol: 'accessing',
  6271. fn: function (){
  6272. var self=this;
  6273. return $core.withContext(function($ctx1) {
  6274. return self.fn;
  6275. return self;
  6276. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  6277. },
  6278. args: [],
  6279. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
  6280. referencedClasses: [],
  6281. messageSends: []
  6282. }),
  6283. $globals.Behavior);
  6284. $core.addMethod(
  6285. $core.method({
  6286. selector: "javascriptConstructor:",
  6287. protocol: 'accessing',
  6288. fn: function (aJavaScriptFunction){
  6289. var self=this;
  6290. return $core.withContext(function($ctx1) {
  6291. $core.setClassConstructor(self, aJavaScriptFunction);;
  6292. return self;
  6293. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  6294. },
  6295. args: ["aJavaScriptFunction"],
  6296. 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<$core.setClassConstructor(self, aJavaScriptFunction);>",
  6297. referencedClasses: [],
  6298. messageSends: []
  6299. }),
  6300. $globals.Behavior);
  6301. $core.addMethod(
  6302. $core.method({
  6303. selector: "lookupSelector:",
  6304. protocol: 'accessing',
  6305. fn: function (selector){
  6306. var self=this;
  6307. var lookupClass;
  6308. return $core.withContext(function($ctx1) {
  6309. var $1;
  6310. var $early={};
  6311. try {
  6312. lookupClass=self;
  6313. $recv((function(){
  6314. return $core.withContext(function($ctx2) {
  6315. return $recv(lookupClass).__eq(nil);
  6316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6317. }))._whileFalse_((function(){
  6318. return $core.withContext(function($ctx2) {
  6319. $1=$recv(lookupClass)._includesSelector_(selector);
  6320. if($core.assert($1)){
  6321. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  6322. };
  6323. lookupClass=$recv(lookupClass)._superclass();
  6324. return lookupClass;
  6325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6326. }));
  6327. return nil;
  6328. }
  6329. catch(e) {if(e===$early)return e[0]; throw e}
  6330. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  6331. },
  6332. args: ["selector"],
  6333. 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",
  6334. referencedClasses: [],
  6335. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  6336. }),
  6337. $globals.Behavior);
  6338. $core.addMethod(
  6339. $core.method({
  6340. selector: "methodAt:",
  6341. protocol: 'accessing',
  6342. fn: function (aString){
  6343. var self=this;
  6344. return $core.withContext(function($ctx1) {
  6345. return $recv(self._methodDictionary())._at_(aString);
  6346. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.Behavior)});
  6347. },
  6348. args: ["aString"],
  6349. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  6350. referencedClasses: [],
  6351. messageSends: ["at:", "methodDictionary"]
  6352. }),
  6353. $globals.Behavior);
  6354. $core.addMethod(
  6355. $core.method({
  6356. selector: "methodDictionary",
  6357. protocol: 'accessing',
  6358. fn: function (){
  6359. var self=this;
  6360. return $core.withContext(function($ctx1) {
  6361. var dict = $globals.HashedCollection._new();
  6362. var methods = self.methods;
  6363. Object.keys(methods).forEach(function(i) {
  6364. if(methods[i].selector) {
  6365. dict._at_put_(methods[i].selector, methods[i]);
  6366. }
  6367. });
  6368. return dict;
  6369. return self;
  6370. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.Behavior)});
  6371. },
  6372. args: [],
  6373. source: "methodDictionary\x0a\x09<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>",
  6374. referencedClasses: [],
  6375. messageSends: []
  6376. }),
  6377. $globals.Behavior);
  6378. $core.addMethod(
  6379. $core.method({
  6380. selector: "methodTemplate",
  6381. protocol: 'accessing',
  6382. fn: function (){
  6383. var self=this;
  6384. return $core.withContext(function($ctx1) {
  6385. var $2,$3,$1,$6,$7,$5,$8,$4;
  6386. return $recv($globals.String)._streamContents_((function(stream){
  6387. return $core.withContext(function($ctx2) {
  6388. $recv(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  6389. $ctx2.sendIdx["nextPutAll:"]=1;
  6390. $2=$recv($globals.String)._lf();
  6391. $ctx2.sendIdx["lf"]=1;
  6392. $3=$recv($globals.String)._tab();
  6393. $ctx2.sendIdx["tab"]=1;
  6394. $1=$recv($2).__comma($3);
  6395. $ctx2.sendIdx[","]=1;
  6396. $recv(stream)._nextPutAll_($1);
  6397. $ctx2.sendIdx["nextPutAll:"]=2;
  6398. $recv(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  6399. $ctx2.sendIdx["nextPutAll:"]=3;
  6400. $6=$recv($globals.String)._lf();
  6401. $ctx2.sendIdx["lf"]=2;
  6402. $7=$recv($globals.String)._lf();
  6403. $ctx2.sendIdx["lf"]=3;
  6404. $5=$recv($6).__comma($7);
  6405. $ctx2.sendIdx[","]=3;
  6406. $8=$recv($globals.String)._tab();
  6407. $ctx2.sendIdx["tab"]=2;
  6408. $4=$recv($5).__comma($8);
  6409. $ctx2.sendIdx[","]=2;
  6410. $recv(stream)._nextPutAll_($4);
  6411. $ctx2.sendIdx["nextPutAll:"]=4;
  6412. $recv(stream)._nextPutAll_("| temporary variable names |");
  6413. $ctx2.sendIdx["nextPutAll:"]=5;
  6414. $recv(stream)._nextPutAll_($recv($recv($globals.String)._lf()).__comma($recv($globals.String)._tab()));
  6415. $ctx2.sendIdx["nextPutAll:"]=6;
  6416. return $recv(stream)._nextPutAll_("statements");
  6417. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6418. }));
  6419. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.Behavior)});
  6420. },
  6421. args: [],
  6422. 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' ]",
  6423. referencedClasses: ["String"],
  6424. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
  6425. }),
  6426. $globals.Behavior);
  6427. $core.addMethod(
  6428. $core.method({
  6429. selector: "methods",
  6430. protocol: 'accessing',
  6431. fn: function (){
  6432. var self=this;
  6433. return $core.withContext(function($ctx1) {
  6434. return $recv(self._methodDictionary())._values();
  6435. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.Behavior)});
  6436. },
  6437. args: [],
  6438. source: "methods\x0a\x09^ self methodDictionary values",
  6439. referencedClasses: [],
  6440. messageSends: ["values", "methodDictionary"]
  6441. }),
  6442. $globals.Behavior);
  6443. $core.addMethod(
  6444. $core.method({
  6445. selector: "methodsInProtocol:",
  6446. protocol: 'accessing',
  6447. fn: function (aString){
  6448. var self=this;
  6449. return $core.withContext(function($ctx1) {
  6450. return $recv(self._methods())._select_((function(each){
  6451. return $core.withContext(function($ctx2) {
  6452. return $recv($recv(each)._protocol()).__eq(aString);
  6453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6454. }));
  6455. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.Behavior)});
  6456. },
  6457. args: ["aString"],
  6458. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  6459. referencedClasses: [],
  6460. messageSends: ["select:", "methods", "=", "protocol"]
  6461. }),
  6462. $globals.Behavior);
  6463. $core.addMethod(
  6464. $core.method({
  6465. selector: "name",
  6466. protocol: 'accessing',
  6467. fn: function (){
  6468. var self=this;
  6469. return $core.withContext(function($ctx1) {
  6470. return self.className || nil;
  6471. return self;
  6472. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Behavior)});
  6473. },
  6474. args: [],
  6475. source: "name\x0a\x09<return self.className || nil>",
  6476. referencedClasses: [],
  6477. messageSends: []
  6478. }),
  6479. $globals.Behavior);
  6480. $core.addMethod(
  6481. $core.method({
  6482. selector: "new",
  6483. protocol: 'instance creation',
  6484. fn: function (){
  6485. var self=this;
  6486. return $core.withContext(function($ctx1) {
  6487. return $recv(self._basicNew())._initialize();
  6488. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  6489. },
  6490. args: [],
  6491. source: "new\x0a\x09^ self basicNew initialize",
  6492. referencedClasses: [],
  6493. messageSends: ["initialize", "basicNew"]
  6494. }),
  6495. $globals.Behavior);
  6496. $core.addMethod(
  6497. $core.method({
  6498. selector: "organization",
  6499. protocol: 'accessing',
  6500. fn: function (){
  6501. var self=this;
  6502. return $core.withContext(function($ctx1) {
  6503. return self._basicAt_("organization");
  6504. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Behavior)});
  6505. },
  6506. args: [],
  6507. source: "organization\x0a\x09^ self basicAt: 'organization'",
  6508. referencedClasses: [],
  6509. messageSends: ["basicAt:"]
  6510. }),
  6511. $globals.Behavior);
  6512. $core.addMethod(
  6513. $core.method({
  6514. selector: "ownMethods",
  6515. protocol: 'accessing',
  6516. fn: function (){
  6517. var self=this;
  6518. return $core.withContext(function($ctx1) {
  6519. var $1;
  6520. return $recv($recv(self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  6521. return $core.withContext(function($ctx2) {
  6522. return $recv(acc).__comma(self._methodsInProtocol_(each));
  6523. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  6524. })))._sorted_((function(a,b){
  6525. return $core.withContext(function($ctx2) {
  6526. $1=$recv(a)._selector();
  6527. $ctx2.sendIdx["selector"]=1;
  6528. return $recv($1).__lt_eq($recv(b)._selector());
  6529. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  6530. }));
  6531. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.Behavior)});
  6532. },
  6533. args: [],
  6534. 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 ]",
  6535. referencedClasses: ["OrderedCollection"],
  6536. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
  6537. }),
  6538. $globals.Behavior);
  6539. $core.addMethod(
  6540. $core.method({
  6541. selector: "ownProtocols",
  6542. protocol: 'accessing',
  6543. fn: function (){
  6544. var self=this;
  6545. return $core.withContext(function($ctx1) {
  6546. return $recv(self._protocols())._reject_((function(each){
  6547. return $core.withContext(function($ctx2) {
  6548. return $recv(each)._match_("^\x5c*");
  6549. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6550. }));
  6551. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.Behavior)});
  6552. },
  6553. args: [],
  6554. 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*' ]",
  6555. referencedClasses: [],
  6556. messageSends: ["reject:", "protocols", "match:"]
  6557. }),
  6558. $globals.Behavior);
  6559. $core.addMethod(
  6560. $core.method({
  6561. selector: "packageOfProtocol:",
  6562. protocol: 'accessing',
  6563. fn: function (aString){
  6564. var self=this;
  6565. return $core.withContext(function($ctx1) {
  6566. var $1;
  6567. $1=$recv(aString)._beginsWith_("*");
  6568. if(!$core.assert($1)){
  6569. return self._package();
  6570. };
  6571. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  6572. return nil;
  6573. }));
  6574. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.Behavior)});
  6575. },
  6576. args: ["aString"],
  6577. 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 ]",
  6578. referencedClasses: ["Package"],
  6579. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  6580. }),
  6581. $globals.Behavior);
  6582. $core.addMethod(
  6583. $core.method({
  6584. selector: "protocols",
  6585. protocol: 'accessing',
  6586. fn: function (){
  6587. var self=this;
  6588. return $core.withContext(function($ctx1) {
  6589. return $recv($recv(self._organization())._elements())._sorted();
  6590. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.Behavior)});
  6591. },
  6592. args: [],
  6593. source: "protocols\x0a\x09^ self organization elements sorted",
  6594. referencedClasses: [],
  6595. messageSends: ["sorted", "elements", "organization"]
  6596. }),
  6597. $globals.Behavior);
  6598. $core.addMethod(
  6599. $core.method({
  6600. selector: "protocolsDo:",
  6601. protocol: 'enumerating',
  6602. fn: function (aBlock){
  6603. var self=this;
  6604. var methodsByProtocol;
  6605. return $core.withContext(function($ctx1) {
  6606. methodsByProtocol=$recv($globals.HashedCollection)._new();
  6607. $ctx1.sendIdx["new"]=1;
  6608. $recv(self._methodDictionary())._valuesDo_((function(m){
  6609. return $core.withContext(function($ctx2) {
  6610. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  6611. return $core.withContext(function($ctx3) {
  6612. return $recv($globals.Array)._new();
  6613. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6614. })))._add_(m);
  6615. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  6616. }));
  6617. $recv(self._protocols())._do_((function(protocol){
  6618. return $core.withContext(function($ctx2) {
  6619. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  6620. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  6621. }));
  6622. return self;
  6623. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.Behavior)});
  6624. },
  6625. args: ["aBlock"],
  6626. 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) ]",
  6627. referencedClasses: ["HashedCollection", "Array"],
  6628. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  6629. }),
  6630. $globals.Behavior);
  6631. $core.addMethod(
  6632. $core.method({
  6633. selector: "prototype",
  6634. protocol: 'accessing',
  6635. fn: function (){
  6636. var self=this;
  6637. return $core.withContext(function($ctx1) {
  6638. return self.fn.prototype;
  6639. return self;
  6640. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  6641. },
  6642. args: [],
  6643. source: "prototype\x0a\x09<return self.fn.prototype>",
  6644. referencedClasses: [],
  6645. messageSends: []
  6646. }),
  6647. $globals.Behavior);
  6648. $core.addMethod(
  6649. $core.method({
  6650. selector: "recompile",
  6651. protocol: 'compiling',
  6652. fn: function (){
  6653. var self=this;
  6654. return $core.withContext(function($ctx1) {
  6655. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  6656. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.Behavior)});
  6657. },
  6658. args: [],
  6659. source: "recompile\x0a\x09^ Compiler new recompile: self",
  6660. referencedClasses: ["Compiler"],
  6661. messageSends: ["recompile:", "new"]
  6662. }),
  6663. $globals.Behavior);
  6664. $core.addMethod(
  6665. $core.method({
  6666. selector: "removeCompiledMethod:",
  6667. protocol: 'compiling',
  6668. fn: function (aMethod){
  6669. var self=this;
  6670. return $core.withContext(function($ctx1) {
  6671. var $1,$3,$2;
  6672. self._basicRemoveCompiledMethod_(aMethod);
  6673. self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  6674. $1=$recv($globals.SystemAnnouncer)._current();
  6675. $3=$recv($globals.MethodRemoved)._new();
  6676. $recv($3)._method_(aMethod);
  6677. $2=$recv($3)._yourself();
  6678. $recv($1)._announce_($2);
  6679. return self;
  6680. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6681. },
  6682. args: ["aMethod"],
  6683. 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)",
  6684. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  6685. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  6686. }),
  6687. $globals.Behavior);
  6688. $core.addMethod(
  6689. $core.method({
  6690. selector: "removeProtocolIfEmpty:",
  6691. protocol: 'accessing',
  6692. fn: function (aString){
  6693. var self=this;
  6694. return $core.withContext(function($ctx1) {
  6695. $recv(self._methods())._detect_ifNone_((function(each){
  6696. return $core.withContext(function($ctx2) {
  6697. return $recv($recv(each)._protocol()).__eq(aString);
  6698. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6699. }),(function(){
  6700. return $core.withContext(function($ctx2) {
  6701. return $recv(self._organization())._removeElement_(aString);
  6702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6703. }));
  6704. return self;
  6705. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.Behavior)});
  6706. },
  6707. args: ["aString"],
  6708. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  6709. referencedClasses: [],
  6710. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  6711. }),
  6712. $globals.Behavior);
  6713. $core.addMethod(
  6714. $core.method({
  6715. selector: "selectors",
  6716. protocol: 'accessing',
  6717. fn: function (){
  6718. var self=this;
  6719. return $core.withContext(function($ctx1) {
  6720. return $recv(self._methodDictionary())._keys();
  6721. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.Behavior)});
  6722. },
  6723. args: [],
  6724. source: "selectors\x0a\x09^ self methodDictionary keys",
  6725. referencedClasses: [],
  6726. messageSends: ["keys", "methodDictionary"]
  6727. }),
  6728. $globals.Behavior);
  6729. $core.addMethod(
  6730. $core.method({
  6731. selector: "subclasses",
  6732. protocol: 'accessing',
  6733. fn: function (){
  6734. var self=this;
  6735. return $core.withContext(function($ctx1) {
  6736. self._subclassResponsibility();
  6737. return self;
  6738. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  6739. },
  6740. args: [],
  6741. source: "subclasses\x0a\x09self subclassResponsibility",
  6742. referencedClasses: [],
  6743. messageSends: ["subclassResponsibility"]
  6744. }),
  6745. $globals.Behavior);
  6746. $core.addMethod(
  6747. $core.method({
  6748. selector: "superclass",
  6749. protocol: 'accessing',
  6750. fn: function (){
  6751. var self=this;
  6752. return $core.withContext(function($ctx1) {
  6753. return self.superclass;
  6754. return self;
  6755. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  6756. },
  6757. args: [],
  6758. source: "superclass\x0a\x09<return self.superclass>",
  6759. referencedClasses: [],
  6760. messageSends: []
  6761. }),
  6762. $globals.Behavior);
  6763. $core.addMethod(
  6764. $core.method({
  6765. selector: "theMetaClass",
  6766. protocol: 'accessing',
  6767. fn: function (){
  6768. var self=this;
  6769. return $core.withContext(function($ctx1) {
  6770. self._subclassResponsibility();
  6771. return self;
  6772. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  6773. },
  6774. args: [],
  6775. source: "theMetaClass\x0a\x09self subclassResponsibility",
  6776. referencedClasses: [],
  6777. messageSends: ["subclassResponsibility"]
  6778. }),
  6779. $globals.Behavior);
  6780. $core.addMethod(
  6781. $core.method({
  6782. selector: "theNonMetaClass",
  6783. protocol: 'accessing',
  6784. fn: function (){
  6785. var self=this;
  6786. return $core.withContext(function($ctx1) {
  6787. self._subclassResponsibility();
  6788. return self;
  6789. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  6790. },
  6791. args: [],
  6792. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  6793. referencedClasses: [],
  6794. messageSends: ["subclassResponsibility"]
  6795. }),
  6796. $globals.Behavior);
  6797. $core.addMethod(
  6798. $core.method({
  6799. selector: "withAllSubclasses",
  6800. protocol: 'accessing',
  6801. fn: function (){
  6802. var self=this;
  6803. return $core.withContext(function($ctx1) {
  6804. var $1;
  6805. $1=$recv($globals.Array)._with_(self);
  6806. $recv($1)._addAll_(self._allSubclasses());
  6807. return $recv($1)._yourself();
  6808. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  6809. },
  6810. args: [],
  6811. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  6812. referencedClasses: ["Array"],
  6813. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  6814. }),
  6815. $globals.Behavior);
  6816. $core.addClass('Class', $globals.Behavior, [], 'Kernel-Classes');
  6817. $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.";
  6818. $core.addMethod(
  6819. $core.method({
  6820. selector: "asJavascript",
  6821. protocol: 'converting',
  6822. fn: function (){
  6823. var self=this;
  6824. return $core.withContext(function($ctx1) {
  6825. return "$globals.".__comma(self._name());
  6826. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Class)});
  6827. },
  6828. args: [],
  6829. source: "asJavascript\x0a\x09^ '$globals.', self name",
  6830. referencedClasses: [],
  6831. messageSends: [",", "name"]
  6832. }),
  6833. $globals.Class);
  6834. $core.addMethod(
  6835. $core.method({
  6836. selector: "browse",
  6837. protocol: 'browsing',
  6838. fn: function (){
  6839. var self=this;
  6840. return $core.withContext(function($ctx1) {
  6841. $recv($globals.Finder)._findClass_(self);
  6842. return self;
  6843. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)});
  6844. },
  6845. args: [],
  6846. source: "browse\x0a\x09Finder findClass: self",
  6847. referencedClasses: ["Finder"],
  6848. messageSends: ["findClass:"]
  6849. }),
  6850. $globals.Class);
  6851. $core.addMethod(
  6852. $core.method({
  6853. selector: "category",
  6854. protocol: 'accessing',
  6855. fn: function (){
  6856. var self=this;
  6857. return $core.withContext(function($ctx1) {
  6858. var $1,$receiver;
  6859. $1=self._package();
  6860. $ctx1.sendIdx["package"]=1;
  6861. if(($receiver = $1) == null || $receiver.isNil){
  6862. return "Unclassified";
  6863. } else {
  6864. return $recv(self._package())._name();
  6865. };
  6866. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)});
  6867. },
  6868. args: [],
  6869. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  6870. referencedClasses: [],
  6871. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  6872. }),
  6873. $globals.Class);
  6874. $core.addMethod(
  6875. $core.method({
  6876. selector: "classTag",
  6877. protocol: 'accessing',
  6878. fn: function (){
  6879. var self=this;
  6880. return "class";
  6881. },
  6882. args: [],
  6883. 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'",
  6884. referencedClasses: [],
  6885. messageSends: []
  6886. }),
  6887. $globals.Class);
  6888. $core.addMethod(
  6889. $core.method({
  6890. selector: "definition",
  6891. protocol: 'accessing',
  6892. fn: function (){
  6893. var self=this;
  6894. return $core.withContext(function($ctx1) {
  6895. var $2,$3,$1,$4,$5;
  6896. return $recv($globals.String)._streamContents_((function(stream){
  6897. return $core.withContext(function($ctx2) {
  6898. $recv(stream)._nextPutAll_($recv(self._superclass())._asString());
  6899. $ctx2.sendIdx["nextPutAll:"]=1;
  6900. $recv(stream)._nextPutAll_(" subclass: #");
  6901. $ctx2.sendIdx["nextPutAll:"]=2;
  6902. $recv(stream)._nextPutAll_(self._name());
  6903. $ctx2.sendIdx["nextPutAll:"]=3;
  6904. $2=$recv($globals.String)._lf();
  6905. $ctx2.sendIdx["lf"]=1;
  6906. $3=$recv($globals.String)._tab();
  6907. $ctx2.sendIdx["tab"]=1;
  6908. $1=$recv($2).__comma($3);
  6909. $ctx2.sendIdx[","]=1;
  6910. $recv(stream)._nextPutAll_($1);
  6911. $ctx2.sendIdx["nextPutAll:"]=4;
  6912. $4=$recv(stream)._nextPutAll_("instanceVariableNames: '");
  6913. $ctx2.sendIdx["nextPutAll:"]=5;
  6914. $4;
  6915. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6916. return $core.withContext(function($ctx3) {
  6917. return $recv(stream)._nextPutAll_(each);
  6918. $ctx3.sendIdx["nextPutAll:"]=6;
  6919. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6920. }),(function(){
  6921. return $core.withContext(function($ctx3) {
  6922. return $recv(stream)._nextPutAll_(" ");
  6923. $ctx3.sendIdx["nextPutAll:"]=7;
  6924. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6925. }));
  6926. $5=$recv("'".__comma($recv($globals.String)._lf())).__comma($recv($globals.String)._tab());
  6927. $ctx2.sendIdx[","]=2;
  6928. $recv(stream)._nextPutAll_($5);
  6929. $ctx2.sendIdx["nextPutAll:"]=8;
  6930. $recv(stream)._nextPutAll_("package: '");
  6931. $ctx2.sendIdx["nextPutAll:"]=9;
  6932. $recv(stream)._nextPutAll_(self._category());
  6933. $ctx2.sendIdx["nextPutAll:"]=10;
  6934. return $recv(stream)._nextPutAll_("'");
  6935. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6936. }));
  6937. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  6938. },
  6939. args: [],
  6940. 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: '''' ]",
  6941. referencedClasses: ["String"],
  6942. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"]
  6943. }),
  6944. $globals.Class);
  6945. $core.addMethod(
  6946. $core.method({
  6947. selector: "isClass",
  6948. protocol: 'testing',
  6949. fn: function (){
  6950. var self=this;
  6951. return true;
  6952. },
  6953. args: [],
  6954. source: "isClass\x0a\x09^ true",
  6955. referencedClasses: [],
  6956. messageSends: []
  6957. }),
  6958. $globals.Class);
  6959. $core.addMethod(
  6960. $core.method({
  6961. selector: "package",
  6962. protocol: 'accessing',
  6963. fn: function (){
  6964. var self=this;
  6965. return $core.withContext(function($ctx1) {
  6966. return self._basicAt_("pkg");
  6967. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)});
  6968. },
  6969. args: [],
  6970. source: "package\x0a\x09^ self basicAt: 'pkg'",
  6971. referencedClasses: [],
  6972. messageSends: ["basicAt:"]
  6973. }),
  6974. $globals.Class);
  6975. $core.addMethod(
  6976. $core.method({
  6977. selector: "package:",
  6978. protocol: 'accessing',
  6979. fn: function (aPackage){
  6980. var self=this;
  6981. var oldPackage;
  6982. return $core.withContext(function($ctx1) {
  6983. var $2,$1,$3,$4,$6,$5;
  6984. $2=self._package();
  6985. $ctx1.sendIdx["package"]=1;
  6986. $1=$recv($2).__eq(aPackage);
  6987. if($core.assert($1)){
  6988. return self;
  6989. };
  6990. oldPackage=self._package();
  6991. self._basicAt_put_("pkg",aPackage);
  6992. $3=$recv(oldPackage)._organization();
  6993. $ctx1.sendIdx["organization"]=1;
  6994. $recv($3)._removeElement_(self);
  6995. $recv($recv(aPackage)._organization())._addElement_(self);
  6996. $4=$recv($globals.SystemAnnouncer)._current();
  6997. $6=$recv($globals.ClassMoved)._new();
  6998. $recv($6)._theClass_(self);
  6999. $recv($6)._oldPackage_(oldPackage);
  7000. $5=$recv($6)._yourself();
  7001. $recv($4)._announce_($5);
  7002. return self;
  7003. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)});
  7004. },
  7005. args: ["aPackage"],
  7006. 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)",
  7007. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  7008. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  7009. }),
  7010. $globals.Class);
  7011. $core.addMethod(
  7012. $core.method({
  7013. selector: "printOn:",
  7014. protocol: 'printing',
  7015. fn: function (aStream){
  7016. var self=this;
  7017. return $core.withContext(function($ctx1) {
  7018. $recv(aStream)._nextPutAll_(self._name());
  7019. return self;
  7020. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Class)});
  7021. },
  7022. args: ["aStream"],
  7023. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  7024. referencedClasses: [],
  7025. messageSends: ["nextPutAll:", "name"]
  7026. }),
  7027. $globals.Class);
  7028. $core.addMethod(
  7029. $core.method({
  7030. selector: "rename:",
  7031. protocol: 'accessing',
  7032. fn: function (aString){
  7033. var self=this;
  7034. return $core.withContext(function($ctx1) {
  7035. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  7036. return self;
  7037. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  7038. },
  7039. args: ["aString"],
  7040. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  7041. referencedClasses: ["ClassBuilder"],
  7042. messageSends: ["renameClass:to:", "new"]
  7043. }),
  7044. $globals.Class);
  7045. $core.addMethod(
  7046. $core.method({
  7047. selector: "subclass:instanceVariableNames:",
  7048. protocol: 'class creation',
  7049. fn: function (aString,anotherString){
  7050. var self=this;
  7051. return $core.withContext(function($ctx1) {
  7052. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  7053. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)});
  7054. },
  7055. args: ["aString", "anotherString"],
  7056. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  7057. referencedClasses: [],
  7058. messageSends: ["subclass:instanceVariableNames:package:"]
  7059. }),
  7060. $globals.Class);
  7061. $core.addMethod(
  7062. $core.method({
  7063. selector: "subclass:instanceVariableNames:category:",
  7064. protocol: 'class creation',
  7065. fn: function (aString,aString2,aString3){
  7066. var self=this;
  7067. return $core.withContext(function($ctx1) {
  7068. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  7069. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  7070. },
  7071. args: ["aString", "aString2", "aString3"],
  7072. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  7073. referencedClasses: [],
  7074. messageSends: ["subclass:instanceVariableNames:package:"]
  7075. }),
  7076. $globals.Class);
  7077. $core.addMethod(
  7078. $core.method({
  7079. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  7080. protocol: 'class creation',
  7081. fn: function (aString,aString2,classVars,pools,aString3){
  7082. var self=this;
  7083. return $core.withContext(function($ctx1) {
  7084. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  7085. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  7086. },
  7087. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  7088. 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",
  7089. referencedClasses: [],
  7090. messageSends: ["subclass:instanceVariableNames:package:"]
  7091. }),
  7092. $globals.Class);
  7093. $core.addMethod(
  7094. $core.method({
  7095. selector: "subclass:instanceVariableNames:package:",
  7096. protocol: 'class creation',
  7097. fn: function (aString,aString2,aString3){
  7098. var self=this;
  7099. return $core.withContext(function($ctx1) {
  7100. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  7101. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  7102. },
  7103. args: ["aString", "aString2", "aString3"],
  7104. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  7105. referencedClasses: ["ClassBuilder"],
  7106. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  7107. }),
  7108. $globals.Class);
  7109. $core.addMethod(
  7110. $core.method({
  7111. selector: "subclasses",
  7112. protocol: 'accessing',
  7113. fn: function (){
  7114. var self=this;
  7115. return $core.withContext(function($ctx1) {
  7116. return self.subclasses._copy();
  7117. return self;
  7118. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  7119. },
  7120. args: [],
  7121. source: "subclasses\x0a\x09<return self.subclasses._copy()>",
  7122. referencedClasses: [],
  7123. messageSends: []
  7124. }),
  7125. $globals.Class);
  7126. $core.addMethod(
  7127. $core.method({
  7128. selector: "theMetaClass",
  7129. protocol: 'accessing',
  7130. fn: function (){
  7131. var self=this;
  7132. return $core.withContext(function($ctx1) {
  7133. return self._class();
  7134. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  7135. },
  7136. args: [],
  7137. source: "theMetaClass\x0a\x09^ self class",
  7138. referencedClasses: [],
  7139. messageSends: ["class"]
  7140. }),
  7141. $globals.Class);
  7142. $core.addMethod(
  7143. $core.method({
  7144. selector: "theNonMetaClass",
  7145. protocol: 'accessing',
  7146. fn: function (){
  7147. var self=this;
  7148. return self;
  7149. },
  7150. args: [],
  7151. source: "theNonMetaClass\x0a\x09^ self",
  7152. referencedClasses: [],
  7153. messageSends: []
  7154. }),
  7155. $globals.Class);
  7156. $core.addClass('Metaclass', $globals.Behavior, [], 'Kernel-Classes');
  7157. $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.";
  7158. $core.addMethod(
  7159. $core.method({
  7160. selector: "asJavascript",
  7161. protocol: 'converting',
  7162. fn: function (){
  7163. var self=this;
  7164. return $core.withContext(function($ctx1) {
  7165. var $1;
  7166. $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass");
  7167. $ctx1.sendIdx[","]=1;
  7168. return $1;
  7169. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Metaclass)});
  7170. },
  7171. args: [],
  7172. source: "asJavascript\x0a\x09^ '$globals.', self instanceClass name, '.klass'",
  7173. referencedClasses: [],
  7174. messageSends: [",", "name", "instanceClass"]
  7175. }),
  7176. $globals.Metaclass);
  7177. $core.addMethod(
  7178. $core.method({
  7179. selector: "definition",
  7180. protocol: 'accessing',
  7181. fn: function (){
  7182. var self=this;
  7183. return $core.withContext(function($ctx1) {
  7184. var $1;
  7185. return $recv($globals.String)._streamContents_((function(stream){
  7186. return $core.withContext(function($ctx2) {
  7187. $recv(stream)._nextPutAll_(self._asString());
  7188. $ctx2.sendIdx["nextPutAll:"]=1;
  7189. $1=$recv(stream)._nextPutAll_(" instanceVariableNames: '");
  7190. $ctx2.sendIdx["nextPutAll:"]=2;
  7191. $1;
  7192. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  7193. return $core.withContext(function($ctx3) {
  7194. return $recv(stream)._nextPutAll_(each);
  7195. $ctx3.sendIdx["nextPutAll:"]=3;
  7196. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  7197. }),(function(){
  7198. return $core.withContext(function($ctx3) {
  7199. return $recv(stream)._nextPutAll_(" ");
  7200. $ctx3.sendIdx["nextPutAll:"]=4;
  7201. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  7202. }));
  7203. return $recv(stream)._nextPutAll_("'");
  7204. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  7205. }));
  7206. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  7207. },
  7208. args: [],
  7209. 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: '''' ]",
  7210. referencedClasses: ["String"],
  7211. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"]
  7212. }),
  7213. $globals.Metaclass);
  7214. $core.addMethod(
  7215. $core.method({
  7216. selector: "instanceClass",
  7217. protocol: 'accessing',
  7218. fn: function (){
  7219. var self=this;
  7220. return $core.withContext(function($ctx1) {
  7221. return self.instanceClass;
  7222. return self;
  7223. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  7224. },
  7225. args: [],
  7226. source: "instanceClass\x0a\x09<return self.instanceClass>",
  7227. referencedClasses: [],
  7228. messageSends: []
  7229. }),
  7230. $globals.Metaclass);
  7231. $core.addMethod(
  7232. $core.method({
  7233. selector: "instanceVariableNames:",
  7234. protocol: 'accessing',
  7235. fn: function (aCollection){
  7236. var self=this;
  7237. return $core.withContext(function($ctx1) {
  7238. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  7239. return self;
  7240. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  7241. },
  7242. args: ["aCollection"],
  7243. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  7244. referencedClasses: ["ClassBuilder"],
  7245. messageSends: ["class:instanceVariableNames:", "new"]
  7246. }),
  7247. $globals.Metaclass);
  7248. $core.addMethod(
  7249. $core.method({
  7250. selector: "isMetaclass",
  7251. protocol: 'testing',
  7252. fn: function (){
  7253. var self=this;
  7254. return true;
  7255. },
  7256. args: [],
  7257. source: "isMetaclass\x0a\x09^ true",
  7258. referencedClasses: [],
  7259. messageSends: []
  7260. }),
  7261. $globals.Metaclass);
  7262. $core.addMethod(
  7263. $core.method({
  7264. selector: "package",
  7265. protocol: 'accessing',
  7266. fn: function (){
  7267. var self=this;
  7268. return $core.withContext(function($ctx1) {
  7269. return $recv(self._instanceClass())._package();
  7270. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  7271. },
  7272. args: [],
  7273. source: "package\x0a\x09^ self instanceClass package",
  7274. referencedClasses: [],
  7275. messageSends: ["package", "instanceClass"]
  7276. }),
  7277. $globals.Metaclass);
  7278. $core.addMethod(
  7279. $core.method({
  7280. selector: "printOn:",
  7281. protocol: 'printing',
  7282. fn: function (aStream){
  7283. var self=this;
  7284. return $core.withContext(function($ctx1) {
  7285. $recv(aStream)._nextPutAll_($recv(self._instanceClass())._name());
  7286. $ctx1.sendIdx["nextPutAll:"]=1;
  7287. $recv(aStream)._nextPutAll_(" class");
  7288. return self;
  7289. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Metaclass)});
  7290. },
  7291. args: ["aStream"],
  7292. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  7293. referencedClasses: [],
  7294. messageSends: ["nextPutAll:", "name", "instanceClass"]
  7295. }),
  7296. $globals.Metaclass);
  7297. $core.addMethod(
  7298. $core.method({
  7299. selector: "subclasses",
  7300. protocol: 'accessing',
  7301. fn: function (){
  7302. var self=this;
  7303. return $core.withContext(function($ctx1) {
  7304. return $core.metaSubclasses(self);
  7305. return self;
  7306. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  7307. },
  7308. args: [],
  7309. source: "subclasses\x0a\x09<return $core.metaSubclasses(self)>",
  7310. referencedClasses: [],
  7311. messageSends: []
  7312. }),
  7313. $globals.Metaclass);
  7314. $core.addMethod(
  7315. $core.method({
  7316. selector: "theMetaClass",
  7317. protocol: 'accessing',
  7318. fn: function (){
  7319. var self=this;
  7320. return self;
  7321. },
  7322. args: [],
  7323. source: "theMetaClass\x0a\x09^ self",
  7324. referencedClasses: [],
  7325. messageSends: []
  7326. }),
  7327. $globals.Metaclass);
  7328. $core.addMethod(
  7329. $core.method({
  7330. selector: "theNonMetaClass",
  7331. protocol: 'accessing',
  7332. fn: function (){
  7333. var self=this;
  7334. return $core.withContext(function($ctx1) {
  7335. return self._instanceClass();
  7336. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  7337. },
  7338. args: [],
  7339. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  7340. referencedClasses: [],
  7341. messageSends: ["instanceClass"]
  7342. }),
  7343. $globals.Metaclass);
  7344. $core.addClass('ClassBuilder', $globals.Object, [], 'Kernel-Classes');
  7345. $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:`.";
  7346. $core.addMethod(
  7347. $core.method({
  7348. selector: "addSubclassOf:named:instanceVariableNames:package:",
  7349. protocol: 'class definition',
  7350. fn: function (aClass,className,aCollection,packageName){
  7351. var self=this;
  7352. var theClass,thePackage;
  7353. return $core.withContext(function($ctx1) {
  7354. var $1,$2,$receiver;
  7355. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  7356. thePackage=$recv($globals.Package)._named_(packageName);
  7357. $1=theClass;
  7358. if(($receiver = $1) == null || $receiver.isNil){
  7359. $1;
  7360. } else {
  7361. $recv(theClass)._package_(thePackage);
  7362. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  7363. if(!$core.assert($2)){
  7364. return self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  7365. };
  7366. };
  7367. return self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  7368. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  7369. },
  7370. args: ["aClass", "className", "aCollection", "packageName"],
  7371. 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",
  7372. referencedClasses: ["Smalltalk", "Package"],
  7373. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"]
  7374. }),
  7375. $globals.ClassBuilder);
  7376. $core.addMethod(
  7377. $core.method({
  7378. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  7379. protocol: 'private',
  7380. fn: function (aClass,aString,aCollection,packageName){
  7381. var self=this;
  7382. return $core.withContext(function($ctx1) {
  7383. return $core.addClass(aString, aClass, aCollection, packageName);
  7384. ;
  7385. return self;
  7386. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  7387. },
  7388. args: ["aClass", "aString", "aCollection", "packageName"],
  7389. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09>",
  7390. referencedClasses: [],
  7391. messageSends: []
  7392. }),
  7393. $globals.ClassBuilder);
  7394. $core.addMethod(
  7395. $core.method({
  7396. selector: "basicClass:instanceVariableNames:",
  7397. protocol: 'private',
  7398. fn: function (aClass,aString){
  7399. var self=this;
  7400. return $core.withContext(function($ctx1) {
  7401. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  7402. return self;
  7403. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7404. },
  7405. args: ["aClass", "aString"],
  7406. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  7407. referencedClasses: [],
  7408. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  7409. }),
  7410. $globals.ClassBuilder);
  7411. $core.addMethod(
  7412. $core.method({
  7413. selector: "basicClass:instanceVariables:",
  7414. protocol: 'private',
  7415. fn: function (aClass,aCollection){
  7416. var self=this;
  7417. return $core.withContext(function($ctx1) {
  7418. var $1;
  7419. $1=$recv(aClass)._isMetaclass();
  7420. if(!$core.assert($1)){
  7421. self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  7422. };
  7423. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  7424. return self;
  7425. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  7426. },
  7427. args: ["aClass", "aCollection"],
  7428. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  7429. referencedClasses: [],
  7430. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  7431. }),
  7432. $globals.ClassBuilder);
  7433. $core.addMethod(
  7434. $core.method({
  7435. selector: "basicRemoveClass:",
  7436. protocol: 'private',
  7437. fn: function (aClass){
  7438. var self=this;
  7439. return $core.withContext(function($ctx1) {
  7440. $core.removeClass(aClass);
  7441. return self;
  7442. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  7443. },
  7444. args: ["aClass"],
  7445. source: "basicRemoveClass: aClass\x0a\x09<$core.removeClass(aClass)>",
  7446. referencedClasses: [],
  7447. messageSends: []
  7448. }),
  7449. $globals.ClassBuilder);
  7450. $core.addMethod(
  7451. $core.method({
  7452. selector: "basicRenameClass:to:",
  7453. protocol: 'private',
  7454. fn: function (aClass,aString){
  7455. var self=this;
  7456. return $core.withContext(function($ctx1) {
  7457. $globals[aString] = aClass;
  7458. delete $globals[aClass.className];
  7459. aClass.className = aString;
  7460. ;
  7461. return self;
  7462. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7463. },
  7464. args: ["aClass", "aString"],
  7465. source: "basicRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>",
  7466. referencedClasses: [],
  7467. messageSends: []
  7468. }),
  7469. $globals.ClassBuilder);
  7470. $core.addMethod(
  7471. $core.method({
  7472. selector: "basicSwapClassNames:with:",
  7473. protocol: 'private',
  7474. fn: function (aClass,anotherClass){
  7475. var self=this;
  7476. return $core.withContext(function($ctx1) {
  7477. var tmp = aClass.className;
  7478. aClass.className = anotherClass.className;
  7479. anotherClass.className = tmp;
  7480. ;
  7481. return self;
  7482. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7483. },
  7484. args: ["aClass", "anotherClass"],
  7485. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09>",
  7486. referencedClasses: [],
  7487. messageSends: []
  7488. }),
  7489. $globals.ClassBuilder);
  7490. $core.addMethod(
  7491. $core.method({
  7492. selector: "class:instanceVariableNames:",
  7493. protocol: 'class definition',
  7494. fn: function (aClass,ivarNames){
  7495. var self=this;
  7496. return $core.withContext(function($ctx1) {
  7497. var $1,$3,$2;
  7498. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  7499. $1=$recv($globals.SystemAnnouncer)._current();
  7500. $3=$recv($globals.ClassDefinitionChanged)._new();
  7501. $recv($3)._theClass_(aClass);
  7502. $2=$recv($3)._yourself();
  7503. $recv($1)._announce_($2);
  7504. return self;
  7505. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  7506. },
  7507. args: ["aClass", "ivarNames"],
  7508. 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)",
  7509. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  7510. messageSends: ["basicClass:instanceVariableNames:", "announce:", "current", "theClass:", "new", "yourself"]
  7511. }),
  7512. $globals.ClassBuilder);
  7513. $core.addMethod(
  7514. $core.method({
  7515. selector: "copyClass:named:",
  7516. protocol: 'copying',
  7517. fn: function (aClass,className){
  7518. var self=this;
  7519. var newClass;
  7520. return $core.withContext(function($ctx1) {
  7521. var $1,$3,$2;
  7522. newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7523. self._copyClass_to_(aClass,newClass);
  7524. $1=$recv($globals.SystemAnnouncer)._current();
  7525. $3=$recv($globals.ClassAdded)._new();
  7526. $recv($3)._theClass_(newClass);
  7527. $2=$recv($3)._yourself();
  7528. $recv($1)._announce_($2);
  7529. return newClass;
  7530. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  7531. },
  7532. args: ["aClass", "className"],
  7533. 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",
  7534. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7535. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  7536. }),
  7537. $globals.ClassBuilder);
  7538. $core.addMethod(
  7539. $core.method({
  7540. selector: "copyClass:to:",
  7541. protocol: 'copying',
  7542. fn: function (aClass,anotherClass){
  7543. var self=this;
  7544. return $core.withContext(function($ctx1) {
  7545. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  7546. $recv(anotherClass)._comment_($recv(aClass)._comment());
  7547. $1=$recv(aClass)._methodDictionary();
  7548. $ctx1.sendIdx["methodDictionary"]=1;
  7549. $recv($1)._valuesDo_((function(each){
  7550. return $core.withContext(function($ctx2) {
  7551. $2=$recv($globals.Compiler)._new();
  7552. $ctx2.sendIdx["new"]=1;
  7553. $3=$recv(each)._source();
  7554. $ctx2.sendIdx["source"]=1;
  7555. $4=$recv(each)._protocol();
  7556. $ctx2.sendIdx["protocol"]=1;
  7557. return $recv($2)._install_forClass_protocol_($3,anotherClass,$4);
  7558. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  7559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7560. }));
  7561. $ctx1.sendIdx["valuesDo:"]=1;
  7562. $5=$recv(anotherClass)._class();
  7563. $ctx1.sendIdx["class"]=1;
  7564. $7=$recv(aClass)._class();
  7565. $ctx1.sendIdx["class"]=2;
  7566. $6=$recv($7)._instanceVariableNames();
  7567. self._basicClass_instanceVariables_($5,$6);
  7568. $9=$recv(aClass)._class();
  7569. $ctx1.sendIdx["class"]=3;
  7570. $8=$recv($9)._methodDictionary();
  7571. $recv($8)._valuesDo_((function(each){
  7572. return $core.withContext(function($ctx2) {
  7573. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_($recv(each)._source(),$recv(anotherClass)._class(),$recv(each)._protocol());
  7574. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7575. }));
  7576. return self;
  7577. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7578. },
  7579. args: ["aClass", "anotherClass"],
  7580. 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 ]",
  7581. referencedClasses: ["Compiler"],
  7582. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  7583. }),
  7584. $globals.ClassBuilder);
  7585. $core.addMethod(
  7586. $core.method({
  7587. selector: "installMethod:forClass:protocol:",
  7588. protocol: 'method definition',
  7589. fn: function (aCompiledMethod,aBehavior,aString){
  7590. var self=this;
  7591. return $core.withContext(function($ctx1) {
  7592. $recv(aCompiledMethod)._protocol_(aString);
  7593. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  7594. return aCompiledMethod;
  7595. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  7596. },
  7597. args: ["aCompiledMethod", "aBehavior", "aString"],
  7598. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  7599. referencedClasses: [],
  7600. messageSends: ["protocol:", "addCompiledMethod:"]
  7601. }),
  7602. $globals.ClassBuilder);
  7603. $core.addMethod(
  7604. $core.method({
  7605. selector: "instanceVariableNamesFor:",
  7606. protocol: 'accessing',
  7607. fn: function (aString){
  7608. var self=this;
  7609. return $core.withContext(function($ctx1) {
  7610. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  7611. return $core.withContext(function($ctx2) {
  7612. return $recv(each)._isEmpty();
  7613. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7614. }));
  7615. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  7616. },
  7617. args: ["aString"],
  7618. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  7619. referencedClasses: [],
  7620. messageSends: ["reject:", "tokenize:", "isEmpty"]
  7621. }),
  7622. $globals.ClassBuilder);
  7623. $core.addMethod(
  7624. $core.method({
  7625. selector: "migrateClass:superclass:",
  7626. protocol: 'class migration',
  7627. fn: function (aClass,anotherClass){
  7628. var self=this;
  7629. return $core.withContext(function($ctx1) {
  7630. var $1;
  7631. $1=$recv(aClass)._name();
  7632. $ctx1.sendIdx["name"]=1;
  7633. return self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7634. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7635. },
  7636. args: ["aClass", "anotherClass"],
  7637. 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",
  7638. referencedClasses: [],
  7639. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  7640. }),
  7641. $globals.ClassBuilder);
  7642. $core.addMethod(
  7643. $core.method({
  7644. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  7645. protocol: 'class migration',
  7646. fn: function (className,aClass,aCollection,packageName){
  7647. var self=this;
  7648. var oldClass,newClass,tmp;
  7649. return $core.withContext(function($ctx1) {
  7650. var $1,$2,$4,$3;
  7651. tmp="new*".__comma(className);
  7652. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  7653. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  7654. self._basicSwapClassNames_with_(oldClass,newClass);
  7655. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  7656. $recv((function(){
  7657. return $core.withContext(function($ctx2) {
  7658. return self._copyClass_to_(oldClass,newClass);
  7659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7660. }))._on_do_($globals.Error,(function(exception){
  7661. return $core.withContext(function($ctx2) {
  7662. self._basicSwapClassNames_with_(oldClass,newClass);
  7663. $1=self._basicRemoveClass_(newClass);
  7664. $ctx2.sendIdx["basicRemoveClass:"]=1;
  7665. $1;
  7666. return $recv(exception)._resignal();
  7667. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  7668. }));
  7669. self._rawRenameClass_to_(oldClass,tmp);
  7670. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  7671. self._rawRenameClass_to_(newClass,className);
  7672. $recv($recv(oldClass)._subclasses())._do_((function(each){
  7673. return $core.withContext(function($ctx2) {
  7674. return self._migrateClass_superclass_(each,newClass);
  7675. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7676. }));
  7677. self._basicRemoveClass_(oldClass);
  7678. $2=$recv($globals.SystemAnnouncer)._current();
  7679. $4=$recv($globals.ClassMigrated)._new();
  7680. $recv($4)._theClass_(newClass);
  7681. $recv($4)._oldClass_(oldClass);
  7682. $3=$recv($4)._yourself();
  7683. $recv($2)._announce_($3);
  7684. return newClass;
  7685. }, 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)});
  7686. },
  7687. args: ["className", "aClass", "aCollection", "packageName"],
  7688. 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",
  7689. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  7690. 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"]
  7691. }),
  7692. $globals.ClassBuilder);
  7693. $core.addMethod(
  7694. $core.method({
  7695. selector: "rawRenameClass:to:",
  7696. protocol: 'private',
  7697. fn: function (aClass,aString){
  7698. var self=this;
  7699. return $core.withContext(function($ctx1) {
  7700. $globals[aString] = aClass;
  7701. ;
  7702. return self;
  7703. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7704. },
  7705. args: ["aClass", "aString"],
  7706. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09>",
  7707. referencedClasses: [],
  7708. messageSends: []
  7709. }),
  7710. $globals.ClassBuilder);
  7711. $core.addMethod(
  7712. $core.method({
  7713. selector: "renameClass:to:",
  7714. protocol: 'class migration',
  7715. fn: function (aClass,className){
  7716. var self=this;
  7717. return $core.withContext(function($ctx1) {
  7718. var $1,$3,$2;
  7719. self._basicRenameClass_to_(aClass,className);
  7720. $recv(aClass)._recompile();
  7721. $1=$recv($globals.SystemAnnouncer)._current();
  7722. $3=$recv($globals.ClassRenamed)._new();
  7723. $recv($3)._theClass_(aClass);
  7724. $2=$recv($3)._yourself();
  7725. $recv($1)._announce_($2);
  7726. return self;
  7727. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7728. },
  7729. args: ["aClass", "className"],
  7730. 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)",
  7731. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  7732. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  7733. }),
  7734. $globals.ClassBuilder);
  7735. $core.addMethod(
  7736. $core.method({
  7737. selector: "setupClass:",
  7738. protocol: 'public',
  7739. fn: function (aClass){
  7740. var self=this;
  7741. return $core.withContext(function($ctx1) {
  7742. self._deprecatedAPI_("Classes are now auto-inited.");
  7743. return self;
  7744. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  7745. },
  7746. args: ["aClass"],
  7747. source: "setupClass: aClass\x0a\x09self deprecatedAPI: 'Classes are now auto-inited.'",
  7748. referencedClasses: [],
  7749. messageSends: ["deprecatedAPI:"]
  7750. }),
  7751. $globals.ClassBuilder);
  7752. $core.addMethod(
  7753. $core.method({
  7754. selector: "superclass:subclass:",
  7755. protocol: 'class definition',
  7756. fn: function (aClass,className){
  7757. var self=this;
  7758. return $core.withContext(function($ctx1) {
  7759. return self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  7760. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7761. },
  7762. args: ["aClass", "className"],
  7763. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  7764. referencedClasses: [],
  7765. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  7766. }),
  7767. $globals.ClassBuilder);
  7768. $core.addMethod(
  7769. $core.method({
  7770. selector: "superclass:subclass:instanceVariableNames:package:",
  7771. protocol: 'class definition',
  7772. fn: function (aClass,className,ivarNames,packageName){
  7773. var self=this;
  7774. var newClass;
  7775. return $core.withContext(function($ctx1) {
  7776. var $1,$2,$3,$5,$4,$receiver;
  7777. $1=self._instanceVariableNamesFor_(ivarNames);
  7778. if(($receiver = packageName) == null || $receiver.isNil){
  7779. $2="unclassified";
  7780. } else {
  7781. $2=packageName;
  7782. };
  7783. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  7784. $3=$recv($globals.SystemAnnouncer)._current();
  7785. $5=$recv($globals.ClassAdded)._new();
  7786. $recv($5)._theClass_(newClass);
  7787. $4=$recv($5)._yourself();
  7788. $recv($3)._announce_($4);
  7789. return newClass;
  7790. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  7791. },
  7792. args: ["aClass", "className", "ivarNames", "packageName"],
  7793. 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",
  7794. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7795. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  7796. }),
  7797. $globals.ClassBuilder);
  7798. $core.addClass('ClassSorterNode', $globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  7799. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  7800. $core.addMethod(
  7801. $core.method({
  7802. selector: "getNodesFrom:",
  7803. protocol: 'accessing',
  7804. fn: function (aCollection){
  7805. var self=this;
  7806. var children,others;
  7807. return $core.withContext(function($ctx1) {
  7808. var $1;
  7809. children=[];
  7810. others=[];
  7811. $recv(aCollection)._do_((function(each){
  7812. return $core.withContext(function($ctx2) {
  7813. $1=$recv($recv(each)._superclass()).__eq(self._theClass());
  7814. if($core.assert($1)){
  7815. return $recv(children)._add_(each);
  7816. $ctx2.sendIdx["add:"]=1;
  7817. } else {
  7818. return $recv(others)._add_(each);
  7819. };
  7820. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7821. }));
  7822. self["@nodes"]=$recv(children)._collect_((function(each){
  7823. return $core.withContext(function($ctx2) {
  7824. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv(self._level()).__plus((1)));
  7825. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  7826. }));
  7827. return self;
  7828. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  7829. },
  7830. args: ["aCollection"],
  7831. 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 ]",
  7832. referencedClasses: ["ClassSorterNode"],
  7833. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  7834. }),
  7835. $globals.ClassSorterNode);
  7836. $core.addMethod(
  7837. $core.method({
  7838. selector: "level",
  7839. protocol: 'accessing',
  7840. fn: function (){
  7841. var self=this;
  7842. return self["@level"];
  7843. },
  7844. args: [],
  7845. source: "level\x0a\x09^ level",
  7846. referencedClasses: [],
  7847. messageSends: []
  7848. }),
  7849. $globals.ClassSorterNode);
  7850. $core.addMethod(
  7851. $core.method({
  7852. selector: "level:",
  7853. protocol: 'accessing',
  7854. fn: function (anInteger){
  7855. var self=this;
  7856. self["@level"]=anInteger;
  7857. return self;
  7858. },
  7859. args: ["anInteger"],
  7860. source: "level: anInteger\x0a\x09level := anInteger",
  7861. referencedClasses: [],
  7862. messageSends: []
  7863. }),
  7864. $globals.ClassSorterNode);
  7865. $core.addMethod(
  7866. $core.method({
  7867. selector: "nodes",
  7868. protocol: 'accessing',
  7869. fn: function (){
  7870. var self=this;
  7871. return self["@nodes"];
  7872. },
  7873. args: [],
  7874. source: "nodes\x0a\x09^ nodes",
  7875. referencedClasses: [],
  7876. messageSends: []
  7877. }),
  7878. $globals.ClassSorterNode);
  7879. $core.addMethod(
  7880. $core.method({
  7881. selector: "theClass",
  7882. protocol: 'accessing',
  7883. fn: function (){
  7884. var self=this;
  7885. return self["@theClass"];
  7886. },
  7887. args: [],
  7888. source: "theClass\x0a\x09^ theClass",
  7889. referencedClasses: [],
  7890. messageSends: []
  7891. }),
  7892. $globals.ClassSorterNode);
  7893. $core.addMethod(
  7894. $core.method({
  7895. selector: "theClass:",
  7896. protocol: 'accessing',
  7897. fn: function (aClass){
  7898. var self=this;
  7899. self["@theClass"]=aClass;
  7900. return self;
  7901. },
  7902. args: ["aClass"],
  7903. source: "theClass: aClass\x0a\x09theClass := aClass",
  7904. referencedClasses: [],
  7905. messageSends: []
  7906. }),
  7907. $globals.ClassSorterNode);
  7908. $core.addMethod(
  7909. $core.method({
  7910. selector: "traverseClassesWith:",
  7911. protocol: 'visiting',
  7912. fn: function (aCollection){
  7913. var self=this;
  7914. return $core.withContext(function($ctx1) {
  7915. var $1,$3,$2;
  7916. $1=self._theClass();
  7917. $ctx1.sendIdx["theClass"]=1;
  7918. $recv(aCollection)._add_($1);
  7919. $recv($recv(self._nodes())._sorted_((function(a,b){
  7920. return $core.withContext(function($ctx2) {
  7921. $3=$recv(a)._theClass();
  7922. $ctx2.sendIdx["theClass"]=2;
  7923. $2=$recv($3)._name();
  7924. $ctx2.sendIdx["name"]=1;
  7925. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  7926. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  7927. })))._do_((function(aNode){
  7928. return $core.withContext(function($ctx2) {
  7929. return $recv(aNode)._traverseClassesWith_(aCollection);
  7930. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  7931. }));
  7932. return self;
  7933. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  7934. },
  7935. args: ["aCollection"],
  7936. 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 ].",
  7937. referencedClasses: [],
  7938. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  7939. }),
  7940. $globals.ClassSorterNode);
  7941. $core.addMethod(
  7942. $core.method({
  7943. selector: "on:classes:level:",
  7944. protocol: 'instance creation',
  7945. fn: function (aClass,aCollection,anInteger){
  7946. var self=this;
  7947. return $core.withContext(function($ctx1) {
  7948. var $1;
  7949. $1=self._new();
  7950. $recv($1)._theClass_(aClass);
  7951. $recv($1)._level_(anInteger);
  7952. $recv($1)._getNodesFrom_(aCollection);
  7953. return $recv($1)._yourself();
  7954. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)});
  7955. },
  7956. args: ["aClass", "aCollection", "anInteger"],
  7957. 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",
  7958. referencedClasses: [],
  7959. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  7960. }),
  7961. $globals.ClassSorterNode.klass);
  7962. });
  7963. define("amber_core/Kernel-Methods", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7964. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  7965. $core.addPackage('Kernel-Methods');
  7966. $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  7967. $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7968. $core.addClass('BlockClosure', $globals.Object, [], 'Kernel-Methods');
  7969. $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 | ... ] `";
  7970. $core.addMethod(
  7971. $core.method({
  7972. selector: "applyTo:arguments:",
  7973. protocol: 'evaluating',
  7974. fn: function (anObject,aCollection){
  7975. var self=this;
  7976. return $core.withContext(function($ctx1) {
  7977. return self.apply(anObject, aCollection);
  7978. return self;
  7979. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  7980. },
  7981. args: ["anObject", "aCollection"],
  7982. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  7983. referencedClasses: [],
  7984. messageSends: []
  7985. }),
  7986. $globals.BlockClosure);
  7987. $core.addMethod(
  7988. $core.method({
  7989. selector: "asCompiledMethod:",
  7990. protocol: 'converting',
  7991. fn: function (aString){
  7992. var self=this;
  7993. return $core.withContext(function($ctx1) {
  7994. return $core.method({selector:aString, fn:self});;
  7995. return self;
  7996. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  7997. },
  7998. args: ["aString"],
  7999. source: "asCompiledMethod: aString\x0a\x09<return $core.method({selector:aString, fn:self});>",
  8000. referencedClasses: [],
  8001. messageSends: []
  8002. }),
  8003. $globals.BlockClosure);
  8004. $core.addMethod(
  8005. $core.method({
  8006. selector: "compiledSource",
  8007. protocol: 'accessing',
  8008. fn: function (){
  8009. var self=this;
  8010. return $core.withContext(function($ctx1) {
  8011. return self.toString();
  8012. return self;
  8013. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  8014. },
  8015. args: [],
  8016. source: "compiledSource\x0a\x09<return self.toString()>",
  8017. referencedClasses: [],
  8018. messageSends: []
  8019. }),
  8020. $globals.BlockClosure);
  8021. $core.addMethod(
  8022. $core.method({
  8023. selector: "currySelf",
  8024. protocol: 'converting',
  8025. fn: function (){
  8026. var self=this;
  8027. return $core.withContext(function($ctx1) {
  8028. return function () {
  8029. var args = [ this ];
  8030. args.push.apply(args, arguments);
  8031. return self.apply(null, args);
  8032. }
  8033. ;
  8034. return self;
  8035. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  8036. },
  8037. args: [],
  8038. 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<\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>",
  8039. referencedClasses: [],
  8040. messageSends: []
  8041. }),
  8042. $globals.BlockClosure);
  8043. $core.addMethod(
  8044. $core.method({
  8045. selector: "ensure:",
  8046. protocol: 'evaluating',
  8047. fn: function (aBlock){
  8048. var self=this;
  8049. return $core.withContext(function($ctx1) {
  8050. try{return self._value()}finally{aBlock._value()};
  8051. return self;
  8052. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  8053. },
  8054. args: ["aBlock"],
  8055. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  8056. referencedClasses: [],
  8057. messageSends: []
  8058. }),
  8059. $globals.BlockClosure);
  8060. $core.addMethod(
  8061. $core.method({
  8062. selector: "fork",
  8063. protocol: 'timeout/interval',
  8064. fn: function (){
  8065. var self=this;
  8066. return $core.withContext(function($ctx1) {
  8067. $recv($recv($globals.ForkPool)._default())._fork_(self);
  8068. return self;
  8069. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  8070. },
  8071. args: [],
  8072. source: "fork\x0a\x09ForkPool default fork: self",
  8073. referencedClasses: ["ForkPool"],
  8074. messageSends: ["fork:", "default"]
  8075. }),
  8076. $globals.BlockClosure);
  8077. $core.addMethod(
  8078. $core.method({
  8079. selector: "new",
  8080. protocol: 'evaluating',
  8081. fn: function (){
  8082. var self=this;
  8083. return $core.withContext(function($ctx1) {
  8084. return new self();
  8085. return self;
  8086. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  8087. },
  8088. args: [],
  8089. 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<return new self()>",
  8090. referencedClasses: [],
  8091. messageSends: []
  8092. }),
  8093. $globals.BlockClosure);
  8094. $core.addMethod(
  8095. $core.method({
  8096. selector: "newValue:",
  8097. protocol: 'evaluating',
  8098. fn: function (anObject){
  8099. var self=this;
  8100. return $core.withContext(function($ctx1) {
  8101. return self._newWithValues_([anObject]);
  8102. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  8103. },
  8104. args: ["anObject"],
  8105. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  8106. referencedClasses: [],
  8107. messageSends: ["newWithValues:"]
  8108. }),
  8109. $globals.BlockClosure);
  8110. $core.addMethod(
  8111. $core.method({
  8112. selector: "newValue:value:",
  8113. protocol: 'evaluating',
  8114. fn: function (anObject,anObject2){
  8115. var self=this;
  8116. return $core.withContext(function($ctx1) {
  8117. return self._newWithValues_([anObject,anObject2]);
  8118. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  8119. },
  8120. args: ["anObject", "anObject2"],
  8121. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  8122. referencedClasses: [],
  8123. messageSends: ["newWithValues:"]
  8124. }),
  8125. $globals.BlockClosure);
  8126. $core.addMethod(
  8127. $core.method({
  8128. selector: "newValue:value:value:",
  8129. protocol: 'evaluating',
  8130. fn: function (anObject,anObject2,anObject3){
  8131. var self=this;
  8132. return $core.withContext(function($ctx1) {
  8133. return self._newWithValues_([anObject,anObject2,anObject3]);
  8134. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  8135. },
  8136. args: ["anObject", "anObject2", "anObject3"],
  8137. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  8138. referencedClasses: [],
  8139. messageSends: ["newWithValues:"]
  8140. }),
  8141. $globals.BlockClosure);
  8142. $core.addMethod(
  8143. $core.method({
  8144. selector: "newWithValues:",
  8145. protocol: 'evaluating',
  8146. fn: function (aCollection){
  8147. var self=this;
  8148. return $core.withContext(function($ctx1) {
  8149. var object = Object.create(self.prototype);
  8150. var result = self.apply(object, aCollection);
  8151. return typeof result === "object" ? result : object;
  8152. ;
  8153. return self;
  8154. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  8155. },
  8156. args: ["aCollection"],
  8157. source: "newWithValues: aCollection\x0a\x09\x22Simulates JS new operator by combination of Object.create and .apply\x22\x0a\x09<\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>",
  8158. referencedClasses: [],
  8159. messageSends: []
  8160. }),
  8161. $globals.BlockClosure);
  8162. $core.addMethod(
  8163. $core.method({
  8164. selector: "numArgs",
  8165. protocol: 'accessing',
  8166. fn: function (){
  8167. var self=this;
  8168. return $core.withContext(function($ctx1) {
  8169. return self.length;
  8170. return self;
  8171. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  8172. },
  8173. args: [],
  8174. source: "numArgs\x0a\x09<return self.length>",
  8175. referencedClasses: [],
  8176. messageSends: []
  8177. }),
  8178. $globals.BlockClosure);
  8179. $core.addMethod(
  8180. $core.method({
  8181. selector: "on:do:",
  8182. protocol: 'error handling',
  8183. fn: function (anErrorClass,aBlock){
  8184. var self=this;
  8185. return $core.withContext(function($ctx1) {
  8186. var $1;
  8187. return self._tryCatch_((function(error){
  8188. var smalltalkError;
  8189. return $core.withContext(function($ctx2) {
  8190. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  8191. smalltalkError;
  8192. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  8193. if($core.assert($1)){
  8194. return $recv(aBlock)._value_(smalltalkError);
  8195. } else {
  8196. return $recv(smalltalkError)._resignal();
  8197. };
  8198. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  8199. }));
  8200. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  8201. },
  8202. args: ["anErrorClass", "aBlock"],
  8203. 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 ] ]",
  8204. referencedClasses: ["Smalltalk"],
  8205. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  8206. }),
  8207. $globals.BlockClosure);
  8208. $core.addMethod(
  8209. $core.method({
  8210. selector: "receiver",
  8211. protocol: 'accessing',
  8212. fn: function (){
  8213. var self=this;
  8214. return nil;
  8215. },
  8216. args: [],
  8217. source: "receiver\x0a\x09^ nil",
  8218. referencedClasses: [],
  8219. messageSends: []
  8220. }),
  8221. $globals.BlockClosure);
  8222. $core.addMethod(
  8223. $core.method({
  8224. selector: "timeToRun",
  8225. protocol: 'evaluating',
  8226. fn: function (){
  8227. var self=this;
  8228. return $core.withContext(function($ctx1) {
  8229. return $recv($globals.Date)._millisecondsToRun_(self);
  8230. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  8231. },
  8232. args: [],
  8233. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  8234. referencedClasses: ["Date"],
  8235. messageSends: ["millisecondsToRun:"]
  8236. }),
  8237. $globals.BlockClosure);
  8238. $core.addMethod(
  8239. $core.method({
  8240. selector: "tryCatch:",
  8241. protocol: 'error handling',
  8242. fn: function (aBlock){
  8243. var self=this;
  8244. return $core.withContext(function($ctx1) {
  8245. try {
  8246. return self._value();
  8247. } catch(error) {
  8248. // pass non-local returns undetected
  8249. if (Array.isArray(error) && error.length === 1) throw error;
  8250. return aBlock._value_(error);
  8251. }
  8252. ;
  8253. return self;
  8254. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  8255. },
  8256. args: ["aBlock"],
  8257. source: "tryCatch: aBlock\x0a\x09<\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>",
  8258. referencedClasses: [],
  8259. messageSends: []
  8260. }),
  8261. $globals.BlockClosure);
  8262. $core.addMethod(
  8263. $core.method({
  8264. selector: "value",
  8265. protocol: 'evaluating',
  8266. fn: function (){
  8267. var self=this;
  8268. return $core.withContext(function($ctx1) {
  8269. return self();;
  8270. return self;
  8271. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  8272. },
  8273. args: [],
  8274. source: "value\x0a\x09<return self();>",
  8275. referencedClasses: [],
  8276. messageSends: []
  8277. }),
  8278. $globals.BlockClosure);
  8279. $core.addMethod(
  8280. $core.method({
  8281. selector: "value:",
  8282. protocol: 'evaluating',
  8283. fn: function (anArg){
  8284. var self=this;
  8285. return $core.withContext(function($ctx1) {
  8286. return self(anArg);;
  8287. return self;
  8288. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  8289. },
  8290. args: ["anArg"],
  8291. source: "value: anArg\x0a\x09<return self(anArg);>",
  8292. referencedClasses: [],
  8293. messageSends: []
  8294. }),
  8295. $globals.BlockClosure);
  8296. $core.addMethod(
  8297. $core.method({
  8298. selector: "value:value:",
  8299. protocol: 'evaluating',
  8300. fn: function (firstArg,secondArg){
  8301. var self=this;
  8302. return $core.withContext(function($ctx1) {
  8303. return self(firstArg, secondArg);;
  8304. return self;
  8305. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  8306. },
  8307. args: ["firstArg", "secondArg"],
  8308. source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
  8309. referencedClasses: [],
  8310. messageSends: []
  8311. }),
  8312. $globals.BlockClosure);
  8313. $core.addMethod(
  8314. $core.method({
  8315. selector: "value:value:value:",
  8316. protocol: 'evaluating',
  8317. fn: function (firstArg,secondArg,thirdArg){
  8318. var self=this;
  8319. return $core.withContext(function($ctx1) {
  8320. return self(firstArg, secondArg, thirdArg);;
  8321. return self;
  8322. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  8323. },
  8324. args: ["firstArg", "secondArg", "thirdArg"],
  8325. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  8326. referencedClasses: [],
  8327. messageSends: []
  8328. }),
  8329. $globals.BlockClosure);
  8330. $core.addMethod(
  8331. $core.method({
  8332. selector: "valueWithInterval:",
  8333. protocol: 'timeout/interval',
  8334. fn: function (aNumber){
  8335. var self=this;
  8336. return $core.withContext(function($ctx1) {
  8337. var interval = setInterval(self, aNumber);
  8338. return $globals.Timeout._on_(interval);
  8339. ;
  8340. return self;
  8341. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  8342. },
  8343. args: ["aNumber"],
  8344. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09>",
  8345. referencedClasses: [],
  8346. messageSends: []
  8347. }),
  8348. $globals.BlockClosure);
  8349. $core.addMethod(
  8350. $core.method({
  8351. selector: "valueWithPossibleArguments:",
  8352. protocol: 'evaluating',
  8353. fn: function (aCollection){
  8354. var self=this;
  8355. return $core.withContext(function($ctx1) {
  8356. return self.apply(null, aCollection);;
  8357. return self;
  8358. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  8359. },
  8360. args: ["aCollection"],
  8361. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  8362. referencedClasses: [],
  8363. messageSends: []
  8364. }),
  8365. $globals.BlockClosure);
  8366. $core.addMethod(
  8367. $core.method({
  8368. selector: "valueWithTimeout:",
  8369. protocol: 'timeout/interval',
  8370. fn: function (aNumber){
  8371. var self=this;
  8372. return $core.withContext(function($ctx1) {
  8373. var timeout = setTimeout(self, aNumber);
  8374. return $globals.Timeout._on_(timeout);
  8375. ;
  8376. return self;
  8377. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  8378. },
  8379. args: ["aNumber"],
  8380. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09>",
  8381. referencedClasses: [],
  8382. messageSends: []
  8383. }),
  8384. $globals.BlockClosure);
  8385. $core.addMethod(
  8386. $core.method({
  8387. selector: "whileFalse",
  8388. protocol: 'controlling',
  8389. fn: function (){
  8390. var self=this;
  8391. return $core.withContext(function($ctx1) {
  8392. self._whileFalse_((function(){
  8393. }));
  8394. return self;
  8395. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  8396. },
  8397. args: [],
  8398. source: "whileFalse\x0a\x09self whileFalse: []",
  8399. referencedClasses: [],
  8400. messageSends: ["whileFalse:"]
  8401. }),
  8402. $globals.BlockClosure);
  8403. $core.addMethod(
  8404. $core.method({
  8405. selector: "whileFalse:",
  8406. protocol: 'controlling',
  8407. fn: function (aBlock){
  8408. var self=this;
  8409. return $core.withContext(function($ctx1) {
  8410. while(!$core.assert(self._value())) {aBlock._value()};
  8411. return self;
  8412. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  8413. },
  8414. args: ["aBlock"],
  8415. source: "whileFalse: aBlock\x0a\x09<while(!$core.assert(self._value())) {aBlock._value()}>",
  8416. referencedClasses: [],
  8417. messageSends: []
  8418. }),
  8419. $globals.BlockClosure);
  8420. $core.addMethod(
  8421. $core.method({
  8422. selector: "whileTrue",
  8423. protocol: 'controlling',
  8424. fn: function (){
  8425. var self=this;
  8426. return $core.withContext(function($ctx1) {
  8427. self._whileTrue_((function(){
  8428. }));
  8429. return self;
  8430. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  8431. },
  8432. args: [],
  8433. source: "whileTrue\x0a\x09self whileTrue: []",
  8434. referencedClasses: [],
  8435. messageSends: ["whileTrue:"]
  8436. }),
  8437. $globals.BlockClosure);
  8438. $core.addMethod(
  8439. $core.method({
  8440. selector: "whileTrue:",
  8441. protocol: 'controlling',
  8442. fn: function (aBlock){
  8443. var self=this;
  8444. return $core.withContext(function($ctx1) {
  8445. while($core.assert(self._value())) {aBlock._value()};
  8446. return self;
  8447. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  8448. },
  8449. args: ["aBlock"],
  8450. source: "whileTrue: aBlock\x0a\x09<while($core.assert(self._value())) {aBlock._value()}>",
  8451. referencedClasses: [],
  8452. messageSends: []
  8453. }),
  8454. $globals.BlockClosure);
  8455. $core.addClass('CompiledMethod', $globals.Object, [], 'Kernel-Methods');
  8456. $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";
  8457. $core.addMethod(
  8458. $core.method({
  8459. selector: "arguments",
  8460. protocol: 'accessing',
  8461. fn: function (){
  8462. var self=this;
  8463. return $core.withContext(function($ctx1) {
  8464. return self.args || [];
  8465. return self;
  8466. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  8467. },
  8468. args: [],
  8469. source: "arguments\x0a\x09<return self.args || []>",
  8470. referencedClasses: [],
  8471. messageSends: []
  8472. }),
  8473. $globals.CompiledMethod);
  8474. $core.addMethod(
  8475. $core.method({
  8476. selector: "browse",
  8477. protocol: 'browsing',
  8478. fn: function (){
  8479. var self=this;
  8480. return $core.withContext(function($ctx1) {
  8481. $recv($globals.Finder)._findMethod_(self);
  8482. return self;
  8483. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  8484. },
  8485. args: [],
  8486. source: "browse\x0a\x09Finder findMethod: self",
  8487. referencedClasses: ["Finder"],
  8488. messageSends: ["findMethod:"]
  8489. }),
  8490. $globals.CompiledMethod);
  8491. $core.addMethod(
  8492. $core.method({
  8493. selector: "category",
  8494. protocol: 'accessing',
  8495. fn: function (){
  8496. var self=this;
  8497. return $core.withContext(function($ctx1) {
  8498. return self._protocol();
  8499. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  8500. },
  8501. args: [],
  8502. source: "category\x0a\x09^ self protocol",
  8503. referencedClasses: [],
  8504. messageSends: ["protocol"]
  8505. }),
  8506. $globals.CompiledMethod);
  8507. $core.addMethod(
  8508. $core.method({
  8509. selector: "defaultProtocol",
  8510. protocol: 'defaults',
  8511. fn: function (){
  8512. var self=this;
  8513. return "as yet unclassified";
  8514. },
  8515. args: [],
  8516. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  8517. referencedClasses: [],
  8518. messageSends: []
  8519. }),
  8520. $globals.CompiledMethod);
  8521. $core.addMethod(
  8522. $core.method({
  8523. selector: "fn",
  8524. protocol: 'accessing',
  8525. fn: function (){
  8526. var self=this;
  8527. return $core.withContext(function($ctx1) {
  8528. return self._basicAt_("fn");
  8529. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  8530. },
  8531. args: [],
  8532. source: "fn\x0a\x09^ self basicAt: 'fn'",
  8533. referencedClasses: [],
  8534. messageSends: ["basicAt:"]
  8535. }),
  8536. $globals.CompiledMethod);
  8537. $core.addMethod(
  8538. $core.method({
  8539. selector: "fn:",
  8540. protocol: 'accessing',
  8541. fn: function (aBlock){
  8542. var self=this;
  8543. return $core.withContext(function($ctx1) {
  8544. self._basicAt_put_("fn",aBlock);
  8545. return self;
  8546. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  8547. },
  8548. args: ["aBlock"],
  8549. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  8550. referencedClasses: [],
  8551. messageSends: ["basicAt:put:"]
  8552. }),
  8553. $globals.CompiledMethod);
  8554. $core.addMethod(
  8555. $core.method({
  8556. selector: "isCompiledMethod",
  8557. protocol: 'testing',
  8558. fn: function (){
  8559. var self=this;
  8560. return true;
  8561. },
  8562. args: [],
  8563. source: "isCompiledMethod\x0a\x09^ true",
  8564. referencedClasses: [],
  8565. messageSends: []
  8566. }),
  8567. $globals.CompiledMethod);
  8568. $core.addMethod(
  8569. $core.method({
  8570. selector: "isOverridden",
  8571. protocol: 'testing',
  8572. fn: function (){
  8573. var self=this;
  8574. var selector;
  8575. return $core.withContext(function($ctx1) {
  8576. var $1;
  8577. var $early={};
  8578. try {
  8579. selector=self._selector();
  8580. $recv(self._methodClass())._allSubclassesDo_((function(each){
  8581. return $core.withContext(function($ctx2) {
  8582. $1=$recv(each)._includesSelector_(selector);
  8583. if($core.assert($1)){
  8584. throw $early=[true];
  8585. };
  8586. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8587. }));
  8588. return false;
  8589. }
  8590. catch(e) {if(e===$early)return e[0]; throw e}
  8591. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  8592. },
  8593. args: [],
  8594. 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",
  8595. referencedClasses: [],
  8596. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  8597. }),
  8598. $globals.CompiledMethod);
  8599. $core.addMethod(
  8600. $core.method({
  8601. selector: "isOverride",
  8602. protocol: 'testing',
  8603. fn: function (){
  8604. var self=this;
  8605. var superclass;
  8606. return $core.withContext(function($ctx1) {
  8607. var $1,$2,$receiver;
  8608. $1=self._methodClass();
  8609. $ctx1.sendIdx["methodClass"]=1;
  8610. superclass=$recv($1)._superclass();
  8611. $ctx1.sendIdx["superclass"]=1;
  8612. $2=superclass;
  8613. if(($receiver = $2) == null || $receiver.isNil){
  8614. return false;
  8615. } else {
  8616. $2;
  8617. };
  8618. return $recv($recv($recv(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  8619. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  8620. },
  8621. args: [],
  8622. 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",
  8623. referencedClasses: [],
  8624. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  8625. }),
  8626. $globals.CompiledMethod);
  8627. $core.addMethod(
  8628. $core.method({
  8629. selector: "messageSends",
  8630. protocol: 'accessing',
  8631. fn: function (){
  8632. var self=this;
  8633. return $core.withContext(function($ctx1) {
  8634. return self._basicAt_("messageSends");
  8635. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  8636. },
  8637. args: [],
  8638. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  8639. referencedClasses: [],
  8640. messageSends: ["basicAt:"]
  8641. }),
  8642. $globals.CompiledMethod);
  8643. $core.addMethod(
  8644. $core.method({
  8645. selector: "methodClass",
  8646. protocol: 'accessing',
  8647. fn: function (){
  8648. var self=this;
  8649. return $core.withContext(function($ctx1) {
  8650. return self._basicAt_("methodClass");
  8651. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  8652. },
  8653. args: [],
  8654. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  8655. referencedClasses: [],
  8656. messageSends: ["basicAt:"]
  8657. }),
  8658. $globals.CompiledMethod);
  8659. $core.addMethod(
  8660. $core.method({
  8661. selector: "package",
  8662. protocol: 'accessing',
  8663. fn: function (){
  8664. var self=this;
  8665. return $core.withContext(function($ctx1) {
  8666. var $1,$receiver;
  8667. $1=self._methodClass();
  8668. if(($receiver = $1) == null || $receiver.isNil){
  8669. return $1;
  8670. } else {
  8671. var class_;
  8672. class_=$receiver;
  8673. return $recv(class_)._packageOfProtocol_(self._protocol());
  8674. };
  8675. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  8676. },
  8677. args: [],
  8678. 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 ]",
  8679. referencedClasses: [],
  8680. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  8681. }),
  8682. $globals.CompiledMethod);
  8683. $core.addMethod(
  8684. $core.method({
  8685. selector: "protocol",
  8686. protocol: 'accessing',
  8687. fn: function (){
  8688. var self=this;
  8689. return $core.withContext(function($ctx1) {
  8690. var $1,$receiver;
  8691. $1=self._basicAt_("protocol");
  8692. if(($receiver = $1) == null || $receiver.isNil){
  8693. return self._defaultProtocol();
  8694. } else {
  8695. return $1;
  8696. };
  8697. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  8698. },
  8699. args: [],
  8700. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  8701. referencedClasses: [],
  8702. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  8703. }),
  8704. $globals.CompiledMethod);
  8705. $core.addMethod(
  8706. $core.method({
  8707. selector: "protocol:",
  8708. protocol: 'accessing',
  8709. fn: function (aString){
  8710. var self=this;
  8711. var oldProtocol;
  8712. return $core.withContext(function($ctx1) {
  8713. var $1,$3,$2,$4,$receiver;
  8714. oldProtocol=self._protocol();
  8715. self._basicAt_put_("protocol",aString);
  8716. $1=$recv($globals.SystemAnnouncer)._current();
  8717. $3=$recv($globals.MethodMoved)._new();
  8718. $recv($3)._method_(self);
  8719. $recv($3)._oldProtocol_(oldProtocol);
  8720. $2=$recv($3)._yourself();
  8721. $recv($1)._announce_($2);
  8722. $4=self._methodClass();
  8723. if(($receiver = $4) == null || $receiver.isNil){
  8724. $4;
  8725. } else {
  8726. var methodClass;
  8727. methodClass=$receiver;
  8728. $recv($recv(methodClass)._organization())._addElement_(aString);
  8729. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  8730. };
  8731. return self;
  8732. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  8733. },
  8734. args: ["aString"],
  8735. 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 ]",
  8736. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  8737. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  8738. }),
  8739. $globals.CompiledMethod);
  8740. $core.addMethod(
  8741. $core.method({
  8742. selector: "referencedClasses",
  8743. protocol: 'accessing',
  8744. fn: function (){
  8745. var self=this;
  8746. return $core.withContext(function($ctx1) {
  8747. return self._basicAt_("referencedClasses");
  8748. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  8749. },
  8750. args: [],
  8751. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  8752. referencedClasses: [],
  8753. messageSends: ["basicAt:"]
  8754. }),
  8755. $globals.CompiledMethod);
  8756. $core.addMethod(
  8757. $core.method({
  8758. selector: "selector",
  8759. protocol: 'accessing',
  8760. fn: function (){
  8761. var self=this;
  8762. return $core.withContext(function($ctx1) {
  8763. return self._basicAt_("selector");
  8764. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  8765. },
  8766. args: [],
  8767. source: "selector\x0a\x09^ self basicAt: 'selector'",
  8768. referencedClasses: [],
  8769. messageSends: ["basicAt:"]
  8770. }),
  8771. $globals.CompiledMethod);
  8772. $core.addMethod(
  8773. $core.method({
  8774. selector: "selector:",
  8775. protocol: 'accessing',
  8776. fn: function (aString){
  8777. var self=this;
  8778. return $core.withContext(function($ctx1) {
  8779. self._basicAt_put_("selector",aString);
  8780. return self;
  8781. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  8782. },
  8783. args: ["aString"],
  8784. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  8785. referencedClasses: [],
  8786. messageSends: ["basicAt:put:"]
  8787. }),
  8788. $globals.CompiledMethod);
  8789. $core.addMethod(
  8790. $core.method({
  8791. selector: "sendTo:arguments:",
  8792. protocol: 'evaluating',
  8793. fn: function (anObject,aCollection){
  8794. var self=this;
  8795. return $core.withContext(function($ctx1) {
  8796. return $recv(self._fn())._applyTo_arguments_(anObject,aCollection);
  8797. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  8798. },
  8799. args: ["anObject", "aCollection"],
  8800. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  8801. referencedClasses: [],
  8802. messageSends: ["applyTo:arguments:", "fn"]
  8803. }),
  8804. $globals.CompiledMethod);
  8805. $core.addMethod(
  8806. $core.method({
  8807. selector: "source",
  8808. protocol: 'accessing',
  8809. fn: function (){
  8810. var self=this;
  8811. return $core.withContext(function($ctx1) {
  8812. var $1,$receiver;
  8813. $1=self._basicAt_("source");
  8814. if(($receiver = $1) == null || $receiver.isNil){
  8815. return "";
  8816. } else {
  8817. return $1;
  8818. };
  8819. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  8820. },
  8821. args: [],
  8822. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  8823. referencedClasses: [],
  8824. messageSends: ["ifNil:", "basicAt:"]
  8825. }),
  8826. $globals.CompiledMethod);
  8827. $core.addMethod(
  8828. $core.method({
  8829. selector: "source:",
  8830. protocol: 'accessing',
  8831. fn: function (aString){
  8832. var self=this;
  8833. return $core.withContext(function($ctx1) {
  8834. self._basicAt_put_("source",aString);
  8835. return self;
  8836. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  8837. },
  8838. args: ["aString"],
  8839. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  8840. referencedClasses: [],
  8841. messageSends: ["basicAt:put:"]
  8842. }),
  8843. $globals.CompiledMethod);
  8844. $core.addClass('ForkPool', $globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  8845. $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`";
  8846. $core.addMethod(
  8847. $core.method({
  8848. selector: "addWorker",
  8849. protocol: 'private',
  8850. fn: function (){
  8851. var self=this;
  8852. return $core.withContext(function($ctx1) {
  8853. $recv(self["@worker"])._valueWithTimeout_((0));
  8854. self["@poolSize"]=$recv(self["@poolSize"]).__plus((1));
  8855. return self;
  8856. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  8857. },
  8858. args: [],
  8859. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  8860. referencedClasses: [],
  8861. messageSends: ["valueWithTimeout:", "+"]
  8862. }),
  8863. $globals.ForkPool);
  8864. $core.addMethod(
  8865. $core.method({
  8866. selector: "defaultMaxPoolSize",
  8867. protocol: 'defaults',
  8868. fn: function (){
  8869. var self=this;
  8870. return $core.withContext(function($ctx1) {
  8871. return $recv(self._class())._defaultMaxPoolSize();
  8872. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  8873. },
  8874. args: [],
  8875. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  8876. referencedClasses: [],
  8877. messageSends: ["defaultMaxPoolSize", "class"]
  8878. }),
  8879. $globals.ForkPool);
  8880. $core.addMethod(
  8881. $core.method({
  8882. selector: "fork:",
  8883. protocol: 'actions',
  8884. fn: function (aBlock){
  8885. var self=this;
  8886. return $core.withContext(function($ctx1) {
  8887. var $1;
  8888. $1=$recv(self["@poolSize"]).__lt(self._maxPoolSize());
  8889. if($core.assert($1)){
  8890. self._addWorker();
  8891. };
  8892. $recv(self["@queue"])._nextPut_(aBlock);
  8893. return self;
  8894. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  8895. },
  8896. args: ["aBlock"],
  8897. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  8898. referencedClasses: [],
  8899. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  8900. }),
  8901. $globals.ForkPool);
  8902. $core.addMethod(
  8903. $core.method({
  8904. selector: "initialize",
  8905. protocol: 'initialization',
  8906. fn: function (){
  8907. var self=this;
  8908. return $core.withContext(function($ctx1) {
  8909. (
  8910. $ctx1.supercall = true,
  8911. ($globals.ForkPool.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  8912. $ctx1.supercall = false;
  8913. self["@poolSize"]=(0);
  8914. self["@queue"]=$recv($globals.Queue)._new();
  8915. self["@worker"]=self._makeWorker();
  8916. return self;
  8917. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  8918. },
  8919. args: [],
  8920. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  8921. referencedClasses: ["Queue"],
  8922. messageSends: ["initialize", "new", "makeWorker"]
  8923. }),
  8924. $globals.ForkPool);
  8925. $core.addMethod(
  8926. $core.method({
  8927. selector: "makeWorker",
  8928. protocol: 'initialization',
  8929. fn: function (){
  8930. var self=this;
  8931. var sentinel;
  8932. return $core.withContext(function($ctx1) {
  8933. var $1;
  8934. sentinel=$recv($globals.Object)._new();
  8935. return (function(){
  8936. var block;
  8937. return $core.withContext(function($ctx2) {
  8938. self["@poolSize"]=$recv(self["@poolSize"]).__minus((1));
  8939. self["@poolSize"];
  8940. block=$recv(self["@queue"])._nextIfAbsent_((function(){
  8941. return sentinel;
  8942. }));
  8943. block;
  8944. $1=$recv(block).__eq_eq(sentinel);
  8945. if(!$core.assert($1)){
  8946. return $recv((function(){
  8947. return $core.withContext(function($ctx3) {
  8948. return $recv(block)._value();
  8949. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  8950. }))._ensure_((function(){
  8951. return $core.withContext(function($ctx3) {
  8952. return self._addWorker();
  8953. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  8954. }));
  8955. };
  8956. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  8957. });
  8958. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  8959. },
  8960. args: [],
  8961. 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 ] ]]",
  8962. referencedClasses: ["Object"],
  8963. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  8964. }),
  8965. $globals.ForkPool);
  8966. $core.addMethod(
  8967. $core.method({
  8968. selector: "maxPoolSize",
  8969. protocol: 'accessing',
  8970. fn: function (){
  8971. var self=this;
  8972. return $core.withContext(function($ctx1) {
  8973. var $1,$receiver;
  8974. $1=self["@maxPoolSize"];
  8975. if(($receiver = $1) == null || $receiver.isNil){
  8976. return self._defaultMaxPoolSize();
  8977. } else {
  8978. return $1;
  8979. };
  8980. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  8981. },
  8982. args: [],
  8983. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  8984. referencedClasses: [],
  8985. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  8986. }),
  8987. $globals.ForkPool);
  8988. $core.addMethod(
  8989. $core.method({
  8990. selector: "maxPoolSize:",
  8991. protocol: 'accessing',
  8992. fn: function (anInteger){
  8993. var self=this;
  8994. self["@maxPoolSize"]=anInteger;
  8995. return self;
  8996. },
  8997. args: ["anInteger"],
  8998. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  8999. referencedClasses: [],
  9000. messageSends: []
  9001. }),
  9002. $globals.ForkPool);
  9003. $globals.ForkPool.klass.iVarNames = ['default'];
  9004. $core.addMethod(
  9005. $core.method({
  9006. selector: "default",
  9007. protocol: 'accessing',
  9008. fn: function (){
  9009. var self=this;
  9010. return $core.withContext(function($ctx1) {
  9011. var $1,$receiver;
  9012. $1=self["@default"];
  9013. if(($receiver = $1) == null || $receiver.isNil){
  9014. self["@default"]=self._new();
  9015. return self["@default"];
  9016. } else {
  9017. return $1;
  9018. };
  9019. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.klass)});
  9020. },
  9021. args: [],
  9022. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  9023. referencedClasses: [],
  9024. messageSends: ["ifNil:", "new"]
  9025. }),
  9026. $globals.ForkPool.klass);
  9027. $core.addMethod(
  9028. $core.method({
  9029. selector: "defaultMaxPoolSize",
  9030. protocol: 'accessing',
  9031. fn: function (){
  9032. var self=this;
  9033. return (100);
  9034. },
  9035. args: [],
  9036. source: "defaultMaxPoolSize\x0a\x09^ 100",
  9037. referencedClasses: [],
  9038. messageSends: []
  9039. }),
  9040. $globals.ForkPool.klass);
  9041. $core.addMethod(
  9042. $core.method({
  9043. selector: "resetDefault",
  9044. protocol: 'accessing',
  9045. fn: function (){
  9046. var self=this;
  9047. self["@default"]=nil;
  9048. return self;
  9049. },
  9050. args: [],
  9051. source: "resetDefault\x0a\x09default := nil",
  9052. referencedClasses: [],
  9053. messageSends: []
  9054. }),
  9055. $globals.ForkPool.klass);
  9056. $core.addClass('Message', $globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
  9057. $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.";
  9058. $core.addMethod(
  9059. $core.method({
  9060. selector: "arguments",
  9061. protocol: 'accessing',
  9062. fn: function (){
  9063. var self=this;
  9064. return self["@arguments"];
  9065. },
  9066. args: [],
  9067. source: "arguments\x0a\x09^ arguments",
  9068. referencedClasses: [],
  9069. messageSends: []
  9070. }),
  9071. $globals.Message);
  9072. $core.addMethod(
  9073. $core.method({
  9074. selector: "arguments:",
  9075. protocol: 'accessing',
  9076. fn: function (anArray){
  9077. var self=this;
  9078. self["@arguments"]=anArray;
  9079. return self;
  9080. },
  9081. args: ["anArray"],
  9082. source: "arguments: anArray\x0a\x09arguments := anArray",
  9083. referencedClasses: [],
  9084. messageSends: []
  9085. }),
  9086. $globals.Message);
  9087. $core.addMethod(
  9088. $core.method({
  9089. selector: "printOn:",
  9090. protocol: 'printing',
  9091. fn: function (aStream){
  9092. var self=this;
  9093. return $core.withContext(function($ctx1) {
  9094. (
  9095. $ctx1.supercall = true,
  9096. ($globals.Message.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9097. $ctx1.supercall = false;
  9098. $recv(aStream)._nextPutAll_("(");
  9099. $ctx1.sendIdx["nextPutAll:"]=1;
  9100. $recv(aStream)._nextPutAll_(self._selector());
  9101. $ctx1.sendIdx["nextPutAll:"]=2;
  9102. $recv(aStream)._nextPutAll_(")");
  9103. return self;
  9104. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  9105. },
  9106. args: ["aStream"],
  9107. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  9108. referencedClasses: [],
  9109. messageSends: ["printOn:", "nextPutAll:", "selector"]
  9110. }),
  9111. $globals.Message);
  9112. $core.addMethod(
  9113. $core.method({
  9114. selector: "selector",
  9115. protocol: 'accessing',
  9116. fn: function (){
  9117. var self=this;
  9118. return self["@selector"];
  9119. },
  9120. args: [],
  9121. source: "selector\x0a\x09^ selector",
  9122. referencedClasses: [],
  9123. messageSends: []
  9124. }),
  9125. $globals.Message);
  9126. $core.addMethod(
  9127. $core.method({
  9128. selector: "selector:",
  9129. protocol: 'accessing',
  9130. fn: function (aString){
  9131. var self=this;
  9132. self["@selector"]=aString;
  9133. return self;
  9134. },
  9135. args: ["aString"],
  9136. source: "selector: aString\x0a\x09selector := aString",
  9137. referencedClasses: [],
  9138. messageSends: []
  9139. }),
  9140. $globals.Message);
  9141. $core.addMethod(
  9142. $core.method({
  9143. selector: "sendTo:",
  9144. protocol: 'actions',
  9145. fn: function (anObject){
  9146. var self=this;
  9147. return $core.withContext(function($ctx1) {
  9148. return $recv(anObject)._perform_withArguments_(self._selector(),self._arguments());
  9149. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  9150. },
  9151. args: ["anObject"],
  9152. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  9153. referencedClasses: [],
  9154. messageSends: ["perform:withArguments:", "selector", "arguments"]
  9155. }),
  9156. $globals.Message);
  9157. $core.addMethod(
  9158. $core.method({
  9159. selector: "selector:arguments:",
  9160. protocol: 'instance creation',
  9161. fn: function (aString,anArray){
  9162. var self=this;
  9163. return $core.withContext(function($ctx1) {
  9164. var $1;
  9165. $1=self._new();
  9166. $recv($1)._selector_(aString);
  9167. $recv($1)._arguments_(anArray);
  9168. return $recv($1)._yourself();
  9169. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.klass)});
  9170. },
  9171. args: ["aString", "anArray"],
  9172. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  9173. referencedClasses: [],
  9174. messageSends: ["selector:", "new", "arguments:", "yourself"]
  9175. }),
  9176. $globals.Message.klass);
  9177. $core.addClass('MessageSend', $globals.Object, ['receiver', 'message'], 'Kernel-Methods');
  9178. $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.";
  9179. $core.addMethod(
  9180. $core.method({
  9181. selector: "arguments",
  9182. protocol: 'accessing',
  9183. fn: function (){
  9184. var self=this;
  9185. return $core.withContext(function($ctx1) {
  9186. return $recv(self["@message"])._arguments();
  9187. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  9188. },
  9189. args: [],
  9190. source: "arguments\x0a\x09^ message arguments",
  9191. referencedClasses: [],
  9192. messageSends: ["arguments"]
  9193. }),
  9194. $globals.MessageSend);
  9195. $core.addMethod(
  9196. $core.method({
  9197. selector: "arguments:",
  9198. protocol: 'accessing',
  9199. fn: function (aCollection){
  9200. var self=this;
  9201. return $core.withContext(function($ctx1) {
  9202. $recv(self["@message"])._arguments_(aCollection);
  9203. return self;
  9204. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  9205. },
  9206. args: ["aCollection"],
  9207. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  9208. referencedClasses: [],
  9209. messageSends: ["arguments:"]
  9210. }),
  9211. $globals.MessageSend);
  9212. $core.addMethod(
  9213. $core.method({
  9214. selector: "initialize",
  9215. protocol: 'initialization',
  9216. fn: function (){
  9217. var self=this;
  9218. return $core.withContext(function($ctx1) {
  9219. (
  9220. $ctx1.supercall = true,
  9221. ($globals.MessageSend.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  9222. $ctx1.supercall = false;
  9223. self["@message"]=$recv($globals.Message)._new();
  9224. return self;
  9225. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  9226. },
  9227. args: [],
  9228. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  9229. referencedClasses: ["Message"],
  9230. messageSends: ["initialize", "new"]
  9231. }),
  9232. $globals.MessageSend);
  9233. $core.addMethod(
  9234. $core.method({
  9235. selector: "printOn:",
  9236. protocol: 'printing',
  9237. fn: function (aStream){
  9238. var self=this;
  9239. return $core.withContext(function($ctx1) {
  9240. (
  9241. $ctx1.supercall = true,
  9242. ($globals.MessageSend.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9243. $ctx1.supercall = false;
  9244. $recv(aStream)._nextPutAll_("(");
  9245. $ctx1.sendIdx["nextPutAll:"]=1;
  9246. $recv(aStream)._nextPutAll_(self._receiver());
  9247. $ctx1.sendIdx["nextPutAll:"]=2;
  9248. $recv(aStream)._nextPutAll_(" >> ");
  9249. $ctx1.sendIdx["nextPutAll:"]=3;
  9250. $recv(aStream)._nextPutAll_(self._selector());
  9251. $ctx1.sendIdx["nextPutAll:"]=4;
  9252. $recv(aStream)._nextPutAll_(")");
  9253. return self;
  9254. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  9255. },
  9256. args: ["aStream"],
  9257. 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: ')'",
  9258. referencedClasses: [],
  9259. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  9260. }),
  9261. $globals.MessageSend);
  9262. $core.addMethod(
  9263. $core.method({
  9264. selector: "receiver",
  9265. protocol: 'accessing',
  9266. fn: function (){
  9267. var self=this;
  9268. return self["@receiver"];
  9269. },
  9270. args: [],
  9271. source: "receiver\x0a\x09^ receiver",
  9272. referencedClasses: [],
  9273. messageSends: []
  9274. }),
  9275. $globals.MessageSend);
  9276. $core.addMethod(
  9277. $core.method({
  9278. selector: "receiver:",
  9279. protocol: 'accessing',
  9280. fn: function (anObject){
  9281. var self=this;
  9282. self["@receiver"]=anObject;
  9283. return self;
  9284. },
  9285. args: ["anObject"],
  9286. source: "receiver: anObject\x0a\x09receiver := anObject",
  9287. referencedClasses: [],
  9288. messageSends: []
  9289. }),
  9290. $globals.MessageSend);
  9291. $core.addMethod(
  9292. $core.method({
  9293. selector: "selector",
  9294. protocol: 'accessing',
  9295. fn: function (){
  9296. var self=this;
  9297. return $core.withContext(function($ctx1) {
  9298. return $recv(self["@message"])._selector();
  9299. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  9300. },
  9301. args: [],
  9302. source: "selector\x0a\x09^ message selector",
  9303. referencedClasses: [],
  9304. messageSends: ["selector"]
  9305. }),
  9306. $globals.MessageSend);
  9307. $core.addMethod(
  9308. $core.method({
  9309. selector: "selector:",
  9310. protocol: 'accessing',
  9311. fn: function (aString){
  9312. var self=this;
  9313. return $core.withContext(function($ctx1) {
  9314. $recv(self["@message"])._selector_(aString);
  9315. return self;
  9316. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  9317. },
  9318. args: ["aString"],
  9319. source: "selector: aString\x0a\x09message selector: aString",
  9320. referencedClasses: [],
  9321. messageSends: ["selector:"]
  9322. }),
  9323. $globals.MessageSend);
  9324. $core.addMethod(
  9325. $core.method({
  9326. selector: "value",
  9327. protocol: 'evaluating',
  9328. fn: function (){
  9329. var self=this;
  9330. return $core.withContext(function($ctx1) {
  9331. return $recv(self["@message"])._sendTo_(self._receiver());
  9332. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  9333. },
  9334. args: [],
  9335. source: "value\x0a\x09^ message sendTo: self receiver",
  9336. referencedClasses: [],
  9337. messageSends: ["sendTo:", "receiver"]
  9338. }),
  9339. $globals.MessageSend);
  9340. $core.addMethod(
  9341. $core.method({
  9342. selector: "value:",
  9343. protocol: 'evaluating',
  9344. fn: function (anObject){
  9345. var self=this;
  9346. return $core.withContext(function($ctx1) {
  9347. var $1;
  9348. $1=self["@message"];
  9349. $recv($1)._arguments_([anObject]);
  9350. return $recv($1)._sendTo_(self._receiver());
  9351. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  9352. },
  9353. args: ["anObject"],
  9354. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  9355. referencedClasses: [],
  9356. messageSends: ["arguments:", "sendTo:", "receiver"]
  9357. }),
  9358. $globals.MessageSend);
  9359. $core.addMethod(
  9360. $core.method({
  9361. selector: "value:value:",
  9362. protocol: 'evaluating',
  9363. fn: function (firstArgument,secondArgument){
  9364. var self=this;
  9365. return $core.withContext(function($ctx1) {
  9366. var $1;
  9367. $1=self["@message"];
  9368. $recv($1)._arguments_([firstArgument,secondArgument]);
  9369. return $recv($1)._sendTo_(self._receiver());
  9370. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  9371. },
  9372. args: ["firstArgument", "secondArgument"],
  9373. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  9374. referencedClasses: [],
  9375. messageSends: ["arguments:", "sendTo:", "receiver"]
  9376. }),
  9377. $globals.MessageSend);
  9378. $core.addMethod(
  9379. $core.method({
  9380. selector: "value:value:value:",
  9381. protocol: 'evaluating',
  9382. fn: function (firstArgument,secondArgument,thirdArgument){
  9383. var self=this;
  9384. return $core.withContext(function($ctx1) {
  9385. var $1;
  9386. $1=self["@message"];
  9387. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  9388. return $recv($1)._sendTo_(self._receiver());
  9389. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  9390. },
  9391. args: ["firstArgument", "secondArgument", "thirdArgument"],
  9392. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  9393. referencedClasses: [],
  9394. messageSends: ["arguments:", "sendTo:", "receiver"]
  9395. }),
  9396. $globals.MessageSend);
  9397. $core.addMethod(
  9398. $core.method({
  9399. selector: "valueWithPossibleArguments:",
  9400. protocol: 'evaluating',
  9401. fn: function (aCollection){
  9402. var self=this;
  9403. return $core.withContext(function($ctx1) {
  9404. self._arguments_(aCollection);
  9405. return self._value();
  9406. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  9407. },
  9408. args: ["aCollection"],
  9409. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  9410. referencedClasses: [],
  9411. messageSends: ["arguments:", "value"]
  9412. }),
  9413. $globals.MessageSend);
  9414. $core.addClass('MethodContext', $globals.Object, [], 'Kernel-Methods');
  9415. $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`.";
  9416. $core.addMethod(
  9417. $core.method({
  9418. selector: "asString",
  9419. protocol: 'converting',
  9420. fn: function (){
  9421. var self=this;
  9422. return $core.withContext(function($ctx1) {
  9423. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  9424. $2=self._isBlockContext();
  9425. if($core.assert($2)){
  9426. $3="a block (in ".__comma($recv(self._methodContext())._asString());
  9427. $ctx1.sendIdx[","]=2;
  9428. $1=$recv($3).__comma(")");
  9429. $ctx1.sendIdx[","]=1;
  9430. } else {
  9431. var methodClass;
  9432. methodClass=$recv(self._method())._methodClass();
  9433. methodClass;
  9434. $5=methodClass;
  9435. $7=self._receiver();
  9436. $ctx1.sendIdx["receiver"]=1;
  9437. $6=$recv($7)._class();
  9438. $ctx1.sendIdx["class"]=1;
  9439. $4=$recv($5).__eq($6);
  9440. if($core.assert($4)){
  9441. $11=self._receiver();
  9442. $ctx1.sendIdx["receiver"]=2;
  9443. $10=$recv($11)._class();
  9444. $ctx1.sendIdx["class"]=2;
  9445. $9=$recv($10)._name();
  9446. $ctx1.sendIdx["name"]=1;
  9447. $8=$recv($9).__comma(" >> ");
  9448. $ctx1.sendIdx[","]=4;
  9449. $12=self._selector();
  9450. $ctx1.sendIdx["selector"]=1;
  9451. $1=$recv($8).__comma($12);
  9452. $ctx1.sendIdx[","]=3;
  9453. } else {
  9454. $16=$recv($recv(self._receiver())._class())._name();
  9455. $ctx1.sendIdx["name"]=2;
  9456. $15=$recv($16).__comma("(");
  9457. $14=$recv($15).__comma($recv(methodClass)._name());
  9458. $ctx1.sendIdx[","]=7;
  9459. $13=$recv($14).__comma(") >> ");
  9460. $ctx1.sendIdx[","]=6;
  9461. $1=$recv($13).__comma(self._selector());
  9462. $ctx1.sendIdx[","]=5;
  9463. };
  9464. };
  9465. return $1;
  9466. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  9467. },
  9468. args: [],
  9469. 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 ] ]",
  9470. referencedClasses: [],
  9471. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  9472. }),
  9473. $globals.MethodContext);
  9474. $core.addMethod(
  9475. $core.method({
  9476. selector: "basicReceiver",
  9477. protocol: 'accessing',
  9478. fn: function (){
  9479. var self=this;
  9480. return $core.withContext(function($ctx1) {
  9481. return self.receiver;
  9482. return self;
  9483. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  9484. },
  9485. args: [],
  9486. source: "basicReceiver\x0a\x09<return self.receiver>",
  9487. referencedClasses: [],
  9488. messageSends: []
  9489. }),
  9490. $globals.MethodContext);
  9491. $core.addMethod(
  9492. $core.method({
  9493. selector: "evaluatedSelector",
  9494. protocol: 'accessing',
  9495. fn: function (){
  9496. var self=this;
  9497. return $core.withContext(function($ctx1) {
  9498. return self.evaluatedSelector;
  9499. return self;
  9500. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  9501. },
  9502. args: [],
  9503. source: "evaluatedSelector\x0a\x09<return self.evaluatedSelector>",
  9504. referencedClasses: [],
  9505. messageSends: []
  9506. }),
  9507. $globals.MethodContext);
  9508. $core.addMethod(
  9509. $core.method({
  9510. selector: "findContextSuchThat:",
  9511. protocol: 'accessing',
  9512. fn: function (testBlock){
  9513. var self=this;
  9514. var context;
  9515. return $core.withContext(function($ctx1) {
  9516. var $1;
  9517. var $early={};
  9518. try {
  9519. context=self;
  9520. $recv((function(){
  9521. return $core.withContext(function($ctx2) {
  9522. return $recv(context)._isNil();
  9523. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9524. }))._whileFalse_((function(){
  9525. return $core.withContext(function($ctx2) {
  9526. $1=$recv(testBlock)._value_(context);
  9527. if($core.assert($1)){
  9528. throw $early=[context];
  9529. };
  9530. context=$recv(context)._outerContext();
  9531. return context;
  9532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9533. }));
  9534. return nil;
  9535. }
  9536. catch(e) {if(e===$early)return e[0]; throw e}
  9537. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  9538. },
  9539. args: ["testBlock"],
  9540. 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",
  9541. referencedClasses: [],
  9542. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  9543. }),
  9544. $globals.MethodContext);
  9545. $core.addMethod(
  9546. $core.method({
  9547. selector: "home",
  9548. protocol: 'accessing',
  9549. fn: function (){
  9550. var self=this;
  9551. return $core.withContext(function($ctx1) {
  9552. return self.homeContext;
  9553. return self;
  9554. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  9555. },
  9556. args: [],
  9557. source: "home\x0a\x09<return self.homeContext>",
  9558. referencedClasses: [],
  9559. messageSends: []
  9560. }),
  9561. $globals.MethodContext);
  9562. $core.addMethod(
  9563. $core.method({
  9564. selector: "index",
  9565. protocol: 'accessing',
  9566. fn: function (){
  9567. var self=this;
  9568. return $core.withContext(function($ctx1) {
  9569. return self.index || 0;
  9570. return self;
  9571. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  9572. },
  9573. args: [],
  9574. source: "index\x0a\x09<return self.index || 0>",
  9575. referencedClasses: [],
  9576. messageSends: []
  9577. }),
  9578. $globals.MethodContext);
  9579. $core.addMethod(
  9580. $core.method({
  9581. selector: "isBlockContext",
  9582. protocol: 'testing',
  9583. fn: function (){
  9584. var self=this;
  9585. return $core.withContext(function($ctx1) {
  9586. return $recv(self._selector())._isNil();
  9587. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  9588. },
  9589. args: [],
  9590. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  9591. referencedClasses: [],
  9592. messageSends: ["isNil", "selector"]
  9593. }),
  9594. $globals.MethodContext);
  9595. $core.addMethod(
  9596. $core.method({
  9597. selector: "locals",
  9598. protocol: 'accessing',
  9599. fn: function (){
  9600. var self=this;
  9601. return $core.withContext(function($ctx1) {
  9602. return self.locals || {};
  9603. return self;
  9604. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  9605. },
  9606. args: [],
  9607. source: "locals\x0a\x09<return self.locals || {}>",
  9608. referencedClasses: [],
  9609. messageSends: []
  9610. }),
  9611. $globals.MethodContext);
  9612. $core.addMethod(
  9613. $core.method({
  9614. selector: "method",
  9615. protocol: 'accessing',
  9616. fn: function (){
  9617. var self=this;
  9618. var method,lookupClass,receiverClass,supercall;
  9619. return $core.withContext(function($ctx1) {
  9620. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  9621. $1=self._methodContext();
  9622. $ctx1.sendIdx["methodContext"]=1;
  9623. if(($receiver = $1) == null || $receiver.isNil){
  9624. return nil;
  9625. } else {
  9626. $1;
  9627. };
  9628. $3=self._methodContext();
  9629. $ctx1.sendIdx["methodContext"]=2;
  9630. $2=$recv($3)._receiver();
  9631. receiverClass=$recv($2)._class();
  9632. $4=receiverClass;
  9633. $6=self._methodContext();
  9634. $ctx1.sendIdx["methodContext"]=3;
  9635. $5=$recv($6)._selector();
  9636. $ctx1.sendIdx["selector"]=1;
  9637. method=$recv($4)._lookupSelector_($5);
  9638. $ctx1.sendIdx["lookupSelector:"]=1;
  9639. $7=self._outerContext();
  9640. if(($receiver = $7) == null || $receiver.isNil){
  9641. supercall=false;
  9642. } else {
  9643. var outer;
  9644. outer=$receiver;
  9645. supercall=$recv(outer)._supercall();
  9646. };
  9647. $8=supercall;
  9648. if($core.assert($8)){
  9649. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv(self._methodContext())._selector());
  9650. } else {
  9651. return method;
  9652. };
  9653. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  9654. },
  9655. args: [],
  9656. 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 ]",
  9657. referencedClasses: [],
  9658. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  9659. }),
  9660. $globals.MethodContext);
  9661. $core.addMethod(
  9662. $core.method({
  9663. selector: "methodContext",
  9664. protocol: 'accessing',
  9665. fn: function (){
  9666. var self=this;
  9667. return $core.withContext(function($ctx1) {
  9668. var $1,$2,$receiver;
  9669. $1=self._isBlockContext();
  9670. if(!$core.assert($1)){
  9671. return self;
  9672. };
  9673. $2=self._outerContext();
  9674. if(($receiver = $2) == null || $receiver.isNil){
  9675. return $2;
  9676. } else {
  9677. var outer;
  9678. outer=$receiver;
  9679. return $recv(outer)._methodContext();
  9680. };
  9681. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  9682. },
  9683. args: [],
  9684. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  9685. referencedClasses: [],
  9686. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  9687. }),
  9688. $globals.MethodContext);
  9689. $core.addMethod(
  9690. $core.method({
  9691. selector: "outerContext",
  9692. protocol: 'accessing',
  9693. fn: function (){
  9694. var self=this;
  9695. return $core.withContext(function($ctx1) {
  9696. return self.outerContext || self.homeContext;
  9697. return self;
  9698. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  9699. },
  9700. args: [],
  9701. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  9702. referencedClasses: [],
  9703. messageSends: []
  9704. }),
  9705. $globals.MethodContext);
  9706. $core.addMethod(
  9707. $core.method({
  9708. selector: "printOn:",
  9709. protocol: 'printing',
  9710. fn: function (aStream){
  9711. var self=this;
  9712. return $core.withContext(function($ctx1) {
  9713. (
  9714. $ctx1.supercall = true,
  9715. ($globals.MethodContext.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9716. $ctx1.supercall = false;
  9717. $recv(aStream)._nextPutAll_("(");
  9718. $ctx1.sendIdx["nextPutAll:"]=1;
  9719. $recv(aStream)._nextPutAll_(self._asString());
  9720. $ctx1.sendIdx["nextPutAll:"]=2;
  9721. $recv(aStream)._nextPutAll_(")");
  9722. return self;
  9723. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  9724. },
  9725. args: ["aStream"],
  9726. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  9727. referencedClasses: [],
  9728. messageSends: ["printOn:", "nextPutAll:", "asString"]
  9729. }),
  9730. $globals.MethodContext);
  9731. $core.addMethod(
  9732. $core.method({
  9733. selector: "receiver",
  9734. protocol: 'accessing',
  9735. fn: function (){
  9736. var self=this;
  9737. return $core.withContext(function($ctx1) {
  9738. var $2,$1;
  9739. $1=$recv(self._isBlockContext())._and_((function(){
  9740. return $core.withContext(function($ctx2) {
  9741. $2=self._outerContext();
  9742. $ctx2.sendIdx["outerContext"]=1;
  9743. return $recv($2)._notNil();
  9744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9745. }));
  9746. if($core.assert($1)){
  9747. return $recv(self._outerContext())._receiver();
  9748. } else {
  9749. return self._basicReceiver();
  9750. };
  9751. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  9752. },
  9753. args: [],
  9754. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  9755. referencedClasses: [],
  9756. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  9757. }),
  9758. $globals.MethodContext);
  9759. $core.addMethod(
  9760. $core.method({
  9761. selector: "selector",
  9762. protocol: 'accessing',
  9763. fn: function (){
  9764. var self=this;
  9765. return $core.withContext(function($ctx1) {
  9766. if(self.selector) {
  9767. return $core.js2st(self.selector);
  9768. } else {
  9769. return nil;
  9770. }
  9771. ;
  9772. return self;
  9773. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  9774. },
  9775. args: [],
  9776. source: "selector\x0a\x09<\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>",
  9777. referencedClasses: [],
  9778. messageSends: []
  9779. }),
  9780. $globals.MethodContext);
  9781. $core.addMethod(
  9782. $core.method({
  9783. selector: "sendIndexAt:",
  9784. protocol: 'accessing',
  9785. fn: function (aSelector){
  9786. var self=this;
  9787. return $core.withContext(function($ctx1) {
  9788. return self.sendIdx[aSelector] || 0;
  9789. return self;
  9790. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  9791. },
  9792. args: ["aSelector"],
  9793. source: "sendIndexAt: aSelector\x0a\x09<return self.sendIdx[aSelector] || 0>",
  9794. referencedClasses: [],
  9795. messageSends: []
  9796. }),
  9797. $globals.MethodContext);
  9798. $core.addMethod(
  9799. $core.method({
  9800. selector: "sendIndexes",
  9801. protocol: 'accessing',
  9802. fn: function (){
  9803. var self=this;
  9804. return $core.withContext(function($ctx1) {
  9805. return self.sendIdx;
  9806. return self;
  9807. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  9808. },
  9809. args: [],
  9810. source: "sendIndexes\x0a\x09<return self.sendIdx>",
  9811. referencedClasses: [],
  9812. messageSends: []
  9813. }),
  9814. $globals.MethodContext);
  9815. $core.addMethod(
  9816. $core.method({
  9817. selector: "supercall",
  9818. protocol: 'accessing',
  9819. fn: function (){
  9820. var self=this;
  9821. return $core.withContext(function($ctx1) {
  9822. return self.supercall == true;
  9823. return self;
  9824. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  9825. },
  9826. args: [],
  9827. source: "supercall\x0a\x09<return self.supercall == true>",
  9828. referencedClasses: [],
  9829. messageSends: []
  9830. }),
  9831. $globals.MethodContext);
  9832. $core.addClass('NativeFunction', $globals.Object, [], 'Kernel-Methods');
  9833. $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' ]";
  9834. $core.addMethod(
  9835. $core.method({
  9836. selector: "constructor:",
  9837. protocol: 'instance creation',
  9838. fn: function (aString){
  9839. var self=this;
  9840. return $core.withContext(function($ctx1) {
  9841. self._deprecatedAPI_("Use constructorNamed:");
  9842. var nativeFunc=eval(aString);
  9843. return new nativeFunc();
  9844. ;
  9845. return self;
  9846. }, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},$globals.NativeFunction.klass)});
  9847. },
  9848. args: ["aString"],
  9849. source: "constructor: aString\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9850. referencedClasses: [],
  9851. messageSends: []
  9852. }),
  9853. $globals.NativeFunction.klass);
  9854. $core.addMethod(
  9855. $core.method({
  9856. selector: "constructor:value:",
  9857. protocol: 'instance creation',
  9858. fn: function (aString,anObject){
  9859. var self=this;
  9860. return $core.withContext(function($ctx1) {
  9861. self._deprecatedAPI_("Use constructorNamed:value:");
  9862. var nativeFunc=eval(aString);
  9863. return new nativeFunc(anObject);
  9864. ;
  9865. return self;
  9866. }, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9867. },
  9868. args: ["aString", "anObject"],
  9869. source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9870. referencedClasses: [],
  9871. messageSends: []
  9872. }),
  9873. $globals.NativeFunction.klass);
  9874. $core.addMethod(
  9875. $core.method({
  9876. selector: "constructor:value:value:",
  9877. protocol: 'instance creation',
  9878. fn: function (aString,anObject,anObject2){
  9879. var self=this;
  9880. return $core.withContext(function($ctx1) {
  9881. self._deprecatedAPI_("Use constructorNamed:value:value:");
  9882. var nativeFunc=eval(aString);
  9883. return new nativeFunc(anObject,anObject2);
  9884. ;
  9885. return self;
  9886. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9887. },
  9888. args: ["aString", "anObject", "anObject2"],
  9889. source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:value:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9890. referencedClasses: [],
  9891. messageSends: []
  9892. }),
  9893. $globals.NativeFunction.klass);
  9894. $core.addMethod(
  9895. $core.method({
  9896. selector: "constructor:value:value:value:",
  9897. protocol: 'instance creation',
  9898. fn: function (aString,anObject,anObject2,anObject3){
  9899. var self=this;
  9900. return $core.withContext(function($ctx1) {
  9901. self._deprecatedAPI_("Use constructorNamed:value:value:value");
  9902. var nativeFunc=eval(aString);
  9903. return new nativeFunc(anObject,anObject2, anObject3);
  9904. ;
  9905. return self;
  9906. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9907. },
  9908. args: ["aString", "anObject", "anObject2", "anObject3"],
  9909. source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:value:value\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9910. referencedClasses: [],
  9911. messageSends: []
  9912. }),
  9913. $globals.NativeFunction.klass);
  9914. $core.addMethod(
  9915. $core.method({
  9916. selector: "constructorNamed:",
  9917. protocol: 'instance creation',
  9918. fn: function (aString){
  9919. var self=this;
  9920. return $core.withContext(function($ctx1) {
  9921. var nativeFunc=(new Function('return this'))()[aString];
  9922. return new nativeFunc();
  9923. ;
  9924. return self;
  9925. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9926. },
  9927. args: ["aString"],
  9928. source: "constructorNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9929. referencedClasses: [],
  9930. messageSends: []
  9931. }),
  9932. $globals.NativeFunction.klass);
  9933. $core.addMethod(
  9934. $core.method({
  9935. selector: "constructorNamed:value:",
  9936. protocol: 'instance creation',
  9937. fn: function (aString,anObject){
  9938. var self=this;
  9939. return $core.withContext(function($ctx1) {
  9940. var nativeFunc=(new Function('return this'))()[aString];
  9941. return new nativeFunc(anObject);
  9942. ;
  9943. return self;
  9944. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9945. },
  9946. args: ["aString", "anObject"],
  9947. source: "constructorNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9948. referencedClasses: [],
  9949. messageSends: []
  9950. }),
  9951. $globals.NativeFunction.klass);
  9952. $core.addMethod(
  9953. $core.method({
  9954. selector: "constructorNamed:value:value:",
  9955. protocol: 'instance creation',
  9956. fn: function (aString,anObject,anObject2){
  9957. var self=this;
  9958. return $core.withContext(function($ctx1) {
  9959. var nativeFunc=(new Function('return this'))()[aString];
  9960. return new nativeFunc(anObject,anObject2);
  9961. ;
  9962. return self;
  9963. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9964. },
  9965. args: ["aString", "anObject", "anObject2"],
  9966. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9967. referencedClasses: [],
  9968. messageSends: []
  9969. }),
  9970. $globals.NativeFunction.klass);
  9971. $core.addMethod(
  9972. $core.method({
  9973. selector: "constructorNamed:value:value:value:",
  9974. protocol: 'instance creation',
  9975. fn: function (aString,anObject,anObject2,anObject3){
  9976. var self=this;
  9977. return $core.withContext(function($ctx1) {
  9978. var nativeFunc=(new Function('return this'))()[aString];
  9979. return new nativeFunc(anObject,anObject2, anObject3);
  9980. ;
  9981. return self;
  9982. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9983. },
  9984. args: ["aString", "anObject", "anObject2", "anObject3"],
  9985. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9986. referencedClasses: [],
  9987. messageSends: []
  9988. }),
  9989. $globals.NativeFunction.klass);
  9990. $core.addMethod(
  9991. $core.method({
  9992. selector: "constructorOf:",
  9993. protocol: 'instance creation',
  9994. fn: function (nativeFunc){
  9995. var self=this;
  9996. return $core.withContext(function($ctx1) {
  9997. return new nativeFunc();
  9998. ;
  9999. return self;
  10000. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  10001. },
  10002. args: ["nativeFunc"],
  10003. source: "constructorOf: nativeFunc\x0a\x09<\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  10004. referencedClasses: [],
  10005. messageSends: []
  10006. }),
  10007. $globals.NativeFunction.klass);
  10008. $core.addMethod(
  10009. $core.method({
  10010. selector: "constructorOf:value:",
  10011. protocol: 'instance creation',
  10012. fn: function (nativeFunc,anObject){
  10013. var self=this;
  10014. return $core.withContext(function($ctx1) {
  10015. return new nativeFunc(anObject);
  10016. ;
  10017. return self;
  10018. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  10019. },
  10020. args: ["nativeFunc", "anObject"],
  10021. source: "constructorOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  10022. referencedClasses: [],
  10023. messageSends: []
  10024. }),
  10025. $globals.NativeFunction.klass);
  10026. $core.addMethod(
  10027. $core.method({
  10028. selector: "constructorOf:value:value:",
  10029. protocol: 'instance creation',
  10030. fn: function (nativeFunc,anObject,anObject2){
  10031. var self=this;
  10032. return $core.withContext(function($ctx1) {
  10033. return new nativeFunc(anObject,anObject2);
  10034. ;
  10035. return self;
  10036. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10037. },
  10038. args: ["nativeFunc", "anObject", "anObject2"],
  10039. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  10040. referencedClasses: [],
  10041. messageSends: []
  10042. }),
  10043. $globals.NativeFunction.klass);
  10044. $core.addMethod(
  10045. $core.method({
  10046. selector: "constructorOf:value:value:value:",
  10047. protocol: 'instance creation',
  10048. fn: function (nativeFunc,anObject,anObject2,anObject3){
  10049. var self=this;
  10050. return $core.withContext(function($ctx1) {
  10051. return new nativeFunc(anObject,anObject2, anObject3);
  10052. ;
  10053. return self;
  10054. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10055. },
  10056. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  10057. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  10058. referencedClasses: [],
  10059. messageSends: []
  10060. }),
  10061. $globals.NativeFunction.klass);
  10062. $core.addMethod(
  10063. $core.method({
  10064. selector: "exists:",
  10065. protocol: 'testing',
  10066. fn: function (aString){
  10067. var self=this;
  10068. return $core.withContext(function($ctx1) {
  10069. return $recv($globals.Smalltalk)._existsJsGlobal_(aString);
  10070. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.klass)});
  10071. },
  10072. args: ["aString"],
  10073. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  10074. referencedClasses: ["Smalltalk"],
  10075. messageSends: ["existsJsGlobal:"]
  10076. }),
  10077. $globals.NativeFunction.klass);
  10078. $core.addMethod(
  10079. $core.method({
  10080. selector: "functionNamed:",
  10081. protocol: 'function calling',
  10082. fn: function (aString){
  10083. var self=this;
  10084. return $core.withContext(function($ctx1) {
  10085. var nativeFunc=(new Function('return this'))()[aString];
  10086. return nativeFunc();
  10087. ;
  10088. return self;
  10089. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.klass)});
  10090. },
  10091. args: ["aString"],
  10092. source: "functionNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09>",
  10093. referencedClasses: [],
  10094. messageSends: []
  10095. }),
  10096. $globals.NativeFunction.klass);
  10097. $core.addMethod(
  10098. $core.method({
  10099. selector: "functionNamed:value:",
  10100. protocol: 'function calling',
  10101. fn: function (aString,anObject){
  10102. var self=this;
  10103. return $core.withContext(function($ctx1) {
  10104. var nativeFunc=(new Function('return this'))()[aString];
  10105. return nativeFunc(anObject);
  10106. ;
  10107. return self;
  10108. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  10109. },
  10110. args: ["aString", "anObject"],
  10111. source: "functionNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  10112. referencedClasses: [],
  10113. messageSends: []
  10114. }),
  10115. $globals.NativeFunction.klass);
  10116. $core.addMethod(
  10117. $core.method({
  10118. selector: "functionNamed:value:value:",
  10119. protocol: 'function calling',
  10120. fn: function (aString,anObject,anObject2){
  10121. var self=this;
  10122. return $core.withContext(function($ctx1) {
  10123. var nativeFunc=(new Function('return this'))()[aString];
  10124. return nativeFunc(anObject,anObject2);
  10125. ;
  10126. return self;
  10127. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10128. },
  10129. args: ["aString", "anObject", "anObject2"],
  10130. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\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: "functionNamed:value:value:value:",
  10138. protocol: 'function calling',
  10139. fn: function (aString,anObject,anObject2,anObject3){
  10140. var self=this;
  10141. return $core.withContext(function($ctx1) {
  10142. var nativeFunc=(new Function('return this'))()[aString];
  10143. return nativeFunc(anObject,anObject2, anObject3);
  10144. ;
  10145. return self;
  10146. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10147. },
  10148. args: ["aString", "anObject", "anObject2", "anObject3"],
  10149. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  10150. referencedClasses: [],
  10151. messageSends: []
  10152. }),
  10153. $globals.NativeFunction.klass);
  10154. $core.addMethod(
  10155. $core.method({
  10156. selector: "functionNamed:valueWithArgs:",
  10157. protocol: 'function calling',
  10158. fn: function (aString,args){
  10159. var self=this;
  10160. return $core.withContext(function($ctx1) {
  10161. var nativeFunc=(new Function('return this'))()[aString];
  10162. return Function.prototype.apply.call(nativeFunc, null, args);
  10163. ;
  10164. return self;
  10165. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.klass)});
  10166. },
  10167. args: ["aString", "args"],
  10168. source: "functionNamed: aString valueWithArgs: args\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>",
  10169. referencedClasses: [],
  10170. messageSends: []
  10171. }),
  10172. $globals.NativeFunction.klass);
  10173. $core.addMethod(
  10174. $core.method({
  10175. selector: "functionOf:",
  10176. protocol: 'function calling',
  10177. fn: function (nativeFunc){
  10178. var self=this;
  10179. return $core.withContext(function($ctx1) {
  10180. return nativeFunc();
  10181. ;
  10182. return self;
  10183. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  10184. },
  10185. args: ["nativeFunc"],
  10186. source: "functionOf: nativeFunc\x0a\x09<\x0a\x09\x09return nativeFunc();\x0a\x09>",
  10187. referencedClasses: [],
  10188. messageSends: []
  10189. }),
  10190. $globals.NativeFunction.klass);
  10191. $core.addMethod(
  10192. $core.method({
  10193. selector: "functionOf:value:",
  10194. protocol: 'function calling',
  10195. fn: function (nativeFunc,anObject){
  10196. var self=this;
  10197. return $core.withContext(function($ctx1) {
  10198. return nativeFunc(anObject);
  10199. ;
  10200. return self;
  10201. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  10202. },
  10203. args: ["nativeFunc", "anObject"],
  10204. source: "functionOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  10205. referencedClasses: [],
  10206. messageSends: []
  10207. }),
  10208. $globals.NativeFunction.klass);
  10209. $core.addMethod(
  10210. $core.method({
  10211. selector: "functionOf:value:value:",
  10212. protocol: 'function calling',
  10213. fn: function (nativeFunc,anObject,anObject2){
  10214. var self=this;
  10215. return $core.withContext(function($ctx1) {
  10216. return nativeFunc(anObject,anObject2);
  10217. ;
  10218. return self;
  10219. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10220. },
  10221. args: ["nativeFunc", "anObject", "anObject2"],
  10222. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>",
  10223. referencedClasses: [],
  10224. messageSends: []
  10225. }),
  10226. $globals.NativeFunction.klass);
  10227. $core.addMethod(
  10228. $core.method({
  10229. selector: "functionOf:value:value:value:",
  10230. protocol: 'function calling',
  10231. fn: function (nativeFunc,anObject,anObject2,anObject3){
  10232. var self=this;
  10233. return $core.withContext(function($ctx1) {
  10234. return nativeFunc(anObject,anObject2, anObject3);
  10235. ;
  10236. return self;
  10237. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10238. },
  10239. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  10240. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  10241. referencedClasses: [],
  10242. messageSends: []
  10243. }),
  10244. $globals.NativeFunction.klass);
  10245. $core.addMethod(
  10246. $core.method({
  10247. selector: "functionOf:valueWithArgs:",
  10248. protocol: 'function calling',
  10249. fn: function (nativeFunc,args){
  10250. var self=this;
  10251. return $core.withContext(function($ctx1) {
  10252. return Function.prototype.apply.call(nativeFunc, null, args);
  10253. ;
  10254. return self;
  10255. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.klass)});
  10256. },
  10257. args: ["nativeFunc", "args"],
  10258. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>",
  10259. referencedClasses: [],
  10260. messageSends: []
  10261. }),
  10262. $globals.NativeFunction.klass);
  10263. $core.addMethod(
  10264. $core.method({
  10265. selector: "methodOf:this:",
  10266. protocol: 'method calling',
  10267. fn: function (nativeFunc,thisObject){
  10268. var self=this;
  10269. return $core.withContext(function($ctx1) {
  10270. return Function.prototype.call.call(nativeFunc, thisObject);
  10271. ;
  10272. return self;
  10273. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.klass)});
  10274. },
  10275. args: ["nativeFunc", "thisObject"],
  10276. source: "methodOf: nativeFunc this: thisObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09>",
  10277. referencedClasses: [],
  10278. messageSends: []
  10279. }),
  10280. $globals.NativeFunction.klass);
  10281. $core.addMethod(
  10282. $core.method({
  10283. selector: "methodOf:this:value:",
  10284. protocol: 'method calling',
  10285. fn: function (nativeFunc,thisObject,anObject){
  10286. var self=this;
  10287. return $core.withContext(function($ctx1) {
  10288. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  10289. ;
  10290. return self;
  10291. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.klass)});
  10292. },
  10293. args: ["nativeFunc", "thisObject", "anObject"],
  10294. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09>",
  10295. referencedClasses: [],
  10296. messageSends: []
  10297. }),
  10298. $globals.NativeFunction.klass);
  10299. $core.addMethod(
  10300. $core.method({
  10301. selector: "methodOf:this:value:value:",
  10302. protocol: 'method calling',
  10303. fn: function (nativeFunc,thisObject,anObject,anObject2){
  10304. var self=this;
  10305. return $core.withContext(function($ctx1) {
  10306. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  10307. ;
  10308. return self;
  10309. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10310. },
  10311. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  10312. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09>",
  10313. referencedClasses: [],
  10314. messageSends: []
  10315. }),
  10316. $globals.NativeFunction.klass);
  10317. $core.addMethod(
  10318. $core.method({
  10319. selector: "methodOf:this:value:value:value:",
  10320. protocol: 'method calling',
  10321. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  10322. var self=this;
  10323. return $core.withContext(function($ctx1) {
  10324. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  10325. ;
  10326. return self;
  10327. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10328. },
  10329. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  10330. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09>",
  10331. referencedClasses: [],
  10332. messageSends: []
  10333. }),
  10334. $globals.NativeFunction.klass);
  10335. $core.addMethod(
  10336. $core.method({
  10337. selector: "methodOf:this:valueWithArgs:",
  10338. protocol: 'method calling',
  10339. fn: function (nativeFunc,thisObject,args){
  10340. var self=this;
  10341. return $core.withContext(function($ctx1) {
  10342. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  10343. ;
  10344. return self;
  10345. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.klass)});
  10346. },
  10347. args: ["nativeFunc", "thisObject", "args"],
  10348. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09>",
  10349. referencedClasses: [],
  10350. messageSends: []
  10351. }),
  10352. $globals.NativeFunction.klass);
  10353. $core.addClass('Timeout', $globals.Object, ['rawTimeout'], 'Kernel-Methods');
  10354. $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.";
  10355. $core.addMethod(
  10356. $core.method({
  10357. selector: "clearInterval",
  10358. protocol: 'timeout/interval',
  10359. fn: function (){
  10360. var self=this;
  10361. return $core.withContext(function($ctx1) {
  10362. var interval = self["@rawTimeout"];
  10363. clearInterval(interval);
  10364. ;
  10365. return self;
  10366. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  10367. },
  10368. args: [],
  10369. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  10370. referencedClasses: [],
  10371. messageSends: []
  10372. }),
  10373. $globals.Timeout);
  10374. $core.addMethod(
  10375. $core.method({
  10376. selector: "clearTimeout",
  10377. protocol: 'timeout/interval',
  10378. fn: function (){
  10379. var self=this;
  10380. return $core.withContext(function($ctx1) {
  10381. var timeout = self["@rawTimeout"];
  10382. clearTimeout(timeout);
  10383. ;
  10384. return self;
  10385. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  10386. },
  10387. args: [],
  10388. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  10389. referencedClasses: [],
  10390. messageSends: []
  10391. }),
  10392. $globals.Timeout);
  10393. $core.addMethod(
  10394. $core.method({
  10395. selector: "rawTimeout:",
  10396. protocol: 'accessing',
  10397. fn: function (anObject){
  10398. var self=this;
  10399. self["@rawTimeout"]=anObject;
  10400. return self;
  10401. },
  10402. args: ["anObject"],
  10403. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  10404. referencedClasses: [],
  10405. messageSends: []
  10406. }),
  10407. $globals.Timeout);
  10408. $core.addMethod(
  10409. $core.method({
  10410. selector: "on:",
  10411. protocol: 'instance creation',
  10412. fn: function (anObject){
  10413. var self=this;
  10414. return $core.withContext(function($ctx1) {
  10415. var $1;
  10416. $1=self._new();
  10417. $recv($1)._rawTimeout_(anObject);
  10418. return $recv($1)._yourself();
  10419. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.klass)});
  10420. },
  10421. args: ["anObject"],
  10422. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  10423. referencedClasses: [],
  10424. messageSends: ["rawTimeout:", "new", "yourself"]
  10425. }),
  10426. $globals.Timeout.klass);
  10427. });
  10428. define("amber_core/Kernel-Collections", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  10429. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  10430. $core.addPackage('Kernel-Collections');
  10431. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  10432. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  10433. $core.addClass('Association', $globals.Object, ['key', 'value'], 'Kernel-Collections');
  10434. $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:`";
  10435. $core.addMethod(
  10436. $core.method({
  10437. selector: "=",
  10438. protocol: 'comparing',
  10439. fn: function (anAssociation){
  10440. var self=this;
  10441. return $core.withContext(function($ctx1) {
  10442. var $3,$2,$5,$4,$6,$1;
  10443. $3=self._class();
  10444. $ctx1.sendIdx["class"]=1;
  10445. $2=$recv($3).__eq($recv(anAssociation)._class());
  10446. $ctx1.sendIdx["="]=1;
  10447. $1=$recv($2)._and_((function(){
  10448. return $core.withContext(function($ctx2) {
  10449. $5=self._key();
  10450. $ctx2.sendIdx["key"]=1;
  10451. $4=$recv($5).__eq($recv(anAssociation)._key());
  10452. $ctx2.sendIdx["="]=2;
  10453. return $recv($4)._and_((function(){
  10454. return $core.withContext(function($ctx3) {
  10455. $6=self._value();
  10456. $ctx3.sendIdx["value"]=1;
  10457. return $recv($6).__eq($recv(anAssociation)._value());
  10458. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  10459. }));
  10460. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10461. }));
  10462. $ctx1.sendIdx["and:"]=1;
  10463. return $1;
  10464. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  10465. },
  10466. args: ["anAssociation"],
  10467. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  10468. referencedClasses: [],
  10469. messageSends: ["and:", "=", "class", "key", "value"]
  10470. }),
  10471. $globals.Association);
  10472. $core.addMethod(
  10473. $core.method({
  10474. selector: "key",
  10475. protocol: 'accessing',
  10476. fn: function (){
  10477. var self=this;
  10478. return self["@key"];
  10479. },
  10480. args: [],
  10481. source: "key\x0a\x09^ key",
  10482. referencedClasses: [],
  10483. messageSends: []
  10484. }),
  10485. $globals.Association);
  10486. $core.addMethod(
  10487. $core.method({
  10488. selector: "key:",
  10489. protocol: 'accessing',
  10490. fn: function (aKey){
  10491. var self=this;
  10492. self["@key"]=aKey;
  10493. return self;
  10494. },
  10495. args: ["aKey"],
  10496. source: "key: aKey\x0a\x09key := aKey",
  10497. referencedClasses: [],
  10498. messageSends: []
  10499. }),
  10500. $globals.Association);
  10501. $core.addMethod(
  10502. $core.method({
  10503. selector: "printOn:",
  10504. protocol: 'printing',
  10505. fn: function (aStream){
  10506. var self=this;
  10507. return $core.withContext(function($ctx1) {
  10508. $recv(self._key())._printOn_(aStream);
  10509. $ctx1.sendIdx["printOn:"]=1;
  10510. $recv(aStream)._nextPutAll_(" -> ");
  10511. $recv(self._value())._printOn_(aStream);
  10512. return self;
  10513. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  10514. },
  10515. args: ["aStream"],
  10516. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  10517. referencedClasses: [],
  10518. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  10519. }),
  10520. $globals.Association);
  10521. $core.addMethod(
  10522. $core.method({
  10523. selector: "value",
  10524. protocol: 'accessing',
  10525. fn: function (){
  10526. var self=this;
  10527. return self["@value"];
  10528. },
  10529. args: [],
  10530. source: "value\x0a\x09^ value",
  10531. referencedClasses: [],
  10532. messageSends: []
  10533. }),
  10534. $globals.Association);
  10535. $core.addMethod(
  10536. $core.method({
  10537. selector: "value:",
  10538. protocol: 'accessing',
  10539. fn: function (aValue){
  10540. var self=this;
  10541. self["@value"]=aValue;
  10542. return self;
  10543. },
  10544. args: ["aValue"],
  10545. source: "value: aValue\x0a\x09value := aValue",
  10546. referencedClasses: [],
  10547. messageSends: []
  10548. }),
  10549. $globals.Association);
  10550. $core.addMethod(
  10551. $core.method({
  10552. selector: "key:value:",
  10553. protocol: 'instance creation',
  10554. fn: function (aKey,aValue){
  10555. var self=this;
  10556. return $core.withContext(function($ctx1) {
  10557. var $1;
  10558. $1=self._new();
  10559. $recv($1)._key_(aKey);
  10560. $recv($1)._value_(aValue);
  10561. return $recv($1)._yourself();
  10562. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  10563. },
  10564. args: ["aKey", "aValue"],
  10565. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  10566. referencedClasses: [],
  10567. messageSends: ["key:", "new", "value:", "yourself"]
  10568. }),
  10569. $globals.Association.klass);
  10570. $core.addClass('BucketStore', $globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  10571. $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`.";
  10572. $core.addMethod(
  10573. $core.method({
  10574. selector: "bucketOfElement:",
  10575. protocol: 'accessing',
  10576. fn: function (anObject){
  10577. var self=this;
  10578. return $core.withContext(function($ctx1) {
  10579. var hash = self['@hashBlock'](anObject);
  10580. if (!hash) return null;
  10581. var buckets = self['@buckets'],
  10582. bucket = buckets[hash];
  10583. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  10584. return bucket;
  10585. ;
  10586. return self;
  10587. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  10588. },
  10589. args: ["anObject"],
  10590. source: "bucketOfElement: anObject\x0a\x09<\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>",
  10591. referencedClasses: [],
  10592. messageSends: []
  10593. }),
  10594. $globals.BucketStore);
  10595. $core.addMethod(
  10596. $core.method({
  10597. selector: "do:",
  10598. protocol: 'enumerating',
  10599. fn: function (aBlock){
  10600. var self=this;
  10601. return $core.withContext(function($ctx1) {
  10602. var buckets = self['@buckets'];
  10603. var keys = Object.keys(buckets);
  10604. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  10605. ;
  10606. return self;
  10607. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  10608. },
  10609. args: ["aBlock"],
  10610. source: "do: aBlock\x0a\x09<\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>",
  10611. referencedClasses: [],
  10612. messageSends: []
  10613. }),
  10614. $globals.BucketStore);
  10615. $core.addMethod(
  10616. $core.method({
  10617. selector: "hashBlock:",
  10618. protocol: 'accessing',
  10619. fn: function (aBlock){
  10620. var self=this;
  10621. self["@hashBlock"]=aBlock;
  10622. return self;
  10623. },
  10624. args: ["aBlock"],
  10625. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  10626. referencedClasses: [],
  10627. messageSends: []
  10628. }),
  10629. $globals.BucketStore);
  10630. $core.addMethod(
  10631. $core.method({
  10632. selector: "initialize",
  10633. protocol: 'initialization',
  10634. fn: function (){
  10635. var self=this;
  10636. return $core.withContext(function($ctx1) {
  10637. (
  10638. $ctx1.supercall = true,
  10639. ($globals.BucketStore.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  10640. $ctx1.supercall = false;
  10641. self._removeAll();
  10642. return self;
  10643. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  10644. },
  10645. args: [],
  10646. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  10647. referencedClasses: [],
  10648. messageSends: ["initialize", "removeAll"]
  10649. }),
  10650. $globals.BucketStore);
  10651. $core.addMethod(
  10652. $core.method({
  10653. selector: "newBucket",
  10654. protocol: 'private',
  10655. fn: function (){
  10656. var self=this;
  10657. return $core.withContext(function($ctx1) {
  10658. self._subclassResponsibility();
  10659. return self;
  10660. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  10661. },
  10662. args: [],
  10663. source: "newBucket\x0a\x09self subclassResponsibility",
  10664. referencedClasses: [],
  10665. messageSends: ["subclassResponsibility"]
  10666. }),
  10667. $globals.BucketStore);
  10668. $core.addMethod(
  10669. $core.method({
  10670. selector: "removeAll",
  10671. protocol: 'adding/removing',
  10672. fn: function (){
  10673. var self=this;
  10674. return $core.withContext(function($ctx1) {
  10675. self['@buckets'] = Object.create(null);;
  10676. return self;
  10677. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  10678. },
  10679. args: [],
  10680. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  10681. referencedClasses: [],
  10682. messageSends: []
  10683. }),
  10684. $globals.BucketStore);
  10685. $core.addMethod(
  10686. $core.method({
  10687. selector: "hashBlock:",
  10688. protocol: 'instance creation',
  10689. fn: function (aBlock){
  10690. var self=this;
  10691. return $core.withContext(function($ctx1) {
  10692. var $1;
  10693. $1=self._new();
  10694. $recv($1)._hashBlock_(aBlock);
  10695. return $recv($1)._yourself();
  10696. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  10697. },
  10698. args: ["aBlock"],
  10699. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  10700. referencedClasses: [],
  10701. messageSends: ["hashBlock:", "new", "yourself"]
  10702. }),
  10703. $globals.BucketStore.klass);
  10704. $core.addClass('ArrayBucketStore', $globals.BucketStore, [], 'Kernel-Collections');
  10705. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  10706. $core.addMethod(
  10707. $core.method({
  10708. selector: "newBucket",
  10709. protocol: 'private',
  10710. fn: function (){
  10711. var self=this;
  10712. return [];
  10713. },
  10714. args: [],
  10715. source: "newBucket\x0a\x09^ #()",
  10716. referencedClasses: [],
  10717. messageSends: []
  10718. }),
  10719. $globals.ArrayBucketStore);
  10720. $core.addClass('Collection', $globals.Object, [], 'Kernel-Collections');
  10721. $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.";
  10722. $core.addMethod(
  10723. $core.method({
  10724. selector: ",",
  10725. protocol: 'copying',
  10726. fn: function (aCollection){
  10727. var self=this;
  10728. return $core.withContext(function($ctx1) {
  10729. var $1;
  10730. $1=self._copy();
  10731. $recv($1)._addAll_(aCollection);
  10732. return $recv($1)._yourself();
  10733. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  10734. },
  10735. args: ["aCollection"],
  10736. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10737. referencedClasses: [],
  10738. messageSends: ["addAll:", "copy", "yourself"]
  10739. }),
  10740. $globals.Collection);
  10741. $core.addMethod(
  10742. $core.method({
  10743. selector: "add:",
  10744. protocol: 'adding/removing',
  10745. fn: function (anObject){
  10746. var self=this;
  10747. return $core.withContext(function($ctx1) {
  10748. self._subclassResponsibility();
  10749. return self;
  10750. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  10751. },
  10752. args: ["anObject"],
  10753. source: "add: anObject\x0a\x09self subclassResponsibility",
  10754. referencedClasses: [],
  10755. messageSends: ["subclassResponsibility"]
  10756. }),
  10757. $globals.Collection);
  10758. $core.addMethod(
  10759. $core.method({
  10760. selector: "addAll:",
  10761. protocol: 'adding/removing',
  10762. fn: function (aCollection){
  10763. var self=this;
  10764. return $core.withContext(function($ctx1) {
  10765. $recv(aCollection)._do_((function(each){
  10766. return $core.withContext(function($ctx2) {
  10767. return self._add_(each);
  10768. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10769. }));
  10770. return aCollection;
  10771. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  10772. },
  10773. args: ["aCollection"],
  10774. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  10775. referencedClasses: [],
  10776. messageSends: ["do:", "add:"]
  10777. }),
  10778. $globals.Collection);
  10779. $core.addMethod(
  10780. $core.method({
  10781. selector: "allSatisfy:",
  10782. protocol: 'enumerating',
  10783. fn: function (aBlock){
  10784. var self=this;
  10785. return $core.withContext(function($ctx1) {
  10786. var $1;
  10787. var $early={};
  10788. try {
  10789. self._do_((function(each){
  10790. return $core.withContext(function($ctx2) {
  10791. $1=$recv(aBlock)._value_(each);
  10792. if(!$core.assert($1)){
  10793. throw $early=[false];
  10794. };
  10795. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10796. }));
  10797. return true;
  10798. }
  10799. catch(e) {if(e===$early)return e[0]; throw e}
  10800. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  10801. },
  10802. args: ["aBlock"],
  10803. 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",
  10804. referencedClasses: [],
  10805. messageSends: ["do:", "ifFalse:", "value:"]
  10806. }),
  10807. $globals.Collection);
  10808. $core.addMethod(
  10809. $core.method({
  10810. selector: "anyOne",
  10811. protocol: 'adding/removing',
  10812. fn: function (){
  10813. var self=this;
  10814. return $core.withContext(function($ctx1) {
  10815. var $early={};
  10816. try {
  10817. self._ifEmpty_((function(){
  10818. return $core.withContext(function($ctx2) {
  10819. return self._error_("Collection is empty");
  10820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10821. }));
  10822. self._do_((function(each){
  10823. throw $early=[each];
  10824. }));
  10825. return self;
  10826. }
  10827. catch(e) {if(e===$early)return e[0]; throw e}
  10828. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  10829. },
  10830. args: [],
  10831. 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 ]",
  10832. referencedClasses: [],
  10833. messageSends: ["ifEmpty:", "error:", "do:"]
  10834. }),
  10835. $globals.Collection);
  10836. $core.addMethod(
  10837. $core.method({
  10838. selector: "anySatisfy:",
  10839. protocol: 'enumerating',
  10840. fn: function (aBlock){
  10841. var self=this;
  10842. return $core.withContext(function($ctx1) {
  10843. var $1;
  10844. var $early={};
  10845. try {
  10846. self._do_((function(each){
  10847. return $core.withContext(function($ctx2) {
  10848. $1=$recv(aBlock)._value_(each);
  10849. if($core.assert($1)){
  10850. throw $early=[true];
  10851. };
  10852. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10853. }));
  10854. return false;
  10855. }
  10856. catch(e) {if(e===$early)return e[0]; throw e}
  10857. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  10858. },
  10859. args: ["aBlock"],
  10860. 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",
  10861. referencedClasses: [],
  10862. messageSends: ["do:", "ifTrue:", "value:"]
  10863. }),
  10864. $globals.Collection);
  10865. $core.addMethod(
  10866. $core.method({
  10867. selector: "asArray",
  10868. protocol: 'converting',
  10869. fn: function (){
  10870. var self=this;
  10871. return $core.withContext(function($ctx1) {
  10872. return $recv($globals.Array)._withAll_(self);
  10873. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  10874. },
  10875. args: [],
  10876. source: "asArray\x0a\x09^ Array withAll: self",
  10877. referencedClasses: ["Array"],
  10878. messageSends: ["withAll:"]
  10879. }),
  10880. $globals.Collection);
  10881. $core.addMethod(
  10882. $core.method({
  10883. selector: "asJSON",
  10884. protocol: 'converting',
  10885. fn: function (){
  10886. var self=this;
  10887. return $core.withContext(function($ctx1) {
  10888. return $recv(self._asArray())._collect_((function(each){
  10889. return $core.withContext(function($ctx2) {
  10890. return $recv(each)._asJSON();
  10891. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10892. }));
  10893. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)});
  10894. },
  10895. args: [],
  10896. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  10897. referencedClasses: [],
  10898. messageSends: ["collect:", "asArray", "asJSON"]
  10899. }),
  10900. $globals.Collection);
  10901. $core.addMethod(
  10902. $core.method({
  10903. selector: "asOrderedCollection",
  10904. protocol: 'converting',
  10905. fn: function (){
  10906. var self=this;
  10907. return $core.withContext(function($ctx1) {
  10908. return self._asArray();
  10909. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  10910. },
  10911. args: [],
  10912. source: "asOrderedCollection\x0a\x09^ self asArray",
  10913. referencedClasses: [],
  10914. messageSends: ["asArray"]
  10915. }),
  10916. $globals.Collection);
  10917. $core.addMethod(
  10918. $core.method({
  10919. selector: "asSet",
  10920. protocol: 'converting',
  10921. fn: function (){
  10922. var self=this;
  10923. return $core.withContext(function($ctx1) {
  10924. return $recv($globals.Set)._withAll_(self);
  10925. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  10926. },
  10927. args: [],
  10928. source: "asSet\x0a\x09^ Set withAll: self",
  10929. referencedClasses: ["Set"],
  10930. messageSends: ["withAll:"]
  10931. }),
  10932. $globals.Collection);
  10933. $core.addMethod(
  10934. $core.method({
  10935. selector: "collect:",
  10936. protocol: 'enumerating',
  10937. fn: function (aBlock){
  10938. var self=this;
  10939. var stream;
  10940. return $core.withContext(function($ctx1) {
  10941. stream=$recv($recv(self._class())._new())._writeStream();
  10942. self._do_((function(each){
  10943. return $core.withContext(function($ctx2) {
  10944. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  10945. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10946. }));
  10947. return $recv(stream)._contents();
  10948. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  10949. },
  10950. args: ["aBlock"],
  10951. 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",
  10952. referencedClasses: [],
  10953. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  10954. }),
  10955. $globals.Collection);
  10956. $core.addMethod(
  10957. $core.method({
  10958. selector: "copyWith:",
  10959. protocol: 'copying',
  10960. fn: function (anObject){
  10961. var self=this;
  10962. return $core.withContext(function($ctx1) {
  10963. var $1;
  10964. $1=self._copy();
  10965. $recv($1)._add_(anObject);
  10966. return $recv($1)._yourself();
  10967. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  10968. },
  10969. args: ["anObject"],
  10970. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  10971. referencedClasses: [],
  10972. messageSends: ["add:", "copy", "yourself"]
  10973. }),
  10974. $globals.Collection);
  10975. $core.addMethod(
  10976. $core.method({
  10977. selector: "copyWithAll:",
  10978. protocol: 'copying',
  10979. fn: function (aCollection){
  10980. var self=this;
  10981. return $core.withContext(function($ctx1) {
  10982. var $1;
  10983. $1=self._copy();
  10984. $recv($1)._addAll_(aCollection);
  10985. return $recv($1)._yourself();
  10986. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  10987. },
  10988. args: ["aCollection"],
  10989. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  10990. referencedClasses: [],
  10991. messageSends: ["addAll:", "copy", "yourself"]
  10992. }),
  10993. $globals.Collection);
  10994. $core.addMethod(
  10995. $core.method({
  10996. selector: "copyWithoutAll:",
  10997. protocol: 'copying',
  10998. fn: function (aCollection){
  10999. var self=this;
  11000. return $core.withContext(function($ctx1) {
  11001. return self._reject_((function(each){
  11002. return $core.withContext(function($ctx2) {
  11003. return $recv(aCollection)._includes_(each);
  11004. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11005. }));
  11006. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  11007. },
  11008. args: ["aCollection"],
  11009. 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 ]",
  11010. referencedClasses: [],
  11011. messageSends: ["reject:", "includes:"]
  11012. }),
  11013. $globals.Collection);
  11014. $core.addMethod(
  11015. $core.method({
  11016. selector: "deepCopy",
  11017. protocol: 'copying',
  11018. fn: function (){
  11019. var self=this;
  11020. return $core.withContext(function($ctx1) {
  11021. return self._collect_((function(each){
  11022. return $core.withContext(function($ctx2) {
  11023. return $recv(each)._deepCopy();
  11024. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11025. }));
  11026. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  11027. },
  11028. args: [],
  11029. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  11030. referencedClasses: [],
  11031. messageSends: ["collect:", "deepCopy"]
  11032. }),
  11033. $globals.Collection);
  11034. $core.addMethod(
  11035. $core.method({
  11036. selector: "detect:",
  11037. protocol: 'enumerating',
  11038. fn: function (aBlock){
  11039. var self=this;
  11040. return $core.withContext(function($ctx1) {
  11041. return self._detect_ifNone_(aBlock,(function(){
  11042. return $core.withContext(function($ctx2) {
  11043. return self._errorNotFound();
  11044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11045. }));
  11046. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  11047. },
  11048. args: ["aBlock"],
  11049. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  11050. referencedClasses: [],
  11051. messageSends: ["detect:ifNone:", "errorNotFound"]
  11052. }),
  11053. $globals.Collection);
  11054. $core.addMethod(
  11055. $core.method({
  11056. selector: "detect:ifNone:",
  11057. protocol: 'enumerating',
  11058. fn: function (aBlock,anotherBlock){
  11059. var self=this;
  11060. return $core.withContext(function($ctx1) {
  11061. self._subclassResponsibility();
  11062. return self;
  11063. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  11064. },
  11065. args: ["aBlock", "anotherBlock"],
  11066. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  11067. referencedClasses: [],
  11068. messageSends: ["subclassResponsibility"]
  11069. }),
  11070. $globals.Collection);
  11071. $core.addMethod(
  11072. $core.method({
  11073. selector: "do:",
  11074. protocol: 'enumerating',
  11075. fn: function (aBlock){
  11076. var self=this;
  11077. return $core.withContext(function($ctx1) {
  11078. self._subclassResponsibility();
  11079. return self;
  11080. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  11081. },
  11082. args: ["aBlock"],
  11083. source: "do: aBlock\x0a\x09self subclassResponsibility",
  11084. referencedClasses: [],
  11085. messageSends: ["subclassResponsibility"]
  11086. }),
  11087. $globals.Collection);
  11088. $core.addMethod(
  11089. $core.method({
  11090. selector: "do:separatedBy:",
  11091. protocol: 'enumerating',
  11092. fn: function (aBlock,anotherBlock){
  11093. var self=this;
  11094. var actionBeforeElement;
  11095. return $core.withContext(function($ctx1) {
  11096. actionBeforeElement=(function(){
  11097. actionBeforeElement=anotherBlock;
  11098. return actionBeforeElement;
  11099. });
  11100. self._do_((function(each){
  11101. return $core.withContext(function($ctx2) {
  11102. $recv(actionBeforeElement)._value();
  11103. return $recv(aBlock)._value_(each);
  11104. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  11105. }));
  11106. return self;
  11107. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  11108. },
  11109. args: ["aBlock", "anotherBlock"],
  11110. 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 ]",
  11111. referencedClasses: [],
  11112. messageSends: ["do:", "value", "value:"]
  11113. }),
  11114. $globals.Collection);
  11115. $core.addMethod(
  11116. $core.method({
  11117. selector: "errorNotFound",
  11118. protocol: 'error handling',
  11119. fn: function (){
  11120. var self=this;
  11121. return $core.withContext(function($ctx1) {
  11122. self._error_("Object is not in the collection");
  11123. return self;
  11124. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  11125. },
  11126. args: [],
  11127. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  11128. referencedClasses: [],
  11129. messageSends: ["error:"]
  11130. }),
  11131. $globals.Collection);
  11132. $core.addMethod(
  11133. $core.method({
  11134. selector: "ifEmpty:",
  11135. protocol: 'testing',
  11136. fn: function (aBlock){
  11137. var self=this;
  11138. return $core.withContext(function($ctx1) {
  11139. var $1;
  11140. $1=self._isEmpty();
  11141. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  11142. return self;
  11143. }));
  11144. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  11145. },
  11146. args: ["aBlock"],
  11147. 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: aBlock\x0a\x09\x09ifFalse: [ self ]",
  11148. referencedClasses: [],
  11149. messageSends: ["ifTrue:ifFalse:", "isEmpty"]
  11150. }),
  11151. $globals.Collection);
  11152. $core.addMethod(
  11153. $core.method({
  11154. selector: "ifEmpty:ifNotEmpty:",
  11155. protocol: 'testing',
  11156. fn: function (aBlock,anotherBlock){
  11157. var self=this;
  11158. return $core.withContext(function($ctx1) {
  11159. var $1;
  11160. $1=self._isEmpty();
  11161. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  11162. return $core.withContext(function($ctx2) {
  11163. return $recv(anotherBlock)._value_(self);
  11164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11165. }));
  11166. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  11167. },
  11168. args: ["aBlock", "anotherBlock"],
  11169. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  11170. referencedClasses: [],
  11171. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"]
  11172. }),
  11173. $globals.Collection);
  11174. $core.addMethod(
  11175. $core.method({
  11176. selector: "ifNotEmpty:",
  11177. protocol: 'testing',
  11178. fn: function (aBlock){
  11179. var self=this;
  11180. return $core.withContext(function($ctx1) {
  11181. var $1;
  11182. $1=self._notEmpty();
  11183. if($core.assert($1)){
  11184. return $recv(aBlock)._value_(self);
  11185. } else {
  11186. return self;
  11187. };
  11188. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  11189. },
  11190. args: ["aBlock"],
  11191. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  11192. referencedClasses: [],
  11193. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  11194. }),
  11195. $globals.Collection);
  11196. $core.addMethod(
  11197. $core.method({
  11198. selector: "ifNotEmpty:ifEmpty:",
  11199. protocol: 'testing',
  11200. fn: function (aBlock,anotherBlock){
  11201. var self=this;
  11202. return $core.withContext(function($ctx1) {
  11203. var $1;
  11204. $1=self._notEmpty();
  11205. return $recv($1)._ifTrue_ifFalse_((function(){
  11206. return $core.withContext(function($ctx2) {
  11207. return $recv(aBlock)._value_(self);
  11208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11209. }),anotherBlock);
  11210. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  11211. },
  11212. args: ["aBlock", "anotherBlock"],
  11213. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock",
  11214. referencedClasses: [],
  11215. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  11216. }),
  11217. $globals.Collection);
  11218. $core.addMethod(
  11219. $core.method({
  11220. selector: "includes:",
  11221. protocol: 'testing',
  11222. fn: function (anObject){
  11223. var self=this;
  11224. return $core.withContext(function($ctx1) {
  11225. return self._anySatisfy_((function(each){
  11226. return $core.withContext(function($ctx2) {
  11227. return $recv(each).__eq(anObject);
  11228. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11229. }));
  11230. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  11231. },
  11232. args: ["anObject"],
  11233. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  11234. referencedClasses: [],
  11235. messageSends: ["anySatisfy:", "="]
  11236. }),
  11237. $globals.Collection);
  11238. $core.addMethod(
  11239. $core.method({
  11240. selector: "inject:into:",
  11241. protocol: 'enumerating',
  11242. fn: function (anObject,aBlock){
  11243. var self=this;
  11244. var result;
  11245. return $core.withContext(function($ctx1) {
  11246. result=anObject;
  11247. self._do_((function(each){
  11248. return $core.withContext(function($ctx2) {
  11249. result=$recv(aBlock)._value_value_(result,each);
  11250. return result;
  11251. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11252. }));
  11253. return result;
  11254. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  11255. },
  11256. args: ["anObject", "aBlock"],
  11257. 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",
  11258. referencedClasses: [],
  11259. messageSends: ["do:", "value:value:"]
  11260. }),
  11261. $globals.Collection);
  11262. $core.addMethod(
  11263. $core.method({
  11264. selector: "intersection:",
  11265. protocol: 'enumerating',
  11266. fn: function (aCollection){
  11267. var self=this;
  11268. var set,outputSet;
  11269. return $core.withContext(function($ctx1) {
  11270. var $2,$1;
  11271. set=self._asSet();
  11272. outputSet=$recv($globals.Set)._new();
  11273. $recv(aCollection)._do_((function(each){
  11274. return $core.withContext(function($ctx2) {
  11275. $2=$recv(set)._includes_(each);
  11276. $ctx2.sendIdx["includes:"]=1;
  11277. $1=$recv($2)._and_((function(){
  11278. return $core.withContext(function($ctx3) {
  11279. return $recv($recv(outputSet)._includes_(each))._not();
  11280. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  11281. }));
  11282. if($core.assert($1)){
  11283. return $recv(outputSet)._add_(each);
  11284. };
  11285. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11286. }));
  11287. return $recv(self._class())._withAll_($recv(outputSet)._asArray());
  11288. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  11289. },
  11290. args: ["aCollection"],
  11291. 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",
  11292. referencedClasses: ["Set"],
  11293. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  11294. }),
  11295. $globals.Collection);
  11296. $core.addMethod(
  11297. $core.method({
  11298. selector: "isEmpty",
  11299. protocol: 'testing',
  11300. fn: function (){
  11301. var self=this;
  11302. return $core.withContext(function($ctx1) {
  11303. return $recv(self._size()).__eq((0));
  11304. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  11305. },
  11306. args: [],
  11307. source: "isEmpty\x0a\x09^ self size = 0",
  11308. referencedClasses: [],
  11309. messageSends: ["=", "size"]
  11310. }),
  11311. $globals.Collection);
  11312. $core.addMethod(
  11313. $core.method({
  11314. selector: "noneSatisfy:",
  11315. protocol: 'enumerating',
  11316. fn: function (aBlock){
  11317. var self=this;
  11318. return $core.withContext(function($ctx1) {
  11319. var $1;
  11320. var $early={};
  11321. try {
  11322. self._do_((function(item){
  11323. return $core.withContext(function($ctx2) {
  11324. $1=$recv(aBlock)._value_(item);
  11325. if($core.assert($1)){
  11326. throw $early=[false];
  11327. };
  11328. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  11329. }));
  11330. return true;
  11331. }
  11332. catch(e) {if(e===$early)return e[0]; throw e}
  11333. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  11334. },
  11335. args: ["aBlock"],
  11336. 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",
  11337. referencedClasses: [],
  11338. messageSends: ["do:", "ifTrue:", "value:"]
  11339. }),
  11340. $globals.Collection);
  11341. $core.addMethod(
  11342. $core.method({
  11343. selector: "notEmpty",
  11344. protocol: 'testing',
  11345. fn: function (){
  11346. var self=this;
  11347. return $core.withContext(function($ctx1) {
  11348. return $recv(self._isEmpty())._not();
  11349. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  11350. },
  11351. args: [],
  11352. source: "notEmpty\x0a\x09^ self isEmpty not",
  11353. referencedClasses: [],
  11354. messageSends: ["not", "isEmpty"]
  11355. }),
  11356. $globals.Collection);
  11357. $core.addMethod(
  11358. $core.method({
  11359. selector: "occurrencesOf:",
  11360. protocol: 'accessing',
  11361. fn: function (anObject){
  11362. var self=this;
  11363. var tally;
  11364. return $core.withContext(function($ctx1) {
  11365. var $1;
  11366. tally=(0);
  11367. self._do_((function(each){
  11368. return $core.withContext(function($ctx2) {
  11369. $1=$recv(anObject).__eq(each);
  11370. if($core.assert($1)){
  11371. tally=$recv(tally).__plus((1));
  11372. return tally;
  11373. };
  11374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11375. }));
  11376. return tally;
  11377. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  11378. },
  11379. args: ["anObject"],
  11380. 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",
  11381. referencedClasses: [],
  11382. messageSends: ["do:", "ifTrue:", "=", "+"]
  11383. }),
  11384. $globals.Collection);
  11385. $core.addMethod(
  11386. $core.method({
  11387. selector: "putOn:",
  11388. protocol: 'streaming',
  11389. fn: function (aStream){
  11390. var self=this;
  11391. return $core.withContext(function($ctx1) {
  11392. self._do_((function(each){
  11393. return $core.withContext(function($ctx2) {
  11394. return $recv(each)._putOn_(aStream);
  11395. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11396. }));
  11397. return self;
  11398. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  11399. },
  11400. args: ["aStream"],
  11401. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  11402. referencedClasses: [],
  11403. messageSends: ["do:", "putOn:"]
  11404. }),
  11405. $globals.Collection);
  11406. $core.addMethod(
  11407. $core.method({
  11408. selector: "reject:",
  11409. protocol: 'enumerating',
  11410. fn: function (aBlock){
  11411. var self=this;
  11412. return $core.withContext(function($ctx1) {
  11413. return self._select_((function(each){
  11414. return $core.withContext(function($ctx2) {
  11415. return $recv($recv(aBlock)._value_(each)).__eq(false);
  11416. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11417. }));
  11418. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  11419. },
  11420. args: ["aBlock"],
  11421. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  11422. referencedClasses: [],
  11423. messageSends: ["select:", "=", "value:"]
  11424. }),
  11425. $globals.Collection);
  11426. $core.addMethod(
  11427. $core.method({
  11428. selector: "remove:",
  11429. protocol: 'adding/removing',
  11430. fn: function (anObject){
  11431. var self=this;
  11432. return $core.withContext(function($ctx1) {
  11433. return self._remove_ifAbsent_(anObject,(function(){
  11434. return $core.withContext(function($ctx2) {
  11435. return self._errorNotFound();
  11436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11437. }));
  11438. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  11439. },
  11440. args: ["anObject"],
  11441. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  11442. referencedClasses: [],
  11443. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  11444. }),
  11445. $globals.Collection);
  11446. $core.addMethod(
  11447. $core.method({
  11448. selector: "remove:ifAbsent:",
  11449. protocol: 'adding/removing',
  11450. fn: function (anObject,aBlock){
  11451. var self=this;
  11452. return $core.withContext(function($ctx1) {
  11453. self._subclassResponsibility();
  11454. return self;
  11455. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  11456. },
  11457. args: ["anObject", "aBlock"],
  11458. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  11459. referencedClasses: [],
  11460. messageSends: ["subclassResponsibility"]
  11461. }),
  11462. $globals.Collection);
  11463. $core.addMethod(
  11464. $core.method({
  11465. selector: "removeAll",
  11466. protocol: 'adding/removing',
  11467. fn: function (){
  11468. var self=this;
  11469. return $core.withContext(function($ctx1) {
  11470. self._subclassResponsibility();
  11471. return self;
  11472. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  11473. },
  11474. args: [],
  11475. source: "removeAll\x0a\x09self subclassResponsibility",
  11476. referencedClasses: [],
  11477. messageSends: ["subclassResponsibility"]
  11478. }),
  11479. $globals.Collection);
  11480. $core.addMethod(
  11481. $core.method({
  11482. selector: "select:",
  11483. protocol: 'enumerating',
  11484. fn: function (aBlock){
  11485. var self=this;
  11486. var stream;
  11487. return $core.withContext(function($ctx1) {
  11488. var $1;
  11489. stream=$recv($recv(self._class())._new())._writeStream();
  11490. self._do_((function(each){
  11491. return $core.withContext(function($ctx2) {
  11492. $1=$recv(aBlock)._value_(each);
  11493. if($core.assert($1)){
  11494. return $recv(stream)._nextPut_(each);
  11495. };
  11496. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11497. }));
  11498. return $recv(stream)._contents();
  11499. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  11500. },
  11501. args: ["aBlock"],
  11502. 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",
  11503. referencedClasses: [],
  11504. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11505. }),
  11506. $globals.Collection);
  11507. $core.addMethod(
  11508. $core.method({
  11509. selector: "select:thenCollect:",
  11510. protocol: 'enumerating',
  11511. fn: function (selectBlock,collectBlock){
  11512. var self=this;
  11513. var stream;
  11514. return $core.withContext(function($ctx1) {
  11515. var $1;
  11516. stream=$recv($recv(self._class())._new())._writeStream();
  11517. self._do_((function(each){
  11518. return $core.withContext(function($ctx2) {
  11519. $1=$recv(selectBlock)._value_(each);
  11520. $ctx2.sendIdx["value:"]=1;
  11521. if($core.assert($1)){
  11522. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  11523. };
  11524. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11525. }));
  11526. return $recv(stream)._contents();
  11527. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  11528. },
  11529. args: ["selectBlock", "collectBlock"],
  11530. 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",
  11531. referencedClasses: [],
  11532. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11533. }),
  11534. $globals.Collection);
  11535. $core.addMethod(
  11536. $core.method({
  11537. selector: "shallowCopy",
  11538. protocol: 'copying',
  11539. fn: function (){
  11540. var self=this;
  11541. return $core.withContext(function($ctx1) {
  11542. return self._collect_((function(each){
  11543. return each;
  11544. }));
  11545. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  11546. },
  11547. args: [],
  11548. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  11549. referencedClasses: [],
  11550. messageSends: ["collect:"]
  11551. }),
  11552. $globals.Collection);
  11553. $core.addMethod(
  11554. $core.method({
  11555. selector: "size",
  11556. protocol: 'accessing',
  11557. fn: function (){
  11558. var self=this;
  11559. return $core.withContext(function($ctx1) {
  11560. self._subclassResponsibility();
  11561. return self;
  11562. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  11563. },
  11564. args: [],
  11565. source: "size\x0a\x09self subclassResponsibility",
  11566. referencedClasses: [],
  11567. messageSends: ["subclassResponsibility"]
  11568. }),
  11569. $globals.Collection);
  11570. $core.addMethod(
  11571. $core.method({
  11572. selector: "classTag",
  11573. protocol: 'accessing',
  11574. fn: function (){
  11575. var self=this;
  11576. return "collection";
  11577. },
  11578. args: [],
  11579. 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'",
  11580. referencedClasses: [],
  11581. messageSends: []
  11582. }),
  11583. $globals.Collection.klass);
  11584. $core.addMethod(
  11585. $core.method({
  11586. selector: "new:",
  11587. protocol: 'instance creation',
  11588. fn: function (anInteger){
  11589. var self=this;
  11590. return $core.withContext(function($ctx1) {
  11591. return self._new();
  11592. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  11593. },
  11594. args: ["anInteger"],
  11595. source: "new: anInteger\x0a\x09^ self new",
  11596. referencedClasses: [],
  11597. messageSends: ["new"]
  11598. }),
  11599. $globals.Collection.klass);
  11600. $core.addMethod(
  11601. $core.method({
  11602. selector: "with:",
  11603. protocol: 'instance creation',
  11604. fn: function (anObject){
  11605. var self=this;
  11606. return $core.withContext(function($ctx1) {
  11607. var $1;
  11608. $1=self._new();
  11609. $recv($1)._add_(anObject);
  11610. return $recv($1)._yourself();
  11611. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  11612. },
  11613. args: ["anObject"],
  11614. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  11615. referencedClasses: [],
  11616. messageSends: ["add:", "new", "yourself"]
  11617. }),
  11618. $globals.Collection.klass);
  11619. $core.addMethod(
  11620. $core.method({
  11621. selector: "with:with:",
  11622. protocol: 'instance creation',
  11623. fn: function (anObject,anotherObject){
  11624. var self=this;
  11625. return $core.withContext(function($ctx1) {
  11626. var $1;
  11627. $1=self._new();
  11628. $recv($1)._add_(anObject);
  11629. $ctx1.sendIdx["add:"]=1;
  11630. $recv($1)._add_(anotherObject);
  11631. return $recv($1)._yourself();
  11632. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  11633. },
  11634. args: ["anObject", "anotherObject"],
  11635. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  11636. referencedClasses: [],
  11637. messageSends: ["add:", "new", "yourself"]
  11638. }),
  11639. $globals.Collection.klass);
  11640. $core.addMethod(
  11641. $core.method({
  11642. selector: "with:with:with:",
  11643. protocol: 'instance creation',
  11644. fn: function (firstObject,secondObject,thirdObject){
  11645. var self=this;
  11646. return $core.withContext(function($ctx1) {
  11647. var $1;
  11648. $1=self._new();
  11649. $recv($1)._add_(firstObject);
  11650. $ctx1.sendIdx["add:"]=1;
  11651. $recv($1)._add_(secondObject);
  11652. $ctx1.sendIdx["add:"]=2;
  11653. $recv($1)._add_(thirdObject);
  11654. return $recv($1)._yourself();
  11655. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  11656. },
  11657. args: ["firstObject", "secondObject", "thirdObject"],
  11658. 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",
  11659. referencedClasses: [],
  11660. messageSends: ["add:", "new", "yourself"]
  11661. }),
  11662. $globals.Collection.klass);
  11663. $core.addMethod(
  11664. $core.method({
  11665. selector: "withAll:",
  11666. protocol: 'instance creation',
  11667. fn: function (aCollection){
  11668. var self=this;
  11669. return $core.withContext(function($ctx1) {
  11670. var $1;
  11671. $1=self._new();
  11672. $recv($1)._addAll_(aCollection);
  11673. return $recv($1)._yourself();
  11674. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  11675. },
  11676. args: ["aCollection"],
  11677. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  11678. referencedClasses: [],
  11679. messageSends: ["addAll:", "new", "yourself"]
  11680. }),
  11681. $globals.Collection.klass);
  11682. $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections');
  11683. $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.";
  11684. $core.addMethod(
  11685. $core.method({
  11686. selector: "at:",
  11687. protocol: 'accessing',
  11688. fn: function (anIndex){
  11689. var self=this;
  11690. return $core.withContext(function($ctx1) {
  11691. return self._at_ifAbsent_(anIndex,(function(){
  11692. return $core.withContext(function($ctx2) {
  11693. return self._errorNotFound();
  11694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11695. }));
  11696. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  11697. },
  11698. args: ["anIndex"],
  11699. 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 ]",
  11700. referencedClasses: [],
  11701. messageSends: ["at:ifAbsent:", "errorNotFound"]
  11702. }),
  11703. $globals.IndexableCollection);
  11704. $core.addMethod(
  11705. $core.method({
  11706. selector: "at:ifAbsent:",
  11707. protocol: 'accessing',
  11708. fn: function (anIndex,aBlock){
  11709. var self=this;
  11710. return $core.withContext(function($ctx1) {
  11711. self._subclassResponsibility();
  11712. return self;
  11713. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11714. },
  11715. args: ["anIndex", "aBlock"],
  11716. 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",
  11717. referencedClasses: [],
  11718. messageSends: ["subclassResponsibility"]
  11719. }),
  11720. $globals.IndexableCollection);
  11721. $core.addMethod(
  11722. $core.method({
  11723. selector: "at:ifAbsentPut:",
  11724. protocol: 'accessing',
  11725. fn: function (aKey,aBlock){
  11726. var self=this;
  11727. return $core.withContext(function($ctx1) {
  11728. return self._at_ifAbsent_(aKey,(function(){
  11729. return $core.withContext(function($ctx2) {
  11730. return self._at_put_(aKey,$recv(aBlock)._value());
  11731. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11732. }));
  11733. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  11734. },
  11735. args: ["aKey", "aBlock"],
  11736. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  11737. referencedClasses: [],
  11738. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  11739. }),
  11740. $globals.IndexableCollection);
  11741. $core.addMethod(
  11742. $core.method({
  11743. selector: "at:ifPresent:",
  11744. protocol: 'accessing',
  11745. fn: function (anIndex,aBlock){
  11746. var self=this;
  11747. return $core.withContext(function($ctx1) {
  11748. return self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  11749. return nil;
  11750. }));
  11751. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11752. },
  11753. args: ["anIndex", "aBlock"],
  11754. 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 ]",
  11755. referencedClasses: [],
  11756. messageSends: ["at:ifPresent:ifAbsent:"]
  11757. }),
  11758. $globals.IndexableCollection);
  11759. $core.addMethod(
  11760. $core.method({
  11761. selector: "at:ifPresent:ifAbsent:",
  11762. protocol: 'accessing',
  11763. fn: function (anIndex,aBlock,anotherBlock){
  11764. var self=this;
  11765. return $core.withContext(function($ctx1) {
  11766. self._subclassResponsibility();
  11767. return self;
  11768. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  11769. },
  11770. args: ["anIndex", "aBlock", "anotherBlock"],
  11771. 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",
  11772. referencedClasses: [],
  11773. messageSends: ["subclassResponsibility"]
  11774. }),
  11775. $globals.IndexableCollection);
  11776. $core.addMethod(
  11777. $core.method({
  11778. selector: "at:put:",
  11779. protocol: 'accessing',
  11780. fn: function (anIndex,anObject){
  11781. var self=this;
  11782. return $core.withContext(function($ctx1) {
  11783. self._subclassResponsibility();
  11784. return self;
  11785. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  11786. },
  11787. args: ["anIndex", "anObject"],
  11788. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  11789. referencedClasses: [],
  11790. messageSends: ["subclassResponsibility"]
  11791. }),
  11792. $globals.IndexableCollection);
  11793. $core.addMethod(
  11794. $core.method({
  11795. selector: "indexOf:",
  11796. protocol: 'accessing',
  11797. fn: function (anObject){
  11798. var self=this;
  11799. return $core.withContext(function($ctx1) {
  11800. return self._indexOf_ifAbsent_(anObject,(function(){
  11801. return $core.withContext(function($ctx2) {
  11802. return self._errorNotFound();
  11803. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11804. }));
  11805. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  11806. },
  11807. args: ["anObject"],
  11808. 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 ]",
  11809. referencedClasses: [],
  11810. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  11811. }),
  11812. $globals.IndexableCollection);
  11813. $core.addMethod(
  11814. $core.method({
  11815. selector: "indexOf:ifAbsent:",
  11816. protocol: 'accessing',
  11817. fn: function (anObject,aBlock){
  11818. var self=this;
  11819. return $core.withContext(function($ctx1) {
  11820. self._subclassResponsibility();
  11821. return self;
  11822. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  11823. },
  11824. args: ["anObject", "aBlock"],
  11825. 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",
  11826. referencedClasses: [],
  11827. messageSends: ["subclassResponsibility"]
  11828. }),
  11829. $globals.IndexableCollection);
  11830. $core.addMethod(
  11831. $core.method({
  11832. selector: "with:do:",
  11833. protocol: 'enumerating',
  11834. fn: function (anotherCollection,aBlock){
  11835. var self=this;
  11836. return $core.withContext(function($ctx1) {
  11837. self._withIndexDo_((function(each,index){
  11838. return $core.withContext(function($ctx2) {
  11839. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  11840. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  11841. }));
  11842. return self;
  11843. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  11844. },
  11845. args: ["anotherCollection", "aBlock"],
  11846. 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) ]",
  11847. referencedClasses: [],
  11848. messageSends: ["withIndexDo:", "value:value:", "at:"]
  11849. }),
  11850. $globals.IndexableCollection);
  11851. $core.addMethod(
  11852. $core.method({
  11853. selector: "withIndexDo:",
  11854. protocol: 'enumerating',
  11855. fn: function (aBlock){
  11856. var self=this;
  11857. return $core.withContext(function($ctx1) {
  11858. self._subclassResponsibility();
  11859. return self;
  11860. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  11861. },
  11862. args: ["aBlock"],
  11863. 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",
  11864. referencedClasses: [],
  11865. messageSends: ["subclassResponsibility"]
  11866. }),
  11867. $globals.IndexableCollection);
  11868. $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  11869. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  11870. $core.addMethod(
  11871. $core.method({
  11872. selector: "=",
  11873. protocol: 'comparing',
  11874. fn: function (anAssocitativeCollection){
  11875. var self=this;
  11876. return $core.withContext(function($ctx1) {
  11877. var $2,$1,$4,$3,$5;
  11878. $2=self._class();
  11879. $ctx1.sendIdx["class"]=1;
  11880. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  11881. $ctx1.sendIdx["="]=1;
  11882. if(!$core.assert($1)){
  11883. return false;
  11884. };
  11885. $4=self._size();
  11886. $ctx1.sendIdx["size"]=1;
  11887. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  11888. $ctx1.sendIdx["="]=2;
  11889. if(!$core.assert($3)){
  11890. return false;
  11891. };
  11892. $5=self._associations();
  11893. $ctx1.sendIdx["associations"]=1;
  11894. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  11895. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  11896. },
  11897. args: ["anAssocitativeCollection"],
  11898. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  11899. referencedClasses: [],
  11900. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  11901. }),
  11902. $globals.AssociativeCollection);
  11903. $core.addMethod(
  11904. $core.method({
  11905. selector: "add:",
  11906. protocol: 'adding/removing',
  11907. fn: function (anAssociation){
  11908. var self=this;
  11909. return $core.withContext(function($ctx1) {
  11910. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  11911. return self;
  11912. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  11913. },
  11914. args: ["anAssociation"],
  11915. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  11916. referencedClasses: [],
  11917. messageSends: ["at:put:", "key", "value"]
  11918. }),
  11919. $globals.AssociativeCollection);
  11920. $core.addMethod(
  11921. $core.method({
  11922. selector: "addAll:",
  11923. protocol: 'adding/removing',
  11924. fn: function (anAssociativeCollection){
  11925. var self=this;
  11926. return $core.withContext(function($ctx1) {
  11927. (
  11928. $ctx1.supercall = true,
  11929. ($globals.AssociativeCollection.superclass||$boot.dnu).fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  11930. $ctx1.supercall = false;
  11931. return anAssociativeCollection;
  11932. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  11933. },
  11934. args: ["anAssociativeCollection"],
  11935. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  11936. referencedClasses: [],
  11937. messageSends: ["addAll:", "associations"]
  11938. }),
  11939. $globals.AssociativeCollection);
  11940. $core.addMethod(
  11941. $core.method({
  11942. selector: "asDictionary",
  11943. protocol: 'converting',
  11944. fn: function (){
  11945. var self=this;
  11946. return $core.withContext(function($ctx1) {
  11947. return $recv($globals.Dictionary)._from_(self._associations());
  11948. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  11949. },
  11950. args: [],
  11951. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  11952. referencedClasses: ["Dictionary"],
  11953. messageSends: ["from:", "associations"]
  11954. }),
  11955. $globals.AssociativeCollection);
  11956. $core.addMethod(
  11957. $core.method({
  11958. selector: "asHashedCollection",
  11959. protocol: 'converting',
  11960. fn: function (){
  11961. var self=this;
  11962. return $core.withContext(function($ctx1) {
  11963. return $recv($globals.HashedCollection)._from_(self._associations());
  11964. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  11965. },
  11966. args: [],
  11967. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  11968. referencedClasses: ["HashedCollection"],
  11969. messageSends: ["from:", "associations"]
  11970. }),
  11971. $globals.AssociativeCollection);
  11972. $core.addMethod(
  11973. $core.method({
  11974. selector: "asJSON",
  11975. protocol: 'converting',
  11976. fn: function (){
  11977. var self=this;
  11978. var hash;
  11979. return $core.withContext(function($ctx1) {
  11980. hash=$recv($globals.HashedCollection)._new();
  11981. self._keysAndValuesDo_((function(key,value){
  11982. return $core.withContext(function($ctx2) {
  11983. return $recv(hash)._at_put_(key,$recv(value)._asJSON());
  11984. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11985. }));
  11986. return hash;
  11987. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
  11988. },
  11989. args: [],
  11990. 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",
  11991. referencedClasses: ["HashedCollection"],
  11992. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  11993. }),
  11994. $globals.AssociativeCollection);
  11995. $core.addMethod(
  11996. $core.method({
  11997. selector: "associations",
  11998. protocol: 'accessing',
  11999. fn: function (){
  12000. var self=this;
  12001. var associations;
  12002. return $core.withContext(function($ctx1) {
  12003. associations=[];
  12004. self._associationsDo_((function(each){
  12005. return $core.withContext(function($ctx2) {
  12006. return $recv(associations)._add_(each);
  12007. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12008. }));
  12009. return associations;
  12010. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  12011. },
  12012. args: [],
  12013. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  12014. referencedClasses: [],
  12015. messageSends: ["associationsDo:", "add:"]
  12016. }),
  12017. $globals.AssociativeCollection);
  12018. $core.addMethod(
  12019. $core.method({
  12020. selector: "associationsDo:",
  12021. protocol: 'enumerating',
  12022. fn: function (aBlock){
  12023. var self=this;
  12024. return $core.withContext(function($ctx1) {
  12025. self._keysAndValuesDo_((function(key,value){
  12026. return $core.withContext(function($ctx2) {
  12027. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  12028. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12029. }));
  12030. return self;
  12031. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12032. },
  12033. args: ["aBlock"],
  12034. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  12035. referencedClasses: ["Association"],
  12036. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  12037. }),
  12038. $globals.AssociativeCollection);
  12039. $core.addMethod(
  12040. $core.method({
  12041. selector: "at:ifPresent:ifAbsent:",
  12042. protocol: 'accessing',
  12043. fn: function (aKey,aBlock,anotherBlock){
  12044. var self=this;
  12045. return $core.withContext(function($ctx1) {
  12046. var $1;
  12047. $1=self._includesKey_(aKey);
  12048. if($core.assert($1)){
  12049. return $recv(aBlock)._value_(self._at_(aKey));
  12050. } else {
  12051. return $recv(anotherBlock)._value();
  12052. };
  12053. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  12054. },
  12055. args: ["aKey", "aBlock", "anotherBlock"],
  12056. 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 ]",
  12057. referencedClasses: [],
  12058. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  12059. }),
  12060. $globals.AssociativeCollection);
  12061. $core.addMethod(
  12062. $core.method({
  12063. selector: "collect:",
  12064. protocol: 'enumerating',
  12065. fn: function (aBlock){
  12066. var self=this;
  12067. var newDict;
  12068. return $core.withContext(function($ctx1) {
  12069. newDict=$recv(self._class())._new();
  12070. self._keysAndValuesDo_((function(key,value){
  12071. return $core.withContext(function($ctx2) {
  12072. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  12073. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12074. }));
  12075. return newDict;
  12076. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12077. },
  12078. args: ["aBlock"],
  12079. 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",
  12080. referencedClasses: [],
  12081. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  12082. }),
  12083. $globals.AssociativeCollection);
  12084. $core.addMethod(
  12085. $core.method({
  12086. selector: "deepCopy",
  12087. protocol: 'copying',
  12088. fn: function (){
  12089. var self=this;
  12090. var copy;
  12091. return $core.withContext(function($ctx1) {
  12092. copy=$recv(self._class())._new();
  12093. self._keysAndValuesDo_((function(key,value){
  12094. return $core.withContext(function($ctx2) {
  12095. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  12096. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12097. }));
  12098. return copy;
  12099. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  12100. },
  12101. args: [],
  12102. 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",
  12103. referencedClasses: [],
  12104. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  12105. }),
  12106. $globals.AssociativeCollection);
  12107. $core.addMethod(
  12108. $core.method({
  12109. selector: "detect:ifNone:",
  12110. protocol: 'enumerating',
  12111. fn: function (aBlock,anotherBlock){
  12112. var self=this;
  12113. return $core.withContext(function($ctx1) {
  12114. return $recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  12115. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  12116. },
  12117. args: ["aBlock", "anotherBlock"],
  12118. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  12119. referencedClasses: [],
  12120. messageSends: ["detect:ifNone:", "values"]
  12121. }),
  12122. $globals.AssociativeCollection);
  12123. $core.addMethod(
  12124. $core.method({
  12125. selector: "do:",
  12126. protocol: 'enumerating',
  12127. fn: function (aBlock){
  12128. var self=this;
  12129. return $core.withContext(function($ctx1) {
  12130. self._valuesDo_(aBlock);
  12131. return self;
  12132. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12133. },
  12134. args: ["aBlock"],
  12135. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  12136. referencedClasses: [],
  12137. messageSends: ["valuesDo:"]
  12138. }),
  12139. $globals.AssociativeCollection);
  12140. $core.addMethod(
  12141. $core.method({
  12142. selector: "includes:",
  12143. protocol: 'enumerating',
  12144. fn: function (anObject){
  12145. var self=this;
  12146. return $core.withContext(function($ctx1) {
  12147. return $recv(self._values())._includes_(anObject);
  12148. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  12149. },
  12150. args: ["anObject"],
  12151. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  12152. referencedClasses: [],
  12153. messageSends: ["includes:", "values"]
  12154. }),
  12155. $globals.AssociativeCollection);
  12156. $core.addMethod(
  12157. $core.method({
  12158. selector: "includesKey:",
  12159. protocol: 'testing',
  12160. fn: function (aKey){
  12161. var self=this;
  12162. return $core.withContext(function($ctx1) {
  12163. self._subclassResponsibility();
  12164. return self;
  12165. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12166. },
  12167. args: ["aKey"],
  12168. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  12169. referencedClasses: [],
  12170. messageSends: ["subclassResponsibility"]
  12171. }),
  12172. $globals.AssociativeCollection);
  12173. $core.addMethod(
  12174. $core.method({
  12175. selector: "indexOf:ifAbsent:",
  12176. protocol: 'accessing',
  12177. fn: function (anObject,aBlock){
  12178. var self=this;
  12179. return $core.withContext(function($ctx1) {
  12180. return $recv(self._keys())._detect_ifNone_((function(each){
  12181. return $core.withContext(function($ctx2) {
  12182. return $recv(self._at_(each)).__eq(anObject);
  12183. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12184. }),aBlock);
  12185. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12186. },
  12187. args: ["anObject", "aBlock"],
  12188. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  12189. referencedClasses: [],
  12190. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  12191. }),
  12192. $globals.AssociativeCollection);
  12193. $core.addMethod(
  12194. $core.method({
  12195. selector: "keyAtValue:",
  12196. protocol: 'accessing',
  12197. fn: function (anObject){
  12198. var self=this;
  12199. return $core.withContext(function($ctx1) {
  12200. return self._keyAtValue_ifAbsent_(anObject,(function(){
  12201. return $core.withContext(function($ctx2) {
  12202. return self._errorNotFound();
  12203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12204. }));
  12205. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  12206. },
  12207. args: ["anObject"],
  12208. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  12209. referencedClasses: [],
  12210. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  12211. }),
  12212. $globals.AssociativeCollection);
  12213. $core.addMethod(
  12214. $core.method({
  12215. selector: "keyAtValue:ifAbsent:",
  12216. protocol: 'accessing',
  12217. fn: function (anObject,aBlock){
  12218. var self=this;
  12219. return $core.withContext(function($ctx1) {
  12220. return self._indexOf_ifAbsent_(anObject,aBlock);
  12221. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12222. },
  12223. args: ["anObject", "aBlock"],
  12224. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  12225. referencedClasses: [],
  12226. messageSends: ["indexOf:ifAbsent:"]
  12227. }),
  12228. $globals.AssociativeCollection);
  12229. $core.addMethod(
  12230. $core.method({
  12231. selector: "keys",
  12232. protocol: 'accessing',
  12233. fn: function (){
  12234. var self=this;
  12235. return $core.withContext(function($ctx1) {
  12236. self._subclassResponsibility();
  12237. return self;
  12238. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  12239. },
  12240. args: [],
  12241. source: "keys\x0a\x09self subclassResponsibility",
  12242. referencedClasses: [],
  12243. messageSends: ["subclassResponsibility"]
  12244. }),
  12245. $globals.AssociativeCollection);
  12246. $core.addMethod(
  12247. $core.method({
  12248. selector: "keysAndValuesDo:",
  12249. protocol: 'enumerating',
  12250. fn: function (aBlock){
  12251. var self=this;
  12252. return $core.withContext(function($ctx1) {
  12253. self._keysDo_((function(each){
  12254. return $core.withContext(function($ctx2) {
  12255. return $recv(aBlock)._value_value_(each,self._at_(each));
  12256. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12257. }));
  12258. return self;
  12259. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12260. },
  12261. args: ["aBlock"],
  12262. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  12263. referencedClasses: [],
  12264. messageSends: ["keysDo:", "value:value:", "at:"]
  12265. }),
  12266. $globals.AssociativeCollection);
  12267. $core.addMethod(
  12268. $core.method({
  12269. selector: "keysDo:",
  12270. protocol: 'enumerating',
  12271. fn: function (aBlock){
  12272. var self=this;
  12273. return $core.withContext(function($ctx1) {
  12274. self._subclassResponsibility();
  12275. return self;
  12276. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12277. },
  12278. args: ["aBlock"],
  12279. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  12280. referencedClasses: [],
  12281. messageSends: ["subclassResponsibility"]
  12282. }),
  12283. $globals.AssociativeCollection);
  12284. $core.addMethod(
  12285. $core.method({
  12286. selector: "printOn:",
  12287. protocol: 'printing',
  12288. fn: function (aStream){
  12289. var self=this;
  12290. return $core.withContext(function($ctx1) {
  12291. (
  12292. $ctx1.supercall = true,
  12293. ($globals.AssociativeCollection.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  12294. $ctx1.supercall = false;
  12295. $ctx1.sendIdx["printOn:"]=1;
  12296. $recv(aStream)._nextPutAll_(" (");
  12297. $ctx1.sendIdx["nextPutAll:"]=1;
  12298. $recv(self._associations())._do_separatedBy_((function(each){
  12299. return $core.withContext(function($ctx2) {
  12300. return $recv(each)._printOn_(aStream);
  12301. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12302. }),(function(){
  12303. return $core.withContext(function($ctx2) {
  12304. return $recv(aStream)._nextPutAll_(" , ");
  12305. $ctx2.sendIdx["nextPutAll:"]=2;
  12306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12307. }));
  12308. $recv(aStream)._nextPutAll_(")");
  12309. return self;
  12310. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  12311. },
  12312. args: ["aStream"],
  12313. 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: ')'",
  12314. referencedClasses: [],
  12315. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  12316. }),
  12317. $globals.AssociativeCollection);
  12318. $core.addMethod(
  12319. $core.method({
  12320. selector: "remove:ifAbsent:",
  12321. protocol: 'adding/removing',
  12322. fn: function (aKey,aBlock){
  12323. var self=this;
  12324. return $core.withContext(function($ctx1) {
  12325. return self._removeKey_ifAbsent_(aKey,aBlock);
  12326. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12327. },
  12328. args: ["aKey", "aBlock"],
  12329. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  12330. referencedClasses: [],
  12331. messageSends: ["removeKey:ifAbsent:"]
  12332. }),
  12333. $globals.AssociativeCollection);
  12334. $core.addMethod(
  12335. $core.method({
  12336. selector: "removeAll",
  12337. protocol: 'adding/removing',
  12338. fn: function (){
  12339. var self=this;
  12340. return $core.withContext(function($ctx1) {
  12341. return $recv(self._keys())._do_((function(each){
  12342. return $core.withContext(function($ctx2) {
  12343. return self._removeKey_(each);
  12344. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12345. }));
  12346. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  12347. },
  12348. args: [],
  12349. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  12350. referencedClasses: [],
  12351. messageSends: ["do:", "keys", "removeKey:"]
  12352. }),
  12353. $globals.AssociativeCollection);
  12354. $core.addMethod(
  12355. $core.method({
  12356. selector: "removeKey:",
  12357. protocol: 'adding/removing',
  12358. fn: function (aKey){
  12359. var self=this;
  12360. return $core.withContext(function($ctx1) {
  12361. return self._remove_(aKey);
  12362. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12363. },
  12364. args: ["aKey"],
  12365. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  12366. referencedClasses: [],
  12367. messageSends: ["remove:"]
  12368. }),
  12369. $globals.AssociativeCollection);
  12370. $core.addMethod(
  12371. $core.method({
  12372. selector: "removeKey:ifAbsent:",
  12373. protocol: 'adding/removing',
  12374. fn: function (aKey,aBlock){
  12375. var self=this;
  12376. return $core.withContext(function($ctx1) {
  12377. self._subclassResponsibility();
  12378. return self;
  12379. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12380. },
  12381. args: ["aKey", "aBlock"],
  12382. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  12383. referencedClasses: [],
  12384. messageSends: ["subclassResponsibility"]
  12385. }),
  12386. $globals.AssociativeCollection);
  12387. $core.addMethod(
  12388. $core.method({
  12389. selector: "select:",
  12390. protocol: 'enumerating',
  12391. fn: function (aBlock){
  12392. var self=this;
  12393. var newDict;
  12394. return $core.withContext(function($ctx1) {
  12395. var $1;
  12396. newDict=$recv(self._class())._new();
  12397. self._keysAndValuesDo_((function(key,value){
  12398. return $core.withContext(function($ctx2) {
  12399. $1=$recv(aBlock)._value_(value);
  12400. if($core.assert($1)){
  12401. return $recv(newDict)._at_put_(key,value);
  12402. };
  12403. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12404. }));
  12405. return newDict;
  12406. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12407. },
  12408. args: ["aBlock"],
  12409. 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",
  12410. referencedClasses: [],
  12411. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  12412. }),
  12413. $globals.AssociativeCollection);
  12414. $core.addMethod(
  12415. $core.method({
  12416. selector: "shallowCopy",
  12417. protocol: 'copying',
  12418. fn: function (){
  12419. var self=this;
  12420. var copy;
  12421. return $core.withContext(function($ctx1) {
  12422. copy=$recv(self._class())._new();
  12423. self._keysAndValuesDo_((function(key,value){
  12424. return $core.withContext(function($ctx2) {
  12425. return $recv(copy)._at_put_(key,value);
  12426. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12427. }));
  12428. return copy;
  12429. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  12430. },
  12431. args: [],
  12432. 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",
  12433. referencedClasses: [],
  12434. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  12435. }),
  12436. $globals.AssociativeCollection);
  12437. $core.addMethod(
  12438. $core.method({
  12439. selector: "size",
  12440. protocol: 'accessing',
  12441. fn: function (){
  12442. var self=this;
  12443. return $core.withContext(function($ctx1) {
  12444. return $recv(self._keys())._size();
  12445. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  12446. },
  12447. args: [],
  12448. source: "size\x0a\x09^ self keys size",
  12449. referencedClasses: [],
  12450. messageSends: ["size", "keys"]
  12451. }),
  12452. $globals.AssociativeCollection);
  12453. $core.addMethod(
  12454. $core.method({
  12455. selector: "values",
  12456. protocol: 'accessing',
  12457. fn: function (){
  12458. var self=this;
  12459. return $core.withContext(function($ctx1) {
  12460. self._subclassResponsibility();
  12461. return self;
  12462. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  12463. },
  12464. args: [],
  12465. source: "values\x0a\x09self subclassResponsibility",
  12466. referencedClasses: [],
  12467. messageSends: ["subclassResponsibility"]
  12468. }),
  12469. $globals.AssociativeCollection);
  12470. $core.addMethod(
  12471. $core.method({
  12472. selector: "valuesDo:",
  12473. protocol: 'enumerating',
  12474. fn: function (aBlock){
  12475. var self=this;
  12476. return $core.withContext(function($ctx1) {
  12477. self._subclassResponsibility();
  12478. return self;
  12479. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12480. },
  12481. args: ["aBlock"],
  12482. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  12483. referencedClasses: [],
  12484. messageSends: ["subclassResponsibility"]
  12485. }),
  12486. $globals.AssociativeCollection);
  12487. $core.addMethod(
  12488. $core.method({
  12489. selector: "withIndexDo:",
  12490. protocol: 'enumerating',
  12491. fn: function (aBlock){
  12492. var self=this;
  12493. return $core.withContext(function($ctx1) {
  12494. self._keysAndValuesDo_((function(key,value){
  12495. return $core.withContext(function($ctx2) {
  12496. return $recv(aBlock)._value_value_(value,key);
  12497. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12498. }));
  12499. return self;
  12500. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12501. },
  12502. args: ["aBlock"],
  12503. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  12504. referencedClasses: [],
  12505. messageSends: ["keysAndValuesDo:", "value:value:"]
  12506. }),
  12507. $globals.AssociativeCollection);
  12508. $core.addMethod(
  12509. $core.method({
  12510. selector: "from:",
  12511. protocol: 'instance creation',
  12512. fn: function (aCollection){
  12513. var self=this;
  12514. var newCollection;
  12515. return $core.withContext(function($ctx1) {
  12516. newCollection=self._new();
  12517. $recv(aCollection)._do_((function(each){
  12518. return $core.withContext(function($ctx2) {
  12519. return $recv(newCollection)._add_(each);
  12520. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12521. }));
  12522. return newCollection;
  12523. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12524. },
  12525. args: ["aCollection"],
  12526. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  12527. referencedClasses: [],
  12528. messageSends: ["new", "do:", "add:"]
  12529. }),
  12530. $globals.AssociativeCollection.klass);
  12531. $core.addMethod(
  12532. $core.method({
  12533. selector: "fromPairs:",
  12534. protocol: 'instance creation',
  12535. fn: function (aCollection){
  12536. var self=this;
  12537. return $core.withContext(function($ctx1) {
  12538. return self._from_(aCollection);
  12539. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  12540. },
  12541. args: ["aCollection"],
  12542. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  12543. referencedClasses: [],
  12544. messageSends: ["from:"]
  12545. }),
  12546. $globals.AssociativeCollection.klass);
  12547. $core.addMethod(
  12548. $core.method({
  12549. selector: "newFromPairs:",
  12550. protocol: 'instance creation',
  12551. fn: function (aCollection){
  12552. var self=this;
  12553. var newCollection;
  12554. return $core.withContext(function($ctx1) {
  12555. var $2,$1,$3,$4;
  12556. $2=$recv(aCollection)._size();
  12557. $ctx1.sendIdx["size"]=1;
  12558. $1=$recv($2)._even();
  12559. if(!$core.assert($1)){
  12560. self._error_("#newFromPairs only accepts arrays of an even length");
  12561. };
  12562. newCollection=self._new();
  12563. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  12564. return $core.withContext(function($ctx2) {
  12565. $3=newCollection;
  12566. $4=$recv(aCollection)._at_(each);
  12567. $ctx2.sendIdx["at:"]=1;
  12568. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  12569. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  12570. }));
  12571. return newCollection;
  12572. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12573. },
  12574. args: ["aCollection"],
  12575. 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",
  12576. referencedClasses: [],
  12577. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  12578. }),
  12579. $globals.AssociativeCollection.klass);
  12580. $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  12581. $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.";
  12582. $core.addMethod(
  12583. $core.method({
  12584. selector: "at:ifAbsent:",
  12585. protocol: 'accessing',
  12586. fn: function (aKey,aBlock){
  12587. var self=this;
  12588. return $core.withContext(function($ctx1) {
  12589. var index = self._positionOfKey_(aKey);
  12590. return index >=0 ? self['@values'][index] : aBlock._value();
  12591. ;
  12592. return self;
  12593. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12594. },
  12595. args: ["aKey", "aBlock"],
  12596. source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09return index >>=0 ? self['@values'][index] : aBlock._value();\x0a\x09>",
  12597. referencedClasses: [],
  12598. messageSends: []
  12599. }),
  12600. $globals.Dictionary);
  12601. $core.addMethod(
  12602. $core.method({
  12603. selector: "at:put:",
  12604. protocol: 'accessing',
  12605. fn: function (aKey,aValue){
  12606. var self=this;
  12607. return $core.withContext(function($ctx1) {
  12608. var index = self._positionOfKey_(aKey);
  12609. if(index === -1) {
  12610. var keys = self['@keys'];
  12611. index = keys.length;
  12612. keys.push(aKey);
  12613. }
  12614. return self['@values'][index] = aValue;
  12615. ;
  12616. return self;
  12617. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  12618. },
  12619. args: ["aKey", "aValue"],
  12620. source: "at: aKey put: aValue\x0a\x09<\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>",
  12621. referencedClasses: [],
  12622. messageSends: []
  12623. }),
  12624. $globals.Dictionary);
  12625. $core.addMethod(
  12626. $core.method({
  12627. selector: "includesKey:",
  12628. protocol: 'testing',
  12629. fn: function (aKey){
  12630. var self=this;
  12631. return $core.withContext(function($ctx1) {
  12632. return self._positionOfKey_(aKey) >= 0; ;
  12633. return self;
  12634. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  12635. },
  12636. args: ["aKey"],
  12637. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  12638. referencedClasses: [],
  12639. messageSends: []
  12640. }),
  12641. $globals.Dictionary);
  12642. $core.addMethod(
  12643. $core.method({
  12644. selector: "indexOf:ifAbsent:",
  12645. protocol: 'accessing',
  12646. fn: function (anObject,aBlock){
  12647. var self=this;
  12648. var index;
  12649. return $core.withContext(function($ctx1) {
  12650. var $1;
  12651. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  12652. return (0);
  12653. }));
  12654. $1=$recv(index).__eq((0));
  12655. if($core.assert($1)){
  12656. return $recv(aBlock)._value();
  12657. } else {
  12658. return $recv(self["@keys"])._at_(index);
  12659. };
  12660. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  12661. },
  12662. args: ["anObject", "aBlock"],
  12663. 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 ]",
  12664. referencedClasses: [],
  12665. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  12666. }),
  12667. $globals.Dictionary);
  12668. $core.addMethod(
  12669. $core.method({
  12670. selector: "initialize",
  12671. protocol: 'initialization',
  12672. fn: function (){
  12673. var self=this;
  12674. return $core.withContext(function($ctx1) {
  12675. (
  12676. $ctx1.supercall = true,
  12677. ($globals.Dictionary.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  12678. $ctx1.supercall = false;
  12679. self["@keys"]=[];
  12680. self["@values"]=[];
  12681. return self;
  12682. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  12683. },
  12684. args: [],
  12685. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  12686. referencedClasses: [],
  12687. messageSends: ["initialize"]
  12688. }),
  12689. $globals.Dictionary);
  12690. $core.addMethod(
  12691. $core.method({
  12692. selector: "keys",
  12693. protocol: 'accessing',
  12694. fn: function (){
  12695. var self=this;
  12696. return $core.withContext(function($ctx1) {
  12697. return $recv(self["@keys"])._copy();
  12698. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  12699. },
  12700. args: [],
  12701. source: "keys\x0a\x09^ keys copy",
  12702. referencedClasses: [],
  12703. messageSends: ["copy"]
  12704. }),
  12705. $globals.Dictionary);
  12706. $core.addMethod(
  12707. $core.method({
  12708. selector: "keysAndValuesDo:",
  12709. protocol: 'enumerating',
  12710. fn: function (aBlock){
  12711. var self=this;
  12712. return $core.withContext(function($ctx1) {
  12713. return $recv(self["@keys"])._with_do_(self["@values"],aBlock);
  12714. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12715. },
  12716. args: ["aBlock"],
  12717. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  12718. referencedClasses: [],
  12719. messageSends: ["with:do:"]
  12720. }),
  12721. $globals.Dictionary);
  12722. $core.addMethod(
  12723. $core.method({
  12724. selector: "keysDo:",
  12725. protocol: 'enumerating',
  12726. fn: function (aBlock){
  12727. var self=this;
  12728. return $core.withContext(function($ctx1) {
  12729. return $recv(self["@keys"])._do_(aBlock);
  12730. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  12731. },
  12732. args: ["aBlock"],
  12733. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  12734. referencedClasses: [],
  12735. messageSends: ["do:"]
  12736. }),
  12737. $globals.Dictionary);
  12738. $core.addMethod(
  12739. $core.method({
  12740. selector: "positionOfKey:",
  12741. protocol: 'private',
  12742. fn: function (anObject){
  12743. var self=this;
  12744. return $core.withContext(function($ctx1) {
  12745. var keys = self['@keys'];
  12746. for(var i=0;i<keys.length;i++){
  12747. if(keys[i].__eq(anObject)) { return i;}
  12748. }
  12749. return -1;
  12750. ;
  12751. return self;
  12752. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  12753. },
  12754. args: ["anObject"],
  12755. source: "positionOfKey: anObject\x0a\x09<\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>",
  12756. referencedClasses: [],
  12757. messageSends: []
  12758. }),
  12759. $globals.Dictionary);
  12760. $core.addMethod(
  12761. $core.method({
  12762. selector: "removeAll",
  12763. protocol: 'adding/removing',
  12764. fn: function (){
  12765. var self=this;
  12766. return $core.withContext(function($ctx1) {
  12767. $recv(self["@keys"])._removeAll();
  12768. $ctx1.sendIdx["removeAll"]=1;
  12769. $recv(self["@values"])._removeAll();
  12770. return self;
  12771. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  12772. },
  12773. args: [],
  12774. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  12775. referencedClasses: [],
  12776. messageSends: ["removeAll"]
  12777. }),
  12778. $globals.Dictionary);
  12779. $core.addMethod(
  12780. $core.method({
  12781. selector: "removeKey:ifAbsent:",
  12782. protocol: 'adding/removing',
  12783. fn: function (aKey,aBlock){
  12784. var self=this;
  12785. return $core.withContext(function($ctx1) {
  12786. var index = self._positionOfKey_(aKey);
  12787. if(index === -1) {
  12788. return aBlock._value()
  12789. } else {
  12790. var keys = self['@keys'], values = self['@values'];
  12791. var value = values[index], l = keys.length;
  12792. keys[index] = keys[l-1];
  12793. keys.pop();
  12794. values[index] = values[l-1];
  12795. values.pop();
  12796. return value;
  12797. }
  12798. ;
  12799. return self;
  12800. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12801. },
  12802. args: ["aKey", "aBlock"],
  12803. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<\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>",
  12804. referencedClasses: [],
  12805. messageSends: []
  12806. }),
  12807. $globals.Dictionary);
  12808. $core.addMethod(
  12809. $core.method({
  12810. selector: "values",
  12811. protocol: 'accessing',
  12812. fn: function (){
  12813. var self=this;
  12814. return self["@values"];
  12815. },
  12816. args: [],
  12817. source: "values\x0a\x09^ values",
  12818. referencedClasses: [],
  12819. messageSends: []
  12820. }),
  12821. $globals.Dictionary);
  12822. $core.addMethod(
  12823. $core.method({
  12824. selector: "valuesDo:",
  12825. protocol: 'enumerating',
  12826. fn: function (aBlock){
  12827. var self=this;
  12828. return $core.withContext(function($ctx1) {
  12829. return $recv(self["@values"])._do_(aBlock);
  12830. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12831. },
  12832. args: ["aBlock"],
  12833. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  12834. referencedClasses: [],
  12835. messageSends: ["do:"]
  12836. }),
  12837. $globals.Dictionary);
  12838. $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections');
  12839. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  12840. $core.addMethod(
  12841. $core.method({
  12842. selector: "at:ifAbsent:",
  12843. protocol: 'accessing',
  12844. fn: function (aKey,aBlock){
  12845. var self=this;
  12846. return $core.withContext(function($ctx1) {
  12847. var $1;
  12848. $1=self._includesKey_(aKey);
  12849. if($core.assert($1)){
  12850. return self._basicAt_(aKey);
  12851. } else {
  12852. return $recv(aBlock)._value();
  12853. };
  12854. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12855. },
  12856. args: ["aKey", "aBlock"],
  12857. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  12858. referencedClasses: [],
  12859. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  12860. }),
  12861. $globals.HashedCollection);
  12862. $core.addMethod(
  12863. $core.method({
  12864. selector: "at:put:",
  12865. protocol: 'accessing',
  12866. fn: function (aKey,aValue){
  12867. var self=this;
  12868. return $core.withContext(function($ctx1) {
  12869. return self._basicAt_put_(aKey,aValue);
  12870. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  12871. },
  12872. args: ["aKey", "aValue"],
  12873. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  12874. referencedClasses: [],
  12875. messageSends: ["basicAt:put:"]
  12876. }),
  12877. $globals.HashedCollection);
  12878. $core.addMethod(
  12879. $core.method({
  12880. selector: "includesKey:",
  12881. protocol: 'testing',
  12882. fn: function (aKey){
  12883. var self=this;
  12884. return $core.withContext(function($ctx1) {
  12885. return self.hasOwnProperty(aKey);
  12886. return self;
  12887. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  12888. },
  12889. args: ["aKey"],
  12890. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  12891. referencedClasses: [],
  12892. messageSends: []
  12893. }),
  12894. $globals.HashedCollection);
  12895. $core.addMethod(
  12896. $core.method({
  12897. selector: "keys",
  12898. protocol: 'accessing',
  12899. fn: function (){
  12900. var self=this;
  12901. return $core.withContext(function($ctx1) {
  12902. return Object.keys(self);
  12903. return self;
  12904. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  12905. },
  12906. args: [],
  12907. source: "keys\x0a\x09<return Object.keys(self)>",
  12908. referencedClasses: [],
  12909. messageSends: []
  12910. }),
  12911. $globals.HashedCollection);
  12912. $core.addMethod(
  12913. $core.method({
  12914. selector: "keysDo:",
  12915. protocol: 'enumerating',
  12916. fn: function (aBlock){
  12917. var self=this;
  12918. return $core.withContext(function($ctx1) {
  12919. $recv(self._keys())._do_(aBlock);
  12920. return self;
  12921. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12922. },
  12923. args: ["aBlock"],
  12924. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  12925. referencedClasses: [],
  12926. messageSends: ["do:", "keys"]
  12927. }),
  12928. $globals.HashedCollection);
  12929. $core.addMethod(
  12930. $core.method({
  12931. selector: "removeKey:ifAbsent:",
  12932. protocol: 'adding/removing',
  12933. fn: function (aKey,aBlock){
  12934. var self=this;
  12935. return $core.withContext(function($ctx1) {
  12936. return self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  12937. return $core.withContext(function($ctx2) {
  12938. self._basicDelete_(aKey);
  12939. return removed;
  12940. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  12941. }),(function(){
  12942. return $core.withContext(function($ctx2) {
  12943. return $recv(aBlock)._value();
  12944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12945. }));
  12946. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12947. },
  12948. args: ["aKey", "aBlock"],
  12949. 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 ]",
  12950. referencedClasses: [],
  12951. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  12952. }),
  12953. $globals.HashedCollection);
  12954. $core.addMethod(
  12955. $core.method({
  12956. selector: "values",
  12957. protocol: 'accessing',
  12958. fn: function (){
  12959. var self=this;
  12960. return $core.withContext(function($ctx1) {
  12961. return self._keys().map(function(key){
  12962. return self._at_(key);
  12963. });
  12964. ;
  12965. return self;
  12966. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  12967. },
  12968. args: [],
  12969. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  12970. referencedClasses: [],
  12971. messageSends: []
  12972. }),
  12973. $globals.HashedCollection);
  12974. $core.addMethod(
  12975. $core.method({
  12976. selector: "valuesDo:",
  12977. protocol: 'enumerating',
  12978. fn: function (aBlock){
  12979. var self=this;
  12980. return $core.withContext(function($ctx1) {
  12981. $recv(self._values())._do_(aBlock);
  12982. return self;
  12983. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12984. },
  12985. args: ["aBlock"],
  12986. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  12987. referencedClasses: [],
  12988. messageSends: ["do:", "values"]
  12989. }),
  12990. $globals.HashedCollection);
  12991. $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  12992. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  12993. $core.addMethod(
  12994. $core.method({
  12995. selector: "=",
  12996. protocol: 'comparing',
  12997. fn: function (aCollection){
  12998. var self=this;
  12999. return $core.withContext(function($ctx1) {
  13000. var $3,$2,$4,$1,$5;
  13001. var $early={};
  13002. try {
  13003. $3=self._class();
  13004. $ctx1.sendIdx["class"]=1;
  13005. $2=$recv($3).__eq($recv(aCollection)._class());
  13006. $ctx1.sendIdx["="]=1;
  13007. $1=$recv($2)._and_((function(){
  13008. return $core.withContext(function($ctx2) {
  13009. $4=self._size();
  13010. $ctx2.sendIdx["size"]=1;
  13011. return $recv($4).__eq($recv(aCollection)._size());
  13012. $ctx2.sendIdx["="]=2;
  13013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13014. }));
  13015. if(!$core.assert($1)){
  13016. return false;
  13017. };
  13018. self._withIndexDo_((function(each,i){
  13019. return $core.withContext(function($ctx2) {
  13020. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  13021. if(!$core.assert($5)){
  13022. throw $early=[false];
  13023. };
  13024. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  13025. }));
  13026. return true;
  13027. }
  13028. catch(e) {if(e===$early)return e[0]; throw e}
  13029. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  13030. },
  13031. args: ["aCollection"],
  13032. 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",
  13033. referencedClasses: [],
  13034. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  13035. }),
  13036. $globals.SequenceableCollection);
  13037. $core.addMethod(
  13038. $core.method({
  13039. selector: "addLast:",
  13040. protocol: 'adding/removing',
  13041. fn: function (anObject){
  13042. var self=this;
  13043. return $core.withContext(function($ctx1) {
  13044. self._add_(anObject);
  13045. return self;
  13046. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  13047. },
  13048. args: ["anObject"],
  13049. source: "addLast: anObject\x0a\x09self add: anObject",
  13050. referencedClasses: [],
  13051. messageSends: ["add:"]
  13052. }),
  13053. $globals.SequenceableCollection);
  13054. $core.addMethod(
  13055. $core.method({
  13056. selector: "allButFirst",
  13057. protocol: 'accessing',
  13058. fn: function (){
  13059. var self=this;
  13060. return $core.withContext(function($ctx1) {
  13061. return self._copyFrom_to_((2),self._size());
  13062. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  13063. },
  13064. args: [],
  13065. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  13066. referencedClasses: [],
  13067. messageSends: ["copyFrom:to:", "size"]
  13068. }),
  13069. $globals.SequenceableCollection);
  13070. $core.addMethod(
  13071. $core.method({
  13072. selector: "allButLast",
  13073. protocol: 'accessing',
  13074. fn: function (){
  13075. var self=this;
  13076. return $core.withContext(function($ctx1) {
  13077. return self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  13078. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  13079. },
  13080. args: [],
  13081. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  13082. referencedClasses: [],
  13083. messageSends: ["copyFrom:to:", "-", "size"]
  13084. }),
  13085. $globals.SequenceableCollection);
  13086. $core.addMethod(
  13087. $core.method({
  13088. selector: "atRandom",
  13089. protocol: 'accessing',
  13090. fn: function (){
  13091. var self=this;
  13092. return $core.withContext(function($ctx1) {
  13093. return self._at_($recv(self._size())._atRandom());
  13094. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  13095. },
  13096. args: [],
  13097. source: "atRandom\x0a\x09^ self at: self size atRandom",
  13098. referencedClasses: [],
  13099. messageSends: ["at:", "atRandom", "size"]
  13100. }),
  13101. $globals.SequenceableCollection);
  13102. $core.addMethod(
  13103. $core.method({
  13104. selector: "beginsWith:",
  13105. protocol: 'testing',
  13106. fn: function (prefix){
  13107. var self=this;
  13108. return $core.withContext(function($ctx1) {
  13109. var $2,$3,$1;
  13110. $2=self._size();
  13111. $ctx1.sendIdx["size"]=1;
  13112. $3=$recv(prefix)._size();
  13113. $ctx1.sendIdx["size"]=2;
  13114. $1=$recv($2).__lt($3);
  13115. if($core.assert($1)){
  13116. return false;
  13117. };
  13118. return $recv(self._first_($recv(prefix)._size())).__eq(prefix);
  13119. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  13120. },
  13121. args: ["prefix"],
  13122. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  13123. referencedClasses: [],
  13124. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  13125. }),
  13126. $globals.SequenceableCollection);
  13127. $core.addMethod(
  13128. $core.method({
  13129. selector: "copyFrom:to:",
  13130. protocol: 'copying',
  13131. fn: function (anIndex,anotherIndex){
  13132. var self=this;
  13133. return $core.withContext(function($ctx1) {
  13134. self._subclassResponsibility();
  13135. return self;
  13136. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  13137. },
  13138. args: ["anIndex", "anotherIndex"],
  13139. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  13140. referencedClasses: [],
  13141. messageSends: ["subclassResponsibility"]
  13142. }),
  13143. $globals.SequenceableCollection);
  13144. $core.addMethod(
  13145. $core.method({
  13146. selector: "detect:ifNone:",
  13147. protocol: 'enumerating',
  13148. fn: function (aBlock,anotherBlock){
  13149. var self=this;
  13150. return $core.withContext(function($ctx1) {
  13151. self = self._numericallyIndexable();
  13152. for(var i = 0; i < self.length; i++)
  13153. if(aBlock._value_(self[i]))
  13154. return self[i];
  13155. return anotherBlock._value();
  13156. ;
  13157. return self;
  13158. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  13159. },
  13160. args: ["aBlock", "anotherBlock"],
  13161. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\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>",
  13162. referencedClasses: [],
  13163. messageSends: []
  13164. }),
  13165. $globals.SequenceableCollection);
  13166. $core.addMethod(
  13167. $core.method({
  13168. selector: "do:",
  13169. protocol: 'enumerating',
  13170. fn: function (aBlock){
  13171. var self=this;
  13172. return $core.withContext(function($ctx1) {
  13173. self = self._numericallyIndexable();
  13174. for(var i=0; i < self.length; i++) {
  13175. aBlock._value_(self[i]);
  13176. }
  13177. ;
  13178. return self;
  13179. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13180. },
  13181. args: ["aBlock"],
  13182. source: "do: aBlock\x0a\x09<\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>",
  13183. referencedClasses: [],
  13184. messageSends: []
  13185. }),
  13186. $globals.SequenceableCollection);
  13187. $core.addMethod(
  13188. $core.method({
  13189. selector: "endsWith:",
  13190. protocol: 'testing',
  13191. fn: function (suffix){
  13192. var self=this;
  13193. return $core.withContext(function($ctx1) {
  13194. var $2,$3,$1;
  13195. $2=self._size();
  13196. $ctx1.sendIdx["size"]=1;
  13197. $3=$recv(suffix)._size();
  13198. $ctx1.sendIdx["size"]=2;
  13199. $1=$recv($2).__lt($3);
  13200. if($core.assert($1)){
  13201. return false;
  13202. };
  13203. return $recv(self._last_($recv(suffix)._size())).__eq(suffix);
  13204. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  13205. },
  13206. args: ["suffix"],
  13207. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  13208. referencedClasses: [],
  13209. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  13210. }),
  13211. $globals.SequenceableCollection);
  13212. $core.addMethod(
  13213. $core.method({
  13214. selector: "first",
  13215. protocol: 'accessing',
  13216. fn: function (){
  13217. var self=this;
  13218. return $core.withContext(function($ctx1) {
  13219. return self._at_((1));
  13220. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  13221. },
  13222. args: [],
  13223. source: "first\x0a\x09^ self at: 1",
  13224. referencedClasses: [],
  13225. messageSends: ["at:"]
  13226. }),
  13227. $globals.SequenceableCollection);
  13228. $core.addMethod(
  13229. $core.method({
  13230. selector: "first:",
  13231. protocol: 'accessing',
  13232. fn: function (aNumber){
  13233. var self=this;
  13234. return $core.withContext(function($ctx1) {
  13235. var $1;
  13236. $1=$recv(self._size()).__lt(aNumber);
  13237. if($core.assert($1)){
  13238. self._error_("Invalid number of elements");
  13239. };
  13240. return self._copyFrom_to_((1),aNumber);
  13241. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13242. },
  13243. args: ["aNumber"],
  13244. 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",
  13245. referencedClasses: [],
  13246. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  13247. }),
  13248. $globals.SequenceableCollection);
  13249. $core.addMethod(
  13250. $core.method({
  13251. selector: "fourth",
  13252. protocol: 'accessing',
  13253. fn: function (){
  13254. var self=this;
  13255. return $core.withContext(function($ctx1) {
  13256. return self._at_((4));
  13257. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  13258. },
  13259. args: [],
  13260. source: "fourth\x0a\x09^ self at: 4",
  13261. referencedClasses: [],
  13262. messageSends: ["at:"]
  13263. }),
  13264. $globals.SequenceableCollection);
  13265. $core.addMethod(
  13266. $core.method({
  13267. selector: "includes:",
  13268. protocol: 'testing',
  13269. fn: function (anObject){
  13270. var self=this;
  13271. return $core.withContext(function($ctx1) {
  13272. return $recv(self._indexOf_ifAbsent_(anObject,(function(){
  13273. return nil;
  13274. })))._notNil();
  13275. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  13276. },
  13277. args: ["anObject"],
  13278. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  13279. referencedClasses: [],
  13280. messageSends: ["notNil", "indexOf:ifAbsent:"]
  13281. }),
  13282. $globals.SequenceableCollection);
  13283. $core.addMethod(
  13284. $core.method({
  13285. selector: "indexOf:ifAbsent:",
  13286. protocol: 'accessing',
  13287. fn: function (anObject,aBlock){
  13288. var self=this;
  13289. return $core.withContext(function($ctx1) {
  13290. self = self._numericallyIndexable();
  13291. for(var i=0; i < self.length; i++) {
  13292. if($recv(self[i]).__eq(anObject)) {return i+1}
  13293. };
  13294. return aBlock._value();
  13295. ;
  13296. return self;
  13297. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  13298. },
  13299. args: ["anObject", "aBlock"],
  13300. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\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>",
  13301. referencedClasses: [],
  13302. messageSends: []
  13303. }),
  13304. $globals.SequenceableCollection);
  13305. $core.addMethod(
  13306. $core.method({
  13307. selector: "indexOf:startingAt:",
  13308. protocol: 'accessing',
  13309. fn: function (anObject,start){
  13310. var self=this;
  13311. return $core.withContext(function($ctx1) {
  13312. return self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  13313. return (0);
  13314. }));
  13315. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  13316. },
  13317. args: ["anObject", "start"],
  13318. 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 ]",
  13319. referencedClasses: [],
  13320. messageSends: ["indexOf:startingAt:ifAbsent:"]
  13321. }),
  13322. $globals.SequenceableCollection);
  13323. $core.addMethod(
  13324. $core.method({
  13325. selector: "indexOf:startingAt:ifAbsent:",
  13326. protocol: 'accessing',
  13327. fn: function (anObject,start,aBlock){
  13328. var self=this;
  13329. return $core.withContext(function($ctx1) {
  13330. self = self._numericallyIndexable();
  13331. for(var i=start - 1; i < self.length; i++){
  13332. if($recv(self[i]).__eq(anObject)) {return i+1}
  13333. }
  13334. return aBlock._value();
  13335. ;
  13336. return self;
  13337. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  13338. },
  13339. args: ["anObject", "start", "aBlock"],
  13340. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<\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>",
  13341. referencedClasses: [],
  13342. messageSends: []
  13343. }),
  13344. $globals.SequenceableCollection);
  13345. $core.addMethod(
  13346. $core.method({
  13347. selector: "last",
  13348. protocol: 'accessing',
  13349. fn: function (){
  13350. var self=this;
  13351. return $core.withContext(function($ctx1) {
  13352. return self._at_(self._size());
  13353. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  13354. },
  13355. args: [],
  13356. source: "last\x0a\x09^ self at: self size",
  13357. referencedClasses: [],
  13358. messageSends: ["at:", "size"]
  13359. }),
  13360. $globals.SequenceableCollection);
  13361. $core.addMethod(
  13362. $core.method({
  13363. selector: "last:",
  13364. protocol: 'accessing',
  13365. fn: function (aNumber){
  13366. var self=this;
  13367. return $core.withContext(function($ctx1) {
  13368. var $2,$1,$5,$4,$3;
  13369. $2=self._size();
  13370. $ctx1.sendIdx["size"]=1;
  13371. $1=$recv($2).__lt(aNumber);
  13372. if($core.assert($1)){
  13373. self._error_("Invalid number of elements");
  13374. };
  13375. $5=self._size();
  13376. $ctx1.sendIdx["size"]=2;
  13377. $4=$recv($5).__minus(aNumber);
  13378. $3=$recv($4).__plus((1));
  13379. return self._copyFrom_to_($3,self._size());
  13380. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13381. },
  13382. args: ["aNumber"],
  13383. 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",
  13384. referencedClasses: [],
  13385. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  13386. }),
  13387. $globals.SequenceableCollection);
  13388. $core.addMethod(
  13389. $core.method({
  13390. selector: "newStream",
  13391. protocol: 'streaming',
  13392. fn: function (){
  13393. var self=this;
  13394. return $core.withContext(function($ctx1) {
  13395. return $recv(self._streamClass())._on_(self);
  13396. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  13397. },
  13398. args: [],
  13399. source: "newStream\x0a\x09^ self streamClass on: self",
  13400. referencedClasses: [],
  13401. messageSends: ["on:", "streamClass"]
  13402. }),
  13403. $globals.SequenceableCollection);
  13404. $core.addMethod(
  13405. $core.method({
  13406. selector: "numericallyIndexable",
  13407. protocol: 'private',
  13408. fn: function (){
  13409. var self=this;
  13410. return $core.withContext(function($ctx1) {
  13411. self._subclassResponsibility();
  13412. return self;
  13413. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  13414. },
  13415. args: [],
  13416. 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",
  13417. referencedClasses: [],
  13418. messageSends: ["subclassResponsibility"]
  13419. }),
  13420. $globals.SequenceableCollection);
  13421. $core.addMethod(
  13422. $core.method({
  13423. selector: "readStream",
  13424. protocol: 'streaming',
  13425. fn: function (){
  13426. var self=this;
  13427. return $core.withContext(function($ctx1) {
  13428. return self._stream();
  13429. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  13430. },
  13431. args: [],
  13432. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13433. referencedClasses: [],
  13434. messageSends: ["stream"]
  13435. }),
  13436. $globals.SequenceableCollection);
  13437. $core.addMethod(
  13438. $core.method({
  13439. selector: "removeLast",
  13440. protocol: 'adding/removing',
  13441. fn: function (){
  13442. var self=this;
  13443. return $core.withContext(function($ctx1) {
  13444. return self._remove_(self._last());
  13445. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  13446. },
  13447. args: [],
  13448. source: "removeLast\x0a\x09^ self remove: self last",
  13449. referencedClasses: [],
  13450. messageSends: ["remove:", "last"]
  13451. }),
  13452. $globals.SequenceableCollection);
  13453. $core.addMethod(
  13454. $core.method({
  13455. selector: "reversed",
  13456. protocol: 'converting',
  13457. fn: function (){
  13458. var self=this;
  13459. return $core.withContext(function($ctx1) {
  13460. self._subclassResponsibility();
  13461. return self;
  13462. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  13463. },
  13464. args: [],
  13465. source: "reversed\x0a\x09self subclassResponsibility",
  13466. referencedClasses: [],
  13467. messageSends: ["subclassResponsibility"]
  13468. }),
  13469. $globals.SequenceableCollection);
  13470. $core.addMethod(
  13471. $core.method({
  13472. selector: "second",
  13473. protocol: 'accessing',
  13474. fn: function (){
  13475. var self=this;
  13476. return $core.withContext(function($ctx1) {
  13477. return self._at_((2));
  13478. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  13479. },
  13480. args: [],
  13481. source: "second\x0a\x09^ self at: 2",
  13482. referencedClasses: [],
  13483. messageSends: ["at:"]
  13484. }),
  13485. $globals.SequenceableCollection);
  13486. $core.addMethod(
  13487. $core.method({
  13488. selector: "stream",
  13489. protocol: 'streaming',
  13490. fn: function (){
  13491. var self=this;
  13492. return $core.withContext(function($ctx1) {
  13493. return self._newStream();
  13494. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  13495. },
  13496. args: [],
  13497. source: "stream\x0a\x09^ self newStream",
  13498. referencedClasses: [],
  13499. messageSends: ["newStream"]
  13500. }),
  13501. $globals.SequenceableCollection);
  13502. $core.addMethod(
  13503. $core.method({
  13504. selector: "streamClass",
  13505. protocol: 'streaming',
  13506. fn: function (){
  13507. var self=this;
  13508. return $core.withContext(function($ctx1) {
  13509. return $recv(self._class())._streamClass();
  13510. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  13511. },
  13512. args: [],
  13513. source: "streamClass\x0a\x09^ self class streamClass",
  13514. referencedClasses: [],
  13515. messageSends: ["streamClass", "class"]
  13516. }),
  13517. $globals.SequenceableCollection);
  13518. $core.addMethod(
  13519. $core.method({
  13520. selector: "third",
  13521. protocol: 'accessing',
  13522. fn: function (){
  13523. var self=this;
  13524. return $core.withContext(function($ctx1) {
  13525. return self._at_((3));
  13526. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  13527. },
  13528. args: [],
  13529. source: "third\x0a\x09^ self at: 3",
  13530. referencedClasses: [],
  13531. messageSends: ["at:"]
  13532. }),
  13533. $globals.SequenceableCollection);
  13534. $core.addMethod(
  13535. $core.method({
  13536. selector: "with:do:",
  13537. protocol: 'enumerating',
  13538. fn: function (anotherCollection,aBlock){
  13539. var self=this;
  13540. return $core.withContext(function($ctx1) {
  13541. self = self._numericallyIndexable();
  13542. anotherCollection = anotherCollection._numericallyIndexable();
  13543. for(var i=0; i<self.length; i++) {
  13544. aBlock._value_value_(self[i], anotherCollection[i]);
  13545. }
  13546. ;
  13547. return self;
  13548. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  13549. },
  13550. args: ["anotherCollection", "aBlock"],
  13551. source: "with: anotherCollection do: aBlock\x0a\x09<\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>",
  13552. referencedClasses: [],
  13553. messageSends: []
  13554. }),
  13555. $globals.SequenceableCollection);
  13556. $core.addMethod(
  13557. $core.method({
  13558. selector: "withIndexDo:",
  13559. protocol: 'enumerating',
  13560. fn: function (aBlock){
  13561. var self=this;
  13562. return $core.withContext(function($ctx1) {
  13563. self = self._numericallyIndexable();
  13564. for(var i=0; i < self.length; i++) {
  13565. aBlock._value_value_(self[i], i+1);
  13566. }
  13567. ;
  13568. return self;
  13569. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13570. },
  13571. args: ["aBlock"],
  13572. source: "withIndexDo: aBlock\x0a\x09<\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>",
  13573. referencedClasses: [],
  13574. messageSends: []
  13575. }),
  13576. $globals.SequenceableCollection);
  13577. $core.addMethod(
  13578. $core.method({
  13579. selector: "writeStream",
  13580. protocol: 'streaming',
  13581. fn: function (){
  13582. var self=this;
  13583. return $core.withContext(function($ctx1) {
  13584. return self._stream();
  13585. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  13586. },
  13587. args: [],
  13588. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13589. referencedClasses: [],
  13590. messageSends: ["stream"]
  13591. }),
  13592. $globals.SequenceableCollection);
  13593. $core.addMethod(
  13594. $core.method({
  13595. selector: "streamClass",
  13596. protocol: 'accessing',
  13597. fn: function (){
  13598. var self=this;
  13599. return $globals.Stream;
  13600. },
  13601. args: [],
  13602. source: "streamClass\x0a\x09\x09^ Stream",
  13603. referencedClasses: ["Stream"],
  13604. messageSends: []
  13605. }),
  13606. $globals.SequenceableCollection.klass);
  13607. $core.addMethod(
  13608. $core.method({
  13609. selector: "streamContents:",
  13610. protocol: 'streaming',
  13611. fn: function (aBlock){
  13612. var self=this;
  13613. var stream;
  13614. return $core.withContext(function($ctx1) {
  13615. stream=$recv(self._streamClass())._on_(self._new());
  13616. $recv(aBlock)._value_(stream);
  13617. return $recv(stream)._contents();
  13618. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  13619. },
  13620. args: ["aBlock"],
  13621. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  13622. referencedClasses: [],
  13623. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  13624. }),
  13625. $globals.SequenceableCollection.klass);
  13626. $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections');
  13627. $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`.";
  13628. $core.addMethod(
  13629. $core.method({
  13630. selector: "add:",
  13631. protocol: 'adding/removing',
  13632. fn: function (anObject){
  13633. var self=this;
  13634. return $core.withContext(function($ctx1) {
  13635. self.push(anObject); return anObject;;
  13636. return self;
  13637. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  13638. },
  13639. args: ["anObject"],
  13640. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  13641. referencedClasses: [],
  13642. messageSends: []
  13643. }),
  13644. $globals.Array);
  13645. $core.addMethod(
  13646. $core.method({
  13647. selector: "addAll:",
  13648. protocol: 'adding/removing',
  13649. fn: function (aCollection){
  13650. var self=this;
  13651. return $core.withContext(function($ctx1) {
  13652. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  13653. else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);
  13654. return aCollection;;
  13655. return self;
  13656. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  13657. },
  13658. args: ["aCollection"],
  13659. source: "addAll: aCollection\x0a<\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>",
  13660. referencedClasses: [],
  13661. messageSends: []
  13662. }),
  13663. $globals.Array);
  13664. $core.addMethod(
  13665. $core.method({
  13666. selector: "addFirst:",
  13667. protocol: 'adding/removing',
  13668. fn: function (anObject){
  13669. var self=this;
  13670. return $core.withContext(function($ctx1) {
  13671. self.unshift(anObject); return anObject;;
  13672. return self;
  13673. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  13674. },
  13675. args: ["anObject"],
  13676. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  13677. referencedClasses: [],
  13678. messageSends: []
  13679. }),
  13680. $globals.Array);
  13681. $core.addMethod(
  13682. $core.method({
  13683. selector: "asJavascript",
  13684. protocol: 'converting',
  13685. fn: function (){
  13686. var self=this;
  13687. return $core.withContext(function($ctx1) {
  13688. var $1;
  13689. $1=$recv("[".__comma($recv(self._collect_((function(each){
  13690. return $core.withContext(function($ctx2) {
  13691. return $recv(each)._asJavascript();
  13692. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13693. })))._join_(", "))).__comma("]");
  13694. $ctx1.sendIdx[","]=1;
  13695. return $1;
  13696. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
  13697. },
  13698. args: [],
  13699. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  13700. referencedClasses: [],
  13701. messageSends: [",", "join:", "collect:", "asJavascript"]
  13702. }),
  13703. $globals.Array);
  13704. $core.addMethod(
  13705. $core.method({
  13706. selector: "at:ifAbsent:",
  13707. protocol: 'accessing',
  13708. fn: function (anIndex,aBlock){
  13709. var self=this;
  13710. return $core.withContext(function($ctx1) {
  13711. return anIndex >= 1 && anIndex <= self.length
  13712. ? self[anIndex - 1]
  13713. : aBlock._value()
  13714. ;
  13715. return self;
  13716. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  13717. },
  13718. args: ["anIndex", "aBlock"],
  13719. source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09>",
  13720. referencedClasses: [],
  13721. messageSends: []
  13722. }),
  13723. $globals.Array);
  13724. $core.addMethod(
  13725. $core.method({
  13726. selector: "at:ifPresent:ifAbsent:",
  13727. protocol: 'accessing',
  13728. fn: function (anIndex,aBlock,anotherBlock){
  13729. var self=this;
  13730. return $core.withContext(function($ctx1) {
  13731. return anIndex >= 1 && anIndex <= self.length
  13732. ? aBlock._value_(self[anIndex - 1])
  13733. : anotherBlock._value()
  13734. ;
  13735. return self;
  13736. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  13737. },
  13738. args: ["anIndex", "aBlock", "anotherBlock"],
  13739. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\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>",
  13740. referencedClasses: [],
  13741. messageSends: []
  13742. }),
  13743. $globals.Array);
  13744. $core.addMethod(
  13745. $core.method({
  13746. selector: "at:put:",
  13747. protocol: 'accessing',
  13748. fn: function (anIndex,anObject){
  13749. var self=this;
  13750. return $core.withContext(function($ctx1) {
  13751. return self[anIndex - 1] = anObject;
  13752. return self;
  13753. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  13754. },
  13755. args: ["anIndex", "anObject"],
  13756. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  13757. referencedClasses: [],
  13758. messageSends: []
  13759. }),
  13760. $globals.Array);
  13761. $core.addMethod(
  13762. $core.method({
  13763. selector: "collect:",
  13764. protocol: 'enumerating',
  13765. fn: function (aBlock){
  13766. var self=this;
  13767. return $core.withContext(function($ctx1) {
  13768. return self.map(function(each) {return aBlock._value_(each)});
  13769. return self;
  13770. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  13771. },
  13772. args: ["aBlock"],
  13773. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  13774. referencedClasses: [],
  13775. messageSends: []
  13776. }),
  13777. $globals.Array);
  13778. $core.addMethod(
  13779. $core.method({
  13780. selector: "copyFrom:to:",
  13781. protocol: 'copying',
  13782. fn: function (anIndex,anotherIndex){
  13783. var self=this;
  13784. return $core.withContext(function($ctx1) {
  13785. if (anIndex >= 1 && anotherIndex <= self.length) {
  13786. return self.slice(anIndex - 1, anotherIndex);
  13787. } else {
  13788. self._at_(anIndex);
  13789. self._at_(self.length + 1);
  13790. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  13791. };
  13792. return self;
  13793. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  13794. },
  13795. args: ["anIndex", "anotherIndex"],
  13796. source: "copyFrom: anIndex to: anotherIndex\x0a<\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>",
  13797. referencedClasses: [],
  13798. messageSends: []
  13799. }),
  13800. $globals.Array);
  13801. $core.addMethod(
  13802. $core.method({
  13803. selector: "join:",
  13804. protocol: 'enumerating',
  13805. fn: function (aString){
  13806. var self=this;
  13807. return $core.withContext(function($ctx1) {
  13808. return self.join(aString);
  13809. return self;
  13810. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  13811. },
  13812. args: ["aString"],
  13813. source: "join: aString\x0a\x09<return self.join(aString)>",
  13814. referencedClasses: [],
  13815. messageSends: []
  13816. }),
  13817. $globals.Array);
  13818. $core.addMethod(
  13819. $core.method({
  13820. selector: "numericallyIndexable",
  13821. protocol: 'private',
  13822. fn: function (){
  13823. var self=this;
  13824. return self;
  13825. },
  13826. args: [],
  13827. source: "numericallyIndexable\x0a\x09^ self",
  13828. referencedClasses: [],
  13829. messageSends: []
  13830. }),
  13831. $globals.Array);
  13832. $core.addMethod(
  13833. $core.method({
  13834. selector: "printOn:",
  13835. protocol: 'printing',
  13836. fn: function (aStream){
  13837. var self=this;
  13838. return $core.withContext(function($ctx1) {
  13839. (
  13840. $ctx1.supercall = true,
  13841. ($globals.Array.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  13842. $ctx1.supercall = false;
  13843. $ctx1.sendIdx["printOn:"]=1;
  13844. $recv(aStream)._nextPutAll_(" (");
  13845. $ctx1.sendIdx["nextPutAll:"]=1;
  13846. self._do_separatedBy_((function(each){
  13847. return $core.withContext(function($ctx2) {
  13848. return $recv(each)._printOn_(aStream);
  13849. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13850. }),(function(){
  13851. return $core.withContext(function($ctx2) {
  13852. return $recv(aStream)._nextPutAll_(" ");
  13853. $ctx2.sendIdx["nextPutAll:"]=2;
  13854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13855. }));
  13856. $recv(aStream)._nextPutAll_(")");
  13857. return self;
  13858. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  13859. },
  13860. args: ["aStream"],
  13861. 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: ')'",
  13862. referencedClasses: [],
  13863. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13864. }),
  13865. $globals.Array);
  13866. $core.addMethod(
  13867. $core.method({
  13868. selector: "remove:ifAbsent:",
  13869. protocol: 'adding/removing',
  13870. fn: function (anObject,aBlock){
  13871. var self=this;
  13872. var index;
  13873. return $core.withContext(function($ctx1) {
  13874. var $1;
  13875. index=self._indexOf_ifAbsent_(anObject,(function(){
  13876. return (0);
  13877. }));
  13878. $1=$recv(index).__eq((0));
  13879. if($core.assert($1)){
  13880. return $recv(aBlock)._value();
  13881. } else {
  13882. self._removeIndex_(index);
  13883. return anObject;
  13884. };
  13885. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  13886. },
  13887. args: ["anObject", "aBlock"],
  13888. 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 ]",
  13889. referencedClasses: [],
  13890. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  13891. }),
  13892. $globals.Array);
  13893. $core.addMethod(
  13894. $core.method({
  13895. selector: "removeAll",
  13896. protocol: 'adding/removing',
  13897. fn: function (){
  13898. var self=this;
  13899. return $core.withContext(function($ctx1) {
  13900. self.length = 0;
  13901. return self;
  13902. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  13903. },
  13904. args: [],
  13905. source: "removeAll\x0a\x09<self.length = 0>",
  13906. referencedClasses: [],
  13907. messageSends: []
  13908. }),
  13909. $globals.Array);
  13910. $core.addMethod(
  13911. $core.method({
  13912. selector: "removeFrom:to:",
  13913. protocol: 'adding/removing',
  13914. fn: function (aNumber,anotherNumber){
  13915. var self=this;
  13916. return $core.withContext(function($ctx1) {
  13917. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  13918. return self;
  13919. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  13920. },
  13921. args: ["aNumber", "anotherNumber"],
  13922. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  13923. referencedClasses: [],
  13924. messageSends: []
  13925. }),
  13926. $globals.Array);
  13927. $core.addMethod(
  13928. $core.method({
  13929. selector: "removeIndex:",
  13930. protocol: 'adding/removing',
  13931. fn: function (anInteger){
  13932. var self=this;
  13933. return $core.withContext(function($ctx1) {
  13934. self.splice(anInteger - 1, 1);
  13935. return self;
  13936. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  13937. },
  13938. args: ["anInteger"],
  13939. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  13940. referencedClasses: [],
  13941. messageSends: []
  13942. }),
  13943. $globals.Array);
  13944. $core.addMethod(
  13945. $core.method({
  13946. selector: "removeLast",
  13947. protocol: 'adding/removing',
  13948. fn: function (){
  13949. var self=this;
  13950. return $core.withContext(function($ctx1) {
  13951. return self.pop();;
  13952. return self;
  13953. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  13954. },
  13955. args: [],
  13956. source: "removeLast\x0a\x09<return self.pop();>",
  13957. referencedClasses: [],
  13958. messageSends: []
  13959. }),
  13960. $globals.Array);
  13961. $core.addMethod(
  13962. $core.method({
  13963. selector: "reversed",
  13964. protocol: 'converting',
  13965. fn: function (){
  13966. var self=this;
  13967. return $core.withContext(function($ctx1) {
  13968. return self.slice().reverse();
  13969. return self;
  13970. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  13971. },
  13972. args: [],
  13973. source: "reversed\x0a\x09<return self.slice().reverse()>",
  13974. referencedClasses: [],
  13975. messageSends: []
  13976. }),
  13977. $globals.Array);
  13978. $core.addMethod(
  13979. $core.method({
  13980. selector: "select:",
  13981. protocol: 'enumerating',
  13982. fn: function (aBlock){
  13983. var self=this;
  13984. return $core.withContext(function($ctx1) {
  13985. return self.filter(function(each) {return aBlock._value_(each)});
  13986. return self;
  13987. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  13988. },
  13989. args: ["aBlock"],
  13990. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.filter(function(each) {return aBlock._value_(each)})>",
  13991. referencedClasses: [],
  13992. messageSends: []
  13993. }),
  13994. $globals.Array);
  13995. $core.addMethod(
  13996. $core.method({
  13997. selector: "shallowCopy",
  13998. protocol: 'copying',
  13999. fn: function (){
  14000. var self=this;
  14001. return $core.withContext(function($ctx1) {
  14002. return self.slice();
  14003. return self;
  14004. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  14005. },
  14006. args: [],
  14007. source: "shallowCopy\x0a\x09<return self.slice()>",
  14008. referencedClasses: [],
  14009. messageSends: []
  14010. }),
  14011. $globals.Array);
  14012. $core.addMethod(
  14013. $core.method({
  14014. selector: "size",
  14015. protocol: 'accessing',
  14016. fn: function (){
  14017. var self=this;
  14018. return $core.withContext(function($ctx1) {
  14019. return self.length;
  14020. return self;
  14021. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  14022. },
  14023. args: [],
  14024. source: "size\x0a\x09<return self.length>",
  14025. referencedClasses: [],
  14026. messageSends: []
  14027. }),
  14028. $globals.Array);
  14029. $core.addMethod(
  14030. $core.method({
  14031. selector: "sort",
  14032. protocol: 'enumerating',
  14033. fn: function (){
  14034. var self=this;
  14035. return $core.withContext(function($ctx1) {
  14036. return self._sort_((function(a,b){
  14037. return $core.withContext(function($ctx2) {
  14038. return $recv(a).__lt(b);
  14039. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  14040. }));
  14041. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  14042. },
  14043. args: [],
  14044. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  14045. referencedClasses: [],
  14046. messageSends: ["sort:", "<"]
  14047. }),
  14048. $globals.Array);
  14049. $core.addMethod(
  14050. $core.method({
  14051. selector: "sort:",
  14052. protocol: 'enumerating',
  14053. fn: function (aBlock){
  14054. var self=this;
  14055. return $core.withContext(function($ctx1) {
  14056. return self.sort(function(a, b) {
  14057. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  14058. })
  14059. ;
  14060. return self;
  14061. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  14062. },
  14063. args: ["aBlock"],
  14064. source: "sort: aBlock\x0a\x09<\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>",
  14065. referencedClasses: [],
  14066. messageSends: []
  14067. }),
  14068. $globals.Array);
  14069. $core.addMethod(
  14070. $core.method({
  14071. selector: "sorted",
  14072. protocol: 'enumerating',
  14073. fn: function (){
  14074. var self=this;
  14075. return $core.withContext(function($ctx1) {
  14076. return $recv(self._copy())._sort();
  14077. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  14078. },
  14079. args: [],
  14080. source: "sorted\x0a\x09^ self copy sort",
  14081. referencedClasses: [],
  14082. messageSends: ["sort", "copy"]
  14083. }),
  14084. $globals.Array);
  14085. $core.addMethod(
  14086. $core.method({
  14087. selector: "sorted:",
  14088. protocol: 'enumerating',
  14089. fn: function (aBlock){
  14090. var self=this;
  14091. return $core.withContext(function($ctx1) {
  14092. return $recv(self._copy())._sort_(aBlock);
  14093. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  14094. },
  14095. args: ["aBlock"],
  14096. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  14097. referencedClasses: [],
  14098. messageSends: ["sort:", "copy"]
  14099. }),
  14100. $globals.Array);
  14101. $core.addMethod(
  14102. $core.method({
  14103. selector: "new:",
  14104. protocol: 'instance creation',
  14105. fn: function (anInteger){
  14106. var self=this;
  14107. return $core.withContext(function($ctx1) {
  14108. return new Array(anInteger);
  14109. return self;
  14110. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  14111. },
  14112. args: ["anInteger"],
  14113. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  14114. referencedClasses: [],
  14115. messageSends: []
  14116. }),
  14117. $globals.Array.klass);
  14118. $core.addMethod(
  14119. $core.method({
  14120. selector: "with:",
  14121. protocol: 'instance creation',
  14122. fn: function (anObject){
  14123. var self=this;
  14124. return $core.withContext(function($ctx1) {
  14125. var $1;
  14126. $1=self._new_((1));
  14127. $recv($1)._at_put_((1),anObject);
  14128. return $recv($1)._yourself();
  14129. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  14130. },
  14131. args: ["anObject"],
  14132. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  14133. referencedClasses: [],
  14134. messageSends: ["at:put:", "new:", "yourself"]
  14135. }),
  14136. $globals.Array.klass);
  14137. $core.addMethod(
  14138. $core.method({
  14139. selector: "with:with:",
  14140. protocol: 'instance creation',
  14141. fn: function (anObject,anObject2){
  14142. var self=this;
  14143. return $core.withContext(function($ctx1) {
  14144. var $1;
  14145. $1=self._new_((2));
  14146. $recv($1)._at_put_((1),anObject);
  14147. $ctx1.sendIdx["at:put:"]=1;
  14148. $recv($1)._at_put_((2),anObject2);
  14149. return $recv($1)._yourself();
  14150. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  14151. },
  14152. args: ["anObject", "anObject2"],
  14153. 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",
  14154. referencedClasses: [],
  14155. messageSends: ["at:put:", "new:", "yourself"]
  14156. }),
  14157. $globals.Array.klass);
  14158. $core.addMethod(
  14159. $core.method({
  14160. selector: "with:with:with:",
  14161. protocol: 'instance creation',
  14162. fn: function (anObject,anObject2,anObject3){
  14163. var self=this;
  14164. return $core.withContext(function($ctx1) {
  14165. var $1;
  14166. $1=self._new_((3));
  14167. $recv($1)._at_put_((1),anObject);
  14168. $ctx1.sendIdx["at:put:"]=1;
  14169. $recv($1)._at_put_((2),anObject2);
  14170. $ctx1.sendIdx["at:put:"]=2;
  14171. $recv($1)._at_put_((3),anObject3);
  14172. return $recv($1)._yourself();
  14173. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  14174. },
  14175. args: ["anObject", "anObject2", "anObject3"],
  14176. 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",
  14177. referencedClasses: [],
  14178. messageSends: ["at:put:", "new:", "yourself"]
  14179. }),
  14180. $globals.Array.klass);
  14181. $core.addMethod(
  14182. $core.method({
  14183. selector: "withAll:",
  14184. protocol: 'instance creation',
  14185. fn: function (aCollection){
  14186. var self=this;
  14187. var instance,index;
  14188. return $core.withContext(function($ctx1) {
  14189. index=(1);
  14190. instance=self._new_($recv(aCollection)._size());
  14191. $recv(aCollection)._do_((function(each){
  14192. return $core.withContext(function($ctx2) {
  14193. $recv(instance)._at_put_(index,each);
  14194. index=$recv(index).__plus((1));
  14195. return index;
  14196. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14197. }));
  14198. return instance;
  14199. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  14200. },
  14201. args: ["aCollection"],
  14202. 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",
  14203. referencedClasses: [],
  14204. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  14205. }),
  14206. $globals.Array.klass);
  14207. $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections');
  14208. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  14209. $core.addMethod(
  14210. $core.method({
  14211. selector: ",",
  14212. protocol: 'copying',
  14213. fn: function (aString){
  14214. var self=this;
  14215. return $core.withContext(function($ctx1) {
  14216. var $1;
  14217. $1=self._asString();
  14218. $ctx1.sendIdx["asString"]=1;
  14219. return $recv($1).__comma($recv(aString)._asString());
  14220. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  14221. },
  14222. args: ["aString"],
  14223. source: ", aString\x0a\x09^ self asString, aString asString",
  14224. referencedClasses: [],
  14225. messageSends: [",", "asString"]
  14226. }),
  14227. $globals.CharacterArray);
  14228. $core.addMethod(
  14229. $core.method({
  14230. selector: "add:",
  14231. protocol: 'adding/removing',
  14232. fn: function (anObject){
  14233. var self=this;
  14234. return $core.withContext(function($ctx1) {
  14235. self._errorReadOnly();
  14236. return self;
  14237. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  14238. },
  14239. args: ["anObject"],
  14240. source: "add: anObject\x0a\x09self errorReadOnly",
  14241. referencedClasses: [],
  14242. messageSends: ["errorReadOnly"]
  14243. }),
  14244. $globals.CharacterArray);
  14245. $core.addMethod(
  14246. $core.method({
  14247. selector: "asLowercase",
  14248. protocol: 'converting',
  14249. fn: function (){
  14250. var self=this;
  14251. return $core.withContext(function($ctx1) {
  14252. return $recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  14253. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  14254. },
  14255. args: [],
  14256. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  14257. referencedClasses: [],
  14258. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  14259. }),
  14260. $globals.CharacterArray);
  14261. $core.addMethod(
  14262. $core.method({
  14263. selector: "asNumber",
  14264. protocol: 'converting',
  14265. fn: function (){
  14266. var self=this;
  14267. return $core.withContext(function($ctx1) {
  14268. return $recv(self._asString())._asNumber();
  14269. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  14270. },
  14271. args: [],
  14272. source: "asNumber\x0a\x09^ self asString asNumber",
  14273. referencedClasses: [],
  14274. messageSends: ["asNumber", "asString"]
  14275. }),
  14276. $globals.CharacterArray);
  14277. $core.addMethod(
  14278. $core.method({
  14279. selector: "asString",
  14280. protocol: 'converting',
  14281. fn: function (){
  14282. var self=this;
  14283. return $core.withContext(function($ctx1) {
  14284. return self._subclassResponsibility();
  14285. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  14286. },
  14287. args: [],
  14288. source: "asString\x0a\x09^ self subclassResponsibility",
  14289. referencedClasses: [],
  14290. messageSends: ["subclassResponsibility"]
  14291. }),
  14292. $globals.CharacterArray);
  14293. $core.addMethod(
  14294. $core.method({
  14295. selector: "asSymbol",
  14296. protocol: 'converting',
  14297. fn: function (){
  14298. var self=this;
  14299. return $core.withContext(function($ctx1) {
  14300. return self._asString();
  14301. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  14302. },
  14303. args: [],
  14304. source: "asSymbol\x0a\x09^ self asString",
  14305. referencedClasses: [],
  14306. messageSends: ["asString"]
  14307. }),
  14308. $globals.CharacterArray);
  14309. $core.addMethod(
  14310. $core.method({
  14311. selector: "asUppercase",
  14312. protocol: 'converting',
  14313. fn: function (){
  14314. var self=this;
  14315. return $core.withContext(function($ctx1) {
  14316. return $recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  14317. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  14318. },
  14319. args: [],
  14320. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  14321. referencedClasses: [],
  14322. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  14323. }),
  14324. $globals.CharacterArray);
  14325. $core.addMethod(
  14326. $core.method({
  14327. selector: "at:put:",
  14328. protocol: 'accessing',
  14329. fn: function (anIndex,anObject){
  14330. var self=this;
  14331. return $core.withContext(function($ctx1) {
  14332. self._errorReadOnly();
  14333. return self;
  14334. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  14335. },
  14336. args: ["anIndex", "anObject"],
  14337. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  14338. referencedClasses: [],
  14339. messageSends: ["errorReadOnly"]
  14340. }),
  14341. $globals.CharacterArray);
  14342. $core.addMethod(
  14343. $core.method({
  14344. selector: "errorReadOnly",
  14345. protocol: 'error handling',
  14346. fn: function (){
  14347. var self=this;
  14348. return $core.withContext(function($ctx1) {
  14349. self._error_("Object is read-only");
  14350. return self;
  14351. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  14352. },
  14353. args: [],
  14354. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  14355. referencedClasses: [],
  14356. messageSends: ["error:"]
  14357. }),
  14358. $globals.CharacterArray);
  14359. $core.addMethod(
  14360. $core.method({
  14361. selector: "printOn:",
  14362. protocol: 'printing',
  14363. fn: function (aStream){
  14364. var self=this;
  14365. return $core.withContext(function($ctx1) {
  14366. $recv(self._asString())._printOn_(aStream);
  14367. return self;
  14368. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  14369. },
  14370. args: ["aStream"],
  14371. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  14372. referencedClasses: [],
  14373. messageSends: ["printOn:", "asString"]
  14374. }),
  14375. $globals.CharacterArray);
  14376. $core.addMethod(
  14377. $core.method({
  14378. selector: "putOn:",
  14379. protocol: 'streaming',
  14380. fn: function (aStream){
  14381. var self=this;
  14382. return $core.withContext(function($ctx1) {
  14383. $recv(aStream)._nextPutString_(self);
  14384. return self;
  14385. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  14386. },
  14387. args: ["aStream"],
  14388. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  14389. referencedClasses: [],
  14390. messageSends: ["nextPutString:"]
  14391. }),
  14392. $globals.CharacterArray);
  14393. $core.addMethod(
  14394. $core.method({
  14395. selector: "remove:",
  14396. protocol: 'adding/removing',
  14397. fn: function (anObject){
  14398. var self=this;
  14399. return $core.withContext(function($ctx1) {
  14400. self._errorReadOnly();
  14401. return self;
  14402. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  14403. },
  14404. args: ["anObject"],
  14405. source: "remove: anObject\x0a\x09self errorReadOnly",
  14406. referencedClasses: [],
  14407. messageSends: ["errorReadOnly"]
  14408. }),
  14409. $globals.CharacterArray);
  14410. $core.addMethod(
  14411. $core.method({
  14412. selector: "fromString:",
  14413. protocol: 'instance creation',
  14414. fn: function (aString){
  14415. var self=this;
  14416. return $core.withContext(function($ctx1) {
  14417. self._subclassResponsibility();
  14418. return self;
  14419. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  14420. },
  14421. args: ["aString"],
  14422. source: "fromString: aString\x0a\x09self subclassResponsibility",
  14423. referencedClasses: [],
  14424. messageSends: ["subclassResponsibility"]
  14425. }),
  14426. $globals.CharacterArray.klass);
  14427. $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections');
  14428. $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 >> #,`";
  14429. $core.addMethod(
  14430. $core.method({
  14431. selector: ",",
  14432. protocol: 'copying',
  14433. fn: function (aString){
  14434. var self=this;
  14435. return $core.withContext(function($ctx1) {
  14436. return String(self) + aString;
  14437. return self;
  14438. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  14439. },
  14440. args: ["aString"],
  14441. source: ", aString\x0a\x09<return String(self) + aString>",
  14442. referencedClasses: [],
  14443. messageSends: []
  14444. }),
  14445. $globals.String);
  14446. $core.addMethod(
  14447. $core.method({
  14448. selector: "<",
  14449. protocol: 'comparing',
  14450. fn: function (aString){
  14451. var self=this;
  14452. return $core.withContext(function($ctx1) {
  14453. return String(self) < aString._asString();
  14454. return self;
  14455. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  14456. },
  14457. args: ["aString"],
  14458. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  14459. referencedClasses: [],
  14460. messageSends: []
  14461. }),
  14462. $globals.String);
  14463. $core.addMethod(
  14464. $core.method({
  14465. selector: "<=",
  14466. protocol: 'comparing',
  14467. fn: function (aString){
  14468. var self=this;
  14469. return $core.withContext(function($ctx1) {
  14470. return String(self) <= aString._asString();
  14471. return self;
  14472. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  14473. },
  14474. args: ["aString"],
  14475. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  14476. referencedClasses: [],
  14477. messageSends: []
  14478. }),
  14479. $globals.String);
  14480. $core.addMethod(
  14481. $core.method({
  14482. selector: "=",
  14483. protocol: 'comparing',
  14484. fn: function (aString){
  14485. var self=this;
  14486. return $core.withContext(function($ctx1) {
  14487. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  14488. return self;
  14489. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  14490. },
  14491. args: ["aString"],
  14492. source: "= aString\x0a<return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())>",
  14493. referencedClasses: [],
  14494. messageSends: []
  14495. }),
  14496. $globals.String);
  14497. $core.addMethod(
  14498. $core.method({
  14499. selector: "==",
  14500. protocol: 'comparing',
  14501. fn: function (aString){
  14502. var self=this;
  14503. return $core.withContext(function($ctx1) {
  14504. if (typeof aString === "string") return String(self) === aString;
  14505. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  14506. else return false;;
  14507. return self;
  14508. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  14509. },
  14510. args: ["aString"],
  14511. source: "== aString\x0a<\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>",
  14512. referencedClasses: [],
  14513. messageSends: []
  14514. }),
  14515. $globals.String);
  14516. $core.addMethod(
  14517. $core.method({
  14518. selector: ">",
  14519. protocol: 'comparing',
  14520. fn: function (aString){
  14521. var self=this;
  14522. return $core.withContext(function($ctx1) {
  14523. return String(self) > aString._asString();
  14524. return self;
  14525. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  14526. },
  14527. args: ["aString"],
  14528. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  14529. referencedClasses: [],
  14530. messageSends: []
  14531. }),
  14532. $globals.String);
  14533. $core.addMethod(
  14534. $core.method({
  14535. selector: ">=",
  14536. protocol: 'comparing',
  14537. fn: function (aString){
  14538. var self=this;
  14539. return $core.withContext(function($ctx1) {
  14540. return String(self) >= aString._asString();
  14541. return self;
  14542. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  14543. },
  14544. args: ["aString"],
  14545. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  14546. referencedClasses: [],
  14547. messageSends: []
  14548. }),
  14549. $globals.String);
  14550. $core.addMethod(
  14551. $core.method({
  14552. selector: "asJSON",
  14553. protocol: 'converting',
  14554. fn: function (){
  14555. var self=this;
  14556. return self;
  14557. },
  14558. args: [],
  14559. source: "asJSON\x0a\x09^ self",
  14560. referencedClasses: [],
  14561. messageSends: []
  14562. }),
  14563. $globals.String);
  14564. $core.addMethod(
  14565. $core.method({
  14566. selector: "asJavaScriptMethodName",
  14567. protocol: 'converting',
  14568. fn: function (){
  14569. var self=this;
  14570. return $core.withContext(function($ctx1) {
  14571. return $core.st2js(self);
  14572. return self;
  14573. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  14574. },
  14575. args: [],
  14576. source: "asJavaScriptMethodName\x0a\x09<return $core.st2js(self)>",
  14577. referencedClasses: [],
  14578. messageSends: []
  14579. }),
  14580. $globals.String);
  14581. $core.addMethod(
  14582. $core.method({
  14583. selector: "asJavascript",
  14584. protocol: 'converting',
  14585. fn: function (){
  14586. var self=this;
  14587. return $core.withContext(function($ctx1) {
  14588. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  14589. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  14590. else
  14591. return "\"" + self + "\"";
  14592. ;
  14593. return self;
  14594. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  14595. },
  14596. args: [],
  14597. source: "asJavascript\x0a\x09<\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>",
  14598. referencedClasses: [],
  14599. messageSends: []
  14600. }),
  14601. $globals.String);
  14602. $core.addMethod(
  14603. $core.method({
  14604. selector: "asLowercase",
  14605. protocol: 'converting',
  14606. fn: function (){
  14607. var self=this;
  14608. return $core.withContext(function($ctx1) {
  14609. return self.toLowerCase();
  14610. return self;
  14611. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  14612. },
  14613. args: [],
  14614. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  14615. referencedClasses: [],
  14616. messageSends: []
  14617. }),
  14618. $globals.String);
  14619. $core.addMethod(
  14620. $core.method({
  14621. selector: "asMutator",
  14622. protocol: 'converting',
  14623. fn: function (){
  14624. var self=this;
  14625. return $core.withContext(function($ctx1) {
  14626. var $1;
  14627. $1=$recv(self._last()).__eq(":");
  14628. if(!$core.assert($1)){
  14629. return self.__comma(":");
  14630. };
  14631. return self;
  14632. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  14633. },
  14634. args: [],
  14635. 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",
  14636. referencedClasses: [],
  14637. messageSends: ["ifFalse:", "=", "last", ","]
  14638. }),
  14639. $globals.String);
  14640. $core.addMethod(
  14641. $core.method({
  14642. selector: "asNumber",
  14643. protocol: 'converting',
  14644. fn: function (){
  14645. var self=this;
  14646. return $core.withContext(function($ctx1) {
  14647. return Number(self);
  14648. return self;
  14649. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  14650. },
  14651. args: [],
  14652. source: "asNumber\x0a\x09<return Number(self)>",
  14653. referencedClasses: [],
  14654. messageSends: []
  14655. }),
  14656. $globals.String);
  14657. $core.addMethod(
  14658. $core.method({
  14659. selector: "asRegexp",
  14660. protocol: 'converting',
  14661. fn: function (){
  14662. var self=this;
  14663. return $core.withContext(function($ctx1) {
  14664. return $recv($globals.RegularExpression)._fromString_(self);
  14665. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  14666. },
  14667. args: [],
  14668. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  14669. referencedClasses: ["RegularExpression"],
  14670. messageSends: ["fromString:"]
  14671. }),
  14672. $globals.String);
  14673. $core.addMethod(
  14674. $core.method({
  14675. selector: "asString",
  14676. protocol: 'converting',
  14677. fn: function (){
  14678. var self=this;
  14679. return self;
  14680. },
  14681. args: [],
  14682. source: "asString\x0a\x09^ self",
  14683. referencedClasses: [],
  14684. messageSends: []
  14685. }),
  14686. $globals.String);
  14687. $core.addMethod(
  14688. $core.method({
  14689. selector: "asSymbol",
  14690. protocol: 'converting',
  14691. fn: function (){
  14692. var self=this;
  14693. return self;
  14694. },
  14695. args: [],
  14696. source: "asSymbol\x0a\x09^ self",
  14697. referencedClasses: [],
  14698. messageSends: []
  14699. }),
  14700. $globals.String);
  14701. $core.addMethod(
  14702. $core.method({
  14703. selector: "asUppercase",
  14704. protocol: 'converting',
  14705. fn: function (){
  14706. var self=this;
  14707. return $core.withContext(function($ctx1) {
  14708. return self.toUpperCase();
  14709. return self;
  14710. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  14711. },
  14712. args: [],
  14713. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  14714. referencedClasses: [],
  14715. messageSends: []
  14716. }),
  14717. $globals.String);
  14718. $core.addMethod(
  14719. $core.method({
  14720. selector: "asciiValue",
  14721. protocol: 'accessing',
  14722. fn: function (){
  14723. var self=this;
  14724. return $core.withContext(function($ctx1) {
  14725. return self.charCodeAt(0);;
  14726. return self;
  14727. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  14728. },
  14729. args: [],
  14730. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  14731. referencedClasses: [],
  14732. messageSends: []
  14733. }),
  14734. $globals.String);
  14735. $core.addMethod(
  14736. $core.method({
  14737. selector: "at:ifAbsent:",
  14738. protocol: 'accessing',
  14739. fn: function (anIndex,aBlock){
  14740. var self=this;
  14741. return $core.withContext(function($ctx1) {
  14742. return String(self)[anIndex - 1] || aBlock._value();
  14743. return self;
  14744. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  14745. },
  14746. args: ["anIndex", "aBlock"],
  14747. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  14748. referencedClasses: [],
  14749. messageSends: []
  14750. }),
  14751. $globals.String);
  14752. $core.addMethod(
  14753. $core.method({
  14754. selector: "at:ifPresent:ifAbsent:",
  14755. protocol: 'accessing',
  14756. fn: function (anIndex,aBlock,anotherBlock){
  14757. var self=this;
  14758. return $core.withContext(function($ctx1) {
  14759. var result = String(self)[anIndex - 1];
  14760. return result ? aBlock._value_(result) : anotherBlock._value();
  14761. ;
  14762. return self;
  14763. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  14764. },
  14765. args: ["anIndex", "aBlock", "anotherBlock"],
  14766. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09>",
  14767. referencedClasses: [],
  14768. messageSends: []
  14769. }),
  14770. $globals.String);
  14771. $core.addMethod(
  14772. $core.method({
  14773. selector: "capitalized",
  14774. protocol: 'converting',
  14775. fn: function (){
  14776. var self=this;
  14777. return $core.withContext(function($ctx1) {
  14778. var $1;
  14779. $1=self._isEmpty();
  14780. if($core.assert($1)){
  14781. return self;
  14782. } else {
  14783. return $recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  14784. };
  14785. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  14786. },
  14787. args: [],
  14788. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  14789. referencedClasses: [],
  14790. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"]
  14791. }),
  14792. $globals.String);
  14793. $core.addMethod(
  14794. $core.method({
  14795. selector: "charCodeAt:",
  14796. protocol: 'accessing',
  14797. fn: function (anInteger){
  14798. var self=this;
  14799. return $core.withContext(function($ctx1) {
  14800. return self.charCodeAt(anInteger - 1);
  14801. return self;
  14802. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  14803. },
  14804. args: ["anInteger"],
  14805. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  14806. referencedClasses: [],
  14807. messageSends: []
  14808. }),
  14809. $globals.String);
  14810. $core.addMethod(
  14811. $core.method({
  14812. selector: "copyFrom:to:",
  14813. protocol: 'copying',
  14814. fn: function (anIndex,anotherIndex){
  14815. var self=this;
  14816. return $core.withContext(function($ctx1) {
  14817. return self.substring(anIndex - 1, anotherIndex);
  14818. return self;
  14819. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  14820. },
  14821. args: ["anIndex", "anotherIndex"],
  14822. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  14823. referencedClasses: [],
  14824. messageSends: []
  14825. }),
  14826. $globals.String);
  14827. $core.addMethod(
  14828. $core.method({
  14829. selector: "crlfSanitized",
  14830. protocol: 'converting',
  14831. fn: function (){
  14832. var self=this;
  14833. return $core.withContext(function($ctx1) {
  14834. return $recv(self._lines())._join_($recv($globals.String)._lf());
  14835. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  14836. },
  14837. args: [],
  14838. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  14839. referencedClasses: ["String"],
  14840. messageSends: ["join:", "lines", "lf"]
  14841. }),
  14842. $globals.String);
  14843. $core.addMethod(
  14844. $core.method({
  14845. selector: "deepCopy",
  14846. protocol: 'copying',
  14847. fn: function (){
  14848. var self=this;
  14849. return $core.withContext(function($ctx1) {
  14850. return self._shallowCopy();
  14851. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  14852. },
  14853. args: [],
  14854. source: "deepCopy\x0a\x09^ self shallowCopy",
  14855. referencedClasses: [],
  14856. messageSends: ["shallowCopy"]
  14857. }),
  14858. $globals.String);
  14859. $core.addMethod(
  14860. $core.method({
  14861. selector: "escaped",
  14862. protocol: 'converting',
  14863. fn: function (){
  14864. var self=this;
  14865. return $core.withContext(function($ctx1) {
  14866. return escape(self);
  14867. return self;
  14868. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  14869. },
  14870. args: [],
  14871. source: "escaped\x0a\x09<return escape(self)>",
  14872. referencedClasses: [],
  14873. messageSends: []
  14874. }),
  14875. $globals.String);
  14876. $core.addMethod(
  14877. $core.method({
  14878. selector: "includesSubString:",
  14879. protocol: 'testing',
  14880. fn: function (subString){
  14881. var self=this;
  14882. return $core.withContext(function($ctx1) {
  14883. return self.indexOf(subString) != -1;
  14884. return self;
  14885. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  14886. },
  14887. args: ["subString"],
  14888. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  14889. referencedClasses: [],
  14890. messageSends: []
  14891. }),
  14892. $globals.String);
  14893. $core.addMethod(
  14894. $core.method({
  14895. selector: "isCapitalized",
  14896. protocol: 'testing',
  14897. fn: function (){
  14898. var self=this;
  14899. return $core.withContext(function($ctx1) {
  14900. var $2,$1;
  14901. $2=self._first();
  14902. $ctx1.sendIdx["first"]=1;
  14903. $1=$recv($2)._asUppercase();
  14904. return $recv($1).__eq_eq(self._first());
  14905. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  14906. },
  14907. args: [],
  14908. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  14909. referencedClasses: [],
  14910. messageSends: ["==", "asUppercase", "first"]
  14911. }),
  14912. $globals.String);
  14913. $core.addMethod(
  14914. $core.method({
  14915. selector: "isImmutable",
  14916. protocol: 'testing',
  14917. fn: function (){
  14918. var self=this;
  14919. return true;
  14920. },
  14921. args: [],
  14922. source: "isImmutable\x0a\x09^ true",
  14923. referencedClasses: [],
  14924. messageSends: []
  14925. }),
  14926. $globals.String);
  14927. $core.addMethod(
  14928. $core.method({
  14929. selector: "isString",
  14930. protocol: 'testing',
  14931. fn: function (){
  14932. var self=this;
  14933. return true;
  14934. },
  14935. args: [],
  14936. source: "isString\x0a\x09^ true",
  14937. referencedClasses: [],
  14938. messageSends: []
  14939. }),
  14940. $globals.String);
  14941. $core.addMethod(
  14942. $core.method({
  14943. selector: "isVowel",
  14944. protocol: 'testing',
  14945. fn: function (){
  14946. var self=this;
  14947. return $core.withContext(function($ctx1) {
  14948. return $recv($recv(self._size()).__eq((1)))._and_((function(){
  14949. return $core.withContext(function($ctx2) {
  14950. return "aeiou"._includes_(self._asLowercase());
  14951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14952. }));
  14953. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  14954. },
  14955. args: [],
  14956. 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 ]",
  14957. referencedClasses: [],
  14958. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  14959. }),
  14960. $globals.String);
  14961. $core.addMethod(
  14962. $core.method({
  14963. selector: "join:",
  14964. protocol: 'split join',
  14965. fn: function (aCollection){
  14966. var self=this;
  14967. return $core.withContext(function($ctx1) {
  14968. return $recv($globals.String)._streamContents_((function(stream){
  14969. return $core.withContext(function($ctx2) {
  14970. return $recv(aCollection)._do_separatedBy_((function(each){
  14971. return $core.withContext(function($ctx3) {
  14972. return $recv(stream)._nextPutAll_($recv(each)._asString());
  14973. $ctx3.sendIdx["nextPutAll:"]=1;
  14974. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14975. }),(function(){
  14976. return $core.withContext(function($ctx3) {
  14977. return $recv(stream)._nextPutAll_(self);
  14978. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14979. }));
  14980. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14981. }));
  14982. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  14983. },
  14984. args: ["aCollection"],
  14985. 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 ]]",
  14986. referencedClasses: ["String"],
  14987. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  14988. }),
  14989. $globals.String);
  14990. $core.addMethod(
  14991. $core.method({
  14992. selector: "lineIndicesDo:",
  14993. protocol: 'split join',
  14994. fn: function (aBlock){
  14995. var self=this;
  14996. var cr,lf,start,sz,nextLF,nextCR;
  14997. return $core.withContext(function($ctx1) {
  14998. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  14999. var $early={};
  15000. try {
  15001. start=(1);
  15002. sz=self._size();
  15003. cr=$recv($globals.String)._cr();
  15004. nextCR=self._indexOf_startingAt_(cr,(1));
  15005. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  15006. lf=$recv($globals.String)._lf();
  15007. nextLF=self._indexOf_startingAt_(lf,(1));
  15008. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  15009. $recv((function(){
  15010. return $core.withContext(function($ctx2) {
  15011. return $recv(start).__lt_eq(sz);
  15012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15013. }))._whileTrue_((function(){
  15014. return $core.withContext(function($ctx2) {
  15015. $2=$recv(nextLF).__eq((0));
  15016. $ctx2.sendIdx["="]=1;
  15017. $1=$recv($2)._and_((function(){
  15018. return $core.withContext(function($ctx3) {
  15019. return $recv(nextCR).__eq((0));
  15020. $ctx3.sendIdx["="]=2;
  15021. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  15022. }));
  15023. $ctx2.sendIdx["and:"]=1;
  15024. if($core.assert($1)){
  15025. $recv(aBlock)._value_value_value_(start,sz,sz);
  15026. $ctx2.sendIdx["value:value:value:"]=1;
  15027. throw $early=[self];
  15028. };
  15029. $4=$recv(nextCR).__eq((0));
  15030. $ctx2.sendIdx["="]=3;
  15031. $3=$recv($4)._or_((function(){
  15032. return $core.withContext(function($ctx3) {
  15033. $5=(0).__lt(nextLF);
  15034. $ctx3.sendIdx["<"]=1;
  15035. return $recv($5)._and_((function(){
  15036. return $core.withContext(function($ctx4) {
  15037. return $recv(nextLF).__lt(nextCR);
  15038. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  15039. }));
  15040. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  15041. }));
  15042. if($core.assert($3)){
  15043. $6=start;
  15044. $7=$recv(nextLF).__minus((1));
  15045. $ctx2.sendIdx["-"]=1;
  15046. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  15047. $ctx2.sendIdx["value:value:value:"]=2;
  15048. start=(1).__plus(nextLF);
  15049. $ctx2.sendIdx["+"]=1;
  15050. start;
  15051. nextLF=self._indexOf_startingAt_(lf,start);
  15052. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  15053. return nextLF;
  15054. } else {
  15055. $9=(1).__plus(nextCR);
  15056. $ctx2.sendIdx["+"]=2;
  15057. $8=$recv($9).__eq(nextLF);
  15058. if($core.assert($8)){
  15059. $10=start;
  15060. $11=$recv(nextCR).__minus((1));
  15061. $ctx2.sendIdx["-"]=2;
  15062. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  15063. $ctx2.sendIdx["value:value:value:"]=3;
  15064. start=(1).__plus(nextLF);
  15065. $ctx2.sendIdx["+"]=3;
  15066. start;
  15067. nextCR=self._indexOf_startingAt_(cr,start);
  15068. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  15069. nextCR;
  15070. nextLF=self._indexOf_startingAt_(lf,start);
  15071. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  15072. return nextLF;
  15073. } else {
  15074. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  15075. start=(1).__plus(nextCR);
  15076. start;
  15077. nextCR=self._indexOf_startingAt_(cr,start);
  15078. return nextCR;
  15079. };
  15080. };
  15081. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15082. }));
  15083. return self;
  15084. }
  15085. catch(e) {if(e===$early)return e[0]; throw e}
  15086. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  15087. },
  15088. args: ["aBlock"],
  15089. 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 ] ]]",
  15090. referencedClasses: ["String"],
  15091. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  15092. }),
  15093. $globals.String);
  15094. $core.addMethod(
  15095. $core.method({
  15096. selector: "lineNumber:",
  15097. protocol: 'split join',
  15098. fn: function (anIndex){
  15099. var self=this;
  15100. var lineCount;
  15101. return $core.withContext(function($ctx1) {
  15102. var $2,$1;
  15103. var $early={};
  15104. try {
  15105. lineCount=(0);
  15106. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  15107. return $core.withContext(function($ctx2) {
  15108. lineCount=$recv(lineCount).__plus((1));
  15109. $2=lineCount;
  15110. $1=$recv($2).__eq(anIndex);
  15111. if($core.assert($1)){
  15112. throw $early=[self._copyFrom_to_(start,endWithoutDelimiters)];
  15113. };
  15114. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  15115. }));
  15116. return nil;
  15117. }
  15118. catch(e) {if(e===$early)return e[0]; throw e}
  15119. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  15120. },
  15121. args: ["anIndex"],
  15122. 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",
  15123. referencedClasses: [],
  15124. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  15125. }),
  15126. $globals.String);
  15127. $core.addMethod(
  15128. $core.method({
  15129. selector: "lines",
  15130. protocol: 'split join',
  15131. fn: function (){
  15132. var self=this;
  15133. return $core.withContext(function($ctx1) {
  15134. var result = self.split(/\r\n|\r|\n/);
  15135. if (!result[result.length-1]) result.pop();
  15136. return result;;
  15137. return self;
  15138. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  15139. },
  15140. args: [],
  15141. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a<\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;\x0a>",
  15142. referencedClasses: [],
  15143. messageSends: []
  15144. }),
  15145. $globals.String);
  15146. $core.addMethod(
  15147. $core.method({
  15148. selector: "linesDo:",
  15149. protocol: 'split join',
  15150. fn: function (aBlock){
  15151. var self=this;
  15152. return $core.withContext(function($ctx1) {
  15153. $recv(self._lines())._do_(aBlock);
  15154. return self;
  15155. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  15156. },
  15157. args: ["aBlock"],
  15158. 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",
  15159. referencedClasses: [],
  15160. messageSends: ["do:", "lines"]
  15161. }),
  15162. $globals.String);
  15163. $core.addMethod(
  15164. $core.method({
  15165. selector: "match:",
  15166. protocol: 'regular expressions',
  15167. fn: function (aRegexp){
  15168. var self=this;
  15169. return $core.withContext(function($ctx1) {
  15170. return self.search(aRegexp) != -1;
  15171. return self;
  15172. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  15173. },
  15174. args: ["aRegexp"],
  15175. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  15176. referencedClasses: [],
  15177. messageSends: []
  15178. }),
  15179. $globals.String);
  15180. $core.addMethod(
  15181. $core.method({
  15182. selector: "matchesOf:",
  15183. protocol: 'regular expressions',
  15184. fn: function (aRegularExpression){
  15185. var self=this;
  15186. return $core.withContext(function($ctx1) {
  15187. return self.match(aRegularExpression);
  15188. return self;
  15189. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  15190. },
  15191. args: ["aRegularExpression"],
  15192. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  15193. referencedClasses: [],
  15194. messageSends: []
  15195. }),
  15196. $globals.String);
  15197. $core.addMethod(
  15198. $core.method({
  15199. selector: "numericallyIndexable",
  15200. protocol: 'private',
  15201. fn: function (){
  15202. var self=this;
  15203. return $core.withContext(function($ctx1) {
  15204. return String(self);
  15205. return self;
  15206. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  15207. },
  15208. args: [],
  15209. source: "numericallyIndexable\x0a\x09<return String(self)>",
  15210. referencedClasses: [],
  15211. messageSends: []
  15212. }),
  15213. $globals.String);
  15214. $core.addMethod(
  15215. $core.method({
  15216. selector: "printNl",
  15217. protocol: 'printing',
  15218. fn: function (){
  15219. var self=this;
  15220. return $core.withContext(function($ctx1) {
  15221. console.log(self);
  15222. return self;
  15223. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  15224. },
  15225. args: [],
  15226. source: "printNl\x0a\x09<console.log(self)>",
  15227. referencedClasses: [],
  15228. messageSends: []
  15229. }),
  15230. $globals.String);
  15231. $core.addMethod(
  15232. $core.method({
  15233. selector: "printOn:",
  15234. protocol: 'printing',
  15235. fn: function (aStream){
  15236. var self=this;
  15237. return $core.withContext(function($ctx1) {
  15238. $recv(aStream)._nextPutAll_("'");
  15239. $ctx1.sendIdx["nextPutAll:"]=1;
  15240. $recv(aStream)._nextPutAll_(self);
  15241. $ctx1.sendIdx["nextPutAll:"]=2;
  15242. $recv(aStream)._nextPutAll_("'");
  15243. return self;
  15244. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  15245. },
  15246. args: ["aStream"],
  15247. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  15248. referencedClasses: [],
  15249. messageSends: ["nextPutAll:"]
  15250. }),
  15251. $globals.String);
  15252. $core.addMethod(
  15253. $core.method({
  15254. selector: "replace:with:",
  15255. protocol: 'regular expressions',
  15256. fn: function (aString,anotherString){
  15257. var self=this;
  15258. return $core.withContext(function($ctx1) {
  15259. return self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  15260. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  15261. },
  15262. args: ["aString", "anotherString"],
  15263. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  15264. referencedClasses: ["RegularExpression"],
  15265. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  15266. }),
  15267. $globals.String);
  15268. $core.addMethod(
  15269. $core.method({
  15270. selector: "replaceRegexp:with:",
  15271. protocol: 'regular expressions',
  15272. fn: function (aRegexp,aString){
  15273. var self=this;
  15274. return $core.withContext(function($ctx1) {
  15275. return self.replace(aRegexp, aString);
  15276. return self;
  15277. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  15278. },
  15279. args: ["aRegexp", "aString"],
  15280. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  15281. referencedClasses: [],
  15282. messageSends: []
  15283. }),
  15284. $globals.String);
  15285. $core.addMethod(
  15286. $core.method({
  15287. selector: "reversed",
  15288. protocol: 'converting',
  15289. fn: function (){
  15290. var self=this;
  15291. return $core.withContext(function($ctx1) {
  15292. return self.split("").reverse().join("");
  15293. return self;
  15294. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  15295. },
  15296. args: [],
  15297. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  15298. referencedClasses: [],
  15299. messageSends: []
  15300. }),
  15301. $globals.String);
  15302. $core.addMethod(
  15303. $core.method({
  15304. selector: "shallowCopy",
  15305. protocol: 'copying',
  15306. fn: function (){
  15307. var self=this;
  15308. return self;
  15309. },
  15310. args: [],
  15311. source: "shallowCopy\x0a\x09^ self",
  15312. referencedClasses: [],
  15313. messageSends: []
  15314. }),
  15315. $globals.String);
  15316. $core.addMethod(
  15317. $core.method({
  15318. selector: "size",
  15319. protocol: 'accessing',
  15320. fn: function (){
  15321. var self=this;
  15322. return $core.withContext(function($ctx1) {
  15323. return self.length;
  15324. return self;
  15325. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  15326. },
  15327. args: [],
  15328. source: "size\x0a\x09<return self.length>",
  15329. referencedClasses: [],
  15330. messageSends: []
  15331. }),
  15332. $globals.String);
  15333. $core.addMethod(
  15334. $core.method({
  15335. selector: "subStrings:",
  15336. protocol: 'split join',
  15337. fn: function (aString){
  15338. var self=this;
  15339. return $core.withContext(function($ctx1) {
  15340. return self._tokenize_(aString);
  15341. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  15342. },
  15343. args: ["aString"],
  15344. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  15345. referencedClasses: [],
  15346. messageSends: ["tokenize:"]
  15347. }),
  15348. $globals.String);
  15349. $core.addMethod(
  15350. $core.method({
  15351. selector: "tokenize:",
  15352. protocol: 'split join',
  15353. fn: function (aString){
  15354. var self=this;
  15355. return $core.withContext(function($ctx1) {
  15356. return self.split(aString);
  15357. return self;
  15358. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  15359. },
  15360. args: ["aString"],
  15361. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  15362. referencedClasses: [],
  15363. messageSends: []
  15364. }),
  15365. $globals.String);
  15366. $core.addMethod(
  15367. $core.method({
  15368. selector: "trimBoth",
  15369. protocol: 'regular expressions',
  15370. fn: function (){
  15371. var self=this;
  15372. return $core.withContext(function($ctx1) {
  15373. return self._trimBoth_("\x5cs");
  15374. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  15375. },
  15376. args: [],
  15377. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  15378. referencedClasses: [],
  15379. messageSends: ["trimBoth:"]
  15380. }),
  15381. $globals.String);
  15382. $core.addMethod(
  15383. $core.method({
  15384. selector: "trimBoth:",
  15385. protocol: 'regular expressions',
  15386. fn: function (separators){
  15387. var self=this;
  15388. return $core.withContext(function($ctx1) {
  15389. return $recv(self._trimLeft_(separators))._trimRight_(separators);
  15390. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  15391. },
  15392. args: ["separators"],
  15393. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  15394. referencedClasses: [],
  15395. messageSends: ["trimRight:", "trimLeft:"]
  15396. }),
  15397. $globals.String);
  15398. $core.addMethod(
  15399. $core.method({
  15400. selector: "trimLeft",
  15401. protocol: 'regular expressions',
  15402. fn: function (){
  15403. var self=this;
  15404. return $core.withContext(function($ctx1) {
  15405. return self._trimLeft_("\x5cs");
  15406. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  15407. },
  15408. args: [],
  15409. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  15410. referencedClasses: [],
  15411. messageSends: ["trimLeft:"]
  15412. }),
  15413. $globals.String);
  15414. $core.addMethod(
  15415. $core.method({
  15416. selector: "trimLeft:",
  15417. protocol: 'regular expressions',
  15418. fn: function (separators){
  15419. var self=this;
  15420. return $core.withContext(function($ctx1) {
  15421. var $2,$1;
  15422. $2=$recv("^[".__comma(separators)).__comma("]+");
  15423. $ctx1.sendIdx[","]=1;
  15424. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  15425. return self._replaceRegexp_with_($1,"");
  15426. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  15427. },
  15428. args: ["separators"],
  15429. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  15430. referencedClasses: ["RegularExpression"],
  15431. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15432. }),
  15433. $globals.String);
  15434. $core.addMethod(
  15435. $core.method({
  15436. selector: "trimRight",
  15437. protocol: 'regular expressions',
  15438. fn: function (){
  15439. var self=this;
  15440. return $core.withContext(function($ctx1) {
  15441. return self._trimRight_("\x5cs");
  15442. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  15443. },
  15444. args: [],
  15445. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  15446. referencedClasses: [],
  15447. messageSends: ["trimRight:"]
  15448. }),
  15449. $globals.String);
  15450. $core.addMethod(
  15451. $core.method({
  15452. selector: "trimRight:",
  15453. protocol: 'regular expressions',
  15454. fn: function (separators){
  15455. var self=this;
  15456. return $core.withContext(function($ctx1) {
  15457. var $2,$1;
  15458. $2=$recv("[".__comma(separators)).__comma("]+$");
  15459. $ctx1.sendIdx[","]=1;
  15460. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  15461. return self._replaceRegexp_with_($1,"");
  15462. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  15463. },
  15464. args: ["separators"],
  15465. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  15466. referencedClasses: ["RegularExpression"],
  15467. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15468. }),
  15469. $globals.String);
  15470. $core.addMethod(
  15471. $core.method({
  15472. selector: "unescaped",
  15473. protocol: 'converting',
  15474. fn: function (){
  15475. var self=this;
  15476. return $core.withContext(function($ctx1) {
  15477. return unescape(self);
  15478. return self;
  15479. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  15480. },
  15481. args: [],
  15482. source: "unescaped\x0a\x09<return unescape(self)>",
  15483. referencedClasses: [],
  15484. messageSends: []
  15485. }),
  15486. $globals.String);
  15487. $core.addMethod(
  15488. $core.method({
  15489. selector: "uriComponentDecoded",
  15490. protocol: 'converting',
  15491. fn: function (){
  15492. var self=this;
  15493. return $core.withContext(function($ctx1) {
  15494. return decodeURIComponent(self);
  15495. return self;
  15496. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  15497. },
  15498. args: [],
  15499. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  15500. referencedClasses: [],
  15501. messageSends: []
  15502. }),
  15503. $globals.String);
  15504. $core.addMethod(
  15505. $core.method({
  15506. selector: "uriComponentEncoded",
  15507. protocol: 'converting',
  15508. fn: function (){
  15509. var self=this;
  15510. return $core.withContext(function($ctx1) {
  15511. return encodeURIComponent(self);
  15512. return self;
  15513. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  15514. },
  15515. args: [],
  15516. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  15517. referencedClasses: [],
  15518. messageSends: []
  15519. }),
  15520. $globals.String);
  15521. $core.addMethod(
  15522. $core.method({
  15523. selector: "uriDecoded",
  15524. protocol: 'converting',
  15525. fn: function (){
  15526. var self=this;
  15527. return $core.withContext(function($ctx1) {
  15528. return decodeURI(self);
  15529. return self;
  15530. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  15531. },
  15532. args: [],
  15533. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  15534. referencedClasses: [],
  15535. messageSends: []
  15536. }),
  15537. $globals.String);
  15538. $core.addMethod(
  15539. $core.method({
  15540. selector: "uriEncoded",
  15541. protocol: 'converting',
  15542. fn: function (){
  15543. var self=this;
  15544. return $core.withContext(function($ctx1) {
  15545. return encodeURI(self);
  15546. return self;
  15547. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  15548. },
  15549. args: [],
  15550. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  15551. referencedClasses: [],
  15552. messageSends: []
  15553. }),
  15554. $globals.String);
  15555. $core.addMethod(
  15556. $core.method({
  15557. selector: "value:",
  15558. protocol: 'evaluating',
  15559. fn: function (anObject){
  15560. var self=this;
  15561. return $core.withContext(function($ctx1) {
  15562. return $recv(anObject)._perform_(self);
  15563. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  15564. },
  15565. args: ["anObject"],
  15566. source: "value: anObject \x0a\x09^ anObject perform: self",
  15567. referencedClasses: [],
  15568. messageSends: ["perform:"]
  15569. }),
  15570. $globals.String);
  15571. $core.addMethod(
  15572. $core.method({
  15573. selector: "cr",
  15574. protocol: 'accessing',
  15575. fn: function (){
  15576. var self=this;
  15577. return $core.withContext(function($ctx1) {
  15578. return '\r';
  15579. return self;
  15580. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  15581. },
  15582. args: [],
  15583. source: "cr\x0a\x09<return '\x5cr'>",
  15584. referencedClasses: [],
  15585. messageSends: []
  15586. }),
  15587. $globals.String.klass);
  15588. $core.addMethod(
  15589. $core.method({
  15590. selector: "crlf",
  15591. protocol: 'accessing',
  15592. fn: function (){
  15593. var self=this;
  15594. return $core.withContext(function($ctx1) {
  15595. return '\r\n';
  15596. return self;
  15597. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  15598. },
  15599. args: [],
  15600. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  15601. referencedClasses: [],
  15602. messageSends: []
  15603. }),
  15604. $globals.String.klass);
  15605. $core.addMethod(
  15606. $core.method({
  15607. selector: "esc",
  15608. protocol: 'accessing',
  15609. fn: function (){
  15610. var self=this;
  15611. return $core.withContext(function($ctx1) {
  15612. return self._fromCharCode_((27));
  15613. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  15614. },
  15615. args: [],
  15616. source: "esc\x0a\x09^ self fromCharCode: 27",
  15617. referencedClasses: [],
  15618. messageSends: ["fromCharCode:"]
  15619. }),
  15620. $globals.String.klass);
  15621. $core.addMethod(
  15622. $core.method({
  15623. selector: "fromCharCode:",
  15624. protocol: 'instance creation',
  15625. fn: function (anInteger){
  15626. var self=this;
  15627. return $core.withContext(function($ctx1) {
  15628. return String.fromCharCode(anInteger);
  15629. return self;
  15630. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  15631. },
  15632. args: ["anInteger"],
  15633. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  15634. referencedClasses: [],
  15635. messageSends: []
  15636. }),
  15637. $globals.String.klass);
  15638. $core.addMethod(
  15639. $core.method({
  15640. selector: "fromString:",
  15641. protocol: 'instance creation',
  15642. fn: function (aString){
  15643. var self=this;
  15644. return $core.withContext(function($ctx1) {
  15645. return String(aString);
  15646. return self;
  15647. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  15648. },
  15649. args: ["aString"],
  15650. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  15651. referencedClasses: [],
  15652. messageSends: []
  15653. }),
  15654. $globals.String.klass);
  15655. $core.addMethod(
  15656. $core.method({
  15657. selector: "lf",
  15658. protocol: 'accessing',
  15659. fn: function (){
  15660. var self=this;
  15661. return $core.withContext(function($ctx1) {
  15662. return '\n';
  15663. return self;
  15664. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  15665. },
  15666. args: [],
  15667. source: "lf\x0a\x09<return '\x5cn'>",
  15668. referencedClasses: [],
  15669. messageSends: []
  15670. }),
  15671. $globals.String.klass);
  15672. $core.addMethod(
  15673. $core.method({
  15674. selector: "random",
  15675. protocol: 'random',
  15676. fn: function (){
  15677. var self=this;
  15678. return $core.withContext(function($ctx1) {
  15679. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  15680. return self;
  15681. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  15682. },
  15683. args: [],
  15684. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);>",
  15685. referencedClasses: [],
  15686. messageSends: []
  15687. }),
  15688. $globals.String.klass);
  15689. $core.addMethod(
  15690. $core.method({
  15691. selector: "randomNotIn:",
  15692. protocol: 'random',
  15693. fn: function (aString){
  15694. var self=this;
  15695. var result;
  15696. return $core.withContext(function($ctx1) {
  15697. $recv((function(){
  15698. return $core.withContext(function($ctx2) {
  15699. result=self._random();
  15700. result;
  15701. return $recv(aString)._includesSubString_(result);
  15702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15703. }))._whileTrue();
  15704. return result;
  15705. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  15706. },
  15707. args: ["aString"],
  15708. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  15709. referencedClasses: [],
  15710. messageSends: ["whileTrue", "random", "includesSubString:"]
  15711. }),
  15712. $globals.String.klass);
  15713. $core.addMethod(
  15714. $core.method({
  15715. selector: "space",
  15716. protocol: 'accessing',
  15717. fn: function (){
  15718. var self=this;
  15719. return $core.withContext(function($ctx1) {
  15720. return ' ';
  15721. return self;
  15722. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  15723. },
  15724. args: [],
  15725. source: "space\x0a\x09<return ' '>",
  15726. referencedClasses: [],
  15727. messageSends: []
  15728. }),
  15729. $globals.String.klass);
  15730. $core.addMethod(
  15731. $core.method({
  15732. selector: "streamClass",
  15733. protocol: 'accessing',
  15734. fn: function (){
  15735. var self=this;
  15736. return $globals.StringStream;
  15737. },
  15738. args: [],
  15739. source: "streamClass\x0a\x09\x09^ StringStream",
  15740. referencedClasses: ["StringStream"],
  15741. messageSends: []
  15742. }),
  15743. $globals.String.klass);
  15744. $core.addMethod(
  15745. $core.method({
  15746. selector: "tab",
  15747. protocol: 'accessing',
  15748. fn: function (){
  15749. var self=this;
  15750. return $core.withContext(function($ctx1) {
  15751. return '\t';
  15752. return self;
  15753. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  15754. },
  15755. args: [],
  15756. source: "tab\x0a\x09<return '\x5ct'>",
  15757. referencedClasses: [],
  15758. messageSends: []
  15759. }),
  15760. $globals.String.klass);
  15761. $core.addMethod(
  15762. $core.method({
  15763. selector: "value:",
  15764. protocol: 'instance creation',
  15765. fn: function (aUTFCharCode){
  15766. var self=this;
  15767. return $core.withContext(function($ctx1) {
  15768. return String.fromCharCode(aUTFCharCode);;
  15769. return self;
  15770. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  15771. },
  15772. args: ["aUTFCharCode"],
  15773. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  15774. referencedClasses: [],
  15775. messageSends: []
  15776. }),
  15777. $globals.String.klass);
  15778. $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  15779. $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`.";
  15780. $core.addMethod(
  15781. $core.method({
  15782. selector: "=",
  15783. protocol: 'comparing',
  15784. fn: function (aCollection){
  15785. var self=this;
  15786. return $core.withContext(function($ctx1) {
  15787. var $2,$1,$4,$3,$5;
  15788. var $early={};
  15789. try {
  15790. $2=self._class();
  15791. $ctx1.sendIdx["class"]=1;
  15792. $1=$recv($2).__eq($recv(aCollection)._class());
  15793. $ctx1.sendIdx["="]=1;
  15794. if(!$core.assert($1)){
  15795. return false;
  15796. };
  15797. $4=self._size();
  15798. $ctx1.sendIdx["size"]=1;
  15799. $3=$recv($4).__eq($recv(aCollection)._size());
  15800. if(!$core.assert($3)){
  15801. return false;
  15802. };
  15803. self._do_((function(each){
  15804. return $core.withContext(function($ctx2) {
  15805. $5=$recv(aCollection)._includes_(each);
  15806. if(!$core.assert($5)){
  15807. throw $early=[false];
  15808. };
  15809. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15810. }));
  15811. return true;
  15812. }
  15813. catch(e) {if(e===$early)return e[0]; throw e}
  15814. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  15815. },
  15816. args: ["aCollection"],
  15817. 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",
  15818. referencedClasses: [],
  15819. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  15820. }),
  15821. $globals.Set);
  15822. $core.addMethod(
  15823. $core.method({
  15824. selector: "add:",
  15825. protocol: 'adding/removing',
  15826. fn: function (anObject){
  15827. var self=this;
  15828. var bucket;
  15829. return $core.withContext(function($ctx1) {
  15830. var $1,$receiver;
  15831. bucket=self._bucketsOfElement_(anObject);
  15832. $1=$recv(bucket)._second();
  15833. if(($receiver = $1) == null || $receiver.isNil){
  15834. var object,slowBucket;
  15835. object=$recv(bucket)._first();
  15836. $ctx1.sendIdx["first"]=1;
  15837. object;
  15838. slowBucket=$recv(bucket)._third();
  15839. slowBucket;
  15840. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  15841. return $core.withContext(function($ctx2) {
  15842. $recv(slowBucket)._add_(object);
  15843. self["@size"]=$recv(self["@size"]).__plus((1));
  15844. return self["@size"];
  15845. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15846. }));
  15847. return object;
  15848. } else {
  15849. var primitiveBucket;
  15850. primitiveBucket=$receiver;
  15851. return self._add_in_($recv(bucket)._first(),primitiveBucket);
  15852. };
  15853. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  15854. },
  15855. args: ["anObject"],
  15856. 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 ]",
  15857. referencedClasses: [],
  15858. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  15859. }),
  15860. $globals.Set);
  15861. $core.addMethod(
  15862. $core.method({
  15863. selector: "add:in:",
  15864. protocol: 'private',
  15865. fn: function (anObject,anotherObject){
  15866. var self=this;
  15867. return $core.withContext(function($ctx1) {
  15868. if (anObject in anotherObject.store) { return false; }
  15869. self['@size']++;
  15870. anotherObject.store[anObject] = true;
  15871. return anObject;
  15872. ;
  15873. return self;
  15874. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  15875. },
  15876. args: ["anObject", "anotherObject"],
  15877. source: "add: anObject in: anotherObject\x0a\x09<\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>",
  15878. referencedClasses: [],
  15879. messageSends: []
  15880. }),
  15881. $globals.Set);
  15882. $core.addMethod(
  15883. $core.method({
  15884. selector: "bucketsOfElement:",
  15885. protocol: 'private',
  15886. fn: function (anObject){
  15887. var self=this;
  15888. return $core.withContext(function($ctx1) {
  15889. // include nil to well-known objects under 'boolean' fastBucket
  15890. if (anObject == null || anObject.isNil) return [ null, self['@fastBuckets'].boolean ];
  15891. var prim = anObject.valueOf();
  15892. if (typeof prim === "object" || typeof prim === "function" || !self['@fastBuckets'][typeof prim]) {
  15893. var bucket = null;
  15894. self['@slowBucketStores'].some(function (store) {
  15895. return bucket = store._bucketOfElement_(anObject);
  15896. });
  15897. return [ anObject, null, bucket || self['@defaultBucket'] ];
  15898. }
  15899. return [ prim, self['@fastBuckets'][typeof prim] ];
  15900. ;
  15901. return self;
  15902. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  15903. },
  15904. args: ["anObject"],
  15905. 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<\x0a\x09\x09// include nil to well-known objects under 'boolean' 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>",
  15906. referencedClasses: [],
  15907. messageSends: []
  15908. }),
  15909. $globals.Set);
  15910. $core.addMethod(
  15911. $core.method({
  15912. selector: "classNameOf:",
  15913. protocol: 'private',
  15914. fn: function (anObject){
  15915. var self=this;
  15916. return $core.withContext(function($ctx1) {
  15917. return anObject.klass != null && anObject.klass.className;
  15918. return self;
  15919. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  15920. },
  15921. args: ["anObject"],
  15922. 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<return anObject.klass != null && anObject.klass.className>",
  15923. referencedClasses: [],
  15924. messageSends: []
  15925. }),
  15926. $globals.Set);
  15927. $core.addMethod(
  15928. $core.method({
  15929. selector: "collect:",
  15930. protocol: 'enumerating',
  15931. fn: function (aBlock){
  15932. var self=this;
  15933. var collection;
  15934. return $core.withContext(function($ctx1) {
  15935. collection=$recv(self._class())._new();
  15936. self._do_((function(each){
  15937. return $core.withContext(function($ctx2) {
  15938. return $recv(collection)._add_($recv(aBlock)._value_(each));
  15939. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15940. }));
  15941. return collection;
  15942. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  15943. },
  15944. args: ["aBlock"],
  15945. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  15946. referencedClasses: [],
  15947. messageSends: ["new", "class", "do:", "add:", "value:"]
  15948. }),
  15949. $globals.Set);
  15950. $core.addMethod(
  15951. $core.method({
  15952. selector: "detect:ifNone:",
  15953. protocol: 'enumerating',
  15954. fn: function (aBlock,anotherBlock){
  15955. var self=this;
  15956. return $core.withContext(function($ctx1) {
  15957. var $1;
  15958. var $early={};
  15959. try {
  15960. self._do_((function(each){
  15961. return $core.withContext(function($ctx2) {
  15962. $1=$recv(aBlock)._value_(each);
  15963. if($core.assert($1)){
  15964. throw $early=[each];
  15965. };
  15966. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15967. }));
  15968. return $recv(anotherBlock)._value();
  15969. }
  15970. catch(e) {if(e===$early)return e[0]; throw e}
  15971. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  15972. },
  15973. args: ["aBlock", "anotherBlock"],
  15974. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  15975. referencedClasses: [],
  15976. messageSends: ["do:", "ifTrue:", "value:", "value"]
  15977. }),
  15978. $globals.Set);
  15979. $core.addMethod(
  15980. $core.method({
  15981. selector: "do:",
  15982. protocol: 'enumerating',
  15983. fn: function (aBlock){
  15984. var self=this;
  15985. return $core.withContext(function($ctx1) {
  15986. var el, keys, i;
  15987. el = self['@fastBuckets'];
  15988. keys = Object.keys(el);
  15989. for (i = 0; i < keys.length; ++i) {
  15990. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  15991. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  15992. else { store._do_(aBlock); }
  15993. }
  15994. el = self['@slowBucketStores'];
  15995. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  15996. self['@defaultBucket']._do_(aBlock);
  15997. ;
  15998. return self;
  15999. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  16000. },
  16001. args: ["aBlock"],
  16002. source: "do: aBlock\x0a\x09<\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>",
  16003. referencedClasses: [],
  16004. messageSends: []
  16005. }),
  16006. $globals.Set);
  16007. $core.addMethod(
  16008. $core.method({
  16009. selector: "includes:",
  16010. protocol: 'testing',
  16011. fn: function (anObject){
  16012. var self=this;
  16013. var bucket;
  16014. return $core.withContext(function($ctx1) {
  16015. var $1,$2,$3,$receiver;
  16016. bucket=self._bucketsOfElement_(anObject);
  16017. $1=$recv(bucket)._second();
  16018. if(($receiver = $1) == null || $receiver.isNil){
  16019. $2=$recv(bucket)._third();
  16020. $3=$recv(bucket)._first();
  16021. $ctx1.sendIdx["first"]=1;
  16022. return $recv($2)._includes_($3);
  16023. } else {
  16024. var primitiveBucket;
  16025. primitiveBucket=$receiver;
  16026. return self._includes_in_($recv(bucket)._first(),primitiveBucket);
  16027. };
  16028. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  16029. },
  16030. args: ["anObject"],
  16031. 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 ]",
  16032. referencedClasses: [],
  16033. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  16034. }),
  16035. $globals.Set);
  16036. $core.addMethod(
  16037. $core.method({
  16038. selector: "includes:in:",
  16039. protocol: 'private',
  16040. fn: function (anObject,anotherObject){
  16041. var self=this;
  16042. return $core.withContext(function($ctx1) {
  16043. return anObject in anotherObject.store;
  16044. return self;
  16045. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16046. },
  16047. args: ["anObject", "anotherObject"],
  16048. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  16049. referencedClasses: [],
  16050. messageSends: []
  16051. }),
  16052. $globals.Set);
  16053. $core.addMethod(
  16054. $core.method({
  16055. selector: "initialize",
  16056. protocol: 'initialization',
  16057. fn: function (){
  16058. var self=this;
  16059. return $core.withContext(function($ctx1) {
  16060. (
  16061. $ctx1.supercall = true,
  16062. ($globals.Set.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  16063. $ctx1.supercall = false;
  16064. self["@defaultBucket"]=[];
  16065. self._initializeSlowBucketStores();
  16066. self._removeAll();
  16067. return self;
  16068. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  16069. },
  16070. args: [],
  16071. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  16072. referencedClasses: [],
  16073. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  16074. }),
  16075. $globals.Set);
  16076. $core.addMethod(
  16077. $core.method({
  16078. selector: "initializeSlowBucketStores",
  16079. protocol: 'initialization',
  16080. fn: function (){
  16081. var self=this;
  16082. return $core.withContext(function($ctx1) {
  16083. var $1;
  16084. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  16085. return $core.withContext(function($ctx2) {
  16086. return self._classNameOf_(x);
  16087. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  16088. }));
  16089. $ctx1.sendIdx["hashBlock:"]=1;
  16090. self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  16091. return $core.withContext(function($ctx2) {
  16092. return self._jsConstructorNameOf_(x);
  16093. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  16094. }))];
  16095. return self;
  16096. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  16097. },
  16098. args: [],
  16099. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  16100. referencedClasses: ["ArrayBucketStore"],
  16101. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  16102. }),
  16103. $globals.Set);
  16104. $core.addMethod(
  16105. $core.method({
  16106. selector: "jsConstructorNameOf:",
  16107. protocol: 'private',
  16108. fn: function (anObject){
  16109. var self=this;
  16110. return $core.withContext(function($ctx1) {
  16111. return anObject.constructor && anObject.constructor.name;
  16112. return self;
  16113. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  16114. },
  16115. args: ["anObject"],
  16116. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  16117. referencedClasses: [],
  16118. messageSends: []
  16119. }),
  16120. $globals.Set);
  16121. $core.addMethod(
  16122. $core.method({
  16123. selector: "printOn:",
  16124. protocol: 'printing',
  16125. fn: function (aStream){
  16126. var self=this;
  16127. return $core.withContext(function($ctx1) {
  16128. (
  16129. $ctx1.supercall = true,
  16130. ($globals.Set.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  16131. $ctx1.supercall = false;
  16132. $ctx1.sendIdx["printOn:"]=1;
  16133. $recv(aStream)._nextPutAll_(" (");
  16134. $ctx1.sendIdx["nextPutAll:"]=1;
  16135. self._do_separatedBy_((function(each){
  16136. return $core.withContext(function($ctx2) {
  16137. return $recv(each)._printOn_(aStream);
  16138. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16139. }),(function(){
  16140. return $core.withContext(function($ctx2) {
  16141. return $recv(aStream)._nextPutAll_(" ");
  16142. $ctx2.sendIdx["nextPutAll:"]=2;
  16143. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16144. }));
  16145. $recv(aStream)._nextPutAll_(")");
  16146. return self;
  16147. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  16148. },
  16149. args: ["aStream"],
  16150. 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: ')'",
  16151. referencedClasses: [],
  16152. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  16153. }),
  16154. $globals.Set);
  16155. $core.addMethod(
  16156. $core.method({
  16157. selector: "remove:ifAbsent:",
  16158. protocol: 'adding/removing',
  16159. fn: function (anObject,aBlock){
  16160. var self=this;
  16161. var bucket;
  16162. return $core.withContext(function($ctx1) {
  16163. var $1,$2,$3,$receiver;
  16164. var $early={};
  16165. try {
  16166. bucket=self._bucketsOfElement_(anObject);
  16167. $1=$recv(bucket)._second();
  16168. if(($receiver = $1) == null || $receiver.isNil){
  16169. $2=$recv(bucket)._third();
  16170. $3=$recv(bucket)._first();
  16171. $ctx1.sendIdx["first"]=1;
  16172. $recv($2)._remove_ifAbsent_($3,(function(){
  16173. return $core.withContext(function($ctx2) {
  16174. throw $early=[$recv(aBlock)._value()];
  16175. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16176. }));
  16177. self["@size"]=$recv(self["@size"]).__minus((1));
  16178. return self["@size"];
  16179. } else {
  16180. var primitiveBucket;
  16181. primitiveBucket=$receiver;
  16182. return self._remove_in_($recv(bucket)._first(),primitiveBucket);
  16183. };
  16184. }
  16185. catch(e) {if(e===$early)return e[0]; throw e}
  16186. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  16187. },
  16188. args: ["anObject", "aBlock"],
  16189. 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 ]",
  16190. referencedClasses: [],
  16191. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  16192. }),
  16193. $globals.Set);
  16194. $core.addMethod(
  16195. $core.method({
  16196. selector: "remove:in:",
  16197. protocol: 'private',
  16198. fn: function (anObject,anotherObject){
  16199. var self=this;
  16200. return $core.withContext(function($ctx1) {
  16201. if (delete anotherObject.store[anObject]) self['@size']--;
  16202. return self;
  16203. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16204. },
  16205. args: ["anObject", "anotherObject"],
  16206. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  16207. referencedClasses: [],
  16208. messageSends: []
  16209. }),
  16210. $globals.Set);
  16211. $core.addMethod(
  16212. $core.method({
  16213. selector: "removeAll",
  16214. protocol: 'adding/removing',
  16215. fn: function (){
  16216. var self=this;
  16217. return $core.withContext(function($ctx1) {
  16218. self['@fastBuckets'] = {
  16219. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  16220. 'number': { store: Object.create(null), fn: Number },
  16221. 'string': { store: Object.create(null) }
  16222. };
  16223. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  16224. self['@defaultBucket']._removeAll();
  16225. self['@size'] = 0;
  16226. ;
  16227. return self;
  16228. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  16229. },
  16230. args: [],
  16231. source: "removeAll\x0a\x09<\x0a\x09\x09self['@fastBuckets'] = {\x0a\x09\x09\x09'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },\x0a\x09\x09\x09'number': { store: Object.create(null), fn: Number },\x0a\x09\x09\x09'string': { 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>",
  16232. referencedClasses: [],
  16233. messageSends: []
  16234. }),
  16235. $globals.Set);
  16236. $core.addMethod(
  16237. $core.method({
  16238. selector: "select:",
  16239. protocol: 'enumerating',
  16240. fn: function (aBlock){
  16241. var self=this;
  16242. var collection;
  16243. return $core.withContext(function($ctx1) {
  16244. var $1;
  16245. collection=$recv(self._class())._new();
  16246. self._do_((function(each){
  16247. return $core.withContext(function($ctx2) {
  16248. $1=$recv(aBlock)._value_(each);
  16249. if($core.assert($1)){
  16250. return $recv(collection)._add_(each);
  16251. };
  16252. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16253. }));
  16254. return collection;
  16255. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  16256. },
  16257. args: ["aBlock"],
  16258. 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",
  16259. referencedClasses: [],
  16260. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  16261. }),
  16262. $globals.Set);
  16263. $core.addMethod(
  16264. $core.method({
  16265. selector: "size",
  16266. protocol: 'accessing',
  16267. fn: function (){
  16268. var self=this;
  16269. return self["@size"];
  16270. },
  16271. args: [],
  16272. source: "size\x0a\x09^ size",
  16273. referencedClasses: [],
  16274. messageSends: []
  16275. }),
  16276. $globals.Set);
  16277. $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
  16278. $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.";
  16279. $core.addMethod(
  16280. $core.method({
  16281. selector: "<<",
  16282. protocol: 'writing',
  16283. fn: function (anObject){
  16284. var self=this;
  16285. return $core.withContext(function($ctx1) {
  16286. self._write_(anObject);
  16287. return self;
  16288. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  16289. },
  16290. args: ["anObject"],
  16291. source: "<< anObject\x0a\x09self write: anObject",
  16292. referencedClasses: [],
  16293. messageSends: ["write:"]
  16294. }),
  16295. $globals.ProtoStream);
  16296. $core.addMethod(
  16297. $core.method({
  16298. selector: "atEnd",
  16299. protocol: 'testing',
  16300. fn: function (){
  16301. var self=this;
  16302. return $core.withContext(function($ctx1) {
  16303. self._subclassResponsibility();
  16304. return self;
  16305. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  16306. },
  16307. args: [],
  16308. source: "atEnd\x0a\x09self subclassResponsibility",
  16309. referencedClasses: [],
  16310. messageSends: ["subclassResponsibility"]
  16311. }),
  16312. $globals.ProtoStream);
  16313. $core.addMethod(
  16314. $core.method({
  16315. selector: "atStart",
  16316. protocol: 'testing',
  16317. fn: function (){
  16318. var self=this;
  16319. return $core.withContext(function($ctx1) {
  16320. self._subclassResponsibility();
  16321. return self;
  16322. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  16323. },
  16324. args: [],
  16325. source: "atStart\x0a\x09self subclassResponsibility",
  16326. referencedClasses: [],
  16327. messageSends: ["subclassResponsibility"]
  16328. }),
  16329. $globals.ProtoStream);
  16330. $core.addMethod(
  16331. $core.method({
  16332. selector: "contents",
  16333. protocol: 'accessing',
  16334. fn: function (){
  16335. var self=this;
  16336. return $core.withContext(function($ctx1) {
  16337. self._subclassResponsibility();
  16338. return self;
  16339. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  16340. },
  16341. args: [],
  16342. source: "contents\x0a\x09self subclassResponsibility",
  16343. referencedClasses: [],
  16344. messageSends: ["subclassResponsibility"]
  16345. }),
  16346. $globals.ProtoStream);
  16347. $core.addMethod(
  16348. $core.method({
  16349. selector: "do:",
  16350. protocol: 'enumerating',
  16351. fn: function (aBlock){
  16352. var self=this;
  16353. return $core.withContext(function($ctx1) {
  16354. $recv((function(){
  16355. return $core.withContext(function($ctx2) {
  16356. return self._atEnd();
  16357. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16358. }))._whileFalse_((function(){
  16359. return $core.withContext(function($ctx2) {
  16360. return $recv(aBlock)._value_(self._next());
  16361. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16362. }));
  16363. return self;
  16364. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  16365. },
  16366. args: ["aBlock"],
  16367. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  16368. referencedClasses: [],
  16369. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  16370. }),
  16371. $globals.ProtoStream);
  16372. $core.addMethod(
  16373. $core.method({
  16374. selector: "isEmpty",
  16375. protocol: 'testing',
  16376. fn: function (){
  16377. var self=this;
  16378. return $core.withContext(function($ctx1) {
  16379. return $recv(self._atStart())._and_((function(){
  16380. return $core.withContext(function($ctx2) {
  16381. return self._atEnd();
  16382. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16383. }));
  16384. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  16385. },
  16386. args: [],
  16387. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  16388. referencedClasses: [],
  16389. messageSends: ["and:", "atStart", "atEnd"]
  16390. }),
  16391. $globals.ProtoStream);
  16392. $core.addMethod(
  16393. $core.method({
  16394. selector: "next",
  16395. protocol: 'reading',
  16396. fn: function (){
  16397. var self=this;
  16398. return $core.withContext(function($ctx1) {
  16399. var $1;
  16400. $1=self._atEnd();
  16401. if($core.assert($1)){
  16402. return nil;
  16403. } else {
  16404. return self._subclassResponsibility();
  16405. };
  16406. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  16407. },
  16408. args: [],
  16409. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16410. referencedClasses: [],
  16411. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16412. }),
  16413. $globals.ProtoStream);
  16414. $core.addMethod(
  16415. $core.method({
  16416. selector: "nextPut:",
  16417. protocol: 'writing',
  16418. fn: function (anObject){
  16419. var self=this;
  16420. return $core.withContext(function($ctx1) {
  16421. self._subclassResponsibility();
  16422. return self;
  16423. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  16424. },
  16425. args: ["anObject"],
  16426. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  16427. referencedClasses: [],
  16428. messageSends: ["subclassResponsibility"]
  16429. }),
  16430. $globals.ProtoStream);
  16431. $core.addMethod(
  16432. $core.method({
  16433. selector: "nextPutAll:",
  16434. protocol: 'writing',
  16435. fn: function (aCollection){
  16436. var self=this;
  16437. return $core.withContext(function($ctx1) {
  16438. $recv(aCollection)._do_((function(each){
  16439. return $core.withContext(function($ctx2) {
  16440. return self._nextPut_(each);
  16441. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16442. }));
  16443. return self;
  16444. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  16445. },
  16446. args: ["aCollection"],
  16447. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  16448. referencedClasses: [],
  16449. messageSends: ["do:", "nextPut:"]
  16450. }),
  16451. $globals.ProtoStream);
  16452. $core.addMethod(
  16453. $core.method({
  16454. selector: "nextPutJSObject:",
  16455. protocol: 'writing',
  16456. fn: function (aJSObject){
  16457. var self=this;
  16458. return $core.withContext(function($ctx1) {
  16459. self._nextPut_(aJSObject);
  16460. return self;
  16461. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  16462. },
  16463. args: ["aJSObject"],
  16464. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  16465. referencedClasses: [],
  16466. messageSends: ["nextPut:"]
  16467. }),
  16468. $globals.ProtoStream);
  16469. $core.addMethod(
  16470. $core.method({
  16471. selector: "nextPutString:",
  16472. protocol: 'writing',
  16473. fn: function (aString){
  16474. var self=this;
  16475. return $core.withContext(function($ctx1) {
  16476. self._nextPut_(aString);
  16477. return self;
  16478. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  16479. },
  16480. args: ["aString"],
  16481. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  16482. referencedClasses: [],
  16483. messageSends: ["nextPut:"]
  16484. }),
  16485. $globals.ProtoStream);
  16486. $core.addMethod(
  16487. $core.method({
  16488. selector: "peek",
  16489. protocol: 'reading',
  16490. fn: function (){
  16491. var self=this;
  16492. return $core.withContext(function($ctx1) {
  16493. var $1;
  16494. $1=self._atEnd();
  16495. if($core.assert($1)){
  16496. return nil;
  16497. } else {
  16498. return self._subclassResponsibility();
  16499. };
  16500. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  16501. },
  16502. args: [],
  16503. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16504. referencedClasses: [],
  16505. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16506. }),
  16507. $globals.ProtoStream);
  16508. $core.addMethod(
  16509. $core.method({
  16510. selector: "reset",
  16511. protocol: 'actions',
  16512. fn: function (){
  16513. var self=this;
  16514. return $core.withContext(function($ctx1) {
  16515. self._subclassResponsibility();
  16516. return self;
  16517. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  16518. },
  16519. args: [],
  16520. source: "reset\x0a\x09self subclassResponsibility",
  16521. referencedClasses: [],
  16522. messageSends: ["subclassResponsibility"]
  16523. }),
  16524. $globals.ProtoStream);
  16525. $core.addMethod(
  16526. $core.method({
  16527. selector: "resetContents",
  16528. protocol: 'actions',
  16529. fn: function (){
  16530. var self=this;
  16531. return $core.withContext(function($ctx1) {
  16532. self._subclassResponsibility();
  16533. return self;
  16534. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  16535. },
  16536. args: [],
  16537. source: "resetContents\x0a\x09self subclassResponsibility",
  16538. referencedClasses: [],
  16539. messageSends: ["subclassResponsibility"]
  16540. }),
  16541. $globals.ProtoStream);
  16542. $core.addMethod(
  16543. $core.method({
  16544. selector: "setToEnd",
  16545. protocol: 'positioning',
  16546. fn: function (){
  16547. var self=this;
  16548. return $core.withContext(function($ctx1) {
  16549. self._subclassResponsibility();
  16550. return self;
  16551. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  16552. },
  16553. args: [],
  16554. source: "setToEnd\x0a\x09self subclassResponsibility",
  16555. referencedClasses: [],
  16556. messageSends: ["subclassResponsibility"]
  16557. }),
  16558. $globals.ProtoStream);
  16559. $core.addMethod(
  16560. $core.method({
  16561. selector: "setToStart",
  16562. protocol: 'positioning',
  16563. fn: function (){
  16564. var self=this;
  16565. return $core.withContext(function($ctx1) {
  16566. self._reset();
  16567. return self;
  16568. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  16569. },
  16570. args: [],
  16571. source: "setToStart\x0a\x09self reset",
  16572. referencedClasses: [],
  16573. messageSends: ["reset"]
  16574. }),
  16575. $globals.ProtoStream);
  16576. $core.addMethod(
  16577. $core.method({
  16578. selector: "write:",
  16579. protocol: 'writing',
  16580. fn: function (anObject){
  16581. var self=this;
  16582. return $core.withContext(function($ctx1) {
  16583. $recv(anObject)._putOn_(self);
  16584. return self;
  16585. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  16586. },
  16587. args: ["anObject"],
  16588. source: "write: anObject\x0a\x09anObject putOn: self",
  16589. referencedClasses: [],
  16590. messageSends: ["putOn:"]
  16591. }),
  16592. $globals.ProtoStream);
  16593. $core.addMethod(
  16594. $core.method({
  16595. selector: "on:",
  16596. protocol: 'instance creation',
  16597. fn: function (aCollection){
  16598. var self=this;
  16599. return $core.withContext(function($ctx1) {
  16600. var $1;
  16601. $1=self._new();
  16602. $recv($1)._setCollection_(aCollection);
  16603. $recv($1)._setStreamSize_($recv(aCollection)._size());
  16604. return $recv($1)._yourself();
  16605. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  16606. },
  16607. args: ["aCollection"],
  16608. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16609. referencedClasses: [],
  16610. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16611. }),
  16612. $globals.ProtoStream.klass);
  16613. $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  16614. $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.";
  16615. $core.addMethod(
  16616. $core.method({
  16617. selector: "atEnd",
  16618. protocol: 'testing',
  16619. fn: function (){
  16620. var self=this;
  16621. return $core.withContext(function($ctx1) {
  16622. return $recv(self._position()).__eq(self._size());
  16623. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  16624. },
  16625. args: [],
  16626. source: "atEnd\x0a\x09^ self position = self size",
  16627. referencedClasses: [],
  16628. messageSends: ["=", "position", "size"]
  16629. }),
  16630. $globals.Stream);
  16631. $core.addMethod(
  16632. $core.method({
  16633. selector: "atStart",
  16634. protocol: 'testing',
  16635. fn: function (){
  16636. var self=this;
  16637. return $core.withContext(function($ctx1) {
  16638. return $recv(self._position()).__eq((0));
  16639. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  16640. },
  16641. args: [],
  16642. source: "atStart\x0a\x09^ self position = 0",
  16643. referencedClasses: [],
  16644. messageSends: ["=", "position"]
  16645. }),
  16646. $globals.Stream);
  16647. $core.addMethod(
  16648. $core.method({
  16649. selector: "close",
  16650. protocol: 'actions',
  16651. fn: function (){
  16652. var self=this;
  16653. return self;
  16654. },
  16655. args: [],
  16656. source: "close",
  16657. referencedClasses: [],
  16658. messageSends: []
  16659. }),
  16660. $globals.Stream);
  16661. $core.addMethod(
  16662. $core.method({
  16663. selector: "collection",
  16664. protocol: 'accessing',
  16665. fn: function (){
  16666. var self=this;
  16667. return self["@collection"];
  16668. },
  16669. args: [],
  16670. source: "collection\x0a\x09^ collection",
  16671. referencedClasses: [],
  16672. messageSends: []
  16673. }),
  16674. $globals.Stream);
  16675. $core.addMethod(
  16676. $core.method({
  16677. selector: "contents",
  16678. protocol: 'accessing',
  16679. fn: function (){
  16680. var self=this;
  16681. return $core.withContext(function($ctx1) {
  16682. return $recv(self._collection())._copyFrom_to_((1),self._streamSize());
  16683. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  16684. },
  16685. args: [],
  16686. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  16687. referencedClasses: [],
  16688. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  16689. }),
  16690. $globals.Stream);
  16691. $core.addMethod(
  16692. $core.method({
  16693. selector: "flush",
  16694. protocol: 'actions',
  16695. fn: function (){
  16696. var self=this;
  16697. return self;
  16698. },
  16699. args: [],
  16700. source: "flush",
  16701. referencedClasses: [],
  16702. messageSends: []
  16703. }),
  16704. $globals.Stream);
  16705. $core.addMethod(
  16706. $core.method({
  16707. selector: "isEmpty",
  16708. protocol: 'testing',
  16709. fn: function (){
  16710. var self=this;
  16711. return $core.withContext(function($ctx1) {
  16712. return $recv(self._size()).__eq((0));
  16713. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  16714. },
  16715. args: [],
  16716. source: "isEmpty\x0a\x09^ self size = 0",
  16717. referencedClasses: [],
  16718. messageSends: ["=", "size"]
  16719. }),
  16720. $globals.Stream);
  16721. $core.addMethod(
  16722. $core.method({
  16723. selector: "next",
  16724. protocol: 'reading',
  16725. fn: function (){
  16726. var self=this;
  16727. return $core.withContext(function($ctx1) {
  16728. var $1,$3,$2;
  16729. $1=self._atEnd();
  16730. if($core.assert($1)){
  16731. return nil;
  16732. } else {
  16733. $3=self._position();
  16734. $ctx1.sendIdx["position"]=1;
  16735. $2=$recv($3).__plus((1));
  16736. self._position_($2);
  16737. return $recv(self["@collection"])._at_(self._position());
  16738. };
  16739. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  16740. },
  16741. args: [],
  16742. 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 ]",
  16743. referencedClasses: [],
  16744. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  16745. }),
  16746. $globals.Stream);
  16747. $core.addMethod(
  16748. $core.method({
  16749. selector: "next:",
  16750. protocol: 'reading',
  16751. fn: function (anInteger){
  16752. var self=this;
  16753. var tempCollection;
  16754. return $core.withContext(function($ctx1) {
  16755. var $1;
  16756. tempCollection=$recv($recv(self._collection())._class())._new();
  16757. $recv(anInteger)._timesRepeat_((function(){
  16758. return $core.withContext(function($ctx2) {
  16759. $1=self._atEnd();
  16760. if(!$core.assert($1)){
  16761. return $recv(tempCollection)._add_(self._next());
  16762. };
  16763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16764. }));
  16765. return tempCollection;
  16766. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  16767. },
  16768. args: ["anInteger"],
  16769. 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",
  16770. referencedClasses: [],
  16771. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  16772. }),
  16773. $globals.Stream);
  16774. $core.addMethod(
  16775. $core.method({
  16776. selector: "nextPut:",
  16777. protocol: 'writing',
  16778. fn: function (anObject){
  16779. var self=this;
  16780. return $core.withContext(function($ctx1) {
  16781. var $2,$1,$3,$4;
  16782. $2=self._position();
  16783. $ctx1.sendIdx["position"]=1;
  16784. $1=$recv($2).__plus((1));
  16785. self._position_($1);
  16786. $3=self._collection();
  16787. $4=self._position();
  16788. $ctx1.sendIdx["position"]=2;
  16789. $recv($3)._at_put_($4,anObject);
  16790. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  16791. return self;
  16792. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  16793. },
  16794. args: ["anObject"],
  16795. 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)",
  16796. referencedClasses: [],
  16797. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  16798. }),
  16799. $globals.Stream);
  16800. $core.addMethod(
  16801. $core.method({
  16802. selector: "peek",
  16803. protocol: 'reading',
  16804. fn: function (){
  16805. var self=this;
  16806. return $core.withContext(function($ctx1) {
  16807. var $1;
  16808. $1=self._atEnd();
  16809. if(!$core.assert($1)){
  16810. return $recv(self._collection())._at_($recv(self._position()).__plus((1)));
  16811. };
  16812. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  16813. },
  16814. args: [],
  16815. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  16816. referencedClasses: [],
  16817. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  16818. }),
  16819. $globals.Stream);
  16820. $core.addMethod(
  16821. $core.method({
  16822. selector: "position",
  16823. protocol: 'accessing',
  16824. fn: function (){
  16825. var self=this;
  16826. return $core.withContext(function($ctx1) {
  16827. var $1,$receiver;
  16828. $1=self["@position"];
  16829. if(($receiver = $1) == null || $receiver.isNil){
  16830. self["@position"]=(0);
  16831. return self["@position"];
  16832. } else {
  16833. return $1;
  16834. };
  16835. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  16836. },
  16837. args: [],
  16838. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  16839. referencedClasses: [],
  16840. messageSends: ["ifNil:"]
  16841. }),
  16842. $globals.Stream);
  16843. $core.addMethod(
  16844. $core.method({
  16845. selector: "position:",
  16846. protocol: 'accessing',
  16847. fn: function (anInteger){
  16848. var self=this;
  16849. self["@position"]=anInteger;
  16850. return self;
  16851. },
  16852. args: ["anInteger"],
  16853. source: "position: anInteger\x0a\x09position := anInteger",
  16854. referencedClasses: [],
  16855. messageSends: []
  16856. }),
  16857. $globals.Stream);
  16858. $core.addMethod(
  16859. $core.method({
  16860. selector: "reset",
  16861. protocol: 'actions',
  16862. fn: function (){
  16863. var self=this;
  16864. return $core.withContext(function($ctx1) {
  16865. self._position_((0));
  16866. return self;
  16867. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  16868. },
  16869. args: [],
  16870. source: "reset\x0a\x09self position: 0",
  16871. referencedClasses: [],
  16872. messageSends: ["position:"]
  16873. }),
  16874. $globals.Stream);
  16875. $core.addMethod(
  16876. $core.method({
  16877. selector: "resetContents",
  16878. protocol: 'actions',
  16879. fn: function (){
  16880. var self=this;
  16881. return $core.withContext(function($ctx1) {
  16882. self._reset();
  16883. self._setStreamSize_((0));
  16884. return self;
  16885. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  16886. },
  16887. args: [],
  16888. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  16889. referencedClasses: [],
  16890. messageSends: ["reset", "setStreamSize:"]
  16891. }),
  16892. $globals.Stream);
  16893. $core.addMethod(
  16894. $core.method({
  16895. selector: "setCollection:",
  16896. protocol: 'accessing',
  16897. fn: function (aCollection){
  16898. var self=this;
  16899. self["@collection"]=aCollection;
  16900. return self;
  16901. },
  16902. args: ["aCollection"],
  16903. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  16904. referencedClasses: [],
  16905. messageSends: []
  16906. }),
  16907. $globals.Stream);
  16908. $core.addMethod(
  16909. $core.method({
  16910. selector: "setStreamSize:",
  16911. protocol: 'accessing',
  16912. fn: function (anInteger){
  16913. var self=this;
  16914. self["@streamSize"]=anInteger;
  16915. return self;
  16916. },
  16917. args: ["anInteger"],
  16918. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  16919. referencedClasses: [],
  16920. messageSends: []
  16921. }),
  16922. $globals.Stream);
  16923. $core.addMethod(
  16924. $core.method({
  16925. selector: "setToEnd",
  16926. protocol: 'positioning',
  16927. fn: function (){
  16928. var self=this;
  16929. return $core.withContext(function($ctx1) {
  16930. self._position_(self._size());
  16931. return self;
  16932. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  16933. },
  16934. args: [],
  16935. source: "setToEnd\x0a\x09self position: self size",
  16936. referencedClasses: [],
  16937. messageSends: ["position:", "size"]
  16938. }),
  16939. $globals.Stream);
  16940. $core.addMethod(
  16941. $core.method({
  16942. selector: "size",
  16943. protocol: 'accessing',
  16944. fn: function (){
  16945. var self=this;
  16946. return $core.withContext(function($ctx1) {
  16947. return self._streamSize();
  16948. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  16949. },
  16950. args: [],
  16951. source: "size\x0a\x09^ self streamSize",
  16952. referencedClasses: [],
  16953. messageSends: ["streamSize"]
  16954. }),
  16955. $globals.Stream);
  16956. $core.addMethod(
  16957. $core.method({
  16958. selector: "skip:",
  16959. protocol: 'positioning',
  16960. fn: function (anInteger){
  16961. var self=this;
  16962. return $core.withContext(function($ctx1) {
  16963. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  16964. return self;
  16965. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  16966. },
  16967. args: ["anInteger"],
  16968. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  16969. referencedClasses: [],
  16970. messageSends: ["position:", "min:max:", "+", "position", "size"]
  16971. }),
  16972. $globals.Stream);
  16973. $core.addMethod(
  16974. $core.method({
  16975. selector: "streamSize",
  16976. protocol: 'accessing',
  16977. fn: function (){
  16978. var self=this;
  16979. return self["@streamSize"];
  16980. },
  16981. args: [],
  16982. source: "streamSize\x0a\x09^ streamSize",
  16983. referencedClasses: [],
  16984. messageSends: []
  16985. }),
  16986. $globals.Stream);
  16987. $core.addMethod(
  16988. $core.method({
  16989. selector: "on:",
  16990. protocol: 'instance creation',
  16991. fn: function (aCollection){
  16992. var self=this;
  16993. return $core.withContext(function($ctx1) {
  16994. var $1;
  16995. $1=self._new();
  16996. $recv($1)._setCollection_(aCollection);
  16997. $recv($1)._setStreamSize_($recv(aCollection)._size());
  16998. return $recv($1)._yourself();
  16999. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  17000. },
  17001. args: ["aCollection"],
  17002. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  17003. referencedClasses: [],
  17004. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  17005. }),
  17006. $globals.Stream.klass);
  17007. $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
  17008. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  17009. $core.addMethod(
  17010. $core.method({
  17011. selector: "cr",
  17012. protocol: 'writing',
  17013. fn: function (){
  17014. var self=this;
  17015. return $core.withContext(function($ctx1) {
  17016. return self._nextPutAll_($recv($globals.String)._cr());
  17017. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  17018. },
  17019. args: [],
  17020. source: "cr\x0a\x09^ self nextPutAll: String cr",
  17021. referencedClasses: ["String"],
  17022. messageSends: ["nextPutAll:", "cr"]
  17023. }),
  17024. $globals.StringStream);
  17025. $core.addMethod(
  17026. $core.method({
  17027. selector: "crlf",
  17028. protocol: 'writing',
  17029. fn: function (){
  17030. var self=this;
  17031. return $core.withContext(function($ctx1) {
  17032. return self._nextPutAll_($recv($globals.String)._crlf());
  17033. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  17034. },
  17035. args: [],
  17036. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  17037. referencedClasses: ["String"],
  17038. messageSends: ["nextPutAll:", "crlf"]
  17039. }),
  17040. $globals.StringStream);
  17041. $core.addMethod(
  17042. $core.method({
  17043. selector: "lf",
  17044. protocol: 'writing',
  17045. fn: function (){
  17046. var self=this;
  17047. return $core.withContext(function($ctx1) {
  17048. return self._nextPutAll_($recv($globals.String)._lf());
  17049. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  17050. },
  17051. args: [],
  17052. source: "lf\x0a\x09^ self nextPutAll: String lf",
  17053. referencedClasses: ["String"],
  17054. messageSends: ["nextPutAll:", "lf"]
  17055. }),
  17056. $globals.StringStream);
  17057. $core.addMethod(
  17058. $core.method({
  17059. selector: "next:",
  17060. protocol: 'reading',
  17061. fn: function (anInteger){
  17062. var self=this;
  17063. var tempCollection;
  17064. return $core.withContext(function($ctx1) {
  17065. var $1;
  17066. tempCollection=$recv($recv(self._collection())._class())._new();
  17067. $recv(anInteger)._timesRepeat_((function(){
  17068. return $core.withContext(function($ctx2) {
  17069. $1=self._atEnd();
  17070. if(!$core.assert($1)){
  17071. tempCollection=$recv(tempCollection).__comma(self._next());
  17072. return tempCollection;
  17073. };
  17074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17075. }));
  17076. return tempCollection;
  17077. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  17078. },
  17079. args: ["anInteger"],
  17080. 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",
  17081. referencedClasses: [],
  17082. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  17083. }),
  17084. $globals.StringStream);
  17085. $core.addMethod(
  17086. $core.method({
  17087. selector: "nextPut:",
  17088. protocol: 'writing',
  17089. fn: function (aString){
  17090. var self=this;
  17091. return $core.withContext(function($ctx1) {
  17092. self._nextPutAll_(aString);
  17093. return self;
  17094. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  17095. },
  17096. args: ["aString"],
  17097. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  17098. referencedClasses: [],
  17099. messageSends: ["nextPutAll:"]
  17100. }),
  17101. $globals.StringStream);
  17102. $core.addMethod(
  17103. $core.method({
  17104. selector: "nextPutAll:",
  17105. protocol: 'writing',
  17106. fn: function (aString){
  17107. var self=this;
  17108. var pre,post;
  17109. return $core.withContext(function($ctx1) {
  17110. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  17111. $1=self._atEnd();
  17112. if($core.assert($1)){
  17113. $3=self._collection();
  17114. $ctx1.sendIdx["collection"]=1;
  17115. $2=$recv($3).__comma(aString);
  17116. $ctx1.sendIdx[","]=1;
  17117. self._setCollection_($2);
  17118. $ctx1.sendIdx["setCollection:"]=1;
  17119. } else {
  17120. $4=self._collection();
  17121. $ctx1.sendIdx["collection"]=2;
  17122. $5=self._position();
  17123. $ctx1.sendIdx["position"]=1;
  17124. pre=$recv($4)._copyFrom_to_((1),$5);
  17125. $ctx1.sendIdx["copyFrom:to:"]=1;
  17126. pre;
  17127. $6=self._collection();
  17128. $ctx1.sendIdx["collection"]=3;
  17129. $9=self._position();
  17130. $ctx1.sendIdx["position"]=2;
  17131. $8=$recv($9).__plus((1));
  17132. $ctx1.sendIdx["+"]=2;
  17133. $10=$recv(aString)._size();
  17134. $ctx1.sendIdx["size"]=1;
  17135. $7=$recv($8).__plus($10);
  17136. $ctx1.sendIdx["+"]=1;
  17137. $11=$recv(self._collection())._size();
  17138. $ctx1.sendIdx["size"]=2;
  17139. post=$recv($6)._copyFrom_to_($7,$11);
  17140. post;
  17141. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  17142. $ctx1.sendIdx[","]=2;
  17143. self._setCollection_($12);
  17144. };
  17145. $14=self._position();
  17146. $ctx1.sendIdx["position"]=3;
  17147. $13=$recv($14).__plus($recv(aString)._size());
  17148. self._position_($13);
  17149. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  17150. return self;
  17151. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  17152. },
  17153. args: ["aString"],
  17154. 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)",
  17155. referencedClasses: [],
  17156. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  17157. }),
  17158. $globals.StringStream);
  17159. $core.addMethod(
  17160. $core.method({
  17161. selector: "nextPutString:",
  17162. protocol: 'writing',
  17163. fn: function (aString){
  17164. var self=this;
  17165. return $core.withContext(function($ctx1) {
  17166. self._nextPutAll_(aString);
  17167. return self;
  17168. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  17169. },
  17170. args: ["aString"],
  17171. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  17172. referencedClasses: [],
  17173. messageSends: ["nextPutAll:"]
  17174. }),
  17175. $globals.StringStream);
  17176. $core.addMethod(
  17177. $core.method({
  17178. selector: "space",
  17179. protocol: 'writing',
  17180. fn: function (){
  17181. var self=this;
  17182. return $core.withContext(function($ctx1) {
  17183. self._nextPut_(" ");
  17184. return self;
  17185. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  17186. },
  17187. args: [],
  17188. source: "space\x0a\x09self nextPut: ' '",
  17189. referencedClasses: [],
  17190. messageSends: ["nextPut:"]
  17191. }),
  17192. $globals.StringStream);
  17193. $core.addMethod(
  17194. $core.method({
  17195. selector: "tab",
  17196. protocol: 'writing',
  17197. fn: function (){
  17198. var self=this;
  17199. return $core.withContext(function($ctx1) {
  17200. return self._nextPutAll_($recv($globals.String)._tab());
  17201. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  17202. },
  17203. args: [],
  17204. source: "tab\x0a\x09^ self nextPutAll: String tab",
  17205. referencedClasses: ["String"],
  17206. messageSends: ["nextPutAll:", "tab"]
  17207. }),
  17208. $globals.StringStream);
  17209. $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  17210. $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.";
  17211. $core.addMethod(
  17212. $core.method({
  17213. selector: "initialize",
  17214. protocol: 'initialization',
  17215. fn: function (){
  17216. var self=this;
  17217. return $core.withContext(function($ctx1) {
  17218. (
  17219. $ctx1.supercall = true,
  17220. ($globals.Queue.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  17221. $ctx1.supercall = false;
  17222. self["@read"]=$recv($globals.OrderedCollection)._new();
  17223. $ctx1.sendIdx["new"]=1;
  17224. self["@write"]=$recv($globals.OrderedCollection)._new();
  17225. self["@readIndex"]=(1);
  17226. return self;
  17227. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  17228. },
  17229. args: [],
  17230. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  17231. referencedClasses: ["OrderedCollection"],
  17232. messageSends: ["initialize", "new"]
  17233. }),
  17234. $globals.Queue);
  17235. $core.addMethod(
  17236. $core.method({
  17237. selector: "next",
  17238. protocol: 'accessing',
  17239. fn: function (){
  17240. var self=this;
  17241. return $core.withContext(function($ctx1) {
  17242. return self._nextIfAbsent_((function(){
  17243. return $core.withContext(function($ctx2) {
  17244. return self._error_("Cannot read from empty Queue.");
  17245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17246. }));
  17247. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  17248. },
  17249. args: [],
  17250. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  17251. referencedClasses: [],
  17252. messageSends: ["nextIfAbsent:", "error:"]
  17253. }),
  17254. $globals.Queue);
  17255. $core.addMethod(
  17256. $core.method({
  17257. selector: "nextIfAbsent:",
  17258. protocol: 'accessing',
  17259. fn: function (aBlock){
  17260. var self=this;
  17261. var result;
  17262. return $core.withContext(function($ctx1) {
  17263. var $1,$2;
  17264. var $early={};
  17265. try {
  17266. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  17267. return $core.withContext(function($ctx2) {
  17268. $1=$recv(self["@write"])._isEmpty();
  17269. if($core.assert($1)){
  17270. $2=$recv(self["@readIndex"]).__gt((1));
  17271. if($core.assert($2)){
  17272. self["@read"]=[];
  17273. self["@read"];
  17274. self["@readIndex"]=(1);
  17275. self["@readIndex"];
  17276. };
  17277. throw $early=[$recv(aBlock)._value()];
  17278. };
  17279. self["@read"]=self["@write"];
  17280. self["@read"];
  17281. self["@readIndex"]=(1);
  17282. self["@readIndex"];
  17283. self["@write"]=$recv($globals.OrderedCollection)._new();
  17284. self["@write"];
  17285. return $recv(self["@read"])._first();
  17286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17287. }));
  17288. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  17289. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  17290. return result;
  17291. }
  17292. catch(e) {if(e===$early)return e[0]; throw e}
  17293. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  17294. },
  17295. args: ["aBlock"],
  17296. source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write isEmpty ifTrue: [\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",
  17297. referencedClasses: ["OrderedCollection"],
  17298. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"]
  17299. }),
  17300. $globals.Queue);
  17301. $core.addMethod(
  17302. $core.method({
  17303. selector: "nextPut:",
  17304. protocol: 'accessing',
  17305. fn: function (anObject){
  17306. var self=this;
  17307. return $core.withContext(function($ctx1) {
  17308. $recv(self["@write"])._add_(anObject);
  17309. return self;
  17310. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  17311. },
  17312. args: ["anObject"],
  17313. source: "nextPut: anObject\x0a\x09write add: anObject",
  17314. referencedClasses: [],
  17315. messageSends: ["add:"]
  17316. }),
  17317. $globals.Queue);
  17318. $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
  17319. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  17320. $core.addMethod(
  17321. $core.method({
  17322. selector: "compile:",
  17323. protocol: 'evaluating',
  17324. fn: function (aString){
  17325. var self=this;
  17326. return $core.withContext(function($ctx1) {
  17327. return self.compile(aString);
  17328. return self;
  17329. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  17330. },
  17331. args: ["aString"],
  17332. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  17333. referencedClasses: [],
  17334. messageSends: []
  17335. }),
  17336. $globals.RegularExpression);
  17337. $core.addMethod(
  17338. $core.method({
  17339. selector: "exec:",
  17340. protocol: 'evaluating',
  17341. fn: function (aString){
  17342. var self=this;
  17343. return $core.withContext(function($ctx1) {
  17344. return self.exec(aString) || nil;
  17345. return self;
  17346. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  17347. },
  17348. args: ["aString"],
  17349. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  17350. referencedClasses: [],
  17351. messageSends: []
  17352. }),
  17353. $globals.RegularExpression);
  17354. $core.addMethod(
  17355. $core.method({
  17356. selector: "test:",
  17357. protocol: 'evaluating',
  17358. fn: function (aString){
  17359. var self=this;
  17360. return $core.withContext(function($ctx1) {
  17361. return self.test(aString);
  17362. return self;
  17363. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  17364. },
  17365. args: ["aString"],
  17366. source: "test: aString\x0a\x09<return self.test(aString)>",
  17367. referencedClasses: [],
  17368. messageSends: []
  17369. }),
  17370. $globals.RegularExpression);
  17371. $core.addMethod(
  17372. $core.method({
  17373. selector: "fromString:",
  17374. protocol: 'instance creation',
  17375. fn: function (aString){
  17376. var self=this;
  17377. return $core.withContext(function($ctx1) {
  17378. return self._fromString_flag_(aString,"");
  17379. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  17380. },
  17381. args: ["aString"],
  17382. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  17383. referencedClasses: [],
  17384. messageSends: ["fromString:flag:"]
  17385. }),
  17386. $globals.RegularExpression.klass);
  17387. $core.addMethod(
  17388. $core.method({
  17389. selector: "fromString:flag:",
  17390. protocol: 'instance creation',
  17391. fn: function (aString,anotherString){
  17392. var self=this;
  17393. return $core.withContext(function($ctx1) {
  17394. return new RegExp(aString, anotherString);
  17395. return self;
  17396. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  17397. },
  17398. args: ["aString", "anotherString"],
  17399. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  17400. referencedClasses: [],
  17401. messageSends: []
  17402. }),
  17403. $globals.RegularExpression.klass);
  17404. });
  17405. define("amber_core/Kernel-Exceptions", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17406. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  17407. $core.addPackage('Kernel-Exceptions');
  17408. $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  17409. $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17410. $core.addClass('Error', $globals.Object, ['messageText'], 'Kernel-Exceptions');
  17411. $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.";
  17412. $core.addMethod(
  17413. $core.method({
  17414. selector: "beHandled",
  17415. protocol: 'accessing',
  17416. fn: function (){
  17417. var self=this;
  17418. return $core.withContext(function($ctx1) {
  17419. self.amberHandled = true;
  17420. return self;
  17421. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  17422. },
  17423. args: [],
  17424. source: "beHandled\x0a\x09<self.amberHandled = true>",
  17425. referencedClasses: [],
  17426. messageSends: []
  17427. }),
  17428. $globals.Error);
  17429. $core.addMethod(
  17430. $core.method({
  17431. selector: "beUnhandled",
  17432. protocol: 'accessing',
  17433. fn: function (){
  17434. var self=this;
  17435. return $core.withContext(function($ctx1) {
  17436. self.amberHandled = false;
  17437. return self;
  17438. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  17439. },
  17440. args: [],
  17441. source: "beUnhandled\x0a\x09<self.amberHandled = false>",
  17442. referencedClasses: [],
  17443. messageSends: []
  17444. }),
  17445. $globals.Error);
  17446. $core.addMethod(
  17447. $core.method({
  17448. selector: "context",
  17449. protocol: 'accessing',
  17450. fn: function (){
  17451. var self=this;
  17452. return $core.withContext(function($ctx1) {
  17453. return self.context;
  17454. return self;
  17455. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  17456. },
  17457. args: [],
  17458. source: "context\x0a\x09<return self.context>",
  17459. referencedClasses: [],
  17460. messageSends: []
  17461. }),
  17462. $globals.Error);
  17463. $core.addMethod(
  17464. $core.method({
  17465. selector: "initialize",
  17466. protocol: 'initialization',
  17467. fn: function (){
  17468. var self=this;
  17469. return $core.withContext(function($ctx1) {
  17470. self._messageText_("Errorclass: ".__comma($recv(self._class())._name()));
  17471. return self;
  17472. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  17473. },
  17474. args: [],
  17475. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  17476. referencedClasses: [],
  17477. messageSends: ["messageText:", ",", "name", "class"]
  17478. }),
  17479. $globals.Error);
  17480. $core.addMethod(
  17481. $core.method({
  17482. selector: "isSmalltalkError",
  17483. protocol: 'testing',
  17484. fn: function (){
  17485. var self=this;
  17486. return $core.withContext(function($ctx1) {
  17487. return self.smalltalkError === true;
  17488. return self;
  17489. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  17490. },
  17491. args: [],
  17492. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  17493. referencedClasses: [],
  17494. messageSends: []
  17495. }),
  17496. $globals.Error);
  17497. $core.addMethod(
  17498. $core.method({
  17499. selector: "jsStack",
  17500. protocol: 'accessing',
  17501. fn: function (){
  17502. var self=this;
  17503. return $core.withContext(function($ctx1) {
  17504. return self.stack;
  17505. return self;
  17506. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  17507. },
  17508. args: [],
  17509. source: "jsStack\x0a\x09<return self.stack>",
  17510. referencedClasses: [],
  17511. messageSends: []
  17512. }),
  17513. $globals.Error);
  17514. $core.addMethod(
  17515. $core.method({
  17516. selector: "messageText",
  17517. protocol: 'accessing',
  17518. fn: function (){
  17519. var self=this;
  17520. return self["@messageText"];
  17521. },
  17522. args: [],
  17523. source: "messageText\x0a\x09^ messageText",
  17524. referencedClasses: [],
  17525. messageSends: []
  17526. }),
  17527. $globals.Error);
  17528. $core.addMethod(
  17529. $core.method({
  17530. selector: "messageText:",
  17531. protocol: 'accessing',
  17532. fn: function (aString){
  17533. var self=this;
  17534. self["@messageText"]=aString;
  17535. return self;
  17536. },
  17537. args: ["aString"],
  17538. source: "messageText: aString\x0a\x09messageText := aString",
  17539. referencedClasses: [],
  17540. messageSends: []
  17541. }),
  17542. $globals.Error);
  17543. $core.addMethod(
  17544. $core.method({
  17545. selector: "resignal",
  17546. protocol: 'signaling',
  17547. fn: function (){
  17548. var self=this;
  17549. return $core.withContext(function($ctx1) {
  17550. self.amberHandled = false;
  17551. throw(self);
  17552. ;
  17553. return self;
  17554. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  17555. },
  17556. args: [],
  17557. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09>",
  17558. referencedClasses: [],
  17559. messageSends: []
  17560. }),
  17561. $globals.Error);
  17562. $core.addMethod(
  17563. $core.method({
  17564. selector: "signal",
  17565. protocol: 'signaling',
  17566. fn: function (){
  17567. var self=this;
  17568. return $core.withContext(function($ctx1) {
  17569. self.amberHandled = false;
  17570. self.context = $core.getThisContext();
  17571. self.smalltalkError = true;
  17572. throw self;
  17573. ;
  17574. return self;
  17575. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  17576. },
  17577. args: [],
  17578. source: "signal\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09self.context = $core.getThisContext(); \x0a\x09\x09self.smalltalkError = true;\x0a\x09\x09throw self;\x0a\x09>",
  17579. referencedClasses: [],
  17580. messageSends: []
  17581. }),
  17582. $globals.Error);
  17583. $core.addMethod(
  17584. $core.method({
  17585. selector: "signal:",
  17586. protocol: 'signaling',
  17587. fn: function (aString){
  17588. var self=this;
  17589. return $core.withContext(function($ctx1) {
  17590. self._messageText_(aString);
  17591. self._signal();
  17592. return self;
  17593. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  17594. },
  17595. args: ["aString"],
  17596. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  17597. referencedClasses: [],
  17598. messageSends: ["messageText:", "signal"]
  17599. }),
  17600. $globals.Error);
  17601. $core.addMethod(
  17602. $core.method({
  17603. selector: "signalerContext",
  17604. protocol: 'accessing',
  17605. fn: function (){
  17606. var self=this;
  17607. return $core.withContext(function($ctx1) {
  17608. return self._signalerContextFrom_(self._context());
  17609. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  17610. },
  17611. args: [],
  17612. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  17613. referencedClasses: [],
  17614. messageSends: ["signalerContextFrom:", "context"]
  17615. }),
  17616. $globals.Error);
  17617. $core.addMethod(
  17618. $core.method({
  17619. selector: "signalerContextFrom:",
  17620. protocol: 'accessing',
  17621. fn: function (aContext){
  17622. var self=this;
  17623. return $core.withContext(function($ctx1) {
  17624. var $3,$2,$1;
  17625. return $recv(aContext)._findContextSuchThat_((function(context){
  17626. return $core.withContext(function($ctx2) {
  17627. $3=$recv(context)._receiver();
  17628. $ctx2.sendIdx["receiver"]=1;
  17629. $2=$recv($3).__eq_eq(self);
  17630. $ctx2.sendIdx["=="]=1;
  17631. $1=$recv($2)._or_((function(){
  17632. return $core.withContext(function($ctx3) {
  17633. return $recv($recv(context)._receiver()).__eq_eq(self._class());
  17634. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17635. }));
  17636. return $recv($1)._not();
  17637. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  17638. }));
  17639. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  17640. },
  17641. args: ["aContext"],
  17642. 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 ]",
  17643. referencedClasses: [],
  17644. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  17645. }),
  17646. $globals.Error);
  17647. $core.addMethod(
  17648. $core.method({
  17649. selector: "wasHandled",
  17650. protocol: 'testing',
  17651. fn: function (){
  17652. var self=this;
  17653. return $core.withContext(function($ctx1) {
  17654. return self.amberHandled || false;
  17655. return self;
  17656. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  17657. },
  17658. args: [],
  17659. source: "wasHandled\x0a\x09<return self.amberHandled || false>",
  17660. referencedClasses: [],
  17661. messageSends: []
  17662. }),
  17663. $globals.Error);
  17664. $core.addMethod(
  17665. $core.method({
  17666. selector: "classTag",
  17667. protocol: 'accessing',
  17668. fn: function (){
  17669. var self=this;
  17670. return "exception";
  17671. },
  17672. args: [],
  17673. 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'",
  17674. referencedClasses: [],
  17675. messageSends: []
  17676. }),
  17677. $globals.Error.klass);
  17678. $core.addMethod(
  17679. $core.method({
  17680. selector: "signal",
  17681. protocol: 'instance creation',
  17682. fn: function (){
  17683. var self=this;
  17684. return $core.withContext(function($ctx1) {
  17685. return $recv(self._new())._signal();
  17686. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.klass)});
  17687. },
  17688. args: [],
  17689. source: "signal\x0a\x09^ self new signal",
  17690. referencedClasses: [],
  17691. messageSends: ["signal", "new"]
  17692. }),
  17693. $globals.Error.klass);
  17694. $core.addMethod(
  17695. $core.method({
  17696. selector: "signal:",
  17697. protocol: 'instance creation',
  17698. fn: function (aString){
  17699. var self=this;
  17700. return $core.withContext(function($ctx1) {
  17701. return $recv(self._new())._signal_(aString);
  17702. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.klass)});
  17703. },
  17704. args: ["aString"],
  17705. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  17706. referencedClasses: [],
  17707. messageSends: ["signal:", "new"]
  17708. }),
  17709. $globals.Error.klass);
  17710. $core.addClass('Halt', $globals.Error, [], 'Kernel-Exceptions');
  17711. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  17712. $core.addMethod(
  17713. $core.method({
  17714. selector: "messageText",
  17715. protocol: 'accessing',
  17716. fn: function (){
  17717. var self=this;
  17718. return "Halt encountered";
  17719. },
  17720. args: [],
  17721. source: "messageText\x0a\x09^ 'Halt encountered'",
  17722. referencedClasses: [],
  17723. messageSends: []
  17724. }),
  17725. $globals.Halt);
  17726. $core.addMethod(
  17727. $core.method({
  17728. selector: "signalerContextFrom:",
  17729. protocol: 'accessing',
  17730. fn: function (aContext){
  17731. var self=this;
  17732. return $core.withContext(function($ctx1) {
  17733. var $3,$2,$1;
  17734. return $recv(aContext)._findContextSuchThat_((function(context){
  17735. return $core.withContext(function($ctx2) {
  17736. $3=$recv(context)._receiver();
  17737. $ctx2.sendIdx["receiver"]=1;
  17738. $2=$recv($3).__eq_eq(self);
  17739. $ctx2.sendIdx["=="]=1;
  17740. $1=$recv($2)._or_((function(){
  17741. return $core.withContext(function($ctx3) {
  17742. return $recv($recv($recv(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  17743. return $core.withContext(function($ctx4) {
  17744. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  17745. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  17746. }));
  17747. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17748. }));
  17749. $ctx2.sendIdx["or:"]=1;
  17750. return $recv($1)._not();
  17751. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  17752. }));
  17753. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  17754. },
  17755. args: ["aContext"],
  17756. 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 ]",
  17757. referencedClasses: [],
  17758. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  17759. }),
  17760. $globals.Halt);
  17761. $core.addClass('JavaScriptException', $globals.Error, ['exception'], 'Kernel-Exceptions');
  17762. $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:`";
  17763. $core.addMethod(
  17764. $core.method({
  17765. selector: "context:",
  17766. protocol: 'accessing',
  17767. fn: function (aMethodContext){
  17768. var self=this;
  17769. return $core.withContext(function($ctx1) {
  17770. self.context = aMethodContext;
  17771. return self;
  17772. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  17773. },
  17774. args: ["aMethodContext"],
  17775. source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09<self.context = aMethodContext>",
  17776. referencedClasses: [],
  17777. messageSends: []
  17778. }),
  17779. $globals.JavaScriptException);
  17780. $core.addMethod(
  17781. $core.method({
  17782. selector: "exception",
  17783. protocol: 'accessing',
  17784. fn: function (){
  17785. var self=this;
  17786. return self["@exception"];
  17787. },
  17788. args: [],
  17789. source: "exception\x0a\x09^ exception",
  17790. referencedClasses: [],
  17791. messageSends: []
  17792. }),
  17793. $globals.JavaScriptException);
  17794. $core.addMethod(
  17795. $core.method({
  17796. selector: "exception:",
  17797. protocol: 'accessing',
  17798. fn: function (anException){
  17799. var self=this;
  17800. self["@exception"]=anException;
  17801. return self;
  17802. },
  17803. args: ["anException"],
  17804. source: "exception: anException\x0a\x09exception := anException",
  17805. referencedClasses: [],
  17806. messageSends: []
  17807. }),
  17808. $globals.JavaScriptException);
  17809. $core.addMethod(
  17810. $core.method({
  17811. selector: "messageText",
  17812. protocol: 'accessing',
  17813. fn: function (){
  17814. var self=this;
  17815. return $core.withContext(function($ctx1) {
  17816. return 'JavaScript exception: ' + self["@exception"].toString();
  17817. return self;
  17818. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  17819. },
  17820. args: [],
  17821. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  17822. referencedClasses: [],
  17823. messageSends: []
  17824. }),
  17825. $globals.JavaScriptException);
  17826. $core.addMethod(
  17827. $core.method({
  17828. selector: "on:",
  17829. protocol: 'instance creation',
  17830. fn: function (anException){
  17831. var self=this;
  17832. return $core.withContext(function($ctx1) {
  17833. var $1;
  17834. $1=self._new();
  17835. $recv($1)._exception_(anException);
  17836. return $recv($1)._yourself();
  17837. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.klass)});
  17838. },
  17839. args: ["anException"],
  17840. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  17841. referencedClasses: [],
  17842. messageSends: ["exception:", "new", "yourself"]
  17843. }),
  17844. $globals.JavaScriptException.klass);
  17845. $core.addMethod(
  17846. $core.method({
  17847. selector: "on:context:",
  17848. protocol: 'instance creation',
  17849. fn: function (anException,aMethodContext){
  17850. var self=this;
  17851. return $core.withContext(function($ctx1) {
  17852. var $1;
  17853. $1=self._new();
  17854. $recv($1)._exception_(anException);
  17855. $recv($1)._context_(aMethodContext);
  17856. return $recv($1)._yourself();
  17857. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.klass)});
  17858. },
  17859. args: ["anException", "aMethodContext"],
  17860. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  17861. referencedClasses: [],
  17862. messageSends: ["exception:", "new", "context:", "yourself"]
  17863. }),
  17864. $globals.JavaScriptException.klass);
  17865. $core.addClass('MessageNotUnderstood', $globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  17866. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  17867. $core.addMethod(
  17868. $core.method({
  17869. selector: "message",
  17870. protocol: 'accessing',
  17871. fn: function (){
  17872. var self=this;
  17873. return self["@message"];
  17874. },
  17875. args: [],
  17876. source: "message\x0a\x09^ message",
  17877. referencedClasses: [],
  17878. messageSends: []
  17879. }),
  17880. $globals.MessageNotUnderstood);
  17881. $core.addMethod(
  17882. $core.method({
  17883. selector: "message:",
  17884. protocol: 'accessing',
  17885. fn: function (aMessage){
  17886. var self=this;
  17887. self["@message"]=aMessage;
  17888. return self;
  17889. },
  17890. args: ["aMessage"],
  17891. source: "message: aMessage\x0a\x09message := aMessage",
  17892. referencedClasses: [],
  17893. messageSends: []
  17894. }),
  17895. $globals.MessageNotUnderstood);
  17896. $core.addMethod(
  17897. $core.method({
  17898. selector: "messageText",
  17899. protocol: 'accessing',
  17900. fn: function (){
  17901. var self=this;
  17902. return $core.withContext(function($ctx1) {
  17903. var $1;
  17904. $1=$recv($recv($recv(self._receiver())._asString()).__comma(" does not understand #")).__comma($recv(self._message())._selector());
  17905. $ctx1.sendIdx[","]=1;
  17906. return $1;
  17907. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  17908. },
  17909. args: [],
  17910. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  17911. referencedClasses: [],
  17912. messageSends: [",", "asString", "receiver", "selector", "message"]
  17913. }),
  17914. $globals.MessageNotUnderstood);
  17915. $core.addMethod(
  17916. $core.method({
  17917. selector: "receiver",
  17918. protocol: 'accessing',
  17919. fn: function (){
  17920. var self=this;
  17921. return self["@receiver"];
  17922. },
  17923. args: [],
  17924. source: "receiver\x0a\x09^ receiver",
  17925. referencedClasses: [],
  17926. messageSends: []
  17927. }),
  17928. $globals.MessageNotUnderstood);
  17929. $core.addMethod(
  17930. $core.method({
  17931. selector: "receiver:",
  17932. protocol: 'accessing',
  17933. fn: function (anObject){
  17934. var self=this;
  17935. self["@receiver"]=anObject;
  17936. return self;
  17937. },
  17938. args: ["anObject"],
  17939. source: "receiver: anObject\x0a\x09receiver := anObject",
  17940. referencedClasses: [],
  17941. messageSends: []
  17942. }),
  17943. $globals.MessageNotUnderstood);
  17944. $core.addClass('NonBooleanReceiver', $globals.Error, ['object'], 'Kernel-Exceptions');
  17945. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  17946. $core.addMethod(
  17947. $core.method({
  17948. selector: "object",
  17949. protocol: 'accessing',
  17950. fn: function (){
  17951. var self=this;
  17952. return self["@object"];
  17953. },
  17954. args: [],
  17955. source: "object\x0a\x09^ object",
  17956. referencedClasses: [],
  17957. messageSends: []
  17958. }),
  17959. $globals.NonBooleanReceiver);
  17960. $core.addMethod(
  17961. $core.method({
  17962. selector: "object:",
  17963. protocol: 'accessing',
  17964. fn: function (anObject){
  17965. var self=this;
  17966. self["@object"]=anObject;
  17967. return self;
  17968. },
  17969. args: ["anObject"],
  17970. source: "object: anObject\x0a\x09object := anObject",
  17971. referencedClasses: [],
  17972. messageSends: []
  17973. }),
  17974. $globals.NonBooleanReceiver);
  17975. });
  17976. define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Collections"], function($boot){"use strict";
  17977. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  17978. $core.addPackage('Kernel-Infrastructure');
  17979. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  17980. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17981. $core.addClass('JSObjectProxy', $globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  17982. $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`.";
  17983. $core.addMethod(
  17984. $core.method({
  17985. selector: "=",
  17986. protocol: 'comparing',
  17987. fn: function (anObject){
  17988. var self=this;
  17989. return $core.withContext(function($ctx1) {
  17990. var $2,$1;
  17991. $2=$recv(anObject)._class();
  17992. $ctx1.sendIdx["class"]=1;
  17993. $1=$recv($2).__eq_eq(self._class());
  17994. if(!$core.assert($1)){
  17995. return false;
  17996. };
  17997. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  17998. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  17999. },
  18000. args: ["anObject"],
  18001. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  18002. referencedClasses: ["JSObjectProxy"],
  18003. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  18004. }),
  18005. $globals.JSObjectProxy);
  18006. $core.addMethod(
  18007. $core.method({
  18008. selector: "asJSON",
  18009. protocol: 'enumerating',
  18010. fn: function (){
  18011. var self=this;
  18012. return self["@jsObject"];
  18013. },
  18014. args: [],
  18015. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  18016. referencedClasses: [],
  18017. messageSends: []
  18018. }),
  18019. $globals.JSObjectProxy);
  18020. $core.addMethod(
  18021. $core.method({
  18022. selector: "at:",
  18023. protocol: 'accessing',
  18024. fn: function (aString){
  18025. var self=this;
  18026. return $core.withContext(function($ctx1) {
  18027. return self['@jsObject'][aString];
  18028. return self;
  18029. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  18030. },
  18031. args: ["aString"],
  18032. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  18033. referencedClasses: [],
  18034. messageSends: []
  18035. }),
  18036. $globals.JSObjectProxy);
  18037. $core.addMethod(
  18038. $core.method({
  18039. selector: "at:ifAbsent:",
  18040. protocol: 'accessing',
  18041. fn: function (aString,aBlock){
  18042. var self=this;
  18043. return $core.withContext(function($ctx1) {
  18044. var obj = self['@jsObject'];
  18045. return aString in obj ? obj[aString] : aBlock._value();
  18046. ;
  18047. return self;
  18048. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  18049. },
  18050. args: ["aString", "aBlock"],
  18051. 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<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09>",
  18052. referencedClasses: [],
  18053. messageSends: []
  18054. }),
  18055. $globals.JSObjectProxy);
  18056. $core.addMethod(
  18057. $core.method({
  18058. selector: "at:ifPresent:",
  18059. protocol: 'accessing',
  18060. fn: function (aString,aBlock){
  18061. var self=this;
  18062. return $core.withContext(function($ctx1) {
  18063. var obj = self['@jsObject'];
  18064. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  18065. ;
  18066. return self;
  18067. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  18068. },
  18069. args: ["aString", "aBlock"],
  18070. 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<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09>",
  18071. referencedClasses: [],
  18072. messageSends: []
  18073. }),
  18074. $globals.JSObjectProxy);
  18075. $core.addMethod(
  18076. $core.method({
  18077. selector: "at:ifPresent:ifAbsent:",
  18078. protocol: 'accessing',
  18079. fn: function (aString,aBlock,anotherBlock){
  18080. var self=this;
  18081. return $core.withContext(function($ctx1) {
  18082. var obj = self['@jsObject'];
  18083. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  18084. ;
  18085. return self;
  18086. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  18087. },
  18088. args: ["aString", "aBlock", "anotherBlock"],
  18089. 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<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09>",
  18090. referencedClasses: [],
  18091. messageSends: []
  18092. }),
  18093. $globals.JSObjectProxy);
  18094. $core.addMethod(
  18095. $core.method({
  18096. selector: "at:put:",
  18097. protocol: 'accessing',
  18098. fn: function (aString,anObject){
  18099. var self=this;
  18100. return $core.withContext(function($ctx1) {
  18101. return self['@jsObject'][aString] = anObject;
  18102. return self;
  18103. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  18104. },
  18105. args: ["aString", "anObject"],
  18106. source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
  18107. referencedClasses: [],
  18108. messageSends: []
  18109. }),
  18110. $globals.JSObjectProxy);
  18111. $core.addMethod(
  18112. $core.method({
  18113. selector: "doesNotUnderstand:",
  18114. protocol: 'proxy',
  18115. fn: function (aMessage){
  18116. var self=this;
  18117. return $core.withContext(function($ctx1) {
  18118. var $1,$receiver;
  18119. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  18120. if(($receiver = $1) == null || $receiver.isNil){
  18121. return (
  18122. $ctx1.supercall = true,
  18123. ($globals.JSObjectProxy.superclass||$boot.dnu).fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
  18124. $ctx1.supercall = false;
  18125. } else {
  18126. var jsSelector;
  18127. jsSelector=$receiver;
  18128. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  18129. };
  18130. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  18131. },
  18132. args: ["aMessage"],
  18133. 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 ]",
  18134. referencedClasses: ["JSObjectProxy"],
  18135. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  18136. }),
  18137. $globals.JSObjectProxy);
  18138. $core.addMethod(
  18139. $core.method({
  18140. selector: "in:",
  18141. protocol: 'accessing',
  18142. fn: function (aValuable){
  18143. var self=this;
  18144. return $core.withContext(function($ctx1) {
  18145. return $recv(aValuable)._value_(self["@jsObject"]);
  18146. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  18147. },
  18148. args: ["aValuable"],
  18149. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  18150. referencedClasses: [],
  18151. messageSends: ["value:"]
  18152. }),
  18153. $globals.JSObjectProxy);
  18154. $core.addMethod(
  18155. $core.method({
  18156. selector: "jsObject",
  18157. protocol: 'accessing',
  18158. fn: function (){
  18159. var self=this;
  18160. return self["@jsObject"];
  18161. },
  18162. args: [],
  18163. source: "jsObject\x0a\x09^ jsObject",
  18164. referencedClasses: [],
  18165. messageSends: []
  18166. }),
  18167. $globals.JSObjectProxy);
  18168. $core.addMethod(
  18169. $core.method({
  18170. selector: "keysAndValuesDo:",
  18171. protocol: 'enumerating',
  18172. fn: function (aBlock){
  18173. var self=this;
  18174. return $core.withContext(function($ctx1) {
  18175. var o = self['@jsObject'];
  18176. for(var i in o) {
  18177. aBlock._value_value_(i, o[i]);
  18178. }
  18179. ;
  18180. return self;
  18181. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  18182. },
  18183. args: ["aBlock"],
  18184. source: "keysAndValuesDo: aBlock\x0a\x09<\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>",
  18185. referencedClasses: [],
  18186. messageSends: []
  18187. }),
  18188. $globals.JSObjectProxy);
  18189. $core.addMethod(
  18190. $core.method({
  18191. selector: "printOn:",
  18192. protocol: 'printing',
  18193. fn: function (aStream){
  18194. var self=this;
  18195. return $core.withContext(function($ctx1) {
  18196. $recv(aStream)._nextPutAll_(self._printString());
  18197. return self;
  18198. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  18199. },
  18200. args: ["aStream"],
  18201. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  18202. referencedClasses: [],
  18203. messageSends: ["nextPutAll:", "printString"]
  18204. }),
  18205. $globals.JSObjectProxy);
  18206. $core.addMethod(
  18207. $core.method({
  18208. selector: "printString",
  18209. protocol: 'printing',
  18210. fn: function (){
  18211. var self=this;
  18212. return $core.withContext(function($ctx1) {
  18213. var js = self['@jsObject'];
  18214. return js.toString
  18215. ? js.toString()
  18216. : Object.prototype.toString.call(js)
  18217. ;
  18218. return self;
  18219. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  18220. },
  18221. args: [],
  18222. source: "printString\x0a\x09<\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>",
  18223. referencedClasses: [],
  18224. messageSends: []
  18225. }),
  18226. $globals.JSObjectProxy);
  18227. $core.addMethod(
  18228. $core.method({
  18229. selector: "putOn:",
  18230. protocol: 'streaming',
  18231. fn: function (aStream){
  18232. var self=this;
  18233. return $core.withContext(function($ctx1) {
  18234. $recv(aStream)._nextPutJSObject_(self["@jsObject"]);
  18235. return self;
  18236. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  18237. },
  18238. args: ["aStream"],
  18239. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  18240. referencedClasses: [],
  18241. messageSends: ["nextPutJSObject:"]
  18242. }),
  18243. $globals.JSObjectProxy);
  18244. $core.addMethod(
  18245. $core.method({
  18246. selector: "addObjectVariablesTo:ofProxy:",
  18247. protocol: 'proxy',
  18248. fn: function (aDictionary,aProxy){
  18249. var self=this;
  18250. return $core.withContext(function($ctx1) {
  18251. var jsObject = aProxy['@jsObject'];
  18252. for(var i in jsObject) {
  18253. aDictionary._at_put_(i, jsObject[i]);
  18254. }
  18255. ;
  18256. return self;
  18257. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18258. },
  18259. args: ["aDictionary", "aProxy"],
  18260. source: "addObjectVariablesTo: aDictionary ofProxy: aProxy\x0a\x09<\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>",
  18261. referencedClasses: [],
  18262. messageSends: []
  18263. }),
  18264. $globals.JSObjectProxy.klass);
  18265. $core.addMethod(
  18266. $core.method({
  18267. selector: "compareJSObjectOfProxy:withProxy:",
  18268. protocol: 'proxy',
  18269. fn: function (aProxy,anotherProxy){
  18270. var self=this;
  18271. return $core.withContext(function($ctx1) {
  18272. var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy;
  18273. return aProxy["@jsObject"] === anotherJSObject;
  18274. return self;
  18275. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)});
  18276. },
  18277. args: ["aProxy", "anotherProxy"],
  18278. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<\x0a\x09var anotherJSObject = anotherProxy.klass ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a>",
  18279. referencedClasses: [],
  18280. messageSends: []
  18281. }),
  18282. $globals.JSObjectProxy.klass);
  18283. $core.addMethod(
  18284. $core.method({
  18285. selector: "forwardMessage:withArguments:ofProxy:",
  18286. protocol: 'proxy',
  18287. fn: function (aString,anArray,aProxy){
  18288. var self=this;
  18289. return $core.withContext(function($ctx1) {
  18290. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  18291. ;
  18292. return self;
  18293. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18294. },
  18295. args: ["aString", "anArray", "aProxy"],
  18296. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09>",
  18297. referencedClasses: [],
  18298. messageSends: []
  18299. }),
  18300. $globals.JSObjectProxy.klass);
  18301. $core.addMethod(
  18302. $core.method({
  18303. selector: "jsObject:ofProxy:",
  18304. protocol: 'proxy',
  18305. fn: function (aJSObject,aProxy){
  18306. var self=this;
  18307. return $core.withContext(function($ctx1) {
  18308. aProxy['@jsObject'] = aJSObject;
  18309. return self;
  18310. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18311. },
  18312. args: ["aJSObject", "aProxy"],
  18313. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<aProxy['@jsObject'] = aJSObject>",
  18314. referencedClasses: [],
  18315. messageSends: []
  18316. }),
  18317. $globals.JSObjectProxy.klass);
  18318. $core.addMethod(
  18319. $core.method({
  18320. selector: "lookupProperty:ofProxy:",
  18321. protocol: 'proxy',
  18322. fn: function (aString,aProxy){
  18323. var self=this;
  18324. return $core.withContext(function($ctx1) {
  18325. return aString in aProxy._jsObject() ? aString : nil;
  18326. return self;
  18327. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18328. },
  18329. args: ["aString", "aProxy"],
  18330. 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<return aString in aProxy._jsObject() ? aString : nil>",
  18331. referencedClasses: [],
  18332. messageSends: []
  18333. }),
  18334. $globals.JSObjectProxy.klass);
  18335. $core.addMethod(
  18336. $core.method({
  18337. selector: "on:",
  18338. protocol: 'instance creation',
  18339. fn: function (aJSObject){
  18340. var self=this;
  18341. var instance;
  18342. return $core.withContext(function($ctx1) {
  18343. instance=self._new();
  18344. self._jsObject_ofProxy_(aJSObject,instance);
  18345. return instance;
  18346. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)});
  18347. },
  18348. args: ["aJSObject"],
  18349. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  18350. referencedClasses: [],
  18351. messageSends: ["new", "jsObject:ofProxy:"]
  18352. }),
  18353. $globals.JSObjectProxy.klass);
  18354. $core.addClass('Organizer', $globals.Object, [], 'Kernel-Infrastructure');
  18355. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  18356. $core.addMethod(
  18357. $core.method({
  18358. selector: "addElement:",
  18359. protocol: 'accessing',
  18360. fn: function (anObject){
  18361. var self=this;
  18362. return $core.withContext(function($ctx1) {
  18363. self.elements.addElement(anObject);
  18364. return self;
  18365. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  18366. },
  18367. args: ["anObject"],
  18368. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  18369. referencedClasses: [],
  18370. messageSends: []
  18371. }),
  18372. $globals.Organizer);
  18373. $core.addMethod(
  18374. $core.method({
  18375. selector: "elements",
  18376. protocol: 'accessing',
  18377. fn: function (){
  18378. var self=this;
  18379. return $core.withContext(function($ctx1) {
  18380. return $recv(self._basicAt_("elements"))._copy();
  18381. }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
  18382. },
  18383. args: [],
  18384. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  18385. referencedClasses: [],
  18386. messageSends: ["copy", "basicAt:"]
  18387. }),
  18388. $globals.Organizer);
  18389. $core.addMethod(
  18390. $core.method({
  18391. selector: "removeElement:",
  18392. protocol: 'accessing',
  18393. fn: function (anObject){
  18394. var self=this;
  18395. return $core.withContext(function($ctx1) {
  18396. self.elements.removeElement(anObject);
  18397. return self;
  18398. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  18399. },
  18400. args: ["anObject"],
  18401. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  18402. referencedClasses: [],
  18403. messageSends: []
  18404. }),
  18405. $globals.Organizer);
  18406. $core.addClass('ClassOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  18407. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  18408. $core.addMethod(
  18409. $core.method({
  18410. selector: "addElement:",
  18411. protocol: 'accessing',
  18412. fn: function (aString){
  18413. var self=this;
  18414. return $core.withContext(function($ctx1) {
  18415. var $1,$3,$2;
  18416. (
  18417. $ctx1.supercall = true,
  18418. ($globals.ClassOrganizer.superclass||$boot.dnu).fn.prototype._addElement_.apply($recv(self), [aString]));
  18419. $ctx1.supercall = false;
  18420. $1=$recv($globals.SystemAnnouncer)._current();
  18421. $3=$recv($globals.ProtocolAdded)._new();
  18422. $recv($3)._protocol_(aString);
  18423. $recv($3)._theClass_(self._theClass());
  18424. $2=$recv($3)._yourself();
  18425. $recv($1)._announce_($2);
  18426. return self;
  18427. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  18428. },
  18429. args: ["aString"],
  18430. 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)",
  18431. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  18432. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  18433. }),
  18434. $globals.ClassOrganizer);
  18435. $core.addMethod(
  18436. $core.method({
  18437. selector: "removeElement:",
  18438. protocol: 'accessing',
  18439. fn: function (aString){
  18440. var self=this;
  18441. return $core.withContext(function($ctx1) {
  18442. var $1,$3,$2;
  18443. (
  18444. $ctx1.supercall = true,
  18445. ($globals.ClassOrganizer.superclass||$boot.dnu).fn.prototype._removeElement_.apply($recv(self), [aString]));
  18446. $ctx1.supercall = false;
  18447. $1=$recv($globals.SystemAnnouncer)._current();
  18448. $3=$recv($globals.ProtocolRemoved)._new();
  18449. $recv($3)._protocol_(aString);
  18450. $recv($3)._theClass_(self._theClass());
  18451. $2=$recv($3)._yourself();
  18452. $recv($1)._announce_($2);
  18453. return self;
  18454. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  18455. },
  18456. args: ["aString"],
  18457. 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)",
  18458. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  18459. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  18460. }),
  18461. $globals.ClassOrganizer);
  18462. $core.addMethod(
  18463. $core.method({
  18464. selector: "theClass",
  18465. protocol: 'accessing',
  18466. fn: function (){
  18467. var self=this;
  18468. return $core.withContext(function($ctx1) {
  18469. return self.theClass ;
  18470. return self;
  18471. }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
  18472. },
  18473. args: [],
  18474. source: "theClass\x0a\x09< return self.theClass >",
  18475. referencedClasses: [],
  18476. messageSends: []
  18477. }),
  18478. $globals.ClassOrganizer);
  18479. $core.addClass('PackageOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  18480. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  18481. $core.addClass('Package', $globals.Object, ['transport', 'imports', 'dirty'], 'Kernel-Infrastructure');
  18482. $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'";
  18483. $core.addMethod(
  18484. $core.method({
  18485. selector: "basicImports",
  18486. protocol: 'private',
  18487. fn: function (){
  18488. var self=this;
  18489. return $core.withContext(function($ctx1) {
  18490. return self.imports || [];
  18491. return self;
  18492. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  18493. },
  18494. args: [],
  18495. source: "basicImports\x0a\x09\x22Answer the imports literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<return self.imports || []>",
  18496. referencedClasses: [],
  18497. messageSends: []
  18498. }),
  18499. $globals.Package);
  18500. $core.addMethod(
  18501. $core.method({
  18502. selector: "basicName:",
  18503. protocol: 'private',
  18504. fn: function (aString){
  18505. var self=this;
  18506. return $core.withContext(function($ctx1) {
  18507. self.pkgName = aString;
  18508. return self;
  18509. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  18510. },
  18511. args: ["aString"],
  18512. source: "basicName: aString\x0a\x09<self.pkgName = aString>",
  18513. referencedClasses: [],
  18514. messageSends: []
  18515. }),
  18516. $globals.Package);
  18517. $core.addMethod(
  18518. $core.method({
  18519. selector: "basicTransport",
  18520. protocol: 'private',
  18521. fn: function (){
  18522. var self=this;
  18523. return $core.withContext(function($ctx1) {
  18524. return self.transport;
  18525. return self;
  18526. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  18527. },
  18528. args: [],
  18529. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<return self.transport>",
  18530. referencedClasses: [],
  18531. messageSends: []
  18532. }),
  18533. $globals.Package);
  18534. $core.addMethod(
  18535. $core.method({
  18536. selector: "beClean",
  18537. protocol: 'accessing',
  18538. fn: function (){
  18539. var self=this;
  18540. return $core.withContext(function($ctx1) {
  18541. var $1,$3,$2;
  18542. self["@dirty"]=false;
  18543. $1=$recv($globals.SystemAnnouncer)._current();
  18544. $3=$recv($globals.PackageClean)._new();
  18545. $recv($3)._package_(self);
  18546. $2=$recv($3)._yourself();
  18547. $recv($1)._announce_($2);
  18548. return self;
  18549. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  18550. },
  18551. args: [],
  18552. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18553. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  18554. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18555. }),
  18556. $globals.Package);
  18557. $core.addMethod(
  18558. $core.method({
  18559. selector: "beDirty",
  18560. protocol: 'accessing',
  18561. fn: function (){
  18562. var self=this;
  18563. return $core.withContext(function($ctx1) {
  18564. var $1,$3,$2;
  18565. self["@dirty"]=true;
  18566. $1=$recv($globals.SystemAnnouncer)._current();
  18567. $3=$recv($globals.PackageDirty)._new();
  18568. $recv($3)._package_(self);
  18569. $2=$recv($3)._yourself();
  18570. $recv($1)._announce_($2);
  18571. return self;
  18572. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  18573. },
  18574. args: [],
  18575. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18576. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  18577. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18578. }),
  18579. $globals.Package);
  18580. $core.addMethod(
  18581. $core.method({
  18582. selector: "classTemplate",
  18583. protocol: 'accessing',
  18584. fn: function (){
  18585. var self=this;
  18586. return $core.withContext(function($ctx1) {
  18587. var $2,$3,$1,$4,$5;
  18588. return $recv($globals.String)._streamContents_((function(stream){
  18589. return $core.withContext(function($ctx2) {
  18590. $recv(stream)._nextPutAll_("Object");
  18591. $ctx2.sendIdx["nextPutAll:"]=1;
  18592. $recv(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  18593. $ctx2.sendIdx["nextPutAll:"]=2;
  18594. $2=$recv($globals.String)._lf();
  18595. $ctx2.sendIdx["lf"]=1;
  18596. $3=$recv($globals.String)._tab();
  18597. $ctx2.sendIdx["tab"]=1;
  18598. $1=$recv($2).__comma($3);
  18599. $ctx2.sendIdx[","]=1;
  18600. $recv(stream)._nextPutAll_($1);
  18601. $ctx2.sendIdx["nextPutAll:"]=3;
  18602. $4=$recv(stream)._nextPutAll_("instanceVariableNames: ''");
  18603. $ctx2.sendIdx["nextPutAll:"]=4;
  18604. $4;
  18605. $5=$recv("'".__comma($recv($globals.String)._lf())).__comma($recv($globals.String)._tab());
  18606. $ctx2.sendIdx[","]=2;
  18607. $recv(stream)._nextPutAll_($5);
  18608. $ctx2.sendIdx["nextPutAll:"]=5;
  18609. $recv(stream)._nextPutAll_("package: '");
  18610. $ctx2.sendIdx["nextPutAll:"]=6;
  18611. $recv(stream)._nextPutAll_(self._name());
  18612. $ctx2.sendIdx["nextPutAll:"]=7;
  18613. return $recv(stream)._nextPutAll_("'");
  18614. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18615. }));
  18616. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  18617. },
  18618. args: [],
  18619. 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: '''' ]",
  18620. referencedClasses: ["String"],
  18621. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"]
  18622. }),
  18623. $globals.Package);
  18624. $core.addMethod(
  18625. $core.method({
  18626. selector: "classes",
  18627. protocol: 'classes',
  18628. fn: function (){
  18629. var self=this;
  18630. return $core.withContext(function($ctx1) {
  18631. return $recv(self._organization())._elements();
  18632. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  18633. },
  18634. args: [],
  18635. source: "classes\x0a\x09^ self organization elements",
  18636. referencedClasses: [],
  18637. messageSends: ["elements", "organization"]
  18638. }),
  18639. $globals.Package);
  18640. $core.addMethod(
  18641. $core.method({
  18642. selector: "definition",
  18643. protocol: 'accessing',
  18644. fn: function (){
  18645. var self=this;
  18646. return $core.withContext(function($ctx1) {
  18647. var $1,$3,$4,$2,$6,$5,$8,$9,$7,$10;
  18648. return $recv($globals.String)._streamContents_((function(stream){
  18649. return $core.withContext(function($ctx2) {
  18650. $1=$recv(self._class())._name();
  18651. $ctx2.sendIdx["name"]=1;
  18652. $recv(stream)._nextPutAll_($1);
  18653. $ctx2.sendIdx["nextPutAll:"]=1;
  18654. $3=$recv($globals.String)._lf();
  18655. $ctx2.sendIdx["lf"]=1;
  18656. $4=$recv($globals.String)._tab();
  18657. $ctx2.sendIdx["tab"]=1;
  18658. $2=$recv($3).__comma($4);
  18659. $ctx2.sendIdx[","]=1;
  18660. $recv(stream)._nextPutAll_($2);
  18661. $ctx2.sendIdx["nextPutAll:"]=2;
  18662. $recv(stream)._nextPutAll_("named: ");
  18663. $ctx2.sendIdx["nextPutAll:"]=3;
  18664. $6="'".__comma(self._name());
  18665. $ctx2.sendIdx[","]=3;
  18666. $5=$recv($6).__comma("'");
  18667. $ctx2.sendIdx[","]=2;
  18668. $recv(stream)._nextPutAll_($5);
  18669. $ctx2.sendIdx["nextPutAll:"]=4;
  18670. $8=$recv($globals.String)._lf();
  18671. $ctx2.sendIdx["lf"]=2;
  18672. $9=$recv($globals.String)._tab();
  18673. $ctx2.sendIdx["tab"]=2;
  18674. $7=$recv($8).__comma($9);
  18675. $ctx2.sendIdx[","]=4;
  18676. $recv(stream)._nextPutAll_($7);
  18677. $ctx2.sendIdx["nextPutAll:"]=5;
  18678. $recv(stream)._nextPutAll_("imports: ");
  18679. $ctx2.sendIdx["nextPutAll:"]=6;
  18680. $recv(stream)._nextPutAll_(self._importsDefinition());
  18681. $ctx2.sendIdx["nextPutAll:"]=7;
  18682. $10=$recv($recv($globals.String)._lf()).__comma($recv($globals.String)._tab());
  18683. $ctx2.sendIdx[","]=5;
  18684. $recv(stream)._nextPutAll_($10);
  18685. $ctx2.sendIdx["nextPutAll:"]=8;
  18686. $recv(stream)._nextPutAll_("transport: (");
  18687. $ctx2.sendIdx["nextPutAll:"]=9;
  18688. return $recv(stream)._nextPutAll_($recv($recv(self._transport())._definition()).__comma(")"));
  18689. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18690. }));
  18691. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  18692. },
  18693. args: [],
  18694. 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, ')' ]",
  18695. referencedClasses: ["String"],
  18696. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "importsDefinition", "definition", "transport"]
  18697. }),
  18698. $globals.Package);
  18699. $core.addMethod(
  18700. $core.method({
  18701. selector: "imports",
  18702. protocol: 'accessing',
  18703. fn: function (){
  18704. var self=this;
  18705. return $core.withContext(function($ctx1) {
  18706. var $1,$receiver;
  18707. $1=self["@imports"];
  18708. if(($receiver = $1) == null || $receiver.isNil){
  18709. var parsed;
  18710. parsed=self._importsFromJson_(self._basicImports());
  18711. parsed;
  18712. self._imports_(parsed);
  18713. return self["@imports"];
  18714. } else {
  18715. return $1;
  18716. };
  18717. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  18718. },
  18719. args: [],
  18720. 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 ]",
  18721. referencedClasses: [],
  18722. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  18723. }),
  18724. $globals.Package);
  18725. $core.addMethod(
  18726. $core.method({
  18727. selector: "imports:",
  18728. protocol: 'accessing',
  18729. fn: function (anArray){
  18730. var self=this;
  18731. return $core.withContext(function($ctx1) {
  18732. self._validateImports_(anArray);
  18733. self["@imports"]=$recv(anArray)._asSet();
  18734. return self;
  18735. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  18736. },
  18737. args: ["anArray"],
  18738. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  18739. referencedClasses: [],
  18740. messageSends: ["validateImports:", "asSet"]
  18741. }),
  18742. $globals.Package);
  18743. $core.addMethod(
  18744. $core.method({
  18745. selector: "importsAsJson",
  18746. protocol: 'converting',
  18747. fn: function (){
  18748. var self=this;
  18749. return $core.withContext(function($ctx1) {
  18750. var $1;
  18751. return $recv(self._sortedImportsAsArray())._collect_((function(each){
  18752. return $core.withContext(function($ctx2) {
  18753. $1=$recv(each)._isString();
  18754. if($core.assert($1)){
  18755. return each;
  18756. } else {
  18757. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  18758. $ctx2.sendIdx[","]=1;
  18759. };
  18760. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18761. }));
  18762. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  18763. },
  18764. args: [],
  18765. 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 ]]",
  18766. referencedClasses: [],
  18767. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  18768. }),
  18769. $globals.Package);
  18770. $core.addMethod(
  18771. $core.method({
  18772. selector: "importsDefinition",
  18773. protocol: 'accessing',
  18774. fn: function (){
  18775. var self=this;
  18776. return $core.withContext(function($ctx1) {
  18777. return $recv($globals.String)._streamContents_((function(stream){
  18778. return $core.withContext(function($ctx2) {
  18779. $recv(stream)._nextPutAll_("{");
  18780. $ctx2.sendIdx["nextPutAll:"]=1;
  18781. $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
  18782. return $core.withContext(function($ctx3) {
  18783. return $recv(stream)._nextPutAll_($recv(each)._importsString());
  18784. $ctx3.sendIdx["nextPutAll:"]=2;
  18785. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  18786. }),(function(){
  18787. return $core.withContext(function($ctx3) {
  18788. return $recv(stream)._nextPutAll_(". ");
  18789. $ctx3.sendIdx["nextPutAll:"]=3;
  18790. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  18791. }));
  18792. return $recv(stream)._nextPutAll_("}");
  18793. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18794. }));
  18795. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  18796. },
  18797. args: [],
  18798. 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: '}' ]",
  18799. referencedClasses: ["String"],
  18800. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "sortedImportsAsArray", "importsString"]
  18801. }),
  18802. $globals.Package);
  18803. $core.addMethod(
  18804. $core.method({
  18805. selector: "importsFromJson:",
  18806. protocol: 'converting',
  18807. fn: function (anArray){
  18808. var self=this;
  18809. return $core.withContext(function($ctx1) {
  18810. var $1;
  18811. return $recv(anArray)._collect_((function(each){
  18812. var split;
  18813. return $core.withContext(function($ctx2) {
  18814. split=$recv(each)._tokenize_("=");
  18815. split;
  18816. $1=$recv($recv(split)._size()).__eq((1));
  18817. if($core.assert($1)){
  18818. return $recv(split)._first();
  18819. $ctx2.sendIdx["first"]=1;
  18820. } else {
  18821. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  18822. };
  18823. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  18824. }));
  18825. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  18826. },
  18827. args: ["anArray"],
  18828. 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 ]]",
  18829. referencedClasses: [],
  18830. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  18831. }),
  18832. $globals.Package);
  18833. $core.addMethod(
  18834. $core.method({
  18835. selector: "isDirty",
  18836. protocol: 'testing',
  18837. fn: function (){
  18838. var self=this;
  18839. return $core.withContext(function($ctx1) {
  18840. var $1,$receiver;
  18841. $1=self["@dirty"];
  18842. if(($receiver = $1) == null || $receiver.isNil){
  18843. return false;
  18844. } else {
  18845. return $1;
  18846. };
  18847. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  18848. },
  18849. args: [],
  18850. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  18851. referencedClasses: [],
  18852. messageSends: ["ifNil:"]
  18853. }),
  18854. $globals.Package);
  18855. $core.addMethod(
  18856. $core.method({
  18857. selector: "isPackage",
  18858. protocol: 'testing',
  18859. fn: function (){
  18860. var self=this;
  18861. return true;
  18862. },
  18863. args: [],
  18864. source: "isPackage\x0a\x09^ true",
  18865. referencedClasses: [],
  18866. messageSends: []
  18867. }),
  18868. $globals.Package);
  18869. $core.addMethod(
  18870. $core.method({
  18871. selector: "loadDependencies",
  18872. protocol: 'dependencies',
  18873. fn: function (){
  18874. var self=this;
  18875. var classes,packages;
  18876. return $core.withContext(function($ctx1) {
  18877. var $1;
  18878. classes=self._loadDependencyClasses();
  18879. $1=$recv($recv(classes)._collect_((function(each){
  18880. return $core.withContext(function($ctx2) {
  18881. return $recv(each)._package();
  18882. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18883. })))._asSet();
  18884. $recv($1)._remove_ifAbsent_(self,(function(){
  18885. }));
  18886. return $recv($1)._yourself();
  18887. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  18888. },
  18889. args: [],
  18890. 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",
  18891. referencedClasses: [],
  18892. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  18893. }),
  18894. $globals.Package);
  18895. $core.addMethod(
  18896. $core.method({
  18897. selector: "loadDependencyClasses",
  18898. protocol: 'dependencies',
  18899. fn: function (){
  18900. var self=this;
  18901. var starCategoryName;
  18902. return $core.withContext(function($ctx1) {
  18903. var $3,$2,$1,$5,$4;
  18904. starCategoryName="*".__comma(self._name());
  18905. $ctx1.sendIdx[","]=1;
  18906. $3=self._classes();
  18907. $ctx1.sendIdx["classes"]=1;
  18908. $2=$recv($3)._collect_((function(each){
  18909. return $core.withContext(function($ctx2) {
  18910. return $recv(each)._superclass();
  18911. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18912. }));
  18913. $1=$recv($2)._asSet();
  18914. $recv($1)._remove_ifAbsent_(nil,(function(){
  18915. }));
  18916. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  18917. return $core.withContext(function($ctx2) {
  18918. $5=$recv(each)._protocols();
  18919. $ctx2.sendIdx["protocols"]=1;
  18920. $4=$recv($5).__comma($recv($recv(each)._class())._protocols());
  18921. return $recv($4)._includes_(starCategoryName);
  18922. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  18923. })));
  18924. return $recv($1)._yourself();
  18925. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  18926. },
  18927. args: [],
  18928. 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",
  18929. referencedClasses: ["Smalltalk"],
  18930. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"]
  18931. }),
  18932. $globals.Package);
  18933. $core.addMethod(
  18934. $core.method({
  18935. selector: "name",
  18936. protocol: 'accessing',
  18937. fn: function (){
  18938. var self=this;
  18939. return $core.withContext(function($ctx1) {
  18940. return self.pkgName;
  18941. return self;
  18942. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  18943. },
  18944. args: [],
  18945. source: "name\x0a\x09<return self.pkgName>",
  18946. referencedClasses: [],
  18947. messageSends: []
  18948. }),
  18949. $globals.Package);
  18950. $core.addMethod(
  18951. $core.method({
  18952. selector: "name:",
  18953. protocol: 'accessing',
  18954. fn: function (aString){
  18955. var self=this;
  18956. return $core.withContext(function($ctx1) {
  18957. self._basicName_(aString);
  18958. self._beDirty();
  18959. return self;
  18960. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  18961. },
  18962. args: ["aString"],
  18963. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  18964. referencedClasses: [],
  18965. messageSends: ["basicName:", "beDirty"]
  18966. }),
  18967. $globals.Package);
  18968. $core.addMethod(
  18969. $core.method({
  18970. selector: "organization",
  18971. protocol: 'accessing',
  18972. fn: function (){
  18973. var self=this;
  18974. return $core.withContext(function($ctx1) {
  18975. return self._basicAt_("organization");
  18976. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  18977. },
  18978. args: [],
  18979. source: "organization\x0a\x09^ self basicAt: 'organization'",
  18980. referencedClasses: [],
  18981. messageSends: ["basicAt:"]
  18982. }),
  18983. $globals.Package);
  18984. $core.addMethod(
  18985. $core.method({
  18986. selector: "printOn:",
  18987. protocol: 'printing',
  18988. fn: function (aStream){
  18989. var self=this;
  18990. return $core.withContext(function($ctx1) {
  18991. (
  18992. $ctx1.supercall = true,
  18993. ($globals.Package.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  18994. $ctx1.supercall = false;
  18995. $recv(aStream)._nextPutAll_(" (");
  18996. $ctx1.sendIdx["nextPutAll:"]=1;
  18997. $recv(aStream)._nextPutAll_(self._name());
  18998. $ctx1.sendIdx["nextPutAll:"]=2;
  18999. $recv(aStream)._nextPutAll_(")");
  19000. return self;
  19001. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  19002. },
  19003. args: ["aStream"],
  19004. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  19005. referencedClasses: [],
  19006. messageSends: ["printOn:", "nextPutAll:", "name"]
  19007. }),
  19008. $globals.Package);
  19009. $core.addMethod(
  19010. $core.method({
  19011. selector: "setupClasses",
  19012. protocol: 'classes',
  19013. fn: function (){
  19014. var self=this;
  19015. return $core.withContext(function($ctx1) {
  19016. var $1;
  19017. $1=self._classes();
  19018. $recv($1)._do_((function(each){
  19019. return $core.withContext(function($ctx2) {
  19020. return $recv($recv($globals.ClassBuilder)._new())._setupClass_(each);
  19021. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19022. }));
  19023. $ctx1.sendIdx["do:"]=1;
  19024. $recv($1)._do_((function(each){
  19025. return $core.withContext(function($ctx2) {
  19026. return $recv(each)._initialize();
  19027. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  19028. }));
  19029. return self;
  19030. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  19031. },
  19032. args: [],
  19033. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  19034. referencedClasses: ["ClassBuilder"],
  19035. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"]
  19036. }),
  19037. $globals.Package);
  19038. $core.addMethod(
  19039. $core.method({
  19040. selector: "sortedClasses",
  19041. protocol: 'classes',
  19042. fn: function (){
  19043. var self=this;
  19044. return $core.withContext(function($ctx1) {
  19045. return $recv(self._class())._sortedClasses_(self._classes());
  19046. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  19047. },
  19048. args: [],
  19049. 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",
  19050. referencedClasses: [],
  19051. messageSends: ["sortedClasses:", "class", "classes"]
  19052. }),
  19053. $globals.Package);
  19054. $core.addMethod(
  19055. $core.method({
  19056. selector: "sortedImportsAsArray",
  19057. protocol: 'private',
  19058. fn: function (){
  19059. var self=this;
  19060. return $core.withContext(function($ctx1) {
  19061. var $3,$2,$4,$1,$6,$5,$7;
  19062. return $recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  19063. return $core.withContext(function($ctx2) {
  19064. $3=$recv(a)._isString();
  19065. $ctx2.sendIdx["isString"]=1;
  19066. $2=$recv($3)._not();
  19067. $4=$recv(b)._isString();
  19068. $ctx2.sendIdx["isString"]=2;
  19069. $1=$recv($2).__and($4);
  19070. return $recv($1)._or_((function(){
  19071. return $core.withContext(function($ctx3) {
  19072. $6=$recv(a)._isString();
  19073. $ctx3.sendIdx["isString"]=3;
  19074. $5=$recv($6).__eq($recv(b)._isString());
  19075. return $recv($5)._and_((function(){
  19076. return $core.withContext(function($ctx4) {
  19077. $7=$recv(a)._value();
  19078. $ctx4.sendIdx["value"]=1;
  19079. return $recv($7).__lt_eq($recv(b)._value());
  19080. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  19081. }));
  19082. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  19083. }));
  19084. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  19085. }));
  19086. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  19087. },
  19088. args: [],
  19089. 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 ]]]",
  19090. referencedClasses: [],
  19091. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  19092. }),
  19093. $globals.Package);
  19094. $core.addMethod(
  19095. $core.method({
  19096. selector: "transport",
  19097. protocol: 'accessing',
  19098. fn: function (){
  19099. var self=this;
  19100. return $core.withContext(function($ctx1) {
  19101. var $1,$2,$receiver;
  19102. $1=self["@transport"];
  19103. if(($receiver = $1) == null || $receiver.isNil){
  19104. $2=$recv($globals.PackageTransport)._fromJson_(self._basicTransport());
  19105. $recv($2)._package_(self);
  19106. self["@transport"]=$recv($2)._yourself();
  19107. return self["@transport"];
  19108. } else {
  19109. return $1;
  19110. };
  19111. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  19112. },
  19113. args: [],
  19114. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  19115. referencedClasses: ["PackageTransport"],
  19116. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  19117. }),
  19118. $globals.Package);
  19119. $core.addMethod(
  19120. $core.method({
  19121. selector: "transport:",
  19122. protocol: 'accessing',
  19123. fn: function (aPackageTransport){
  19124. var self=this;
  19125. return $core.withContext(function($ctx1) {
  19126. self["@transport"]=aPackageTransport;
  19127. $recv(aPackageTransport)._package_(self);
  19128. return self;
  19129. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  19130. },
  19131. args: ["aPackageTransport"],
  19132. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  19133. referencedClasses: [],
  19134. messageSends: ["package:"]
  19135. }),
  19136. $globals.Package);
  19137. $core.addMethod(
  19138. $core.method({
  19139. selector: "validateImports:",
  19140. protocol: 'validation',
  19141. fn: function (aCollection){
  19142. var self=this;
  19143. return $core.withContext(function($ctx1) {
  19144. var $1,$2,$5,$4,$3,$6;
  19145. $recv(aCollection)._do_((function(import_){
  19146. return $core.withContext(function($ctx2) {
  19147. $1=$recv(import_)._isString();
  19148. $ctx2.sendIdx["isString"]=1;
  19149. if(!$core.assert($1)){
  19150. $2=$recv(import_)._respondsTo_("key");
  19151. if(!$core.assert($2)){
  19152. self._error_("Imports must be Strings or Associations");
  19153. $ctx2.sendIdx["error:"]=1;
  19154. };
  19155. $5=$recv(import_)._key();
  19156. $ctx2.sendIdx["key"]=1;
  19157. $4=$recv($5)._isString();
  19158. $ctx2.sendIdx["isString"]=2;
  19159. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  19160. if(!$core.assert($3)){
  19161. self._error_("Key and value must be Strings");
  19162. $ctx2.sendIdx["error:"]=2;
  19163. };
  19164. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  19165. if(!$core.assert($6)){
  19166. return self._error_("Keys must be identifiers");
  19167. };
  19168. };
  19169. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  19170. }));
  19171. return self;
  19172. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  19173. },
  19174. args: ["aCollection"],
  19175. 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' ]]]",
  19176. referencedClasses: [],
  19177. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  19178. }),
  19179. $globals.Package);
  19180. $globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  19181. $core.addMethod(
  19182. $core.method({
  19183. selector: "named:",
  19184. protocol: 'accessing',
  19185. fn: function (aPackageName){
  19186. var self=this;
  19187. return $core.withContext(function($ctx1) {
  19188. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  19189. return $core.withContext(function($ctx2) {
  19190. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  19191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19192. }));
  19193. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  19194. },
  19195. args: ["aPackageName"],
  19196. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  19197. referencedClasses: ["Smalltalk"],
  19198. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  19199. }),
  19200. $globals.Package.klass);
  19201. $core.addMethod(
  19202. $core.method({
  19203. selector: "named:ifAbsent:",
  19204. protocol: 'accessing',
  19205. fn: function (aPackageName,aBlock){
  19206. var self=this;
  19207. return $core.withContext(function($ctx1) {
  19208. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  19209. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  19210. },
  19211. args: ["aPackageName", "aBlock"],
  19212. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  19213. referencedClasses: ["Smalltalk"],
  19214. messageSends: ["packageAt:ifAbsent:"]
  19215. }),
  19216. $globals.Package.klass);
  19217. $core.addMethod(
  19218. $core.method({
  19219. selector: "named:imports:transport:",
  19220. protocol: 'accessing',
  19221. fn: function (aPackageName,anArray,aTransport){
  19222. var self=this;
  19223. var package_;
  19224. return $core.withContext(function($ctx1) {
  19225. package_=self._named_(aPackageName);
  19226. $recv(package_)._imports_(anArray);
  19227. $recv(package_)._transport_(aTransport);
  19228. return package_;
  19229. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  19230. },
  19231. args: ["aPackageName", "anArray", "aTransport"],
  19232. 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",
  19233. referencedClasses: [],
  19234. messageSends: ["named:", "imports:", "transport:"]
  19235. }),
  19236. $globals.Package.klass);
  19237. $core.addMethod(
  19238. $core.method({
  19239. selector: "named:transport:",
  19240. protocol: 'accessing',
  19241. fn: function (aPackageName,aTransport){
  19242. var self=this;
  19243. var package_;
  19244. return $core.withContext(function($ctx1) {
  19245. package_=self._named_(aPackageName);
  19246. $recv(package_)._transport_(aTransport);
  19247. return package_;
  19248. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  19249. },
  19250. args: ["aPackageName", "aTransport"],
  19251. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  19252. referencedClasses: [],
  19253. messageSends: ["named:", "transport:"]
  19254. }),
  19255. $globals.Package.klass);
  19256. $core.addMethod(
  19257. $core.method({
  19258. selector: "sortedClasses:",
  19259. protocol: 'sorting',
  19260. fn: function (classes){
  19261. var self=this;
  19262. var children,others,nodes,expandedClasses;
  19263. return $core.withContext(function($ctx1) {
  19264. var $1,$3,$2;
  19265. children=[];
  19266. others=[];
  19267. $recv(classes)._do_((function(each){
  19268. return $core.withContext(function($ctx2) {
  19269. $1=$recv(classes)._includes_($recv(each)._superclass());
  19270. if($core.assert($1)){
  19271. return $recv(others)._add_(each);
  19272. } else {
  19273. return $recv(children)._add_(each);
  19274. $ctx2.sendIdx["add:"]=1;
  19275. };
  19276. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19277. }));
  19278. $ctx1.sendIdx["do:"]=1;
  19279. nodes=$recv(children)._collect_((function(each){
  19280. return $core.withContext(function($ctx2) {
  19281. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  19282. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  19283. }));
  19284. nodes=$recv(nodes)._sorted_((function(a,b){
  19285. return $core.withContext(function($ctx2) {
  19286. $3=$recv(a)._theClass();
  19287. $ctx2.sendIdx["theClass"]=1;
  19288. $2=$recv($3)._name();
  19289. $ctx2.sendIdx["name"]=1;
  19290. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  19291. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  19292. }));
  19293. expandedClasses=$recv($globals.Array)._new();
  19294. $recv(nodes)._do_((function(aNode){
  19295. return $core.withContext(function($ctx2) {
  19296. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  19297. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  19298. }));
  19299. return expandedClasses;
  19300. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  19301. },
  19302. args: ["classes"],
  19303. 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",
  19304. referencedClasses: ["ClassSorterNode", "Array"],
  19305. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  19306. }),
  19307. $globals.Package.klass);
  19308. $core.addClass('PackageStateObserver', $globals.Object, [], 'Kernel-Infrastructure');
  19309. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  19310. $core.addMethod(
  19311. $core.method({
  19312. selector: "announcer",
  19313. protocol: 'accessing',
  19314. fn: function (){
  19315. var self=this;
  19316. return $core.withContext(function($ctx1) {
  19317. return $recv($globals.SystemAnnouncer)._current();
  19318. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  19319. },
  19320. args: [],
  19321. source: "announcer\x0a\x09^ SystemAnnouncer current",
  19322. referencedClasses: ["SystemAnnouncer"],
  19323. messageSends: ["current"]
  19324. }),
  19325. $globals.PackageStateObserver);
  19326. $core.addMethod(
  19327. $core.method({
  19328. selector: "observeSystem",
  19329. protocol: 'actions',
  19330. fn: function (){
  19331. var self=this;
  19332. return $core.withContext(function($ctx1) {
  19333. var $1;
  19334. $1=self._announcer();
  19335. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  19336. $ctx1.sendIdx["on:send:to:"]=1;
  19337. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  19338. $ctx1.sendIdx["on:send:to:"]=2;
  19339. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  19340. $ctx1.sendIdx["on:send:to:"]=3;
  19341. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  19342. return self;
  19343. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  19344. },
  19345. args: [],
  19346. 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",
  19347. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  19348. messageSends: ["on:send:to:", "announcer"]
  19349. }),
  19350. $globals.PackageStateObserver);
  19351. $core.addMethod(
  19352. $core.method({
  19353. selector: "onClassModification:",
  19354. protocol: 'reactions',
  19355. fn: function (anAnnouncement){
  19356. var self=this;
  19357. return $core.withContext(function($ctx1) {
  19358. var $1,$receiver;
  19359. $1=$recv(anAnnouncement)._theClass();
  19360. if(($receiver = $1) == null || $receiver.isNil){
  19361. $1;
  19362. } else {
  19363. var theClass;
  19364. theClass=$receiver;
  19365. $recv($recv(theClass)._package())._beDirty();
  19366. };
  19367. return self;
  19368. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19369. },
  19370. args: ["anAnnouncement"],
  19371. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  19372. referencedClasses: [],
  19373. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  19374. }),
  19375. $globals.PackageStateObserver);
  19376. $core.addMethod(
  19377. $core.method({
  19378. selector: "onMethodModification:",
  19379. protocol: 'reactions',
  19380. fn: function (anAnnouncement){
  19381. var self=this;
  19382. return $core.withContext(function($ctx1) {
  19383. var $1,$receiver;
  19384. $1=$recv($recv(anAnnouncement)._method())._package();
  19385. if(($receiver = $1) == null || $receiver.isNil){
  19386. $1;
  19387. } else {
  19388. var package_;
  19389. package_=$receiver;
  19390. $recv(package_)._beDirty();
  19391. };
  19392. return self;
  19393. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19394. },
  19395. args: ["anAnnouncement"],
  19396. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  19397. referencedClasses: [],
  19398. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  19399. }),
  19400. $globals.PackageStateObserver);
  19401. $core.addMethod(
  19402. $core.method({
  19403. selector: "onPackageAdded:",
  19404. protocol: 'reactions',
  19405. fn: function (anAnnouncement){
  19406. var self=this;
  19407. return $core.withContext(function($ctx1) {
  19408. $recv($recv(anAnnouncement)._package())._beDirty();
  19409. return self;
  19410. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19411. },
  19412. args: ["anAnnouncement"],
  19413. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  19414. referencedClasses: [],
  19415. messageSends: ["beDirty", "package"]
  19416. }),
  19417. $globals.PackageStateObserver);
  19418. $core.addMethod(
  19419. $core.method({
  19420. selector: "onProtocolModification:",
  19421. protocol: 'reactions',
  19422. fn: function (anAnnouncement){
  19423. var self=this;
  19424. return $core.withContext(function($ctx1) {
  19425. var $1,$receiver;
  19426. $1=$recv(anAnnouncement)._package();
  19427. if(($receiver = $1) == null || $receiver.isNil){
  19428. $1;
  19429. } else {
  19430. var package_;
  19431. package_=$receiver;
  19432. $recv(package_)._beDirty();
  19433. };
  19434. return self;
  19435. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19436. },
  19437. args: ["anAnnouncement"],
  19438. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  19439. referencedClasses: [],
  19440. messageSends: ["ifNotNil:", "package", "beDirty"]
  19441. }),
  19442. $globals.PackageStateObserver);
  19443. $globals.PackageStateObserver.klass.iVarNames = ['current'];
  19444. $core.addMethod(
  19445. $core.method({
  19446. selector: "current",
  19447. protocol: 'accessing',
  19448. fn: function (){
  19449. var self=this;
  19450. return $core.withContext(function($ctx1) {
  19451. var $1,$receiver;
  19452. $1=self["@current"];
  19453. if(($receiver = $1) == null || $receiver.isNil){
  19454. self["@current"]=self._new();
  19455. return self["@current"];
  19456. } else {
  19457. return $1;
  19458. };
  19459. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  19460. },
  19461. args: [],
  19462. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  19463. referencedClasses: [],
  19464. messageSends: ["ifNil:", "new"]
  19465. }),
  19466. $globals.PackageStateObserver.klass);
  19467. $core.addMethod(
  19468. $core.method({
  19469. selector: "initialize",
  19470. protocol: 'initialization',
  19471. fn: function (){
  19472. var self=this;
  19473. return $core.withContext(function($ctx1) {
  19474. $recv(self._current())._observeSystem();
  19475. return self;
  19476. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  19477. },
  19478. args: [],
  19479. source: "initialize\x0a\x09self current observeSystem",
  19480. referencedClasses: [],
  19481. messageSends: ["observeSystem", "current"]
  19482. }),
  19483. $globals.PackageStateObserver.klass);
  19484. $core.addClass('ParseError', $globals.Error, [], 'Kernel-Infrastructure');
  19485. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  19486. $core.addClass('RethrowErrorHandler', $globals.Object, [], 'Kernel-Infrastructure');
  19487. $globals.RethrowErrorHandler.comment="This class is used in the commandline version of the compiler.\x0aIt uses the handleError: message of ErrorHandler for printing the stacktrace and throws the error again as JS exception.\x0aAs a result Smalltalk errors are not swallowd by the Amber runtime and compilation can be aborted.";
  19488. $core.addMethod(
  19489. $core.method({
  19490. selector: "basicSignal:",
  19491. protocol: 'error handling',
  19492. fn: function (anError){
  19493. var self=this;
  19494. return $core.withContext(function($ctx1) {
  19495. throw anError;
  19496. return self;
  19497. }, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},$globals.RethrowErrorHandler)});
  19498. },
  19499. args: ["anError"],
  19500. source: "basicSignal: anError\x0a <throw anError>",
  19501. referencedClasses: [],
  19502. messageSends: []
  19503. }),
  19504. $globals.RethrowErrorHandler);
  19505. $core.addMethod(
  19506. $core.method({
  19507. selector: "handleError:",
  19508. protocol: 'error handling',
  19509. fn: function (anError){
  19510. var self=this;
  19511. return $core.withContext(function($ctx1) {
  19512. self._basicSignal_(anError);
  19513. return self;
  19514. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.RethrowErrorHandler)});
  19515. },
  19516. args: ["anError"],
  19517. source: "handleError: anError\x0a self basicSignal: anError",
  19518. referencedClasses: [],
  19519. messageSends: ["basicSignal:"]
  19520. }),
  19521. $globals.RethrowErrorHandler);
  19522. $core.addClass('Setting', $globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  19523. $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`";
  19524. $core.addMethod(
  19525. $core.method({
  19526. selector: "defaultValue",
  19527. protocol: 'accessing',
  19528. fn: function (){
  19529. var self=this;
  19530. return self["@defaultValue"];
  19531. },
  19532. args: [],
  19533. source: "defaultValue\x0a\x09^ defaultValue",
  19534. referencedClasses: [],
  19535. messageSends: []
  19536. }),
  19537. $globals.Setting);
  19538. $core.addMethod(
  19539. $core.method({
  19540. selector: "defaultValue:",
  19541. protocol: 'accessing',
  19542. fn: function (aStringifiableObject){
  19543. var self=this;
  19544. self["@defaultValue"]=aStringifiableObject;
  19545. return self;
  19546. },
  19547. args: ["aStringifiableObject"],
  19548. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  19549. referencedClasses: [],
  19550. messageSends: []
  19551. }),
  19552. $globals.Setting);
  19553. $core.addMethod(
  19554. $core.method({
  19555. selector: "key",
  19556. protocol: 'accessing',
  19557. fn: function (){
  19558. var self=this;
  19559. return self["@key"];
  19560. },
  19561. args: [],
  19562. source: "key\x0a\x09^ key",
  19563. referencedClasses: [],
  19564. messageSends: []
  19565. }),
  19566. $globals.Setting);
  19567. $core.addMethod(
  19568. $core.method({
  19569. selector: "key:",
  19570. protocol: 'accessing',
  19571. fn: function (aString){
  19572. var self=this;
  19573. self["@key"]=aString;
  19574. return self;
  19575. },
  19576. args: ["aString"],
  19577. source: "key: aString\x0a\x09key := aString",
  19578. referencedClasses: [],
  19579. messageSends: []
  19580. }),
  19581. $globals.Setting);
  19582. $core.addMethod(
  19583. $core.method({
  19584. selector: "value",
  19585. protocol: 'accessing',
  19586. fn: function (){
  19587. var self=this;
  19588. return $core.withContext(function($ctx1) {
  19589. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_(self._key(),(function(){
  19590. return $core.withContext(function($ctx2) {
  19591. return self._defaultValue();
  19592. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19593. }));
  19594. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  19595. },
  19596. args: [],
  19597. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  19598. referencedClasses: ["Smalltalk"],
  19599. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  19600. }),
  19601. $globals.Setting);
  19602. $core.addMethod(
  19603. $core.method({
  19604. selector: "value:",
  19605. protocol: 'accessing',
  19606. fn: function (aStringifiableObject){
  19607. var self=this;
  19608. return $core.withContext(function($ctx1) {
  19609. return $recv($recv($globals.Smalltalk)._settings())._at_put_(self._key(),aStringifiableObject);
  19610. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  19611. },
  19612. args: ["aStringifiableObject"],
  19613. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  19614. referencedClasses: ["Smalltalk"],
  19615. messageSends: ["at:put:", "settings", "key"]
  19616. }),
  19617. $globals.Setting);
  19618. $core.addMethod(
  19619. $core.method({
  19620. selector: "at:ifAbsent:",
  19621. protocol: 'instance creation',
  19622. fn: function (aString,aDefaultValue){
  19623. var self=this;
  19624. return $core.withContext(function($ctx1) {
  19625. var $1;
  19626. $1=(
  19627. $ctx1.supercall = true,
  19628. ($globals.Setting.klass.superclass||$boot.dnu).fn.prototype._new.apply($recv(self), []));
  19629. $ctx1.supercall = false;
  19630. $recv($1)._key_(aString);
  19631. $recv($1)._defaultValue_(aDefaultValue);
  19632. return $recv($1)._yourself();
  19633. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  19634. },
  19635. args: ["aString", "aDefaultValue"],
  19636. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  19637. referencedClasses: [],
  19638. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  19639. }),
  19640. $globals.Setting.klass);
  19641. $core.addMethod(
  19642. $core.method({
  19643. selector: "new",
  19644. protocol: 'instance creation',
  19645. fn: function (){
  19646. var self=this;
  19647. return $core.withContext(function($ctx1) {
  19648. self._shouldNotImplement();
  19649. return self;
  19650. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  19651. },
  19652. args: [],
  19653. source: "new\x0a\x09self shouldNotImplement",
  19654. referencedClasses: [],
  19655. messageSends: ["shouldNotImplement"]
  19656. }),
  19657. $globals.Setting.klass);
  19658. $core.addClass('SmalltalkImage', $globals.Object, [], 'Kernel-Infrastructure');
  19659. $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.";
  19660. $core.addMethod(
  19661. $core.method({
  19662. selector: "addGlobalJsVariable:",
  19663. protocol: 'globals',
  19664. fn: function (aString){
  19665. var self=this;
  19666. return $core.withContext(function($ctx1) {
  19667. $recv(self._globalJsVariables())._add_(aString);
  19668. return self;
  19669. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19670. },
  19671. args: ["aString"],
  19672. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  19673. referencedClasses: [],
  19674. messageSends: ["add:", "globalJsVariables"]
  19675. }),
  19676. $globals.SmalltalkImage);
  19677. $core.addMethod(
  19678. $core.method({
  19679. selector: "amdRequire",
  19680. protocol: 'accessing amd',
  19681. fn: function (){
  19682. var self=this;
  19683. return $core.withContext(function($ctx1) {
  19684. return $recv(self._core())._at_("amdRequire");
  19685. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  19686. },
  19687. args: [],
  19688. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  19689. referencedClasses: [],
  19690. messageSends: ["at:", "core"]
  19691. }),
  19692. $globals.SmalltalkImage);
  19693. $core.addMethod(
  19694. $core.method({
  19695. selector: "asSmalltalkException:",
  19696. protocol: 'error handling',
  19697. fn: function (anObject){
  19698. var self=this;
  19699. return $core.withContext(function($ctx1) {
  19700. var $1;
  19701. $1=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  19702. return $core.withContext(function($ctx2) {
  19703. return $recv(anObject)._isKindOf_($globals.Error);
  19704. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19705. }));
  19706. if($core.assert($1)){
  19707. return anObject;
  19708. } else {
  19709. return $recv($globals.JavaScriptException)._on_(anObject);
  19710. };
  19711. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  19712. },
  19713. args: ["anObject"],
  19714. 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 ]",
  19715. referencedClasses: ["Error", "JavaScriptException"],
  19716. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  19717. }),
  19718. $globals.SmalltalkImage);
  19719. $core.addMethod(
  19720. $core.method({
  19721. selector: "basicCreatePackage:",
  19722. protocol: 'private',
  19723. fn: function (packageName){
  19724. var self=this;
  19725. return $core.withContext(function($ctx1) {
  19726. return $core.addPackage(packageName);
  19727. return self;
  19728. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19729. },
  19730. args: ["packageName"],
  19731. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<return $core.addPackage(packageName)>",
  19732. referencedClasses: [],
  19733. messageSends: []
  19734. }),
  19735. $globals.SmalltalkImage);
  19736. $core.addMethod(
  19737. $core.method({
  19738. selector: "basicParse:",
  19739. protocol: 'private',
  19740. fn: function (aString){
  19741. var self=this;
  19742. return $core.withContext(function($ctx1) {
  19743. return $recv($globals.SmalltalkParser)._parse_(aString);
  19744. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  19745. },
  19746. args: ["aString"],
  19747. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  19748. referencedClasses: ["SmalltalkParser"],
  19749. messageSends: ["parse:"]
  19750. }),
  19751. $globals.SmalltalkImage);
  19752. $core.addMethod(
  19753. $core.method({
  19754. selector: "basicRegisterPackage:",
  19755. protocol: 'private',
  19756. fn: function (aPackage){
  19757. var self=this;
  19758. return $core.withContext(function($ctx1) {
  19759. $core.packages[aPackage.pkgName]=aPackage;
  19760. return self;
  19761. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  19762. },
  19763. args: ["aPackage"],
  19764. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<$core.packages[aPackage.pkgName]=aPackage>",
  19765. referencedClasses: [],
  19766. messageSends: []
  19767. }),
  19768. $globals.SmalltalkImage);
  19769. $core.addMethod(
  19770. $core.method({
  19771. selector: "cancelOptOut:",
  19772. protocol: 'accessing',
  19773. fn: function (anObject){
  19774. var self=this;
  19775. return $core.withContext(function($ctx1) {
  19776. delete anObject.klass;
  19777. return self;
  19778. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  19779. },
  19780. args: ["anObject"],
  19781. 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<delete anObject.klass>",
  19782. referencedClasses: [],
  19783. messageSends: []
  19784. }),
  19785. $globals.SmalltalkImage);
  19786. $core.addMethod(
  19787. $core.method({
  19788. selector: "classes",
  19789. protocol: 'classes',
  19790. fn: function (){
  19791. var self=this;
  19792. return $core.withContext(function($ctx1) {
  19793. return $core.classes();
  19794. return self;
  19795. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  19796. },
  19797. args: [],
  19798. source: "classes\x0a\x09<return $core.classes()>",
  19799. referencedClasses: [],
  19800. messageSends: []
  19801. }),
  19802. $globals.SmalltalkImage);
  19803. $core.addMethod(
  19804. $core.method({
  19805. selector: "core",
  19806. protocol: 'accessing',
  19807. fn: function (){
  19808. var self=this;
  19809. return $core.withContext(function($ctx1) {
  19810. return $core;
  19811. return self;
  19812. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  19813. },
  19814. args: [],
  19815. source: "core\x0a\x09<return $core>",
  19816. referencedClasses: [],
  19817. messageSends: []
  19818. }),
  19819. $globals.SmalltalkImage);
  19820. $core.addMethod(
  19821. $core.method({
  19822. selector: "createPackage:",
  19823. protocol: 'packages',
  19824. fn: function (packageName){
  19825. var self=this;
  19826. var package_,announcement;
  19827. return $core.withContext(function($ctx1) {
  19828. var $1;
  19829. package_=self._basicCreatePackage_(packageName);
  19830. $1=$recv($globals.PackageAdded)._new();
  19831. $recv($1)._package_(package_);
  19832. announcement=$recv($1)._yourself();
  19833. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  19834. return package_;
  19835. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  19836. },
  19837. args: ["packageName"],
  19838. 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",
  19839. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  19840. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  19841. }),
  19842. $globals.SmalltalkImage);
  19843. $core.addMethod(
  19844. $core.method({
  19845. selector: "defaultAmdNamespace",
  19846. protocol: 'accessing amd',
  19847. fn: function (){
  19848. var self=this;
  19849. return $core.withContext(function($ctx1) {
  19850. return "transport.defaultAmdNamespace"._settingValue();
  19851. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  19852. },
  19853. args: [],
  19854. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  19855. referencedClasses: [],
  19856. messageSends: ["settingValue"]
  19857. }),
  19858. $globals.SmalltalkImage);
  19859. $core.addMethod(
  19860. $core.method({
  19861. selector: "defaultAmdNamespace:",
  19862. protocol: 'accessing amd',
  19863. fn: function (aString){
  19864. var self=this;
  19865. return $core.withContext(function($ctx1) {
  19866. "transport.defaultAmdNamespace"._settingValue_(aString);
  19867. return self;
  19868. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  19869. },
  19870. args: ["aString"],
  19871. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  19872. referencedClasses: [],
  19873. messageSends: ["settingValue:"]
  19874. }),
  19875. $globals.SmalltalkImage);
  19876. $core.addMethod(
  19877. $core.method({
  19878. selector: "deleteClass:",
  19879. protocol: 'private',
  19880. fn: function (aClass){
  19881. var self=this;
  19882. return $core.withContext(function($ctx1) {
  19883. $core.removeClass(aClass);
  19884. return self;
  19885. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  19886. },
  19887. args: ["aClass"],
  19888. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<$core.removeClass(aClass)>",
  19889. referencedClasses: [],
  19890. messageSends: []
  19891. }),
  19892. $globals.SmalltalkImage);
  19893. $core.addMethod(
  19894. $core.method({
  19895. selector: "deleteGlobalJsVariable:",
  19896. protocol: 'globals',
  19897. fn: function (aString){
  19898. var self=this;
  19899. return $core.withContext(function($ctx1) {
  19900. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  19901. }));
  19902. return self;
  19903. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19904. },
  19905. args: ["aString"],
  19906. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  19907. referencedClasses: [],
  19908. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  19909. }),
  19910. $globals.SmalltalkImage);
  19911. $core.addMethod(
  19912. $core.method({
  19913. selector: "deletePackage:",
  19914. protocol: 'private',
  19915. fn: function (packageName){
  19916. var self=this;
  19917. return $core.withContext(function($ctx1) {
  19918. delete $core.packages[packageName];
  19919. return self;
  19920. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19921. },
  19922. args: ["packageName"],
  19923. 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<delete $core.packages[packageName]>",
  19924. referencedClasses: [],
  19925. messageSends: []
  19926. }),
  19927. $globals.SmalltalkImage);
  19928. $core.addMethod(
  19929. $core.method({
  19930. selector: "existsJsGlobal:",
  19931. protocol: 'testing',
  19932. fn: function (aString){
  19933. var self=this;
  19934. return $core.withContext(function($ctx1) {
  19935. return $recv($recv($globals.Platform)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  19936. return true;
  19937. }),(function(){
  19938. return false;
  19939. }));
  19940. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  19941. },
  19942. args: ["aString"],
  19943. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  19944. referencedClasses: ["Platform"],
  19945. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  19946. }),
  19947. $globals.SmalltalkImage);
  19948. $core.addMethod(
  19949. $core.method({
  19950. selector: "globalJsVariables",
  19951. protocol: 'globals',
  19952. fn: function (){
  19953. var self=this;
  19954. return $core.withContext(function($ctx1) {
  19955. return $core.globalJsVariables;
  19956. return self;
  19957. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  19958. },
  19959. args: [],
  19960. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return $core.globalJsVariables>",
  19961. referencedClasses: [],
  19962. messageSends: []
  19963. }),
  19964. $globals.SmalltalkImage);
  19965. $core.addMethod(
  19966. $core.method({
  19967. selector: "globals",
  19968. protocol: 'accessing',
  19969. fn: function (){
  19970. var self=this;
  19971. return $core.withContext(function($ctx1) {
  19972. return $globals;
  19973. return self;
  19974. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  19975. },
  19976. args: [],
  19977. source: "globals\x0a\x09<return $globals>",
  19978. referencedClasses: [],
  19979. messageSends: []
  19980. }),
  19981. $globals.SmalltalkImage);
  19982. $core.addMethod(
  19983. $core.method({
  19984. selector: "includesKey:",
  19985. protocol: 'accessing',
  19986. fn: function (aKey){
  19987. var self=this;
  19988. return $core.withContext(function($ctx1) {
  19989. return $core.hasOwnProperty(aKey);
  19990. return self;
  19991. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  19992. },
  19993. args: ["aKey"],
  19994. source: "includesKey: aKey\x0a\x09<return $core.hasOwnProperty(aKey)>",
  19995. referencedClasses: [],
  19996. messageSends: []
  19997. }),
  19998. $globals.SmalltalkImage);
  19999. $core.addMethod(
  20000. $core.method({
  20001. selector: "isSmalltalkObject:",
  20002. protocol: 'testing',
  20003. fn: function (anObject){
  20004. var self=this;
  20005. return $core.withContext(function($ctx1) {
  20006. return anObject.klass != null;
  20007. return self;
  20008. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  20009. },
  20010. args: ["anObject"],
  20011. 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<return anObject.klass != null>",
  20012. referencedClasses: [],
  20013. messageSends: []
  20014. }),
  20015. $globals.SmalltalkImage);
  20016. $core.addMethod(
  20017. $core.method({
  20018. selector: "optOut:",
  20019. protocol: 'accessing',
  20020. fn: function (anObject){
  20021. var self=this;
  20022. return $core.withContext(function($ctx1) {
  20023. anObject.klass = null;
  20024. return self;
  20025. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  20026. },
  20027. args: ["anObject"],
  20028. 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<anObject.klass = null>",
  20029. referencedClasses: [],
  20030. messageSends: []
  20031. }),
  20032. $globals.SmalltalkImage);
  20033. $core.addMethod(
  20034. $core.method({
  20035. selector: "packageAt:",
  20036. protocol: 'packages',
  20037. fn: function (packageName){
  20038. var self=this;
  20039. return $core.withContext(function($ctx1) {
  20040. return $core.packages[packageName];
  20041. return self;
  20042. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  20043. },
  20044. args: ["packageName"],
  20045. source: "packageAt: packageName\x0a\x09<return $core.packages[packageName]>",
  20046. referencedClasses: [],
  20047. messageSends: []
  20048. }),
  20049. $globals.SmalltalkImage);
  20050. $core.addMethod(
  20051. $core.method({
  20052. selector: "packageAt:ifAbsent:",
  20053. protocol: 'packages',
  20054. fn: function (packageName,aBlock){
  20055. var self=this;
  20056. return $core.withContext(function($ctx1) {
  20057. var $1;
  20058. $1=self._packageAt_(packageName);
  20059. return $recv($1)._ifNil_(aBlock);
  20060. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  20061. },
  20062. args: ["packageName", "aBlock"],
  20063. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  20064. referencedClasses: [],
  20065. messageSends: ["ifNil:", "packageAt:"]
  20066. }),
  20067. $globals.SmalltalkImage);
  20068. $core.addMethod(
  20069. $core.method({
  20070. selector: "packages",
  20071. protocol: 'packages',
  20072. fn: function (){
  20073. var self=this;
  20074. return $core.withContext(function($ctx1) {
  20075. return Object.keys($core.packages).map(function(k) {
  20076. return $core.packages[k];
  20077. })
  20078. ;
  20079. return self;
  20080. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  20081. },
  20082. args: [],
  20083. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<\x0a\x09\x09return Object.keys($core.packages).map(function(k) {\x0a\x09\x09\x09return $core.packages[k];\x0a\x09\x09})\x0a\x09>",
  20084. referencedClasses: [],
  20085. messageSends: []
  20086. }),
  20087. $globals.SmalltalkImage);
  20088. $core.addMethod(
  20089. $core.method({
  20090. selector: "parse:",
  20091. protocol: 'accessing',
  20092. fn: function (aString){
  20093. var self=this;
  20094. var result;
  20095. return $core.withContext(function($ctx1) {
  20096. var $1;
  20097. $recv((function(){
  20098. return $core.withContext(function($ctx2) {
  20099. result=self._basicParse_(aString);
  20100. return result;
  20101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20102. }))._tryCatch_((function(ex){
  20103. return $core.withContext(function($ctx2) {
  20104. return $recv(self._parseError_parsing_(ex,aString))._signal();
  20105. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  20106. }));
  20107. $1=result;
  20108. $recv($1)._source_(aString);
  20109. return $recv($1)._yourself();
  20110. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  20111. },
  20112. args: ["aString"],
  20113. 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",
  20114. referencedClasses: [],
  20115. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  20116. }),
  20117. $globals.SmalltalkImage);
  20118. $core.addMethod(
  20119. $core.method({
  20120. selector: "parseError:parsing:",
  20121. protocol: 'error handling',
  20122. fn: function (anException,aString){
  20123. var self=this;
  20124. return $core.withContext(function($ctx1) {
  20125. var $1,$7,$6,$5,$8,$4,$3,$2;
  20126. $1=$recv($globals.ParseError)._new();
  20127. $7=$recv(anException)._basicAt_("line");
  20128. $ctx1.sendIdx["basicAt:"]=1;
  20129. $6="Parse error on line ".__comma($7);
  20130. $5=$recv($6).__comma(" column ");
  20131. $ctx1.sendIdx[","]=4;
  20132. $8=$recv(anException)._basicAt_("column");
  20133. $ctx1.sendIdx["basicAt:"]=2;
  20134. $4=$recv($5).__comma($8);
  20135. $ctx1.sendIdx[","]=3;
  20136. $3=$recv($4).__comma(" : Unexpected character ");
  20137. $ctx1.sendIdx[","]=2;
  20138. $2=$recv($3).__comma($recv(anException)._basicAt_("found"));
  20139. $ctx1.sendIdx[","]=1;
  20140. return $recv($1)._messageText_($2);
  20141. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  20142. },
  20143. args: ["anException", "aString"],
  20144. 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')",
  20145. referencedClasses: ["ParseError"],
  20146. messageSends: ["messageText:", "new", ",", "basicAt:"]
  20147. }),
  20148. $globals.SmalltalkImage);
  20149. $core.addMethod(
  20150. $core.method({
  20151. selector: "pseudoVariableNames",
  20152. protocol: 'accessing',
  20153. fn: function (){
  20154. var self=this;
  20155. return ["self", "super", "nil", "true", "false", "thisContext"];
  20156. },
  20157. args: [],
  20158. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  20159. referencedClasses: [],
  20160. messageSends: []
  20161. }),
  20162. $globals.SmalltalkImage);
  20163. $core.addMethod(
  20164. $core.method({
  20165. selector: "readJSObject:",
  20166. protocol: 'accessing',
  20167. fn: function (anObject){
  20168. var self=this;
  20169. return $core.withContext(function($ctx1) {
  20170. return $core.readJSObject(anObject);
  20171. return self;
  20172. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  20173. },
  20174. args: ["anObject"],
  20175. source: "readJSObject: anObject\x0a\x09<return $core.readJSObject(anObject)>",
  20176. referencedClasses: [],
  20177. messageSends: []
  20178. }),
  20179. $globals.SmalltalkImage);
  20180. $core.addMethod(
  20181. $core.method({
  20182. selector: "removeClass:",
  20183. protocol: 'classes',
  20184. fn: function (aClass){
  20185. var self=this;
  20186. return $core.withContext(function($ctx1) {
  20187. var $1,$2,$4,$3;
  20188. $1=$recv(aClass)._isMetaclass();
  20189. if($core.assert($1)){
  20190. self._error_($recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  20191. };
  20192. self._deleteClass_(aClass);
  20193. $2=$recv($globals.SystemAnnouncer)._current();
  20194. $4=$recv($globals.ClassRemoved)._new();
  20195. $recv($4)._theClass_(aClass);
  20196. $3=$recv($4)._yourself();
  20197. $recv($2)._announce_($3);
  20198. return self;
  20199. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  20200. },
  20201. args: ["aClass"],
  20202. 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)",
  20203. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  20204. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  20205. }),
  20206. $globals.SmalltalkImage);
  20207. $core.addMethod(
  20208. $core.method({
  20209. selector: "removePackage:",
  20210. protocol: 'packages',
  20211. fn: function (packageName){
  20212. var self=this;
  20213. var pkg;
  20214. return $core.withContext(function($ctx1) {
  20215. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  20216. return $core.withContext(function($ctx2) {
  20217. return self._error_("Missing package: ".__comma(packageName));
  20218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20219. }));
  20220. $recv($recv(pkg)._classes())._do_((function(each){
  20221. return $core.withContext(function($ctx2) {
  20222. return self._removeClass_(each);
  20223. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  20224. }));
  20225. self._deletePackage_(packageName);
  20226. return self;
  20227. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  20228. },
  20229. args: ["packageName"],
  20230. 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",
  20231. referencedClasses: [],
  20232. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  20233. }),
  20234. $globals.SmalltalkImage);
  20235. $core.addMethod(
  20236. $core.method({
  20237. selector: "renamePackage:to:",
  20238. protocol: 'packages',
  20239. fn: function (packageName,newName){
  20240. var self=this;
  20241. var pkg;
  20242. return $core.withContext(function($ctx1) {
  20243. var $1,$2,$receiver;
  20244. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  20245. return $core.withContext(function($ctx2) {
  20246. $1="Missing package: ".__comma(packageName);
  20247. $ctx2.sendIdx[","]=1;
  20248. return self._error_($1);
  20249. $ctx2.sendIdx["error:"]=1;
  20250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20251. }));
  20252. $2=self._packageAt_(newName);
  20253. if(($receiver = $2) == null || $receiver.isNil){
  20254. $2;
  20255. } else {
  20256. self._error_("Already exists a package called: ".__comma(newName));
  20257. };
  20258. $recv(pkg)._name_(newName);
  20259. self._basicRegisterPackage_(pkg);
  20260. self._deletePackage_(packageName);
  20261. return self;
  20262. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  20263. },
  20264. args: ["packageName", "newName"],
  20265. 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.",
  20266. referencedClasses: [],
  20267. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  20268. }),
  20269. $globals.SmalltalkImage);
  20270. $core.addMethod(
  20271. $core.method({
  20272. selector: "reservedWords",
  20273. protocol: 'accessing',
  20274. fn: function (){
  20275. var self=this;
  20276. return $core.withContext(function($ctx1) {
  20277. return $core.reservedWords;
  20278. return self;
  20279. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  20280. },
  20281. args: [],
  20282. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return $core.reservedWords>",
  20283. referencedClasses: [],
  20284. messageSends: []
  20285. }),
  20286. $globals.SmalltalkImage);
  20287. $core.addMethod(
  20288. $core.method({
  20289. selector: "settings",
  20290. protocol: 'accessing',
  20291. fn: function (){
  20292. var self=this;
  20293. return $globals.SmalltalkSettings;
  20294. },
  20295. args: [],
  20296. source: "settings\x0a\x09^ SmalltalkSettings",
  20297. referencedClasses: ["SmalltalkSettings"],
  20298. messageSends: []
  20299. }),
  20300. $globals.SmalltalkImage);
  20301. $core.addMethod(
  20302. $core.method({
  20303. selector: "version",
  20304. protocol: 'accessing',
  20305. fn: function (){
  20306. var self=this;
  20307. return "0.16.0";
  20308. },
  20309. args: [],
  20310. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.16.0'",
  20311. referencedClasses: [],
  20312. messageSends: []
  20313. }),
  20314. $globals.SmalltalkImage);
  20315. $globals.SmalltalkImage.klass.iVarNames = ['current'];
  20316. $core.addMethod(
  20317. $core.method({
  20318. selector: "current",
  20319. protocol: 'instance creation',
  20320. fn: function (){
  20321. var self=this;
  20322. return $core.withContext(function($ctx1) {
  20323. var $1,$receiver;
  20324. $1=self["@current"];
  20325. if(($receiver = $1) == null || $receiver.isNil){
  20326. self["@current"]=(
  20327. $ctx1.supercall = true,
  20328. ($globals.SmalltalkImage.klass.superclass||$boot.dnu).fn.prototype._new.apply($recv(self), []));
  20329. $ctx1.supercall = false;
  20330. return self["@current"];
  20331. } else {
  20332. self._deprecatedAPI();
  20333. return self["@current"];
  20334. };
  20335. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  20336. },
  20337. args: [],
  20338. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  20339. referencedClasses: [],
  20340. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  20341. }),
  20342. $globals.SmalltalkImage.klass);
  20343. $core.addMethod(
  20344. $core.method({
  20345. selector: "initialize",
  20346. protocol: 'initialization',
  20347. fn: function (){
  20348. var self=this;
  20349. var st;
  20350. return $core.withContext(function($ctx1) {
  20351. st=self._current();
  20352. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  20353. return self;
  20354. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  20355. },
  20356. args: [],
  20357. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  20358. referencedClasses: [],
  20359. messageSends: ["current", "at:put:", "globals"]
  20360. }),
  20361. $globals.SmalltalkImage.klass);
  20362. $core.addMethod(
  20363. $core.method({
  20364. selector: "new",
  20365. protocol: 'instance creation',
  20366. fn: function (){
  20367. var self=this;
  20368. return $core.withContext(function($ctx1) {
  20369. self._shouldNotImplement();
  20370. return self;
  20371. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  20372. },
  20373. args: [],
  20374. source: "new\x0a\x09self shouldNotImplement",
  20375. referencedClasses: [],
  20376. messageSends: ["shouldNotImplement"]
  20377. }),
  20378. $globals.SmalltalkImage.klass);
  20379. $core.addMethod(
  20380. $core.method({
  20381. selector: "importsString",
  20382. protocol: '*Kernel-Infrastructure',
  20383. fn: function (){
  20384. var self=this;
  20385. return $core.withContext(function($ctx1) {
  20386. var $3,$2,$1;
  20387. $3=$recv(self._key())._importsString();
  20388. $ctx1.sendIdx["importsString"]=1;
  20389. $2=$recv($3).__comma(" -> ");
  20390. $1=$recv($2).__comma($recv(self._value())._importsString());
  20391. $ctx1.sendIdx[","]=1;
  20392. return $1;
  20393. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.Association)});
  20394. },
  20395. args: [],
  20396. 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",
  20397. referencedClasses: [],
  20398. messageSends: [",", "importsString", "key", "value"]
  20399. }),
  20400. $globals.Association);
  20401. $core.addMethod(
  20402. $core.method({
  20403. selector: "asJavaScriptPropertyName",
  20404. protocol: '*Kernel-Infrastructure',
  20405. fn: function (){
  20406. var self=this;
  20407. return $core.withContext(function($ctx1) {
  20408. return $core.st2prop(self);
  20409. return self;
  20410. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  20411. },
  20412. args: [],
  20413. source: "asJavaScriptPropertyName\x0a<return $core.st2prop(self)>",
  20414. referencedClasses: [],
  20415. messageSends: []
  20416. }),
  20417. $globals.String);
  20418. $core.addMethod(
  20419. $core.method({
  20420. selector: "asSetting",
  20421. protocol: '*Kernel-Infrastructure',
  20422. fn: function (){
  20423. var self=this;
  20424. return $core.withContext(function($ctx1) {
  20425. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  20426. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  20427. },
  20428. args: [],
  20429. 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",
  20430. referencedClasses: ["Setting"],
  20431. messageSends: ["at:ifAbsent:"]
  20432. }),
  20433. $globals.String);
  20434. $core.addMethod(
  20435. $core.method({
  20436. selector: "asSettingIfAbsent:",
  20437. protocol: '*Kernel-Infrastructure',
  20438. fn: function (aDefaultValue){
  20439. var self=this;
  20440. return $core.withContext(function($ctx1) {
  20441. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  20442. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20443. },
  20444. args: ["aDefaultValue"],
  20445. 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",
  20446. referencedClasses: ["Setting"],
  20447. messageSends: ["at:ifAbsent:"]
  20448. }),
  20449. $globals.String);
  20450. $core.addMethod(
  20451. $core.method({
  20452. selector: "importsString",
  20453. protocol: '*Kernel-Infrastructure',
  20454. fn: function (){
  20455. var self=this;
  20456. return $core.withContext(function($ctx1) {
  20457. var $1;
  20458. $1=$recv("'".__comma(self._replace_with_("'","''"))).__comma("'");
  20459. $ctx1.sendIdx[","]=1;
  20460. return $1;
  20461. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.String)});
  20462. },
  20463. args: [],
  20464. source: "importsString\x0a\x09\x22Answer receiver as Smalltalk expression\x22\x0a\x09^ '''', (self replace: '''' with: ''''''), ''''",
  20465. referencedClasses: [],
  20466. messageSends: [",", "replace:with:"]
  20467. }),
  20468. $globals.String);
  20469. $core.addMethod(
  20470. $core.method({
  20471. selector: "settingValue",
  20472. protocol: '*Kernel-Infrastructure',
  20473. fn: function (){
  20474. var self=this;
  20475. return $core.withContext(function($ctx1) {
  20476. return $recv(self._asSetting())._value();
  20477. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  20478. },
  20479. args: [],
  20480. source: "settingValue\x0a\x09^ self asSetting value",
  20481. referencedClasses: [],
  20482. messageSends: ["value", "asSetting"]
  20483. }),
  20484. $globals.String);
  20485. $core.addMethod(
  20486. $core.method({
  20487. selector: "settingValue:",
  20488. protocol: '*Kernel-Infrastructure',
  20489. fn: function (aValue){
  20490. var self=this;
  20491. return $core.withContext(function($ctx1) {
  20492. return $recv(self._asSetting())._value_(aValue);
  20493. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  20494. },
  20495. args: ["aValue"],
  20496. 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",
  20497. referencedClasses: [],
  20498. messageSends: ["value:", "asSetting"]
  20499. }),
  20500. $globals.String);
  20501. $core.addMethod(
  20502. $core.method({
  20503. selector: "settingValueIfAbsent:",
  20504. protocol: '*Kernel-Infrastructure',
  20505. fn: function (aDefaultValue){
  20506. var self=this;
  20507. return $core.withContext(function($ctx1) {
  20508. return $recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  20509. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20510. },
  20511. args: ["aDefaultValue"],
  20512. 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",
  20513. referencedClasses: [],
  20514. messageSends: ["value", "asSettingIfAbsent:"]
  20515. }),
  20516. $globals.String);
  20517. });
  20518. define("amber_core/Kernel-Promises", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Infrastructure"], function($boot){"use strict";
  20519. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  20520. $core.addPackage('Kernel-Promises');
  20521. $core.packages["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  20522. $core.packages["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20523. $core.addClass('Thenable', $globals.Object, [], 'Kernel-Promises');
  20524. $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.";
  20525. $core.addMethod(
  20526. $core.method({
  20527. selector: "catch:",
  20528. protocol: 'promises',
  20529. fn: function (aBlock){
  20530. var self=this;
  20531. return $core.withContext(function($ctx1) {
  20532. return self.then(null, function (err) {return $core.seamless(function () {
  20533. return aBlock._value_(err);
  20534. })});
  20535. return self;
  20536. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.Thenable)});
  20537. },
  20538. args: ["aBlock"],
  20539. source: "catch: aBlock\x0a<return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})>",
  20540. referencedClasses: [],
  20541. messageSends: []
  20542. }),
  20543. $globals.Thenable);
  20544. $core.addMethod(
  20545. $core.method({
  20546. selector: "on:do:",
  20547. protocol: 'promises',
  20548. fn: function (aClass,aBlock){
  20549. var self=this;
  20550. return $core.withContext(function($ctx1) {
  20551. return self.then(null, function (err) {return $core.seamless(function () {
  20552. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  20553. else throw err;
  20554. })});
  20555. return self;
  20556. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Thenable)});
  20557. },
  20558. args: ["aClass", "aBlock"],
  20559. source: "on: aClass do: aBlock\x0a<return self.then(null, function (err) {return $core.seamless(function () {\x0a if (err._isKindOf_(aClass)) return aBlock._value_(err);\x0a else throw err;\x0a})})>",
  20560. referencedClasses: [],
  20561. messageSends: []
  20562. }),
  20563. $globals.Thenable);
  20564. $core.addMethod(
  20565. $core.method({
  20566. selector: "on:do:catch:",
  20567. protocol: 'promises',
  20568. fn: function (aClass,aBlock,anotherBlock){
  20569. var self=this;
  20570. return $core.withContext(function($ctx1) {
  20571. return self.then(null, function (err) {return $core.seamless(function () {
  20572. try { if (err._isKindOf_(aClass)) return aBlock._value_(err); } catch (e) { err = e; }
  20573. return anotherBlock._value_(err);
  20574. })});
  20575. return self;
  20576. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Thenable)});
  20577. },
  20578. args: ["aClass", "aBlock", "anotherBlock"],
  20579. source: "on: aClass do: aBlock catch: anotherBlock\x0a<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})})>",
  20580. referencedClasses: [],
  20581. messageSends: []
  20582. }),
  20583. $globals.Thenable);
  20584. $core.addMethod(
  20585. $core.method({
  20586. selector: "then:",
  20587. protocol: 'promises',
  20588. fn: function (aBlockOrArray){
  20589. var self=this;
  20590. return $core.withContext(function($ctx1) {
  20591. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  20592. return array.reduce(function (soFar, aBlock) {
  20593. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  20594. function (result) {return $core.seamless(function () {
  20595. if (Array.isArray(result)) {
  20596. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  20597. } else {
  20598. return aBlock._value_(result);
  20599. }
  20600. })} :
  20601. function (result) {return $core.seamless(function () {
  20602. return aBlock._value_(result);
  20603. })}
  20604. );
  20605. }, self);
  20606. return self;
  20607. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.Thenable)});
  20608. },
  20609. args: ["aBlockOrArray"],
  20610. 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<\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)>",
  20611. referencedClasses: [],
  20612. messageSends: []
  20613. }),
  20614. $globals.Thenable);
  20615. $core.addMethod(
  20616. $core.method({
  20617. selector: "then:catch:",
  20618. protocol: 'promises',
  20619. fn: function (aBlockOrArray,anotherBlock){
  20620. var self=this;
  20621. return $core.withContext(function($ctx1) {
  20622. return $recv(self._then_(aBlockOrArray))._catch_(anotherBlock);
  20623. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.Thenable)});
  20624. },
  20625. args: ["aBlockOrArray", "anotherBlock"],
  20626. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  20627. referencedClasses: [],
  20628. messageSends: ["catch:", "then:"]
  20629. }),
  20630. $globals.Thenable);
  20631. $core.addMethod(
  20632. $core.method({
  20633. selector: "then:on:do:",
  20634. protocol: 'promises',
  20635. fn: function (aBlockOrArray,aClass,aBlock){
  20636. var self=this;
  20637. return $core.withContext(function($ctx1) {
  20638. return $recv(self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  20639. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.Thenable)});
  20640. },
  20641. args: ["aBlockOrArray", "aClass", "aBlock"],
  20642. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  20643. referencedClasses: [],
  20644. messageSends: ["on:do:", "then:"]
  20645. }),
  20646. $globals.Thenable);
  20647. $core.addMethod(
  20648. $core.method({
  20649. selector: "then:on:do:catch:",
  20650. protocol: 'promises',
  20651. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  20652. var self=this;
  20653. return $core.withContext(function($ctx1) {
  20654. return $recv($recv(self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  20655. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Thenable)});
  20656. },
  20657. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  20658. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  20659. referencedClasses: [],
  20660. messageSends: ["catch:", "on:do:", "then:"]
  20661. }),
  20662. $globals.Thenable);
  20663. $core.addClass('Promise', $globals.Thenable, [], 'Kernel-Promises');
  20664. $core.addMethod(
  20665. $core.method({
  20666. selector: "all:",
  20667. protocol: 'composites',
  20668. fn: function (aCollection){
  20669. var self=this;
  20670. return $core.withContext(function($ctx1) {
  20671. return Promise.all($recv(aCollection)._asArray());
  20672. return self;
  20673. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.klass)});
  20674. },
  20675. args: ["aCollection"],
  20676. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<return Promise.all($recv(aCollection)._asArray())>",
  20677. referencedClasses: [],
  20678. messageSends: []
  20679. }),
  20680. $globals.Promise.klass);
  20681. $core.addMethod(
  20682. $core.method({
  20683. selector: "any:",
  20684. protocol: 'composites',
  20685. fn: function (aCollection){
  20686. var self=this;
  20687. return $core.withContext(function($ctx1) {
  20688. return Promise.race($recv(aCollection)._asArray());
  20689. return self;
  20690. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.klass)});
  20691. },
  20692. args: ["aCollection"],
  20693. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<return Promise.race($recv(aCollection)._asArray())>",
  20694. referencedClasses: [],
  20695. messageSends: []
  20696. }),
  20697. $globals.Promise.klass);
  20698. $core.addMethod(
  20699. $core.method({
  20700. selector: "forBlock:",
  20701. protocol: 'instance creation',
  20702. fn: function (aBlock){
  20703. var self=this;
  20704. return $core.withContext(function($ctx1) {
  20705. return $recv(self._new())._then_(aBlock);
  20706. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.klass)});
  20707. },
  20708. args: ["aBlock"],
  20709. 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",
  20710. referencedClasses: [],
  20711. messageSends: ["then:", "new"]
  20712. }),
  20713. $globals.Promise.klass);
  20714. $core.addMethod(
  20715. $core.method({
  20716. selector: "new",
  20717. protocol: 'instance creation',
  20718. fn: function (){
  20719. var self=this;
  20720. return $core.withContext(function($ctx1) {
  20721. return Promise.resolve();
  20722. return self;
  20723. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.klass)});
  20724. },
  20725. args: [],
  20726. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<return Promise.resolve()>",
  20727. referencedClasses: [],
  20728. messageSends: []
  20729. }),
  20730. $globals.Promise.klass);
  20731. $core.addMethod(
  20732. $core.method({
  20733. selector: "new:",
  20734. protocol: 'instance creation',
  20735. fn: function (aBlock){
  20736. var self=this;
  20737. return $core.withContext(function($ctx1) {
  20738. return new Promise(function (resolve, reject) {
  20739. var model = {value: resolve, signal: reject}; // TODO make faster
  20740. aBlock._value_(model);
  20741. });
  20742. return self;
  20743. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.klass)});
  20744. },
  20745. args: ["aBlock"],
  20746. 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<return new Promise(function (resolve, reject) {\x0a var model = {value: resolve, signal: reject}; // TODO make faster\x0a aBlock._value_(model);\x0a})>",
  20747. referencedClasses: [],
  20748. messageSends: []
  20749. }),
  20750. $globals.Promise.klass);
  20751. $core.addMethod(
  20752. $core.method({
  20753. selector: "signal:",
  20754. protocol: 'instance creation',
  20755. fn: function (anObject){
  20756. var self=this;
  20757. return $core.withContext(function($ctx1) {
  20758. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  20759. return self;
  20760. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.klass)});
  20761. },
  20762. args: ["anObject"],
  20763. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<return $recv(anObject)._in_(function (x) {return Promise.reject(x)})>",
  20764. referencedClasses: [],
  20765. messageSends: []
  20766. }),
  20767. $globals.Promise.klass);
  20768. $core.addMethod(
  20769. $core.method({
  20770. selector: "value:",
  20771. protocol: 'instance creation',
  20772. fn: function (anObject){
  20773. var self=this;
  20774. return $core.withContext(function($ctx1) {
  20775. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  20776. return self;
  20777. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.klass)});
  20778. },
  20779. args: ["anObject"],
  20780. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})>",
  20781. referencedClasses: [],
  20782. messageSends: []
  20783. }),
  20784. $globals.Promise.klass);
  20785. $core.addMethod(
  20786. $core.method({
  20787. selector: "catch:",
  20788. protocol: '*Kernel-Promises',
  20789. fn: function (aBlock){
  20790. var self=this;
  20791. return $core.withContext(function($ctx1) {
  20792. var js = self["@jsObject"];
  20793. if (typeof js.then === "function")
  20794. return $globals.Thenable.fn.prototype._catch_.call(js, aBlock);
  20795. else
  20796. return self._doesNotUnderstand_(
  20797. $globals.Message._new()
  20798. ._selector_("catch:")
  20799. ._arguments_([aBlock])
  20800. );
  20801. return self;
  20802. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  20803. },
  20804. args: ["aBlock"],
  20805. source: "catch: aBlock\x0a<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 )>",
  20806. referencedClasses: [],
  20807. messageSends: []
  20808. }),
  20809. $globals.JSObjectProxy);
  20810. $core.addMethod(
  20811. $core.method({
  20812. selector: "on:do:",
  20813. protocol: '*Kernel-Promises',
  20814. fn: function (aClass,aBlock){
  20815. var self=this;
  20816. return $core.withContext(function($ctx1) {
  20817. var js = self["@jsObject"];
  20818. if (typeof js.then === "function")
  20819. return $globals.Thenable.fn.prototype._on_do_.call(js, aClass, aBlock);
  20820. else
  20821. return self._doesNotUnderstand_(
  20822. $globals.Message._new()
  20823. ._selector_("on:do:")
  20824. ._arguments_([aClass, aBlock])
  20825. );
  20826. return self;
  20827. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  20828. },
  20829. args: ["aClass", "aBlock"],
  20830. source: "on: aClass do: aBlock\x0a<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 )>",
  20831. referencedClasses: [],
  20832. messageSends: []
  20833. }),
  20834. $globals.JSObjectProxy);
  20835. $core.addMethod(
  20836. $core.method({
  20837. selector: "on:do:catch:",
  20838. protocol: '*Kernel-Promises',
  20839. fn: function (aClass,aBlock,anotherBlock){
  20840. var self=this;
  20841. return $core.withContext(function($ctx1) {
  20842. var js = self["@jsObject"];
  20843. if (typeof js.then === "function")
  20844. return $globals.Thenable.fn.prototype._on_do_catch_.call(js, aClass, aBlock, anotherBlock);
  20845. else
  20846. return self._doesNotUnderstand_(
  20847. $globals.Message._new()
  20848. ._selector_("on:do:catch:")
  20849. ._arguments_([aClass, aBlock, anotherBlock])
  20850. );
  20851. return self;
  20852. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  20853. },
  20854. args: ["aClass", "aBlock", "anotherBlock"],
  20855. source: "on: aClass do: aBlock catch: anotherBlock\x0a<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 )>",
  20856. referencedClasses: [],
  20857. messageSends: []
  20858. }),
  20859. $globals.JSObjectProxy);
  20860. $core.addMethod(
  20861. $core.method({
  20862. selector: "then:",
  20863. protocol: '*Kernel-Promises',
  20864. fn: function (aBlockOrArray){
  20865. var self=this;
  20866. return $core.withContext(function($ctx1) {
  20867. var js = self["@jsObject"];
  20868. if (typeof js.then === "function")
  20869. return $globals.Thenable.fn.prototype._then_.call(js, aBlockOrArray);
  20870. else
  20871. return self._doesNotUnderstand_(
  20872. $globals.Message._new()
  20873. ._selector_("then:")
  20874. ._arguments_([aBlockOrArray])
  20875. );
  20876. return self;
  20877. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  20878. },
  20879. args: ["aBlockOrArray"],
  20880. source: "then: aBlockOrArray\x0a<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 )>",
  20881. referencedClasses: [],
  20882. messageSends: []
  20883. }),
  20884. $globals.JSObjectProxy);
  20885. $core.addMethod(
  20886. $core.method({
  20887. selector: "then:catch:",
  20888. protocol: '*Kernel-Promises',
  20889. fn: function (aBlockOrArray,anotherBlock){
  20890. var self=this;
  20891. return $core.withContext(function($ctx1) {
  20892. var js = self["@jsObject"];
  20893. if (typeof js.then === "function")
  20894. return $globals.Thenable.fn.prototype._then_catch_.call(js, aBlockOrArray, anotherBlock);
  20895. else
  20896. return self._doesNotUnderstand_(
  20897. $globals.Message._new()
  20898. ._selector_("then:catch:")
  20899. ._arguments_([aBlockOrArray, anotherBlock])
  20900. );
  20901. return self;
  20902. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  20903. },
  20904. args: ["aBlockOrArray", "anotherBlock"],
  20905. source: "then: aBlockOrArray catch: anotherBlock\x0a<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 )>",
  20906. referencedClasses: [],
  20907. messageSends: []
  20908. }),
  20909. $globals.JSObjectProxy);
  20910. $core.addMethod(
  20911. $core.method({
  20912. selector: "then:on:do:",
  20913. protocol: '*Kernel-Promises',
  20914. fn: function (aBlockOrArray,aClass,aBlock){
  20915. var self=this;
  20916. return $core.withContext(function($ctx1) {
  20917. var js = self["@jsObject"];
  20918. if (typeof js.then === "function")
  20919. return $globals.Thenable.fn.prototype._then_on_do_.call(js, aBlockOrArray, aClass, aBlock);
  20920. else
  20921. return self._doesNotUnderstand_(
  20922. $globals.Message._new()
  20923. ._selector_("then:on:do:")
  20924. ._arguments_([aBlockOrArray, aClass, aBlock])
  20925. );
  20926. return self;
  20927. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  20928. },
  20929. args: ["aBlockOrArray", "aClass", "aBlock"],
  20930. source: "then: aBlockOrArray on: aClass do: aBlock\x0a<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 )>",
  20931. referencedClasses: [],
  20932. messageSends: []
  20933. }),
  20934. $globals.JSObjectProxy);
  20935. $core.addMethod(
  20936. $core.method({
  20937. selector: "then:on:do:catch:",
  20938. protocol: '*Kernel-Promises',
  20939. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  20940. var self=this;
  20941. return $core.withContext(function($ctx1) {
  20942. var js = self["@jsObject"];
  20943. if (typeof js.then === "function")
  20944. return $globals.Thenable.fn.prototype._then_on_do_catch_.call(js, aBlockOrArray, aClass, aBlock, anotherBlock);
  20945. else
  20946. return self._doesNotUnderstand_(
  20947. $globals.Message._new()
  20948. ._selector_("then:on:do:catch:")
  20949. ._arguments_([aBlockOrArray, aClass, aBlock, anotherBlock])
  20950. );
  20951. return self;
  20952. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  20953. },
  20954. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  20955. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a<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 )>",
  20956. referencedClasses: [],
  20957. messageSends: []
  20958. }),
  20959. $globals.JSObjectProxy);
  20960. });
  20961. define("amber_core/Kernel-Announcements", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20962. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  20963. $core.addPackage('Kernel-Announcements');
  20964. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  20965. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20966. $core.addClass('AnnouncementSubscription', $globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  20967. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  20968. $core.addMethod(
  20969. $core.method({
  20970. selector: "announcementClass",
  20971. protocol: 'accessing',
  20972. fn: function (){
  20973. var self=this;
  20974. return self["@announcementClass"];
  20975. },
  20976. args: [],
  20977. source: "announcementClass\x0a\x09^ announcementClass",
  20978. referencedClasses: [],
  20979. messageSends: []
  20980. }),
  20981. $globals.AnnouncementSubscription);
  20982. $core.addMethod(
  20983. $core.method({
  20984. selector: "announcementClass:",
  20985. protocol: 'accessing',
  20986. fn: function (aClass){
  20987. var self=this;
  20988. self["@announcementClass"]=aClass;
  20989. return self;
  20990. },
  20991. args: ["aClass"],
  20992. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  20993. referencedClasses: [],
  20994. messageSends: []
  20995. }),
  20996. $globals.AnnouncementSubscription);
  20997. $core.addMethod(
  20998. $core.method({
  20999. selector: "deliver:",
  21000. protocol: 'announcing',
  21001. fn: function (anAnnouncement){
  21002. var self=this;
  21003. return $core.withContext(function($ctx1) {
  21004. var $1;
  21005. $1=self._handlesAnnouncement_(anAnnouncement);
  21006. if($core.assert($1)){
  21007. $recv(self._valuable())._value_(anAnnouncement);
  21008. };
  21009. return self;
  21010. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  21011. },
  21012. args: ["anAnnouncement"],
  21013. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  21014. referencedClasses: [],
  21015. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  21016. }),
  21017. $globals.AnnouncementSubscription);
  21018. $core.addMethod(
  21019. $core.method({
  21020. selector: "handlesAnnouncement:",
  21021. protocol: 'announcing',
  21022. fn: function (anAnnouncement){
  21023. var self=this;
  21024. return $core.withContext(function($ctx1) {
  21025. var $2,$3,$1,$receiver;
  21026. $2=$recv($globals.Smalltalk)._globals();
  21027. $ctx1.sendIdx["globals"]=1;
  21028. $3=$recv(self._announcementClass())._name();
  21029. $ctx1.sendIdx["name"]=1;
  21030. $1=$recv($2)._at_($3);
  21031. $ctx1.sendIdx["at:"]=1;
  21032. if(($receiver = $1) == null || $receiver.isNil){
  21033. return false;
  21034. } else {
  21035. var class_;
  21036. class_=$receiver;
  21037. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  21038. };
  21039. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  21040. },
  21041. args: ["anAnnouncement"],
  21042. 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 ]",
  21043. referencedClasses: ["Smalltalk"],
  21044. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  21045. }),
  21046. $globals.AnnouncementSubscription);
  21047. $core.addMethod(
  21048. $core.method({
  21049. selector: "receiver",
  21050. protocol: 'accessing',
  21051. fn: function (){
  21052. var self=this;
  21053. return $core.withContext(function($ctx1) {
  21054. return $recv(self._valuable())._receiver();
  21055. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  21056. },
  21057. args: [],
  21058. source: "receiver\x0a\x09^ self valuable receiver",
  21059. referencedClasses: [],
  21060. messageSends: ["receiver", "valuable"]
  21061. }),
  21062. $globals.AnnouncementSubscription);
  21063. $core.addMethod(
  21064. $core.method({
  21065. selector: "valuable",
  21066. protocol: 'accessing',
  21067. fn: function (){
  21068. var self=this;
  21069. return self["@valuable"];
  21070. },
  21071. args: [],
  21072. source: "valuable\x0a\x09^ valuable",
  21073. referencedClasses: [],
  21074. messageSends: []
  21075. }),
  21076. $globals.AnnouncementSubscription);
  21077. $core.addMethod(
  21078. $core.method({
  21079. selector: "valuable:",
  21080. protocol: 'accessing',
  21081. fn: function (aValuable){
  21082. var self=this;
  21083. self["@valuable"]=aValuable;
  21084. return self;
  21085. },
  21086. args: ["aValuable"],
  21087. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  21088. referencedClasses: [],
  21089. messageSends: []
  21090. }),
  21091. $globals.AnnouncementSubscription);
  21092. $core.addClass('AnnouncementValuable', $globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
  21093. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  21094. $core.addMethod(
  21095. $core.method({
  21096. selector: "receiver",
  21097. protocol: 'accessing',
  21098. fn: function (){
  21099. var self=this;
  21100. return self["@receiver"];
  21101. },
  21102. args: [],
  21103. source: "receiver\x0a\x09^ receiver",
  21104. referencedClasses: [],
  21105. messageSends: []
  21106. }),
  21107. $globals.AnnouncementValuable);
  21108. $core.addMethod(
  21109. $core.method({
  21110. selector: "receiver:",
  21111. protocol: 'accessing',
  21112. fn: function (anObject){
  21113. var self=this;
  21114. self["@receiver"]=anObject;
  21115. return self;
  21116. },
  21117. args: ["anObject"],
  21118. source: "receiver: anObject\x0a\x09receiver := anObject",
  21119. referencedClasses: [],
  21120. messageSends: []
  21121. }),
  21122. $globals.AnnouncementValuable);
  21123. $core.addMethod(
  21124. $core.method({
  21125. selector: "valuable",
  21126. protocol: 'accessing',
  21127. fn: function (){
  21128. var self=this;
  21129. return self["@valuable"];
  21130. },
  21131. args: [],
  21132. source: "valuable\x0a\x09^ valuable",
  21133. referencedClasses: [],
  21134. messageSends: []
  21135. }),
  21136. $globals.AnnouncementValuable);
  21137. $core.addMethod(
  21138. $core.method({
  21139. selector: "valuable:",
  21140. protocol: 'accessing',
  21141. fn: function (anObject){
  21142. var self=this;
  21143. self["@valuable"]=anObject;
  21144. return self;
  21145. },
  21146. args: ["anObject"],
  21147. source: "valuable: anObject\x0a\x09valuable := anObject",
  21148. referencedClasses: [],
  21149. messageSends: []
  21150. }),
  21151. $globals.AnnouncementValuable);
  21152. $core.addMethod(
  21153. $core.method({
  21154. selector: "value",
  21155. protocol: 'evaluating',
  21156. fn: function (){
  21157. var self=this;
  21158. return $core.withContext(function($ctx1) {
  21159. return $recv(self._valuable())._value();
  21160. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  21161. },
  21162. args: [],
  21163. source: "value\x0a\x09^ self valuable value",
  21164. referencedClasses: [],
  21165. messageSends: ["value", "valuable"]
  21166. }),
  21167. $globals.AnnouncementValuable);
  21168. $core.addMethod(
  21169. $core.method({
  21170. selector: "value:",
  21171. protocol: 'evaluating',
  21172. fn: function (anObject){
  21173. var self=this;
  21174. return $core.withContext(function($ctx1) {
  21175. return $recv(self._valuable())._value_(anObject);
  21176. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  21177. },
  21178. args: ["anObject"],
  21179. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  21180. referencedClasses: [],
  21181. messageSends: ["value:", "valuable"]
  21182. }),
  21183. $globals.AnnouncementValuable);
  21184. $core.addClass('Announcer', $globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  21185. $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' ].";
  21186. $core.addMethod(
  21187. $core.method({
  21188. selector: "announce:",
  21189. protocol: 'announcing',
  21190. fn: function (anAnnouncement){
  21191. var self=this;
  21192. return $core.withContext(function($ctx1) {
  21193. $recv(self["@subscriptions"])._do_((function(each){
  21194. return $core.withContext(function($ctx2) {
  21195. return $recv(each)._deliver_(anAnnouncement);
  21196. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21197. }));
  21198. return self;
  21199. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  21200. },
  21201. args: ["anAnnouncement"],
  21202. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  21203. referencedClasses: [],
  21204. messageSends: ["do:", "deliver:"]
  21205. }),
  21206. $globals.Announcer);
  21207. $core.addMethod(
  21208. $core.method({
  21209. selector: "initialize",
  21210. protocol: 'initialization',
  21211. fn: function (){
  21212. var self=this;
  21213. return $core.withContext(function($ctx1) {
  21214. (
  21215. $ctx1.supercall = true,
  21216. ($globals.Announcer.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  21217. $ctx1.supercall = false;
  21218. self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  21219. return self;
  21220. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  21221. },
  21222. args: [],
  21223. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  21224. referencedClasses: ["OrderedCollection"],
  21225. messageSends: ["initialize", "new"]
  21226. }),
  21227. $globals.Announcer);
  21228. $core.addMethod(
  21229. $core.method({
  21230. selector: "on:do:",
  21231. protocol: 'subscribing',
  21232. fn: function (aClass,aBlock){
  21233. var self=this;
  21234. return $core.withContext(function($ctx1) {
  21235. self._on_do_for_(aClass,aBlock,nil);
  21236. return self;
  21237. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  21238. },
  21239. args: ["aClass", "aBlock"],
  21240. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  21241. referencedClasses: [],
  21242. messageSends: ["on:do:for:"]
  21243. }),
  21244. $globals.Announcer);
  21245. $core.addMethod(
  21246. $core.method({
  21247. selector: "on:do:for:",
  21248. protocol: 'subscribing',
  21249. fn: function (aClass,aBlock,aReceiver){
  21250. var self=this;
  21251. return $core.withContext(function($ctx1) {
  21252. var $1,$3,$5,$6,$4,$2;
  21253. $1=self["@subscriptions"];
  21254. $3=$recv($globals.AnnouncementSubscription)._new();
  21255. $ctx1.sendIdx["new"]=1;
  21256. $5=$recv($globals.AnnouncementValuable)._new();
  21257. $recv($5)._valuable_(aBlock);
  21258. $recv($5)._receiver_(aReceiver);
  21259. $6=$recv($5)._yourself();
  21260. $ctx1.sendIdx["yourself"]=1;
  21261. $4=$6;
  21262. $recv($3)._valuable_($4);
  21263. $ctx1.sendIdx["valuable:"]=1;
  21264. $recv($3)._announcementClass_(aClass);
  21265. $2=$recv($3)._yourself();
  21266. $recv($1)._add_($2);
  21267. return self;
  21268. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  21269. },
  21270. args: ["aClass", "aBlock", "aReceiver"],
  21271. 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)",
  21272. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  21273. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  21274. }),
  21275. $globals.Announcer);
  21276. $core.addMethod(
  21277. $core.method({
  21278. selector: "on:doOnce:",
  21279. protocol: 'subscribing',
  21280. fn: function (aClass,aBlock){
  21281. var self=this;
  21282. var subscription;
  21283. return $core.withContext(function($ctx1) {
  21284. var $1;
  21285. $1=$recv($globals.AnnouncementSubscription)._new();
  21286. $recv($1)._announcementClass_(aClass);
  21287. subscription=$recv($1)._yourself();
  21288. $recv(subscription)._valuable_((function(ann){
  21289. return $core.withContext(function($ctx2) {
  21290. $recv(self["@subscriptions"])._remove_(subscription);
  21291. return $recv(aBlock)._value_(ann);
  21292. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  21293. }));
  21294. $recv(self["@subscriptions"])._add_(subscription);
  21295. return self;
  21296. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  21297. },
  21298. args: ["aClass", "aBlock"],
  21299. 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",
  21300. referencedClasses: ["AnnouncementSubscription"],
  21301. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  21302. }),
  21303. $globals.Announcer);
  21304. $core.addMethod(
  21305. $core.method({
  21306. selector: "on:send:to:",
  21307. protocol: 'subscribing',
  21308. fn: function (aClass,aSelector,anObject){
  21309. var self=this;
  21310. return $core.withContext(function($ctx1) {
  21311. var $1,$3,$5,$6,$4,$2;
  21312. $1=self["@subscriptions"];
  21313. $3=$recv($globals.AnnouncementSubscription)._new();
  21314. $ctx1.sendIdx["new"]=1;
  21315. $5=$recv($globals.MessageSend)._new();
  21316. $recv($5)._receiver_(anObject);
  21317. $recv($5)._selector_(aSelector);
  21318. $6=$recv($5)._yourself();
  21319. $ctx1.sendIdx["yourself"]=1;
  21320. $4=$6;
  21321. $recv($3)._valuable_($4);
  21322. $recv($3)._announcementClass_(aClass);
  21323. $2=$recv($3)._yourself();
  21324. $recv($1)._add_($2);
  21325. return self;
  21326. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  21327. },
  21328. args: ["aClass", "aSelector", "anObject"],
  21329. 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)",
  21330. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  21331. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  21332. }),
  21333. $globals.Announcer);
  21334. $core.addMethod(
  21335. $core.method({
  21336. selector: "unsubscribe:",
  21337. protocol: 'subscribing',
  21338. fn: function (anObject){
  21339. var self=this;
  21340. return $core.withContext(function($ctx1) {
  21341. self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){
  21342. return $core.withContext(function($ctx2) {
  21343. return $recv($recv(each)._receiver()).__eq(anObject);
  21344. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21345. }));
  21346. return self;
  21347. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  21348. },
  21349. args: ["anObject"],
  21350. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  21351. referencedClasses: [],
  21352. messageSends: ["reject:", "=", "receiver"]
  21353. }),
  21354. $globals.Announcer);
  21355. $core.addClass('SystemAnnouncer', $globals.Announcer, [], 'Kernel-Announcements');
  21356. $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`";
  21357. $globals.SystemAnnouncer.klass.iVarNames = ['current'];
  21358. $core.addMethod(
  21359. $core.method({
  21360. selector: "current",
  21361. protocol: 'accessing',
  21362. fn: function (){
  21363. var self=this;
  21364. return $core.withContext(function($ctx1) {
  21365. var $1,$receiver;
  21366. $1=self["@current"];
  21367. if(($receiver = $1) == null || $receiver.isNil){
  21368. self["@current"]=(
  21369. $ctx1.supercall = true,
  21370. ($globals.SystemAnnouncer.klass.superclass||$boot.dnu).fn.prototype._new.apply($recv(self), []));
  21371. $ctx1.supercall = false;
  21372. return self["@current"];
  21373. } else {
  21374. return $1;
  21375. };
  21376. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)});
  21377. },
  21378. args: [],
  21379. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  21380. referencedClasses: [],
  21381. messageSends: ["ifNil:", "new"]
  21382. }),
  21383. $globals.SystemAnnouncer.klass);
  21384. $core.addMethod(
  21385. $core.method({
  21386. selector: "new",
  21387. protocol: 'instance creation',
  21388. fn: function (){
  21389. var self=this;
  21390. return $core.withContext(function($ctx1) {
  21391. self._shouldNotImplement();
  21392. return self;
  21393. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)});
  21394. },
  21395. args: [],
  21396. source: "new\x0a\x09self shouldNotImplement",
  21397. referencedClasses: [],
  21398. messageSends: ["shouldNotImplement"]
  21399. }),
  21400. $globals.SystemAnnouncer.klass);
  21401. $core.addClass('SystemAnnouncement', $globals.Object, [], 'Kernel-Announcements');
  21402. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  21403. $core.addMethod(
  21404. $core.method({
  21405. selector: "classTag",
  21406. protocol: 'accessing',
  21407. fn: function (){
  21408. var self=this;
  21409. return "announcement";
  21410. },
  21411. args: [],
  21412. 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'",
  21413. referencedClasses: [],
  21414. messageSends: []
  21415. }),
  21416. $globals.SystemAnnouncement.klass);
  21417. $core.addClass('ClassAnnouncement', $globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  21418. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  21419. $core.addMethod(
  21420. $core.method({
  21421. selector: "theClass",
  21422. protocol: 'accessing',
  21423. fn: function (){
  21424. var self=this;
  21425. return self["@theClass"];
  21426. },
  21427. args: [],
  21428. source: "theClass\x0a\x09^ theClass",
  21429. referencedClasses: [],
  21430. messageSends: []
  21431. }),
  21432. $globals.ClassAnnouncement);
  21433. $core.addMethod(
  21434. $core.method({
  21435. selector: "theClass:",
  21436. protocol: 'accessing',
  21437. fn: function (aClass){
  21438. var self=this;
  21439. self["@theClass"]=aClass;
  21440. return self;
  21441. },
  21442. args: ["aClass"],
  21443. source: "theClass: aClass\x0a\x09theClass := aClass",
  21444. referencedClasses: [],
  21445. messageSends: []
  21446. }),
  21447. $globals.ClassAnnouncement);
  21448. $core.addClass('ClassAdded', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21449. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  21450. $core.addClass('ClassCommentChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21451. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  21452. $core.addClass('ClassDefinitionChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21453. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  21454. $core.addClass('ClassMigrated', $globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  21455. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  21456. $core.addMethod(
  21457. $core.method({
  21458. selector: "oldClass",
  21459. protocol: 'accessing',
  21460. fn: function (){
  21461. var self=this;
  21462. return self["@oldClass"];
  21463. },
  21464. args: [],
  21465. source: "oldClass\x0a\x09^ oldClass",
  21466. referencedClasses: [],
  21467. messageSends: []
  21468. }),
  21469. $globals.ClassMigrated);
  21470. $core.addMethod(
  21471. $core.method({
  21472. selector: "oldClass:",
  21473. protocol: 'accessing',
  21474. fn: function (aClass){
  21475. var self=this;
  21476. self["@oldClass"]=aClass;
  21477. return self;
  21478. },
  21479. args: ["aClass"],
  21480. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  21481. referencedClasses: [],
  21482. messageSends: []
  21483. }),
  21484. $globals.ClassMigrated);
  21485. $core.addClass('ClassMoved', $globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  21486. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  21487. $core.addMethod(
  21488. $core.method({
  21489. selector: "oldPackage",
  21490. protocol: 'accessing',
  21491. fn: function (){
  21492. var self=this;
  21493. return self["@oldPackage"];
  21494. },
  21495. args: [],
  21496. source: "oldPackage\x0a\x09^ oldPackage",
  21497. referencedClasses: [],
  21498. messageSends: []
  21499. }),
  21500. $globals.ClassMoved);
  21501. $core.addMethod(
  21502. $core.method({
  21503. selector: "oldPackage:",
  21504. protocol: 'accessing',
  21505. fn: function (aPackage){
  21506. var self=this;
  21507. self["@oldPackage"]=aPackage;
  21508. return self;
  21509. },
  21510. args: ["aPackage"],
  21511. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  21512. referencedClasses: [],
  21513. messageSends: []
  21514. }),
  21515. $globals.ClassMoved);
  21516. $core.addClass('ClassRemoved', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21517. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  21518. $core.addClass('ClassRenamed', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21519. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  21520. $core.addClass('MethodAnnouncement', $globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  21521. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  21522. $core.addMethod(
  21523. $core.method({
  21524. selector: "method",
  21525. protocol: 'accessing',
  21526. fn: function (){
  21527. var self=this;
  21528. return self["@method"];
  21529. },
  21530. args: [],
  21531. source: "method\x0a\x09^ method",
  21532. referencedClasses: [],
  21533. messageSends: []
  21534. }),
  21535. $globals.MethodAnnouncement);
  21536. $core.addMethod(
  21537. $core.method({
  21538. selector: "method:",
  21539. protocol: 'accessing',
  21540. fn: function (aCompiledMethod){
  21541. var self=this;
  21542. self["@method"]=aCompiledMethod;
  21543. return self;
  21544. },
  21545. args: ["aCompiledMethod"],
  21546. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  21547. referencedClasses: [],
  21548. messageSends: []
  21549. }),
  21550. $globals.MethodAnnouncement);
  21551. $core.addClass('MethodAdded', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21552. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  21553. $core.addClass('MethodModified', $globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  21554. $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.";
  21555. $core.addMethod(
  21556. $core.method({
  21557. selector: "oldMethod",
  21558. protocol: 'accessing',
  21559. fn: function (){
  21560. var self=this;
  21561. return self["@oldMethod"];
  21562. },
  21563. args: [],
  21564. source: "oldMethod\x0a\x09^ oldMethod",
  21565. referencedClasses: [],
  21566. messageSends: []
  21567. }),
  21568. $globals.MethodModified);
  21569. $core.addMethod(
  21570. $core.method({
  21571. selector: "oldMethod:",
  21572. protocol: 'accessing',
  21573. fn: function (aMethod){
  21574. var self=this;
  21575. self["@oldMethod"]=aMethod;
  21576. return self;
  21577. },
  21578. args: ["aMethod"],
  21579. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  21580. referencedClasses: [],
  21581. messageSends: []
  21582. }),
  21583. $globals.MethodModified);
  21584. $core.addClass('MethodMoved', $globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  21585. $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.";
  21586. $core.addMethod(
  21587. $core.method({
  21588. selector: "oldProtocol",
  21589. protocol: 'accessing',
  21590. fn: function (){
  21591. var self=this;
  21592. return self["@oldProtocol"];
  21593. },
  21594. args: [],
  21595. source: "oldProtocol\x0a\x09^ oldProtocol",
  21596. referencedClasses: [],
  21597. messageSends: []
  21598. }),
  21599. $globals.MethodMoved);
  21600. $core.addMethod(
  21601. $core.method({
  21602. selector: "oldProtocol:",
  21603. protocol: 'accessing',
  21604. fn: function (aString){
  21605. var self=this;
  21606. self["@oldProtocol"]=aString;
  21607. return self;
  21608. },
  21609. args: ["aString"],
  21610. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  21611. referencedClasses: [],
  21612. messageSends: []
  21613. }),
  21614. $globals.MethodMoved);
  21615. $core.addClass('MethodRemoved', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21616. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  21617. $core.addClass('PackageAnnouncement', $globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  21618. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  21619. $core.addMethod(
  21620. $core.method({
  21621. selector: "package",
  21622. protocol: 'accessing',
  21623. fn: function (){
  21624. var self=this;
  21625. return self["@package"];
  21626. },
  21627. args: [],
  21628. source: "package\x0a\x09^ package",
  21629. referencedClasses: [],
  21630. messageSends: []
  21631. }),
  21632. $globals.PackageAnnouncement);
  21633. $core.addMethod(
  21634. $core.method({
  21635. selector: "package:",
  21636. protocol: 'accessing',
  21637. fn: function (aPackage){
  21638. var self=this;
  21639. self["@package"]=aPackage;
  21640. return self;
  21641. },
  21642. args: ["aPackage"],
  21643. source: "package: aPackage\x0a\x09package := aPackage",
  21644. referencedClasses: [],
  21645. messageSends: []
  21646. }),
  21647. $globals.PackageAnnouncement);
  21648. $core.addClass('PackageAdded', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21649. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  21650. $core.addClass('PackageClean', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21651. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  21652. $core.addClass('PackageDirty', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21653. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  21654. $core.addClass('PackageRemoved', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21655. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  21656. $core.addClass('ProtocolAnnouncement', $globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  21657. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  21658. $core.addMethod(
  21659. $core.method({
  21660. selector: "package",
  21661. protocol: 'accessing',
  21662. fn: function (){
  21663. var self=this;
  21664. return $core.withContext(function($ctx1) {
  21665. var $1,$receiver;
  21666. $1=self._theClass();
  21667. if(($receiver = $1) == null || $receiver.isNil){
  21668. return $1;
  21669. } else {
  21670. var class_;
  21671. class_=$receiver;
  21672. return $recv(class_)._packageOfProtocol_(self._protocol());
  21673. };
  21674. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  21675. },
  21676. args: [],
  21677. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  21678. referencedClasses: [],
  21679. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  21680. }),
  21681. $globals.ProtocolAnnouncement);
  21682. $core.addMethod(
  21683. $core.method({
  21684. selector: "protocol",
  21685. protocol: 'accessing',
  21686. fn: function (){
  21687. var self=this;
  21688. return self["@protocol"];
  21689. },
  21690. args: [],
  21691. source: "protocol\x0a\x09^ protocol",
  21692. referencedClasses: [],
  21693. messageSends: []
  21694. }),
  21695. $globals.ProtocolAnnouncement);
  21696. $core.addMethod(
  21697. $core.method({
  21698. selector: "protocol:",
  21699. protocol: 'accessing',
  21700. fn: function (aString){
  21701. var self=this;
  21702. self["@protocol"]=aString;
  21703. return self;
  21704. },
  21705. args: ["aString"],
  21706. source: "protocol: aString\x0a\x09protocol := aString",
  21707. referencedClasses: [],
  21708. messageSends: []
  21709. }),
  21710. $globals.ProtocolAnnouncement);
  21711. $core.addMethod(
  21712. $core.method({
  21713. selector: "theClass",
  21714. protocol: 'accessing',
  21715. fn: function (){
  21716. var self=this;
  21717. return self["@theClass"];
  21718. },
  21719. args: [],
  21720. source: "theClass\x0a\x09^ theClass",
  21721. referencedClasses: [],
  21722. messageSends: []
  21723. }),
  21724. $globals.ProtocolAnnouncement);
  21725. $core.addMethod(
  21726. $core.method({
  21727. selector: "theClass:",
  21728. protocol: 'accessing',
  21729. fn: function (aClass){
  21730. var self=this;
  21731. self["@theClass"]=aClass;
  21732. return self;
  21733. },
  21734. args: ["aClass"],
  21735. source: "theClass: aClass\x0a\x09theClass := aClass",
  21736. referencedClasses: [],
  21737. messageSends: []
  21738. }),
  21739. $globals.ProtocolAnnouncement);
  21740. $core.addClass('ProtocolAdded', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21741. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  21742. $core.addClass('ProtocolRemoved', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21743. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  21744. });
  21745. define("amber_core/Platform-Services", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure"], function($boot){"use strict";
  21746. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  21747. $core.addPackage('Platform-Services');
  21748. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  21749. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21750. $core.addClass('ConsoleErrorHandler', $globals.Object, [], 'Platform-Services');
  21751. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  21752. $core.addMethod(
  21753. $core.method({
  21754. selector: "handleError:",
  21755. protocol: 'error handling',
  21756. fn: function (anError){
  21757. var self=this;
  21758. return $core.withContext(function($ctx1) {
  21759. var $1,$receiver;
  21760. $1=$recv(anError)._context();
  21761. $ctx1.sendIdx["context"]=1;
  21762. if(($receiver = $1) == null || $receiver.isNil){
  21763. $1;
  21764. } else {
  21765. self._logErrorContext_($recv(anError)._context());
  21766. };
  21767. self._logError_(anError);
  21768. return self;
  21769. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21770. },
  21771. args: ["anError"],
  21772. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  21773. referencedClasses: [],
  21774. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  21775. }),
  21776. $globals.ConsoleErrorHandler);
  21777. $core.addMethod(
  21778. $core.method({
  21779. selector: "log:",
  21780. protocol: 'private',
  21781. fn: function (aString){
  21782. var self=this;
  21783. return $core.withContext(function($ctx1) {
  21784. $recv(console)._log_(aString);
  21785. return self;
  21786. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  21787. },
  21788. args: ["aString"],
  21789. source: "log: aString\x0a\x09console log: aString",
  21790. referencedClasses: [],
  21791. messageSends: ["log:"]
  21792. }),
  21793. $globals.ConsoleErrorHandler);
  21794. $core.addMethod(
  21795. $core.method({
  21796. selector: "logContext:",
  21797. protocol: 'private',
  21798. fn: function (aContext){
  21799. var self=this;
  21800. return $core.withContext(function($ctx1) {
  21801. var $1,$receiver;
  21802. $1=$recv(aContext)._home();
  21803. $ctx1.sendIdx["home"]=1;
  21804. if(($receiver = $1) == null || $receiver.isNil){
  21805. $1;
  21806. } else {
  21807. self._logContext_($recv(aContext)._home());
  21808. };
  21809. self._log_($recv(aContext)._asString());
  21810. return self;
  21811. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21812. },
  21813. args: ["aContext"],
  21814. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  21815. referencedClasses: [],
  21816. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  21817. }),
  21818. $globals.ConsoleErrorHandler);
  21819. $core.addMethod(
  21820. $core.method({
  21821. selector: "logError:",
  21822. protocol: 'private',
  21823. fn: function (anError){
  21824. var self=this;
  21825. return $core.withContext(function($ctx1) {
  21826. self._log_($recv(anError)._messageText());
  21827. return self;
  21828. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21829. },
  21830. args: ["anError"],
  21831. source: "logError: anError\x0a\x09self log: anError messageText",
  21832. referencedClasses: [],
  21833. messageSends: ["log:", "messageText"]
  21834. }),
  21835. $globals.ConsoleErrorHandler);
  21836. $core.addMethod(
  21837. $core.method({
  21838. selector: "logErrorContext:",
  21839. protocol: 'private',
  21840. fn: function (aContext){
  21841. var self=this;
  21842. return $core.withContext(function($ctx1) {
  21843. var $1,$receiver;
  21844. if(($receiver = aContext) == null || $receiver.isNil){
  21845. aContext;
  21846. } else {
  21847. $1=$recv(aContext)._home();
  21848. $ctx1.sendIdx["home"]=1;
  21849. if(($receiver = $1) == null || $receiver.isNil){
  21850. $1;
  21851. } else {
  21852. self._logContext_($recv(aContext)._home());
  21853. };
  21854. };
  21855. return self;
  21856. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21857. },
  21858. args: ["aContext"],
  21859. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  21860. referencedClasses: [],
  21861. messageSends: ["ifNotNil:", "home", "logContext:"]
  21862. }),
  21863. $globals.ConsoleErrorHandler);
  21864. $globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  21865. $core.addMethod(
  21866. $core.method({
  21867. selector: "initialize",
  21868. protocol: 'initialization',
  21869. fn: function (){
  21870. var self=this;
  21871. return $core.withContext(function($ctx1) {
  21872. $recv($globals.ErrorHandler)._registerIfNone_(self._new());
  21873. return self;
  21874. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)});
  21875. },
  21876. args: [],
  21877. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  21878. referencedClasses: ["ErrorHandler"],
  21879. messageSends: ["registerIfNone:", "new"]
  21880. }),
  21881. $globals.ConsoleErrorHandler.klass);
  21882. $core.addClass('ConsoleTranscript', $globals.Object, ['textarea'], 'Platform-Services');
  21883. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  21884. $core.addMethod(
  21885. $core.method({
  21886. selector: "clear",
  21887. protocol: 'printing',
  21888. fn: function (){
  21889. var self=this;
  21890. return self;
  21891. },
  21892. args: [],
  21893. source: "clear\x0a\x09\x22no op\x22",
  21894. referencedClasses: [],
  21895. messageSends: []
  21896. }),
  21897. $globals.ConsoleTranscript);
  21898. $core.addMethod(
  21899. $core.method({
  21900. selector: "cr",
  21901. protocol: 'printing',
  21902. fn: function (){
  21903. var self=this;
  21904. return self;
  21905. },
  21906. args: [],
  21907. source: "cr\x0a\x09\x22no op\x22",
  21908. referencedClasses: [],
  21909. messageSends: []
  21910. }),
  21911. $globals.ConsoleTranscript);
  21912. $core.addMethod(
  21913. $core.method({
  21914. selector: "open",
  21915. protocol: 'actions',
  21916. fn: function (){
  21917. var self=this;
  21918. return self;
  21919. },
  21920. args: [],
  21921. source: "open",
  21922. referencedClasses: [],
  21923. messageSends: []
  21924. }),
  21925. $globals.ConsoleTranscript);
  21926. $core.addMethod(
  21927. $core.method({
  21928. selector: "show:",
  21929. protocol: 'printing',
  21930. fn: function (anObject){
  21931. var self=this;
  21932. return $core.withContext(function($ctx1) {
  21933. console.log(String($recv(anObject)._asString()));
  21934. return self;
  21935. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  21936. },
  21937. args: ["anObject"],
  21938. 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<console.log(String($recv(anObject)._asString()))>",
  21939. referencedClasses: [],
  21940. messageSends: []
  21941. }),
  21942. $globals.ConsoleTranscript);
  21943. $core.addMethod(
  21944. $core.method({
  21945. selector: "initialize",
  21946. protocol: 'initialization',
  21947. fn: function (){
  21948. var self=this;
  21949. return $core.withContext(function($ctx1) {
  21950. $recv($globals.Transcript)._registerIfNone_(self._new());
  21951. return self;
  21952. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
  21953. },
  21954. args: [],
  21955. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  21956. referencedClasses: ["Transcript"],
  21957. messageSends: ["registerIfNone:", "new"]
  21958. }),
  21959. $globals.ConsoleTranscript.klass);
  21960. $core.addClass('InterfacingObject', $globals.Object, [], 'Platform-Services');
  21961. $globals.InterfacingObject.comment="I am superclass of all object that interface with user or environment. `Widget` and a few other classes are subclasses of me. I delegate all of the above APIs to `PlatformInterface`.\x0a\x0a## API\x0a\x0a self alert: 'Hey, there is a problem'.\x0a self confirm: 'Affirmative?'.\x0a self prompt: 'Your name:'.\x0a\x0a self ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
  21962. $core.addMethod(
  21963. $core.method({
  21964. selector: "ajax:",
  21965. protocol: 'actions',
  21966. fn: function (anObject){
  21967. var self=this;
  21968. return $core.withContext(function($ctx1) {
  21969. self._deprecatedAPI();
  21970. return $recv($globals.PlatformInterface)._ajax_(anObject);
  21971. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.InterfacingObject)});
  21972. },
  21973. args: ["anObject"],
  21974. source: "ajax: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ PlatformInterface ajax: anObject",
  21975. referencedClasses: ["PlatformInterface"],
  21976. messageSends: ["deprecatedAPI", "ajax:"]
  21977. }),
  21978. $globals.InterfacingObject);
  21979. $core.addMethod(
  21980. $core.method({
  21981. selector: "alert:",
  21982. protocol: 'actions',
  21983. fn: function (aString){
  21984. var self=this;
  21985. return $core.withContext(function($ctx1) {
  21986. return $recv($globals.Terminal)._alert_(aString);
  21987. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.InterfacingObject)});
  21988. },
  21989. args: ["aString"],
  21990. source: "alert: aString\x0a\x09^ Terminal alert: aString",
  21991. referencedClasses: ["Terminal"],
  21992. messageSends: ["alert:"]
  21993. }),
  21994. $globals.InterfacingObject);
  21995. $core.addMethod(
  21996. $core.method({
  21997. selector: "confirm:",
  21998. protocol: 'actions',
  21999. fn: function (aString){
  22000. var self=this;
  22001. return $core.withContext(function($ctx1) {
  22002. return $recv($globals.Terminal)._confirm_(aString);
  22003. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.InterfacingObject)});
  22004. },
  22005. args: ["aString"],
  22006. source: "confirm: aString\x0a\x09^ Terminal confirm: aString",
  22007. referencedClasses: ["Terminal"],
  22008. messageSends: ["confirm:"]
  22009. }),
  22010. $globals.InterfacingObject);
  22011. $core.addMethod(
  22012. $core.method({
  22013. selector: "prompt:",
  22014. protocol: 'actions',
  22015. fn: function (aString){
  22016. var self=this;
  22017. return $core.withContext(function($ctx1) {
  22018. return $recv($globals.Terminal)._prompt_(aString);
  22019. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.InterfacingObject)});
  22020. },
  22021. args: ["aString"],
  22022. source: "prompt: aString\x0a\x09^ Terminal prompt: aString",
  22023. referencedClasses: ["Terminal"],
  22024. messageSends: ["prompt:"]
  22025. }),
  22026. $globals.InterfacingObject);
  22027. $core.addMethod(
  22028. $core.method({
  22029. selector: "prompt:default:",
  22030. protocol: 'actions',
  22031. fn: function (aString,defaultString){
  22032. var self=this;
  22033. return $core.withContext(function($ctx1) {
  22034. return $recv($globals.Terminal)._prompt_default_(aString,defaultString);
  22035. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.InterfacingObject)});
  22036. },
  22037. args: ["aString", "defaultString"],
  22038. source: "prompt: aString default: defaultString\x0a\x09^ Terminal prompt: aString default: defaultString",
  22039. referencedClasses: ["Terminal"],
  22040. messageSends: ["prompt:default:"]
  22041. }),
  22042. $globals.InterfacingObject);
  22043. $core.addClass('Environment', $globals.InterfacingObject, [], 'Platform-Services');
  22044. $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.";
  22045. $core.addMethod(
  22046. $core.method({
  22047. selector: "addInstVarNamed:to:",
  22048. protocol: 'compiling',
  22049. fn: function (aString,aClass){
  22050. var self=this;
  22051. return $core.withContext(function($ctx1) {
  22052. var $1,$2,$3,$5,$4;
  22053. $1=self._classBuilder();
  22054. $2=$recv(aClass)._superclass();
  22055. $3=$recv(aClass)._name();
  22056. $ctx1.sendIdx["name"]=1;
  22057. $5=$recv($recv(aClass)._instanceVariableNames())._copy();
  22058. $recv($5)._add_(aString);
  22059. $4=$recv($5)._yourself();
  22060. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$recv($recv(aClass)._package())._name());
  22061. return self;
  22062. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  22063. },
  22064. args: ["aString", "aClass"],
  22065. 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",
  22066. referencedClasses: [],
  22067. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  22068. }),
  22069. $globals.Environment);
  22070. $core.addMethod(
  22071. $core.method({
  22072. selector: "allSelectors",
  22073. protocol: 'accessing',
  22074. fn: function (){
  22075. var self=this;
  22076. return $core.withContext(function($ctx1) {
  22077. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  22078. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  22079. },
  22080. args: [],
  22081. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  22082. referencedClasses: ["Smalltalk"],
  22083. messageSends: ["allSelectors", "core"]
  22084. }),
  22085. $globals.Environment);
  22086. $core.addMethod(
  22087. $core.method({
  22088. selector: "availableClassNames",
  22089. protocol: 'accessing',
  22090. fn: function (){
  22091. var self=this;
  22092. return $core.withContext(function($ctx1) {
  22093. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  22094. return $core.withContext(function($ctx2) {
  22095. return $recv(each)._name();
  22096. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22097. }));
  22098. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  22099. },
  22100. args: [],
  22101. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  22102. referencedClasses: ["Smalltalk"],
  22103. messageSends: ["collect:", "classes", "name"]
  22104. }),
  22105. $globals.Environment);
  22106. $core.addMethod(
  22107. $core.method({
  22108. selector: "availablePackageNames",
  22109. protocol: 'accessing',
  22110. fn: function (){
  22111. var self=this;
  22112. return $core.withContext(function($ctx1) {
  22113. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  22114. return $core.withContext(function($ctx2) {
  22115. return $recv(each)._name();
  22116. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22117. }));
  22118. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  22119. },
  22120. args: [],
  22121. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  22122. referencedClasses: ["Smalltalk"],
  22123. messageSends: ["collect:", "packages", "name"]
  22124. }),
  22125. $globals.Environment);
  22126. $core.addMethod(
  22127. $core.method({
  22128. selector: "availableProtocolsFor:",
  22129. protocol: 'accessing',
  22130. fn: function (aClass){
  22131. var self=this;
  22132. var protocols;
  22133. return $core.withContext(function($ctx1) {
  22134. var $1,$receiver;
  22135. protocols=$recv(aClass)._protocols();
  22136. $1=$recv(aClass)._superclass();
  22137. $ctx1.sendIdx["superclass"]=1;
  22138. if(($receiver = $1) == null || $receiver.isNil){
  22139. $1;
  22140. } else {
  22141. $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
  22142. };
  22143. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  22144. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  22145. },
  22146. args: ["aClass"],
  22147. 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",
  22148. referencedClasses: [],
  22149. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  22150. }),
  22151. $globals.Environment);
  22152. $core.addMethod(
  22153. $core.method({
  22154. selector: "classBuilder",
  22155. protocol: 'accessing',
  22156. fn: function (){
  22157. var self=this;
  22158. return $core.withContext(function($ctx1) {
  22159. return $recv($globals.ClassBuilder)._new();
  22160. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  22161. },
  22162. args: [],
  22163. source: "classBuilder\x0a\x09^ ClassBuilder new",
  22164. referencedClasses: ["ClassBuilder"],
  22165. messageSends: ["new"]
  22166. }),
  22167. $globals.Environment);
  22168. $core.addMethod(
  22169. $core.method({
  22170. selector: "classNamed:",
  22171. protocol: 'accessing',
  22172. fn: function (aString){
  22173. var self=this;
  22174. return $core.withContext(function($ctx1) {
  22175. var $1,$receiver;
  22176. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  22177. if(($receiver = $1) == null || $receiver.isNil){
  22178. return self._error_("Invalid class name");
  22179. } else {
  22180. return $1;
  22181. };
  22182. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  22183. },
  22184. args: ["aString"],
  22185. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  22186. referencedClasses: ["Smalltalk"],
  22187. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  22188. }),
  22189. $globals.Environment);
  22190. $core.addMethod(
  22191. $core.method({
  22192. selector: "classes",
  22193. protocol: 'accessing',
  22194. fn: function (){
  22195. var self=this;
  22196. return $core.withContext(function($ctx1) {
  22197. return $recv($globals.Smalltalk)._classes();
  22198. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  22199. },
  22200. args: [],
  22201. source: "classes\x0a\x09^ Smalltalk classes",
  22202. referencedClasses: ["Smalltalk"],
  22203. messageSends: ["classes"]
  22204. }),
  22205. $globals.Environment);
  22206. $core.addMethod(
  22207. $core.method({
  22208. selector: "commitPackage:onSuccess:onError:",
  22209. protocol: 'actions',
  22210. fn: function (aPackage,aBlock,anotherBlock){
  22211. var self=this;
  22212. return $core.withContext(function($ctx1) {
  22213. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  22214. return self;
  22215. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  22216. },
  22217. args: ["aPackage", "aBlock", "anotherBlock"],
  22218. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  22219. referencedClasses: [],
  22220. messageSends: ["commitOnSuccess:onError:", "transport"]
  22221. }),
  22222. $globals.Environment);
  22223. $core.addMethod(
  22224. $core.method({
  22225. selector: "compileClassComment:for:",
  22226. protocol: 'compiling',
  22227. fn: function (aString,aClass){
  22228. var self=this;
  22229. return $core.withContext(function($ctx1) {
  22230. $recv(aClass)._comment_(aString);
  22231. return self;
  22232. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  22233. },
  22234. args: ["aString", "aClass"],
  22235. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  22236. referencedClasses: [],
  22237. messageSends: ["comment:"]
  22238. }),
  22239. $globals.Environment);
  22240. $core.addMethod(
  22241. $core.method({
  22242. selector: "compileClassDefinition:",
  22243. protocol: 'compiling',
  22244. fn: function (aString){
  22245. var self=this;
  22246. return $core.withContext(function($ctx1) {
  22247. $recv((function(){
  22248. return $core.withContext(function($ctx2) {
  22249. return self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  22250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22251. }))._on_do_($globals.Error,(function(error){
  22252. return $core.withContext(function($ctx2) {
  22253. return self._alert_($recv(error)._messageText());
  22254. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  22255. }));
  22256. return self;
  22257. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  22258. },
  22259. args: ["aString"],
  22260. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
  22261. referencedClasses: ["DoIt", "Error"],
  22262. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  22263. }),
  22264. $globals.Environment);
  22265. $core.addMethod(
  22266. $core.method({
  22267. selector: "compileMethod:for:protocol:",
  22268. protocol: 'compiling',
  22269. fn: function (sourceCode,class_,protocol){
  22270. var self=this;
  22271. return $core.withContext(function($ctx1) {
  22272. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  22273. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  22274. },
  22275. args: ["sourceCode", "class", "protocol"],
  22276. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  22277. referencedClasses: [],
  22278. messageSends: ["compile:protocol:"]
  22279. }),
  22280. $globals.Environment);
  22281. $core.addMethod(
  22282. $core.method({
  22283. selector: "copyClass:to:",
  22284. protocol: 'actions',
  22285. fn: function (aClass,aClassName){
  22286. var self=this;
  22287. return $core.withContext(function($ctx1) {
  22288. var $1,$2,$receiver;
  22289. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  22290. if(($receiver = $1) == null || $receiver.isNil){
  22291. $1;
  22292. } else {
  22293. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22294. $ctx1.sendIdx[","]=1;
  22295. self._error_($2);
  22296. };
  22297. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  22298. return self;
  22299. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22300. },
  22301. args: ["aClass", "aClassName"],
  22302. 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",
  22303. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22304. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  22305. }),
  22306. $globals.Environment);
  22307. $core.addMethod(
  22308. $core.method({
  22309. selector: "doItReceiver",
  22310. protocol: 'accessing',
  22311. fn: function (){
  22312. var self=this;
  22313. return $core.withContext(function($ctx1) {
  22314. return $recv($globals.DoIt)._new();
  22315. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  22316. },
  22317. args: [],
  22318. source: "doItReceiver\x0a\x09^ DoIt new",
  22319. referencedClasses: ["DoIt"],
  22320. messageSends: ["new"]
  22321. }),
  22322. $globals.Environment);
  22323. $core.addMethod(
  22324. $core.method({
  22325. selector: "evaluate:for:",
  22326. protocol: 'evaluating',
  22327. fn: function (aString,anObject){
  22328. var self=this;
  22329. return $core.withContext(function($ctx1) {
  22330. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  22331. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  22332. },
  22333. args: ["aString", "anObject"],
  22334. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  22335. referencedClasses: ["Evaluator"],
  22336. messageSends: ["evaluate:for:"]
  22337. }),
  22338. $globals.Environment);
  22339. $core.addMethod(
  22340. $core.method({
  22341. selector: "evaluate:on:do:",
  22342. protocol: 'error handling',
  22343. fn: function (aBlock,anErrorClass,exceptionBlock){
  22344. var self=this;
  22345. return $core.withContext(function($ctx1) {
  22346. var $1;
  22347. $recv(aBlock)._tryCatch_((function(exception){
  22348. return $core.withContext(function($ctx2) {
  22349. $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
  22350. if($core.assert($1)){
  22351. return $recv(exceptionBlock)._value_(exception);
  22352. } else {
  22353. return $recv(exception)._resignal();
  22354. };
  22355. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  22356. }));
  22357. return self;
  22358. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  22359. },
  22360. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  22361. 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 ] ]",
  22362. referencedClasses: [],
  22363. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  22364. }),
  22365. $globals.Environment);
  22366. $core.addMethod(
  22367. $core.method({
  22368. selector: "inspect:",
  22369. protocol: 'actions',
  22370. fn: function (anObject){
  22371. var self=this;
  22372. return $core.withContext(function($ctx1) {
  22373. $recv($globals.Inspector)._inspect_(anObject);
  22374. return self;
  22375. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  22376. },
  22377. args: ["anObject"],
  22378. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  22379. referencedClasses: ["Inspector"],
  22380. messageSends: ["inspect:"]
  22381. }),
  22382. $globals.Environment);
  22383. $core.addMethod(
  22384. $core.method({
  22385. selector: "moveClass:toPackage:",
  22386. protocol: 'actions',
  22387. fn: function (aClass,aPackageName){
  22388. var self=this;
  22389. var package_;
  22390. return $core.withContext(function($ctx1) {
  22391. var $1,$2,$receiver;
  22392. package_=$recv($globals.Package)._named_(aPackageName);
  22393. $1=package_;
  22394. if(($receiver = $1) == null || $receiver.isNil){
  22395. self._error_("Invalid package name");
  22396. } else {
  22397. $1;
  22398. };
  22399. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  22400. if($core.assert($2)){
  22401. return self;
  22402. };
  22403. $recv(aClass)._package_(package_);
  22404. return self;
  22405. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  22406. },
  22407. args: ["aClass", "aPackageName"],
  22408. 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",
  22409. referencedClasses: ["Package"],
  22410. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
  22411. }),
  22412. $globals.Environment);
  22413. $core.addMethod(
  22414. $core.method({
  22415. selector: "moveMethod:toClass:",
  22416. protocol: 'actions',
  22417. fn: function (aMethod,aClassName){
  22418. var self=this;
  22419. var destinationClass;
  22420. return $core.withContext(function($ctx1) {
  22421. var $2,$3,$1,$5,$4;
  22422. destinationClass=self._classNamed_(aClassName);
  22423. $2=destinationClass;
  22424. $3=$recv(aMethod)._methodClass();
  22425. $ctx1.sendIdx["methodClass"]=1;
  22426. $1=$recv($2).__eq_eq($3);
  22427. if($core.assert($1)){
  22428. return self;
  22429. };
  22430. $5=$recv(aMethod)._methodClass();
  22431. $ctx1.sendIdx["methodClass"]=2;
  22432. $4=$recv($5)._isMetaclass();
  22433. if($core.assert($4)){
  22434. destinationClass=$recv(destinationClass)._class();
  22435. destinationClass;
  22436. };
  22437. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  22438. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22439. return self;
  22440. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  22441. },
  22442. args: ["aMethod", "aClassName"],
  22443. 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",
  22444. referencedClasses: [],
  22445. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  22446. }),
  22447. $globals.Environment);
  22448. $core.addMethod(
  22449. $core.method({
  22450. selector: "moveMethod:toProtocol:",
  22451. protocol: 'actions',
  22452. fn: function (aMethod,aProtocol){
  22453. var self=this;
  22454. return $core.withContext(function($ctx1) {
  22455. $recv(aMethod)._protocol_(aProtocol);
  22456. return self;
  22457. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  22458. },
  22459. args: ["aMethod", "aProtocol"],
  22460. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  22461. referencedClasses: [],
  22462. messageSends: ["protocol:"]
  22463. }),
  22464. $globals.Environment);
  22465. $core.addMethod(
  22466. $core.method({
  22467. selector: "packages",
  22468. protocol: 'accessing',
  22469. fn: function (){
  22470. var self=this;
  22471. return $core.withContext(function($ctx1) {
  22472. return $recv($globals.Smalltalk)._packages();
  22473. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  22474. },
  22475. args: [],
  22476. source: "packages\x0a\x09^ Smalltalk packages",
  22477. referencedClasses: ["Smalltalk"],
  22478. messageSends: ["packages"]
  22479. }),
  22480. $globals.Environment);
  22481. $core.addMethod(
  22482. $core.method({
  22483. selector: "registerErrorHandler:",
  22484. protocol: 'services',
  22485. fn: function (anErrorHandler){
  22486. var self=this;
  22487. return $core.withContext(function($ctx1) {
  22488. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  22489. return self;
  22490. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  22491. },
  22492. args: ["anErrorHandler"],
  22493. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  22494. referencedClasses: ["ErrorHandler"],
  22495. messageSends: ["register:"]
  22496. }),
  22497. $globals.Environment);
  22498. $core.addMethod(
  22499. $core.method({
  22500. selector: "registerFinder:",
  22501. protocol: 'services',
  22502. fn: function (aFinder){
  22503. var self=this;
  22504. return $core.withContext(function($ctx1) {
  22505. $recv($globals.Finder)._register_(aFinder);
  22506. return self;
  22507. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  22508. },
  22509. args: ["aFinder"],
  22510. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  22511. referencedClasses: ["Finder"],
  22512. messageSends: ["register:"]
  22513. }),
  22514. $globals.Environment);
  22515. $core.addMethod(
  22516. $core.method({
  22517. selector: "registerInspector:",
  22518. protocol: 'services',
  22519. fn: function (anInspector){
  22520. var self=this;
  22521. return $core.withContext(function($ctx1) {
  22522. $recv($globals.Inspector)._register_(anInspector);
  22523. return self;
  22524. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  22525. },
  22526. args: ["anInspector"],
  22527. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  22528. referencedClasses: ["Inspector"],
  22529. messageSends: ["register:"]
  22530. }),
  22531. $globals.Environment);
  22532. $core.addMethod(
  22533. $core.method({
  22534. selector: "registerProgressHandler:",
  22535. protocol: 'services',
  22536. fn: function (aProgressHandler){
  22537. var self=this;
  22538. return $core.withContext(function($ctx1) {
  22539. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  22540. return self;
  22541. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  22542. },
  22543. args: ["aProgressHandler"],
  22544. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  22545. referencedClasses: ["ProgressHandler"],
  22546. messageSends: ["register:"]
  22547. }),
  22548. $globals.Environment);
  22549. $core.addMethod(
  22550. $core.method({
  22551. selector: "registerTranscript:",
  22552. protocol: 'services',
  22553. fn: function (aTranscript){
  22554. var self=this;
  22555. return $core.withContext(function($ctx1) {
  22556. $recv($globals.Transcript)._register_(aTranscript);
  22557. return self;
  22558. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  22559. },
  22560. args: ["aTranscript"],
  22561. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  22562. referencedClasses: ["Transcript"],
  22563. messageSends: ["register:"]
  22564. }),
  22565. $globals.Environment);
  22566. $core.addMethod(
  22567. $core.method({
  22568. selector: "removeClass:",
  22569. protocol: 'actions',
  22570. fn: function (aClass){
  22571. var self=this;
  22572. return $core.withContext(function($ctx1) {
  22573. $recv($globals.Smalltalk)._removeClass_(aClass);
  22574. return self;
  22575. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  22576. },
  22577. args: ["aClass"],
  22578. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  22579. referencedClasses: ["Smalltalk"],
  22580. messageSends: ["removeClass:"]
  22581. }),
  22582. $globals.Environment);
  22583. $core.addMethod(
  22584. $core.method({
  22585. selector: "removeMethod:",
  22586. protocol: 'actions',
  22587. fn: function (aMethod){
  22588. var self=this;
  22589. return $core.withContext(function($ctx1) {
  22590. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22591. return self;
  22592. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  22593. },
  22594. args: ["aMethod"],
  22595. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  22596. referencedClasses: [],
  22597. messageSends: ["removeCompiledMethod:", "methodClass"]
  22598. }),
  22599. $globals.Environment);
  22600. $core.addMethod(
  22601. $core.method({
  22602. selector: "removeProtocol:from:",
  22603. protocol: 'actions',
  22604. fn: function (aString,aClass){
  22605. var self=this;
  22606. return $core.withContext(function($ctx1) {
  22607. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22608. return $core.withContext(function($ctx2) {
  22609. return $recv(aClass)._removeCompiledMethod_(each);
  22610. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22611. }));
  22612. return self;
  22613. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  22614. },
  22615. args: ["aString", "aClass"],
  22616. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  22617. referencedClasses: [],
  22618. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  22619. }),
  22620. $globals.Environment);
  22621. $core.addMethod(
  22622. $core.method({
  22623. selector: "renameClass:to:",
  22624. protocol: 'actions',
  22625. fn: function (aClass,aClassName){
  22626. var self=this;
  22627. return $core.withContext(function($ctx1) {
  22628. var $1,$2,$receiver;
  22629. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  22630. if(($receiver = $1) == null || $receiver.isNil){
  22631. $1;
  22632. } else {
  22633. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22634. $ctx1.sendIdx[","]=1;
  22635. self._error_($2);
  22636. };
  22637. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  22638. return self;
  22639. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22640. },
  22641. args: ["aClass", "aClassName"],
  22642. 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",
  22643. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22644. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  22645. }),
  22646. $globals.Environment);
  22647. $core.addMethod(
  22648. $core.method({
  22649. selector: "renamePackage:to:",
  22650. protocol: 'actions',
  22651. fn: function (aPackageName,aNewPackageName){
  22652. var self=this;
  22653. return $core.withContext(function($ctx1) {
  22654. var $1,$2,$receiver;
  22655. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aNewPackageName);
  22656. if(($receiver = $1) == null || $receiver.isNil){
  22657. $1;
  22658. } else {
  22659. $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
  22660. $ctx1.sendIdx[","]=1;
  22661. self._error_($2);
  22662. };
  22663. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  22664. return self;
  22665. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  22666. },
  22667. args: ["aPackageName", "aNewPackageName"],
  22668. 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",
  22669. referencedClasses: ["Smalltalk"],
  22670. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
  22671. }),
  22672. $globals.Environment);
  22673. $core.addMethod(
  22674. $core.method({
  22675. selector: "renameProtocol:to:in:",
  22676. protocol: 'actions',
  22677. fn: function (aString,anotherString,aClass){
  22678. var self=this;
  22679. return $core.withContext(function($ctx1) {
  22680. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22681. return $core.withContext(function($ctx2) {
  22682. return $recv(each)._protocol_(anotherString);
  22683. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22684. }));
  22685. return self;
  22686. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  22687. },
  22688. args: ["aString", "anotherString", "aClass"],
  22689. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  22690. referencedClasses: [],
  22691. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  22692. }),
  22693. $globals.Environment);
  22694. $core.addMethod(
  22695. $core.method({
  22696. selector: "setClassCommentOf:to:",
  22697. protocol: 'actions',
  22698. fn: function (aClass,aString){
  22699. var self=this;
  22700. return $core.withContext(function($ctx1) {
  22701. $recv(aClass)._comment_(aString);
  22702. return self;
  22703. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  22704. },
  22705. args: ["aClass", "aString"],
  22706. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  22707. referencedClasses: [],
  22708. messageSends: ["comment:"]
  22709. }),
  22710. $globals.Environment);
  22711. $core.addMethod(
  22712. $core.method({
  22713. selector: "systemAnnouncer",
  22714. protocol: 'accessing',
  22715. fn: function (){
  22716. var self=this;
  22717. return $core.withContext(function($ctx1) {
  22718. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  22719. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  22720. },
  22721. args: [],
  22722. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  22723. referencedClasses: ["Smalltalk"],
  22724. messageSends: ["current", "at:", "globals"]
  22725. }),
  22726. $globals.Environment);
  22727. $core.addClass('NullProgressHandler', $globals.Object, [], 'Platform-Services');
  22728. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  22729. $core.addMethod(
  22730. $core.method({
  22731. selector: "do:on:displaying:",
  22732. protocol: 'progress handling',
  22733. fn: function (aBlock,aCollection,aString){
  22734. var self=this;
  22735. return $core.withContext(function($ctx1) {
  22736. $recv(aCollection)._do_(aBlock);
  22737. return self;
  22738. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  22739. },
  22740. args: ["aBlock", "aCollection", "aString"],
  22741. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  22742. referencedClasses: [],
  22743. messageSends: ["do:"]
  22744. }),
  22745. $globals.NullProgressHandler);
  22746. $globals.NullProgressHandler.klass.iVarNames = ['current'];
  22747. $core.addMethod(
  22748. $core.method({
  22749. selector: "initialize",
  22750. protocol: 'initialization',
  22751. fn: function (){
  22752. var self=this;
  22753. return $core.withContext(function($ctx1) {
  22754. $recv($globals.ProgressHandler)._registerIfNone_(self._new());
  22755. return self;
  22756. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
  22757. },
  22758. args: [],
  22759. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  22760. referencedClasses: ["ProgressHandler"],
  22761. messageSends: ["registerIfNone:", "new"]
  22762. }),
  22763. $globals.NullProgressHandler.klass);
  22764. $core.addClass('PlatformInterface', $globals.Object, [], 'Platform-Services');
  22765. $globals.PlatformInterface.comment="Deprecated. Use `Platform` or `Terminal`.";
  22766. $core.addMethod(
  22767. $core.method({
  22768. selector: "ajax:",
  22769. protocol: 'actions',
  22770. fn: function (anObject){
  22771. var self=this;
  22772. return $core.withContext(function($ctx1) {
  22773. var $receiver;
  22774. self._deprecatedAPI_("Use Platform newXhr or dedicated library.");
  22775. if(($receiver = $globals.JQuery) == null || $receiver.isNil){
  22776. return self._error_("JQuery wrapper not loaded, cannot do AJAX.");
  22777. } else {
  22778. return $recv($recv($globals.JQuery)._current())._ajax_(anObject);
  22779. };
  22780. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.PlatformInterface.klass)});
  22781. },
  22782. args: ["anObject"],
  22783. source: "ajax: anObject\x0a\x09self deprecatedAPI: 'Use Platform newXhr or dedicated library.'.\x0a\x09^ JQuery\x0a\x09\x09ifNotNil: [ JQuery current ajax: anObject ]\x0a\x09\x09ifNil: [ self error: 'JQuery wrapper not loaded, cannot do AJAX.' ]",
  22784. referencedClasses: ["JQuery"],
  22785. messageSends: ["deprecatedAPI:", "ifNotNil:ifNil:", "ajax:", "current", "error:"]
  22786. }),
  22787. $globals.PlatformInterface.klass);
  22788. $core.addMethod(
  22789. $core.method({
  22790. selector: "alert:",
  22791. protocol: 'actions',
  22792. fn: function (aString){
  22793. var self=this;
  22794. return $core.withContext(function($ctx1) {
  22795. self._deprecatedAPI_("Use Terminal alert:");
  22796. return $recv($globals.Terminal)._alert_(aString);
  22797. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.PlatformInterface.klass)});
  22798. },
  22799. args: ["aString"],
  22800. source: "alert: aString\x0a\x09self deprecatedAPI: 'Use Terminal alert:'.\x0a\x09^ Terminal alert: aString",
  22801. referencedClasses: ["Terminal"],
  22802. messageSends: ["deprecatedAPI:", "alert:"]
  22803. }),
  22804. $globals.PlatformInterface.klass);
  22805. $core.addMethod(
  22806. $core.method({
  22807. selector: "confirm:",
  22808. protocol: 'actions',
  22809. fn: function (aString){
  22810. var self=this;
  22811. return $core.withContext(function($ctx1) {
  22812. self._deprecatedAPI_("Use Terminal confirm:");
  22813. return $recv($globals.Terminal)._confirm_(aString);
  22814. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.PlatformInterface.klass)});
  22815. },
  22816. args: ["aString"],
  22817. source: "confirm: aString\x0a\x09self deprecatedAPI: 'Use Terminal confirm:'.\x0a\x09^ Terminal confirm: aString",
  22818. referencedClasses: ["Terminal"],
  22819. messageSends: ["deprecatedAPI:", "confirm:"]
  22820. }),
  22821. $globals.PlatformInterface.klass);
  22822. $core.addMethod(
  22823. $core.method({
  22824. selector: "existsGlobal:",
  22825. protocol: 'actions',
  22826. fn: function (aString){
  22827. var self=this;
  22828. return $core.withContext(function($ctx1) {
  22829. self._deprecatedAPI_("Use Smalltalk existsJsGlobal:");
  22830. return $recv($recv($globals.PlatformInterface)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  22831. return true;
  22832. }),(function(){
  22833. return false;
  22834. }));
  22835. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},$globals.PlatformInterface.klass)});
  22836. },
  22837. args: ["aString"],
  22838. source: "existsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Smalltalk existsJsGlobal:'.\x0a\x09^ PlatformInterface globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  22839. referencedClasses: ["PlatformInterface"],
  22840. messageSends: ["deprecatedAPI:", "at:ifPresent:ifAbsent:", "globals"]
  22841. }),
  22842. $globals.PlatformInterface.klass);
  22843. $core.addMethod(
  22844. $core.method({
  22845. selector: "globals",
  22846. protocol: 'accessing',
  22847. fn: function (){
  22848. var self=this;
  22849. return $core.withContext(function($ctx1) {
  22850. self._deprecatedAPI_("Use Platform globals");
  22851. return $recv($globals.Platform)._globals();
  22852. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.PlatformInterface.klass)});
  22853. },
  22854. args: [],
  22855. source: "globals\x0a\x09self deprecatedAPI: 'Use Platform globals'.\x0a\x09^ Platform globals",
  22856. referencedClasses: ["Platform"],
  22857. messageSends: ["deprecatedAPI:", "globals"]
  22858. }),
  22859. $globals.PlatformInterface.klass);
  22860. $core.addMethod(
  22861. $core.method({
  22862. selector: "newXhr",
  22863. protocol: 'actions',
  22864. fn: function (){
  22865. var self=this;
  22866. return $core.withContext(function($ctx1) {
  22867. self._deprecatedAPI_("Use Platform newXhr");
  22868. return $recv($globals.Platform)._newXhr();
  22869. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.PlatformInterface.klass)});
  22870. },
  22871. args: [],
  22872. source: "newXhr\x0a\x09self deprecatedAPI: 'Use Platform newXhr'.\x0a\x09^ Platform newXhr",
  22873. referencedClasses: ["Platform"],
  22874. messageSends: ["deprecatedAPI:", "newXhr"]
  22875. }),
  22876. $globals.PlatformInterface.klass);
  22877. $core.addMethod(
  22878. $core.method({
  22879. selector: "prompt:",
  22880. protocol: 'actions',
  22881. fn: function (aString){
  22882. var self=this;
  22883. return $core.withContext(function($ctx1) {
  22884. self._deprecatedAPI_("Use Terminal prompt:");
  22885. return $recv($globals.Terminal)._prompt_(aString);
  22886. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.PlatformInterface.klass)});
  22887. },
  22888. args: ["aString"],
  22889. source: "prompt: aString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:'.\x0a\x09^ Terminal prompt: aString",
  22890. referencedClasses: ["Terminal"],
  22891. messageSends: ["deprecatedAPI:", "prompt:"]
  22892. }),
  22893. $globals.PlatformInterface.klass);
  22894. $core.addMethod(
  22895. $core.method({
  22896. selector: "prompt:default:",
  22897. protocol: 'actions',
  22898. fn: function (aString,defaultString){
  22899. var self=this;
  22900. return $core.withContext(function($ctx1) {
  22901. self._deprecatedAPI_("Use Terminal prompt:default:");
  22902. return $recv($globals.Terminal)._prompt_default_(aString,defaultString);
  22903. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.PlatformInterface.klass)});
  22904. },
  22905. args: ["aString", "defaultString"],
  22906. source: "prompt: aString default: defaultString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:default:'.\x0a\x09^ Terminal prompt: aString default: defaultString",
  22907. referencedClasses: ["Terminal"],
  22908. messageSends: ["deprecatedAPI:", "prompt:default:"]
  22909. }),
  22910. $globals.PlatformInterface.klass);
  22911. $core.addClass('Service', $globals.Object, [], 'Platform-Services');
  22912. $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.";
  22913. $globals.Service.klass.iVarNames = ['current'];
  22914. $core.addMethod(
  22915. $core.method({
  22916. selector: "current",
  22917. protocol: 'accessing',
  22918. fn: function (){
  22919. var self=this;
  22920. return self["@current"];
  22921. },
  22922. args: [],
  22923. source: "current\x0a\x09^ current",
  22924. referencedClasses: [],
  22925. messageSends: []
  22926. }),
  22927. $globals.Service.klass);
  22928. $core.addMethod(
  22929. $core.method({
  22930. selector: "new",
  22931. protocol: 'instance creation',
  22932. fn: function (){
  22933. var self=this;
  22934. return $core.withContext(function($ctx1) {
  22935. self._shouldNotImplement();
  22936. return self;
  22937. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
  22938. },
  22939. args: [],
  22940. source: "new\x0a\x09self shouldNotImplement",
  22941. referencedClasses: [],
  22942. messageSends: ["shouldNotImplement"]
  22943. }),
  22944. $globals.Service.klass);
  22945. $core.addMethod(
  22946. $core.method({
  22947. selector: "register:",
  22948. protocol: 'registration',
  22949. fn: function (anObject){
  22950. var self=this;
  22951. self["@current"]=anObject;
  22952. return self;
  22953. },
  22954. args: ["anObject"],
  22955. source: "register: anObject\x0a\x09current := anObject",
  22956. referencedClasses: [],
  22957. messageSends: []
  22958. }),
  22959. $globals.Service.klass);
  22960. $core.addMethod(
  22961. $core.method({
  22962. selector: "registerIfNone:",
  22963. protocol: 'registration',
  22964. fn: function (anObject){
  22965. var self=this;
  22966. return $core.withContext(function($ctx1) {
  22967. var $1,$receiver;
  22968. $1=self._current();
  22969. if(($receiver = $1) == null || $receiver.isNil){
  22970. self._register_(anObject);
  22971. } else {
  22972. $1;
  22973. };
  22974. return self;
  22975. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
  22976. },
  22977. args: ["anObject"],
  22978. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  22979. referencedClasses: [],
  22980. messageSends: ["ifNil:", "current", "register:"]
  22981. }),
  22982. $globals.Service.klass);
  22983. $core.addClass('ErrorHandler', $globals.Service, [], 'Platform-Services');
  22984. $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.";
  22985. $core.addMethod(
  22986. $core.method({
  22987. selector: "handleError:",
  22988. protocol: 'error handling',
  22989. fn: function (anError){
  22990. var self=this;
  22991. return $core.withContext(function($ctx1) {
  22992. self._handleUnhandledError_(anError);
  22993. return self;
  22994. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
  22995. },
  22996. args: ["anError"],
  22997. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  22998. referencedClasses: [],
  22999. messageSends: ["handleUnhandledError:"]
  23000. }),
  23001. $globals.ErrorHandler.klass);
  23002. $core.addMethod(
  23003. $core.method({
  23004. selector: "handleUnhandledError:",
  23005. protocol: 'error handling',
  23006. fn: function (anError){
  23007. var self=this;
  23008. return $core.withContext(function($ctx1) {
  23009. var $1;
  23010. $1=$recv(anError)._wasHandled();
  23011. if($core.assert($1)){
  23012. return self;
  23013. };
  23014. return $recv(self._current())._handleError_(anError);
  23015. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
  23016. },
  23017. args: ["anError"],
  23018. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  23019. referencedClasses: [],
  23020. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  23021. }),
  23022. $globals.ErrorHandler.klass);
  23023. $core.addClass('Finder', $globals.Service, [], 'Platform-Services');
  23024. $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.";
  23025. $core.addMethod(
  23026. $core.method({
  23027. selector: "findClass:",
  23028. protocol: 'finding',
  23029. fn: function (aClass){
  23030. var self=this;
  23031. return $core.withContext(function($ctx1) {
  23032. return $recv(self._current())._findClass_(aClass);
  23033. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
  23034. },
  23035. args: ["aClass"],
  23036. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  23037. referencedClasses: [],
  23038. messageSends: ["findClass:", "current"]
  23039. }),
  23040. $globals.Finder.klass);
  23041. $core.addMethod(
  23042. $core.method({
  23043. selector: "findMethod:",
  23044. protocol: 'finding',
  23045. fn: function (aCompiledMethod){
  23046. var self=this;
  23047. return $core.withContext(function($ctx1) {
  23048. return $recv(self._current())._findMethod_(aCompiledMethod);
  23049. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
  23050. },
  23051. args: ["aCompiledMethod"],
  23052. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  23053. referencedClasses: [],
  23054. messageSends: ["findMethod:", "current"]
  23055. }),
  23056. $globals.Finder.klass);
  23057. $core.addMethod(
  23058. $core.method({
  23059. selector: "findString:",
  23060. protocol: 'finding',
  23061. fn: function (aString){
  23062. var self=this;
  23063. return $core.withContext(function($ctx1) {
  23064. return $recv(self._current())._findString_(aString);
  23065. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
  23066. },
  23067. args: ["aString"],
  23068. source: "findString: aString\x0a\x09^ self current findString: aString",
  23069. referencedClasses: [],
  23070. messageSends: ["findString:", "current"]
  23071. }),
  23072. $globals.Finder.klass);
  23073. $core.addClass('Inspector', $globals.Service, [], 'Platform-Services');
  23074. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  23075. $core.addMethod(
  23076. $core.method({
  23077. selector: "inspect:",
  23078. protocol: 'inspecting',
  23079. fn: function (anObject){
  23080. var self=this;
  23081. return $core.withContext(function($ctx1) {
  23082. return $recv(self._current())._inspect_(anObject);
  23083. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
  23084. },
  23085. args: ["anObject"],
  23086. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  23087. referencedClasses: [],
  23088. messageSends: ["inspect:", "current"]
  23089. }),
  23090. $globals.Inspector.klass);
  23091. $core.addClass('Platform', $globals.Service, [], 'Platform-Services');
  23092. $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";
  23093. $core.addMethod(
  23094. $core.method({
  23095. selector: "globals",
  23096. protocol: 'accessing',
  23097. fn: function (){
  23098. var self=this;
  23099. return $core.withContext(function($ctx1) {
  23100. return $recv(self._current())._globals();
  23101. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.klass)});
  23102. },
  23103. args: [],
  23104. source: "globals\x0a\x09^ self current globals",
  23105. referencedClasses: [],
  23106. messageSends: ["globals", "current"]
  23107. }),
  23108. $globals.Platform.klass);
  23109. $core.addMethod(
  23110. $core.method({
  23111. selector: "newXhr",
  23112. protocol: 'accessing',
  23113. fn: function (){
  23114. var self=this;
  23115. return $core.withContext(function($ctx1) {
  23116. return $recv(self._current())._newXhr();
  23117. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.klass)});
  23118. },
  23119. args: [],
  23120. source: "newXhr\x0a\x09^ self current newXhr",
  23121. referencedClasses: [],
  23122. messageSends: ["newXhr", "current"]
  23123. }),
  23124. $globals.Platform.klass);
  23125. $core.addClass('ProgressHandler', $globals.Service, [], 'Platform-Services');
  23126. $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`.";
  23127. $core.addMethod(
  23128. $core.method({
  23129. selector: "do:on:displaying:",
  23130. protocol: 'progress handling',
  23131. fn: function (aBlock,aCollection,aString){
  23132. var self=this;
  23133. return $core.withContext(function($ctx1) {
  23134. $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  23135. return self;
  23136. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
  23137. },
  23138. args: ["aBlock", "aCollection", "aString"],
  23139. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  23140. referencedClasses: [],
  23141. messageSends: ["do:on:displaying:", "current"]
  23142. }),
  23143. $globals.ProgressHandler.klass);
  23144. $core.addClass('Terminal', $globals.Service, [], 'Platform-Services');
  23145. $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:'.";
  23146. $core.addMethod(
  23147. $core.method({
  23148. selector: "alert:",
  23149. protocol: 'dialogs',
  23150. fn: function (aString){
  23151. var self=this;
  23152. return $core.withContext(function($ctx1) {
  23153. return $recv(self._current())._alert_(aString);
  23154. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.klass)});
  23155. },
  23156. args: ["aString"],
  23157. source: "alert: aString\x0a\x09^ self current alert: aString",
  23158. referencedClasses: [],
  23159. messageSends: ["alert:", "current"]
  23160. }),
  23161. $globals.Terminal.klass);
  23162. $core.addMethod(
  23163. $core.method({
  23164. selector: "confirm:",
  23165. protocol: 'dialogs',
  23166. fn: function (aString){
  23167. var self=this;
  23168. return $core.withContext(function($ctx1) {
  23169. return $recv(self._current())._confirm_(aString);
  23170. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.klass)});
  23171. },
  23172. args: ["aString"],
  23173. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  23174. referencedClasses: [],
  23175. messageSends: ["confirm:", "current"]
  23176. }),
  23177. $globals.Terminal.klass);
  23178. $core.addMethod(
  23179. $core.method({
  23180. selector: "prompt:",
  23181. protocol: 'dialogs',
  23182. fn: function (aString){
  23183. var self=this;
  23184. return $core.withContext(function($ctx1) {
  23185. return $recv(self._current())._prompt_(aString);
  23186. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.klass)});
  23187. },
  23188. args: ["aString"],
  23189. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  23190. referencedClasses: [],
  23191. messageSends: ["prompt:", "current"]
  23192. }),
  23193. $globals.Terminal.klass);
  23194. $core.addMethod(
  23195. $core.method({
  23196. selector: "prompt:default:",
  23197. protocol: 'dialogs',
  23198. fn: function (aString,defaultString){
  23199. var self=this;
  23200. return $core.withContext(function($ctx1) {
  23201. return $recv(self._current())._prompt_default_(aString,defaultString);
  23202. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.klass)});
  23203. },
  23204. args: ["aString", "defaultString"],
  23205. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  23206. referencedClasses: [],
  23207. messageSends: ["prompt:default:", "current"]
  23208. }),
  23209. $globals.Terminal.klass);
  23210. $core.addClass('Transcript', $globals.Service, [], 'Platform-Services');
  23211. $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.";
  23212. $core.addMethod(
  23213. $core.method({
  23214. selector: "clear",
  23215. protocol: 'printing',
  23216. fn: function (){
  23217. var self=this;
  23218. return $core.withContext(function($ctx1) {
  23219. $recv(self._current())._clear();
  23220. return self;
  23221. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
  23222. },
  23223. args: [],
  23224. source: "clear\x0a\x09self current clear",
  23225. referencedClasses: [],
  23226. messageSends: ["clear", "current"]
  23227. }),
  23228. $globals.Transcript.klass);
  23229. $core.addMethod(
  23230. $core.method({
  23231. selector: "cr",
  23232. protocol: 'printing',
  23233. fn: function (){
  23234. var self=this;
  23235. return $core.withContext(function($ctx1) {
  23236. $recv(self._current())._show_($recv($globals.String)._cr());
  23237. return self;
  23238. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
  23239. },
  23240. args: [],
  23241. source: "cr\x0a\x09self current show: String cr",
  23242. referencedClasses: ["String"],
  23243. messageSends: ["show:", "current", "cr"]
  23244. }),
  23245. $globals.Transcript.klass);
  23246. $core.addMethod(
  23247. $core.method({
  23248. selector: "inspect:",
  23249. protocol: 'printing',
  23250. fn: function (anObject){
  23251. var self=this;
  23252. return $core.withContext(function($ctx1) {
  23253. self._show_(anObject);
  23254. return self;
  23255. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
  23256. },
  23257. args: ["anObject"],
  23258. source: "inspect: anObject\x0a\x09self show: anObject",
  23259. referencedClasses: [],
  23260. messageSends: ["show:"]
  23261. }),
  23262. $globals.Transcript.klass);
  23263. $core.addMethod(
  23264. $core.method({
  23265. selector: "open",
  23266. protocol: 'instance creation',
  23267. fn: function (){
  23268. var self=this;
  23269. return $core.withContext(function($ctx1) {
  23270. $recv(self._current())._open();
  23271. return self;
  23272. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
  23273. },
  23274. args: [],
  23275. source: "open\x0a\x09self current open",
  23276. referencedClasses: [],
  23277. messageSends: ["open", "current"]
  23278. }),
  23279. $globals.Transcript.klass);
  23280. $core.addMethod(
  23281. $core.method({
  23282. selector: "show:",
  23283. protocol: 'printing',
  23284. fn: function (anObject){
  23285. var self=this;
  23286. return $core.withContext(function($ctx1) {
  23287. $recv(self._current())._show_(anObject);
  23288. return self;
  23289. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
  23290. },
  23291. args: ["anObject"],
  23292. source: "show: anObject\x0a\x09self current show: anObject",
  23293. referencedClasses: [],
  23294. messageSends: ["show:", "current"]
  23295. }),
  23296. $globals.Transcript.klass);
  23297. $core.addMethod(
  23298. $core.method({
  23299. selector: "inspectOn:",
  23300. protocol: '*Platform-Services',
  23301. fn: function (anInspector){
  23302. var self=this;
  23303. var variables;
  23304. return $core.withContext(function($ctx1) {
  23305. variables=$recv($globals.Dictionary)._new();
  23306. $recv(variables)._at_put_("#self",self);
  23307. $ctx1.sendIdx["at:put:"]=1;
  23308. $recv(variables)._at_put_("#keys",self._keys());
  23309. $ctx1.sendIdx["at:put:"]=2;
  23310. self._keysAndValuesDo_((function(key,value){
  23311. return $core.withContext(function($ctx2) {
  23312. return $recv(variables)._at_put_(key,value);
  23313. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23314. }));
  23315. $recv(anInspector)._setLabel_(self._printString());
  23316. $recv(anInspector)._setVariables_(variables);
  23317. return self;
  23318. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  23319. },
  23320. args: ["anInspector"],
  23321. 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",
  23322. referencedClasses: ["Dictionary"],
  23323. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  23324. }),
  23325. $globals.AssociativeCollection);
  23326. $core.addMethod(
  23327. $core.method({
  23328. selector: "inspectOn:",
  23329. protocol: '*Platform-Services',
  23330. fn: function (anInspector){
  23331. var self=this;
  23332. var variables;
  23333. return $core.withContext(function($ctx1) {
  23334. variables=$recv($globals.Dictionary)._new();
  23335. $recv(variables)._at_put_("#self",self);
  23336. $ctx1.sendIdx["at:put:"]=1;
  23337. self._withIndexDo_((function(each,i){
  23338. return $core.withContext(function($ctx2) {
  23339. return $recv(variables)._at_put_(i,each);
  23340. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  23341. }));
  23342. $recv(anInspector)._setLabel_(self._printString());
  23343. $recv(anInspector)._setVariables_(variables);
  23344. return self;
  23345. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  23346. },
  23347. args: ["anInspector"],
  23348. 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",
  23349. referencedClasses: ["Dictionary"],
  23350. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  23351. }),
  23352. $globals.Collection);
  23353. $core.addMethod(
  23354. $core.method({
  23355. selector: "inspectOn:",
  23356. protocol: '*Platform-Services',
  23357. fn: function (anInspector){
  23358. var self=this;
  23359. var variables;
  23360. return $core.withContext(function($ctx1) {
  23361. variables=$recv($globals.Dictionary)._new();
  23362. $recv(variables)._at_put_("#self",self);
  23363. $ctx1.sendIdx["at:put:"]=1;
  23364. $recv(variables)._at_put_("#year",self._year());
  23365. $ctx1.sendIdx["at:put:"]=2;
  23366. $recv(variables)._at_put_("#month",self._month());
  23367. $ctx1.sendIdx["at:put:"]=3;
  23368. $recv(variables)._at_put_("#day",self._day());
  23369. $ctx1.sendIdx["at:put:"]=4;
  23370. $recv(variables)._at_put_("#hours",self._hours());
  23371. $ctx1.sendIdx["at:put:"]=5;
  23372. $recv(variables)._at_put_("#minutes",self._minutes());
  23373. $ctx1.sendIdx["at:put:"]=6;
  23374. $recv(variables)._at_put_("#seconds",self._seconds());
  23375. $ctx1.sendIdx["at:put:"]=7;
  23376. $recv(variables)._at_put_("#milliseconds",self._milliseconds());
  23377. $recv(anInspector)._setLabel_(self._printString());
  23378. $recv(anInspector)._setVariables_(variables);
  23379. return self;
  23380. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  23381. },
  23382. args: ["anInspector"],
  23383. 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",
  23384. referencedClasses: ["Dictionary"],
  23385. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  23386. }),
  23387. $globals.Date);
  23388. $core.addMethod(
  23389. $core.method({
  23390. selector: "inspectOn:",
  23391. protocol: '*Platform-Services',
  23392. fn: function (anInspector){
  23393. var self=this;
  23394. var variables;
  23395. return $core.withContext(function($ctx1) {
  23396. variables=$recv($globals.Dictionary)._new();
  23397. $recv(variables)._at_put_("#self",self._jsObject());
  23398. $recv(anInspector)._setLabel_(self._printString());
  23399. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  23400. $recv(anInspector)._setVariables_(variables);
  23401. return self;
  23402. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  23403. },
  23404. args: ["anInspector"],
  23405. 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",
  23406. referencedClasses: ["Dictionary", "JSObjectProxy"],
  23407. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  23408. }),
  23409. $globals.JSObjectProxy);
  23410. $core.addMethod(
  23411. $core.method({
  23412. selector: "inspectOn:",
  23413. protocol: '*Platform-Services',
  23414. fn: function (anInspector){
  23415. var self=this;
  23416. var variables;
  23417. return $core.withContext(function($ctx1) {
  23418. variables=$recv($globals.Dictionary)._new();
  23419. $recv(variables)._at_put_("#self",self);
  23420. $ctx1.sendIdx["at:put:"]=1;
  23421. $recv(variables)._at_put_("#home",self._home());
  23422. $ctx1.sendIdx["at:put:"]=2;
  23423. $recv(variables)._at_put_("#receiver",self._receiver());
  23424. $ctx1.sendIdx["at:put:"]=3;
  23425. $recv(variables)._at_put_("#selector",self._selector());
  23426. $ctx1.sendIdx["at:put:"]=4;
  23427. $recv(variables)._at_put_("#locals",self._locals());
  23428. $ctx1.sendIdx["at:put:"]=5;
  23429. $recv($recv(self._class())._instanceVariableNames())._do_((function(each){
  23430. return $core.withContext(function($ctx2) {
  23431. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23432. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23433. }));
  23434. $recv(anInspector)._setLabel_(self._printString());
  23435. $recv(anInspector)._setVariables_(variables);
  23436. return self;
  23437. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  23438. },
  23439. args: ["anInspector"],
  23440. 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",
  23441. referencedClasses: ["Dictionary"],
  23442. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23443. }),
  23444. $globals.MethodContext);
  23445. $core.addMethod(
  23446. $core.method({
  23447. selector: "inspectOn:",
  23448. protocol: '*Platform-Services',
  23449. fn: function (anInspector){
  23450. var self=this;
  23451. var variables;
  23452. return $core.withContext(function($ctx1) {
  23453. variables=$recv($globals.Dictionary)._new();
  23454. $recv(variables)._at_put_("#self",self);
  23455. $ctx1.sendIdx["at:put:"]=1;
  23456. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  23457. return $core.withContext(function($ctx2) {
  23458. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23460. }));
  23461. $recv(anInspector)._setLabel_(self._printString());
  23462. $recv(anInspector)._setVariables_(variables);
  23463. return self;
  23464. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  23465. },
  23466. args: ["anInspector"],
  23467. 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",
  23468. referencedClasses: ["Dictionary"],
  23469. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23470. }),
  23471. $globals.Object);
  23472. $core.addMethod(
  23473. $core.method({
  23474. selector: "do:displayingProgress:",
  23475. protocol: '*Platform-Services',
  23476. fn: function (aBlock,aString){
  23477. var self=this;
  23478. return $core.withContext(function($ctx1) {
  23479. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  23480. return self;
  23481. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  23482. },
  23483. args: ["aBlock", "aString"],
  23484. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  23485. referencedClasses: ["ProgressHandler"],
  23486. messageSends: ["do:on:displaying:"]
  23487. }),
  23488. $globals.SequenceableCollection);
  23489. $core.addMethod(
  23490. $core.method({
  23491. selector: "inspectOn:",
  23492. protocol: '*Platform-Services',
  23493. fn: function (anInspector){
  23494. var self=this;
  23495. var variables,i;
  23496. return $core.withContext(function($ctx1) {
  23497. variables=$recv($globals.Dictionary)._new();
  23498. $recv(variables)._at_put_("#self",self);
  23499. $ctx1.sendIdx["at:put:"]=1;
  23500. i=(1);
  23501. self._do_((function(each){
  23502. return $core.withContext(function($ctx2) {
  23503. $recv(variables)._at_put_(i,each);
  23504. i=$recv(i).__plus((1));
  23505. return i;
  23506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23507. }));
  23508. $recv(anInspector)._setLabel_(self._printString());
  23509. $recv(anInspector)._setVariables_(variables);
  23510. return self;
  23511. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  23512. },
  23513. args: ["anInspector"],
  23514. 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",
  23515. referencedClasses: ["Dictionary"],
  23516. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  23517. }),
  23518. $globals.Set);
  23519. $core.addMethod(
  23520. $core.method({
  23521. selector: "inspectOn:",
  23522. protocol: '*Platform-Services',
  23523. fn: function (anInspector){
  23524. var self=this;
  23525. var label;
  23526. return $core.withContext(function($ctx1) {
  23527. var $3,$2,$1,$5,$4;
  23528. (
  23529. $ctx1.supercall = true,
  23530. ($globals.String.superclass||$boot.dnu).fn.prototype._inspectOn_.apply($recv(self), [anInspector]));
  23531. $ctx1.supercall = false;
  23532. $3=self._printString();
  23533. $ctx1.sendIdx["printString"]=1;
  23534. $2=$recv($3)._size();
  23535. $1=$recv($2).__gt((30));
  23536. if($core.assert($1)){
  23537. $5=self._printString();
  23538. $ctx1.sendIdx["printString"]=2;
  23539. $4=$recv($5)._copyFrom_to_((1),(30));
  23540. label=$recv($4).__comma("...'");
  23541. label;
  23542. } else {
  23543. label=self._printString();
  23544. label;
  23545. };
  23546. $recv(anInspector)._setLabel_(label);
  23547. return self;
  23548. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  23549. },
  23550. args: ["anInspector"],
  23551. 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",
  23552. referencedClasses: [],
  23553. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  23554. }),
  23555. $globals.String);
  23556. });
  23557. define("amber_core/Platform-Node", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  23558. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  23559. $core.addPackage('Platform-Node');
  23560. $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  23561. $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23562. $core.addClass('NodePlatform', $globals.Object, [], 'Platform-Node');
  23563. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  23564. $core.addMethod(
  23565. $core.method({
  23566. selector: "globals",
  23567. protocol: 'accessing',
  23568. fn: function (){
  23569. var self=this;
  23570. return global;
  23571. },
  23572. args: [],
  23573. source: "globals\x0a\x09^ global",
  23574. referencedClasses: [],
  23575. messageSends: []
  23576. }),
  23577. $globals.NodePlatform);
  23578. $core.addMethod(
  23579. $core.method({
  23580. selector: "newXhr",
  23581. protocol: 'accessing',
  23582. fn: function (){
  23583. var self=this;
  23584. return $core.withContext(function($ctx1) {
  23585. var $receiver;
  23586. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.isNil){
  23587. self._error_("XMLHttpRequest not available.");
  23588. } else {
  23589. return $recv($globals.XMLHttpRequest)._new();
  23590. };
  23591. return self;
  23592. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  23593. },
  23594. args: [],
  23595. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  23596. referencedClasses: ["XMLHttpRequest"],
  23597. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  23598. }),
  23599. $globals.NodePlatform);
  23600. $core.addMethod(
  23601. $core.method({
  23602. selector: "initialize",
  23603. protocol: 'testing',
  23604. fn: function (){
  23605. var self=this;
  23606. return $core.withContext(function($ctx1) {
  23607. var $1;
  23608. $1=self._isFeasible();
  23609. if($core.assert($1)){
  23610. $recv($globals.Platform)._registerIfNone_(self._new());
  23611. };
  23612. return self;
  23613. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.klass)});
  23614. },
  23615. args: [],
  23616. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  23617. referencedClasses: ["Platform"],
  23618. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  23619. }),
  23620. $globals.NodePlatform.klass);
  23621. $core.addMethod(
  23622. $core.method({
  23623. selector: "isFeasible",
  23624. protocol: 'testing',
  23625. fn: function (){
  23626. var self=this;
  23627. return $core.withContext(function($ctx1) {
  23628. return typeof global !== "undefined";
  23629. return self;
  23630. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.klass)});
  23631. },
  23632. args: [],
  23633. source: "isFeasible\x0a<return typeof global !== \x22undefined\x22>",
  23634. referencedClasses: [],
  23635. messageSends: []
  23636. }),
  23637. $globals.NodePlatform.klass);
  23638. });
  23639. define('amber/deploy',[
  23640. './helpers',
  23641. './compatibility', // pre-fetch, dep of ./boot
  23642. './boot', // pre-fetch, dep of ./helpers
  23643. // --- packages of the core Amber begin here ---
  23644. 'amber_core/Kernel-Objects',
  23645. 'amber_core/Kernel-Classes',
  23646. 'amber_core/Kernel-Methods',
  23647. 'amber_core/Kernel-Collections',
  23648. 'amber_core/Kernel-Infrastructure',
  23649. 'amber_core/Kernel-Promises',
  23650. 'amber_core/Kernel-Exceptions',
  23651. 'amber_core/Kernel-Announcements',
  23652. 'amber_core/Platform-Services',
  23653. 'amber/Platform'
  23654. // --- packages of the core Amber end here ---
  23655. ], function (amber) { return amber; });
  23656. define('amber/parser',['./boot'], function($boot) {
  23657. var $globals = $boot.globals, nil = $boot.nil;
  23658. $globals.SmalltalkParser = (function() {
  23659. "use strict";
  23660. /*
  23661. * Generated by PEG.js 0.9.0.
  23662. *
  23663. * http://pegjs.org/
  23664. */
  23665. function peg$subclass(child, parent) {
  23666. function ctor() { this.constructor = child; }
  23667. ctor.prototype = parent.prototype;
  23668. child.prototype = new ctor();
  23669. }
  23670. function peg$SyntaxError(message, expected, found, location) {
  23671. this.message = message;
  23672. this.expected = expected;
  23673. this.found = found;
  23674. this.location = location;
  23675. this.name = "SyntaxError";
  23676. if (typeof Error.captureStackTrace === "function") {
  23677. Error.captureStackTrace(this, peg$SyntaxError);
  23678. }
  23679. }
  23680. peg$subclass(peg$SyntaxError, Error);
  23681. function peg$parse(input) {
  23682. var options = arguments.length > 1 ? arguments[1] : {},
  23683. parser = this,
  23684. peg$FAILED = {},
  23685. peg$startRuleFunctions = { start: peg$parsestart },
  23686. peg$startRuleFunction = peg$parsestart,
  23687. peg$c0 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  23688. peg$c1 = { type: "class", value: "[ \\t\\v\\f\\u00A0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\v\\f\\u00A0\\uFEFF\\n\\r\\u2028\\u2029]" },
  23689. peg$c2 = "\"",
  23690. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  23691. peg$c4 = /^[^"]/,
  23692. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  23693. peg$c6 = ".",
  23694. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  23695. peg$c8 = /^[a-zA-Z]/,
  23696. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  23697. peg$c10 = /^[a-zA-Z0-9]/,
  23698. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  23699. peg$c12 = function(first, others) {return first + others.join("");},
  23700. peg$c13 = ":",
  23701. peg$c14 = { type: "literal", value: ":", description: "\":\"" },
  23702. peg$c15 = function(first, last) {return first + last;},
  23703. peg$c16 = /^[a-zA-Z0-9:]/,
  23704. peg$c17 = { type: "class", value: "[a-zA-Z0-9\\:]", description: "[a-zA-Z0-9\\:]" },
  23705. peg$c18 = /^[A-Z]/,
  23706. peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  23707. peg$c20 = "'",
  23708. peg$c21 = { type: "literal", value: "'", description: "\"'\"" },
  23709. peg$c22 = "''",
  23710. peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
  23711. peg$c24 = function() {return "'";},
  23712. peg$c25 = /^[^']/,
  23713. peg$c26 = { type: "class", value: "[^']", description: "[^']" },
  23714. peg$c27 = function(val) {
  23715. return $globals.ValueNode._new()
  23716. ._location_(location())
  23717. ._source_(text())
  23718. ._value_(val.join(""));
  23719. },
  23720. peg$c28 = "$",
  23721. peg$c29 = { type: "literal", value: "$", description: "\"$\"" },
  23722. peg$c30 = { type: "any", description: "any character" },
  23723. peg$c31 = function(char) {
  23724. return $globals.ValueNode._new()
  23725. ._location_(location())
  23726. ._source_(text())
  23727. ._value_(char);
  23728. },
  23729. peg$c32 = "#",
  23730. peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
  23731. peg$c34 = function(rest) {return rest;},
  23732. peg$c35 = function(node) {return node._value();},
  23733. peg$c36 = function(val) {
  23734. return $globals.ValueNode._new()
  23735. ._location_(location())
  23736. ._source_(text())
  23737. ._value_(val);
  23738. },
  23739. peg$c37 = function(n) {
  23740. return $globals.ValueNode._new()
  23741. ._location_(location())
  23742. ._source_(text())
  23743. ._value_(n);
  23744. },
  23745. peg$c38 = "e",
  23746. peg$c39 = { type: "literal", value: "e", description: "\"e\"" },
  23747. peg$c40 = function(n) {return parseFloat(n.join(""));},
  23748. peg$c41 = "-",
  23749. peg$c42 = { type: "literal", value: "-", description: "\"-\"" },
  23750. peg$c43 = "16r",
  23751. peg$c44 = { type: "literal", value: "16r", description: "\"16r\"" },
  23752. peg$c45 = /^[0-9a-fA-F]/,
  23753. peg$c46 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  23754. peg$c47 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  23755. peg$c48 = /^[0-9]/,
  23756. peg$c49 = { type: "class", value: "[0-9]", description: "[0-9]" },
  23757. peg$c50 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  23758. peg$c51 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));},
  23759. peg$c52 = "#(",
  23760. peg$c53 = { type: "literal", value: "#(", description: "\"#(\"" },
  23761. peg$c54 = ")",
  23762. peg$c55 = { type: "literal", value: ")", description: "\")\"" },
  23763. peg$c56 = function(rest) {
  23764. return rest
  23765. ._location_(location())
  23766. ._source_(text());
  23767. },
  23768. peg$c57 = "(",
  23769. peg$c58 = { type: "literal", value: "(", description: "\"(\"" },
  23770. peg$c59 = function(lit) {return lit._value();},
  23771. peg$c60 = function(lits) {
  23772. return $globals.ValueNode._new()
  23773. ._value_(lits);
  23774. },
  23775. peg$c61 = "{",
  23776. peg$c62 = { type: "literal", value: "{", description: "\"{\"" },
  23777. peg$c63 = "}",
  23778. peg$c64 = { type: "literal", value: "}", description: "\"}\"" },
  23779. peg$c65 = function(expressions) {
  23780. return $globals.DynamicArrayNode._new()
  23781. ._location_(location())
  23782. ._source_(text())
  23783. ._nodes_(expressions || []);
  23784. },
  23785. peg$c66 = "#{",
  23786. peg$c67 = { type: "literal", value: "#{", description: "\"#{\"" },
  23787. peg$c68 = function(expressions) {
  23788. return $globals.DynamicDictionaryNode._new()
  23789. ._location_(location())
  23790. ._source_(text())
  23791. ._nodes_(expressions || []);
  23792. },
  23793. peg$c69 = "true",
  23794. peg$c70 = { type: "literal", value: "true", description: "\"true\"" },
  23795. peg$c71 = function() {return true;},
  23796. peg$c72 = "false",
  23797. peg$c73 = { type: "literal", value: "false", description: "\"false\"" },
  23798. peg$c74 = function() {return false;},
  23799. peg$c75 = "nil",
  23800. peg$c76 = { type: "literal", value: "nil", description: "\"nil\"" },
  23801. peg$c77 = function() {return nil;},
  23802. peg$c78 = function(val) {
  23803. return $globals.ValueNode._new()
  23804. ._location_(location())
  23805. ._source_(text())
  23806. ._value_(val);
  23807. },
  23808. peg$c79 = function(identifier) {
  23809. return $globals.VariableNode._new()
  23810. ._location_(location())
  23811. ._source_(text())
  23812. ._value_(identifier);
  23813. },
  23814. peg$c80 = /^[\\+*\/=><,@%~|&\-]/,
  23815. peg$c81 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  23816. peg$c82 = function(bin) {return bin.join("");},
  23817. peg$c83 = function(key, arg) {return {key:key, arg:arg};},
  23818. peg$c84 = function(pairs) {
  23819. var selector = "";
  23820. var params = [];
  23821. for(var i = 0; i < pairs.length; i++){
  23822. selector += pairs[i].key;
  23823. params.push(pairs[i].arg);
  23824. }
  23825. return [selector, params];
  23826. },
  23827. peg$c85 = function(selector, arg) {return [selector, [arg]];},
  23828. peg$c86 = function(selector) {return [selector, []];},
  23829. peg$c87 = function(expression) {return expression;},
  23830. peg$c88 = function(first, others) { return [first].concat(others); },
  23831. peg$c89 = ":=",
  23832. peg$c90 = { type: "literal", value: ":=", description: "\":=\"" },
  23833. peg$c91 = function(variable, expression) {
  23834. return $globals.AssignmentNode._new()
  23835. ._location_(location())
  23836. ._source_(text())
  23837. ._left_(variable)
  23838. ._right_(expression);
  23839. },
  23840. peg$c92 = "^",
  23841. peg$c93 = { type: "literal", value: "^", description: "\"^\"" },
  23842. peg$c94 = function(expression) {
  23843. return $globals.ReturnNode._new()
  23844. ._location_(location())
  23845. ._source_(text())
  23846. ._nodes_([expression]);
  23847. },
  23848. peg$c95 = "|",
  23849. peg$c96 = { type: "literal", value: "|", description: "\"|\"" },
  23850. peg$c97 = function(variable) {return variable;},
  23851. peg$c98 = function(vars) {return vars;},
  23852. peg$c99 = function(param) {return param;},
  23853. peg$c100 = function(params) {return params;},
  23854. peg$c101 = function(ret) {return [ret];},
  23855. peg$c102 = function(exps, ret) {
  23856. var expressions = exps;
  23857. expressions.push(ret);
  23858. return expressions;
  23859. },
  23860. peg$c103 = function(expressions) {
  23861. return expressions || [];
  23862. },
  23863. peg$c104 = function(js) { return js; },
  23864. peg$c105 = function(temps, statements) {
  23865. return $globals.SequenceNode._new()
  23866. ._location_(location())
  23867. ._source_(text())
  23868. ._temps_(temps || [])
  23869. ._nodes_(statements || []);
  23870. },
  23871. peg$c106 = "[",
  23872. peg$c107 = { type: "literal", value: "[", description: "\"[\"" },
  23873. peg$c108 = "]",
  23874. peg$c109 = { type: "literal", value: "]", description: "\"]\"" },
  23875. peg$c110 = function(params, sequence) {
  23876. return $globals.BlockNode._new()
  23877. ._location_(location())
  23878. ._source_(text())
  23879. ._parameters_(params || [])
  23880. ._nodes_([sequence._asBlockSequenceNode()]);
  23881. },
  23882. peg$c111 = function(selector) {
  23883. return $globals.SendNode._new()
  23884. ._location_(location())
  23885. ._source_(text())
  23886. ._selector_(selector);
  23887. },
  23888. peg$c112 = function(message, tail) {
  23889. if(tail) {
  23890. return tail._valueForReceiver_(message);
  23891. }
  23892. else {
  23893. return message;
  23894. }
  23895. },
  23896. peg$c113 = function(receiver, tail) {
  23897. if(tail) {
  23898. return tail._valueForReceiver_(receiver);
  23899. }
  23900. else {
  23901. return receiver;
  23902. }
  23903. },
  23904. peg$c114 = function(selector, arg) {
  23905. return $globals.SendNode._new()
  23906. ._location_(location())
  23907. ._source_(text())
  23908. ._selector_(selector)
  23909. ._arguments_([arg]);
  23910. },
  23911. peg$c115 = function(message, tail) {
  23912. if(tail) {
  23913. return tail._valueForReceiver_(message);
  23914. }
  23915. else {
  23916. return message;
  23917. }
  23918. },
  23919. peg$c116 = function(pairs) {
  23920. var selector = "";
  23921. var args = [];
  23922. for(var i = 0; i < pairs.length; i++) {
  23923. selector += pairs[i].key;
  23924. args.push(pairs[i].arg);
  23925. }
  23926. return $globals.SendNode._new()
  23927. ._location_(location())
  23928. ._source_(text())
  23929. ._selector_(selector)
  23930. ._arguments_(args);
  23931. },
  23932. peg$c117 = function(send) { return send._isSendNode(); },
  23933. peg$c118 = ";",
  23934. peg$c119 = { type: "literal", value: ";", description: "\";\"" },
  23935. peg$c120 = function(send, mess) {return mess;},
  23936. peg$c121 = function(send, messages) {
  23937. messages.unshift(send);
  23938. return $globals.CascadeNode._new()
  23939. ._location_(location())
  23940. ._source_(text())
  23941. ._nodes_(messages);
  23942. },
  23943. peg$c122 = "<",
  23944. peg$c123 = { type: "literal", value: "<", description: "\"<\"" },
  23945. peg$c124 = ">>",
  23946. peg$c125 = { type: "literal", value: ">>", description: "\">>\"" },
  23947. peg$c126 = function() {return ">";},
  23948. peg$c127 = /^[^>]/,
  23949. peg$c128 = { type: "class", value: "[^>]", description: "[^>]" },
  23950. peg$c129 = ">",
  23951. peg$c130 = { type: "literal", value: ">", description: "\">\"" },
  23952. peg$c131 = function(val) {
  23953. return $globals.JSStatementNode._new()
  23954. ._location_(location())
  23955. ._source_(val.join(""))
  23956. },
  23957. peg$c132 = function(pattern, sequence) {
  23958. return $globals.MethodNode._new()
  23959. ._location_(location())
  23960. ._source_(text())
  23961. ._selector_(pattern[0])
  23962. ._arguments_(pattern[1])
  23963. ._nodes_([sequence]);
  23964. },
  23965. peg$c133 = function(send) { return send._isSendNode() && send._selector() === "->" },
  23966. peg$c134 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  23967. peg$c135 = function(first, others) { return first.concat.apply(first, others); },
  23968. peg$currPos = 0,
  23969. peg$savedPos = 0,
  23970. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  23971. peg$maxFailPos = 0,
  23972. peg$maxFailExpected = [],
  23973. peg$silentFails = 0,
  23974. peg$resultsCache = {},
  23975. peg$result;
  23976. if ("startRule" in options) {
  23977. if (!(options.startRule in peg$startRuleFunctions)) {
  23978. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  23979. }
  23980. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  23981. }
  23982. function text() {
  23983. return input.substring(peg$savedPos, peg$currPos);
  23984. }
  23985. function location() {
  23986. return peg$computeLocation(peg$savedPos, peg$currPos);
  23987. }
  23988. function expected(description) {
  23989. throw peg$buildException(
  23990. null,
  23991. [{ type: "other", description: description }],
  23992. input.substring(peg$savedPos, peg$currPos),
  23993. peg$computeLocation(peg$savedPos, peg$currPos)
  23994. );
  23995. }
  23996. function error(message) {
  23997. throw peg$buildException(
  23998. message,
  23999. null,
  24000. input.substring(peg$savedPos, peg$currPos),
  24001. peg$computeLocation(peg$savedPos, peg$currPos)
  24002. );
  24003. }
  24004. function peg$computePosDetails(pos) {
  24005. var details = peg$posDetailsCache[pos],
  24006. p, ch;
  24007. if (details) {
  24008. return details;
  24009. } else {
  24010. p = pos - 1;
  24011. while (!peg$posDetailsCache[p]) {
  24012. p--;
  24013. }
  24014. details = peg$posDetailsCache[p];
  24015. details = {
  24016. line: details.line,
  24017. column: details.column,
  24018. seenCR: details.seenCR
  24019. };
  24020. while (p < pos) {
  24021. ch = input.charAt(p);
  24022. if (ch === "\n") {
  24023. if (!details.seenCR) { details.line++; }
  24024. details.column = 1;
  24025. details.seenCR = false;
  24026. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  24027. details.line++;
  24028. details.column = 1;
  24029. details.seenCR = true;
  24030. } else {
  24031. details.column++;
  24032. details.seenCR = false;
  24033. }
  24034. p++;
  24035. }
  24036. peg$posDetailsCache[pos] = details;
  24037. return details;
  24038. }
  24039. }
  24040. function peg$computeLocation(startPos, endPos) {
  24041. var startPosDetails = peg$computePosDetails(startPos),
  24042. endPosDetails = peg$computePosDetails(endPos);
  24043. return {
  24044. start: {
  24045. offset: startPos,
  24046. line: startPosDetails.line,
  24047. column: startPosDetails.column
  24048. },
  24049. end: {
  24050. offset: endPos,
  24051. line: endPosDetails.line,
  24052. column: endPosDetails.column
  24053. }
  24054. };
  24055. }
  24056. function peg$fail(expected) {
  24057. if (peg$currPos < peg$maxFailPos) { return; }
  24058. if (peg$currPos > peg$maxFailPos) {
  24059. peg$maxFailPos = peg$currPos;
  24060. peg$maxFailExpected = [];
  24061. }
  24062. peg$maxFailExpected.push(expected);
  24063. }
  24064. function peg$buildException(message, expected, found, location) {
  24065. function cleanupExpected(expected) {
  24066. var i = 1;
  24067. expected.sort(function(a, b) {
  24068. if (a.description < b.description) {
  24069. return -1;
  24070. } else if (a.description > b.description) {
  24071. return 1;
  24072. } else {
  24073. return 0;
  24074. }
  24075. });
  24076. while (i < expected.length) {
  24077. if (expected[i - 1] === expected[i]) {
  24078. expected.splice(i, 1);
  24079. } else {
  24080. i++;
  24081. }
  24082. }
  24083. }
  24084. function buildMessage(expected, found) {
  24085. function stringEscape(s) {
  24086. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  24087. return s
  24088. .replace(/\\/g, '\\\\')
  24089. .replace(/"/g, '\\"')
  24090. .replace(/\x08/g, '\\b')
  24091. .replace(/\t/g, '\\t')
  24092. .replace(/\n/g, '\\n')
  24093. .replace(/\f/g, '\\f')
  24094. .replace(/\r/g, '\\r')
  24095. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  24096. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  24097. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  24098. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  24099. }
  24100. var expectedDescs = new Array(expected.length),
  24101. expectedDesc, foundDesc, i;
  24102. for (i = 0; i < expected.length; i++) {
  24103. expectedDescs[i] = expected[i].description;
  24104. }
  24105. expectedDesc = expected.length > 1
  24106. ? expectedDescs.slice(0, -1).join(", ")
  24107. + " or "
  24108. + expectedDescs[expected.length - 1]
  24109. : expectedDescs[0];
  24110. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  24111. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  24112. }
  24113. if (expected !== null) {
  24114. cleanupExpected(expected);
  24115. }
  24116. return new peg$SyntaxError(
  24117. message !== null ? message : buildMessage(expected, found),
  24118. expected,
  24119. found,
  24120. location
  24121. );
  24122. }
  24123. function peg$parsestart() {
  24124. var s0;
  24125. var key = peg$currPos * 61 + 0,
  24126. cached = peg$resultsCache[key];
  24127. if (cached) {
  24128. peg$currPos = cached.nextPos;
  24129. return cached.result;
  24130. }
  24131. s0 = peg$parsemethod();
  24132. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24133. return s0;
  24134. }
  24135. function peg$parseseparator() {
  24136. var s0, s1;
  24137. var key = peg$currPos * 61 + 1,
  24138. cached = peg$resultsCache[key];
  24139. if (cached) {
  24140. peg$currPos = cached.nextPos;
  24141. return cached.result;
  24142. }
  24143. s0 = [];
  24144. if (peg$c0.test(input.charAt(peg$currPos))) {
  24145. s1 = input.charAt(peg$currPos);
  24146. peg$currPos++;
  24147. } else {
  24148. s1 = peg$FAILED;
  24149. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  24150. }
  24151. if (s1 !== peg$FAILED) {
  24152. while (s1 !== peg$FAILED) {
  24153. s0.push(s1);
  24154. if (peg$c0.test(input.charAt(peg$currPos))) {
  24155. s1 = input.charAt(peg$currPos);
  24156. peg$currPos++;
  24157. } else {
  24158. s1 = peg$FAILED;
  24159. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  24160. }
  24161. }
  24162. } else {
  24163. s0 = peg$FAILED;
  24164. }
  24165. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24166. return s0;
  24167. }
  24168. function peg$parsecomments() {
  24169. var s0, s1, s2, s3, s4;
  24170. var key = peg$currPos * 61 + 2,
  24171. cached = peg$resultsCache[key];
  24172. if (cached) {
  24173. peg$currPos = cached.nextPos;
  24174. return cached.result;
  24175. }
  24176. s0 = [];
  24177. s1 = peg$currPos;
  24178. if (input.charCodeAt(peg$currPos) === 34) {
  24179. s2 = peg$c2;
  24180. peg$currPos++;
  24181. } else {
  24182. s2 = peg$FAILED;
  24183. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24184. }
  24185. if (s2 !== peg$FAILED) {
  24186. s3 = [];
  24187. if (peg$c4.test(input.charAt(peg$currPos))) {
  24188. s4 = input.charAt(peg$currPos);
  24189. peg$currPos++;
  24190. } else {
  24191. s4 = peg$FAILED;
  24192. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24193. }
  24194. while (s4 !== peg$FAILED) {
  24195. s3.push(s4);
  24196. if (peg$c4.test(input.charAt(peg$currPos))) {
  24197. s4 = input.charAt(peg$currPos);
  24198. peg$currPos++;
  24199. } else {
  24200. s4 = peg$FAILED;
  24201. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24202. }
  24203. }
  24204. if (s3 !== peg$FAILED) {
  24205. if (input.charCodeAt(peg$currPos) === 34) {
  24206. s4 = peg$c2;
  24207. peg$currPos++;
  24208. } else {
  24209. s4 = peg$FAILED;
  24210. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24211. }
  24212. if (s4 !== peg$FAILED) {
  24213. s2 = [s2, s3, s4];
  24214. s1 = s2;
  24215. } else {
  24216. peg$currPos = s1;
  24217. s1 = peg$FAILED;
  24218. }
  24219. } else {
  24220. peg$currPos = s1;
  24221. s1 = peg$FAILED;
  24222. }
  24223. } else {
  24224. peg$currPos = s1;
  24225. s1 = peg$FAILED;
  24226. }
  24227. if (s1 !== peg$FAILED) {
  24228. while (s1 !== peg$FAILED) {
  24229. s0.push(s1);
  24230. s1 = peg$currPos;
  24231. if (input.charCodeAt(peg$currPos) === 34) {
  24232. s2 = peg$c2;
  24233. peg$currPos++;
  24234. } else {
  24235. s2 = peg$FAILED;
  24236. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24237. }
  24238. if (s2 !== peg$FAILED) {
  24239. s3 = [];
  24240. if (peg$c4.test(input.charAt(peg$currPos))) {
  24241. s4 = input.charAt(peg$currPos);
  24242. peg$currPos++;
  24243. } else {
  24244. s4 = peg$FAILED;
  24245. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24246. }
  24247. while (s4 !== peg$FAILED) {
  24248. s3.push(s4);
  24249. if (peg$c4.test(input.charAt(peg$currPos))) {
  24250. s4 = input.charAt(peg$currPos);
  24251. peg$currPos++;
  24252. } else {
  24253. s4 = peg$FAILED;
  24254. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24255. }
  24256. }
  24257. if (s3 !== peg$FAILED) {
  24258. if (input.charCodeAt(peg$currPos) === 34) {
  24259. s4 = peg$c2;
  24260. peg$currPos++;
  24261. } else {
  24262. s4 = peg$FAILED;
  24263. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24264. }
  24265. if (s4 !== peg$FAILED) {
  24266. s2 = [s2, s3, s4];
  24267. s1 = s2;
  24268. } else {
  24269. peg$currPos = s1;
  24270. s1 = peg$FAILED;
  24271. }
  24272. } else {
  24273. peg$currPos = s1;
  24274. s1 = peg$FAILED;
  24275. }
  24276. } else {
  24277. peg$currPos = s1;
  24278. s1 = peg$FAILED;
  24279. }
  24280. }
  24281. } else {
  24282. s0 = peg$FAILED;
  24283. }
  24284. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24285. return s0;
  24286. }
  24287. function peg$parsews() {
  24288. var s0, s1;
  24289. var key = peg$currPos * 61 + 3,
  24290. cached = peg$resultsCache[key];
  24291. if (cached) {
  24292. peg$currPos = cached.nextPos;
  24293. return cached.result;
  24294. }
  24295. s0 = [];
  24296. s1 = peg$parseseparator();
  24297. if (s1 === peg$FAILED) {
  24298. s1 = peg$parsecomments();
  24299. }
  24300. while (s1 !== peg$FAILED) {
  24301. s0.push(s1);
  24302. s1 = peg$parseseparator();
  24303. if (s1 === peg$FAILED) {
  24304. s1 = peg$parsecomments();
  24305. }
  24306. }
  24307. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24308. return s0;
  24309. }
  24310. function peg$parsemaybeDotsWs() {
  24311. var s0, s1;
  24312. var key = peg$currPos * 61 + 4,
  24313. cached = peg$resultsCache[key];
  24314. if (cached) {
  24315. peg$currPos = cached.nextPos;
  24316. return cached.result;
  24317. }
  24318. s0 = [];
  24319. if (input.charCodeAt(peg$currPos) === 46) {
  24320. s1 = peg$c6;
  24321. peg$currPos++;
  24322. } else {
  24323. s1 = peg$FAILED;
  24324. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24325. }
  24326. if (s1 === peg$FAILED) {
  24327. s1 = peg$parseseparator();
  24328. if (s1 === peg$FAILED) {
  24329. s1 = peg$parsecomments();
  24330. }
  24331. }
  24332. while (s1 !== peg$FAILED) {
  24333. s0.push(s1);
  24334. if (input.charCodeAt(peg$currPos) === 46) {
  24335. s1 = peg$c6;
  24336. peg$currPos++;
  24337. } else {
  24338. s1 = peg$FAILED;
  24339. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24340. }
  24341. if (s1 === peg$FAILED) {
  24342. s1 = peg$parseseparator();
  24343. if (s1 === peg$FAILED) {
  24344. s1 = peg$parsecomments();
  24345. }
  24346. }
  24347. }
  24348. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24349. return s0;
  24350. }
  24351. function peg$parseidentifier() {
  24352. var s0, s1, s2, s3;
  24353. var key = peg$currPos * 61 + 5,
  24354. cached = peg$resultsCache[key];
  24355. if (cached) {
  24356. peg$currPos = cached.nextPos;
  24357. return cached.result;
  24358. }
  24359. s0 = peg$currPos;
  24360. if (peg$c8.test(input.charAt(peg$currPos))) {
  24361. s1 = input.charAt(peg$currPos);
  24362. peg$currPos++;
  24363. } else {
  24364. s1 = peg$FAILED;
  24365. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24366. }
  24367. if (s1 !== peg$FAILED) {
  24368. s2 = [];
  24369. if (peg$c10.test(input.charAt(peg$currPos))) {
  24370. s3 = input.charAt(peg$currPos);
  24371. peg$currPos++;
  24372. } else {
  24373. s3 = peg$FAILED;
  24374. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24375. }
  24376. while (s3 !== peg$FAILED) {
  24377. s2.push(s3);
  24378. if (peg$c10.test(input.charAt(peg$currPos))) {
  24379. s3 = input.charAt(peg$currPos);
  24380. peg$currPos++;
  24381. } else {
  24382. s3 = peg$FAILED;
  24383. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24384. }
  24385. }
  24386. if (s2 !== peg$FAILED) {
  24387. peg$savedPos = s0;
  24388. s1 = peg$c12(s1, s2);
  24389. s0 = s1;
  24390. } else {
  24391. peg$currPos = s0;
  24392. s0 = peg$FAILED;
  24393. }
  24394. } else {
  24395. peg$currPos = s0;
  24396. s0 = peg$FAILED;
  24397. }
  24398. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24399. return s0;
  24400. }
  24401. function peg$parsekeyword() {
  24402. var s0, s1, s2;
  24403. var key = peg$currPos * 61 + 6,
  24404. cached = peg$resultsCache[key];
  24405. if (cached) {
  24406. peg$currPos = cached.nextPos;
  24407. return cached.result;
  24408. }
  24409. s0 = peg$currPos;
  24410. s1 = peg$parseidentifier();
  24411. if (s1 !== peg$FAILED) {
  24412. if (input.charCodeAt(peg$currPos) === 58) {
  24413. s2 = peg$c13;
  24414. peg$currPos++;
  24415. } else {
  24416. s2 = peg$FAILED;
  24417. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  24418. }
  24419. if (s2 !== peg$FAILED) {
  24420. peg$savedPos = s0;
  24421. s1 = peg$c15(s1, s2);
  24422. s0 = s1;
  24423. } else {
  24424. peg$currPos = s0;
  24425. s0 = peg$FAILED;
  24426. }
  24427. } else {
  24428. peg$currPos = s0;
  24429. s0 = peg$FAILED;
  24430. }
  24431. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24432. return s0;
  24433. }
  24434. function peg$parseselector() {
  24435. var s0, s1, s2, s3;
  24436. var key = peg$currPos * 61 + 7,
  24437. cached = peg$resultsCache[key];
  24438. if (cached) {
  24439. peg$currPos = cached.nextPos;
  24440. return cached.result;
  24441. }
  24442. s0 = peg$currPos;
  24443. if (peg$c8.test(input.charAt(peg$currPos))) {
  24444. s1 = input.charAt(peg$currPos);
  24445. peg$currPos++;
  24446. } else {
  24447. s1 = peg$FAILED;
  24448. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24449. }
  24450. if (s1 !== peg$FAILED) {
  24451. s2 = [];
  24452. if (peg$c16.test(input.charAt(peg$currPos))) {
  24453. s3 = input.charAt(peg$currPos);
  24454. peg$currPos++;
  24455. } else {
  24456. s3 = peg$FAILED;
  24457. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24458. }
  24459. while (s3 !== peg$FAILED) {
  24460. s2.push(s3);
  24461. if (peg$c16.test(input.charAt(peg$currPos))) {
  24462. s3 = input.charAt(peg$currPos);
  24463. peg$currPos++;
  24464. } else {
  24465. s3 = peg$FAILED;
  24466. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24467. }
  24468. }
  24469. if (s2 !== peg$FAILED) {
  24470. peg$savedPos = s0;
  24471. s1 = peg$c12(s1, s2);
  24472. s0 = s1;
  24473. } else {
  24474. peg$currPos = s0;
  24475. s0 = peg$FAILED;
  24476. }
  24477. } else {
  24478. peg$currPos = s0;
  24479. s0 = peg$FAILED;
  24480. }
  24481. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24482. return s0;
  24483. }
  24484. function peg$parseclassName() {
  24485. var s0, s1, s2, s3;
  24486. var key = peg$currPos * 61 + 8,
  24487. cached = peg$resultsCache[key];
  24488. if (cached) {
  24489. peg$currPos = cached.nextPos;
  24490. return cached.result;
  24491. }
  24492. s0 = peg$currPos;
  24493. if (peg$c18.test(input.charAt(peg$currPos))) {
  24494. s1 = input.charAt(peg$currPos);
  24495. peg$currPos++;
  24496. } else {
  24497. s1 = peg$FAILED;
  24498. if (peg$silentFails === 0) { peg$fail(peg$c19); }
  24499. }
  24500. if (s1 !== peg$FAILED) {
  24501. s2 = [];
  24502. if (peg$c10.test(input.charAt(peg$currPos))) {
  24503. s3 = input.charAt(peg$currPos);
  24504. peg$currPos++;
  24505. } else {
  24506. s3 = peg$FAILED;
  24507. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24508. }
  24509. while (s3 !== peg$FAILED) {
  24510. s2.push(s3);
  24511. if (peg$c10.test(input.charAt(peg$currPos))) {
  24512. s3 = input.charAt(peg$currPos);
  24513. peg$currPos++;
  24514. } else {
  24515. s3 = peg$FAILED;
  24516. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24517. }
  24518. }
  24519. if (s2 !== peg$FAILED) {
  24520. peg$savedPos = s0;
  24521. s1 = peg$c12(s1, s2);
  24522. s0 = s1;
  24523. } else {
  24524. peg$currPos = s0;
  24525. s0 = peg$FAILED;
  24526. }
  24527. } else {
  24528. peg$currPos = s0;
  24529. s0 = peg$FAILED;
  24530. }
  24531. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24532. return s0;
  24533. }
  24534. function peg$parsestring() {
  24535. var s0, s1, s2, s3, s4;
  24536. var key = peg$currPos * 61 + 9,
  24537. cached = peg$resultsCache[key];
  24538. if (cached) {
  24539. peg$currPos = cached.nextPos;
  24540. return cached.result;
  24541. }
  24542. s0 = peg$currPos;
  24543. if (input.charCodeAt(peg$currPos) === 39) {
  24544. s1 = peg$c20;
  24545. peg$currPos++;
  24546. } else {
  24547. s1 = peg$FAILED;
  24548. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24549. }
  24550. if (s1 !== peg$FAILED) {
  24551. s2 = [];
  24552. s3 = peg$currPos;
  24553. if (input.substr(peg$currPos, 2) === peg$c22) {
  24554. s4 = peg$c22;
  24555. peg$currPos += 2;
  24556. } else {
  24557. s4 = peg$FAILED;
  24558. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24559. }
  24560. if (s4 !== peg$FAILED) {
  24561. peg$savedPos = s3;
  24562. s4 = peg$c24();
  24563. }
  24564. s3 = s4;
  24565. if (s3 === peg$FAILED) {
  24566. if (peg$c25.test(input.charAt(peg$currPos))) {
  24567. s3 = input.charAt(peg$currPos);
  24568. peg$currPos++;
  24569. } else {
  24570. s3 = peg$FAILED;
  24571. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24572. }
  24573. }
  24574. while (s3 !== peg$FAILED) {
  24575. s2.push(s3);
  24576. s3 = peg$currPos;
  24577. if (input.substr(peg$currPos, 2) === peg$c22) {
  24578. s4 = peg$c22;
  24579. peg$currPos += 2;
  24580. } else {
  24581. s4 = peg$FAILED;
  24582. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24583. }
  24584. if (s4 !== peg$FAILED) {
  24585. peg$savedPos = s3;
  24586. s4 = peg$c24();
  24587. }
  24588. s3 = s4;
  24589. if (s3 === peg$FAILED) {
  24590. if (peg$c25.test(input.charAt(peg$currPos))) {
  24591. s3 = input.charAt(peg$currPos);
  24592. peg$currPos++;
  24593. } else {
  24594. s3 = peg$FAILED;
  24595. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24596. }
  24597. }
  24598. }
  24599. if (s2 !== peg$FAILED) {
  24600. if (input.charCodeAt(peg$currPos) === 39) {
  24601. s3 = peg$c20;
  24602. peg$currPos++;
  24603. } else {
  24604. s3 = peg$FAILED;
  24605. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24606. }
  24607. if (s3 !== peg$FAILED) {
  24608. peg$savedPos = s0;
  24609. s1 = peg$c27(s2);
  24610. s0 = s1;
  24611. } else {
  24612. peg$currPos = s0;
  24613. s0 = peg$FAILED;
  24614. }
  24615. } else {
  24616. peg$currPos = s0;
  24617. s0 = peg$FAILED;
  24618. }
  24619. } else {
  24620. peg$currPos = s0;
  24621. s0 = peg$FAILED;
  24622. }
  24623. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24624. return s0;
  24625. }
  24626. function peg$parsecharacter() {
  24627. var s0, s1, s2;
  24628. var key = peg$currPos * 61 + 10,
  24629. cached = peg$resultsCache[key];
  24630. if (cached) {
  24631. peg$currPos = cached.nextPos;
  24632. return cached.result;
  24633. }
  24634. s0 = peg$currPos;
  24635. if (input.charCodeAt(peg$currPos) === 36) {
  24636. s1 = peg$c28;
  24637. peg$currPos++;
  24638. } else {
  24639. s1 = peg$FAILED;
  24640. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  24641. }
  24642. if (s1 !== peg$FAILED) {
  24643. if (input.length > peg$currPos) {
  24644. s2 = input.charAt(peg$currPos);
  24645. peg$currPos++;
  24646. } else {
  24647. s2 = peg$FAILED;
  24648. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  24649. }
  24650. if (s2 !== peg$FAILED) {
  24651. peg$savedPos = s0;
  24652. s1 = peg$c31(s2);
  24653. s0 = s1;
  24654. } else {
  24655. peg$currPos = s0;
  24656. s0 = peg$FAILED;
  24657. }
  24658. } else {
  24659. peg$currPos = s0;
  24660. s0 = peg$FAILED;
  24661. }
  24662. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24663. return s0;
  24664. }
  24665. function peg$parsesymbol() {
  24666. var s0, s1, s2;
  24667. var key = peg$currPos * 61 + 11,
  24668. cached = peg$resultsCache[key];
  24669. if (cached) {
  24670. peg$currPos = cached.nextPos;
  24671. return cached.result;
  24672. }
  24673. s0 = peg$currPos;
  24674. if (input.charCodeAt(peg$currPos) === 35) {
  24675. s1 = peg$c32;
  24676. peg$currPos++;
  24677. } else {
  24678. s1 = peg$FAILED;
  24679. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  24680. }
  24681. if (s1 !== peg$FAILED) {
  24682. s2 = peg$parsebareSymbol();
  24683. if (s2 !== peg$FAILED) {
  24684. peg$savedPos = s0;
  24685. s1 = peg$c34(s2);
  24686. s0 = s1;
  24687. } else {
  24688. peg$currPos = s0;
  24689. s0 = peg$FAILED;
  24690. }
  24691. } else {
  24692. peg$currPos = s0;
  24693. s0 = peg$FAILED;
  24694. }
  24695. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24696. return s0;
  24697. }
  24698. function peg$parsebareSymbol() {
  24699. var s0, s1, s2;
  24700. var key = peg$currPos * 61 + 12,
  24701. cached = peg$resultsCache[key];
  24702. if (cached) {
  24703. peg$currPos = cached.nextPos;
  24704. return cached.result;
  24705. }
  24706. s0 = peg$currPos;
  24707. s1 = peg$parseselector();
  24708. if (s1 === peg$FAILED) {
  24709. s1 = peg$parsebinarySelector();
  24710. if (s1 === peg$FAILED) {
  24711. s1 = peg$currPos;
  24712. s2 = peg$parsestring();
  24713. if (s2 !== peg$FAILED) {
  24714. peg$savedPos = s1;
  24715. s2 = peg$c35(s2);
  24716. }
  24717. s1 = s2;
  24718. }
  24719. }
  24720. if (s1 !== peg$FAILED) {
  24721. peg$savedPos = s0;
  24722. s1 = peg$c36(s1);
  24723. }
  24724. s0 = s1;
  24725. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24726. return s0;
  24727. }
  24728. function peg$parsenumber() {
  24729. var s0, s1;
  24730. var key = peg$currPos * 61 + 13,
  24731. cached = peg$resultsCache[key];
  24732. if (cached) {
  24733. peg$currPos = cached.nextPos;
  24734. return cached.result;
  24735. }
  24736. s0 = peg$currPos;
  24737. s1 = peg$parsenumberExp();
  24738. if (s1 === peg$FAILED) {
  24739. s1 = peg$parsehex();
  24740. if (s1 === peg$FAILED) {
  24741. s1 = peg$parsefloat();
  24742. if (s1 === peg$FAILED) {
  24743. s1 = peg$parseinteger();
  24744. }
  24745. }
  24746. }
  24747. if (s1 !== peg$FAILED) {
  24748. peg$savedPos = s0;
  24749. s1 = peg$c37(s1);
  24750. }
  24751. s0 = s1;
  24752. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24753. return s0;
  24754. }
  24755. function peg$parsenumberExp() {
  24756. var s0, s1, s2, s3, s4;
  24757. var key = peg$currPos * 61 + 14,
  24758. cached = peg$resultsCache[key];
  24759. if (cached) {
  24760. peg$currPos = cached.nextPos;
  24761. return cached.result;
  24762. }
  24763. s0 = peg$currPos;
  24764. s1 = peg$currPos;
  24765. s2 = peg$parsefloat();
  24766. if (s2 === peg$FAILED) {
  24767. s2 = peg$parseinteger();
  24768. }
  24769. if (s2 !== peg$FAILED) {
  24770. if (input.charCodeAt(peg$currPos) === 101) {
  24771. s3 = peg$c38;
  24772. peg$currPos++;
  24773. } else {
  24774. s3 = peg$FAILED;
  24775. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  24776. }
  24777. if (s3 !== peg$FAILED) {
  24778. s4 = peg$parseinteger();
  24779. if (s4 !== peg$FAILED) {
  24780. s2 = [s2, s3, s4];
  24781. s1 = s2;
  24782. } else {
  24783. peg$currPos = s1;
  24784. s1 = peg$FAILED;
  24785. }
  24786. } else {
  24787. peg$currPos = s1;
  24788. s1 = peg$FAILED;
  24789. }
  24790. } else {
  24791. peg$currPos = s1;
  24792. s1 = peg$FAILED;
  24793. }
  24794. if (s1 !== peg$FAILED) {
  24795. peg$savedPos = s0;
  24796. s1 = peg$c40(s1);
  24797. }
  24798. s0 = s1;
  24799. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24800. return s0;
  24801. }
  24802. function peg$parsehex() {
  24803. var s0, s1, s2, s3, s4;
  24804. var key = peg$currPos * 61 + 15,
  24805. cached = peg$resultsCache[key];
  24806. if (cached) {
  24807. peg$currPos = cached.nextPos;
  24808. return cached.result;
  24809. }
  24810. s0 = peg$currPos;
  24811. if (input.charCodeAt(peg$currPos) === 45) {
  24812. s1 = peg$c41;
  24813. peg$currPos++;
  24814. } else {
  24815. s1 = peg$FAILED;
  24816. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  24817. }
  24818. if (s1 === peg$FAILED) {
  24819. s1 = null;
  24820. }
  24821. if (s1 !== peg$FAILED) {
  24822. if (input.substr(peg$currPos, 3) === peg$c43) {
  24823. s2 = peg$c43;
  24824. peg$currPos += 3;
  24825. } else {
  24826. s2 = peg$FAILED;
  24827. if (peg$silentFails === 0) { peg$fail(peg$c44); }
  24828. }
  24829. if (s2 !== peg$FAILED) {
  24830. s3 = [];
  24831. if (peg$c45.test(input.charAt(peg$currPos))) {
  24832. s4 = input.charAt(peg$currPos);
  24833. peg$currPos++;
  24834. } else {
  24835. s4 = peg$FAILED;
  24836. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  24837. }
  24838. if (s4 !== peg$FAILED) {
  24839. while (s4 !== peg$FAILED) {
  24840. s3.push(s4);
  24841. if (peg$c45.test(input.charAt(peg$currPos))) {
  24842. s4 = input.charAt(peg$currPos);
  24843. peg$currPos++;
  24844. } else {
  24845. s4 = peg$FAILED;
  24846. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  24847. }
  24848. }
  24849. } else {
  24850. s3 = peg$FAILED;
  24851. }
  24852. if (s3 !== peg$FAILED) {
  24853. peg$savedPos = s0;
  24854. s1 = peg$c47(s1, s3);
  24855. s0 = s1;
  24856. } else {
  24857. peg$currPos = s0;
  24858. s0 = peg$FAILED;
  24859. }
  24860. } else {
  24861. peg$currPos = s0;
  24862. s0 = peg$FAILED;
  24863. }
  24864. } else {
  24865. peg$currPos = s0;
  24866. s0 = peg$FAILED;
  24867. }
  24868. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24869. return s0;
  24870. }
  24871. function peg$parsefloat() {
  24872. var s0, s1, s2, s3, s4, s5;
  24873. var key = peg$currPos * 61 + 16,
  24874. cached = peg$resultsCache[key];
  24875. if (cached) {
  24876. peg$currPos = cached.nextPos;
  24877. return cached.result;
  24878. }
  24879. s0 = peg$currPos;
  24880. if (input.charCodeAt(peg$currPos) === 45) {
  24881. s1 = peg$c41;
  24882. peg$currPos++;
  24883. } else {
  24884. s1 = peg$FAILED;
  24885. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  24886. }
  24887. if (s1 === peg$FAILED) {
  24888. s1 = null;
  24889. }
  24890. if (s1 !== peg$FAILED) {
  24891. s2 = [];
  24892. if (peg$c48.test(input.charAt(peg$currPos))) {
  24893. s3 = input.charAt(peg$currPos);
  24894. peg$currPos++;
  24895. } else {
  24896. s3 = peg$FAILED;
  24897. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24898. }
  24899. if (s3 !== peg$FAILED) {
  24900. while (s3 !== peg$FAILED) {
  24901. s2.push(s3);
  24902. if (peg$c48.test(input.charAt(peg$currPos))) {
  24903. s3 = input.charAt(peg$currPos);
  24904. peg$currPos++;
  24905. } else {
  24906. s3 = peg$FAILED;
  24907. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24908. }
  24909. }
  24910. } else {
  24911. s2 = peg$FAILED;
  24912. }
  24913. if (s2 !== peg$FAILED) {
  24914. if (input.charCodeAt(peg$currPos) === 46) {
  24915. s3 = peg$c6;
  24916. peg$currPos++;
  24917. } else {
  24918. s3 = peg$FAILED;
  24919. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24920. }
  24921. if (s3 !== peg$FAILED) {
  24922. s4 = [];
  24923. if (peg$c48.test(input.charAt(peg$currPos))) {
  24924. s5 = input.charAt(peg$currPos);
  24925. peg$currPos++;
  24926. } else {
  24927. s5 = peg$FAILED;
  24928. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24929. }
  24930. if (s5 !== peg$FAILED) {
  24931. while (s5 !== peg$FAILED) {
  24932. s4.push(s5);
  24933. if (peg$c48.test(input.charAt(peg$currPos))) {
  24934. s5 = input.charAt(peg$currPos);
  24935. peg$currPos++;
  24936. } else {
  24937. s5 = peg$FAILED;
  24938. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24939. }
  24940. }
  24941. } else {
  24942. s4 = peg$FAILED;
  24943. }
  24944. if (s4 !== peg$FAILED) {
  24945. peg$savedPos = s0;
  24946. s1 = peg$c50(s1, s2, s4);
  24947. s0 = s1;
  24948. } else {
  24949. peg$currPos = s0;
  24950. s0 = peg$FAILED;
  24951. }
  24952. } else {
  24953. peg$currPos = s0;
  24954. s0 = peg$FAILED;
  24955. }
  24956. } else {
  24957. peg$currPos = s0;
  24958. s0 = peg$FAILED;
  24959. }
  24960. } else {
  24961. peg$currPos = s0;
  24962. s0 = peg$FAILED;
  24963. }
  24964. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24965. return s0;
  24966. }
  24967. function peg$parseinteger() {
  24968. var s0, s1, s2, s3;
  24969. var key = peg$currPos * 61 + 17,
  24970. cached = peg$resultsCache[key];
  24971. if (cached) {
  24972. peg$currPos = cached.nextPos;
  24973. return cached.result;
  24974. }
  24975. s0 = peg$currPos;
  24976. if (input.charCodeAt(peg$currPos) === 45) {
  24977. s1 = peg$c41;
  24978. peg$currPos++;
  24979. } else {
  24980. s1 = peg$FAILED;
  24981. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  24982. }
  24983. if (s1 === peg$FAILED) {
  24984. s1 = null;
  24985. }
  24986. if (s1 !== peg$FAILED) {
  24987. s2 = [];
  24988. if (peg$c48.test(input.charAt(peg$currPos))) {
  24989. s3 = input.charAt(peg$currPos);
  24990. peg$currPos++;
  24991. } else {
  24992. s3 = peg$FAILED;
  24993. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24994. }
  24995. if (s3 !== peg$FAILED) {
  24996. while (s3 !== peg$FAILED) {
  24997. s2.push(s3);
  24998. if (peg$c48.test(input.charAt(peg$currPos))) {
  24999. s3 = input.charAt(peg$currPos);
  25000. peg$currPos++;
  25001. } else {
  25002. s3 = peg$FAILED;
  25003. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  25004. }
  25005. }
  25006. } else {
  25007. s2 = peg$FAILED;
  25008. }
  25009. if (s2 !== peg$FAILED) {
  25010. peg$savedPos = s0;
  25011. s1 = peg$c51(s1, s2);
  25012. s0 = s1;
  25013. } else {
  25014. peg$currPos = s0;
  25015. s0 = peg$FAILED;
  25016. }
  25017. } else {
  25018. peg$currPos = s0;
  25019. s0 = peg$FAILED;
  25020. }
  25021. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25022. return s0;
  25023. }
  25024. function peg$parseliteralArray() {
  25025. var s0, s1, s2, s3, s4;
  25026. var key = peg$currPos * 61 + 18,
  25027. cached = peg$resultsCache[key];
  25028. if (cached) {
  25029. peg$currPos = cached.nextPos;
  25030. return cached.result;
  25031. }
  25032. s0 = peg$currPos;
  25033. if (input.substr(peg$currPos, 2) === peg$c52) {
  25034. s1 = peg$c52;
  25035. peg$currPos += 2;
  25036. } else {
  25037. s1 = peg$FAILED;
  25038. if (peg$silentFails === 0) { peg$fail(peg$c53); }
  25039. }
  25040. if (s1 !== peg$FAILED) {
  25041. s2 = peg$parsewsLiteralArrayContents();
  25042. if (s2 !== peg$FAILED) {
  25043. s3 = peg$parsews();
  25044. if (s3 !== peg$FAILED) {
  25045. if (input.charCodeAt(peg$currPos) === 41) {
  25046. s4 = peg$c54;
  25047. peg$currPos++;
  25048. } else {
  25049. s4 = peg$FAILED;
  25050. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  25051. }
  25052. if (s4 !== peg$FAILED) {
  25053. peg$savedPos = s0;
  25054. s1 = peg$c56(s2);
  25055. s0 = s1;
  25056. } else {
  25057. peg$currPos = s0;
  25058. s0 = peg$FAILED;
  25059. }
  25060. } else {
  25061. peg$currPos = s0;
  25062. s0 = peg$FAILED;
  25063. }
  25064. } else {
  25065. peg$currPos = s0;
  25066. s0 = peg$FAILED;
  25067. }
  25068. } else {
  25069. peg$currPos = s0;
  25070. s0 = peg$FAILED;
  25071. }
  25072. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25073. return s0;
  25074. }
  25075. function peg$parsebareLiteralArray() {
  25076. var s0, s1, s2, s3, s4;
  25077. var key = peg$currPos * 61 + 19,
  25078. cached = peg$resultsCache[key];
  25079. if (cached) {
  25080. peg$currPos = cached.nextPos;
  25081. return cached.result;
  25082. }
  25083. s0 = peg$currPos;
  25084. if (input.charCodeAt(peg$currPos) === 40) {
  25085. s1 = peg$c57;
  25086. peg$currPos++;
  25087. } else {
  25088. s1 = peg$FAILED;
  25089. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  25090. }
  25091. if (s1 !== peg$FAILED) {
  25092. s2 = peg$parsewsLiteralArrayContents();
  25093. if (s2 !== peg$FAILED) {
  25094. s3 = peg$parsews();
  25095. if (s3 !== peg$FAILED) {
  25096. if (input.charCodeAt(peg$currPos) === 41) {
  25097. s4 = peg$c54;
  25098. peg$currPos++;
  25099. } else {
  25100. s4 = peg$FAILED;
  25101. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  25102. }
  25103. if (s4 !== peg$FAILED) {
  25104. peg$savedPos = s0;
  25105. s1 = peg$c56(s2);
  25106. s0 = s1;
  25107. } else {
  25108. peg$currPos = s0;
  25109. s0 = peg$FAILED;
  25110. }
  25111. } else {
  25112. peg$currPos = s0;
  25113. s0 = peg$FAILED;
  25114. }
  25115. } else {
  25116. peg$currPos = s0;
  25117. s0 = peg$FAILED;
  25118. }
  25119. } else {
  25120. peg$currPos = s0;
  25121. s0 = peg$FAILED;
  25122. }
  25123. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25124. return s0;
  25125. }
  25126. function peg$parseliteralArrayElement() {
  25127. var s0;
  25128. var key = peg$currPos * 61 + 20,
  25129. cached = peg$resultsCache[key];
  25130. if (cached) {
  25131. peg$currPos = cached.nextPos;
  25132. return cached.result;
  25133. }
  25134. s0 = peg$parseparseTimeLiteral();
  25135. if (s0 === peg$FAILED) {
  25136. s0 = peg$parsebareLiteralArray();
  25137. if (s0 === peg$FAILED) {
  25138. s0 = peg$parsebareSymbol();
  25139. }
  25140. }
  25141. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25142. return s0;
  25143. }
  25144. function peg$parsewsLiteralArrayContents() {
  25145. var s0, s1, s2, s3, s4;
  25146. var key = peg$currPos * 61 + 21,
  25147. cached = peg$resultsCache[key];
  25148. if (cached) {
  25149. peg$currPos = cached.nextPos;
  25150. return cached.result;
  25151. }
  25152. s0 = peg$currPos;
  25153. s1 = [];
  25154. s2 = peg$currPos;
  25155. s3 = peg$parsews();
  25156. if (s3 !== peg$FAILED) {
  25157. s4 = peg$parseliteralArrayElement();
  25158. if (s4 !== peg$FAILED) {
  25159. peg$savedPos = s2;
  25160. s3 = peg$c59(s4);
  25161. s2 = s3;
  25162. } else {
  25163. peg$currPos = s2;
  25164. s2 = peg$FAILED;
  25165. }
  25166. } else {
  25167. peg$currPos = s2;
  25168. s2 = peg$FAILED;
  25169. }
  25170. while (s2 !== peg$FAILED) {
  25171. s1.push(s2);
  25172. s2 = peg$currPos;
  25173. s3 = peg$parsews();
  25174. if (s3 !== peg$FAILED) {
  25175. s4 = peg$parseliteralArrayElement();
  25176. if (s4 !== peg$FAILED) {
  25177. peg$savedPos = s2;
  25178. s3 = peg$c59(s4);
  25179. s2 = s3;
  25180. } else {
  25181. peg$currPos = s2;
  25182. s2 = peg$FAILED;
  25183. }
  25184. } else {
  25185. peg$currPos = s2;
  25186. s2 = peg$FAILED;
  25187. }
  25188. }
  25189. if (s1 !== peg$FAILED) {
  25190. peg$savedPos = s0;
  25191. s1 = peg$c60(s1);
  25192. }
  25193. s0 = s1;
  25194. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25195. return s0;
  25196. }
  25197. function peg$parsedynamicArray() {
  25198. var s0, s1, s2, s3, s4, s5;
  25199. var key = peg$currPos * 61 + 22,
  25200. cached = peg$resultsCache[key];
  25201. if (cached) {
  25202. peg$currPos = cached.nextPos;
  25203. return cached.result;
  25204. }
  25205. s0 = peg$currPos;
  25206. if (input.charCodeAt(peg$currPos) === 123) {
  25207. s1 = peg$c61;
  25208. peg$currPos++;
  25209. } else {
  25210. s1 = peg$FAILED;
  25211. if (peg$silentFails === 0) { peg$fail(peg$c62); }
  25212. }
  25213. if (s1 !== peg$FAILED) {
  25214. s2 = peg$parsews();
  25215. if (s2 !== peg$FAILED) {
  25216. s3 = peg$parseexpressions();
  25217. if (s3 === peg$FAILED) {
  25218. s3 = null;
  25219. }
  25220. if (s3 !== peg$FAILED) {
  25221. s4 = peg$parsemaybeDotsWs();
  25222. if (s4 !== peg$FAILED) {
  25223. if (input.charCodeAt(peg$currPos) === 125) {
  25224. s5 = peg$c63;
  25225. peg$currPos++;
  25226. } else {
  25227. s5 = peg$FAILED;
  25228. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  25229. }
  25230. if (s5 !== peg$FAILED) {
  25231. peg$savedPos = s0;
  25232. s1 = peg$c65(s3);
  25233. s0 = s1;
  25234. } else {
  25235. peg$currPos = s0;
  25236. s0 = peg$FAILED;
  25237. }
  25238. } else {
  25239. peg$currPos = s0;
  25240. s0 = peg$FAILED;
  25241. }
  25242. } else {
  25243. peg$currPos = s0;
  25244. s0 = peg$FAILED;
  25245. }
  25246. } else {
  25247. peg$currPos = s0;
  25248. s0 = peg$FAILED;
  25249. }
  25250. } else {
  25251. peg$currPos = s0;
  25252. s0 = peg$FAILED;
  25253. }
  25254. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25255. return s0;
  25256. }
  25257. function peg$parsedynamicDictionary() {
  25258. var s0, s1, s2, s3, s4, s5;
  25259. var key = peg$currPos * 61 + 23,
  25260. cached = peg$resultsCache[key];
  25261. if (cached) {
  25262. peg$currPos = cached.nextPos;
  25263. return cached.result;
  25264. }
  25265. s0 = peg$currPos;
  25266. if (input.substr(peg$currPos, 2) === peg$c66) {
  25267. s1 = peg$c66;
  25268. peg$currPos += 2;
  25269. } else {
  25270. s1 = peg$FAILED;
  25271. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  25272. }
  25273. if (s1 !== peg$FAILED) {
  25274. s2 = peg$parsews();
  25275. if (s2 !== peg$FAILED) {
  25276. s3 = peg$parseassociations();
  25277. if (s3 === peg$FAILED) {
  25278. s3 = null;
  25279. }
  25280. if (s3 !== peg$FAILED) {
  25281. s4 = peg$parsemaybeDotsWs();
  25282. if (s4 !== peg$FAILED) {
  25283. if (input.charCodeAt(peg$currPos) === 125) {
  25284. s5 = peg$c63;
  25285. peg$currPos++;
  25286. } else {
  25287. s5 = peg$FAILED;
  25288. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  25289. }
  25290. if (s5 !== peg$FAILED) {
  25291. peg$savedPos = s0;
  25292. s1 = peg$c68(s3);
  25293. s0 = s1;
  25294. } else {
  25295. peg$currPos = s0;
  25296. s0 = peg$FAILED;
  25297. }
  25298. } else {
  25299. peg$currPos = s0;
  25300. s0 = peg$FAILED;
  25301. }
  25302. } else {
  25303. peg$currPos = s0;
  25304. s0 = peg$FAILED;
  25305. }
  25306. } else {
  25307. peg$currPos = s0;
  25308. s0 = peg$FAILED;
  25309. }
  25310. } else {
  25311. peg$currPos = s0;
  25312. s0 = peg$FAILED;
  25313. }
  25314. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25315. return s0;
  25316. }
  25317. function peg$parsepseudoVariable() {
  25318. var s0, s1, s2;
  25319. var key = peg$currPos * 61 + 24,
  25320. cached = peg$resultsCache[key];
  25321. if (cached) {
  25322. peg$currPos = cached.nextPos;
  25323. return cached.result;
  25324. }
  25325. s0 = peg$currPos;
  25326. s1 = peg$currPos;
  25327. if (input.substr(peg$currPos, 4) === peg$c69) {
  25328. s2 = peg$c69;
  25329. peg$currPos += 4;
  25330. } else {
  25331. s2 = peg$FAILED;
  25332. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  25333. }
  25334. if (s2 !== peg$FAILED) {
  25335. peg$savedPos = s1;
  25336. s2 = peg$c71();
  25337. }
  25338. s1 = s2;
  25339. if (s1 === peg$FAILED) {
  25340. s1 = peg$currPos;
  25341. if (input.substr(peg$currPos, 5) === peg$c72) {
  25342. s2 = peg$c72;
  25343. peg$currPos += 5;
  25344. } else {
  25345. s2 = peg$FAILED;
  25346. if (peg$silentFails === 0) { peg$fail(peg$c73); }
  25347. }
  25348. if (s2 !== peg$FAILED) {
  25349. peg$savedPos = s1;
  25350. s2 = peg$c74();
  25351. }
  25352. s1 = s2;
  25353. if (s1 === peg$FAILED) {
  25354. s1 = peg$currPos;
  25355. if (input.substr(peg$currPos, 3) === peg$c75) {
  25356. s2 = peg$c75;
  25357. peg$currPos += 3;
  25358. } else {
  25359. s2 = peg$FAILED;
  25360. if (peg$silentFails === 0) { peg$fail(peg$c76); }
  25361. }
  25362. if (s2 !== peg$FAILED) {
  25363. peg$savedPos = s1;
  25364. s2 = peg$c77();
  25365. }
  25366. s1 = s2;
  25367. }
  25368. }
  25369. if (s1 !== peg$FAILED) {
  25370. peg$savedPos = s0;
  25371. s1 = peg$c78(s1);
  25372. }
  25373. s0 = s1;
  25374. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25375. return s0;
  25376. }
  25377. function peg$parseparseTimeLiteral() {
  25378. var s0;
  25379. var key = peg$currPos * 61 + 25,
  25380. cached = peg$resultsCache[key];
  25381. if (cached) {
  25382. peg$currPos = cached.nextPos;
  25383. return cached.result;
  25384. }
  25385. s0 = peg$parsepseudoVariable();
  25386. if (s0 === peg$FAILED) {
  25387. s0 = peg$parsenumber();
  25388. if (s0 === peg$FAILED) {
  25389. s0 = peg$parseliteralArray();
  25390. if (s0 === peg$FAILED) {
  25391. s0 = peg$parsestring();
  25392. if (s0 === peg$FAILED) {
  25393. s0 = peg$parsesymbol();
  25394. if (s0 === peg$FAILED) {
  25395. s0 = peg$parsecharacter();
  25396. }
  25397. }
  25398. }
  25399. }
  25400. }
  25401. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25402. return s0;
  25403. }
  25404. function peg$parseruntimeLiteral() {
  25405. var s0;
  25406. var key = peg$currPos * 61 + 26,
  25407. cached = peg$resultsCache[key];
  25408. if (cached) {
  25409. peg$currPos = cached.nextPos;
  25410. return cached.result;
  25411. }
  25412. s0 = peg$parsedynamicDictionary();
  25413. if (s0 === peg$FAILED) {
  25414. s0 = peg$parsedynamicArray();
  25415. if (s0 === peg$FAILED) {
  25416. s0 = peg$parseblock();
  25417. }
  25418. }
  25419. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25420. return s0;
  25421. }
  25422. function peg$parseliteral() {
  25423. var s0;
  25424. var key = peg$currPos * 61 + 27,
  25425. cached = peg$resultsCache[key];
  25426. if (cached) {
  25427. peg$currPos = cached.nextPos;
  25428. return cached.result;
  25429. }
  25430. s0 = peg$parseruntimeLiteral();
  25431. if (s0 === peg$FAILED) {
  25432. s0 = peg$parseparseTimeLiteral();
  25433. }
  25434. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25435. return s0;
  25436. }
  25437. function peg$parsevariable() {
  25438. var s0, s1;
  25439. var key = peg$currPos * 61 + 28,
  25440. cached = peg$resultsCache[key];
  25441. if (cached) {
  25442. peg$currPos = cached.nextPos;
  25443. return cached.result;
  25444. }
  25445. s0 = peg$currPos;
  25446. s1 = peg$parseidentifier();
  25447. if (s1 !== peg$FAILED) {
  25448. peg$savedPos = s0;
  25449. s1 = peg$c79(s1);
  25450. }
  25451. s0 = s1;
  25452. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25453. return s0;
  25454. }
  25455. function peg$parsebinarySelector() {
  25456. var s0, s1, s2;
  25457. var key = peg$currPos * 61 + 29,
  25458. cached = peg$resultsCache[key];
  25459. if (cached) {
  25460. peg$currPos = cached.nextPos;
  25461. return cached.result;
  25462. }
  25463. s0 = peg$currPos;
  25464. s1 = [];
  25465. if (peg$c80.test(input.charAt(peg$currPos))) {
  25466. s2 = input.charAt(peg$currPos);
  25467. peg$currPos++;
  25468. } else {
  25469. s2 = peg$FAILED;
  25470. if (peg$silentFails === 0) { peg$fail(peg$c81); }
  25471. }
  25472. if (s2 !== peg$FAILED) {
  25473. while (s2 !== peg$FAILED) {
  25474. s1.push(s2);
  25475. if (peg$c80.test(input.charAt(peg$currPos))) {
  25476. s2 = input.charAt(peg$currPos);
  25477. peg$currPos++;
  25478. } else {
  25479. s2 = peg$FAILED;
  25480. if (peg$silentFails === 0) { peg$fail(peg$c81); }
  25481. }
  25482. }
  25483. } else {
  25484. s1 = peg$FAILED;
  25485. }
  25486. if (s1 !== peg$FAILED) {
  25487. peg$savedPos = s0;
  25488. s1 = peg$c82(s1);
  25489. }
  25490. s0 = s1;
  25491. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25492. return s0;
  25493. }
  25494. function peg$parsewsKeywordPattern() {
  25495. var s0, s1, s2, s3, s4, s5, s6;
  25496. var key = peg$currPos * 61 + 30,
  25497. cached = peg$resultsCache[key];
  25498. if (cached) {
  25499. peg$currPos = cached.nextPos;
  25500. return cached.result;
  25501. }
  25502. s0 = peg$currPos;
  25503. s1 = [];
  25504. s2 = peg$currPos;
  25505. s3 = peg$parsews();
  25506. if (s3 !== peg$FAILED) {
  25507. s4 = peg$parsekeyword();
  25508. if (s4 !== peg$FAILED) {
  25509. s5 = peg$parsews();
  25510. if (s5 !== peg$FAILED) {
  25511. s6 = peg$parseidentifier();
  25512. if (s6 !== peg$FAILED) {
  25513. peg$savedPos = s2;
  25514. s3 = peg$c83(s4, s6);
  25515. s2 = s3;
  25516. } else {
  25517. peg$currPos = s2;
  25518. s2 = peg$FAILED;
  25519. }
  25520. } else {
  25521. peg$currPos = s2;
  25522. s2 = peg$FAILED;
  25523. }
  25524. } else {
  25525. peg$currPos = s2;
  25526. s2 = peg$FAILED;
  25527. }
  25528. } else {
  25529. peg$currPos = s2;
  25530. s2 = peg$FAILED;
  25531. }
  25532. if (s2 !== peg$FAILED) {
  25533. while (s2 !== peg$FAILED) {
  25534. s1.push(s2);
  25535. s2 = peg$currPos;
  25536. s3 = peg$parsews();
  25537. if (s3 !== peg$FAILED) {
  25538. s4 = peg$parsekeyword();
  25539. if (s4 !== peg$FAILED) {
  25540. s5 = peg$parsews();
  25541. if (s5 !== peg$FAILED) {
  25542. s6 = peg$parseidentifier();
  25543. if (s6 !== peg$FAILED) {
  25544. peg$savedPos = s2;
  25545. s3 = peg$c83(s4, s6);
  25546. s2 = s3;
  25547. } else {
  25548. peg$currPos = s2;
  25549. s2 = peg$FAILED;
  25550. }
  25551. } else {
  25552. peg$currPos = s2;
  25553. s2 = peg$FAILED;
  25554. }
  25555. } else {
  25556. peg$currPos = s2;
  25557. s2 = peg$FAILED;
  25558. }
  25559. } else {
  25560. peg$currPos = s2;
  25561. s2 = peg$FAILED;
  25562. }
  25563. }
  25564. } else {
  25565. s1 = peg$FAILED;
  25566. }
  25567. if (s1 !== peg$FAILED) {
  25568. peg$savedPos = s0;
  25569. s1 = peg$c84(s1);
  25570. }
  25571. s0 = s1;
  25572. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25573. return s0;
  25574. }
  25575. function peg$parsewsBinaryPattern() {
  25576. var s0, s1, s2, s3, s4;
  25577. var key = peg$currPos * 61 + 31,
  25578. cached = peg$resultsCache[key];
  25579. if (cached) {
  25580. peg$currPos = cached.nextPos;
  25581. return cached.result;
  25582. }
  25583. s0 = peg$currPos;
  25584. s1 = peg$parsews();
  25585. if (s1 !== peg$FAILED) {
  25586. s2 = peg$parsebinarySelector();
  25587. if (s2 !== peg$FAILED) {
  25588. s3 = peg$parsews();
  25589. if (s3 !== peg$FAILED) {
  25590. s4 = peg$parseidentifier();
  25591. if (s4 !== peg$FAILED) {
  25592. peg$savedPos = s0;
  25593. s1 = peg$c85(s2, s4);
  25594. s0 = s1;
  25595. } else {
  25596. peg$currPos = s0;
  25597. s0 = peg$FAILED;
  25598. }
  25599. } else {
  25600. peg$currPos = s0;
  25601. s0 = peg$FAILED;
  25602. }
  25603. } else {
  25604. peg$currPos = s0;
  25605. s0 = peg$FAILED;
  25606. }
  25607. } else {
  25608. peg$currPos = s0;
  25609. s0 = peg$FAILED;
  25610. }
  25611. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25612. return s0;
  25613. }
  25614. function peg$parsewsUnaryPattern() {
  25615. var s0, s1, s2;
  25616. var key = peg$currPos * 61 + 32,
  25617. cached = peg$resultsCache[key];
  25618. if (cached) {
  25619. peg$currPos = cached.nextPos;
  25620. return cached.result;
  25621. }
  25622. s0 = peg$currPos;
  25623. s1 = peg$parsews();
  25624. if (s1 !== peg$FAILED) {
  25625. s2 = peg$parseidentifier();
  25626. if (s2 !== peg$FAILED) {
  25627. peg$savedPos = s0;
  25628. s1 = peg$c86(s2);
  25629. s0 = s1;
  25630. } else {
  25631. peg$currPos = s0;
  25632. s0 = peg$FAILED;
  25633. }
  25634. } else {
  25635. peg$currPos = s0;
  25636. s0 = peg$FAILED;
  25637. }
  25638. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25639. return s0;
  25640. }
  25641. function peg$parseexpression() {
  25642. var s0;
  25643. var key = peg$currPos * 61 + 33,
  25644. cached = peg$resultsCache[key];
  25645. if (cached) {
  25646. peg$currPos = cached.nextPos;
  25647. return cached.result;
  25648. }
  25649. s0 = peg$parseassignment();
  25650. if (s0 === peg$FAILED) {
  25651. s0 = peg$parsecascade();
  25652. if (s0 === peg$FAILED) {
  25653. s0 = peg$parsekeywordSend();
  25654. }
  25655. }
  25656. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25657. return s0;
  25658. }
  25659. function peg$parsewsExpressionsRest() {
  25660. var s0, s1, s2, s3, s4;
  25661. var key = peg$currPos * 61 + 34,
  25662. cached = peg$resultsCache[key];
  25663. if (cached) {
  25664. peg$currPos = cached.nextPos;
  25665. return cached.result;
  25666. }
  25667. s0 = peg$currPos;
  25668. s1 = peg$parsews();
  25669. if (s1 !== peg$FAILED) {
  25670. if (input.charCodeAt(peg$currPos) === 46) {
  25671. s2 = peg$c6;
  25672. peg$currPos++;
  25673. } else {
  25674. s2 = peg$FAILED;
  25675. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  25676. }
  25677. if (s2 !== peg$FAILED) {
  25678. s3 = peg$parsemaybeDotsWs();
  25679. if (s3 !== peg$FAILED) {
  25680. s4 = peg$parseexpression();
  25681. if (s4 !== peg$FAILED) {
  25682. peg$savedPos = s0;
  25683. s1 = peg$c87(s4);
  25684. s0 = s1;
  25685. } else {
  25686. peg$currPos = s0;
  25687. s0 = peg$FAILED;
  25688. }
  25689. } else {
  25690. peg$currPos = s0;
  25691. s0 = peg$FAILED;
  25692. }
  25693. } else {
  25694. peg$currPos = s0;
  25695. s0 = peg$FAILED;
  25696. }
  25697. } else {
  25698. peg$currPos = s0;
  25699. s0 = peg$FAILED;
  25700. }
  25701. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25702. return s0;
  25703. }
  25704. function peg$parseexpressions() {
  25705. var s0, s1, s2, s3;
  25706. var key = peg$currPos * 61 + 35,
  25707. cached = peg$resultsCache[key];
  25708. if (cached) {
  25709. peg$currPos = cached.nextPos;
  25710. return cached.result;
  25711. }
  25712. s0 = peg$currPos;
  25713. s1 = peg$parseexpression();
  25714. if (s1 !== peg$FAILED) {
  25715. s2 = [];
  25716. s3 = peg$parsewsExpressionsRest();
  25717. while (s3 !== peg$FAILED) {
  25718. s2.push(s3);
  25719. s3 = peg$parsewsExpressionsRest();
  25720. }
  25721. if (s2 !== peg$FAILED) {
  25722. peg$savedPos = s0;
  25723. s1 = peg$c88(s1, s2);
  25724. s0 = s1;
  25725. } else {
  25726. peg$currPos = s0;
  25727. s0 = peg$FAILED;
  25728. }
  25729. } else {
  25730. peg$currPos = s0;
  25731. s0 = peg$FAILED;
  25732. }
  25733. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25734. return s0;
  25735. }
  25736. function peg$parseassignment() {
  25737. var s0, s1, s2, s3, s4, s5;
  25738. var key = peg$currPos * 61 + 36,
  25739. cached = peg$resultsCache[key];
  25740. if (cached) {
  25741. peg$currPos = cached.nextPos;
  25742. return cached.result;
  25743. }
  25744. s0 = peg$currPos;
  25745. s1 = peg$parsevariable();
  25746. if (s1 !== peg$FAILED) {
  25747. s2 = peg$parsews();
  25748. if (s2 !== peg$FAILED) {
  25749. if (input.substr(peg$currPos, 2) === peg$c89) {
  25750. s3 = peg$c89;
  25751. peg$currPos += 2;
  25752. } else {
  25753. s3 = peg$FAILED;
  25754. if (peg$silentFails === 0) { peg$fail(peg$c90); }
  25755. }
  25756. if (s3 !== peg$FAILED) {
  25757. s4 = peg$parsews();
  25758. if (s4 !== peg$FAILED) {
  25759. s5 = peg$parseexpression();
  25760. if (s5 !== peg$FAILED) {
  25761. peg$savedPos = s0;
  25762. s1 = peg$c91(s1, s5);
  25763. s0 = s1;
  25764. } else {
  25765. peg$currPos = s0;
  25766. s0 = peg$FAILED;
  25767. }
  25768. } else {
  25769. peg$currPos = s0;
  25770. s0 = peg$FAILED;
  25771. }
  25772. } else {
  25773. peg$currPos = s0;
  25774. s0 = peg$FAILED;
  25775. }
  25776. } else {
  25777. peg$currPos = s0;
  25778. s0 = peg$FAILED;
  25779. }
  25780. } else {
  25781. peg$currPos = s0;
  25782. s0 = peg$FAILED;
  25783. }
  25784. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25785. return s0;
  25786. }
  25787. function peg$parseret() {
  25788. var s0, s1, s2, s3;
  25789. var key = peg$currPos * 61 + 37,
  25790. cached = peg$resultsCache[key];
  25791. if (cached) {
  25792. peg$currPos = cached.nextPos;
  25793. return cached.result;
  25794. }
  25795. s0 = peg$currPos;
  25796. if (input.charCodeAt(peg$currPos) === 94) {
  25797. s1 = peg$c92;
  25798. peg$currPos++;
  25799. } else {
  25800. s1 = peg$FAILED;
  25801. if (peg$silentFails === 0) { peg$fail(peg$c93); }
  25802. }
  25803. if (s1 !== peg$FAILED) {
  25804. s2 = peg$parsews();
  25805. if (s2 !== peg$FAILED) {
  25806. s3 = peg$parseexpression();
  25807. if (s3 !== peg$FAILED) {
  25808. peg$savedPos = s0;
  25809. s1 = peg$c94(s3);
  25810. s0 = s1;
  25811. } else {
  25812. peg$currPos = s0;
  25813. s0 = peg$FAILED;
  25814. }
  25815. } else {
  25816. peg$currPos = s0;
  25817. s0 = peg$FAILED;
  25818. }
  25819. } else {
  25820. peg$currPos = s0;
  25821. s0 = peg$FAILED;
  25822. }
  25823. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25824. return s0;
  25825. }
  25826. function peg$parsetemps() {
  25827. var s0, s1, s2, s3, s4, s5;
  25828. var key = peg$currPos * 61 + 38,
  25829. cached = peg$resultsCache[key];
  25830. if (cached) {
  25831. peg$currPos = cached.nextPos;
  25832. return cached.result;
  25833. }
  25834. s0 = peg$currPos;
  25835. if (input.charCodeAt(peg$currPos) === 124) {
  25836. s1 = peg$c95;
  25837. peg$currPos++;
  25838. } else {
  25839. s1 = peg$FAILED;
  25840. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  25841. }
  25842. if (s1 !== peg$FAILED) {
  25843. s2 = [];
  25844. s3 = peg$currPos;
  25845. s4 = peg$parsews();
  25846. if (s4 !== peg$FAILED) {
  25847. s5 = peg$parseidentifier();
  25848. if (s5 !== peg$FAILED) {
  25849. peg$savedPos = s3;
  25850. s4 = peg$c97(s5);
  25851. s3 = s4;
  25852. } else {
  25853. peg$currPos = s3;
  25854. s3 = peg$FAILED;
  25855. }
  25856. } else {
  25857. peg$currPos = s3;
  25858. s3 = peg$FAILED;
  25859. }
  25860. while (s3 !== peg$FAILED) {
  25861. s2.push(s3);
  25862. s3 = peg$currPos;
  25863. s4 = peg$parsews();
  25864. if (s4 !== peg$FAILED) {
  25865. s5 = peg$parseidentifier();
  25866. if (s5 !== peg$FAILED) {
  25867. peg$savedPos = s3;
  25868. s4 = peg$c97(s5);
  25869. s3 = s4;
  25870. } else {
  25871. peg$currPos = s3;
  25872. s3 = peg$FAILED;
  25873. }
  25874. } else {
  25875. peg$currPos = s3;
  25876. s3 = peg$FAILED;
  25877. }
  25878. }
  25879. if (s2 !== peg$FAILED) {
  25880. s3 = peg$parsews();
  25881. if (s3 !== peg$FAILED) {
  25882. if (input.charCodeAt(peg$currPos) === 124) {
  25883. s4 = peg$c95;
  25884. peg$currPos++;
  25885. } else {
  25886. s4 = peg$FAILED;
  25887. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  25888. }
  25889. if (s4 !== peg$FAILED) {
  25890. peg$savedPos = s0;
  25891. s1 = peg$c98(s2);
  25892. s0 = s1;
  25893. } else {
  25894. peg$currPos = s0;
  25895. s0 = peg$FAILED;
  25896. }
  25897. } else {
  25898. peg$currPos = s0;
  25899. s0 = peg$FAILED;
  25900. }
  25901. } else {
  25902. peg$currPos = s0;
  25903. s0 = peg$FAILED;
  25904. }
  25905. } else {
  25906. peg$currPos = s0;
  25907. s0 = peg$FAILED;
  25908. }
  25909. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25910. return s0;
  25911. }
  25912. function peg$parsewsBlockParamList() {
  25913. var s0, s1, s2, s3, s4, s5, s6;
  25914. var key = peg$currPos * 61 + 39,
  25915. cached = peg$resultsCache[key];
  25916. if (cached) {
  25917. peg$currPos = cached.nextPos;
  25918. return cached.result;
  25919. }
  25920. s0 = peg$currPos;
  25921. s1 = [];
  25922. s2 = peg$currPos;
  25923. s3 = peg$parsews();
  25924. if (s3 !== peg$FAILED) {
  25925. if (input.charCodeAt(peg$currPos) === 58) {
  25926. s4 = peg$c13;
  25927. peg$currPos++;
  25928. } else {
  25929. s4 = peg$FAILED;
  25930. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25931. }
  25932. if (s4 !== peg$FAILED) {
  25933. s5 = peg$parsews();
  25934. if (s5 !== peg$FAILED) {
  25935. s6 = peg$parseidentifier();
  25936. if (s6 !== peg$FAILED) {
  25937. peg$savedPos = s2;
  25938. s3 = peg$c99(s6);
  25939. s2 = s3;
  25940. } else {
  25941. peg$currPos = s2;
  25942. s2 = peg$FAILED;
  25943. }
  25944. } else {
  25945. peg$currPos = s2;
  25946. s2 = peg$FAILED;
  25947. }
  25948. } else {
  25949. peg$currPos = s2;
  25950. s2 = peg$FAILED;
  25951. }
  25952. } else {
  25953. peg$currPos = s2;
  25954. s2 = peg$FAILED;
  25955. }
  25956. if (s2 !== peg$FAILED) {
  25957. while (s2 !== peg$FAILED) {
  25958. s1.push(s2);
  25959. s2 = peg$currPos;
  25960. s3 = peg$parsews();
  25961. if (s3 !== peg$FAILED) {
  25962. if (input.charCodeAt(peg$currPos) === 58) {
  25963. s4 = peg$c13;
  25964. peg$currPos++;
  25965. } else {
  25966. s4 = peg$FAILED;
  25967. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25968. }
  25969. if (s4 !== peg$FAILED) {
  25970. s5 = peg$parsews();
  25971. if (s5 !== peg$FAILED) {
  25972. s6 = peg$parseidentifier();
  25973. if (s6 !== peg$FAILED) {
  25974. peg$savedPos = s2;
  25975. s3 = peg$c99(s6);
  25976. s2 = s3;
  25977. } else {
  25978. peg$currPos = s2;
  25979. s2 = peg$FAILED;
  25980. }
  25981. } else {
  25982. peg$currPos = s2;
  25983. s2 = peg$FAILED;
  25984. }
  25985. } else {
  25986. peg$currPos = s2;
  25987. s2 = peg$FAILED;
  25988. }
  25989. } else {
  25990. peg$currPos = s2;
  25991. s2 = peg$FAILED;
  25992. }
  25993. }
  25994. } else {
  25995. s1 = peg$FAILED;
  25996. }
  25997. if (s1 !== peg$FAILED) {
  25998. s2 = peg$parsews();
  25999. if (s2 !== peg$FAILED) {
  26000. if (input.charCodeAt(peg$currPos) === 124) {
  26001. s3 = peg$c95;
  26002. peg$currPos++;
  26003. } else {
  26004. s3 = peg$FAILED;
  26005. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  26006. }
  26007. if (s3 !== peg$FAILED) {
  26008. peg$savedPos = s0;
  26009. s1 = peg$c100(s1);
  26010. s0 = s1;
  26011. } else {
  26012. peg$currPos = s0;
  26013. s0 = peg$FAILED;
  26014. }
  26015. } else {
  26016. peg$currPos = s0;
  26017. s0 = peg$FAILED;
  26018. }
  26019. } else {
  26020. peg$currPos = s0;
  26021. s0 = peg$FAILED;
  26022. }
  26023. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26024. return s0;
  26025. }
  26026. function peg$parsesubexpression() {
  26027. var s0, s1, s2, s3, s4, s5;
  26028. var key = peg$currPos * 61 + 40,
  26029. cached = peg$resultsCache[key];
  26030. if (cached) {
  26031. peg$currPos = cached.nextPos;
  26032. return cached.result;
  26033. }
  26034. s0 = peg$currPos;
  26035. if (input.charCodeAt(peg$currPos) === 40) {
  26036. s1 = peg$c57;
  26037. peg$currPos++;
  26038. } else {
  26039. s1 = peg$FAILED;
  26040. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  26041. }
  26042. if (s1 !== peg$FAILED) {
  26043. s2 = peg$parsews();
  26044. if (s2 !== peg$FAILED) {
  26045. s3 = peg$parseexpression();
  26046. if (s3 !== peg$FAILED) {
  26047. s4 = peg$parsews();
  26048. if (s4 !== peg$FAILED) {
  26049. if (input.charCodeAt(peg$currPos) === 41) {
  26050. s5 = peg$c54;
  26051. peg$currPos++;
  26052. } else {
  26053. s5 = peg$FAILED;
  26054. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  26055. }
  26056. if (s5 !== peg$FAILED) {
  26057. peg$savedPos = s0;
  26058. s1 = peg$c87(s3);
  26059. s0 = s1;
  26060. } else {
  26061. peg$currPos = s0;
  26062. s0 = peg$FAILED;
  26063. }
  26064. } else {
  26065. peg$currPos = s0;
  26066. s0 = peg$FAILED;
  26067. }
  26068. } else {
  26069. peg$currPos = s0;
  26070. s0 = peg$FAILED;
  26071. }
  26072. } else {
  26073. peg$currPos = s0;
  26074. s0 = peg$FAILED;
  26075. }
  26076. } else {
  26077. peg$currPos = s0;
  26078. s0 = peg$FAILED;
  26079. }
  26080. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26081. return s0;
  26082. }
  26083. function peg$parsestatementsWs() {
  26084. var s0, s1, s2, s3, s4, s5, s6;
  26085. var key = peg$currPos * 61 + 41,
  26086. cached = peg$resultsCache[key];
  26087. if (cached) {
  26088. peg$currPos = cached.nextPos;
  26089. return cached.result;
  26090. }
  26091. s0 = peg$currPos;
  26092. s1 = peg$parseret();
  26093. if (s1 !== peg$FAILED) {
  26094. s2 = peg$parsemaybeDotsWs();
  26095. if (s2 !== peg$FAILED) {
  26096. peg$savedPos = s0;
  26097. s1 = peg$c101(s1);
  26098. s0 = s1;
  26099. } else {
  26100. peg$currPos = s0;
  26101. s0 = peg$FAILED;
  26102. }
  26103. } else {
  26104. peg$currPos = s0;
  26105. s0 = peg$FAILED;
  26106. }
  26107. if (s0 === peg$FAILED) {
  26108. s0 = peg$currPos;
  26109. s1 = peg$parseexpressions();
  26110. if (s1 !== peg$FAILED) {
  26111. s2 = peg$parsews();
  26112. if (s2 !== peg$FAILED) {
  26113. if (input.charCodeAt(peg$currPos) === 46) {
  26114. s3 = peg$c6;
  26115. peg$currPos++;
  26116. } else {
  26117. s3 = peg$FAILED;
  26118. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  26119. }
  26120. if (s3 !== peg$FAILED) {
  26121. s4 = peg$parsemaybeDotsWs();
  26122. if (s4 !== peg$FAILED) {
  26123. s5 = peg$parseret();
  26124. if (s5 !== peg$FAILED) {
  26125. s6 = peg$parsemaybeDotsWs();
  26126. if (s6 !== peg$FAILED) {
  26127. peg$savedPos = s0;
  26128. s1 = peg$c102(s1, s5);
  26129. s0 = s1;
  26130. } else {
  26131. peg$currPos = s0;
  26132. s0 = peg$FAILED;
  26133. }
  26134. } else {
  26135. peg$currPos = s0;
  26136. s0 = peg$FAILED;
  26137. }
  26138. } else {
  26139. peg$currPos = s0;
  26140. s0 = peg$FAILED;
  26141. }
  26142. } else {
  26143. peg$currPos = s0;
  26144. s0 = peg$FAILED;
  26145. }
  26146. } else {
  26147. peg$currPos = s0;
  26148. s0 = peg$FAILED;
  26149. }
  26150. } else {
  26151. peg$currPos = s0;
  26152. s0 = peg$FAILED;
  26153. }
  26154. if (s0 === peg$FAILED) {
  26155. s0 = peg$currPos;
  26156. s1 = peg$parseexpressions();
  26157. if (s1 === peg$FAILED) {
  26158. s1 = null;
  26159. }
  26160. if (s1 !== peg$FAILED) {
  26161. s2 = peg$parsemaybeDotsWs();
  26162. if (s2 !== peg$FAILED) {
  26163. peg$savedPos = s0;
  26164. s1 = peg$c103(s1);
  26165. s0 = s1;
  26166. } else {
  26167. peg$currPos = s0;
  26168. s0 = peg$FAILED;
  26169. }
  26170. } else {
  26171. peg$currPos = s0;
  26172. s0 = peg$FAILED;
  26173. }
  26174. }
  26175. }
  26176. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26177. return s0;
  26178. }
  26179. function peg$parsewsSequenceWs() {
  26180. var s0, s1, s2, s3;
  26181. var key = peg$currPos * 61 + 42,
  26182. cached = peg$resultsCache[key];
  26183. if (cached) {
  26184. peg$currPos = cached.nextPos;
  26185. return cached.result;
  26186. }
  26187. s0 = peg$currPos;
  26188. s1 = peg$parsews();
  26189. if (s1 !== peg$FAILED) {
  26190. s2 = peg$parsejsStatement();
  26191. if (s2 !== peg$FAILED) {
  26192. s3 = peg$parsews();
  26193. if (s3 !== peg$FAILED) {
  26194. peg$savedPos = s0;
  26195. s1 = peg$c104(s2);
  26196. s0 = s1;
  26197. } else {
  26198. peg$currPos = s0;
  26199. s0 = peg$FAILED;
  26200. }
  26201. } else {
  26202. peg$currPos = s0;
  26203. s0 = peg$FAILED;
  26204. }
  26205. } else {
  26206. peg$currPos = s0;
  26207. s0 = peg$FAILED;
  26208. }
  26209. if (s0 === peg$FAILED) {
  26210. s0 = peg$parsewsStSequenceWs();
  26211. }
  26212. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26213. return s0;
  26214. }
  26215. function peg$parsewsStSequenceWs() {
  26216. var s0, s1, s2, s3, s4;
  26217. var key = peg$currPos * 61 + 43,
  26218. cached = peg$resultsCache[key];
  26219. if (cached) {
  26220. peg$currPos = cached.nextPos;
  26221. return cached.result;
  26222. }
  26223. s0 = peg$currPos;
  26224. s1 = peg$parsews();
  26225. if (s1 !== peg$FAILED) {
  26226. s2 = peg$parsetemps();
  26227. if (s2 === peg$FAILED) {
  26228. s2 = null;
  26229. }
  26230. if (s2 !== peg$FAILED) {
  26231. s3 = peg$parsemaybeDotsWs();
  26232. if (s3 !== peg$FAILED) {
  26233. s4 = peg$parsestatementsWs();
  26234. if (s4 === peg$FAILED) {
  26235. s4 = null;
  26236. }
  26237. if (s4 !== peg$FAILED) {
  26238. peg$savedPos = s0;
  26239. s1 = peg$c105(s2, s4);
  26240. s0 = s1;
  26241. } else {
  26242. peg$currPos = s0;
  26243. s0 = peg$FAILED;
  26244. }
  26245. } else {
  26246. peg$currPos = s0;
  26247. s0 = peg$FAILED;
  26248. }
  26249. } else {
  26250. peg$currPos = s0;
  26251. s0 = peg$FAILED;
  26252. }
  26253. } else {
  26254. peg$currPos = s0;
  26255. s0 = peg$FAILED;
  26256. }
  26257. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26258. return s0;
  26259. }
  26260. function peg$parseblock() {
  26261. var s0, s1, s2, s3, s4;
  26262. var key = peg$currPos * 61 + 44,
  26263. cached = peg$resultsCache[key];
  26264. if (cached) {
  26265. peg$currPos = cached.nextPos;
  26266. return cached.result;
  26267. }
  26268. s0 = peg$currPos;
  26269. if (input.charCodeAt(peg$currPos) === 91) {
  26270. s1 = peg$c106;
  26271. peg$currPos++;
  26272. } else {
  26273. s1 = peg$FAILED;
  26274. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  26275. }
  26276. if (s1 !== peg$FAILED) {
  26277. s2 = peg$parsewsBlockParamList();
  26278. if (s2 === peg$FAILED) {
  26279. s2 = null;
  26280. }
  26281. if (s2 !== peg$FAILED) {
  26282. s3 = peg$parsewsSequenceWs();
  26283. if (s3 === peg$FAILED) {
  26284. s3 = null;
  26285. }
  26286. if (s3 !== peg$FAILED) {
  26287. if (input.charCodeAt(peg$currPos) === 93) {
  26288. s4 = peg$c108;
  26289. peg$currPos++;
  26290. } else {
  26291. s4 = peg$FAILED;
  26292. if (peg$silentFails === 0) { peg$fail(peg$c109); }
  26293. }
  26294. if (s4 !== peg$FAILED) {
  26295. peg$savedPos = s0;
  26296. s1 = peg$c110(s2, s3);
  26297. s0 = s1;
  26298. } else {
  26299. peg$currPos = s0;
  26300. s0 = peg$FAILED;
  26301. }
  26302. } else {
  26303. peg$currPos = s0;
  26304. s0 = peg$FAILED;
  26305. }
  26306. } else {
  26307. peg$currPos = s0;
  26308. s0 = peg$FAILED;
  26309. }
  26310. } else {
  26311. peg$currPos = s0;
  26312. s0 = peg$FAILED;
  26313. }
  26314. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26315. return s0;
  26316. }
  26317. function peg$parseoperand() {
  26318. var s0;
  26319. var key = peg$currPos * 61 + 45,
  26320. cached = peg$resultsCache[key];
  26321. if (cached) {
  26322. peg$currPos = cached.nextPos;
  26323. return cached.result;
  26324. }
  26325. s0 = peg$parseliteral();
  26326. if (s0 === peg$FAILED) {
  26327. s0 = peg$parsevariable();
  26328. if (s0 === peg$FAILED) {
  26329. s0 = peg$parsesubexpression();
  26330. }
  26331. }
  26332. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26333. return s0;
  26334. }
  26335. function peg$parsewsUnaryMessage() {
  26336. var s0, s1, s2, s3, s4;
  26337. var key = peg$currPos * 61 + 46,
  26338. cached = peg$resultsCache[key];
  26339. if (cached) {
  26340. peg$currPos = cached.nextPos;
  26341. return cached.result;
  26342. }
  26343. s0 = peg$currPos;
  26344. s1 = peg$parsews();
  26345. if (s1 !== peg$FAILED) {
  26346. s2 = peg$parseidentifier();
  26347. if (s2 !== peg$FAILED) {
  26348. s3 = peg$currPos;
  26349. peg$silentFails++;
  26350. if (input.charCodeAt(peg$currPos) === 58) {
  26351. s4 = peg$c13;
  26352. peg$currPos++;
  26353. } else {
  26354. s4 = peg$FAILED;
  26355. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  26356. }
  26357. peg$silentFails--;
  26358. if (s4 === peg$FAILED) {
  26359. s3 = void 0;
  26360. } else {
  26361. peg$currPos = s3;
  26362. s3 = peg$FAILED;
  26363. }
  26364. if (s3 !== peg$FAILED) {
  26365. peg$savedPos = s0;
  26366. s1 = peg$c111(s2);
  26367. s0 = s1;
  26368. } else {
  26369. peg$currPos = s0;
  26370. s0 = peg$FAILED;
  26371. }
  26372. } else {
  26373. peg$currPos = s0;
  26374. s0 = peg$FAILED;
  26375. }
  26376. } else {
  26377. peg$currPos = s0;
  26378. s0 = peg$FAILED;
  26379. }
  26380. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26381. return s0;
  26382. }
  26383. function peg$parsewsUnaryTail() {
  26384. var s0, s1, s2;
  26385. var key = peg$currPos * 61 + 47,
  26386. cached = peg$resultsCache[key];
  26387. if (cached) {
  26388. peg$currPos = cached.nextPos;
  26389. return cached.result;
  26390. }
  26391. s0 = peg$currPos;
  26392. s1 = peg$parsewsUnaryMessage();
  26393. if (s1 !== peg$FAILED) {
  26394. s2 = peg$parsewsUnaryTail();
  26395. if (s2 === peg$FAILED) {
  26396. s2 = null;
  26397. }
  26398. if (s2 !== peg$FAILED) {
  26399. peg$savedPos = s0;
  26400. s1 = peg$c112(s1, s2);
  26401. s0 = s1;
  26402. } else {
  26403. peg$currPos = s0;
  26404. s0 = peg$FAILED;
  26405. }
  26406. } else {
  26407. peg$currPos = s0;
  26408. s0 = peg$FAILED;
  26409. }
  26410. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26411. return s0;
  26412. }
  26413. function peg$parseunarySend() {
  26414. var s0, s1, s2;
  26415. var key = peg$currPos * 61 + 48,
  26416. cached = peg$resultsCache[key];
  26417. if (cached) {
  26418. peg$currPos = cached.nextPos;
  26419. return cached.result;
  26420. }
  26421. s0 = peg$currPos;
  26422. s1 = peg$parseoperand();
  26423. if (s1 !== peg$FAILED) {
  26424. s2 = peg$parsewsUnaryTail();
  26425. if (s2 === peg$FAILED) {
  26426. s2 = null;
  26427. }
  26428. if (s2 !== peg$FAILED) {
  26429. peg$savedPos = s0;
  26430. s1 = peg$c113(s1, s2);
  26431. s0 = s1;
  26432. } else {
  26433. peg$currPos = s0;
  26434. s0 = peg$FAILED;
  26435. }
  26436. } else {
  26437. peg$currPos = s0;
  26438. s0 = peg$FAILED;
  26439. }
  26440. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26441. return s0;
  26442. }
  26443. function peg$parsewsBinaryMessage() {
  26444. var s0, s1, s2, s3, s4;
  26445. var key = peg$currPos * 61 + 49,
  26446. cached = peg$resultsCache[key];
  26447. if (cached) {
  26448. peg$currPos = cached.nextPos;
  26449. return cached.result;
  26450. }
  26451. s0 = peg$currPos;
  26452. s1 = peg$parsews();
  26453. if (s1 !== peg$FAILED) {
  26454. s2 = peg$parsebinarySelector();
  26455. if (s2 !== peg$FAILED) {
  26456. s3 = peg$parsews();
  26457. if (s3 !== peg$FAILED) {
  26458. s4 = peg$parseunarySend();
  26459. if (s4 !== peg$FAILED) {
  26460. peg$savedPos = s0;
  26461. s1 = peg$c114(s2, s4);
  26462. s0 = s1;
  26463. } else {
  26464. peg$currPos = s0;
  26465. s0 = peg$FAILED;
  26466. }
  26467. } else {
  26468. peg$currPos = s0;
  26469. s0 = peg$FAILED;
  26470. }
  26471. } else {
  26472. peg$currPos = s0;
  26473. s0 = peg$FAILED;
  26474. }
  26475. } else {
  26476. peg$currPos = s0;
  26477. s0 = peg$FAILED;
  26478. }
  26479. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26480. return s0;
  26481. }
  26482. function peg$parsewsBinaryTail() {
  26483. var s0, s1, s2;
  26484. var key = peg$currPos * 61 + 50,
  26485. cached = peg$resultsCache[key];
  26486. if (cached) {
  26487. peg$currPos = cached.nextPos;
  26488. return cached.result;
  26489. }
  26490. s0 = peg$currPos;
  26491. s1 = peg$parsewsBinaryMessage();
  26492. if (s1 !== peg$FAILED) {
  26493. s2 = peg$parsewsBinaryTail();
  26494. if (s2 === peg$FAILED) {
  26495. s2 = null;
  26496. }
  26497. if (s2 !== peg$FAILED) {
  26498. peg$savedPos = s0;
  26499. s1 = peg$c115(s1, s2);
  26500. s0 = s1;
  26501. } else {
  26502. peg$currPos = s0;
  26503. s0 = peg$FAILED;
  26504. }
  26505. } else {
  26506. peg$currPos = s0;
  26507. s0 = peg$FAILED;
  26508. }
  26509. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26510. return s0;
  26511. }
  26512. function peg$parsebinarySend() {
  26513. var s0, s1, s2;
  26514. var key = peg$currPos * 61 + 51,
  26515. cached = peg$resultsCache[key];
  26516. if (cached) {
  26517. peg$currPos = cached.nextPos;
  26518. return cached.result;
  26519. }
  26520. s0 = peg$currPos;
  26521. s1 = peg$parseunarySend();
  26522. if (s1 !== peg$FAILED) {
  26523. s2 = peg$parsewsBinaryTail();
  26524. if (s2 === peg$FAILED) {
  26525. s2 = null;
  26526. }
  26527. if (s2 !== peg$FAILED) {
  26528. peg$savedPos = s0;
  26529. s1 = peg$c113(s1, s2);
  26530. s0 = s1;
  26531. } else {
  26532. peg$currPos = s0;
  26533. s0 = peg$FAILED;
  26534. }
  26535. } else {
  26536. peg$currPos = s0;
  26537. s0 = peg$FAILED;
  26538. }
  26539. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26540. return s0;
  26541. }
  26542. function peg$parsewsKeywordMessage() {
  26543. var s0, s1, s2, s3, s4, s5, s6;
  26544. var key = peg$currPos * 61 + 52,
  26545. cached = peg$resultsCache[key];
  26546. if (cached) {
  26547. peg$currPos = cached.nextPos;
  26548. return cached.result;
  26549. }
  26550. s0 = peg$currPos;
  26551. s1 = [];
  26552. s2 = peg$currPos;
  26553. s3 = peg$parsews();
  26554. if (s3 !== peg$FAILED) {
  26555. s4 = peg$parsekeyword();
  26556. if (s4 !== peg$FAILED) {
  26557. s5 = peg$parsews();
  26558. if (s5 !== peg$FAILED) {
  26559. s6 = peg$parsebinarySend();
  26560. if (s6 !== peg$FAILED) {
  26561. peg$savedPos = s2;
  26562. s3 = peg$c83(s4, s6);
  26563. s2 = s3;
  26564. } else {
  26565. peg$currPos = s2;
  26566. s2 = peg$FAILED;
  26567. }
  26568. } else {
  26569. peg$currPos = s2;
  26570. s2 = peg$FAILED;
  26571. }
  26572. } else {
  26573. peg$currPos = s2;
  26574. s2 = peg$FAILED;
  26575. }
  26576. } else {
  26577. peg$currPos = s2;
  26578. s2 = peg$FAILED;
  26579. }
  26580. if (s2 !== peg$FAILED) {
  26581. while (s2 !== peg$FAILED) {
  26582. s1.push(s2);
  26583. s2 = peg$currPos;
  26584. s3 = peg$parsews();
  26585. if (s3 !== peg$FAILED) {
  26586. s4 = peg$parsekeyword();
  26587. if (s4 !== peg$FAILED) {
  26588. s5 = peg$parsews();
  26589. if (s5 !== peg$FAILED) {
  26590. s6 = peg$parsebinarySend();
  26591. if (s6 !== peg$FAILED) {
  26592. peg$savedPos = s2;
  26593. s3 = peg$c83(s4, s6);
  26594. s2 = s3;
  26595. } else {
  26596. peg$currPos = s2;
  26597. s2 = peg$FAILED;
  26598. }
  26599. } else {
  26600. peg$currPos = s2;
  26601. s2 = peg$FAILED;
  26602. }
  26603. } else {
  26604. peg$currPos = s2;
  26605. s2 = peg$FAILED;
  26606. }
  26607. } else {
  26608. peg$currPos = s2;
  26609. s2 = peg$FAILED;
  26610. }
  26611. }
  26612. } else {
  26613. s1 = peg$FAILED;
  26614. }
  26615. if (s1 !== peg$FAILED) {
  26616. peg$savedPos = s0;
  26617. s1 = peg$c116(s1);
  26618. }
  26619. s0 = s1;
  26620. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26621. return s0;
  26622. }
  26623. function peg$parsekeywordSend() {
  26624. var s0, s1, s2;
  26625. var key = peg$currPos * 61 + 53,
  26626. cached = peg$resultsCache[key];
  26627. if (cached) {
  26628. peg$currPos = cached.nextPos;
  26629. return cached.result;
  26630. }
  26631. s0 = peg$currPos;
  26632. s1 = peg$parsebinarySend();
  26633. if (s1 !== peg$FAILED) {
  26634. s2 = peg$parsewsKeywordMessage();
  26635. if (s2 === peg$FAILED) {
  26636. s2 = null;
  26637. }
  26638. if (s2 !== peg$FAILED) {
  26639. peg$savedPos = s0;
  26640. s1 = peg$c113(s1, s2);
  26641. s0 = s1;
  26642. } else {
  26643. peg$currPos = s0;
  26644. s0 = peg$FAILED;
  26645. }
  26646. } else {
  26647. peg$currPos = s0;
  26648. s0 = peg$FAILED;
  26649. }
  26650. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26651. return s0;
  26652. }
  26653. function peg$parsewsMessage() {
  26654. var s0;
  26655. var key = peg$currPos * 61 + 54,
  26656. cached = peg$resultsCache[key];
  26657. if (cached) {
  26658. peg$currPos = cached.nextPos;
  26659. return cached.result;
  26660. }
  26661. s0 = peg$parsewsBinaryMessage();
  26662. if (s0 === peg$FAILED) {
  26663. s0 = peg$parsewsUnaryMessage();
  26664. if (s0 === peg$FAILED) {
  26665. s0 = peg$parsewsKeywordMessage();
  26666. }
  26667. }
  26668. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26669. return s0;
  26670. }
  26671. function peg$parsecascade() {
  26672. var s0, s1, s2, s3, s4, s5, s6, s7;
  26673. var key = peg$currPos * 61 + 55,
  26674. cached = peg$resultsCache[key];
  26675. if (cached) {
  26676. peg$currPos = cached.nextPos;
  26677. return cached.result;
  26678. }
  26679. s0 = peg$currPos;
  26680. s1 = peg$parsekeywordSend();
  26681. if (s1 !== peg$FAILED) {
  26682. peg$savedPos = peg$currPos;
  26683. s2 = peg$c117(s1);
  26684. if (s2) {
  26685. s2 = void 0;
  26686. } else {
  26687. s2 = peg$FAILED;
  26688. }
  26689. if (s2 !== peg$FAILED) {
  26690. s3 = [];
  26691. s4 = peg$currPos;
  26692. s5 = peg$parsews();
  26693. if (s5 !== peg$FAILED) {
  26694. if (input.charCodeAt(peg$currPos) === 59) {
  26695. s6 = peg$c118;
  26696. peg$currPos++;
  26697. } else {
  26698. s6 = peg$FAILED;
  26699. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  26700. }
  26701. if (s6 !== peg$FAILED) {
  26702. s7 = peg$parsewsMessage();
  26703. if (s7 !== peg$FAILED) {
  26704. peg$savedPos = s4;
  26705. s5 = peg$c120(s1, s7);
  26706. s4 = s5;
  26707. } else {
  26708. peg$currPos = s4;
  26709. s4 = peg$FAILED;
  26710. }
  26711. } else {
  26712. peg$currPos = s4;
  26713. s4 = peg$FAILED;
  26714. }
  26715. } else {
  26716. peg$currPos = s4;
  26717. s4 = peg$FAILED;
  26718. }
  26719. if (s4 !== peg$FAILED) {
  26720. while (s4 !== peg$FAILED) {
  26721. s3.push(s4);
  26722. s4 = peg$currPos;
  26723. s5 = peg$parsews();
  26724. if (s5 !== peg$FAILED) {
  26725. if (input.charCodeAt(peg$currPos) === 59) {
  26726. s6 = peg$c118;
  26727. peg$currPos++;
  26728. } else {
  26729. s6 = peg$FAILED;
  26730. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  26731. }
  26732. if (s6 !== peg$FAILED) {
  26733. s7 = peg$parsewsMessage();
  26734. if (s7 !== peg$FAILED) {
  26735. peg$savedPos = s4;
  26736. s5 = peg$c120(s1, s7);
  26737. s4 = s5;
  26738. } else {
  26739. peg$currPos = s4;
  26740. s4 = peg$FAILED;
  26741. }
  26742. } else {
  26743. peg$currPos = s4;
  26744. s4 = peg$FAILED;
  26745. }
  26746. } else {
  26747. peg$currPos = s4;
  26748. s4 = peg$FAILED;
  26749. }
  26750. }
  26751. } else {
  26752. s3 = peg$FAILED;
  26753. }
  26754. if (s3 !== peg$FAILED) {
  26755. peg$savedPos = s0;
  26756. s1 = peg$c121(s1, s3);
  26757. s0 = s1;
  26758. } else {
  26759. peg$currPos = s0;
  26760. s0 = peg$FAILED;
  26761. }
  26762. } else {
  26763. peg$currPos = s0;
  26764. s0 = peg$FAILED;
  26765. }
  26766. } else {
  26767. peg$currPos = s0;
  26768. s0 = peg$FAILED;
  26769. }
  26770. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26771. return s0;
  26772. }
  26773. function peg$parsejsStatement() {
  26774. var s0, s1, s2, s3, s4;
  26775. var key = peg$currPos * 61 + 56,
  26776. cached = peg$resultsCache[key];
  26777. if (cached) {
  26778. peg$currPos = cached.nextPos;
  26779. return cached.result;
  26780. }
  26781. s0 = peg$currPos;
  26782. if (input.charCodeAt(peg$currPos) === 60) {
  26783. s1 = peg$c122;
  26784. peg$currPos++;
  26785. } else {
  26786. s1 = peg$FAILED;
  26787. if (peg$silentFails === 0) { peg$fail(peg$c123); }
  26788. }
  26789. if (s1 !== peg$FAILED) {
  26790. s2 = [];
  26791. s3 = peg$currPos;
  26792. if (input.substr(peg$currPos, 2) === peg$c124) {
  26793. s4 = peg$c124;
  26794. peg$currPos += 2;
  26795. } else {
  26796. s4 = peg$FAILED;
  26797. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  26798. }
  26799. if (s4 !== peg$FAILED) {
  26800. peg$savedPos = s3;
  26801. s4 = peg$c126();
  26802. }
  26803. s3 = s4;
  26804. if (s3 === peg$FAILED) {
  26805. if (peg$c127.test(input.charAt(peg$currPos))) {
  26806. s3 = input.charAt(peg$currPos);
  26807. peg$currPos++;
  26808. } else {
  26809. s3 = peg$FAILED;
  26810. if (peg$silentFails === 0) { peg$fail(peg$c128); }
  26811. }
  26812. }
  26813. while (s3 !== peg$FAILED) {
  26814. s2.push(s3);
  26815. s3 = peg$currPos;
  26816. if (input.substr(peg$currPos, 2) === peg$c124) {
  26817. s4 = peg$c124;
  26818. peg$currPos += 2;
  26819. } else {
  26820. s4 = peg$FAILED;
  26821. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  26822. }
  26823. if (s4 !== peg$FAILED) {
  26824. peg$savedPos = s3;
  26825. s4 = peg$c126();
  26826. }
  26827. s3 = s4;
  26828. if (s3 === peg$FAILED) {
  26829. if (peg$c127.test(input.charAt(peg$currPos))) {
  26830. s3 = input.charAt(peg$currPos);
  26831. peg$currPos++;
  26832. } else {
  26833. s3 = peg$FAILED;
  26834. if (peg$silentFails === 0) { peg$fail(peg$c128); }
  26835. }
  26836. }
  26837. }
  26838. if (s2 !== peg$FAILED) {
  26839. if (input.charCodeAt(peg$currPos) === 62) {
  26840. s3 = peg$c129;
  26841. peg$currPos++;
  26842. } else {
  26843. s3 = peg$FAILED;
  26844. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  26845. }
  26846. if (s3 !== peg$FAILED) {
  26847. peg$savedPos = s0;
  26848. s1 = peg$c131(s2);
  26849. s0 = s1;
  26850. } else {
  26851. peg$currPos = s0;
  26852. s0 = peg$FAILED;
  26853. }
  26854. } else {
  26855. peg$currPos = s0;
  26856. s0 = peg$FAILED;
  26857. }
  26858. } else {
  26859. peg$currPos = s0;
  26860. s0 = peg$FAILED;
  26861. }
  26862. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26863. return s0;
  26864. }
  26865. function peg$parsemethod() {
  26866. var s0, s1, s2;
  26867. var key = peg$currPos * 61 + 57,
  26868. cached = peg$resultsCache[key];
  26869. if (cached) {
  26870. peg$currPos = cached.nextPos;
  26871. return cached.result;
  26872. }
  26873. s0 = peg$currPos;
  26874. s1 = peg$parsewsKeywordPattern();
  26875. if (s1 === peg$FAILED) {
  26876. s1 = peg$parsewsBinaryPattern();
  26877. if (s1 === peg$FAILED) {
  26878. s1 = peg$parsewsUnaryPattern();
  26879. }
  26880. }
  26881. if (s1 !== peg$FAILED) {
  26882. s2 = peg$parsewsSequenceWs();
  26883. if (s2 === peg$FAILED) {
  26884. s2 = null;
  26885. }
  26886. if (s2 !== peg$FAILED) {
  26887. peg$savedPos = s0;
  26888. s1 = peg$c132(s1, s2);
  26889. s0 = s1;
  26890. } else {
  26891. peg$currPos = s0;
  26892. s0 = peg$FAILED;
  26893. }
  26894. } else {
  26895. peg$currPos = s0;
  26896. s0 = peg$FAILED;
  26897. }
  26898. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26899. return s0;
  26900. }
  26901. function peg$parseassociationSend() {
  26902. var s0, s1, s2;
  26903. var key = peg$currPos * 61 + 58,
  26904. cached = peg$resultsCache[key];
  26905. if (cached) {
  26906. peg$currPos = cached.nextPos;
  26907. return cached.result;
  26908. }
  26909. s0 = peg$currPos;
  26910. s1 = peg$parsebinarySend();
  26911. if (s1 !== peg$FAILED) {
  26912. peg$savedPos = peg$currPos;
  26913. s2 = peg$c133(s1);
  26914. if (s2) {
  26915. s2 = void 0;
  26916. } else {
  26917. s2 = peg$FAILED;
  26918. }
  26919. if (s2 !== peg$FAILED) {
  26920. peg$savedPos = s0;
  26921. s1 = peg$c134(s1);
  26922. s0 = s1;
  26923. } else {
  26924. peg$currPos = s0;
  26925. s0 = peg$FAILED;
  26926. }
  26927. } else {
  26928. peg$currPos = s0;
  26929. s0 = peg$FAILED;
  26930. }
  26931. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26932. return s0;
  26933. }
  26934. function peg$parsewsAssociationsRest() {
  26935. var s0, s1, s2, s3, s4;
  26936. var key = peg$currPos * 61 + 59,
  26937. cached = peg$resultsCache[key];
  26938. if (cached) {
  26939. peg$currPos = cached.nextPos;
  26940. return cached.result;
  26941. }
  26942. s0 = peg$currPos;
  26943. s1 = peg$parsews();
  26944. if (s1 !== peg$FAILED) {
  26945. if (input.charCodeAt(peg$currPos) === 46) {
  26946. s2 = peg$c6;
  26947. peg$currPos++;
  26948. } else {
  26949. s2 = peg$FAILED;
  26950. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  26951. }
  26952. if (s2 !== peg$FAILED) {
  26953. s3 = peg$parsemaybeDotsWs();
  26954. if (s3 !== peg$FAILED) {
  26955. s4 = peg$parseassociationSend();
  26956. if (s4 !== peg$FAILED) {
  26957. peg$savedPos = s0;
  26958. s1 = peg$c87(s4);
  26959. s0 = s1;
  26960. } else {
  26961. peg$currPos = s0;
  26962. s0 = peg$FAILED;
  26963. }
  26964. } else {
  26965. peg$currPos = s0;
  26966. s0 = peg$FAILED;
  26967. }
  26968. } else {
  26969. peg$currPos = s0;
  26970. s0 = peg$FAILED;
  26971. }
  26972. } else {
  26973. peg$currPos = s0;
  26974. s0 = peg$FAILED;
  26975. }
  26976. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26977. return s0;
  26978. }
  26979. function peg$parseassociations() {
  26980. var s0, s1, s2, s3;
  26981. var key = peg$currPos * 61 + 60,
  26982. cached = peg$resultsCache[key];
  26983. if (cached) {
  26984. peg$currPos = cached.nextPos;
  26985. return cached.result;
  26986. }
  26987. s0 = peg$currPos;
  26988. s1 = peg$parseassociationSend();
  26989. if (s1 !== peg$FAILED) {
  26990. s2 = [];
  26991. s3 = peg$parsewsAssociationsRest();
  26992. while (s3 !== peg$FAILED) {
  26993. s2.push(s3);
  26994. s3 = peg$parsewsAssociationsRest();
  26995. }
  26996. if (s2 !== peg$FAILED) {
  26997. peg$savedPos = s0;
  26998. s1 = peg$c135(s1, s2);
  26999. s0 = s1;
  27000. } else {
  27001. peg$currPos = s0;
  27002. s0 = peg$FAILED;
  27003. }
  27004. } else {
  27005. peg$currPos = s0;
  27006. s0 = peg$FAILED;
  27007. }
  27008. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27009. return s0;
  27010. }
  27011. peg$result = peg$startRuleFunction();
  27012. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  27013. return peg$result;
  27014. } else {
  27015. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  27016. peg$fail({ type: "end", description: "end of input" });
  27017. }
  27018. throw peg$buildException(
  27019. null,
  27020. peg$maxFailExpected,
  27021. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  27022. peg$maxFailPos < input.length
  27023. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  27024. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  27025. );
  27026. }
  27027. }
  27028. return {
  27029. SyntaxError: peg$SyntaxError,
  27030. parse: peg$parse
  27031. };
  27032. })();
  27033. });
  27034. define("amber_core/Platform-ImportExport", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Platform-Services", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Classes"], function($boot){"use strict";
  27035. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  27036. $core.addPackage('Platform-ImportExport');
  27037. $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  27038. $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  27039. $core.addClass('AbstractExporter', $globals.Object, [], 'Platform-ImportExport');
  27040. $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.";
  27041. $core.addMethod(
  27042. $core.method({
  27043. selector: "classNameFor:",
  27044. protocol: 'convenience',
  27045. fn: function (aClass){
  27046. var self=this;
  27047. return $core.withContext(function($ctx1) {
  27048. var $1,$2,$receiver;
  27049. $1=$recv(aClass)._isMetaclass();
  27050. if($core.assert($1)){
  27051. $2=$recv($recv(aClass)._instanceClass())._name();
  27052. $ctx1.sendIdx["name"]=1;
  27053. return $recv($2).__comma(" class");
  27054. } else {
  27055. if(($receiver = aClass) == null || $receiver.isNil){
  27056. return "nil";
  27057. } else {
  27058. return $recv(aClass)._name();
  27059. };
  27060. };
  27061. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractExporter)});
  27062. },
  27063. args: ["aClass"],
  27064. 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 ] ]",
  27065. referencedClasses: [],
  27066. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "ifNil:ifNotNil:"]
  27067. }),
  27068. $globals.AbstractExporter);
  27069. $core.addMethod(
  27070. $core.method({
  27071. selector: "exportPackage:on:",
  27072. protocol: 'output',
  27073. fn: function (aPackage,aStream){
  27074. var self=this;
  27075. return $core.withContext(function($ctx1) {
  27076. self._subclassResponsibility();
  27077. return self;
  27078. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  27079. },
  27080. args: ["aPackage", "aStream"],
  27081. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27082. referencedClasses: [],
  27083. messageSends: ["subclassResponsibility"]
  27084. }),
  27085. $globals.AbstractExporter);
  27086. $core.addMethod(
  27087. $core.method({
  27088. selector: "extensionMethodsOfPackage:",
  27089. protocol: 'accessing',
  27090. fn: function (aPackage){
  27091. var self=this;
  27092. var result;
  27093. return $core.withContext(function($ctx1) {
  27094. result=$recv($globals.OrderedCollection)._new();
  27095. $recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  27096. return $core.withContext(function($ctx2) {
  27097. return $recv(result)._addAll_($recv(each)._methods());
  27098. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27099. }));
  27100. return result;
  27101. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  27102. },
  27103. args: ["aPackage"],
  27104. 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",
  27105. referencedClasses: ["OrderedCollection"],
  27106. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"]
  27107. }),
  27108. $globals.AbstractExporter);
  27109. $core.addMethod(
  27110. $core.method({
  27111. selector: "extensionProtocolsOfPackage:",
  27112. protocol: 'accessing',
  27113. fn: function (aPackage){
  27114. var self=this;
  27115. var extensionName,result;
  27116. return $core.withContext(function($ctx1) {
  27117. var $1,$2,$3;
  27118. $1=$recv(aPackage)._name();
  27119. $ctx1.sendIdx["name"]=1;
  27120. extensionName="*".__comma($1);
  27121. result=$recv($globals.OrderedCollection)._new();
  27122. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  27123. return $core.withContext(function($ctx2) {
  27124. $2=$recv(a)._name();
  27125. $ctx2.sendIdx["name"]=2;
  27126. return $recv($2).__lt($recv(b)._name());
  27127. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  27128. })))._do_((function(each){
  27129. return $core.withContext(function($ctx2) {
  27130. return $recv([each,$recv(each)._class()])._do_((function(behavior){
  27131. return $core.withContext(function($ctx3) {
  27132. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  27133. if($core.assert($3)){
  27134. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  27135. };
  27136. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  27137. }));
  27138. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27139. }));
  27140. $ctx1.sendIdx["do:"]=1;
  27141. return result;
  27142. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  27143. },
  27144. args: ["aPackage"],
  27145. 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",
  27146. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  27147. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  27148. }),
  27149. $globals.AbstractExporter);
  27150. $core.addClass('ChunkExporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27151. $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.";
  27152. $core.addMethod(
  27153. $core.method({
  27154. selector: "chunkEscape:",
  27155. protocol: 'convenience',
  27156. fn: function (aString){
  27157. var self=this;
  27158. return $core.withContext(function($ctx1) {
  27159. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  27160. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  27161. },
  27162. args: ["aString"],
  27163. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  27164. referencedClasses: [],
  27165. messageSends: ["trimBoth", "replace:with:"]
  27166. }),
  27167. $globals.ChunkExporter);
  27168. $core.addMethod(
  27169. $core.method({
  27170. selector: "exportCategoryEpilogueOf:on:",
  27171. protocol: 'output',
  27172. fn: function (aCategory,aStream){
  27173. var self=this;
  27174. return $core.withContext(function($ctx1) {
  27175. $recv(aStream)._nextPutAll_(" !");
  27176. $recv(aStream)._lf();
  27177. $ctx1.sendIdx["lf"]=1;
  27178. $recv(aStream)._lf();
  27179. return self;
  27180. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27181. },
  27182. args: ["aCategory", "aStream"],
  27183. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27184. referencedClasses: [],
  27185. messageSends: ["nextPutAll:", "lf"]
  27186. }),
  27187. $globals.ChunkExporter);
  27188. $core.addMethod(
  27189. $core.method({
  27190. selector: "exportCategoryPrologueOf:on:",
  27191. protocol: 'output',
  27192. fn: function (aCategory,aStream){
  27193. var self=this;
  27194. return $core.withContext(function($ctx1) {
  27195. var $1,$2;
  27196. $1="!".__comma(self._classNameFor_($recv(aCategory)._theClass()));
  27197. $ctx1.sendIdx[","]=1;
  27198. $recv(aStream)._nextPutAll_($1);
  27199. $ctx1.sendIdx["nextPutAll:"]=1;
  27200. $2=$recv(" methodsFor: '".__comma($recv(aCategory)._name())).__comma("'!");
  27201. $ctx1.sendIdx[","]=2;
  27202. $recv(aStream)._nextPutAll_($2);
  27203. return self;
  27204. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27205. },
  27206. args: ["aCategory", "aStream"],
  27207. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  27208. referencedClasses: [],
  27209. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27210. }),
  27211. $globals.ChunkExporter);
  27212. $core.addMethod(
  27213. $core.method({
  27214. selector: "exportDefinitionOf:on:",
  27215. protocol: 'output',
  27216. fn: function (aClass,aStream){
  27217. var self=this;
  27218. return $core.withContext(function($ctx1) {
  27219. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12;
  27220. $1=self._classNameFor_($recv(aClass)._superclass());
  27221. $ctx1.sendIdx["classNameFor:"]=1;
  27222. $recv(aStream)._nextPutAll_($1);
  27223. $ctx1.sendIdx["nextPutAll:"]=1;
  27224. $3=self._classNameFor_(aClass);
  27225. $ctx1.sendIdx["classNameFor:"]=2;
  27226. $2=" subclass: #".__comma($3);
  27227. $ctx1.sendIdx[","]=1;
  27228. $recv(aStream)._nextPutAll_($2);
  27229. $ctx1.sendIdx["nextPutAll:"]=2;
  27230. $recv(aStream)._lf();
  27231. $ctx1.sendIdx["lf"]=1;
  27232. $recv(aStream)._tab();
  27233. $ctx1.sendIdx["tab"]=1;
  27234. $4=$recv(aStream)._nextPutAll_("instanceVariableNames: '");
  27235. $ctx1.sendIdx["nextPutAll:"]=3;
  27236. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27237. return $core.withContext(function($ctx2) {
  27238. return $recv(aStream)._nextPutAll_(each);
  27239. $ctx2.sendIdx["nextPutAll:"]=4;
  27240. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27241. }),(function(){
  27242. return $core.withContext(function($ctx2) {
  27243. return $recv(aStream)._nextPutAll_(" ");
  27244. $ctx2.sendIdx["nextPutAll:"]=5;
  27245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27246. }));
  27247. $recv(aStream)._nextPutAll_("'");
  27248. $ctx1.sendIdx["nextPutAll:"]=6;
  27249. $recv(aStream)._lf();
  27250. $ctx1.sendIdx["lf"]=2;
  27251. $recv(aStream)._tab();
  27252. $6="package: '".__comma($recv(aClass)._category());
  27253. $ctx1.sendIdx[","]=3;
  27254. $5=$recv($6).__comma("'!");
  27255. $ctx1.sendIdx[","]=2;
  27256. $recv(aStream)._nextPutAll_($5);
  27257. $ctx1.sendIdx["nextPutAll:"]=7;
  27258. $7=$recv(aStream)._lf();
  27259. $ctx1.sendIdx["lf"]=3;
  27260. $9=$recv(aClass)._comment();
  27261. $ctx1.sendIdx["comment"]=1;
  27262. $8=$recv($9)._notEmpty();
  27263. if($core.assert($8)){
  27264. $11="!".__comma(self._classNameFor_(aClass));
  27265. $ctx1.sendIdx[","]=5;
  27266. $10=$recv($11).__comma(" commentStamp!");
  27267. $ctx1.sendIdx[","]=4;
  27268. $recv(aStream)._nextPutAll_($10);
  27269. $ctx1.sendIdx["nextPutAll:"]=8;
  27270. $recv(aStream)._lf();
  27271. $ctx1.sendIdx["lf"]=4;
  27272. $recv(aStream)._nextPutAll_($recv(self._chunkEscape_($recv(aClass)._comment())).__comma("!"));
  27273. $12=$recv(aStream)._lf();
  27274. $ctx1.sendIdx["lf"]=5;
  27275. $12;
  27276. };
  27277. $recv(aStream)._lf();
  27278. return self;
  27279. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27280. },
  27281. args: ["aClass", "aStream"],
  27282. 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 notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass), ' commentStamp!';lf;\x0a\x09\x09nextPutAll: (self chunkEscape: aClass comment), '!';lf ].\x0a\x09aStream lf",
  27283. referencedClasses: [],
  27284. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"]
  27285. }),
  27286. $globals.ChunkExporter);
  27287. $core.addMethod(
  27288. $core.method({
  27289. selector: "exportMetaDefinitionOf:on:",
  27290. protocol: 'output',
  27291. fn: function (aClass,aStream){
  27292. var self=this;
  27293. return $core.withContext(function($ctx1) {
  27294. var $3,$2,$1,$5,$4,$6;
  27295. $3=$recv(aClass)._class();
  27296. $ctx1.sendIdx["class"]=1;
  27297. $2=$recv($3)._instanceVariableNames();
  27298. $ctx1.sendIdx["instanceVariableNames"]=1;
  27299. $1=$recv($2)._isEmpty();
  27300. if(!$core.assert($1)){
  27301. $5=$recv(aClass)._class();
  27302. $ctx1.sendIdx["class"]=2;
  27303. $4=self._classNameFor_($5);
  27304. $recv(aStream)._nextPutAll_($4);
  27305. $ctx1.sendIdx["nextPutAll:"]=1;
  27306. $6=$recv(aStream)._nextPutAll_(" instanceVariableNames: '");
  27307. $ctx1.sendIdx["nextPutAll:"]=2;
  27308. $6;
  27309. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  27310. return $core.withContext(function($ctx2) {
  27311. return $recv(aStream)._nextPutAll_(each);
  27312. $ctx2.sendIdx["nextPutAll:"]=3;
  27313. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27314. }),(function(){
  27315. return $core.withContext(function($ctx2) {
  27316. return $recv(aStream)._nextPutAll_(" ");
  27317. $ctx2.sendIdx["nextPutAll:"]=4;
  27318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27319. }));
  27320. $recv(aStream)._nextPutAll_("'!");
  27321. $recv(aStream)._lf();
  27322. $ctx1.sendIdx["lf"]=1;
  27323. $recv(aStream)._lf();
  27324. };
  27325. return self;
  27326. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27327. },
  27328. args: ["aClass", "aStream"],
  27329. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: (self classNameFor: aClass class);\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '''!'; lf; lf ]",
  27330. referencedClasses: [],
  27331. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"]
  27332. }),
  27333. $globals.ChunkExporter);
  27334. $core.addMethod(
  27335. $core.method({
  27336. selector: "exportMethod:on:",
  27337. protocol: 'output',
  27338. fn: function (aMethod,aStream){
  27339. var self=this;
  27340. return $core.withContext(function($ctx1) {
  27341. $recv(aStream)._lf();
  27342. $ctx1.sendIdx["lf"]=1;
  27343. $recv(aStream)._lf();
  27344. $ctx1.sendIdx["lf"]=2;
  27345. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aMethod)._source()));
  27346. $ctx1.sendIdx["nextPutAll:"]=1;
  27347. $recv(aStream)._lf();
  27348. $recv(aStream)._nextPutAll_("!");
  27349. return self;
  27350. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  27351. },
  27352. args: ["aMethod", "aStream"],
  27353. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  27354. referencedClasses: [],
  27355. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]
  27356. }),
  27357. $globals.ChunkExporter);
  27358. $core.addMethod(
  27359. $core.method({
  27360. selector: "exportPackage:on:",
  27361. protocol: 'output',
  27362. fn: function (aPackage,aStream){
  27363. var self=this;
  27364. return $core.withContext(function($ctx1) {
  27365. var $1;
  27366. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27367. self._exportPackageImportsOf_on_(aPackage,aStream);
  27368. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27369. return $core.withContext(function($ctx2) {
  27370. self._exportDefinitionOf_on_(each,aStream);
  27371. $1=self._ownMethodProtocolsOfClass_(each);
  27372. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  27373. self._exportProtocols_on_($1,aStream);
  27374. $ctx2.sendIdx["exportProtocols:on:"]=1;
  27375. self._exportMetaDefinitionOf_on_(each,aStream);
  27376. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_($recv(each)._class()),aStream);
  27377. $ctx2.sendIdx["exportProtocols:on:"]=2;
  27378. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27379. }));
  27380. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  27381. return self;
  27382. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27383. },
  27384. args: ["aPackage", "aStream"],
  27385. 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",
  27386. referencedClasses: [],
  27387. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"]
  27388. }),
  27389. $globals.ChunkExporter);
  27390. $core.addMethod(
  27391. $core.method({
  27392. selector: "exportPackageDefinitionOf:on:",
  27393. protocol: 'output',
  27394. fn: function (aPackage,aStream){
  27395. var self=this;
  27396. return $core.withContext(function($ctx1) {
  27397. var $1;
  27398. $1=$recv("Smalltalk createPackage: '".__comma($recv(aPackage)._name())).__comma("'!");
  27399. $ctx1.sendIdx[","]=1;
  27400. $recv(aStream)._nextPutAll_($1);
  27401. $recv(aStream)._lf();
  27402. return self;
  27403. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27404. },
  27405. args: ["aPackage", "aStream"],
  27406. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  27407. referencedClasses: [],
  27408. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27409. }),
  27410. $globals.ChunkExporter);
  27411. $core.addMethod(
  27412. $core.method({
  27413. selector: "exportPackageImportsOf:on:",
  27414. protocol: 'output',
  27415. fn: function (aPackage,aStream){
  27416. var self=this;
  27417. return $core.withContext(function($ctx1) {
  27418. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  27419. return $core.withContext(function($ctx2) {
  27420. $recv(aStream)._nextPutAll_("(Smalltalk packageAt: '");
  27421. $ctx2.sendIdx["nextPutAll:"]=1;
  27422. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  27423. $ctx2.sendIdx["nextPutAll:"]=2;
  27424. $recv(aStream)._nextPutAll_("') imports: ");
  27425. $ctx2.sendIdx["nextPutAll:"]=3;
  27426. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aPackage)._importsDefinition()));
  27427. $ctx2.sendIdx["nextPutAll:"]=4;
  27428. $recv(aStream)._nextPutAll_("!");
  27429. return $recv(aStream)._lf();
  27430. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27431. }));
  27432. return self;
  27433. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27434. },
  27435. args: ["aPackage", "aStream"],
  27436. 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 ]",
  27437. referencedClasses: [],
  27438. messageSends: ["ifNotEmpty:", "imports", "nextPutAll:", "name", "chunkEscape:", "importsDefinition", "lf"]
  27439. }),
  27440. $globals.ChunkExporter);
  27441. $core.addMethod(
  27442. $core.method({
  27443. selector: "exportProtocol:on:",
  27444. protocol: 'output',
  27445. fn: function (aProtocol,aStream){
  27446. var self=this;
  27447. return $core.withContext(function($ctx1) {
  27448. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  27449. $recv($recv(aProtocol)._methods())._do_((function(method){
  27450. return $core.withContext(function($ctx2) {
  27451. return self._exportMethod_on_(method,aStream);
  27452. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  27453. }));
  27454. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  27455. return self;
  27456. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27457. },
  27458. args: ["aProtocol", "aStream"],
  27459. 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",
  27460. referencedClasses: [],
  27461. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  27462. }),
  27463. $globals.ChunkExporter);
  27464. $core.addMethod(
  27465. $core.method({
  27466. selector: "exportProtocolEpilogueOf:on:",
  27467. protocol: 'output',
  27468. fn: function (aProtocol,aStream){
  27469. var self=this;
  27470. return $core.withContext(function($ctx1) {
  27471. $recv(aStream)._nextPutAll_(" !");
  27472. $recv(aStream)._lf();
  27473. $ctx1.sendIdx["lf"]=1;
  27474. $recv(aStream)._lf();
  27475. return self;
  27476. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27477. },
  27478. args: ["aProtocol", "aStream"],
  27479. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27480. referencedClasses: [],
  27481. messageSends: ["nextPutAll:", "lf"]
  27482. }),
  27483. $globals.ChunkExporter);
  27484. $core.addMethod(
  27485. $core.method({
  27486. selector: "exportProtocolPrologueOf:on:",
  27487. protocol: 'output',
  27488. fn: function (aProtocol,aStream){
  27489. var self=this;
  27490. return $core.withContext(function($ctx1) {
  27491. var $1,$2;
  27492. $1="!".__comma(self._classNameFor_($recv(aProtocol)._theClass()));
  27493. $ctx1.sendIdx[","]=1;
  27494. $recv(aStream)._nextPutAll_($1);
  27495. $ctx1.sendIdx["nextPutAll:"]=1;
  27496. $2=$recv(" methodsFor: '".__comma($recv(aProtocol)._name())).__comma("'!");
  27497. $ctx1.sendIdx[","]=2;
  27498. $recv(aStream)._nextPutAll_($2);
  27499. return self;
  27500. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27501. },
  27502. args: ["aProtocol", "aStream"],
  27503. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  27504. referencedClasses: [],
  27505. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27506. }),
  27507. $globals.ChunkExporter);
  27508. $core.addMethod(
  27509. $core.method({
  27510. selector: "exportProtocols:on:",
  27511. protocol: 'output',
  27512. fn: function (aCollection,aStream){
  27513. var self=this;
  27514. return $core.withContext(function($ctx1) {
  27515. $recv(aCollection)._do_((function(each){
  27516. return $core.withContext(function($ctx2) {
  27517. return self._exportProtocol_on_(each,aStream);
  27518. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27519. }));
  27520. return self;
  27521. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  27522. },
  27523. args: ["aCollection", "aStream"],
  27524. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  27525. referencedClasses: [],
  27526. messageSends: ["do:", "exportProtocol:on:"]
  27527. }),
  27528. $globals.ChunkExporter);
  27529. $core.addMethod(
  27530. $core.method({
  27531. selector: "extensionCategoriesOfPackage:",
  27532. protocol: 'accessing',
  27533. fn: function (aPackage){
  27534. var self=this;
  27535. var name,map,result;
  27536. return $core.withContext(function($ctx1) {
  27537. var $1;
  27538. name=$recv(aPackage)._name();
  27539. result=$recv($globals.OrderedCollection)._new();
  27540. $ctx1.sendIdx["new"]=1;
  27541. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  27542. return $core.withContext(function($ctx2) {
  27543. return $recv([each,$recv(each)._class()])._do_((function(aClass){
  27544. return $core.withContext(function($ctx3) {
  27545. map=$recv($globals.Dictionary)._new();
  27546. map;
  27547. $recv(aClass)._protocolsDo_((function(category,methods){
  27548. return $core.withContext(function($ctx4) {
  27549. $1=$recv(category).__eq("*".__comma(name));
  27550. if($core.assert($1)){
  27551. return $recv(map)._at_put_(category,methods);
  27552. };
  27553. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  27554. }));
  27555. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27556. return $core.withContext(function($ctx4) {
  27557. return $recv(a).__lt_eq(b);
  27558. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  27559. })))._collect_((function(category){
  27560. return $core.withContext(function($ctx4) {
  27561. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  27562. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  27563. })));
  27564. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  27565. }));
  27566. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27567. }));
  27568. $ctx1.sendIdx["do:"]=1;
  27569. return result;
  27570. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  27571. },
  27572. args: ["aPackage"],
  27573. 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",
  27574. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  27575. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27576. }),
  27577. $globals.ChunkExporter);
  27578. $core.addMethod(
  27579. $core.method({
  27580. selector: "ownCategoriesOfClass:",
  27581. protocol: 'accessing',
  27582. fn: function (aClass){
  27583. var self=this;
  27584. var map;
  27585. return $core.withContext(function($ctx1) {
  27586. var $1;
  27587. map=$recv($globals.Dictionary)._new();
  27588. $recv(aClass)._protocolsDo_((function(each,methods){
  27589. return $core.withContext(function($ctx2) {
  27590. $1=$recv(each)._match_("^\x5c*");
  27591. if(!$core.assert($1)){
  27592. return $recv(map)._at_put_(each,methods);
  27593. };
  27594. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  27595. }));
  27596. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27597. return $core.withContext(function($ctx2) {
  27598. return $recv(a).__lt_eq(b);
  27599. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  27600. })))._collect_((function(each){
  27601. return $core.withContext(function($ctx2) {
  27602. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  27603. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27604. }));
  27605. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  27606. },
  27607. args: ["aClass"],
  27608. 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) ]",
  27609. referencedClasses: ["Dictionary", "MethodCategory"],
  27610. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27611. }),
  27612. $globals.ChunkExporter);
  27613. $core.addMethod(
  27614. $core.method({
  27615. selector: "ownCategoriesOfMetaClass:",
  27616. protocol: 'accessing',
  27617. fn: function (aClass){
  27618. var self=this;
  27619. return $core.withContext(function($ctx1) {
  27620. return self._ownCategoriesOfClass_($recv(aClass)._class());
  27621. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  27622. },
  27623. args: ["aClass"],
  27624. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  27625. referencedClasses: [],
  27626. messageSends: ["ownCategoriesOfClass:", "class"]
  27627. }),
  27628. $globals.ChunkExporter);
  27629. $core.addMethod(
  27630. $core.method({
  27631. selector: "ownMethodProtocolsOfClass:",
  27632. protocol: 'accessing',
  27633. fn: function (aClass){
  27634. var self=this;
  27635. return $core.withContext(function($ctx1) {
  27636. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  27637. return $core.withContext(function($ctx2) {
  27638. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  27639. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27640. }));
  27641. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  27642. },
  27643. args: ["aClass"],
  27644. 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 ]",
  27645. referencedClasses: ["ExportMethodProtocol"],
  27646. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  27647. }),
  27648. $globals.ChunkExporter);
  27649. $core.addClass('Exporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27650. $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.).";
  27651. $core.addMethod(
  27652. $core.method({
  27653. selector: "exportDefinitionOf:on:",
  27654. protocol: 'output',
  27655. fn: function (aClass,aStream){
  27656. var self=this;
  27657. return $core.withContext(function($ctx1) {
  27658. var $2,$1,$3,$4,$6,$5,$7,$9,$8;
  27659. $recv(aStream)._lf();
  27660. $ctx1.sendIdx["lf"]=1;
  27661. $recv(aStream)._nextPutAll_("$core.addClass(");
  27662. $ctx1.sendIdx["nextPutAll:"]=1;
  27663. $2="'".__comma(self._classNameFor_(aClass));
  27664. $ctx1.sendIdx[","]=2;
  27665. $1=$recv($2).__comma("', ");
  27666. $ctx1.sendIdx[","]=1;
  27667. $recv(aStream)._nextPutAll_($1);
  27668. $ctx1.sendIdx["nextPutAll:"]=2;
  27669. $3=self._jsClassNameFor_($recv(aClass)._superclass());
  27670. $ctx1.sendIdx["jsClassNameFor:"]=1;
  27671. $recv(aStream)._nextPutAll_($3);
  27672. $ctx1.sendIdx["nextPutAll:"]=3;
  27673. $4=$recv(aStream)._nextPutAll_(", [");
  27674. $ctx1.sendIdx["nextPutAll:"]=4;
  27675. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27676. return $core.withContext(function($ctx2) {
  27677. $6="'".__comma(each);
  27678. $ctx2.sendIdx[","]=4;
  27679. $5=$recv($6).__comma("'");
  27680. $ctx2.sendIdx[","]=3;
  27681. return $recv(aStream)._nextPutAll_($5);
  27682. $ctx2.sendIdx["nextPutAll:"]=5;
  27683. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27684. }),(function(){
  27685. return $core.withContext(function($ctx2) {
  27686. return $recv(aStream)._nextPutAll_(", ");
  27687. $ctx2.sendIdx["nextPutAll:"]=6;
  27688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27689. }));
  27690. $recv(aStream)._nextPutAll_("], '");
  27691. $ctx1.sendIdx["nextPutAll:"]=7;
  27692. $recv(aStream)._nextPutAll_($recv($recv(aClass)._category()).__comma("'"));
  27693. $ctx1.sendIdx["nextPutAll:"]=8;
  27694. $7=$recv(aStream)._nextPutAll_(");");
  27695. $ctx1.sendIdx["nextPutAll:"]=9;
  27696. $9=$recv(aClass)._comment();
  27697. $ctx1.sendIdx["comment"]=1;
  27698. $8=$recv($9)._notEmpty();
  27699. if($core.assert($8)){
  27700. $recv(aStream)._lf();
  27701. $ctx1.sendIdx["lf"]=2;
  27702. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27703. $ctx1.sendIdx["nextPutAll:"]=10;
  27704. $recv(aStream)._lf();
  27705. $ctx1.sendIdx["lf"]=3;
  27706. $recv(aStream)._nextPutAll_(self._jsClassNameFor_(aClass));
  27707. $ctx1.sendIdx["nextPutAll:"]=11;
  27708. $recv(aStream)._nextPutAll_(".comment=");
  27709. $ctx1.sendIdx["nextPutAll:"]=12;
  27710. $recv(aStream)._nextPutAll_($recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavascript());
  27711. $ctx1.sendIdx["nextPutAll:"]=13;
  27712. $recv(aStream)._nextPutAll_(";");
  27713. $ctx1.sendIdx["nextPutAll:"]=14;
  27714. $recv(aStream)._lf();
  27715. $ctx1.sendIdx["lf"]=4;
  27716. $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27717. };
  27718. $recv(aStream)._lf();
  27719. return self;
  27720. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27721. },
  27722. args: ["aClass", "aStream"],
  27723. 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 notEmpty ifTrue: [\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",
  27724. referencedClasses: [],
  27725. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript", "crlfSanitized"]
  27726. }),
  27727. $globals.Exporter);
  27728. $core.addMethod(
  27729. $core.method({
  27730. selector: "exportMetaDefinitionOf:on:",
  27731. protocol: 'output',
  27732. fn: function (aClass,aStream){
  27733. var self=this;
  27734. return $core.withContext(function($ctx1) {
  27735. var $3,$2,$1,$5,$4,$6,$8,$7;
  27736. $recv(aStream)._lf();
  27737. $ctx1.sendIdx["lf"]=1;
  27738. $3=$recv(aClass)._class();
  27739. $ctx1.sendIdx["class"]=1;
  27740. $2=$recv($3)._instanceVariableNames();
  27741. $ctx1.sendIdx["instanceVariableNames"]=1;
  27742. $1=$recv($2)._isEmpty();
  27743. if(!$core.assert($1)){
  27744. $5=$recv(aClass)._class();
  27745. $ctx1.sendIdx["class"]=2;
  27746. $4=self._jsClassNameFor_($5);
  27747. $recv(aStream)._nextPutAll_($4);
  27748. $ctx1.sendIdx["nextPutAll:"]=1;
  27749. $6=$recv(aStream)._nextPutAll_(".iVarNames = [");
  27750. $ctx1.sendIdx["nextPutAll:"]=2;
  27751. $6;
  27752. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  27753. return $core.withContext(function($ctx2) {
  27754. $8="'".__comma(each);
  27755. $ctx2.sendIdx[","]=2;
  27756. $7=$recv($8).__comma("'");
  27757. $ctx2.sendIdx[","]=1;
  27758. return $recv(aStream)._nextPutAll_($7);
  27759. $ctx2.sendIdx["nextPutAll:"]=3;
  27760. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27761. }),(function(){
  27762. return $core.withContext(function($ctx2) {
  27763. return $recv(aStream)._nextPutAll_(",");
  27764. $ctx2.sendIdx["nextPutAll:"]=4;
  27765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27766. }));
  27767. $recv(aStream)._nextPutAll_("];".__comma($recv($globals.String)._lf()));
  27768. };
  27769. return self;
  27770. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27771. },
  27772. args: ["aClass", "aStream"],
  27773. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ',' ].\x0a\x09\x09aStream nextPutAll: '];', String lf ]",
  27774. referencedClasses: ["String"],
  27775. messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","]
  27776. }),
  27777. $globals.Exporter);
  27778. $core.addMethod(
  27779. $core.method({
  27780. selector: "exportMethod:on:",
  27781. protocol: 'output',
  27782. fn: function (aMethod,aStream){
  27783. var self=this;
  27784. return $core.withContext(function($ctx1) {
  27785. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14;
  27786. $recv(aStream)._nextPutAll_("$core.addMethod(");
  27787. $ctx1.sendIdx["nextPutAll:"]=1;
  27788. $recv(aStream)._lf();
  27789. $ctx1.sendIdx["lf"]=1;
  27790. $recv(aStream)._nextPutAll_("$core.method({");
  27791. $ctx1.sendIdx["nextPutAll:"]=2;
  27792. $recv(aStream)._lf();
  27793. $ctx1.sendIdx["lf"]=2;
  27794. $3=$recv($recv(aMethod)._selector())._asJavascript();
  27795. $ctx1.sendIdx["asJavascript"]=1;
  27796. $2="selector: ".__comma($3);
  27797. $ctx1.sendIdx[","]=2;
  27798. $1=$recv($2).__comma(",");
  27799. $ctx1.sendIdx[","]=1;
  27800. $recv(aStream)._nextPutAll_($1);
  27801. $ctx1.sendIdx["nextPutAll:"]=3;
  27802. $recv(aStream)._lf();
  27803. $ctx1.sendIdx["lf"]=3;
  27804. $5="protocol: '".__comma($recv(aMethod)._protocol());
  27805. $ctx1.sendIdx[","]=4;
  27806. $4=$recv($5).__comma("',");
  27807. $ctx1.sendIdx[","]=3;
  27808. $recv(aStream)._nextPutAll_($4);
  27809. $ctx1.sendIdx["nextPutAll:"]=4;
  27810. $recv(aStream)._lf();
  27811. $ctx1.sendIdx["lf"]=4;
  27812. $7="fn: ".__comma($recv($recv(aMethod)._fn())._compiledSource());
  27813. $ctx1.sendIdx[","]=6;
  27814. $6=$recv($7).__comma(",");
  27815. $ctx1.sendIdx[","]=5;
  27816. $recv(aStream)._nextPutAll_($6);
  27817. $ctx1.sendIdx["nextPutAll:"]=5;
  27818. $recv(aStream)._lf();
  27819. $ctx1.sendIdx["lf"]=5;
  27820. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27821. $ctx1.sendIdx["nextPutAll:"]=6;
  27822. $recv(aStream)._lf();
  27823. $ctx1.sendIdx["lf"]=6;
  27824. $10=$recv($recv(aMethod)._arguments())._asJavascript();
  27825. $ctx1.sendIdx["asJavascript"]=2;
  27826. $9="args: ".__comma($10);
  27827. $ctx1.sendIdx[","]=8;
  27828. $8=$recv($9).__comma(",");
  27829. $ctx1.sendIdx[","]=7;
  27830. $recv(aStream)._nextPutAll_($8);
  27831. $ctx1.sendIdx["nextPutAll:"]=7;
  27832. $recv(aStream)._lf();
  27833. $ctx1.sendIdx["lf"]=7;
  27834. $13=$recv($recv(aMethod)._source())._asJavascript();
  27835. $ctx1.sendIdx["asJavascript"]=3;
  27836. $12="source: ".__comma($13);
  27837. $ctx1.sendIdx[","]=10;
  27838. $11=$recv($12).__comma(",");
  27839. $ctx1.sendIdx[","]=9;
  27840. $recv(aStream)._nextPutAll_($11);
  27841. $ctx1.sendIdx["nextPutAll:"]=8;
  27842. $recv(aStream)._lf();
  27843. $ctx1.sendIdx["lf"]=8;
  27844. $16=$recv($recv(aMethod)._referencedClasses())._asJavascript();
  27845. $ctx1.sendIdx["asJavascript"]=4;
  27846. $15="referencedClasses: ".__comma($16);
  27847. $ctx1.sendIdx[","]=12;
  27848. $14=$recv($15).__comma(",");
  27849. $ctx1.sendIdx[","]=11;
  27850. $recv(aStream)._nextPutAll_($14);
  27851. $ctx1.sendIdx["nextPutAll:"]=9;
  27852. $recv(aStream)._lf();
  27853. $ctx1.sendIdx["lf"]=9;
  27854. $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27855. $ctx1.sendIdx["nextPutAll:"]=10;
  27856. $recv(aStream)._lf();
  27857. $ctx1.sendIdx["lf"]=10;
  27858. $recv(aStream)._nextPutAll_("messageSends: ".__comma($recv($recv(aMethod)._messageSends())._asJavascript()));
  27859. $ctx1.sendIdx["nextPutAll:"]=11;
  27860. $recv(aStream)._lf();
  27861. $ctx1.sendIdx["lf"]=11;
  27862. $recv(aStream)._nextPutAll_("}),");
  27863. $ctx1.sendIdx["nextPutAll:"]=12;
  27864. $recv(aStream)._lf();
  27865. $ctx1.sendIdx["lf"]=12;
  27866. $recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aMethod)._methodClass()));
  27867. $ctx1.sendIdx["nextPutAll:"]=13;
  27868. $recv(aStream)._nextPutAll_(");");
  27869. $recv(aStream)._lf();
  27870. $ctx1.sendIdx["lf"]=13;
  27871. $recv(aStream)._lf();
  27872. return self;
  27873. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  27874. },
  27875. args: ["aMethod", "aStream"],
  27876. 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",
  27877. referencedClasses: [],
  27878. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"]
  27879. }),
  27880. $globals.Exporter);
  27881. $core.addMethod(
  27882. $core.method({
  27883. selector: "exportPackage:on:",
  27884. protocol: 'output',
  27885. fn: function (aPackage,aStream){
  27886. var self=this;
  27887. return $core.withContext(function($ctx1) {
  27888. var $1;
  27889. self._exportPackagePrologueOf_on_(aPackage,aStream);
  27890. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27891. self._exportPackageContextOf_on_(aPackage,aStream);
  27892. self._exportPackageImportsOf_on_(aPackage,aStream);
  27893. self._exportPackageTransportOf_on_(aPackage,aStream);
  27894. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27895. return $core.withContext(function($ctx2) {
  27896. self._exportDefinitionOf_on_(each,aStream);
  27897. $1=$recv(each)._ownMethods();
  27898. $ctx2.sendIdx["ownMethods"]=1;
  27899. $recv($1)._do_((function(method){
  27900. return $core.withContext(function($ctx3) {
  27901. return self._exportMethod_on_(method,aStream);
  27902. $ctx3.sendIdx["exportMethod:on:"]=1;
  27903. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  27904. }));
  27905. $ctx2.sendIdx["do:"]=2;
  27906. self._exportMetaDefinitionOf_on_(each,aStream);
  27907. return $recv($recv($recv(each)._class())._ownMethods())._do_((function(method){
  27908. return $core.withContext(function($ctx3) {
  27909. return self._exportMethod_on_(method,aStream);
  27910. $ctx3.sendIdx["exportMethod:on:"]=2;
  27911. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)});
  27912. }));
  27913. $ctx2.sendIdx["do:"]=3;
  27914. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27915. }));
  27916. $ctx1.sendIdx["do:"]=1;
  27917. $recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  27918. return $core.withContext(function($ctx2) {
  27919. return self._exportMethod_on_(each,aStream);
  27920. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27921. }));
  27922. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  27923. return self;
  27924. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27925. },
  27926. args: ["aPackage", "aStream"],
  27927. 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",
  27928. referencedClasses: [],
  27929. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"]
  27930. }),
  27931. $globals.Exporter);
  27932. $core.addMethod(
  27933. $core.method({
  27934. selector: "exportPackageContextOf:on:",
  27935. protocol: 'output',
  27936. fn: function (aPackage,aStream){
  27937. var self=this;
  27938. return $core.withContext(function($ctx1) {
  27939. $recv(aStream)._nextPutAll_("$core.packages[");
  27940. $ctx1.sendIdx["nextPutAll:"]=1;
  27941. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27942. $ctx1.sendIdx["nextPutAll:"]=2;
  27943. $recv(aStream)._nextPutAll_("].innerEval = ");
  27944. $ctx1.sendIdx["nextPutAll:"]=3;
  27945. $recv(aStream)._nextPutAll_("function (expr) { return eval(expr); }");
  27946. $ctx1.sendIdx["nextPutAll:"]=4;
  27947. $recv(aStream)._nextPutAll_(";");
  27948. $recv(aStream)._lf();
  27949. return self;
  27950. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27951. },
  27952. args: ["aPackage", "aStream"],
  27953. 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",
  27954. referencedClasses: [],
  27955. messageSends: ["nextPutAll:", "asJavascript", "name", "lf"]
  27956. }),
  27957. $globals.Exporter);
  27958. $core.addMethod(
  27959. $core.method({
  27960. selector: "exportPackageDefinitionOf:on:",
  27961. protocol: 'output',
  27962. fn: function (aPackage,aStream){
  27963. var self=this;
  27964. return $core.withContext(function($ctx1) {
  27965. var $1;
  27966. $recv(aStream)._nextPutAll_("$core.addPackage(");
  27967. $ctx1.sendIdx["nextPutAll:"]=1;
  27968. $1=$recv("'".__comma($recv(aPackage)._name())).__comma("');");
  27969. $ctx1.sendIdx[","]=1;
  27970. $recv(aStream)._nextPutAll_($1);
  27971. $recv(aStream)._lf();
  27972. return self;
  27973. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27974. },
  27975. args: ["aPackage", "aStream"],
  27976. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  27977. referencedClasses: [],
  27978. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27979. }),
  27980. $globals.Exporter);
  27981. $core.addMethod(
  27982. $core.method({
  27983. selector: "exportPackageEpilogueOf:on:",
  27984. protocol: 'output',
  27985. fn: function (aPackage,aStream){
  27986. var self=this;
  27987. return $core.withContext(function($ctx1) {
  27988. self._subclassResponsibility();
  27989. return self;
  27990. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27991. },
  27992. args: ["aPackage", "aStream"],
  27993. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27994. referencedClasses: [],
  27995. messageSends: ["subclassResponsibility"]
  27996. }),
  27997. $globals.Exporter);
  27998. $core.addMethod(
  27999. $core.method({
  28000. selector: "exportPackageImportsOf:on:",
  28001. protocol: 'output',
  28002. fn: function (aPackage,aStream){
  28003. var self=this;
  28004. return $core.withContext(function($ctx1) {
  28005. var $1;
  28006. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  28007. return $core.withContext(function($ctx2) {
  28008. $recv(aStream)._nextPutAll_("$core.packages[");
  28009. $ctx2.sendIdx["nextPutAll:"]=1;
  28010. $1=$recv($recv(aPackage)._name())._asJavascript();
  28011. $ctx2.sendIdx["asJavascript"]=1;
  28012. $recv(aStream)._nextPutAll_($1);
  28013. $ctx2.sendIdx["nextPutAll:"]=2;
  28014. $recv(aStream)._nextPutAll_("].imports = ");
  28015. $ctx2.sendIdx["nextPutAll:"]=3;
  28016. $recv(aStream)._nextPutAll_($recv(imports)._asJavascript());
  28017. $ctx2.sendIdx["nextPutAll:"]=4;
  28018. $recv(aStream)._nextPutAll_(";");
  28019. return $recv(aStream)._lf();
  28020. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  28021. }));
  28022. return self;
  28023. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28024. },
  28025. args: ["aPackage", "aStream"],
  28026. 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 ]",
  28027. referencedClasses: [],
  28028. messageSends: ["ifNotEmpty:", "importsAsJson", "nextPutAll:", "asJavascript", "name", "lf"]
  28029. }),
  28030. $globals.Exporter);
  28031. $core.addMethod(
  28032. $core.method({
  28033. selector: "exportPackagePrologueOf:on:",
  28034. protocol: 'output',
  28035. fn: function (aPackage,aStream){
  28036. var self=this;
  28037. return $core.withContext(function($ctx1) {
  28038. self._subclassResponsibility();
  28039. return self;
  28040. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28041. },
  28042. args: ["aPackage", "aStream"],
  28043. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  28044. referencedClasses: [],
  28045. messageSends: ["subclassResponsibility"]
  28046. }),
  28047. $globals.Exporter);
  28048. $core.addMethod(
  28049. $core.method({
  28050. selector: "exportPackageTransportOf:on:",
  28051. protocol: 'output',
  28052. fn: function (aPackage,aStream){
  28053. var self=this;
  28054. return $core.withContext(function($ctx1) {
  28055. $recv(aStream)._nextPutAll_("$core.packages[");
  28056. $ctx1.sendIdx["nextPutAll:"]=1;
  28057. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  28058. $ctx1.sendIdx["nextPutAll:"]=2;
  28059. $recv(aStream)._nextPutAll_("].transport = ");
  28060. $ctx1.sendIdx["nextPutAll:"]=3;
  28061. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._transport())._asJSONString());
  28062. $ctx1.sendIdx["nextPutAll:"]=4;
  28063. $recv(aStream)._nextPutAll_(";");
  28064. $recv(aStream)._lf();
  28065. return self;
  28066. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28067. },
  28068. args: ["aPackage", "aStream"],
  28069. 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",
  28070. referencedClasses: [],
  28071. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"]
  28072. }),
  28073. $globals.Exporter);
  28074. $core.addMethod(
  28075. $core.method({
  28076. selector: "jsClassNameFor:",
  28077. protocol: 'convenience',
  28078. fn: function (aClass){
  28079. var self=this;
  28080. return $core.withContext(function($ctx1) {
  28081. var $1,$receiver;
  28082. $1=$recv(aClass)._isMetaclass();
  28083. if($core.assert($1)){
  28084. return $recv(self._jsClassNameFor_($recv(aClass)._instanceClass())).__comma(".klass");
  28085. $ctx1.sendIdx[","]=1;
  28086. } else {
  28087. if(($receiver = aClass) == null || $receiver.isNil){
  28088. return "null";
  28089. } else {
  28090. return "$globals.".__comma($recv(aClass)._name());
  28091. };
  28092. };
  28093. }, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},$globals.Exporter)});
  28094. },
  28095. args: ["aClass"],
  28096. 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 ] ]",
  28097. referencedClasses: [],
  28098. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"]
  28099. }),
  28100. $globals.Exporter);
  28101. $core.addMethod(
  28102. $core.method({
  28103. selector: "ownMethodsOfClass:",
  28104. protocol: 'accessing',
  28105. fn: function (aClass){
  28106. var self=this;
  28107. return $core.withContext(function($ctx1) {
  28108. var $1;
  28109. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  28110. return $core.withContext(function($ctx2) {
  28111. $1=$recv(a)._selector();
  28112. $ctx2.sendIdx["selector"]=1;
  28113. return $recv($1).__lt_eq($recv(b)._selector());
  28114. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28115. })))._reject_((function(each){
  28116. return $core.withContext(function($ctx2) {
  28117. return $recv($recv(each)._protocol())._match_("^\x5c*");
  28118. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28119. }));
  28120. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  28121. },
  28122. args: ["aClass"],
  28123. 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*') ]",
  28124. referencedClasses: [],
  28125. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  28126. }),
  28127. $globals.Exporter);
  28128. $core.addMethod(
  28129. $core.method({
  28130. selector: "ownMethodsOfMetaClass:",
  28131. protocol: 'accessing',
  28132. fn: function (aClass){
  28133. var self=this;
  28134. return $core.withContext(function($ctx1) {
  28135. return self._ownMethodsOfClass_($recv(aClass)._class());
  28136. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  28137. },
  28138. args: ["aClass"],
  28139. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  28140. referencedClasses: [],
  28141. messageSends: ["ownMethodsOfClass:", "class"]
  28142. }),
  28143. $globals.Exporter);
  28144. $core.addClass('AmdExporter', $globals.Exporter, ['namespace'], 'Platform-ImportExport');
  28145. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  28146. $core.addMethod(
  28147. $core.method({
  28148. selector: "amdNamesOfPackages:",
  28149. protocol: 'private',
  28150. fn: function (anArray){
  28151. var self=this;
  28152. return $core.withContext(function($ctx1) {
  28153. var $1;
  28154. return $recv($recv(anArray)._select_((function(each){
  28155. return $core.withContext(function($ctx2) {
  28156. $1=self._amdNamespaceOfPackage_(each);
  28157. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  28158. return $recv($1)._notNil();
  28159. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28160. })))._collect_((function(each){
  28161. return $core.withContext(function($ctx2) {
  28162. return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  28163. $ctx2.sendIdx[","]=1;
  28164. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28165. }));
  28166. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  28167. },
  28168. args: ["anArray"],
  28169. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  28170. referencedClasses: [],
  28171. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  28172. }),
  28173. $globals.AmdExporter);
  28174. $core.addMethod(
  28175. $core.method({
  28176. selector: "amdNamespaceOfPackage:",
  28177. protocol: 'private',
  28178. fn: function (aPackage){
  28179. var self=this;
  28180. return $core.withContext(function($ctx1) {
  28181. var $3,$2,$1;
  28182. $3=$recv(aPackage)._transport();
  28183. $ctx1.sendIdx["transport"]=1;
  28184. $2=$recv($3)._type();
  28185. $1=$recv($2).__eq("amd");
  28186. if($core.assert($1)){
  28187. return $recv($recv(aPackage)._transport())._namespace();
  28188. } else {
  28189. return nil;
  28190. };
  28191. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  28192. },
  28193. args: ["aPackage"],
  28194. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  28195. referencedClasses: [],
  28196. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  28197. }),
  28198. $globals.AmdExporter);
  28199. $core.addMethod(
  28200. $core.method({
  28201. selector: "exportPackageEpilogueOf:on:",
  28202. protocol: 'output',
  28203. fn: function (aPackage,aStream){
  28204. var self=this;
  28205. return $core.withContext(function($ctx1) {
  28206. $recv(aStream)._nextPutAll_("});");
  28207. $recv(aStream)._lf();
  28208. return self;
  28209. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  28210. },
  28211. args: ["aPackage", "aStream"],
  28212. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  28213. referencedClasses: [],
  28214. messageSends: ["nextPutAll:", "lf"]
  28215. }),
  28216. $globals.AmdExporter);
  28217. $core.addMethod(
  28218. $core.method({
  28219. selector: "exportPackagePrologueOf:on:",
  28220. protocol: 'output',
  28221. fn: function (aPackage,aStream){
  28222. var self=this;
  28223. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  28224. return $core.withContext(function($ctx1) {
  28225. var $1,$3,$2,$4,$6,$5,$7,$13,$12,$11,$10,$9,$8,$17,$16,$15,$14;
  28226. pragmaStart="";
  28227. pragmaEnd="";
  28228. importsForOutput=self._importsForOutput_(aPackage);
  28229. loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  28230. $1=$recv(importsForOutput)._value();
  28231. $ctx1.sendIdx["value"]=1;
  28232. $recv($1)._ifNotEmpty_((function(){
  28233. return $core.withContext(function($ctx2) {
  28234. $3=$recv($globals.String)._lf();
  28235. $ctx2.sendIdx["lf"]=1;
  28236. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  28237. $ctx2.sendIdx[","]=2;
  28238. $4=$recv($globals.String)._lf();
  28239. $ctx2.sendIdx["lf"]=2;
  28240. pragmaStart=$recv($2).__comma($4);
  28241. $ctx2.sendIdx[","]=1;
  28242. pragmaStart;
  28243. $6=$recv($globals.String)._lf();
  28244. $ctx2.sendIdx["lf"]=3;
  28245. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  28246. $ctx2.sendIdx[","]=4;
  28247. $7=$recv($globals.String)._lf();
  28248. $ctx2.sendIdx["lf"]=4;
  28249. pragmaEnd=$recv($5).__comma($7);
  28250. $ctx2.sendIdx[","]=3;
  28251. return pragmaEnd;
  28252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28253. }));
  28254. $recv(aStream)._nextPutAll_("define(\x22");
  28255. $ctx1.sendIdx["nextPutAll:"]=1;
  28256. $recv(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
  28257. $ctx1.sendIdx["nextPutAll:"]=2;
  28258. $recv(aStream)._nextPutAll_("/");
  28259. $ctx1.sendIdx["nextPutAll:"]=3;
  28260. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  28261. $ctx1.sendIdx["nextPutAll:"]=4;
  28262. $recv(aStream)._nextPutAll_("\x22, ");
  28263. $ctx1.sendIdx["nextPutAll:"]=5;
  28264. $13=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  28265. $ctx1.sendIdx[","]=7;
  28266. $12=$recv($13).__comma([":2:"]);
  28267. $ctx1.sendIdx[","]=6;
  28268. $11=$recv($12).__comma(loadDependencies);
  28269. $ctx1.sendIdx[","]=5;
  28270. $10=$recv($11)._asJavascript();
  28271. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  28272. $ctx1.sendIdx["replace:with:"]=2;
  28273. $8=$recv($9)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  28274. $ctx1.sendIdx["replace:with:"]=1;
  28275. $recv(aStream)._nextPutAll_($8);
  28276. $ctx1.sendIdx["nextPutAll:"]=6;
  28277. $recv(aStream)._nextPutAll_(", function(");
  28278. $ctx1.sendIdx["nextPutAll:"]=7;
  28279. $17=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  28280. $ctx1.sendIdx[","]=8;
  28281. $16=$recv($17)._join_(",");
  28282. $15=$recv($16)._replace_with_(",\x5cs*:1:",pragmaStart);
  28283. $14=$recv($15)._replace_with_(",\x5cs*:2:",pragmaEnd);
  28284. $ctx1.sendIdx["replace:with:"]=3;
  28285. $recv(aStream)._nextPutAll_($14);
  28286. $ctx1.sendIdx["nextPutAll:"]=8;
  28287. $recv(aStream)._nextPutAll_("){\x22use strict\x22;");
  28288. $ctx1.sendIdx["nextPutAll:"]=9;
  28289. $recv(aStream)._lf();
  28290. $ctx1.sendIdx["lf"]=5;
  28291. $recv(aStream)._nextPutAll_("var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;");
  28292. $recv(aStream)._lf();
  28293. return self;
  28294. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  28295. },
  28296. args: ["aPackage", "aStream"],
  28297. 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(\x22';\x0a\x09\x09nextPutAll: (self amdNamespaceOfPackage: aPackage);\x0a\x09\x09nextPutAll: '/'; \x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, ';\x0a\x09\x09nextPutAll: (((\x0a\x09\x09\x09(#('amber/boot' ':1:'), importsForOutput value, #(':2:'), loadDependencies) 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\x09\x09nextPutAll: 'var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;';\x0a\x09\x09lf",
  28298. referencedClasses: ["String"],
  28299. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "nextPutAll:", "amdNamespaceOfPackage:", "name", "replace:with:", "asJavascript", "join:", "key"]
  28300. }),
  28301. $globals.AmdExporter);
  28302. $core.addMethod(
  28303. $core.method({
  28304. selector: "importsForOutput:",
  28305. protocol: 'private',
  28306. fn: function (aPackage){
  28307. var self=this;
  28308. var namedImports,anonImports,importVarNames;
  28309. return $core.withContext(function($ctx1) {
  28310. var $1;
  28311. namedImports=[];
  28312. anonImports=[];
  28313. importVarNames=[];
  28314. $recv($recv(aPackage)._imports())._do_((function(each){
  28315. return $core.withContext(function($ctx2) {
  28316. $1=$recv(each)._isString();
  28317. if($core.assert($1)){
  28318. return $recv(anonImports)._add_(each);
  28319. $ctx2.sendIdx["add:"]=1;
  28320. } else {
  28321. $recv(namedImports)._add_($recv(each)._value());
  28322. $ctx2.sendIdx["add:"]=2;
  28323. return $recv(importVarNames)._add_($recv(each)._key());
  28324. };
  28325. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28326. }));
  28327. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  28328. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  28329. },
  28330. args: ["aPackage"],
  28331. 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)",
  28332. referencedClasses: [],
  28333. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  28334. }),
  28335. $globals.AmdExporter);
  28336. $core.addClass('ChunkParser', $globals.Object, ['stream', 'last'], 'Platform-ImportExport');
  28337. $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";
  28338. $core.addMethod(
  28339. $core.method({
  28340. selector: "last",
  28341. protocol: 'accessing',
  28342. fn: function (){
  28343. var self=this;
  28344. return self["@last"];
  28345. },
  28346. args: [],
  28347. source: "last\x0a\x09^ last",
  28348. referencedClasses: [],
  28349. messageSends: []
  28350. }),
  28351. $globals.ChunkParser);
  28352. $core.addMethod(
  28353. $core.method({
  28354. selector: "nextChunk",
  28355. protocol: 'reading',
  28356. fn: function (){
  28357. var self=this;
  28358. var char,result,chunk;
  28359. return $core.withContext(function($ctx1) {
  28360. var $1,$2,$3,$4;
  28361. var $early={};
  28362. try {
  28363. result=""._writeStream();
  28364. $recv((function(){
  28365. return $core.withContext(function($ctx2) {
  28366. char=$recv(self["@stream"])._next();
  28367. $ctx2.sendIdx["next"]=1;
  28368. char;
  28369. return $recv(char)._notNil();
  28370. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28371. }))._whileTrue_((function(){
  28372. return $core.withContext(function($ctx2) {
  28373. $1=$recv(char).__eq("!");
  28374. $ctx2.sendIdx["="]=1;
  28375. if($core.assert($1)){
  28376. $2=$recv($recv(self["@stream"])._peek()).__eq("!");
  28377. if($core.assert($2)){
  28378. $recv(self["@stream"])._next();
  28379. } else {
  28380. self["@last"]=$recv($recv(result)._contents())._trimBoth();
  28381. $3=self["@last"];
  28382. throw $early=[$3];
  28383. };
  28384. };
  28385. return $recv(result)._nextPut_(char);
  28386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28387. }));
  28388. self["@last"]=nil;
  28389. $4=self["@last"];
  28390. return $4;
  28391. }
  28392. catch(e) {if(e===$early)return e[0]; throw e}
  28393. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  28394. },
  28395. args: [],
  28396. 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",
  28397. referencedClasses: [],
  28398. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  28399. }),
  28400. $globals.ChunkParser);
  28401. $core.addMethod(
  28402. $core.method({
  28403. selector: "stream:",
  28404. protocol: 'accessing',
  28405. fn: function (aStream){
  28406. var self=this;
  28407. self["@stream"]=aStream;
  28408. return self;
  28409. },
  28410. args: ["aStream"],
  28411. source: "stream: aStream\x0a\x09stream := aStream",
  28412. referencedClasses: [],
  28413. messageSends: []
  28414. }),
  28415. $globals.ChunkParser);
  28416. $core.addMethod(
  28417. $core.method({
  28418. selector: "on:",
  28419. protocol: 'instance creation',
  28420. fn: function (aStream){
  28421. var self=this;
  28422. return $core.withContext(function($ctx1) {
  28423. return $recv(self._new())._stream_(aStream);
  28424. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)});
  28425. },
  28426. args: ["aStream"],
  28427. source: "on: aStream\x0a\x09^ self new stream: aStream",
  28428. referencedClasses: [],
  28429. messageSends: ["stream:", "new"]
  28430. }),
  28431. $globals.ChunkParser.klass);
  28432. $core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Platform-ImportExport');
  28433. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  28434. $core.addMethod(
  28435. $core.method({
  28436. selector: "class:",
  28437. protocol: 'accessing',
  28438. fn: function (aClass){
  28439. var self=this;
  28440. self["@class"]=aClass;
  28441. return self;
  28442. },
  28443. args: ["aClass"],
  28444. source: "class: aClass\x0a\x09class := aClass",
  28445. referencedClasses: [],
  28446. messageSends: []
  28447. }),
  28448. $globals.ClassCommentReader);
  28449. $core.addMethod(
  28450. $core.method({
  28451. selector: "initialize",
  28452. protocol: 'initialization',
  28453. fn: function (){
  28454. var self=this;
  28455. return $core.withContext(function($ctx1) {
  28456. (
  28457. $ctx1.supercall = true,
  28458. ($globals.ClassCommentReader.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  28459. $ctx1.supercall = false;
  28460. return self;
  28461. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  28462. },
  28463. args: [],
  28464. source: "initialize\x0a\x09super initialize.",
  28465. referencedClasses: [],
  28466. messageSends: ["initialize"]
  28467. }),
  28468. $globals.ClassCommentReader);
  28469. $core.addMethod(
  28470. $core.method({
  28471. selector: "scanFrom:",
  28472. protocol: 'fileIn',
  28473. fn: function (aChunkParser){
  28474. var self=this;
  28475. var chunk;
  28476. return $core.withContext(function($ctx1) {
  28477. var $1;
  28478. chunk=$recv(aChunkParser)._nextChunk();
  28479. $1=$recv(chunk)._isEmpty();
  28480. if(!$core.assert($1)){
  28481. self._setComment_(chunk);
  28482. };
  28483. return self;
  28484. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  28485. },
  28486. args: ["aChunkParser"],
  28487. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
  28488. referencedClasses: [],
  28489. messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"]
  28490. }),
  28491. $globals.ClassCommentReader);
  28492. $core.addMethod(
  28493. $core.method({
  28494. selector: "setComment:",
  28495. protocol: 'private',
  28496. fn: function (aString){
  28497. var self=this;
  28498. return $core.withContext(function($ctx1) {
  28499. $recv(self["@class"])._comment_(aString);
  28500. return self;
  28501. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  28502. },
  28503. args: ["aString"],
  28504. source: "setComment: aString\x0a\x09class comment: aString",
  28505. referencedClasses: [],
  28506. messageSends: ["comment:"]
  28507. }),
  28508. $globals.ClassCommentReader);
  28509. $core.addClass('ClassProtocolReader', $globals.Object, ['class', 'category'], 'Platform-ImportExport');
  28510. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  28511. $core.addMethod(
  28512. $core.method({
  28513. selector: "class:category:",
  28514. protocol: 'accessing',
  28515. fn: function (aClass,aString){
  28516. var self=this;
  28517. self["@class"]=aClass;
  28518. self["@category"]=aString;
  28519. return self;
  28520. },
  28521. args: ["aClass", "aString"],
  28522. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  28523. referencedClasses: [],
  28524. messageSends: []
  28525. }),
  28526. $globals.ClassProtocolReader);
  28527. $core.addMethod(
  28528. $core.method({
  28529. selector: "compileMethod:",
  28530. protocol: 'private',
  28531. fn: function (aString){
  28532. var self=this;
  28533. return $core.withContext(function($ctx1) {
  28534. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  28535. return self;
  28536. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  28537. },
  28538. args: ["aString"],
  28539. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  28540. referencedClasses: ["Compiler"],
  28541. messageSends: ["install:forClass:protocol:", "new"]
  28542. }),
  28543. $globals.ClassProtocolReader);
  28544. $core.addMethod(
  28545. $core.method({
  28546. selector: "initialize",
  28547. protocol: 'initialization',
  28548. fn: function (){
  28549. var self=this;
  28550. return $core.withContext(function($ctx1) {
  28551. (
  28552. $ctx1.supercall = true,
  28553. ($globals.ClassProtocolReader.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  28554. $ctx1.supercall = false;
  28555. return self;
  28556. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  28557. },
  28558. args: [],
  28559. source: "initialize\x0a\x09super initialize.",
  28560. referencedClasses: [],
  28561. messageSends: ["initialize"]
  28562. }),
  28563. $globals.ClassProtocolReader);
  28564. $core.addMethod(
  28565. $core.method({
  28566. selector: "scanFrom:",
  28567. protocol: 'fileIn',
  28568. fn: function (aChunkParser){
  28569. var self=this;
  28570. var chunk;
  28571. return $core.withContext(function($ctx1) {
  28572. $recv((function(){
  28573. return $core.withContext(function($ctx2) {
  28574. chunk=$recv(aChunkParser)._nextChunk();
  28575. chunk;
  28576. return $recv(chunk)._isEmpty();
  28577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28578. }))._whileFalse_((function(){
  28579. return $core.withContext(function($ctx2) {
  28580. return self._compileMethod_(chunk);
  28581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28582. }));
  28583. return self;
  28584. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  28585. },
  28586. args: ["aChunkParser"],
  28587. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  28588. referencedClasses: [],
  28589. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  28590. }),
  28591. $globals.ClassProtocolReader);
  28592. $core.addClass('ExportMethodProtocol', $globals.Object, ['name', 'theClass'], 'Platform-ImportExport');
  28593. $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.";
  28594. $core.addMethod(
  28595. $core.method({
  28596. selector: "methods",
  28597. protocol: 'accessing',
  28598. fn: function (){
  28599. var self=this;
  28600. return $core.withContext(function($ctx1) {
  28601. var $1;
  28602. return $recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  28603. return $core.withContext(function($ctx2) {
  28604. $1=$recv(a)._selector();
  28605. $ctx2.sendIdx["selector"]=1;
  28606. return $recv($1).__lt_eq($recv(b)._selector());
  28607. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28608. }));
  28609. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  28610. },
  28611. args: [],
  28612. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  28613. referencedClasses: [],
  28614. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  28615. }),
  28616. $globals.ExportMethodProtocol);
  28617. $core.addMethod(
  28618. $core.method({
  28619. selector: "name",
  28620. protocol: 'accessing',
  28621. fn: function (){
  28622. var self=this;
  28623. return self["@name"];
  28624. },
  28625. args: [],
  28626. source: "name\x0a\x09^ name",
  28627. referencedClasses: [],
  28628. messageSends: []
  28629. }),
  28630. $globals.ExportMethodProtocol);
  28631. $core.addMethod(
  28632. $core.method({
  28633. selector: "name:",
  28634. protocol: 'accessing',
  28635. fn: function (aString){
  28636. var self=this;
  28637. self["@name"]=aString;
  28638. return self;
  28639. },
  28640. args: ["aString"],
  28641. source: "name: aString\x0a\x09name := aString",
  28642. referencedClasses: [],
  28643. messageSends: []
  28644. }),
  28645. $globals.ExportMethodProtocol);
  28646. $core.addMethod(
  28647. $core.method({
  28648. selector: "theClass",
  28649. protocol: 'accessing',
  28650. fn: function (){
  28651. var self=this;
  28652. return self["@theClass"];
  28653. },
  28654. args: [],
  28655. source: "theClass\x0a\x09^ theClass",
  28656. referencedClasses: [],
  28657. messageSends: []
  28658. }),
  28659. $globals.ExportMethodProtocol);
  28660. $core.addMethod(
  28661. $core.method({
  28662. selector: "theClass:",
  28663. protocol: 'accessing',
  28664. fn: function (aClass){
  28665. var self=this;
  28666. self["@theClass"]=aClass;
  28667. return self;
  28668. },
  28669. args: ["aClass"],
  28670. source: "theClass: aClass\x0a\x09theClass := aClass",
  28671. referencedClasses: [],
  28672. messageSends: []
  28673. }),
  28674. $globals.ExportMethodProtocol);
  28675. $core.addMethod(
  28676. $core.method({
  28677. selector: "name:theClass:",
  28678. protocol: 'instance creation',
  28679. fn: function (aString,aClass){
  28680. var self=this;
  28681. return $core.withContext(function($ctx1) {
  28682. var $1;
  28683. $1=self._new();
  28684. $recv($1)._name_(aString);
  28685. $recv($1)._theClass_(aClass);
  28686. return $recv($1)._yourself();
  28687. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)});
  28688. },
  28689. args: ["aString", "aClass"],
  28690. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  28691. referencedClasses: [],
  28692. messageSends: ["name:", "new", "theClass:", "yourself"]
  28693. }),
  28694. $globals.ExportMethodProtocol.klass);
  28695. $core.addClass('Importer', $globals.Object, ['lastSection', 'lastChunk'], 'Platform-ImportExport');
  28696. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  28697. $core.addMethod(
  28698. $core.method({
  28699. selector: "import:",
  28700. protocol: 'fileIn',
  28701. fn: function (aStream){
  28702. var self=this;
  28703. var chunk,result,parser,lastEmpty;
  28704. return $core.withContext(function($ctx1) {
  28705. var $1,$2;
  28706. parser=$recv($globals.ChunkParser)._on_(aStream);
  28707. lastEmpty=false;
  28708. self["@lastSection"]="n/a, not started";
  28709. self["@lastChunk"]=nil;
  28710. $recv((function(){
  28711. return $core.withContext(function($ctx2) {
  28712. $recv((function(){
  28713. return $core.withContext(function($ctx3) {
  28714. chunk=$recv(parser)._nextChunk();
  28715. chunk;
  28716. return $recv(chunk)._isNil();
  28717. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28718. }))._whileFalse_((function(){
  28719. return $core.withContext(function($ctx3) {
  28720. $1=$recv(chunk)._isEmpty();
  28721. if($core.assert($1)){
  28722. lastEmpty=true;
  28723. return lastEmpty;
  28724. } else {
  28725. self["@lastSection"]=chunk;
  28726. self["@lastSection"];
  28727. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  28728. result;
  28729. $2=lastEmpty;
  28730. if($core.assert($2)){
  28731. lastEmpty=false;
  28732. lastEmpty;
  28733. return $recv(result)._scanFrom_(parser);
  28734. };
  28735. };
  28736. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28737. }));
  28738. self["@lastSection"]="n/a, finished";
  28739. return self["@lastSection"];
  28740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28741. }))._on_do_($globals.Error,(function(e){
  28742. return $core.withContext(function($ctx2) {
  28743. self["@lastChunk"]=$recv(parser)._last();
  28744. self["@lastChunk"];
  28745. return $recv(e)._resignal();
  28746. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  28747. }));
  28748. return self;
  28749. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  28750. },
  28751. args: ["aStream"],
  28752. 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 isEmpty\x0a\x09\x09\x09ifTrue: [ lastEmpty := true ]\x0a\x09\x09\x09ifFalse: [\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 ].",
  28753. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  28754. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  28755. }),
  28756. $globals.Importer);
  28757. $core.addMethod(
  28758. $core.method({
  28759. selector: "lastChunk",
  28760. protocol: 'accessing',
  28761. fn: function (){
  28762. var self=this;
  28763. return self["@lastChunk"];
  28764. },
  28765. args: [],
  28766. source: "lastChunk\x0a\x09^ lastChunk",
  28767. referencedClasses: [],
  28768. messageSends: []
  28769. }),
  28770. $globals.Importer);
  28771. $core.addMethod(
  28772. $core.method({
  28773. selector: "lastSection",
  28774. protocol: 'accessing',
  28775. fn: function (){
  28776. var self=this;
  28777. return self["@lastSection"];
  28778. },
  28779. args: [],
  28780. source: "lastSection\x0a\x09^ lastSection",
  28781. referencedClasses: [],
  28782. messageSends: []
  28783. }),
  28784. $globals.Importer);
  28785. $core.addClass('PackageCommitError', $globals.Error, [], 'Platform-ImportExport');
  28786. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  28787. $core.addClass('PackageHandler', $globals.InterfacingObject, [], 'Platform-ImportExport');
  28788. $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.";
  28789. $core.addMethod(
  28790. $core.method({
  28791. selector: "ajaxPutAt:data:onSuccess:onError:",
  28792. protocol: 'private',
  28793. fn: function (aURL,aString,aBlock,anotherBlock){
  28794. var self=this;
  28795. var xhr;
  28796. return $core.withContext(function($ctx1) {
  28797. var $1,$4,$3,$2;
  28798. xhr=$recv($globals.Platform)._newXhr();
  28799. $recv(xhr)._open_url_async_("PUT",aURL,true);
  28800. $recv(xhr)._onreadystatechange_((function(){
  28801. return $core.withContext(function($ctx2) {
  28802. $1=$recv($recv(xhr)._readyState()).__eq((4));
  28803. if($core.assert($1)){
  28804. $4=$recv(xhr)._status();
  28805. $ctx2.sendIdx["status"]=1;
  28806. $3=$recv($4).__gt_eq((200));
  28807. $2=$recv($3)._and_((function(){
  28808. return $core.withContext(function($ctx3) {
  28809. return $recv($recv(xhr)._status()).__lt((300));
  28810. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28811. }));
  28812. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  28813. };
  28814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28815. }));
  28816. $recv(xhr)._send_(aString);
  28817. return self;
  28818. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  28819. },
  28820. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  28821. 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",
  28822. referencedClasses: ["Platform"],
  28823. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  28824. }),
  28825. $globals.PackageHandler);
  28826. $core.addMethod(
  28827. $core.method({
  28828. selector: "chunkContentsFor:",
  28829. protocol: 'accessing',
  28830. fn: function (aPackage){
  28831. var self=this;
  28832. return $core.withContext(function($ctx1) {
  28833. return $recv($globals.String)._streamContents_((function(str){
  28834. return $core.withContext(function($ctx2) {
  28835. return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str);
  28836. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28837. }));
  28838. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28839. },
  28840. args: ["aPackage"],
  28841. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  28842. referencedClasses: ["String"],
  28843. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  28844. }),
  28845. $globals.PackageHandler);
  28846. $core.addMethod(
  28847. $core.method({
  28848. selector: "chunkExporter",
  28849. protocol: 'factory',
  28850. fn: function (){
  28851. var self=this;
  28852. return $core.withContext(function($ctx1) {
  28853. return $recv(self._chunkExporterClass())._new();
  28854. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  28855. },
  28856. args: [],
  28857. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  28858. referencedClasses: [],
  28859. messageSends: ["new", "chunkExporterClass"]
  28860. }),
  28861. $globals.PackageHandler);
  28862. $core.addMethod(
  28863. $core.method({
  28864. selector: "chunkExporterClass",
  28865. protocol: 'accessing',
  28866. fn: function (){
  28867. var self=this;
  28868. return $globals.ChunkExporter;
  28869. },
  28870. args: [],
  28871. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  28872. referencedClasses: ["ChunkExporter"],
  28873. messageSends: []
  28874. }),
  28875. $globals.PackageHandler);
  28876. $core.addMethod(
  28877. $core.method({
  28878. selector: "commit:",
  28879. protocol: 'committing',
  28880. fn: function (aPackage){
  28881. var self=this;
  28882. return $core.withContext(function($ctx1) {
  28883. var $1,$2;
  28884. self._commit_onSuccess_onError_(aPackage,(function(){
  28885. }),(function(error){
  28886. return $core.withContext(function($ctx2) {
  28887. $1=$recv($globals.PackageCommitError)._new();
  28888. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  28889. $ctx2.sendIdx[","]=1;
  28890. $recv($1)._messageText_($2);
  28891. return $recv($1)._signal();
  28892. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  28893. }));
  28894. return self;
  28895. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  28896. },
  28897. args: ["aPackage"],
  28898. 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 ]",
  28899. referencedClasses: ["PackageCommitError"],
  28900. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  28901. }),
  28902. $globals.PackageHandler);
  28903. $core.addMethod(
  28904. $core.method({
  28905. selector: "commit:onSuccess:onError:",
  28906. protocol: 'committing',
  28907. fn: function (aPackage,aBlock,anotherBlock){
  28908. var self=this;
  28909. return $core.withContext(function($ctx1) {
  28910. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  28911. return $core.withContext(function($ctx2) {
  28912. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  28913. return $core.withContext(function($ctx3) {
  28914. $recv(aPackage)._beClean();
  28915. return $recv(aBlock)._value();
  28916. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28917. }),anotherBlock);
  28918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28919. }),anotherBlock);
  28920. return self;
  28921. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28922. },
  28923. args: ["aPackage", "aBlock", "anotherBlock"],
  28924. 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",
  28925. referencedClasses: [],
  28926. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  28927. }),
  28928. $globals.PackageHandler);
  28929. $core.addMethod(
  28930. $core.method({
  28931. selector: "commitJsFileFor:onSuccess:onError:",
  28932. protocol: 'committing',
  28933. fn: function (aPackage,aBlock,anotherBlock){
  28934. var self=this;
  28935. return $core.withContext(function($ctx1) {
  28936. var $2,$1;
  28937. $2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28938. $ctx1.sendIdx[","]=2;
  28939. $1=$recv($2).__comma(".js");
  28940. $ctx1.sendIdx[","]=1;
  28941. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  28942. return self;
  28943. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28944. },
  28945. args: ["aPackage", "aBlock", "anotherBlock"],
  28946. 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",
  28947. referencedClasses: [],
  28948. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  28949. }),
  28950. $globals.PackageHandler);
  28951. $core.addMethod(
  28952. $core.method({
  28953. selector: "commitPathJsFor:",
  28954. protocol: 'accessing',
  28955. fn: function (aPackage){
  28956. var self=this;
  28957. return $core.withContext(function($ctx1) {
  28958. self._subclassResponsibility();
  28959. return self;
  28960. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28961. },
  28962. args: ["aPackage"],
  28963. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  28964. referencedClasses: [],
  28965. messageSends: ["subclassResponsibility"]
  28966. }),
  28967. $globals.PackageHandler);
  28968. $core.addMethod(
  28969. $core.method({
  28970. selector: "commitPathStFor:",
  28971. protocol: 'accessing',
  28972. fn: function (aPackage){
  28973. var self=this;
  28974. return $core.withContext(function($ctx1) {
  28975. self._subclassResponsibility();
  28976. return self;
  28977. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28978. },
  28979. args: ["aPackage"],
  28980. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  28981. referencedClasses: [],
  28982. messageSends: ["subclassResponsibility"]
  28983. }),
  28984. $globals.PackageHandler);
  28985. $core.addMethod(
  28986. $core.method({
  28987. selector: "commitStFileFor:onSuccess:onError:",
  28988. protocol: 'committing',
  28989. fn: function (aPackage,aBlock,anotherBlock){
  28990. var self=this;
  28991. return $core.withContext(function($ctx1) {
  28992. var $2,$1;
  28993. $2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28994. $ctx1.sendIdx[","]=2;
  28995. $1=$recv($2).__comma(".st");
  28996. $ctx1.sendIdx[","]=1;
  28997. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  28998. return self;
  28999. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  29000. },
  29001. args: ["aPackage", "aBlock", "anotherBlock"],
  29002. 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",
  29003. referencedClasses: [],
  29004. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  29005. }),
  29006. $globals.PackageHandler);
  29007. $core.addMethod(
  29008. $core.method({
  29009. selector: "contentsFor:",
  29010. protocol: 'accessing',
  29011. fn: function (aPackage){
  29012. var self=this;
  29013. return $core.withContext(function($ctx1) {
  29014. return $recv($globals.String)._streamContents_((function(str){
  29015. return $core.withContext(function($ctx2) {
  29016. return $recv(self._exporter())._exportPackage_on_(aPackage,str);
  29017. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  29018. }));
  29019. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  29020. },
  29021. args: ["aPackage"],
  29022. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  29023. referencedClasses: ["String"],
  29024. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  29025. }),
  29026. $globals.PackageHandler);
  29027. $core.addMethod(
  29028. $core.method({
  29029. selector: "exporter",
  29030. protocol: 'factory',
  29031. fn: function (){
  29032. var self=this;
  29033. return $core.withContext(function($ctx1) {
  29034. return $recv(self._exporterClass())._new();
  29035. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  29036. },
  29037. args: [],
  29038. source: "exporter\x0a\x09^ self exporterClass new",
  29039. referencedClasses: [],
  29040. messageSends: ["new", "exporterClass"]
  29041. }),
  29042. $globals.PackageHandler);
  29043. $core.addMethod(
  29044. $core.method({
  29045. selector: "exporterClass",
  29046. protocol: 'accessing',
  29047. fn: function (){
  29048. var self=this;
  29049. return $core.withContext(function($ctx1) {
  29050. self._subclassResponsibility();
  29051. return self;
  29052. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  29053. },
  29054. args: [],
  29055. source: "exporterClass\x0a\x09self subclassResponsibility",
  29056. referencedClasses: [],
  29057. messageSends: ["subclassResponsibility"]
  29058. }),
  29059. $globals.PackageHandler);
  29060. $core.addMethod(
  29061. $core.method({
  29062. selector: "load:",
  29063. protocol: 'loading',
  29064. fn: function (aPackage){
  29065. var self=this;
  29066. return $core.withContext(function($ctx1) {
  29067. self._subclassResponsibility();
  29068. return self;
  29069. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  29070. },
  29071. args: ["aPackage"],
  29072. source: "load: aPackage\x0a\x09self subclassResponsibility",
  29073. referencedClasses: [],
  29074. messageSends: ["subclassResponsibility"]
  29075. }),
  29076. $globals.PackageHandler);
  29077. $core.addMethod(
  29078. $core.method({
  29079. selector: "onCommitError:",
  29080. protocol: 'error handling',
  29081. fn: function (anError){
  29082. var self=this;
  29083. return $core.withContext(function($ctx1) {
  29084. var $1,$2;
  29085. $1=$recv($globals.PackageCommitError)._new();
  29086. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  29087. $ctx1.sendIdx[","]=1;
  29088. $recv($1)._messageText_($2);
  29089. $recv($1)._signal();
  29090. return self;
  29091. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  29092. },
  29093. args: ["anError"],
  29094. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  29095. referencedClasses: ["PackageCommitError"],
  29096. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  29097. }),
  29098. $globals.PackageHandler);
  29099. $core.addClass('AmdPackageHandler', $globals.PackageHandler, [], 'Platform-ImportExport');
  29100. $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.";
  29101. $core.addMethod(
  29102. $core.method({
  29103. selector: "commitPathJsFor:",
  29104. protocol: 'accessing',
  29105. fn: function (aPackage){
  29106. var self=this;
  29107. return $core.withContext(function($ctx1) {
  29108. return self._toUrl_(self._namespaceFor_(aPackage));
  29109. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29110. },
  29111. args: ["aPackage"],
  29112. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  29113. referencedClasses: [],
  29114. messageSends: ["toUrl:", "namespaceFor:"]
  29115. }),
  29116. $globals.AmdPackageHandler);
  29117. $core.addMethod(
  29118. $core.method({
  29119. selector: "commitPathStFor:",
  29120. protocol: 'accessing',
  29121. fn: function (aPackage){
  29122. var self=this;
  29123. var path,pathWithout;
  29124. return $core.withContext(function($ctx1) {
  29125. var $1,$2;
  29126. $1=$recv(self._namespaceFor_(aPackage)).__comma("/_source");
  29127. $ctx1.sendIdx[","]=1;
  29128. path=self._toUrl_($1);
  29129. pathWithout=self._commitPathJsFor_(aPackage);
  29130. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  29131. if($core.assert($2)){
  29132. return pathWithout;
  29133. } else {
  29134. return path;
  29135. };
  29136. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  29137. },
  29138. args: ["aPackage"],
  29139. 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 ]",
  29140. referencedClasses: [],
  29141. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  29142. }),
  29143. $globals.AmdPackageHandler);
  29144. $core.addMethod(
  29145. $core.method({
  29146. selector: "exporterClass",
  29147. protocol: 'accessing',
  29148. fn: function (){
  29149. var self=this;
  29150. return $globals.AmdExporter;
  29151. },
  29152. args: [],
  29153. source: "exporterClass\x0a\x09^ AmdExporter",
  29154. referencedClasses: ["AmdExporter"],
  29155. messageSends: []
  29156. }),
  29157. $globals.AmdPackageHandler);
  29158. $core.addMethod(
  29159. $core.method({
  29160. selector: "load:",
  29161. protocol: 'loading',
  29162. fn: function (aPackage){
  29163. var self=this;
  29164. return $core.withContext(function($ctx1) {
  29165. var $1,$3,$2,$receiver;
  29166. $1=$recv($globals.Smalltalk)._amdRequire();
  29167. if(($receiver = $1) == null || $receiver.isNil){
  29168. self._error_("AMD loader not present");
  29169. } else {
  29170. var require;
  29171. require=$receiver;
  29172. $3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  29173. $ctx1.sendIdx[","]=1;
  29174. $2=$recv($globals.Array)._with_($3);
  29175. $recv(require)._value_($2);
  29176. };
  29177. return self;
  29178. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29179. },
  29180. args: ["aPackage"],
  29181. 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 ) ]",
  29182. referencedClasses: ["Smalltalk", "Array"],
  29183. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  29184. }),
  29185. $globals.AmdPackageHandler);
  29186. $core.addMethod(
  29187. $core.method({
  29188. selector: "namespaceFor:",
  29189. protocol: 'committing',
  29190. fn: function (aPackage){
  29191. var self=this;
  29192. return $core.withContext(function($ctx1) {
  29193. return $recv($recv(aPackage)._transport())._namespace();
  29194. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29195. },
  29196. args: ["aPackage"],
  29197. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  29198. referencedClasses: [],
  29199. messageSends: ["namespace", "transport"]
  29200. }),
  29201. $globals.AmdPackageHandler);
  29202. $core.addMethod(
  29203. $core.method({
  29204. selector: "toUrl:",
  29205. protocol: 'private',
  29206. fn: function (aString){
  29207. var self=this;
  29208. return $core.withContext(function($ctx1) {
  29209. var $1,$receiver;
  29210. $1=$recv($globals.Smalltalk)._amdRequire();
  29211. if(($receiver = $1) == null || $receiver.isNil){
  29212. return self._error_("AMD loader not present");
  29213. } else {
  29214. var require;
  29215. require=$receiver;
  29216. return $recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  29217. };
  29218. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  29219. },
  29220. args: ["aString"],
  29221. 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 ]",
  29222. referencedClasses: ["Smalltalk"],
  29223. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  29224. }),
  29225. $globals.AmdPackageHandler);
  29226. $core.addMethod(
  29227. $core.method({
  29228. selector: "defaultNamespace",
  29229. protocol: 'commit paths',
  29230. fn: function (){
  29231. var self=this;
  29232. return $core.withContext(function($ctx1) {
  29233. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  29234. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)});
  29235. },
  29236. args: [],
  29237. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29238. referencedClasses: ["Smalltalk"],
  29239. messageSends: ["defaultAmdNamespace"]
  29240. }),
  29241. $globals.AmdPackageHandler.klass);
  29242. $core.addMethod(
  29243. $core.method({
  29244. selector: "defaultNamespace:",
  29245. protocol: 'commit paths',
  29246. fn: function (aString){
  29247. var self=this;
  29248. return $core.withContext(function($ctx1) {
  29249. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  29250. return self;
  29251. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)});
  29252. },
  29253. args: ["aString"],
  29254. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  29255. referencedClasses: ["Smalltalk"],
  29256. messageSends: ["defaultAmdNamespace:"]
  29257. }),
  29258. $globals.AmdPackageHandler.klass);
  29259. $core.addClass('PackageTransport', $globals.Object, ['package'], 'Platform-ImportExport');
  29260. $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.";
  29261. $core.addMethod(
  29262. $core.method({
  29263. selector: "asJSON",
  29264. protocol: 'converting',
  29265. fn: function (){
  29266. var self=this;
  29267. return $core.withContext(function($ctx1) {
  29268. return $globals.HashedCollection._newFromPairs_(["type",self._type()]);
  29269. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.PackageTransport)});
  29270. },
  29271. args: [],
  29272. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  29273. referencedClasses: [],
  29274. messageSends: ["type"]
  29275. }),
  29276. $globals.PackageTransport);
  29277. $core.addMethod(
  29278. $core.method({
  29279. selector: "commit",
  29280. protocol: 'committing',
  29281. fn: function (){
  29282. var self=this;
  29283. return $core.withContext(function($ctx1) {
  29284. $recv(self._commitHandler())._commit_(self._package());
  29285. return self;
  29286. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  29287. },
  29288. args: [],
  29289. source: "commit\x0a\x09self commitHandler commit: self package",
  29290. referencedClasses: [],
  29291. messageSends: ["commit:", "commitHandler", "package"]
  29292. }),
  29293. $globals.PackageTransport);
  29294. $core.addMethod(
  29295. $core.method({
  29296. selector: "commitHandler",
  29297. protocol: 'factory',
  29298. fn: function (){
  29299. var self=this;
  29300. return $core.withContext(function($ctx1) {
  29301. return $recv(self._commitHandlerClass())._new();
  29302. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  29303. },
  29304. args: [],
  29305. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  29306. referencedClasses: [],
  29307. messageSends: ["new", "commitHandlerClass"]
  29308. }),
  29309. $globals.PackageTransport);
  29310. $core.addMethod(
  29311. $core.method({
  29312. selector: "commitHandlerClass",
  29313. protocol: 'accessing',
  29314. fn: function (){
  29315. var self=this;
  29316. return $core.withContext(function($ctx1) {
  29317. self._subclassResponsibility();
  29318. return self;
  29319. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  29320. },
  29321. args: [],
  29322. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  29323. referencedClasses: [],
  29324. messageSends: ["subclassResponsibility"]
  29325. }),
  29326. $globals.PackageTransport);
  29327. $core.addMethod(
  29328. $core.method({
  29329. selector: "commitOnSuccess:onError:",
  29330. protocol: 'committing',
  29331. fn: function (aBlock,anotherBlock){
  29332. var self=this;
  29333. return $core.withContext(function($ctx1) {
  29334. $recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  29335. return self;
  29336. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  29337. },
  29338. args: ["aBlock", "anotherBlock"],
  29339. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  29340. referencedClasses: [],
  29341. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  29342. }),
  29343. $globals.PackageTransport);
  29344. $core.addMethod(
  29345. $core.method({
  29346. selector: "definition",
  29347. protocol: 'accessing',
  29348. fn: function (){
  29349. var self=this;
  29350. return "";
  29351. },
  29352. args: [],
  29353. source: "definition\x0a\x09^ ''",
  29354. referencedClasses: [],
  29355. messageSends: []
  29356. }),
  29357. $globals.PackageTransport);
  29358. $core.addMethod(
  29359. $core.method({
  29360. selector: "load",
  29361. protocol: 'loading',
  29362. fn: function (){
  29363. var self=this;
  29364. return $core.withContext(function($ctx1) {
  29365. $recv(self._commitHandler())._load_(self._package());
  29366. return self;
  29367. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  29368. },
  29369. args: [],
  29370. source: "load\x0a\x09self commitHandler load: self package",
  29371. referencedClasses: [],
  29372. messageSends: ["load:", "commitHandler", "package"]
  29373. }),
  29374. $globals.PackageTransport);
  29375. $core.addMethod(
  29376. $core.method({
  29377. selector: "package",
  29378. protocol: 'accessing',
  29379. fn: function (){
  29380. var self=this;
  29381. return self["@package"];
  29382. },
  29383. args: [],
  29384. source: "package\x0a\x09^ package",
  29385. referencedClasses: [],
  29386. messageSends: []
  29387. }),
  29388. $globals.PackageTransport);
  29389. $core.addMethod(
  29390. $core.method({
  29391. selector: "package:",
  29392. protocol: 'accessing',
  29393. fn: function (aPackage){
  29394. var self=this;
  29395. self["@package"]=aPackage;
  29396. return self;
  29397. },
  29398. args: ["aPackage"],
  29399. source: "package: aPackage\x0a\x09package := aPackage",
  29400. referencedClasses: [],
  29401. messageSends: []
  29402. }),
  29403. $globals.PackageTransport);
  29404. $core.addMethod(
  29405. $core.method({
  29406. selector: "setupFromJson:",
  29407. protocol: 'initialization',
  29408. fn: function (anObject){
  29409. var self=this;
  29410. return self;
  29411. },
  29412. args: ["anObject"],
  29413. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  29414. referencedClasses: [],
  29415. messageSends: []
  29416. }),
  29417. $globals.PackageTransport);
  29418. $core.addMethod(
  29419. $core.method({
  29420. selector: "type",
  29421. protocol: 'accessing',
  29422. fn: function (){
  29423. var self=this;
  29424. return $core.withContext(function($ctx1) {
  29425. return $recv(self._class())._type();
  29426. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  29427. },
  29428. args: [],
  29429. source: "type\x0a\x09^ self class type",
  29430. referencedClasses: [],
  29431. messageSends: ["type", "class"]
  29432. }),
  29433. $globals.PackageTransport);
  29434. $globals.PackageTransport.klass.iVarNames = ['registry'];
  29435. $core.addMethod(
  29436. $core.method({
  29437. selector: "classRegisteredFor:",
  29438. protocol: 'accessing',
  29439. fn: function (aString){
  29440. var self=this;
  29441. return $core.withContext(function($ctx1) {
  29442. return $recv(self["@registry"])._at_(aString);
  29443. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)});
  29444. },
  29445. args: ["aString"],
  29446. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  29447. referencedClasses: [],
  29448. messageSends: ["at:"]
  29449. }),
  29450. $globals.PackageTransport.klass);
  29451. $core.addMethod(
  29452. $core.method({
  29453. selector: "defaultType",
  29454. protocol: 'accessing',
  29455. fn: function (){
  29456. var self=this;
  29457. return $core.withContext(function($ctx1) {
  29458. return $recv($globals.AmdPackageTransport)._type();
  29459. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)});
  29460. },
  29461. args: [],
  29462. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  29463. referencedClasses: ["AmdPackageTransport"],
  29464. messageSends: ["type"]
  29465. }),
  29466. $globals.PackageTransport.klass);
  29467. $core.addMethod(
  29468. $core.method({
  29469. selector: "for:",
  29470. protocol: 'instance creation',
  29471. fn: function (aString){
  29472. var self=this;
  29473. return $core.withContext(function($ctx1) {
  29474. return $recv(self._classRegisteredFor_(aString))._new();
  29475. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)});
  29476. },
  29477. args: ["aString"],
  29478. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  29479. referencedClasses: [],
  29480. messageSends: ["new", "classRegisteredFor:"]
  29481. }),
  29482. $globals.PackageTransport.klass);
  29483. $core.addMethod(
  29484. $core.method({
  29485. selector: "fromJson:",
  29486. protocol: 'instance creation',
  29487. fn: function (anObject){
  29488. var self=this;
  29489. return $core.withContext(function($ctx1) {
  29490. var $1,$2,$receiver;
  29491. if(($receiver = anObject) == null || $receiver.isNil){
  29492. $1=self._for_(self._defaultType());
  29493. $ctx1.sendIdx["for:"]=1;
  29494. return $1;
  29495. } else {
  29496. anObject;
  29497. };
  29498. $2=self._for_($recv(anObject)._type());
  29499. $recv($2)._setupFromJson_(anObject);
  29500. return $recv($2)._yourself();
  29501. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)});
  29502. },
  29503. args: ["anObject"],
  29504. 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",
  29505. referencedClasses: [],
  29506. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  29507. }),
  29508. $globals.PackageTransport.klass);
  29509. $core.addMethod(
  29510. $core.method({
  29511. selector: "initialize",
  29512. protocol: 'initialization',
  29513. fn: function (){
  29514. var self=this;
  29515. return $core.withContext(function($ctx1) {
  29516. var $1;
  29517. (
  29518. $ctx1.supercall = true,
  29519. ($globals.PackageTransport.klass.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  29520. $ctx1.supercall = false;
  29521. $1=self.__eq_eq($globals.PackageTransport);
  29522. if($core.assert($1)){
  29523. self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  29524. self["@registry"];
  29525. } else {
  29526. self._register();
  29527. };
  29528. return self;
  29529. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)});
  29530. },
  29531. args: [],
  29532. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  29533. referencedClasses: ["PackageTransport"],
  29534. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  29535. }),
  29536. $globals.PackageTransport.klass);
  29537. $core.addMethod(
  29538. $core.method({
  29539. selector: "register",
  29540. protocol: 'registration',
  29541. fn: function (){
  29542. var self=this;
  29543. return $core.withContext(function($ctx1) {
  29544. $recv($globals.PackageTransport)._register_(self);
  29545. return self;
  29546. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)});
  29547. },
  29548. args: [],
  29549. source: "register\x0a\x09PackageTransport register: self",
  29550. referencedClasses: ["PackageTransport"],
  29551. messageSends: ["register:"]
  29552. }),
  29553. $globals.PackageTransport.klass);
  29554. $core.addMethod(
  29555. $core.method({
  29556. selector: "register:",
  29557. protocol: 'registration',
  29558. fn: function (aClass){
  29559. var self=this;
  29560. return $core.withContext(function($ctx1) {
  29561. var $1,$receiver;
  29562. $1=$recv(aClass)._type();
  29563. $ctx1.sendIdx["type"]=1;
  29564. if(($receiver = $1) == null || $receiver.isNil){
  29565. $1;
  29566. } else {
  29567. $recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  29568. };
  29569. return self;
  29570. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)});
  29571. },
  29572. args: ["aClass"],
  29573. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  29574. referencedClasses: [],
  29575. messageSends: ["ifNotNil:", "type", "at:put:"]
  29576. }),
  29577. $globals.PackageTransport.klass);
  29578. $core.addMethod(
  29579. $core.method({
  29580. selector: "type",
  29581. protocol: 'accessing',
  29582. fn: function (){
  29583. var self=this;
  29584. return nil;
  29585. },
  29586. args: [],
  29587. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  29588. referencedClasses: [],
  29589. messageSends: []
  29590. }),
  29591. $globals.PackageTransport.klass);
  29592. $core.addClass('AmdPackageTransport', $globals.PackageTransport, ['namespace'], 'Platform-ImportExport');
  29593. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  29594. $core.addMethod(
  29595. $core.method({
  29596. selector: "asJSON",
  29597. protocol: 'converting',
  29598. fn: function (){
  29599. var self=this;
  29600. return $core.withContext(function($ctx1) {
  29601. var $1;
  29602. $1=(
  29603. $ctx1.supercall = true,
  29604. ($globals.AmdPackageTransport.superclass||$boot.dnu).fn.prototype._asJSON.apply($recv(self), []));
  29605. $ctx1.supercall = false;
  29606. $recv($1)._at_put_("amdNamespace",self._namespace());
  29607. return $recv($1)._yourself();
  29608. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.AmdPackageTransport)});
  29609. },
  29610. args: [],
  29611. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  29612. referencedClasses: [],
  29613. messageSends: ["at:put:", "asJSON", "namespace", "yourself"]
  29614. }),
  29615. $globals.AmdPackageTransport);
  29616. $core.addMethod(
  29617. $core.method({
  29618. selector: "commitHandlerClass",
  29619. protocol: 'accessing',
  29620. fn: function (){
  29621. var self=this;
  29622. return $globals.AmdPackageHandler;
  29623. },
  29624. args: [],
  29625. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  29626. referencedClasses: ["AmdPackageHandler"],
  29627. messageSends: []
  29628. }),
  29629. $globals.AmdPackageTransport);
  29630. $core.addMethod(
  29631. $core.method({
  29632. selector: "defaultNamespace",
  29633. protocol: 'defaults',
  29634. fn: function (){
  29635. var self=this;
  29636. return $core.withContext(function($ctx1) {
  29637. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  29638. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  29639. },
  29640. args: [],
  29641. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29642. referencedClasses: ["Smalltalk"],
  29643. messageSends: ["defaultAmdNamespace"]
  29644. }),
  29645. $globals.AmdPackageTransport);
  29646. $core.addMethod(
  29647. $core.method({
  29648. selector: "definition",
  29649. protocol: 'accessing',
  29650. fn: function (){
  29651. var self=this;
  29652. return $core.withContext(function($ctx1) {
  29653. var $1;
  29654. return $recv($globals.String)._streamContents_((function(stream){
  29655. return $core.withContext(function($ctx2) {
  29656. $recv(stream)._nextPutAll_($recv(self._class())._name());
  29657. $ctx2.sendIdx["nextPutAll:"]=1;
  29658. $recv(stream)._nextPutAll_(" namespace: ");
  29659. $ctx2.sendIdx["nextPutAll:"]=2;
  29660. $1=$recv("'".__comma(self._namespace())).__comma("'");
  29661. $ctx2.sendIdx[","]=1;
  29662. return $recv(stream)._nextPutAll_($1);
  29663. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  29664. }));
  29665. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  29666. },
  29667. args: [],
  29668. 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, '''' ]",
  29669. referencedClasses: ["String"],
  29670. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"]
  29671. }),
  29672. $globals.AmdPackageTransport);
  29673. $core.addMethod(
  29674. $core.method({
  29675. selector: "namespace",
  29676. protocol: 'accessing',
  29677. fn: function (){
  29678. var self=this;
  29679. return $core.withContext(function($ctx1) {
  29680. var $1,$receiver;
  29681. $1=self["@namespace"];
  29682. if(($receiver = $1) == null || $receiver.isNil){
  29683. return self._defaultNamespace();
  29684. } else {
  29685. return $1;
  29686. };
  29687. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  29688. },
  29689. args: [],
  29690. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  29691. referencedClasses: [],
  29692. messageSends: ["ifNil:", "defaultNamespace"]
  29693. }),
  29694. $globals.AmdPackageTransport);
  29695. $core.addMethod(
  29696. $core.method({
  29697. selector: "namespace:",
  29698. protocol: 'accessing',
  29699. fn: function (aString){
  29700. var self=this;
  29701. self["@namespace"]=aString;
  29702. return self;
  29703. },
  29704. args: ["aString"],
  29705. source: "namespace: aString\x0a\x09namespace := aString",
  29706. referencedClasses: [],
  29707. messageSends: []
  29708. }),
  29709. $globals.AmdPackageTransport);
  29710. $core.addMethod(
  29711. $core.method({
  29712. selector: "printOn:",
  29713. protocol: 'printing',
  29714. fn: function (aStream){
  29715. var self=this;
  29716. return $core.withContext(function($ctx1) {
  29717. (
  29718. $ctx1.supercall = true,
  29719. ($globals.AmdPackageTransport.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  29720. $ctx1.supercall = false;
  29721. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  29722. $ctx1.sendIdx["nextPutAll:"]=1;
  29723. $recv(aStream)._nextPutAll_(self._namespace());
  29724. $ctx1.sendIdx["nextPutAll:"]=2;
  29725. $recv(aStream)._nextPutAll_(")");
  29726. return self;
  29727. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  29728. },
  29729. args: ["aStream"],
  29730. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  29731. referencedClasses: [],
  29732. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  29733. }),
  29734. $globals.AmdPackageTransport);
  29735. $core.addMethod(
  29736. $core.method({
  29737. selector: "setPath:",
  29738. protocol: 'actions',
  29739. fn: function (aString){
  29740. var self=this;
  29741. return $core.withContext(function($ctx1) {
  29742. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  29743. return self;
  29744. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  29745. },
  29746. args: ["aString"],
  29747. 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}.",
  29748. referencedClasses: [],
  29749. messageSends: ["value:", "basicAt:", "namespace"]
  29750. }),
  29751. $globals.AmdPackageTransport);
  29752. $core.addMethod(
  29753. $core.method({
  29754. selector: "setupFromJson:",
  29755. protocol: 'initialization',
  29756. fn: function (anObject){
  29757. var self=this;
  29758. return $core.withContext(function($ctx1) {
  29759. self._namespace_($recv(anObject)._at_("amdNamespace"));
  29760. return self;
  29761. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  29762. },
  29763. args: ["anObject"],
  29764. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  29765. referencedClasses: [],
  29766. messageSends: ["namespace:", "at:"]
  29767. }),
  29768. $globals.AmdPackageTransport);
  29769. $core.addMethod(
  29770. $core.method({
  29771. selector: "namespace:",
  29772. protocol: 'instance creation',
  29773. fn: function (aString){
  29774. var self=this;
  29775. return $core.withContext(function($ctx1) {
  29776. var $1;
  29777. $1=self._new();
  29778. $recv($1)._namespace_(aString);
  29779. return $recv($1)._yourself();
  29780. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)});
  29781. },
  29782. args: ["aString"],
  29783. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  29784. referencedClasses: [],
  29785. messageSends: ["namespace:", "new", "yourself"]
  29786. }),
  29787. $globals.AmdPackageTransport.klass);
  29788. $core.addMethod(
  29789. $core.method({
  29790. selector: "type",
  29791. protocol: 'accessing',
  29792. fn: function (){
  29793. var self=this;
  29794. return "amd";
  29795. },
  29796. args: [],
  29797. source: "type\x0a\x09^ 'amd'",
  29798. referencedClasses: [],
  29799. messageSends: []
  29800. }),
  29801. $globals.AmdPackageTransport.klass);
  29802. $core.addMethod(
  29803. $core.method({
  29804. selector: "commentStamp",
  29805. protocol: '*Platform-ImportExport',
  29806. fn: function (){
  29807. var self=this;
  29808. return $core.withContext(function($ctx1) {
  29809. var $1;
  29810. $1=$recv($globals.ClassCommentReader)._new();
  29811. $recv($1)._class_(self);
  29812. return $recv($1)._yourself();
  29813. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)});
  29814. },
  29815. args: [],
  29816. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  29817. referencedClasses: ["ClassCommentReader"],
  29818. messageSends: ["class:", "new", "yourself"]
  29819. }),
  29820. $globals.Behavior);
  29821. $core.addMethod(
  29822. $core.method({
  29823. selector: "commentStamp:prior:",
  29824. protocol: '*Platform-ImportExport',
  29825. fn: function (aStamp,prior){
  29826. var self=this;
  29827. return $core.withContext(function($ctx1) {
  29828. return self._commentStamp();
  29829. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)});
  29830. },
  29831. args: ["aStamp", "prior"],
  29832. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  29833. referencedClasses: [],
  29834. messageSends: ["commentStamp"]
  29835. }),
  29836. $globals.Behavior);
  29837. $core.addMethod(
  29838. $core.method({
  29839. selector: "methodsFor:",
  29840. protocol: '*Platform-ImportExport',
  29841. fn: function (aString){
  29842. var self=this;
  29843. return $core.withContext(function($ctx1) {
  29844. var $1;
  29845. $1=$recv($globals.ClassProtocolReader)._new();
  29846. $recv($1)._class_category_(self,aString);
  29847. return $recv($1)._yourself();
  29848. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)});
  29849. },
  29850. args: ["aString"],
  29851. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  29852. referencedClasses: ["ClassProtocolReader"],
  29853. messageSends: ["class:category:", "new", "yourself"]
  29854. }),
  29855. $globals.Behavior);
  29856. $core.addMethod(
  29857. $core.method({
  29858. selector: "methodsFor:stamp:",
  29859. protocol: '*Platform-ImportExport',
  29860. fn: function (aString,aStamp){
  29861. var self=this;
  29862. return $core.withContext(function($ctx1) {
  29863. return self._methodsFor_(aString);
  29864. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)});
  29865. },
  29866. args: ["aString", "aStamp"],
  29867. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  29868. referencedClasses: [],
  29869. messageSends: ["methodsFor:"]
  29870. }),
  29871. $globals.Behavior);
  29872. $core.addMethod(
  29873. $core.method({
  29874. selector: "commit",
  29875. protocol: '*Platform-ImportExport',
  29876. fn: function (){
  29877. var self=this;
  29878. return $core.withContext(function($ctx1) {
  29879. return $recv(self._transport())._commit();
  29880. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  29881. },
  29882. args: [],
  29883. source: "commit\x0a\x09^ self transport commit",
  29884. referencedClasses: [],
  29885. messageSends: ["commit", "transport"]
  29886. }),
  29887. $globals.Package);
  29888. $core.addMethod(
  29889. $core.method({
  29890. selector: "load",
  29891. protocol: '*Platform-ImportExport',
  29892. fn: function (){
  29893. var self=this;
  29894. return $core.withContext(function($ctx1) {
  29895. return $recv(self._transport())._load();
  29896. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  29897. },
  29898. args: [],
  29899. source: "load\x0a\x09^ self transport load",
  29900. referencedClasses: [],
  29901. messageSends: ["load", "transport"]
  29902. }),
  29903. $globals.Package);
  29904. $core.addMethod(
  29905. $core.method({
  29906. selector: "loadFromNamespace:",
  29907. protocol: '*Platform-ImportExport',
  29908. fn: function (aString){
  29909. var self=this;
  29910. return $core.withContext(function($ctx1) {
  29911. var $1;
  29912. $1=self._transport();
  29913. $recv($1)._namespace_(aString);
  29914. return $recv($1)._load();
  29915. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  29916. },
  29917. args: ["aString"],
  29918. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  29919. referencedClasses: [],
  29920. messageSends: ["namespace:", "transport", "load"]
  29921. }),
  29922. $globals.Package);
  29923. $core.addMethod(
  29924. $core.method({
  29925. selector: "load:",
  29926. protocol: '*Platform-ImportExport',
  29927. fn: function (aPackageName){
  29928. var self=this;
  29929. return $core.withContext(function($ctx1) {
  29930. $recv(self._named_(aPackageName))._load();
  29931. return self;
  29932. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)});
  29933. },
  29934. args: ["aPackageName"],
  29935. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  29936. referencedClasses: [],
  29937. messageSends: ["load", "named:"]
  29938. }),
  29939. $globals.Package.klass);
  29940. $core.addMethod(
  29941. $core.method({
  29942. selector: "load:fromNamespace:",
  29943. protocol: '*Platform-ImportExport',
  29944. fn: function (aPackageName,aString){
  29945. var self=this;
  29946. return $core.withContext(function($ctx1) {
  29947. $recv(self._named_(aPackageName))._loadFromNamespace_(aString);
  29948. return self;
  29949. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)});
  29950. },
  29951. args: ["aPackageName", "aString"],
  29952. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  29953. referencedClasses: [],
  29954. messageSends: ["loadFromNamespace:", "named:"]
  29955. }),
  29956. $globals.Package.klass);
  29957. });
  29958. define("amber_core/Compiler-Core", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Platform-Services", "amber_core/Kernel-Collections"], function($boot){"use strict";
  29959. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  29960. $core.addPackage('Compiler-Core');
  29961. $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  29962. $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  29963. $core.addClass('AbstractCodeGenerator', $globals.Object, ['currentClass', 'currentPackage', 'source'], 'Compiler-Core');
  29964. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  29965. $core.addMethod(
  29966. $core.method({
  29967. selector: "compileNode:",
  29968. protocol: 'compiling',
  29969. fn: function (aNode){
  29970. var self=this;
  29971. return $core.withContext(function($ctx1) {
  29972. self._subclassResponsibility();
  29973. return self;
  29974. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  29975. },
  29976. args: ["aNode"],
  29977. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  29978. referencedClasses: [],
  29979. messageSends: ["subclassResponsibility"]
  29980. }),
  29981. $globals.AbstractCodeGenerator);
  29982. $core.addMethod(
  29983. $core.method({
  29984. selector: "currentClass",
  29985. protocol: 'accessing',
  29986. fn: function (){
  29987. var self=this;
  29988. return self["@currentClass"];
  29989. },
  29990. args: [],
  29991. source: "currentClass\x0a\x09^ currentClass",
  29992. referencedClasses: [],
  29993. messageSends: []
  29994. }),
  29995. $globals.AbstractCodeGenerator);
  29996. $core.addMethod(
  29997. $core.method({
  29998. selector: "currentClass:",
  29999. protocol: 'accessing',
  30000. fn: function (aClass){
  30001. var self=this;
  30002. self["@currentClass"]=aClass;
  30003. return self;
  30004. },
  30005. args: ["aClass"],
  30006. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30007. referencedClasses: [],
  30008. messageSends: []
  30009. }),
  30010. $globals.AbstractCodeGenerator);
  30011. $core.addMethod(
  30012. $core.method({
  30013. selector: "currentPackage",
  30014. protocol: 'accessing',
  30015. fn: function (){
  30016. var self=this;
  30017. return self["@currentPackage"];
  30018. },
  30019. args: [],
  30020. source: "currentPackage\x0a\x09^ currentPackage",
  30021. referencedClasses: [],
  30022. messageSends: []
  30023. }),
  30024. $globals.AbstractCodeGenerator);
  30025. $core.addMethod(
  30026. $core.method({
  30027. selector: "currentPackage:",
  30028. protocol: 'accessing',
  30029. fn: function (anObject){
  30030. var self=this;
  30031. self["@currentPackage"]=anObject;
  30032. return self;
  30033. },
  30034. args: ["anObject"],
  30035. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30036. referencedClasses: [],
  30037. messageSends: []
  30038. }),
  30039. $globals.AbstractCodeGenerator);
  30040. $core.addMethod(
  30041. $core.method({
  30042. selector: "pseudoVariables",
  30043. protocol: 'accessing',
  30044. fn: function (){
  30045. var self=this;
  30046. return $core.withContext(function($ctx1) {
  30047. return $recv($globals.Smalltalk)._pseudoVariableNames();
  30048. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  30049. },
  30050. args: [],
  30051. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  30052. referencedClasses: ["Smalltalk"],
  30053. messageSends: ["pseudoVariableNames"]
  30054. }),
  30055. $globals.AbstractCodeGenerator);
  30056. $core.addMethod(
  30057. $core.method({
  30058. selector: "source",
  30059. protocol: 'accessing',
  30060. fn: function (){
  30061. var self=this;
  30062. return $core.withContext(function($ctx1) {
  30063. var $1,$receiver;
  30064. $1=self["@source"];
  30065. if(($receiver = $1) == null || $receiver.isNil){
  30066. return "";
  30067. } else {
  30068. return $1;
  30069. };
  30070. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  30071. },
  30072. args: [],
  30073. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30074. referencedClasses: [],
  30075. messageSends: ["ifNil:"]
  30076. }),
  30077. $globals.AbstractCodeGenerator);
  30078. $core.addMethod(
  30079. $core.method({
  30080. selector: "source:",
  30081. protocol: 'accessing',
  30082. fn: function (aString){
  30083. var self=this;
  30084. self["@source"]=aString;
  30085. return self;
  30086. },
  30087. args: ["aString"],
  30088. source: "source: aString\x0a\x09source := aString",
  30089. referencedClasses: [],
  30090. messageSends: []
  30091. }),
  30092. $globals.AbstractCodeGenerator);
  30093. $core.addClass('CodeGenerator', $globals.AbstractCodeGenerator, [], 'Compiler-Core');
  30094. $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.";
  30095. $core.addMethod(
  30096. $core.method({
  30097. selector: "compileNode:",
  30098. protocol: 'compiling',
  30099. fn: function (aNode){
  30100. var self=this;
  30101. var ir,stream;
  30102. return $core.withContext(function($ctx1) {
  30103. var $1;
  30104. $recv(self._semanticAnalyzer())._visit_(aNode);
  30105. $ctx1.sendIdx["visit:"]=1;
  30106. ir=$recv(self._translator())._visit_(aNode);
  30107. $ctx1.sendIdx["visit:"]=2;
  30108. $1=self._irTranslator();
  30109. $recv($1)._currentClass_(self._currentClass());
  30110. $recv($1)._visit_(ir);
  30111. return $recv($1)._contents();
  30112. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.CodeGenerator)});
  30113. },
  30114. args: ["aNode"],
  30115. 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",
  30116. referencedClasses: [],
  30117. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"]
  30118. }),
  30119. $globals.CodeGenerator);
  30120. $core.addMethod(
  30121. $core.method({
  30122. selector: "irTranslator",
  30123. protocol: 'compiling',
  30124. fn: function (){
  30125. var self=this;
  30126. return $core.withContext(function($ctx1) {
  30127. return $recv($globals.IRJSTranslator)._new();
  30128. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  30129. },
  30130. args: [],
  30131. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  30132. referencedClasses: ["IRJSTranslator"],
  30133. messageSends: ["new"]
  30134. }),
  30135. $globals.CodeGenerator);
  30136. $core.addMethod(
  30137. $core.method({
  30138. selector: "semanticAnalyzer",
  30139. protocol: 'compiling',
  30140. fn: function (){
  30141. var self=this;
  30142. return $core.withContext(function($ctx1) {
  30143. var $1;
  30144. $1=$recv($globals.SemanticAnalyzer)._on_(self._currentClass());
  30145. $recv($1)._thePackage_(self._currentPackage());
  30146. return $recv($1)._yourself();
  30147. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  30148. },
  30149. args: [],
  30150. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  30151. referencedClasses: ["SemanticAnalyzer"],
  30152. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  30153. }),
  30154. $globals.CodeGenerator);
  30155. $core.addMethod(
  30156. $core.method({
  30157. selector: "translator",
  30158. protocol: 'compiling',
  30159. fn: function (){
  30160. var self=this;
  30161. return $core.withContext(function($ctx1) {
  30162. var $1;
  30163. $1=$recv($globals.IRASTTranslator)._new();
  30164. $recv($1)._source_(self._source());
  30165. $recv($1)._theClass_(self._currentClass());
  30166. return $recv($1)._yourself();
  30167. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  30168. },
  30169. args: [],
  30170. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  30171. referencedClasses: ["IRASTTranslator"],
  30172. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  30173. }),
  30174. $globals.CodeGenerator);
  30175. $core.addClass('Compiler', $globals.Object, ['currentClass', 'currentPackage', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  30176. $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`";
  30177. $core.addMethod(
  30178. $core.method({
  30179. selector: "codeGeneratorClass",
  30180. protocol: 'accessing',
  30181. fn: function (){
  30182. var self=this;
  30183. return $core.withContext(function($ctx1) {
  30184. var $1,$receiver;
  30185. $1=self["@codeGeneratorClass"];
  30186. if(($receiver = $1) == null || $receiver.isNil){
  30187. return $globals.InliningCodeGenerator;
  30188. } else {
  30189. return $1;
  30190. };
  30191. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  30192. },
  30193. args: [],
  30194. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  30195. referencedClasses: ["InliningCodeGenerator"],
  30196. messageSends: ["ifNil:"]
  30197. }),
  30198. $globals.Compiler);
  30199. $core.addMethod(
  30200. $core.method({
  30201. selector: "codeGeneratorClass:",
  30202. protocol: 'accessing',
  30203. fn: function (aClass){
  30204. var self=this;
  30205. self["@codeGeneratorClass"]=aClass;
  30206. return self;
  30207. },
  30208. args: ["aClass"],
  30209. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  30210. referencedClasses: [],
  30211. messageSends: []
  30212. }),
  30213. $globals.Compiler);
  30214. $core.addMethod(
  30215. $core.method({
  30216. selector: "compile:forClass:protocol:",
  30217. protocol: 'compiling',
  30218. fn: function (aString,aClass,anotherString){
  30219. var self=this;
  30220. return $core.withContext(function($ctx1) {
  30221. self._source_(aString);
  30222. return self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  30223. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  30224. },
  30225. args: ["aString", "aClass", "anotherString"],
  30226. 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)",
  30227. referencedClasses: [],
  30228. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  30229. }),
  30230. $globals.Compiler);
  30231. $core.addMethod(
  30232. $core.method({
  30233. selector: "compileExpression:on:",
  30234. protocol: 'compiling',
  30235. fn: function (aString,anObject){
  30236. var self=this;
  30237. return $core.withContext(function($ctx1) {
  30238. var $1;
  30239. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  30240. $ctx1.sendIdx[","]=1;
  30241. return self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  30242. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  30243. },
  30244. args: ["aString", "anObject"],
  30245. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  30246. referencedClasses: [],
  30247. messageSends: ["compile:forClass:protocol:", ",", "class"]
  30248. }),
  30249. $globals.Compiler);
  30250. $core.addMethod(
  30251. $core.method({
  30252. selector: "compileNode:",
  30253. protocol: 'compiling',
  30254. fn: function (aNode){
  30255. var self=this;
  30256. var generator,result;
  30257. return $core.withContext(function($ctx1) {
  30258. var $1;
  30259. generator=$recv(self._codeGeneratorClass())._new();
  30260. $1=generator;
  30261. $recv($1)._source_(self._source());
  30262. $recv($1)._currentClass_(self._currentClass());
  30263. $recv($1)._currentPackage_(self._currentPackage());
  30264. result=$recv(generator)._compileNode_(aNode);
  30265. self._unknownVariables_([]);
  30266. return result;
  30267. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  30268. },
  30269. args: ["aNode"],
  30270. 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",
  30271. referencedClasses: [],
  30272. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"]
  30273. }),
  30274. $globals.Compiler);
  30275. $core.addMethod(
  30276. $core.method({
  30277. selector: "compileNode:forClass:package:",
  30278. protocol: 'compiling',
  30279. fn: function (aNode,aClass,aPackage){
  30280. var self=this;
  30281. return $core.withContext(function($ctx1) {
  30282. self._currentClass_(aClass);
  30283. self._currentPackage_(aPackage);
  30284. return self._compileNode_(aNode);
  30285. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  30286. },
  30287. args: ["aNode", "aClass", "aPackage"],
  30288. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  30289. referencedClasses: [],
  30290. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  30291. }),
  30292. $globals.Compiler);
  30293. $core.addMethod(
  30294. $core.method({
  30295. selector: "currentClass",
  30296. protocol: 'accessing',
  30297. fn: function (){
  30298. var self=this;
  30299. return self["@currentClass"];
  30300. },
  30301. args: [],
  30302. source: "currentClass\x0a\x09^ currentClass",
  30303. referencedClasses: [],
  30304. messageSends: []
  30305. }),
  30306. $globals.Compiler);
  30307. $core.addMethod(
  30308. $core.method({
  30309. selector: "currentClass:",
  30310. protocol: 'accessing',
  30311. fn: function (aClass){
  30312. var self=this;
  30313. self["@currentClass"]=aClass;
  30314. return self;
  30315. },
  30316. args: ["aClass"],
  30317. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30318. referencedClasses: [],
  30319. messageSends: []
  30320. }),
  30321. $globals.Compiler);
  30322. $core.addMethod(
  30323. $core.method({
  30324. selector: "currentPackage",
  30325. protocol: 'accessing',
  30326. fn: function (){
  30327. var self=this;
  30328. return self["@currentPackage"];
  30329. },
  30330. args: [],
  30331. source: "currentPackage\x0a\x09^ currentPackage",
  30332. referencedClasses: [],
  30333. messageSends: []
  30334. }),
  30335. $globals.Compiler);
  30336. $core.addMethod(
  30337. $core.method({
  30338. selector: "currentPackage:",
  30339. protocol: 'accessing',
  30340. fn: function (anObject){
  30341. var self=this;
  30342. self["@currentPackage"]=anObject;
  30343. return self;
  30344. },
  30345. args: ["anObject"],
  30346. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30347. referencedClasses: [],
  30348. messageSends: []
  30349. }),
  30350. $globals.Compiler);
  30351. $core.addMethod(
  30352. $core.method({
  30353. selector: "eval:",
  30354. protocol: 'compiling',
  30355. fn: function (aString){
  30356. var self=this;
  30357. return $core.withContext(function($ctx1) {
  30358. return eval(aString);
  30359. return self;
  30360. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  30361. },
  30362. args: ["aString"],
  30363. source: "eval: aString\x0a\x09<return eval(aString)>",
  30364. referencedClasses: [],
  30365. messageSends: []
  30366. }),
  30367. $globals.Compiler);
  30368. $core.addMethod(
  30369. $core.method({
  30370. selector: "eval:forPackage:",
  30371. protocol: 'compiling',
  30372. fn: function (aString,aPackage){
  30373. var self=this;
  30374. return $core.withContext(function($ctx1) {
  30375. return aPackage && aPackage.innerEval
  30376. ? aPackage.innerEval(aString)
  30377. : eval(aString);
  30378. return self;
  30379. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  30380. },
  30381. args: ["aString", "aPackage"],
  30382. source: "eval: aString forPackage: aPackage\x0a\x09<return aPackage && aPackage.innerEval\x0a\x09\x09? aPackage.innerEval(aString)\x0a\x09\x09: eval(aString)>",
  30383. referencedClasses: [],
  30384. messageSends: []
  30385. }),
  30386. $globals.Compiler);
  30387. $core.addMethod(
  30388. $core.method({
  30389. selector: "evaluateExpression:",
  30390. protocol: 'compiling',
  30391. fn: function (aString){
  30392. var self=this;
  30393. return $core.withContext(function($ctx1) {
  30394. return self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  30395. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  30396. },
  30397. args: ["aString"],
  30398. 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",
  30399. referencedClasses: ["DoIt"],
  30400. messageSends: ["evaluateExpression:on:", "new"]
  30401. }),
  30402. $globals.Compiler);
  30403. $core.addMethod(
  30404. $core.method({
  30405. selector: "evaluateExpression:on:",
  30406. protocol: 'compiling',
  30407. fn: function (aString,anObject){
  30408. var self=this;
  30409. var result,method;
  30410. return $core.withContext(function($ctx1) {
  30411. var $1;
  30412. method=self._eval_(self._compileExpression_on_(aString,anObject));
  30413. $recv(method)._protocol_("**xxxDoIt");
  30414. $1=$recv(anObject)._class();
  30415. $ctx1.sendIdx["class"]=1;
  30416. $recv($1)._addCompiledMethod_(method);
  30417. result=$recv(anObject)._xxxDoIt();
  30418. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  30419. return result;
  30420. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  30421. },
  30422. args: ["aString", "anObject"],
  30423. 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",
  30424. referencedClasses: [],
  30425. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  30426. }),
  30427. $globals.Compiler);
  30428. $core.addMethod(
  30429. $core.method({
  30430. selector: "install:forClass:protocol:",
  30431. protocol: 'compiling',
  30432. fn: function (aString,aBehavior,anotherString){
  30433. var self=this;
  30434. var compiledMethod;
  30435. return $core.withContext(function($ctx1) {
  30436. compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  30437. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  30438. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  30439. },
  30440. args: ["aString", "aBehavior", "anotherString"],
  30441. 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",
  30442. referencedClasses: ["ClassBuilder"],
  30443. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  30444. }),
  30445. $globals.Compiler);
  30446. $core.addMethod(
  30447. $core.method({
  30448. selector: "parse:",
  30449. protocol: 'compiling',
  30450. fn: function (aString){
  30451. var self=this;
  30452. return $core.withContext(function($ctx1) {
  30453. return $recv($globals.Smalltalk)._parse_(aString);
  30454. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  30455. },
  30456. args: ["aString"],
  30457. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  30458. referencedClasses: ["Smalltalk"],
  30459. messageSends: ["parse:"]
  30460. }),
  30461. $globals.Compiler);
  30462. $core.addMethod(
  30463. $core.method({
  30464. selector: "parseExpression:",
  30465. protocol: 'compiling',
  30466. fn: function (aString){
  30467. var self=this;
  30468. return $core.withContext(function($ctx1) {
  30469. var $1;
  30470. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  30471. $ctx1.sendIdx[","]=1;
  30472. return self._parse_($1);
  30473. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  30474. },
  30475. args: ["aString"],
  30476. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  30477. referencedClasses: [],
  30478. messageSends: ["parse:", ","]
  30479. }),
  30480. $globals.Compiler);
  30481. $core.addMethod(
  30482. $core.method({
  30483. selector: "recompile:",
  30484. protocol: 'compiling',
  30485. fn: function (aClass){
  30486. var self=this;
  30487. return $core.withContext(function($ctx1) {
  30488. var $1;
  30489. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  30490. return $core.withContext(function($ctx2) {
  30491. return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  30492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30493. }),"Recompiling ".__comma($recv(aClass)._name()));
  30494. $1=$recv(aClass)._isMetaclass();
  30495. if(!$core.assert($1)){
  30496. self._recompile_($recv(aClass)._class());
  30497. };
  30498. return self;
  30499. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  30500. },
  30501. args: ["aClass"],
  30502. 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 ]",
  30503. referencedClasses: [],
  30504. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"]
  30505. }),
  30506. $globals.Compiler);
  30507. $core.addMethod(
  30508. $core.method({
  30509. selector: "recompileAll",
  30510. protocol: 'compiling',
  30511. fn: function (){
  30512. var self=this;
  30513. return $core.withContext(function($ctx1) {
  30514. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  30515. return $core.withContext(function($ctx2) {
  30516. return self._recompile_(each);
  30517. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30518. }),"Compiling all classes...");
  30519. return self;
  30520. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  30521. },
  30522. args: [],
  30523. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  30524. referencedClasses: ["Smalltalk"],
  30525. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  30526. }),
  30527. $globals.Compiler);
  30528. $core.addMethod(
  30529. $core.method({
  30530. selector: "source",
  30531. protocol: 'accessing',
  30532. fn: function (){
  30533. var self=this;
  30534. return $core.withContext(function($ctx1) {
  30535. var $1,$receiver;
  30536. $1=self["@source"];
  30537. if(($receiver = $1) == null || $receiver.isNil){
  30538. return "";
  30539. } else {
  30540. return $1;
  30541. };
  30542. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  30543. },
  30544. args: [],
  30545. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30546. referencedClasses: [],
  30547. messageSends: ["ifNil:"]
  30548. }),
  30549. $globals.Compiler);
  30550. $core.addMethod(
  30551. $core.method({
  30552. selector: "source:",
  30553. protocol: 'accessing',
  30554. fn: function (aString){
  30555. var self=this;
  30556. self["@source"]=aString;
  30557. return self;
  30558. },
  30559. args: ["aString"],
  30560. source: "source: aString\x0a\x09source := aString",
  30561. referencedClasses: [],
  30562. messageSends: []
  30563. }),
  30564. $globals.Compiler);
  30565. $core.addMethod(
  30566. $core.method({
  30567. selector: "unknownVariables",
  30568. protocol: 'accessing',
  30569. fn: function (){
  30570. var self=this;
  30571. return self["@unknownVariables"];
  30572. },
  30573. args: [],
  30574. source: "unknownVariables\x0a\x09^ unknownVariables",
  30575. referencedClasses: [],
  30576. messageSends: []
  30577. }),
  30578. $globals.Compiler);
  30579. $core.addMethod(
  30580. $core.method({
  30581. selector: "unknownVariables:",
  30582. protocol: 'accessing',
  30583. fn: function (aCollection){
  30584. var self=this;
  30585. self["@unknownVariables"]=aCollection;
  30586. return self;
  30587. },
  30588. args: ["aCollection"],
  30589. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  30590. referencedClasses: [],
  30591. messageSends: []
  30592. }),
  30593. $globals.Compiler);
  30594. $core.addMethod(
  30595. $core.method({
  30596. selector: "recompile:",
  30597. protocol: 'compiling',
  30598. fn: function (aClass){
  30599. var self=this;
  30600. return $core.withContext(function($ctx1) {
  30601. $recv(self._new())._recompile_(aClass);
  30602. return self;
  30603. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)});
  30604. },
  30605. args: ["aClass"],
  30606. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  30607. referencedClasses: [],
  30608. messageSends: ["recompile:", "new"]
  30609. }),
  30610. $globals.Compiler.klass);
  30611. $core.addMethod(
  30612. $core.method({
  30613. selector: "recompileAll",
  30614. protocol: 'compiling',
  30615. fn: function (){
  30616. var self=this;
  30617. return $core.withContext(function($ctx1) {
  30618. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  30619. return $core.withContext(function($ctx2) {
  30620. return self._recompile_(each);
  30621. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30622. }));
  30623. return self;
  30624. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)});
  30625. },
  30626. args: [],
  30627. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  30628. referencedClasses: ["Smalltalk"],
  30629. messageSends: ["do:", "classes", "recompile:"]
  30630. }),
  30631. $globals.Compiler.klass);
  30632. $core.addClass('CompilerError', $globals.Error, [], 'Compiler-Core');
  30633. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  30634. $core.addClass('DoIt', $globals.Object, [], 'Compiler-Core');
  30635. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  30636. $core.addClass('Evaluator', $globals.InterfacingObject, [], 'Compiler-Core');
  30637. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  30638. $core.addMethod(
  30639. $core.method({
  30640. selector: "evaluate:context:",
  30641. protocol: 'evaluating',
  30642. fn: function (aString,aContext){
  30643. var self=this;
  30644. var compiler,ast;
  30645. return $core.withContext(function($ctx1) {
  30646. var $1;
  30647. var $early={};
  30648. try {
  30649. compiler=$recv($globals.Compiler)._new();
  30650. $recv((function(){
  30651. return $core.withContext(function($ctx2) {
  30652. ast=$recv(compiler)._parseExpression_(aString);
  30653. return ast;
  30654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30655. }))._on_do_($globals.Error,(function(ex){
  30656. return $core.withContext(function($ctx2) {
  30657. throw $early=[self._alert_($recv(ex)._messageText())];
  30658. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30659. }));
  30660. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  30661. $recv($1)._context_(aContext);
  30662. $recv($1)._visit_(ast);
  30663. return $recv(aContext)._evaluateNode_(ast);
  30664. }
  30665. catch(e) {if(e===$early)return e[0]; throw e}
  30666. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  30667. },
  30668. args: ["aString", "aContext"],
  30669. 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 | ^ self 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",
  30670. referencedClasses: ["Compiler", "Error", "AISemanticAnalyzer"],
  30671. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  30672. }),
  30673. $globals.Evaluator);
  30674. $core.addMethod(
  30675. $core.method({
  30676. selector: "evaluate:for:",
  30677. protocol: 'evaluating',
  30678. fn: function (aString,anObject){
  30679. var self=this;
  30680. return $core.withContext(function($ctx1) {
  30681. return $recv(anObject)._evaluate_on_(aString,self);
  30682. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  30683. },
  30684. args: ["aString", "anObject"],
  30685. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  30686. referencedClasses: [],
  30687. messageSends: ["evaluate:on:"]
  30688. }),
  30689. $globals.Evaluator);
  30690. $core.addMethod(
  30691. $core.method({
  30692. selector: "evaluate:receiver:",
  30693. protocol: 'evaluating',
  30694. fn: function (aString,anObject){
  30695. var self=this;
  30696. var compiler;
  30697. return $core.withContext(function($ctx1) {
  30698. var $early={};
  30699. try {
  30700. compiler=$recv($globals.Compiler)._new();
  30701. $recv((function(){
  30702. return $core.withContext(function($ctx2) {
  30703. return $recv(compiler)._parseExpression_(aString);
  30704. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30705. }))._on_do_($globals.Error,(function(ex){
  30706. return $core.withContext(function($ctx2) {
  30707. throw $early=[self._alert_($recv(ex)._messageText())];
  30708. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30709. }));
  30710. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  30711. }
  30712. catch(e) {if(e===$early)return e[0]; throw e}
  30713. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  30714. },
  30715. args: ["aString", "anObject"],
  30716. 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 | ^ self alert: ex messageText ].\x0a\x0a\x09^ compiler evaluateExpression: aString on: anObject",
  30717. referencedClasses: ["Compiler", "Error"],
  30718. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  30719. }),
  30720. $globals.Evaluator);
  30721. $core.addMethod(
  30722. $core.method({
  30723. selector: "evaluate:for:",
  30724. protocol: 'instance creation',
  30725. fn: function (aString,anObject){
  30726. var self=this;
  30727. return $core.withContext(function($ctx1) {
  30728. return $recv(self._new())._evaluate_for_(aString,anObject);
  30729. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)});
  30730. },
  30731. args: ["aString", "anObject"],
  30732. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  30733. referencedClasses: [],
  30734. messageSends: ["evaluate:for:", "new"]
  30735. }),
  30736. $globals.Evaluator.klass);
  30737. $core.addMethod(
  30738. $core.method({
  30739. selector: "asVariableName",
  30740. protocol: '*Compiler-Core',
  30741. fn: function (){
  30742. var self=this;
  30743. return $core.withContext(function($ctx1) {
  30744. var $1;
  30745. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  30746. if($core.assert($1)){
  30747. return self.__comma("_");
  30748. } else {
  30749. return self;
  30750. };
  30751. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  30752. },
  30753. args: [],
  30754. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  30755. referencedClasses: ["Smalltalk"],
  30756. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  30757. }),
  30758. $globals.String);
  30759. });
  30760. define("amber_core/Compiler-AST", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
  30761. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  30762. $core.addPackage('Compiler-AST');
  30763. $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  30764. $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30765. $core.addClass('Node', $globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  30766. $globals.Node.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.";
  30767. $core.addMethod(
  30768. $core.method({
  30769. selector: "accept:",
  30770. protocol: 'visiting',
  30771. fn: function (aVisitor){
  30772. var self=this;
  30773. return $core.withContext(function($ctx1) {
  30774. return $recv(aVisitor)._visitNode_(self);
  30775. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.Node)});
  30776. },
  30777. args: ["aVisitor"],
  30778. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  30779. referencedClasses: [],
  30780. messageSends: ["visitNode:"]
  30781. }),
  30782. $globals.Node);
  30783. $core.addMethod(
  30784. $core.method({
  30785. selector: "addNode:",
  30786. protocol: 'accessing',
  30787. fn: function (aNode){
  30788. var self=this;
  30789. return $core.withContext(function($ctx1) {
  30790. $recv(self._nodes())._add_(aNode);
  30791. $recv(aNode)._parent_(self);
  30792. return self;
  30793. }, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},$globals.Node)});
  30794. },
  30795. args: ["aNode"],
  30796. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  30797. referencedClasses: [],
  30798. messageSends: ["add:", "nodes", "parent:"]
  30799. }),
  30800. $globals.Node);
  30801. $core.addMethod(
  30802. $core.method({
  30803. selector: "allNodes",
  30804. protocol: 'accessing',
  30805. fn: function (){
  30806. var self=this;
  30807. var allNodes;
  30808. return $core.withContext(function($ctx1) {
  30809. var $1;
  30810. $1=self._nodes();
  30811. $ctx1.sendIdx["nodes"]=1;
  30812. allNodes=$recv($1)._asSet();
  30813. $recv(self._nodes())._do_((function(each){
  30814. return $core.withContext(function($ctx2) {
  30815. return $recv(allNodes)._addAll_($recv(each)._allNodes());
  30816. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30817. }));
  30818. return allNodes;
  30819. }, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},$globals.Node)});
  30820. },
  30821. args: [],
  30822. source: "allNodes\x0a\x09| allNodes |\x0a\x09\x0a\x09allNodes := self nodes asSet.\x0a\x09self nodes do: [ :each | \x0a\x09\x09allNodes addAll: each allNodes ].\x0a\x09\x0a\x09^ allNodes",
  30823. referencedClasses: [],
  30824. messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"]
  30825. }),
  30826. $globals.Node);
  30827. $core.addMethod(
  30828. $core.method({
  30829. selector: "inPosition:",
  30830. protocol: 'testing',
  30831. fn: function (aPoint){
  30832. var self=this;
  30833. return $core.withContext(function($ctx1) {
  30834. return $recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  30835. return $core.withContext(function($ctx2) {
  30836. return $recv(self._positionEnd()).__gt_eq(aPoint);
  30837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30838. }));
  30839. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.Node)});
  30840. },
  30841. args: ["aPoint"],
  30842. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  30843. referencedClasses: [],
  30844. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  30845. }),
  30846. $globals.Node);
  30847. $core.addMethod(
  30848. $core.method({
  30849. selector: "isAssignmentNode",
  30850. protocol: 'testing',
  30851. fn: function (){
  30852. var self=this;
  30853. return false;
  30854. },
  30855. args: [],
  30856. source: "isAssignmentNode\x0a\x09^ false",
  30857. referencedClasses: [],
  30858. messageSends: []
  30859. }),
  30860. $globals.Node);
  30861. $core.addMethod(
  30862. $core.method({
  30863. selector: "isBlockNode",
  30864. protocol: 'testing',
  30865. fn: function (){
  30866. var self=this;
  30867. return false;
  30868. },
  30869. args: [],
  30870. source: "isBlockNode\x0a\x09^ false",
  30871. referencedClasses: [],
  30872. messageSends: []
  30873. }),
  30874. $globals.Node);
  30875. $core.addMethod(
  30876. $core.method({
  30877. selector: "isBlockSequenceNode",
  30878. protocol: 'testing',
  30879. fn: function (){
  30880. var self=this;
  30881. return false;
  30882. },
  30883. args: [],
  30884. source: "isBlockSequenceNode\x0a\x09^ false",
  30885. referencedClasses: [],
  30886. messageSends: []
  30887. }),
  30888. $globals.Node);
  30889. $core.addMethod(
  30890. $core.method({
  30891. selector: "isCascadeNode",
  30892. protocol: 'testing',
  30893. fn: function (){
  30894. var self=this;
  30895. return false;
  30896. },
  30897. args: [],
  30898. source: "isCascadeNode\x0a\x09^ false",
  30899. referencedClasses: [],
  30900. messageSends: []
  30901. }),
  30902. $globals.Node);
  30903. $core.addMethod(
  30904. $core.method({
  30905. selector: "isImmutable",
  30906. protocol: 'testing',
  30907. fn: function (){
  30908. var self=this;
  30909. return false;
  30910. },
  30911. args: [],
  30912. source: "isImmutable\x0a\x09^ false",
  30913. referencedClasses: [],
  30914. messageSends: []
  30915. }),
  30916. $globals.Node);
  30917. $core.addMethod(
  30918. $core.method({
  30919. selector: "isJSStatementNode",
  30920. protocol: 'testing',
  30921. fn: function (){
  30922. var self=this;
  30923. return false;
  30924. },
  30925. args: [],
  30926. source: "isJSStatementNode\x0a\x09^ false",
  30927. referencedClasses: [],
  30928. messageSends: []
  30929. }),
  30930. $globals.Node);
  30931. $core.addMethod(
  30932. $core.method({
  30933. selector: "isLastChild",
  30934. protocol: 'testing',
  30935. fn: function (){
  30936. var self=this;
  30937. return $core.withContext(function($ctx1) {
  30938. return $recv($recv($recv(self._parent())._nodes())._last()).__eq(self);
  30939. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.Node)});
  30940. },
  30941. args: [],
  30942. source: "isLastChild\x0a\x09^ self parent nodes last = self",
  30943. referencedClasses: [],
  30944. messageSends: ["=", "last", "nodes", "parent"]
  30945. }),
  30946. $globals.Node);
  30947. $core.addMethod(
  30948. $core.method({
  30949. selector: "isNavigationNode",
  30950. protocol: 'testing',
  30951. fn: function (){
  30952. var self=this;
  30953. return false;
  30954. },
  30955. args: [],
  30956. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  30957. referencedClasses: [],
  30958. messageSends: []
  30959. }),
  30960. $globals.Node);
  30961. $core.addMethod(
  30962. $core.method({
  30963. selector: "isNode",
  30964. protocol: 'testing',
  30965. fn: function (){
  30966. var self=this;
  30967. return true;
  30968. },
  30969. args: [],
  30970. source: "isNode\x0a\x09^ true",
  30971. referencedClasses: [],
  30972. messageSends: []
  30973. }),
  30974. $globals.Node);
  30975. $core.addMethod(
  30976. $core.method({
  30977. selector: "isReferenced",
  30978. protocol: 'testing',
  30979. fn: function (){
  30980. var self=this;
  30981. return $core.withContext(function($ctx1) {
  30982. var $3,$2,$1;
  30983. $3=self._parent();
  30984. $ctx1.sendIdx["parent"]=1;
  30985. $2=$recv($3)._isSequenceNode();
  30986. $1=$recv($2)._or_((function(){
  30987. return $core.withContext(function($ctx2) {
  30988. return $recv(self._parent())._isAssignmentNode();
  30989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30990. }));
  30991. return $recv($1)._not();
  30992. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.Node)});
  30993. },
  30994. args: [],
  30995. 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",
  30996. referencedClasses: [],
  30997. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  30998. }),
  30999. $globals.Node);
  31000. $core.addMethod(
  31001. $core.method({
  31002. selector: "isReturnNode",
  31003. protocol: 'testing',
  31004. fn: function (){
  31005. var self=this;
  31006. return false;
  31007. },
  31008. args: [],
  31009. source: "isReturnNode\x0a\x09^ false",
  31010. referencedClasses: [],
  31011. messageSends: []
  31012. }),
  31013. $globals.Node);
  31014. $core.addMethod(
  31015. $core.method({
  31016. selector: "isSendNode",
  31017. protocol: 'testing',
  31018. fn: function (){
  31019. var self=this;
  31020. return false;
  31021. },
  31022. args: [],
  31023. source: "isSendNode\x0a\x09^ false",
  31024. referencedClasses: [],
  31025. messageSends: []
  31026. }),
  31027. $globals.Node);
  31028. $core.addMethod(
  31029. $core.method({
  31030. selector: "isSequenceNode",
  31031. protocol: 'testing',
  31032. fn: function (){
  31033. var self=this;
  31034. return false;
  31035. },
  31036. args: [],
  31037. source: "isSequenceNode\x0a\x09^ false",
  31038. referencedClasses: [],
  31039. messageSends: []
  31040. }),
  31041. $globals.Node);
  31042. $core.addMethod(
  31043. $core.method({
  31044. selector: "isValueNode",
  31045. protocol: 'testing',
  31046. fn: function (){
  31047. var self=this;
  31048. return false;
  31049. },
  31050. args: [],
  31051. source: "isValueNode\x0a\x09^ false",
  31052. referencedClasses: [],
  31053. messageSends: []
  31054. }),
  31055. $globals.Node);
  31056. $core.addMethod(
  31057. $core.method({
  31058. selector: "isVariableNode",
  31059. protocol: 'testing',
  31060. fn: function (){
  31061. var self=this;
  31062. return false;
  31063. },
  31064. args: [],
  31065. source: "isVariableNode\x0a\x09^ false",
  31066. referencedClasses: [],
  31067. messageSends: []
  31068. }),
  31069. $globals.Node);
  31070. $core.addMethod(
  31071. $core.method({
  31072. selector: "location:",
  31073. protocol: 'accessing',
  31074. fn: function (aLocation){
  31075. var self=this;
  31076. return $core.withContext(function($ctx1) {
  31077. var $3,$2,$1;
  31078. $3=$recv(aLocation)._start();
  31079. $ctx1.sendIdx["start"]=1;
  31080. $2=$recv($3)._line();
  31081. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  31082. self._position_($1);
  31083. return self;
  31084. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.Node)});
  31085. },
  31086. args: ["aLocation"],
  31087. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  31088. referencedClasses: [],
  31089. messageSends: ["position:", "@", "line", "start", "column"]
  31090. }),
  31091. $globals.Node);
  31092. $core.addMethod(
  31093. $core.method({
  31094. selector: "method",
  31095. protocol: 'accessing',
  31096. fn: function (){
  31097. var self=this;
  31098. return $core.withContext(function($ctx1) {
  31099. var $1,$receiver;
  31100. $1=self._parent();
  31101. if(($receiver = $1) == null || $receiver.isNil){
  31102. return $1;
  31103. } else {
  31104. var node;
  31105. node=$receiver;
  31106. return $recv(node)._method();
  31107. };
  31108. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.Node)});
  31109. },
  31110. args: [],
  31111. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  31112. referencedClasses: [],
  31113. messageSends: ["ifNotNil:", "parent", "method"]
  31114. }),
  31115. $globals.Node);
  31116. $core.addMethod(
  31117. $core.method({
  31118. selector: "navigationNodeAt:ifAbsent:",
  31119. protocol: 'accessing',
  31120. fn: function (aPoint,aBlock){
  31121. var self=this;
  31122. var children;
  31123. return $core.withContext(function($ctx1) {
  31124. var $2,$1;
  31125. var $early={};
  31126. try {
  31127. children=$recv(self._allNodes())._select_((function(each){
  31128. return $core.withContext(function($ctx2) {
  31129. return $recv($recv(each)._isNavigationNode())._and_((function(){
  31130. return $core.withContext(function($ctx3) {
  31131. return $recv(each)._inPosition_(aPoint);
  31132. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31133. }));
  31134. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31135. }));
  31136. $recv(children)._ifEmpty_((function(){
  31137. return $core.withContext(function($ctx2) {
  31138. throw $early=[$recv(aBlock)._value()];
  31139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  31140. }));
  31141. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  31142. return $core.withContext(function($ctx2) {
  31143. $2=$recv(a)._positionStart();
  31144. $ctx2.sendIdx["positionStart"]=1;
  31145. $1=$recv($2)._dist_(aPoint);
  31146. $ctx2.sendIdx["dist:"]=1;
  31147. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  31148. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  31149. })))._first();
  31150. }
  31151. catch(e) {if(e===$early)return e[0]; throw e}
  31152. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.Node)});
  31153. },
  31154. args: ["aPoint", "aBlock"],
  31155. 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 allNodes 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",
  31156. referencedClasses: [],
  31157. messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  31158. }),
  31159. $globals.Node);
  31160. $core.addMethod(
  31161. $core.method({
  31162. selector: "nodes",
  31163. protocol: 'accessing',
  31164. fn: function (){
  31165. var self=this;
  31166. return $core.withContext(function($ctx1) {
  31167. var $1,$receiver;
  31168. $1=self["@nodes"];
  31169. if(($receiver = $1) == null || $receiver.isNil){
  31170. self["@nodes"]=$recv($globals.Array)._new();
  31171. return self["@nodes"];
  31172. } else {
  31173. return $1;
  31174. };
  31175. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.Node)});
  31176. },
  31177. args: [],
  31178. source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  31179. referencedClasses: ["Array"],
  31180. messageSends: ["ifNil:", "new"]
  31181. }),
  31182. $globals.Node);
  31183. $core.addMethod(
  31184. $core.method({
  31185. selector: "nodes:",
  31186. protocol: 'building',
  31187. fn: function (aCollection){
  31188. var self=this;
  31189. return $core.withContext(function($ctx1) {
  31190. self["@nodes"]=aCollection;
  31191. $recv(aCollection)._do_((function(each){
  31192. return $core.withContext(function($ctx2) {
  31193. return $recv(each)._parent_(self);
  31194. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31195. }));
  31196. return self;
  31197. }, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},$globals.Node)});
  31198. },
  31199. args: ["aCollection"],
  31200. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  31201. referencedClasses: [],
  31202. messageSends: ["do:", "parent:"]
  31203. }),
  31204. $globals.Node);
  31205. $core.addMethod(
  31206. $core.method({
  31207. selector: "parent",
  31208. protocol: 'accessing',
  31209. fn: function (){
  31210. var self=this;
  31211. return self["@parent"];
  31212. },
  31213. args: [],
  31214. source: "parent\x0a\x09^ parent",
  31215. referencedClasses: [],
  31216. messageSends: []
  31217. }),
  31218. $globals.Node);
  31219. $core.addMethod(
  31220. $core.method({
  31221. selector: "parent:",
  31222. protocol: 'accessing',
  31223. fn: function (aNode){
  31224. var self=this;
  31225. self["@parent"]=aNode;
  31226. return self;
  31227. },
  31228. args: ["aNode"],
  31229. source: "parent: aNode\x0a\x09parent := aNode",
  31230. referencedClasses: [],
  31231. messageSends: []
  31232. }),
  31233. $globals.Node);
  31234. $core.addMethod(
  31235. $core.method({
  31236. selector: "position",
  31237. protocol: 'accessing',
  31238. fn: function (){
  31239. var self=this;
  31240. return $core.withContext(function($ctx1) {
  31241. var $1,$2,$receiver;
  31242. $1=self["@position"];
  31243. if(($receiver = $1) == null || $receiver.isNil){
  31244. $2=self._parent();
  31245. if(($receiver = $2) == null || $receiver.isNil){
  31246. return $2;
  31247. } else {
  31248. var node;
  31249. node=$receiver;
  31250. return $recv(node)._position();
  31251. };
  31252. } else {
  31253. return $1;
  31254. };
  31255. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Node)});
  31256. },
  31257. args: [],
  31258. 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 ] ]",
  31259. referencedClasses: [],
  31260. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  31261. }),
  31262. $globals.Node);
  31263. $core.addMethod(
  31264. $core.method({
  31265. selector: "position:",
  31266. protocol: 'accessing',
  31267. fn: function (aPosition){
  31268. var self=this;
  31269. self["@position"]=aPosition;
  31270. return self;
  31271. },
  31272. args: ["aPosition"],
  31273. source: "position: aPosition\x0a\x09position := aPosition",
  31274. referencedClasses: [],
  31275. messageSends: []
  31276. }),
  31277. $globals.Node);
  31278. $core.addMethod(
  31279. $core.method({
  31280. selector: "positionEnd",
  31281. protocol: 'accessing',
  31282. fn: function (){
  31283. var self=this;
  31284. return $core.withContext(function($ctx1) {
  31285. var $1,$6,$5,$4,$3,$2;
  31286. $1=self._positionStart();
  31287. $6=self._source();
  31288. $ctx1.sendIdx["source"]=1;
  31289. $5=$recv($6)._lines();
  31290. $ctx1.sendIdx["lines"]=1;
  31291. $4=$recv($5)._size();
  31292. $ctx1.sendIdx["size"]=1;
  31293. $3=$recv($4).__minus((1));
  31294. $ctx1.sendIdx["-"]=1;
  31295. $2=$recv($3).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1)));
  31296. return $recv($1).__plus($2);
  31297. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.Node)});
  31298. },
  31299. args: [],
  31300. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  31301. referencedClasses: [],
  31302. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  31303. }),
  31304. $globals.Node);
  31305. $core.addMethod(
  31306. $core.method({
  31307. selector: "positionStart",
  31308. protocol: 'accessing',
  31309. fn: function (){
  31310. var self=this;
  31311. return $core.withContext(function($ctx1) {
  31312. return self._position();
  31313. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.Node)});
  31314. },
  31315. args: [],
  31316. source: "positionStart\x0a\x09^ self position",
  31317. referencedClasses: [],
  31318. messageSends: ["position"]
  31319. }),
  31320. $globals.Node);
  31321. $core.addMethod(
  31322. $core.method({
  31323. selector: "postCopy",
  31324. protocol: 'copying',
  31325. fn: function (){
  31326. var self=this;
  31327. return $core.withContext(function($ctx1) {
  31328. (
  31329. $ctx1.supercall = true,
  31330. ($globals.Node.superclass||$boot.dnu).fn.prototype._postCopy.apply($recv(self), []));
  31331. $ctx1.supercall = false;
  31332. $recv(self._nodes())._do_((function(each){
  31333. return $core.withContext(function($ctx2) {
  31334. return $recv(each)._parent_(self);
  31335. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31336. }));
  31337. return self;
  31338. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.Node)});
  31339. },
  31340. args: [],
  31341. source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
  31342. referencedClasses: [],
  31343. messageSends: ["postCopy", "do:", "nodes", "parent:"]
  31344. }),
  31345. $globals.Node);
  31346. $core.addMethod(
  31347. $core.method({
  31348. selector: "requiresSmalltalkContext",
  31349. protocol: 'testing',
  31350. fn: function (){
  31351. var self=this;
  31352. return $core.withContext(function($ctx1) {
  31353. return $recv($recv(self._nodes())._detect_ifNone_((function(each){
  31354. return $core.withContext(function($ctx2) {
  31355. return $recv(each)._requiresSmalltalkContext();
  31356. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31357. }),(function(){
  31358. return nil;
  31359. })))._notNil();
  31360. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.Node)});
  31361. },
  31362. args: [],
  31363. 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 nodes \x0a\x09\x09detect: [ :each | each requiresSmalltalkContext ]\x0a\x09\x09ifNone: [ nil ]) notNil",
  31364. referencedClasses: [],
  31365. messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"]
  31366. }),
  31367. $globals.Node);
  31368. $core.addMethod(
  31369. $core.method({
  31370. selector: "shouldBeAliased",
  31371. protocol: 'accessing',
  31372. fn: function (){
  31373. var self=this;
  31374. return $core.withContext(function($ctx1) {
  31375. var $1,$receiver;
  31376. $1=self["@shouldBeAliased"];
  31377. if(($receiver = $1) == null || $receiver.isNil){
  31378. return false;
  31379. } else {
  31380. return $1;
  31381. };
  31382. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.Node)});
  31383. },
  31384. args: [],
  31385. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  31386. referencedClasses: [],
  31387. messageSends: ["ifNil:"]
  31388. }),
  31389. $globals.Node);
  31390. $core.addMethod(
  31391. $core.method({
  31392. selector: "shouldBeAliased:",
  31393. protocol: 'accessing',
  31394. fn: function (aBoolean){
  31395. var self=this;
  31396. self["@shouldBeAliased"]=aBoolean;
  31397. return self;
  31398. },
  31399. args: ["aBoolean"],
  31400. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  31401. referencedClasses: [],
  31402. messageSends: []
  31403. }),
  31404. $globals.Node);
  31405. $core.addMethod(
  31406. $core.method({
  31407. selector: "shouldBeInlined",
  31408. protocol: 'accessing',
  31409. fn: function (){
  31410. var self=this;
  31411. return $core.withContext(function($ctx1) {
  31412. var $1,$receiver;
  31413. $1=self["@shouldBeInlined"];
  31414. if(($receiver = $1) == null || $receiver.isNil){
  31415. return false;
  31416. } else {
  31417. return $1;
  31418. };
  31419. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.Node)});
  31420. },
  31421. args: [],
  31422. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  31423. referencedClasses: [],
  31424. messageSends: ["ifNil:"]
  31425. }),
  31426. $globals.Node);
  31427. $core.addMethod(
  31428. $core.method({
  31429. selector: "shouldBeInlined:",
  31430. protocol: 'accessing',
  31431. fn: function (aBoolean){
  31432. var self=this;
  31433. self["@shouldBeInlined"]=aBoolean;
  31434. return self;
  31435. },
  31436. args: ["aBoolean"],
  31437. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  31438. referencedClasses: [],
  31439. messageSends: []
  31440. }),
  31441. $globals.Node);
  31442. $core.addMethod(
  31443. $core.method({
  31444. selector: "size",
  31445. protocol: 'accessing',
  31446. fn: function (){
  31447. var self=this;
  31448. return $core.withContext(function($ctx1) {
  31449. return $recv(self._source())._size();
  31450. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Node)});
  31451. },
  31452. args: [],
  31453. source: "size\x0a\x09^ self source size",
  31454. referencedClasses: [],
  31455. messageSends: ["size", "source"]
  31456. }),
  31457. $globals.Node);
  31458. $core.addMethod(
  31459. $core.method({
  31460. selector: "source",
  31461. protocol: 'accessing',
  31462. fn: function (){
  31463. var self=this;
  31464. return $core.withContext(function($ctx1) {
  31465. var $1,$receiver;
  31466. $1=self["@source"];
  31467. if(($receiver = $1) == null || $receiver.isNil){
  31468. return "";
  31469. } else {
  31470. return $1;
  31471. };
  31472. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Node)});
  31473. },
  31474. args: [],
  31475. source: "source\x0a\x09^ source ifNil: [ '' ]",
  31476. referencedClasses: [],
  31477. messageSends: ["ifNil:"]
  31478. }),
  31479. $globals.Node);
  31480. $core.addMethod(
  31481. $core.method({
  31482. selector: "source:",
  31483. protocol: 'accessing',
  31484. fn: function (aString){
  31485. var self=this;
  31486. self["@source"]=aString;
  31487. return self;
  31488. },
  31489. args: ["aString"],
  31490. source: "source: aString\x0a\x09source := aString",
  31491. referencedClasses: [],
  31492. messageSends: []
  31493. }),
  31494. $globals.Node);
  31495. $core.addMethod(
  31496. $core.method({
  31497. selector: "subtreeNeedsAliasing",
  31498. protocol: 'testing',
  31499. fn: function (){
  31500. var self=this;
  31501. return $core.withContext(function($ctx1) {
  31502. var $1;
  31503. $1=$recv($recv(self._shouldBeAliased())._or_((function(){
  31504. return $core.withContext(function($ctx2) {
  31505. return self._shouldBeInlined();
  31506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31507. })))._or_((function(){
  31508. return $core.withContext(function($ctx2) {
  31509. return $recv(self._nodes())._anySatisfy_((function(each){
  31510. return $core.withContext(function($ctx3) {
  31511. return $recv(each)._subtreeNeedsAliasing();
  31512. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  31513. }));
  31514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31515. }));
  31516. $ctx1.sendIdx["or:"]=1;
  31517. return $1;
  31518. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.Node)});
  31519. },
  31520. args: [],
  31521. source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  31522. referencedClasses: [],
  31523. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"]
  31524. }),
  31525. $globals.Node);
  31526. $core.addClass('AssignmentNode', $globals.Node, ['left', 'right'], 'Compiler-AST');
  31527. $globals.AssignmentNode.comment="I represent an assignment node.";
  31528. $core.addMethod(
  31529. $core.method({
  31530. selector: "accept:",
  31531. protocol: 'visiting',
  31532. fn: function (aVisitor){
  31533. var self=this;
  31534. return $core.withContext(function($ctx1) {
  31535. return $recv(aVisitor)._visitAssignmentNode_(self);
  31536. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  31537. },
  31538. args: ["aVisitor"],
  31539. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  31540. referencedClasses: [],
  31541. messageSends: ["visitAssignmentNode:"]
  31542. }),
  31543. $globals.AssignmentNode);
  31544. $core.addMethod(
  31545. $core.method({
  31546. selector: "isAssignmentNode",
  31547. protocol: 'testing',
  31548. fn: function (){
  31549. var self=this;
  31550. return true;
  31551. },
  31552. args: [],
  31553. source: "isAssignmentNode\x0a\x09^ true",
  31554. referencedClasses: [],
  31555. messageSends: []
  31556. }),
  31557. $globals.AssignmentNode);
  31558. $core.addMethod(
  31559. $core.method({
  31560. selector: "left",
  31561. protocol: 'accessing',
  31562. fn: function (){
  31563. var self=this;
  31564. return self["@left"];
  31565. },
  31566. args: [],
  31567. source: "left\x0a\x09^ left",
  31568. referencedClasses: [],
  31569. messageSends: []
  31570. }),
  31571. $globals.AssignmentNode);
  31572. $core.addMethod(
  31573. $core.method({
  31574. selector: "left:",
  31575. protocol: 'accessing',
  31576. fn: function (aNode){
  31577. var self=this;
  31578. return $core.withContext(function($ctx1) {
  31579. self["@left"]=aNode;
  31580. $recv(aNode)._parent_(self);
  31581. return self;
  31582. }, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},$globals.AssignmentNode)});
  31583. },
  31584. args: ["aNode"],
  31585. source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
  31586. referencedClasses: [],
  31587. messageSends: ["parent:"]
  31588. }),
  31589. $globals.AssignmentNode);
  31590. $core.addMethod(
  31591. $core.method({
  31592. selector: "nodes",
  31593. protocol: 'accessing',
  31594. fn: function (){
  31595. var self=this;
  31596. return $core.withContext(function($ctx1) {
  31597. return $recv($globals.Array)._with_with_(self._left(),self._right());
  31598. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.AssignmentNode)});
  31599. },
  31600. args: [],
  31601. source: "nodes\x0a\x09^ Array with: self left with: self right",
  31602. referencedClasses: ["Array"],
  31603. messageSends: ["with:with:", "left", "right"]
  31604. }),
  31605. $globals.AssignmentNode);
  31606. $core.addMethod(
  31607. $core.method({
  31608. selector: "right",
  31609. protocol: 'accessing',
  31610. fn: function (){
  31611. var self=this;
  31612. return self["@right"];
  31613. },
  31614. args: [],
  31615. source: "right\x0a\x09^ right",
  31616. referencedClasses: [],
  31617. messageSends: []
  31618. }),
  31619. $globals.AssignmentNode);
  31620. $core.addMethod(
  31621. $core.method({
  31622. selector: "right:",
  31623. protocol: 'accessing',
  31624. fn: function (aNode){
  31625. var self=this;
  31626. return $core.withContext(function($ctx1) {
  31627. self["@right"]=aNode;
  31628. $recv(aNode)._parent_(self);
  31629. return self;
  31630. }, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},$globals.AssignmentNode)});
  31631. },
  31632. args: ["aNode"],
  31633. source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
  31634. referencedClasses: [],
  31635. messageSends: ["parent:"]
  31636. }),
  31637. $globals.AssignmentNode);
  31638. $core.addMethod(
  31639. $core.method({
  31640. selector: "shouldBeAliased",
  31641. protocol: 'testing',
  31642. fn: function (){
  31643. var self=this;
  31644. return $core.withContext(function($ctx1) {
  31645. var $1;
  31646. $1=(
  31647. $ctx1.supercall = true,
  31648. ($globals.AssignmentNode.superclass||$boot.dnu).fn.prototype._shouldBeAliased.apply($recv(self), []));
  31649. $ctx1.supercall = false;
  31650. return $recv($1)._or_((function(){
  31651. return $core.withContext(function($ctx2) {
  31652. return self._isReferenced();
  31653. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31654. }));
  31655. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  31656. },
  31657. args: [],
  31658. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  31659. referencedClasses: [],
  31660. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  31661. }),
  31662. $globals.AssignmentNode);
  31663. $core.addClass('BlockNode', $globals.Node, ['parameters', 'scope'], 'Compiler-AST');
  31664. $globals.BlockNode.comment="I represent an block closure node.";
  31665. $core.addMethod(
  31666. $core.method({
  31667. selector: "accept:",
  31668. protocol: 'visiting',
  31669. fn: function (aVisitor){
  31670. var self=this;
  31671. return $core.withContext(function($ctx1) {
  31672. return $recv(aVisitor)._visitBlockNode_(self);
  31673. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockNode)});
  31674. },
  31675. args: ["aVisitor"],
  31676. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  31677. referencedClasses: [],
  31678. messageSends: ["visitBlockNode:"]
  31679. }),
  31680. $globals.BlockNode);
  31681. $core.addMethod(
  31682. $core.method({
  31683. selector: "isBlockNode",
  31684. protocol: 'testing',
  31685. fn: function (){
  31686. var self=this;
  31687. return true;
  31688. },
  31689. args: [],
  31690. source: "isBlockNode\x0a\x09^ true",
  31691. referencedClasses: [],
  31692. messageSends: []
  31693. }),
  31694. $globals.BlockNode);
  31695. $core.addMethod(
  31696. $core.method({
  31697. selector: "parameters",
  31698. protocol: 'accessing',
  31699. fn: function (){
  31700. var self=this;
  31701. return $core.withContext(function($ctx1) {
  31702. var $1,$receiver;
  31703. $1=self["@parameters"];
  31704. if(($receiver = $1) == null || $receiver.isNil){
  31705. self["@parameters"]=$recv($globals.Array)._new();
  31706. return self["@parameters"];
  31707. } else {
  31708. return $1;
  31709. };
  31710. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  31711. },
  31712. args: [],
  31713. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  31714. referencedClasses: ["Array"],
  31715. messageSends: ["ifNil:", "new"]
  31716. }),
  31717. $globals.BlockNode);
  31718. $core.addMethod(
  31719. $core.method({
  31720. selector: "parameters:",
  31721. protocol: 'accessing',
  31722. fn: function (aCollection){
  31723. var self=this;
  31724. self["@parameters"]=aCollection;
  31725. return self;
  31726. },
  31727. args: ["aCollection"],
  31728. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  31729. referencedClasses: [],
  31730. messageSends: []
  31731. }),
  31732. $globals.BlockNode);
  31733. $core.addMethod(
  31734. $core.method({
  31735. selector: "scope",
  31736. protocol: 'accessing',
  31737. fn: function (){
  31738. var self=this;
  31739. return self["@scope"];
  31740. },
  31741. args: [],
  31742. source: "scope\x0a\x09^ scope",
  31743. referencedClasses: [],
  31744. messageSends: []
  31745. }),
  31746. $globals.BlockNode);
  31747. $core.addMethod(
  31748. $core.method({
  31749. selector: "scope:",
  31750. protocol: 'accessing',
  31751. fn: function (aLexicalScope){
  31752. var self=this;
  31753. self["@scope"]=aLexicalScope;
  31754. return self;
  31755. },
  31756. args: ["aLexicalScope"],
  31757. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  31758. referencedClasses: [],
  31759. messageSends: []
  31760. }),
  31761. $globals.BlockNode);
  31762. $core.addMethod(
  31763. $core.method({
  31764. selector: "subtreeNeedsAliasing",
  31765. protocol: 'testing',
  31766. fn: function (){
  31767. var self=this;
  31768. return $core.withContext(function($ctx1) {
  31769. return $recv(self._shouldBeAliased())._or_((function(){
  31770. return $core.withContext(function($ctx2) {
  31771. return self._shouldBeInlined();
  31772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31773. }));
  31774. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  31775. },
  31776. args: [],
  31777. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  31778. referencedClasses: [],
  31779. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"]
  31780. }),
  31781. $globals.BlockNode);
  31782. $core.addClass('CascadeNode', $globals.Node, ['receiver'], 'Compiler-AST');
  31783. $globals.CascadeNode.comment="I represent an cascade node.";
  31784. $core.addMethod(
  31785. $core.method({
  31786. selector: "accept:",
  31787. protocol: 'visiting',
  31788. fn: function (aVisitor){
  31789. var self=this;
  31790. return $core.withContext(function($ctx1) {
  31791. return $recv(aVisitor)._visitCascadeNode_(self);
  31792. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.CascadeNode)});
  31793. },
  31794. args: ["aVisitor"],
  31795. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  31796. referencedClasses: [],
  31797. messageSends: ["visitCascadeNode:"]
  31798. }),
  31799. $globals.CascadeNode);
  31800. $core.addMethod(
  31801. $core.method({
  31802. selector: "isCascadeNode",
  31803. protocol: 'testing',
  31804. fn: function (){
  31805. var self=this;
  31806. return true;
  31807. },
  31808. args: [],
  31809. source: "isCascadeNode\x0a\x09^ true",
  31810. referencedClasses: [],
  31811. messageSends: []
  31812. }),
  31813. $globals.CascadeNode);
  31814. $core.addMethod(
  31815. $core.method({
  31816. selector: "receiver",
  31817. protocol: 'accessing',
  31818. fn: function (){
  31819. var self=this;
  31820. return self["@receiver"];
  31821. },
  31822. args: [],
  31823. source: "receiver\x0a\x09^ receiver",
  31824. referencedClasses: [],
  31825. messageSends: []
  31826. }),
  31827. $globals.CascadeNode);
  31828. $core.addMethod(
  31829. $core.method({
  31830. selector: "receiver:",
  31831. protocol: 'accessing',
  31832. fn: function (aNode){
  31833. var self=this;
  31834. self["@receiver"]=aNode;
  31835. return self;
  31836. },
  31837. args: ["aNode"],
  31838. source: "receiver: aNode\x0a\x09receiver := aNode",
  31839. referencedClasses: [],
  31840. messageSends: []
  31841. }),
  31842. $globals.CascadeNode);
  31843. $core.addMethod(
  31844. $core.method({
  31845. selector: "subtreeNeedsAliasing",
  31846. protocol: 'testing',
  31847. fn: function (){
  31848. var self=this;
  31849. return $core.withContext(function($ctx1) {
  31850. return $recv($recv(self._parent())._isSequenceNode())._not();
  31851. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  31852. },
  31853. args: [],
  31854. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  31855. referencedClasses: [],
  31856. messageSends: ["not", "isSequenceNode", "parent"]
  31857. }),
  31858. $globals.CascadeNode);
  31859. $core.addClass('DynamicArrayNode', $globals.Node, [], 'Compiler-AST');
  31860. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  31861. $core.addMethod(
  31862. $core.method({
  31863. selector: "accept:",
  31864. protocol: 'visiting',
  31865. fn: function (aVisitor){
  31866. var self=this;
  31867. return $core.withContext(function($ctx1) {
  31868. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  31869. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  31870. },
  31871. args: ["aVisitor"],
  31872. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  31873. referencedClasses: [],
  31874. messageSends: ["visitDynamicArrayNode:"]
  31875. }),
  31876. $globals.DynamicArrayNode);
  31877. $core.addClass('DynamicDictionaryNode', $globals.Node, [], 'Compiler-AST');
  31878. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  31879. $core.addMethod(
  31880. $core.method({
  31881. selector: "accept:",
  31882. protocol: 'visiting',
  31883. fn: function (aVisitor){
  31884. var self=this;
  31885. return $core.withContext(function($ctx1) {
  31886. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  31887. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  31888. },
  31889. args: ["aVisitor"],
  31890. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  31891. referencedClasses: [],
  31892. messageSends: ["visitDynamicDictionaryNode:"]
  31893. }),
  31894. $globals.DynamicDictionaryNode);
  31895. $core.addClass('JSStatementNode', $globals.Node, [], 'Compiler-AST');
  31896. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  31897. $core.addMethod(
  31898. $core.method({
  31899. selector: "accept:",
  31900. protocol: 'visiting',
  31901. fn: function (aVisitor){
  31902. var self=this;
  31903. return $core.withContext(function($ctx1) {
  31904. return $recv(aVisitor)._visitJSStatementNode_(self);
  31905. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  31906. },
  31907. args: ["aVisitor"],
  31908. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  31909. referencedClasses: [],
  31910. messageSends: ["visitJSStatementNode:"]
  31911. }),
  31912. $globals.JSStatementNode);
  31913. $core.addMethod(
  31914. $core.method({
  31915. selector: "isJSStatementNode",
  31916. protocol: 'testing',
  31917. fn: function (){
  31918. var self=this;
  31919. return true;
  31920. },
  31921. args: [],
  31922. source: "isJSStatementNode\x0a\x09^ true",
  31923. referencedClasses: [],
  31924. messageSends: []
  31925. }),
  31926. $globals.JSStatementNode);
  31927. $core.addMethod(
  31928. $core.method({
  31929. selector: "requiresSmalltalkContext",
  31930. protocol: 'testing',
  31931. fn: function (){
  31932. var self=this;
  31933. return true;
  31934. },
  31935. args: [],
  31936. source: "requiresSmalltalkContext\x0a\x09^ true",
  31937. referencedClasses: [],
  31938. messageSends: []
  31939. }),
  31940. $globals.JSStatementNode);
  31941. $core.addClass('MethodNode', $globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes'], 'Compiler-AST');
  31942. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  31943. $core.addMethod(
  31944. $core.method({
  31945. selector: "accept:",
  31946. protocol: 'visiting',
  31947. fn: function (aVisitor){
  31948. var self=this;
  31949. return $core.withContext(function($ctx1) {
  31950. return $recv(aVisitor)._visitMethodNode_(self);
  31951. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.MethodNode)});
  31952. },
  31953. args: ["aVisitor"],
  31954. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  31955. referencedClasses: [],
  31956. messageSends: ["visitMethodNode:"]
  31957. }),
  31958. $globals.MethodNode);
  31959. $core.addMethod(
  31960. $core.method({
  31961. selector: "arguments",
  31962. protocol: 'accessing',
  31963. fn: function (){
  31964. var self=this;
  31965. return $core.withContext(function($ctx1) {
  31966. var $1,$receiver;
  31967. $1=self["@arguments"];
  31968. if(($receiver = $1) == null || $receiver.isNil){
  31969. return [];
  31970. } else {
  31971. return $1;
  31972. };
  31973. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  31974. },
  31975. args: [],
  31976. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  31977. referencedClasses: [],
  31978. messageSends: ["ifNil:"]
  31979. }),
  31980. $globals.MethodNode);
  31981. $core.addMethod(
  31982. $core.method({
  31983. selector: "arguments:",
  31984. protocol: 'accessing',
  31985. fn: function (aCollection){
  31986. var self=this;
  31987. self["@arguments"]=aCollection;
  31988. return self;
  31989. },
  31990. args: ["aCollection"],
  31991. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  31992. referencedClasses: [],
  31993. messageSends: []
  31994. }),
  31995. $globals.MethodNode);
  31996. $core.addMethod(
  31997. $core.method({
  31998. selector: "classReferences",
  31999. protocol: 'accessing',
  32000. fn: function (){
  32001. var self=this;
  32002. return self["@classReferences"];
  32003. },
  32004. args: [],
  32005. source: "classReferences\x0a\x09^ classReferences",
  32006. referencedClasses: [],
  32007. messageSends: []
  32008. }),
  32009. $globals.MethodNode);
  32010. $core.addMethod(
  32011. $core.method({
  32012. selector: "classReferences:",
  32013. protocol: 'accessing',
  32014. fn: function (aCollection){
  32015. var self=this;
  32016. self["@classReferences"]=aCollection;
  32017. return self;
  32018. },
  32019. args: ["aCollection"],
  32020. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  32021. referencedClasses: [],
  32022. messageSends: []
  32023. }),
  32024. $globals.MethodNode);
  32025. $core.addMethod(
  32026. $core.method({
  32027. selector: "messageSends",
  32028. protocol: 'accessing',
  32029. fn: function (){
  32030. var self=this;
  32031. return $core.withContext(function($ctx1) {
  32032. return $recv(self._sendIndexes())._keys();
  32033. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  32034. },
  32035. args: [],
  32036. source: "messageSends\x0a\x09^ self sendIndexes keys",
  32037. referencedClasses: [],
  32038. messageSends: ["keys", "sendIndexes"]
  32039. }),
  32040. $globals.MethodNode);
  32041. $core.addMethod(
  32042. $core.method({
  32043. selector: "method",
  32044. protocol: 'accessing',
  32045. fn: function (){
  32046. var self=this;
  32047. return self;
  32048. },
  32049. args: [],
  32050. source: "method\x0a\x09^ self",
  32051. referencedClasses: [],
  32052. messageSends: []
  32053. }),
  32054. $globals.MethodNode);
  32055. $core.addMethod(
  32056. $core.method({
  32057. selector: "scope",
  32058. protocol: 'accessing',
  32059. fn: function (){
  32060. var self=this;
  32061. return self["@scope"];
  32062. },
  32063. args: [],
  32064. source: "scope\x0a\x09^ scope",
  32065. referencedClasses: [],
  32066. messageSends: []
  32067. }),
  32068. $globals.MethodNode);
  32069. $core.addMethod(
  32070. $core.method({
  32071. selector: "scope:",
  32072. protocol: 'accessing',
  32073. fn: function (aMethodScope){
  32074. var self=this;
  32075. self["@scope"]=aMethodScope;
  32076. return self;
  32077. },
  32078. args: ["aMethodScope"],
  32079. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  32080. referencedClasses: [],
  32081. messageSends: []
  32082. }),
  32083. $globals.MethodNode);
  32084. $core.addMethod(
  32085. $core.method({
  32086. selector: "selector",
  32087. protocol: 'accessing',
  32088. fn: function (){
  32089. var self=this;
  32090. return self["@selector"];
  32091. },
  32092. args: [],
  32093. source: "selector\x0a\x09^ selector",
  32094. referencedClasses: [],
  32095. messageSends: []
  32096. }),
  32097. $globals.MethodNode);
  32098. $core.addMethod(
  32099. $core.method({
  32100. selector: "selector:",
  32101. protocol: 'accessing',
  32102. fn: function (aString){
  32103. var self=this;
  32104. self["@selector"]=aString;
  32105. return self;
  32106. },
  32107. args: ["aString"],
  32108. source: "selector: aString\x0a\x09selector := aString",
  32109. referencedClasses: [],
  32110. messageSends: []
  32111. }),
  32112. $globals.MethodNode);
  32113. $core.addMethod(
  32114. $core.method({
  32115. selector: "sendIndexes",
  32116. protocol: 'accessing',
  32117. fn: function (){
  32118. var self=this;
  32119. return self["@sendIndexes"];
  32120. },
  32121. args: [],
  32122. source: "sendIndexes\x0a\x09^ sendIndexes",
  32123. referencedClasses: [],
  32124. messageSends: []
  32125. }),
  32126. $globals.MethodNode);
  32127. $core.addMethod(
  32128. $core.method({
  32129. selector: "sendIndexes:",
  32130. protocol: 'accessing',
  32131. fn: function (aDictionary){
  32132. var self=this;
  32133. self["@sendIndexes"]=aDictionary;
  32134. return self;
  32135. },
  32136. args: ["aDictionary"],
  32137. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  32138. referencedClasses: [],
  32139. messageSends: []
  32140. }),
  32141. $globals.MethodNode);
  32142. $core.addMethod(
  32143. $core.method({
  32144. selector: "sequenceNode",
  32145. protocol: 'accessing',
  32146. fn: function (){
  32147. var self=this;
  32148. return $core.withContext(function($ctx1) {
  32149. var $1;
  32150. var $early={};
  32151. try {
  32152. $recv(self._nodes())._do_((function(each){
  32153. return $core.withContext(function($ctx2) {
  32154. $1=$recv(each)._isSequenceNode();
  32155. if($core.assert($1)){
  32156. throw $early=[each];
  32157. };
  32158. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32159. }));
  32160. return nil;
  32161. }
  32162. catch(e) {if(e===$early)return e[0]; throw e}
  32163. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  32164. },
  32165. args: [],
  32166. source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  32167. referencedClasses: [],
  32168. messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"]
  32169. }),
  32170. $globals.MethodNode);
  32171. $core.addMethod(
  32172. $core.method({
  32173. selector: "source",
  32174. protocol: 'accessing',
  32175. fn: function (){
  32176. var self=this;
  32177. return self["@source"];
  32178. },
  32179. args: [],
  32180. source: "source\x0a\x09^ source",
  32181. referencedClasses: [],
  32182. messageSends: []
  32183. }),
  32184. $globals.MethodNode);
  32185. $core.addMethod(
  32186. $core.method({
  32187. selector: "source:",
  32188. protocol: 'accessing',
  32189. fn: function (aString){
  32190. var self=this;
  32191. self["@source"]=aString;
  32192. return self;
  32193. },
  32194. args: ["aString"],
  32195. source: "source: aString\x0a\x09source := aString",
  32196. referencedClasses: [],
  32197. messageSends: []
  32198. }),
  32199. $globals.MethodNode);
  32200. $core.addClass('ReturnNode', $globals.Node, ['scope'], 'Compiler-AST');
  32201. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  32202. $core.addMethod(
  32203. $core.method({
  32204. selector: "accept:",
  32205. protocol: 'visiting',
  32206. fn: function (aVisitor){
  32207. var self=this;
  32208. return $core.withContext(function($ctx1) {
  32209. return $recv(aVisitor)._visitReturnNode_(self);
  32210. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ReturnNode)});
  32211. },
  32212. args: ["aVisitor"],
  32213. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  32214. referencedClasses: [],
  32215. messageSends: ["visitReturnNode:"]
  32216. }),
  32217. $globals.ReturnNode);
  32218. $core.addMethod(
  32219. $core.method({
  32220. selector: "isReturnNode",
  32221. protocol: 'testing',
  32222. fn: function (){
  32223. var self=this;
  32224. return true;
  32225. },
  32226. args: [],
  32227. source: "isReturnNode\x0a\x09^ true",
  32228. referencedClasses: [],
  32229. messageSends: []
  32230. }),
  32231. $globals.ReturnNode);
  32232. $core.addMethod(
  32233. $core.method({
  32234. selector: "nonLocalReturn",
  32235. protocol: 'testing',
  32236. fn: function (){
  32237. var self=this;
  32238. return $core.withContext(function($ctx1) {
  32239. return $recv($recv(self._scope())._isMethodScope())._not();
  32240. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  32241. },
  32242. args: [],
  32243. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  32244. referencedClasses: [],
  32245. messageSends: ["not", "isMethodScope", "scope"]
  32246. }),
  32247. $globals.ReturnNode);
  32248. $core.addMethod(
  32249. $core.method({
  32250. selector: "scope",
  32251. protocol: 'accessing',
  32252. fn: function (){
  32253. var self=this;
  32254. return self["@scope"];
  32255. },
  32256. args: [],
  32257. source: "scope\x0a\x09^ scope",
  32258. referencedClasses: [],
  32259. messageSends: []
  32260. }),
  32261. $globals.ReturnNode);
  32262. $core.addMethod(
  32263. $core.method({
  32264. selector: "scope:",
  32265. protocol: 'accessing',
  32266. fn: function (aLexicalScope){
  32267. var self=this;
  32268. self["@scope"]=aLexicalScope;
  32269. return self;
  32270. },
  32271. args: ["aLexicalScope"],
  32272. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32273. referencedClasses: [],
  32274. messageSends: []
  32275. }),
  32276. $globals.ReturnNode);
  32277. $core.addClass('SendNode', $globals.Node, ['selector', 'arguments', 'receiver', 'index'], 'Compiler-AST');
  32278. $globals.SendNode.comment="I represent an message send node.";
  32279. $core.addMethod(
  32280. $core.method({
  32281. selector: "accept:",
  32282. protocol: 'visiting',
  32283. fn: function (aVisitor){
  32284. var self=this;
  32285. return $core.withContext(function($ctx1) {
  32286. return $recv(aVisitor)._visitSendNode_(self);
  32287. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SendNode)});
  32288. },
  32289. args: ["aVisitor"],
  32290. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  32291. referencedClasses: [],
  32292. messageSends: ["visitSendNode:"]
  32293. }),
  32294. $globals.SendNode);
  32295. $core.addMethod(
  32296. $core.method({
  32297. selector: "arguments",
  32298. protocol: 'accessing',
  32299. fn: function (){
  32300. var self=this;
  32301. return $core.withContext(function($ctx1) {
  32302. var $1,$receiver;
  32303. $1=self["@arguments"];
  32304. if(($receiver = $1) == null || $receiver.isNil){
  32305. self["@arguments"]=[];
  32306. return self["@arguments"];
  32307. } else {
  32308. return $1;
  32309. };
  32310. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  32311. },
  32312. args: [],
  32313. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  32314. referencedClasses: [],
  32315. messageSends: ["ifNil:"]
  32316. }),
  32317. $globals.SendNode);
  32318. $core.addMethod(
  32319. $core.method({
  32320. selector: "arguments:",
  32321. protocol: 'accessing',
  32322. fn: function (aCollection){
  32323. var self=this;
  32324. return $core.withContext(function($ctx1) {
  32325. self["@arguments"]=aCollection;
  32326. $recv(aCollection)._do_((function(each){
  32327. return $core.withContext(function($ctx2) {
  32328. return $recv(each)._parent_(self);
  32329. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32330. }));
  32331. return self;
  32332. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.SendNode)});
  32333. },
  32334. args: ["aCollection"],
  32335. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  32336. referencedClasses: [],
  32337. messageSends: ["do:", "parent:"]
  32338. }),
  32339. $globals.SendNode);
  32340. $core.addMethod(
  32341. $core.method({
  32342. selector: "cascadeNodeWithMessages:",
  32343. protocol: 'accessing',
  32344. fn: function (aCollection){
  32345. var self=this;
  32346. var first;
  32347. return $core.withContext(function($ctx1) {
  32348. var $1,$2,$3;
  32349. $1=$recv($globals.SendNode)._new();
  32350. $ctx1.sendIdx["new"]=1;
  32351. $recv($1)._selector_(self._selector());
  32352. $recv($1)._arguments_(self._arguments());
  32353. $2=$recv($1)._yourself();
  32354. $ctx1.sendIdx["yourself"]=1;
  32355. first=$2;
  32356. $3=$recv($globals.CascadeNode)._new();
  32357. $recv($3)._receiver_(self._receiver());
  32358. $recv($3)._nodes_($recv($recv($globals.Array)._with_(first)).__comma(aCollection));
  32359. return $recv($3)._yourself();
  32360. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},$globals.SendNode)});
  32361. },
  32362. args: ["aCollection"],
  32363. source: "cascadeNodeWithMessages: aCollection\x0a\x09| first |\x0a\x09first := SendNode new\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself.\x0a\x09^ CascadeNode new\x0a\x09\x09receiver: self receiver;\x0a\x09\x09nodes: (Array with: first), aCollection;\x0a\x09\x09yourself",
  32364. referencedClasses: ["SendNode", "CascadeNode", "Array"],
  32365. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"]
  32366. }),
  32367. $globals.SendNode);
  32368. $core.addMethod(
  32369. $core.method({
  32370. selector: "index",
  32371. protocol: 'accessing',
  32372. fn: function (){
  32373. var self=this;
  32374. return self["@index"];
  32375. },
  32376. args: [],
  32377. source: "index\x0a\x09^ index",
  32378. referencedClasses: [],
  32379. messageSends: []
  32380. }),
  32381. $globals.SendNode);
  32382. $core.addMethod(
  32383. $core.method({
  32384. selector: "index:",
  32385. protocol: 'accessing',
  32386. fn: function (anInteger){
  32387. var self=this;
  32388. self["@index"]=anInteger;
  32389. return self;
  32390. },
  32391. args: ["anInteger"],
  32392. source: "index: anInteger\x0a\x09index := anInteger",
  32393. referencedClasses: [],
  32394. messageSends: []
  32395. }),
  32396. $globals.SendNode);
  32397. $core.addMethod(
  32398. $core.method({
  32399. selector: "isCascadeSendNode",
  32400. protocol: 'testing',
  32401. fn: function (){
  32402. var self=this;
  32403. return $core.withContext(function($ctx1) {
  32404. return $recv(self._parent())._isCascadeNode();
  32405. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  32406. },
  32407. args: [],
  32408. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  32409. referencedClasses: [],
  32410. messageSends: ["isCascadeNode", "parent"]
  32411. }),
  32412. $globals.SendNode);
  32413. $core.addMethod(
  32414. $core.method({
  32415. selector: "isNavigationNode",
  32416. protocol: 'testing',
  32417. fn: function (){
  32418. var self=this;
  32419. return true;
  32420. },
  32421. args: [],
  32422. source: "isNavigationNode\x0a\x09^ true",
  32423. referencedClasses: [],
  32424. messageSends: []
  32425. }),
  32426. $globals.SendNode);
  32427. $core.addMethod(
  32428. $core.method({
  32429. selector: "isSendNode",
  32430. protocol: 'testing',
  32431. fn: function (){
  32432. var self=this;
  32433. return true;
  32434. },
  32435. args: [],
  32436. source: "isSendNode\x0a\x09^ true",
  32437. referencedClasses: [],
  32438. messageSends: []
  32439. }),
  32440. $globals.SendNode);
  32441. $core.addMethod(
  32442. $core.method({
  32443. selector: "navigationLink",
  32444. protocol: 'accessing',
  32445. fn: function (){
  32446. var self=this;
  32447. return $core.withContext(function($ctx1) {
  32448. return self._selector();
  32449. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  32450. },
  32451. args: [],
  32452. source: "navigationLink\x0a\x09^ self selector",
  32453. referencedClasses: [],
  32454. messageSends: ["selector"]
  32455. }),
  32456. $globals.SendNode);
  32457. $core.addMethod(
  32458. $core.method({
  32459. selector: "nodes",
  32460. protocol: 'accessing',
  32461. fn: function (){
  32462. var self=this;
  32463. return $core.withContext(function($ctx1) {
  32464. var $1,$2,$3,$receiver;
  32465. $1=self._receiver();
  32466. $ctx1.sendIdx["receiver"]=1;
  32467. if(($receiver = $1) == null || $receiver.isNil){
  32468. $2=self._arguments();
  32469. $ctx1.sendIdx["arguments"]=1;
  32470. return $recv($2)._copy();
  32471. } else {
  32472. $1;
  32473. };
  32474. $3=$recv($globals.Array)._with_(self._receiver());
  32475. $recv($3)._addAll_(self._arguments());
  32476. return $recv($3)._yourself();
  32477. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.SendNode)});
  32478. },
  32479. args: [],
  32480. source: "nodes\x0a\x09self receiver ifNil: [ ^ self arguments copy ].\x0a\x09\x0a\x09^ (Array with: self receiver)\x0a\x09\x09addAll: self arguments;\x0a\x09\x09yourself",
  32481. referencedClasses: ["Array"],
  32482. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  32483. }),
  32484. $globals.SendNode);
  32485. $core.addMethod(
  32486. $core.method({
  32487. selector: "receiver",
  32488. protocol: 'accessing',
  32489. fn: function (){
  32490. var self=this;
  32491. return self["@receiver"];
  32492. },
  32493. args: [],
  32494. source: "receiver\x0a\x09^ receiver",
  32495. referencedClasses: [],
  32496. messageSends: []
  32497. }),
  32498. $globals.SendNode);
  32499. $core.addMethod(
  32500. $core.method({
  32501. selector: "receiver:",
  32502. protocol: 'accessing',
  32503. fn: function (aNode){
  32504. var self=this;
  32505. return $core.withContext(function($ctx1) {
  32506. var $1;
  32507. self["@receiver"]=aNode;
  32508. $1=$recv(aNode)._isNode();
  32509. if($core.assert($1)){
  32510. $recv(aNode)._parent_(self);
  32511. };
  32512. return self;
  32513. }, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},$globals.SendNode)});
  32514. },
  32515. args: ["aNode"],
  32516. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  32517. referencedClasses: [],
  32518. messageSends: ["ifTrue:", "isNode", "parent:"]
  32519. }),
  32520. $globals.SendNode);
  32521. $core.addMethod(
  32522. $core.method({
  32523. selector: "requiresSmalltalkContext",
  32524. protocol: 'testing',
  32525. fn: function (){
  32526. var self=this;
  32527. return true;
  32528. },
  32529. args: [],
  32530. source: "requiresSmalltalkContext\x0a\x09^ true",
  32531. referencedClasses: [],
  32532. messageSends: []
  32533. }),
  32534. $globals.SendNode);
  32535. $core.addMethod(
  32536. $core.method({
  32537. selector: "selector",
  32538. protocol: 'accessing',
  32539. fn: function (){
  32540. var self=this;
  32541. return self["@selector"];
  32542. },
  32543. args: [],
  32544. source: "selector\x0a\x09^ selector",
  32545. referencedClasses: [],
  32546. messageSends: []
  32547. }),
  32548. $globals.SendNode);
  32549. $core.addMethod(
  32550. $core.method({
  32551. selector: "selector:",
  32552. protocol: 'accessing',
  32553. fn: function (aString){
  32554. var self=this;
  32555. self["@selector"]=aString;
  32556. return self;
  32557. },
  32558. args: ["aString"],
  32559. source: "selector: aString\x0a\x09selector := aString",
  32560. referencedClasses: [],
  32561. messageSends: []
  32562. }),
  32563. $globals.SendNode);
  32564. $core.addMethod(
  32565. $core.method({
  32566. selector: "shouldBeAliased",
  32567. protocol: 'testing',
  32568. fn: function (){
  32569. var self=this;
  32570. var sends;
  32571. return $core.withContext(function($ctx1) {
  32572. var $2,$1;
  32573. sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size();
  32574. $2=(
  32575. $ctx1.supercall = true,
  32576. ($globals.SendNode.superclass||$boot.dnu).fn.prototype._shouldBeAliased.apply($recv(self), []));
  32577. $ctx1.supercall = false;
  32578. $1=$recv($2)._or_((function(){
  32579. return $core.withContext(function($ctx2) {
  32580. return $recv(self._isReferenced())._and_((function(){
  32581. return $core.withContext(function($ctx3) {
  32582. return $recv($recv($recv(sends).__gt((1)))._and_((function(){
  32583. return $core.withContext(function($ctx4) {
  32584. return $recv(self._index()).__lt(sends);
  32585. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  32586. })))._or_((function(){
  32587. return $core.withContext(function($ctx4) {
  32588. return self._superSend();
  32589. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  32590. }));
  32591. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32592. }));
  32593. $ctx2.sendIdx["and:"]=1;
  32594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32595. }));
  32596. $ctx1.sendIdx["or:"]=1;
  32597. return $1;
  32598. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  32599. },
  32600. args: [],
  32601. 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\x09(sends > 1 and: [ self index < sends ])\x0a\x09\x09\x09\x09or: [ self superSend ] ] ])",
  32602. referencedClasses: [],
  32603. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"]
  32604. }),
  32605. $globals.SendNode);
  32606. $core.addMethod(
  32607. $core.method({
  32608. selector: "superSend",
  32609. protocol: 'accessing',
  32610. fn: function (){
  32611. var self=this;
  32612. return $core.withContext(function($ctx1) {
  32613. return $recv($recv(self._receiver())._value()).__eq("super");
  32614. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  32615. },
  32616. args: [],
  32617. source: "superSend\x0a\x09^ self receiver value = 'super'",
  32618. referencedClasses: [],
  32619. messageSends: ["=", "value", "receiver"]
  32620. }),
  32621. $globals.SendNode);
  32622. $core.addMethod(
  32623. $core.method({
  32624. selector: "valueForReceiver:",
  32625. protocol: 'building',
  32626. fn: function (anObject){
  32627. var self=this;
  32628. return $core.withContext(function($ctx1) {
  32629. var $1,$3,$2,$receiver;
  32630. $1=$recv($globals.SendNode)._new();
  32631. $recv($1)._position_(self._position());
  32632. $recv($1)._source_(self._source());
  32633. $3=self._receiver();
  32634. $ctx1.sendIdx["receiver"]=1;
  32635. if(($receiver = $3) == null || $receiver.isNil){
  32636. $2=anObject;
  32637. } else {
  32638. $2=$recv(self._receiver())._valueForReceiver_(anObject);
  32639. };
  32640. $recv($1)._receiver_($2);
  32641. $recv($1)._selector_(self._selector());
  32642. $recv($1)._arguments_(self._arguments());
  32643. return $recv($1)._yourself();
  32644. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},$globals.SendNode)});
  32645. },
  32646. args: ["anObject"],
  32647. 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",
  32648. referencedClasses: ["SendNode"],
  32649. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  32650. }),
  32651. $globals.SendNode);
  32652. $core.addClass('SequenceNode', $globals.Node, ['temps', 'scope'], 'Compiler-AST');
  32653. $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).";
  32654. $core.addMethod(
  32655. $core.method({
  32656. selector: "accept:",
  32657. protocol: 'visiting',
  32658. fn: function (aVisitor){
  32659. var self=this;
  32660. return $core.withContext(function($ctx1) {
  32661. return $recv(aVisitor)._visitSequenceNode_(self);
  32662. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SequenceNode)});
  32663. },
  32664. args: ["aVisitor"],
  32665. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  32666. referencedClasses: [],
  32667. messageSends: ["visitSequenceNode:"]
  32668. }),
  32669. $globals.SequenceNode);
  32670. $core.addMethod(
  32671. $core.method({
  32672. selector: "asBlockSequenceNode",
  32673. protocol: 'building',
  32674. fn: function (){
  32675. var self=this;
  32676. return $core.withContext(function($ctx1) {
  32677. var $1;
  32678. $1=$recv($globals.BlockSequenceNode)._new();
  32679. $recv($1)._position_(self._position());
  32680. $recv($1)._source_(self._source());
  32681. $recv($1)._nodes_(self._nodes());
  32682. $recv($1)._temps_(self._temps());
  32683. return $recv($1)._yourself();
  32684. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  32685. },
  32686. args: [],
  32687. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09nodes: self nodes;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  32688. referencedClasses: ["BlockSequenceNode"],
  32689. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"]
  32690. }),
  32691. $globals.SequenceNode);
  32692. $core.addMethod(
  32693. $core.method({
  32694. selector: "isSequenceNode",
  32695. protocol: 'testing',
  32696. fn: function (){
  32697. var self=this;
  32698. return true;
  32699. },
  32700. args: [],
  32701. source: "isSequenceNode\x0a\x09^ true",
  32702. referencedClasses: [],
  32703. messageSends: []
  32704. }),
  32705. $globals.SequenceNode);
  32706. $core.addMethod(
  32707. $core.method({
  32708. selector: "scope",
  32709. protocol: 'accessing',
  32710. fn: function (){
  32711. var self=this;
  32712. return self["@scope"];
  32713. },
  32714. args: [],
  32715. source: "scope\x0a\x09^ scope",
  32716. referencedClasses: [],
  32717. messageSends: []
  32718. }),
  32719. $globals.SequenceNode);
  32720. $core.addMethod(
  32721. $core.method({
  32722. selector: "scope:",
  32723. protocol: 'accessing',
  32724. fn: function (aLexicalScope){
  32725. var self=this;
  32726. self["@scope"]=aLexicalScope;
  32727. return self;
  32728. },
  32729. args: ["aLexicalScope"],
  32730. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32731. referencedClasses: [],
  32732. messageSends: []
  32733. }),
  32734. $globals.SequenceNode);
  32735. $core.addMethod(
  32736. $core.method({
  32737. selector: "temps",
  32738. protocol: 'accessing',
  32739. fn: function (){
  32740. var self=this;
  32741. return $core.withContext(function($ctx1) {
  32742. var $1,$receiver;
  32743. $1=self["@temps"];
  32744. if(($receiver = $1) == null || $receiver.isNil){
  32745. return [];
  32746. } else {
  32747. return $1;
  32748. };
  32749. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  32750. },
  32751. args: [],
  32752. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  32753. referencedClasses: [],
  32754. messageSends: ["ifNil:"]
  32755. }),
  32756. $globals.SequenceNode);
  32757. $core.addMethod(
  32758. $core.method({
  32759. selector: "temps:",
  32760. protocol: 'accessing',
  32761. fn: function (aCollection){
  32762. var self=this;
  32763. self["@temps"]=aCollection;
  32764. return self;
  32765. },
  32766. args: ["aCollection"],
  32767. source: "temps: aCollection\x0a\x09temps := aCollection",
  32768. referencedClasses: [],
  32769. messageSends: []
  32770. }),
  32771. $globals.SequenceNode);
  32772. $core.addClass('BlockSequenceNode', $globals.SequenceNode, [], 'Compiler-AST');
  32773. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  32774. $core.addMethod(
  32775. $core.method({
  32776. selector: "accept:",
  32777. protocol: 'visiting',
  32778. fn: function (aVisitor){
  32779. var self=this;
  32780. return $core.withContext(function($ctx1) {
  32781. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  32782. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  32783. },
  32784. args: ["aVisitor"],
  32785. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  32786. referencedClasses: [],
  32787. messageSends: ["visitBlockSequenceNode:"]
  32788. }),
  32789. $globals.BlockSequenceNode);
  32790. $core.addMethod(
  32791. $core.method({
  32792. selector: "isBlockSequenceNode",
  32793. protocol: 'testing',
  32794. fn: function (){
  32795. var self=this;
  32796. return true;
  32797. },
  32798. args: [],
  32799. source: "isBlockSequenceNode\x0a\x09^ true",
  32800. referencedClasses: [],
  32801. messageSends: []
  32802. }),
  32803. $globals.BlockSequenceNode);
  32804. $core.addClass('ValueNode', $globals.Node, ['value'], 'Compiler-AST');
  32805. $globals.ValueNode.comment="I represent a value node.";
  32806. $core.addMethod(
  32807. $core.method({
  32808. selector: "accept:",
  32809. protocol: 'visiting',
  32810. fn: function (aVisitor){
  32811. var self=this;
  32812. return $core.withContext(function($ctx1) {
  32813. return $recv(aVisitor)._visitValueNode_(self);
  32814. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ValueNode)});
  32815. },
  32816. args: ["aVisitor"],
  32817. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  32818. referencedClasses: [],
  32819. messageSends: ["visitValueNode:"]
  32820. }),
  32821. $globals.ValueNode);
  32822. $core.addMethod(
  32823. $core.method({
  32824. selector: "isImmutable",
  32825. protocol: 'testing',
  32826. fn: function (){
  32827. var self=this;
  32828. return $core.withContext(function($ctx1) {
  32829. return $recv(self._value())._isImmutable();
  32830. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  32831. },
  32832. args: [],
  32833. source: "isImmutable\x0a\x09^ self value isImmutable",
  32834. referencedClasses: [],
  32835. messageSends: ["isImmutable", "value"]
  32836. }),
  32837. $globals.ValueNode);
  32838. $core.addMethod(
  32839. $core.method({
  32840. selector: "isValueNode",
  32841. protocol: 'testing',
  32842. fn: function (){
  32843. var self=this;
  32844. return true;
  32845. },
  32846. args: [],
  32847. source: "isValueNode\x0a\x09^ true",
  32848. referencedClasses: [],
  32849. messageSends: []
  32850. }),
  32851. $globals.ValueNode);
  32852. $core.addMethod(
  32853. $core.method({
  32854. selector: "value",
  32855. protocol: 'accessing',
  32856. fn: function (){
  32857. var self=this;
  32858. return self["@value"];
  32859. },
  32860. args: [],
  32861. source: "value\x0a\x09^ value",
  32862. referencedClasses: [],
  32863. messageSends: []
  32864. }),
  32865. $globals.ValueNode);
  32866. $core.addMethod(
  32867. $core.method({
  32868. selector: "value:",
  32869. protocol: 'accessing',
  32870. fn: function (anObject){
  32871. var self=this;
  32872. self["@value"]=anObject;
  32873. return self;
  32874. },
  32875. args: ["anObject"],
  32876. source: "value: anObject\x0a\x09value := anObject",
  32877. referencedClasses: [],
  32878. messageSends: []
  32879. }),
  32880. $globals.ValueNode);
  32881. $core.addClass('VariableNode', $globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  32882. $globals.VariableNode.comment="I represent an variable node.";
  32883. $core.addMethod(
  32884. $core.method({
  32885. selector: "accept:",
  32886. protocol: 'visiting',
  32887. fn: function (aVisitor){
  32888. var self=this;
  32889. return $core.withContext(function($ctx1) {
  32890. return $recv(aVisitor)._visitVariableNode_(self);
  32891. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.VariableNode)});
  32892. },
  32893. args: ["aVisitor"],
  32894. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  32895. referencedClasses: [],
  32896. messageSends: ["visitVariableNode:"]
  32897. }),
  32898. $globals.VariableNode);
  32899. $core.addMethod(
  32900. $core.method({
  32901. selector: "alias",
  32902. protocol: 'accessing',
  32903. fn: function (){
  32904. var self=this;
  32905. return $core.withContext(function($ctx1) {
  32906. return $recv(self._binding())._alias();
  32907. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  32908. },
  32909. args: [],
  32910. source: "alias\x0a\x09^ self binding alias",
  32911. referencedClasses: [],
  32912. messageSends: ["alias", "binding"]
  32913. }),
  32914. $globals.VariableNode);
  32915. $core.addMethod(
  32916. $core.method({
  32917. selector: "assigned",
  32918. protocol: 'accessing',
  32919. fn: function (){
  32920. var self=this;
  32921. return $core.withContext(function($ctx1) {
  32922. var $1,$receiver;
  32923. $1=self["@assigned"];
  32924. if(($receiver = $1) == null || $receiver.isNil){
  32925. return false;
  32926. } else {
  32927. return $1;
  32928. };
  32929. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  32930. },
  32931. args: [],
  32932. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  32933. referencedClasses: [],
  32934. messageSends: ["ifNil:"]
  32935. }),
  32936. $globals.VariableNode);
  32937. $core.addMethod(
  32938. $core.method({
  32939. selector: "assigned:",
  32940. protocol: 'accessing',
  32941. fn: function (aBoolean){
  32942. var self=this;
  32943. self["@assigned"]=aBoolean;
  32944. return self;
  32945. },
  32946. args: ["aBoolean"],
  32947. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  32948. referencedClasses: [],
  32949. messageSends: []
  32950. }),
  32951. $globals.VariableNode);
  32952. $core.addMethod(
  32953. $core.method({
  32954. selector: "beAssigned",
  32955. protocol: 'accessing',
  32956. fn: function (){
  32957. var self=this;
  32958. return $core.withContext(function($ctx1) {
  32959. $recv(self._binding())._validateAssignment();
  32960. self["@assigned"]=true;
  32961. return self;
  32962. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  32963. },
  32964. args: [],
  32965. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  32966. referencedClasses: [],
  32967. messageSends: ["validateAssignment", "binding"]
  32968. }),
  32969. $globals.VariableNode);
  32970. $core.addMethod(
  32971. $core.method({
  32972. selector: "binding",
  32973. protocol: 'accessing',
  32974. fn: function (){
  32975. var self=this;
  32976. return self["@binding"];
  32977. },
  32978. args: [],
  32979. source: "binding\x0a\x09^ binding",
  32980. referencedClasses: [],
  32981. messageSends: []
  32982. }),
  32983. $globals.VariableNode);
  32984. $core.addMethod(
  32985. $core.method({
  32986. selector: "binding:",
  32987. protocol: 'accessing',
  32988. fn: function (aScopeVar){
  32989. var self=this;
  32990. self["@binding"]=aScopeVar;
  32991. return self;
  32992. },
  32993. args: ["aScopeVar"],
  32994. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  32995. referencedClasses: [],
  32996. messageSends: []
  32997. }),
  32998. $globals.VariableNode);
  32999. $core.addMethod(
  33000. $core.method({
  33001. selector: "isArgument",
  33002. protocol: 'testing',
  33003. fn: function (){
  33004. var self=this;
  33005. return $core.withContext(function($ctx1) {
  33006. return $recv(self._binding())._isArgVar();
  33007. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  33008. },
  33009. args: [],
  33010. source: "isArgument\x0a\x09^ self binding isArgVar",
  33011. referencedClasses: [],
  33012. messageSends: ["isArgVar", "binding"]
  33013. }),
  33014. $globals.VariableNode);
  33015. $core.addMethod(
  33016. $core.method({
  33017. selector: "isImmutable",
  33018. protocol: 'testing',
  33019. fn: function (){
  33020. var self=this;
  33021. return $core.withContext(function($ctx1) {
  33022. return $recv(self._binding())._isImmutable();
  33023. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  33024. },
  33025. args: [],
  33026. source: "isImmutable\x0a\x09^ self binding isImmutable",
  33027. referencedClasses: [],
  33028. messageSends: ["isImmutable", "binding"]
  33029. }),
  33030. $globals.VariableNode);
  33031. $core.addMethod(
  33032. $core.method({
  33033. selector: "isNavigationNode",
  33034. protocol: 'testing',
  33035. fn: function (){
  33036. var self=this;
  33037. return true;
  33038. },
  33039. args: [],
  33040. source: "isNavigationNode\x0a\x09^ true",
  33041. referencedClasses: [],
  33042. messageSends: []
  33043. }),
  33044. $globals.VariableNode);
  33045. $core.addMethod(
  33046. $core.method({
  33047. selector: "isVariableNode",
  33048. protocol: 'testing',
  33049. fn: function (){
  33050. var self=this;
  33051. return true;
  33052. },
  33053. args: [],
  33054. source: "isVariableNode\x0a\x09^ true",
  33055. referencedClasses: [],
  33056. messageSends: []
  33057. }),
  33058. $globals.VariableNode);
  33059. $core.addMethod(
  33060. $core.method({
  33061. selector: "navigationLink",
  33062. protocol: 'accessing',
  33063. fn: function (){
  33064. var self=this;
  33065. return $core.withContext(function($ctx1) {
  33066. return self._value();
  33067. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  33068. },
  33069. args: [],
  33070. source: "navigationLink\x0a\x09^ self value",
  33071. referencedClasses: [],
  33072. messageSends: ["value"]
  33073. }),
  33074. $globals.VariableNode);
  33075. $core.addClass('NodeVisitor', $globals.Object, [], 'Compiler-AST');
  33076. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  33077. $core.addMethod(
  33078. $core.method({
  33079. selector: "visit:",
  33080. protocol: 'visiting',
  33081. fn: function (aNode){
  33082. var self=this;
  33083. return $core.withContext(function($ctx1) {
  33084. return $recv(aNode)._accept_(self);
  33085. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.NodeVisitor)});
  33086. },
  33087. args: ["aNode"],
  33088. source: "visit: aNode\x0a\x09^ aNode accept: self",
  33089. referencedClasses: [],
  33090. messageSends: ["accept:"]
  33091. }),
  33092. $globals.NodeVisitor);
  33093. $core.addMethod(
  33094. $core.method({
  33095. selector: "visitAll:",
  33096. protocol: 'visiting',
  33097. fn: function (aCollection){
  33098. var self=this;
  33099. return $core.withContext(function($ctx1) {
  33100. return $recv(aCollection)._collect_((function(each){
  33101. return $core.withContext(function($ctx2) {
  33102. return self._visit_(each);
  33103. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33104. }));
  33105. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.NodeVisitor)});
  33106. },
  33107. args: ["aCollection"],
  33108. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  33109. referencedClasses: [],
  33110. messageSends: ["collect:", "visit:"]
  33111. }),
  33112. $globals.NodeVisitor);
  33113. $core.addMethod(
  33114. $core.method({
  33115. selector: "visitAssignmentNode:",
  33116. protocol: 'visiting',
  33117. fn: function (aNode){
  33118. var self=this;
  33119. return $core.withContext(function($ctx1) {
  33120. return self._visitNode_(aNode);
  33121. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  33122. },
  33123. args: ["aNode"],
  33124. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  33125. referencedClasses: [],
  33126. messageSends: ["visitNode:"]
  33127. }),
  33128. $globals.NodeVisitor);
  33129. $core.addMethod(
  33130. $core.method({
  33131. selector: "visitBlockNode:",
  33132. protocol: 'visiting',
  33133. fn: function (aNode){
  33134. var self=this;
  33135. return $core.withContext(function($ctx1) {
  33136. return self._visitNode_(aNode);
  33137. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  33138. },
  33139. args: ["aNode"],
  33140. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  33141. referencedClasses: [],
  33142. messageSends: ["visitNode:"]
  33143. }),
  33144. $globals.NodeVisitor);
  33145. $core.addMethod(
  33146. $core.method({
  33147. selector: "visitBlockSequenceNode:",
  33148. protocol: 'visiting',
  33149. fn: function (aNode){
  33150. var self=this;
  33151. return $core.withContext(function($ctx1) {
  33152. return self._visitSequenceNode_(aNode);
  33153. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  33154. },
  33155. args: ["aNode"],
  33156. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  33157. referencedClasses: [],
  33158. messageSends: ["visitSequenceNode:"]
  33159. }),
  33160. $globals.NodeVisitor);
  33161. $core.addMethod(
  33162. $core.method({
  33163. selector: "visitCascadeNode:",
  33164. protocol: 'visiting',
  33165. fn: function (aNode){
  33166. var self=this;
  33167. return $core.withContext(function($ctx1) {
  33168. return self._visitNode_(aNode);
  33169. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  33170. },
  33171. args: ["aNode"],
  33172. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  33173. referencedClasses: [],
  33174. messageSends: ["visitNode:"]
  33175. }),
  33176. $globals.NodeVisitor);
  33177. $core.addMethod(
  33178. $core.method({
  33179. selector: "visitDynamicArrayNode:",
  33180. protocol: 'visiting',
  33181. fn: function (aNode){
  33182. var self=this;
  33183. return $core.withContext(function($ctx1) {
  33184. return self._visitNode_(aNode);
  33185. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  33186. },
  33187. args: ["aNode"],
  33188. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  33189. referencedClasses: [],
  33190. messageSends: ["visitNode:"]
  33191. }),
  33192. $globals.NodeVisitor);
  33193. $core.addMethod(
  33194. $core.method({
  33195. selector: "visitDynamicDictionaryNode:",
  33196. protocol: 'visiting',
  33197. fn: function (aNode){
  33198. var self=this;
  33199. return $core.withContext(function($ctx1) {
  33200. return self._visitNode_(aNode);
  33201. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  33202. },
  33203. args: ["aNode"],
  33204. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  33205. referencedClasses: [],
  33206. messageSends: ["visitNode:"]
  33207. }),
  33208. $globals.NodeVisitor);
  33209. $core.addMethod(
  33210. $core.method({
  33211. selector: "visitJSStatementNode:",
  33212. protocol: 'visiting',
  33213. fn: function (aNode){
  33214. var self=this;
  33215. return $core.withContext(function($ctx1) {
  33216. return self._visitNode_(aNode);
  33217. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  33218. },
  33219. args: ["aNode"],
  33220. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  33221. referencedClasses: [],
  33222. messageSends: ["visitNode:"]
  33223. }),
  33224. $globals.NodeVisitor);
  33225. $core.addMethod(
  33226. $core.method({
  33227. selector: "visitMethodNode:",
  33228. protocol: 'visiting',
  33229. fn: function (aNode){
  33230. var self=this;
  33231. return $core.withContext(function($ctx1) {
  33232. return self._visitNode_(aNode);
  33233. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  33234. },
  33235. args: ["aNode"],
  33236. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  33237. referencedClasses: [],
  33238. messageSends: ["visitNode:"]
  33239. }),
  33240. $globals.NodeVisitor);
  33241. $core.addMethod(
  33242. $core.method({
  33243. selector: "visitNode:",
  33244. protocol: 'visiting',
  33245. fn: function (aNode){
  33246. var self=this;
  33247. return $core.withContext(function($ctx1) {
  33248. return self._visitAll_($recv(aNode)._nodes());
  33249. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.NodeVisitor)});
  33250. },
  33251. args: ["aNode"],
  33252. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  33253. referencedClasses: [],
  33254. messageSends: ["visitAll:", "nodes"]
  33255. }),
  33256. $globals.NodeVisitor);
  33257. $core.addMethod(
  33258. $core.method({
  33259. selector: "visitReturnNode:",
  33260. protocol: 'visiting',
  33261. fn: function (aNode){
  33262. var self=this;
  33263. return $core.withContext(function($ctx1) {
  33264. return self._visitNode_(aNode);
  33265. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  33266. },
  33267. args: ["aNode"],
  33268. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  33269. referencedClasses: [],
  33270. messageSends: ["visitNode:"]
  33271. }),
  33272. $globals.NodeVisitor);
  33273. $core.addMethod(
  33274. $core.method({
  33275. selector: "visitSendNode:",
  33276. protocol: 'visiting',
  33277. fn: function (aNode){
  33278. var self=this;
  33279. return $core.withContext(function($ctx1) {
  33280. return self._visitNode_(aNode);
  33281. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  33282. },
  33283. args: ["aNode"],
  33284. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  33285. referencedClasses: [],
  33286. messageSends: ["visitNode:"]
  33287. }),
  33288. $globals.NodeVisitor);
  33289. $core.addMethod(
  33290. $core.method({
  33291. selector: "visitSequenceNode:",
  33292. protocol: 'visiting',
  33293. fn: function (aNode){
  33294. var self=this;
  33295. return $core.withContext(function($ctx1) {
  33296. return self._visitNode_(aNode);
  33297. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  33298. },
  33299. args: ["aNode"],
  33300. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  33301. referencedClasses: [],
  33302. messageSends: ["visitNode:"]
  33303. }),
  33304. $globals.NodeVisitor);
  33305. $core.addMethod(
  33306. $core.method({
  33307. selector: "visitValueNode:",
  33308. protocol: 'visiting',
  33309. fn: function (aNode){
  33310. var self=this;
  33311. return $core.withContext(function($ctx1) {
  33312. return self._visitNode_(aNode);
  33313. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  33314. },
  33315. args: ["aNode"],
  33316. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  33317. referencedClasses: [],
  33318. messageSends: ["visitNode:"]
  33319. }),
  33320. $globals.NodeVisitor);
  33321. $core.addMethod(
  33322. $core.method({
  33323. selector: "visitVariableNode:",
  33324. protocol: 'visiting',
  33325. fn: function (aNode){
  33326. var self=this;
  33327. return $core.withContext(function($ctx1) {
  33328. return self._visitNode_(aNode);
  33329. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  33330. },
  33331. args: ["aNode"],
  33332. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  33333. referencedClasses: [],
  33334. messageSends: ["visitNode:"]
  33335. }),
  33336. $globals.NodeVisitor);
  33337. $core.addMethod(
  33338. $core.method({
  33339. selector: "ast",
  33340. protocol: '*Compiler-AST',
  33341. fn: function (){
  33342. var self=this;
  33343. return $core.withContext(function($ctx1) {
  33344. var $1;
  33345. $1=self._source();
  33346. $ctx1.sendIdx["source"]=1;
  33347. $recv($1)._ifEmpty_((function(){
  33348. return $core.withContext(function($ctx2) {
  33349. return self._error_("Method source is empty");
  33350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33351. }));
  33352. return $recv($globals.Smalltalk)._parse_(self._source());
  33353. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  33354. },
  33355. args: [],
  33356. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  33357. referencedClasses: ["Smalltalk"],
  33358. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  33359. }),
  33360. $globals.CompiledMethod);
  33361. $core.addMethod(
  33362. $core.method({
  33363. selector: "isNode",
  33364. protocol: '*Compiler-AST',
  33365. fn: function (){
  33366. var self=this;
  33367. return false;
  33368. },
  33369. args: [],
  33370. source: "isNode\x0a\x09^ false",
  33371. referencedClasses: [],
  33372. messageSends: []
  33373. }),
  33374. $globals.Object);
  33375. });
  33376. define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-AST", "amber_core/Compiler-Core"], function($boot){"use strict";
  33377. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  33378. $core.addPackage('Compiler-Semantic');
  33379. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  33380. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33381. $core.addClass('LexicalScope', $globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  33382. $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.";
  33383. $core.addMethod(
  33384. $core.method({
  33385. selector: "addArg:",
  33386. protocol: 'adding',
  33387. fn: function (aString){
  33388. var self=this;
  33389. return $core.withContext(function($ctx1) {
  33390. var $1;
  33391. $1=self._args();
  33392. $ctx1.sendIdx["args"]=1;
  33393. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  33394. $recv($recv(self._args())._at_(aString))._scope_(self);
  33395. return self;
  33396. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  33397. },
  33398. args: ["aString"],
  33399. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  33400. referencedClasses: ["ArgVar"],
  33401. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  33402. }),
  33403. $globals.LexicalScope);
  33404. $core.addMethod(
  33405. $core.method({
  33406. selector: "addTemp:",
  33407. protocol: 'adding',
  33408. fn: function (aString){
  33409. var self=this;
  33410. return $core.withContext(function($ctx1) {
  33411. var $1;
  33412. $1=self._temps();
  33413. $ctx1.sendIdx["temps"]=1;
  33414. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  33415. $recv($recv(self._temps())._at_(aString))._scope_(self);
  33416. return self;
  33417. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  33418. },
  33419. args: ["aString"],
  33420. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  33421. referencedClasses: ["TempVar"],
  33422. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  33423. }),
  33424. $globals.LexicalScope);
  33425. $core.addMethod(
  33426. $core.method({
  33427. selector: "alias",
  33428. protocol: 'accessing',
  33429. fn: function (){
  33430. var self=this;
  33431. return $core.withContext(function($ctx1) {
  33432. return "$ctx".__comma($recv(self._scopeLevel())._asString());
  33433. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  33434. },
  33435. args: [],
  33436. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  33437. referencedClasses: [],
  33438. messageSends: [",", "asString", "scopeLevel"]
  33439. }),
  33440. $globals.LexicalScope);
  33441. $core.addMethod(
  33442. $core.method({
  33443. selector: "allVariableNames",
  33444. protocol: 'accessing',
  33445. fn: function (){
  33446. var self=this;
  33447. return $core.withContext(function($ctx1) {
  33448. var $1;
  33449. $1=$recv(self._args())._keys();
  33450. $ctx1.sendIdx["keys"]=1;
  33451. return $recv($1).__comma($recv(self._temps())._keys());
  33452. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  33453. },
  33454. args: [],
  33455. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  33456. referencedClasses: [],
  33457. messageSends: [",", "keys", "args", "temps"]
  33458. }),
  33459. $globals.LexicalScope);
  33460. $core.addMethod(
  33461. $core.method({
  33462. selector: "args",
  33463. protocol: 'accessing',
  33464. fn: function (){
  33465. var self=this;
  33466. return $core.withContext(function($ctx1) {
  33467. var $1,$receiver;
  33468. $1=self["@args"];
  33469. if(($receiver = $1) == null || $receiver.isNil){
  33470. self["@args"]=$recv($globals.Dictionary)._new();
  33471. return self["@args"];
  33472. } else {
  33473. return $1;
  33474. };
  33475. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  33476. },
  33477. args: [],
  33478. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  33479. referencedClasses: ["Dictionary"],
  33480. messageSends: ["ifNil:", "new"]
  33481. }),
  33482. $globals.LexicalScope);
  33483. $core.addMethod(
  33484. $core.method({
  33485. selector: "bindingFor:",
  33486. protocol: 'accessing',
  33487. fn: function (aStringOrNode){
  33488. var self=this;
  33489. return $core.withContext(function($ctx1) {
  33490. var $2,$3,$4,$5,$1;
  33491. $2=self._pseudoVars();
  33492. $3=$recv(aStringOrNode)._value();
  33493. $ctx1.sendIdx["value"]=1;
  33494. $1=$recv($2)._at_ifAbsent_($3,(function(){
  33495. return $core.withContext(function($ctx2) {
  33496. $4=self._args();
  33497. $5=$recv(aStringOrNode)._value();
  33498. $ctx2.sendIdx["value"]=2;
  33499. return $recv($4)._at_ifAbsent_($5,(function(){
  33500. return $core.withContext(function($ctx3) {
  33501. return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  33502. return nil;
  33503. }));
  33504. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33505. }));
  33506. $ctx2.sendIdx["at:ifAbsent:"]=2;
  33507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33508. }));
  33509. $ctx1.sendIdx["at:ifAbsent:"]=1;
  33510. return $1;
  33511. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  33512. },
  33513. args: ["aStringOrNode"],
  33514. 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 ]]]",
  33515. referencedClasses: [],
  33516. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  33517. }),
  33518. $globals.LexicalScope);
  33519. $core.addMethod(
  33520. $core.method({
  33521. selector: "blockIndex",
  33522. protocol: 'accessing',
  33523. fn: function (){
  33524. var self=this;
  33525. return $core.withContext(function($ctx1) {
  33526. var $1,$receiver;
  33527. $1=self["@blockIndex"];
  33528. if(($receiver = $1) == null || $receiver.isNil){
  33529. return (0);
  33530. } else {
  33531. return $1;
  33532. };
  33533. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  33534. },
  33535. args: [],
  33536. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  33537. referencedClasses: [],
  33538. messageSends: ["ifNil:"]
  33539. }),
  33540. $globals.LexicalScope);
  33541. $core.addMethod(
  33542. $core.method({
  33543. selector: "blockIndex:",
  33544. protocol: 'accessing',
  33545. fn: function (anInteger){
  33546. var self=this;
  33547. self["@blockIndex"]=anInteger;
  33548. return self;
  33549. },
  33550. args: ["anInteger"],
  33551. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  33552. referencedClasses: [],
  33553. messageSends: []
  33554. }),
  33555. $globals.LexicalScope);
  33556. $core.addMethod(
  33557. $core.method({
  33558. selector: "canInlineNonLocalReturns",
  33559. protocol: 'testing',
  33560. fn: function (){
  33561. var self=this;
  33562. return $core.withContext(function($ctx1) {
  33563. return $recv(self._isInlined())._and_((function(){
  33564. return $core.withContext(function($ctx2) {
  33565. return $recv(self._outerScope())._canInlineNonLocalReturns();
  33566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33567. }));
  33568. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  33569. },
  33570. args: [],
  33571. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  33572. referencedClasses: [],
  33573. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  33574. }),
  33575. $globals.LexicalScope);
  33576. $core.addMethod(
  33577. $core.method({
  33578. selector: "instruction",
  33579. protocol: 'accessing',
  33580. fn: function (){
  33581. var self=this;
  33582. return self["@instruction"];
  33583. },
  33584. args: [],
  33585. source: "instruction\x0a\x09^ instruction",
  33586. referencedClasses: [],
  33587. messageSends: []
  33588. }),
  33589. $globals.LexicalScope);
  33590. $core.addMethod(
  33591. $core.method({
  33592. selector: "instruction:",
  33593. protocol: 'accessing',
  33594. fn: function (anIRInstruction){
  33595. var self=this;
  33596. self["@instruction"]=anIRInstruction;
  33597. return self;
  33598. },
  33599. args: ["anIRInstruction"],
  33600. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  33601. referencedClasses: [],
  33602. messageSends: []
  33603. }),
  33604. $globals.LexicalScope);
  33605. $core.addMethod(
  33606. $core.method({
  33607. selector: "isBlockScope",
  33608. protocol: 'testing',
  33609. fn: function (){
  33610. var self=this;
  33611. return $core.withContext(function($ctx1) {
  33612. return $recv(self._isMethodScope())._not();
  33613. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  33614. },
  33615. args: [],
  33616. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  33617. referencedClasses: [],
  33618. messageSends: ["not", "isMethodScope"]
  33619. }),
  33620. $globals.LexicalScope);
  33621. $core.addMethod(
  33622. $core.method({
  33623. selector: "isInlined",
  33624. protocol: 'testing',
  33625. fn: function (){
  33626. var self=this;
  33627. return $core.withContext(function($ctx1) {
  33628. var $2,$1;
  33629. $2=self._instruction();
  33630. $ctx1.sendIdx["instruction"]=1;
  33631. $1=$recv($2)._notNil();
  33632. return $recv($1)._and_((function(){
  33633. return $core.withContext(function($ctx2) {
  33634. return $recv(self._instruction())._isInlined();
  33635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33636. }));
  33637. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  33638. },
  33639. args: [],
  33640. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  33641. referencedClasses: [],
  33642. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  33643. }),
  33644. $globals.LexicalScope);
  33645. $core.addMethod(
  33646. $core.method({
  33647. selector: "isMethodScope",
  33648. protocol: 'testing',
  33649. fn: function (){
  33650. var self=this;
  33651. return false;
  33652. },
  33653. args: [],
  33654. source: "isMethodScope\x0a\x09^ false",
  33655. referencedClasses: [],
  33656. messageSends: []
  33657. }),
  33658. $globals.LexicalScope);
  33659. $core.addMethod(
  33660. $core.method({
  33661. selector: "lookupVariable:",
  33662. protocol: 'accessing',
  33663. fn: function (aNode){
  33664. var self=this;
  33665. var lookup;
  33666. return $core.withContext(function($ctx1) {
  33667. var $1,$2,$receiver;
  33668. lookup=self._bindingFor_(aNode);
  33669. $1=lookup;
  33670. if(($receiver = $1) == null || $receiver.isNil){
  33671. $2=self._outerScope();
  33672. $ctx1.sendIdx["outerScope"]=1;
  33673. if(($receiver = $2) == null || $receiver.isNil){
  33674. lookup=$2;
  33675. } else {
  33676. lookup=$recv(self._outerScope())._lookupVariable_(aNode);
  33677. };
  33678. lookup;
  33679. } else {
  33680. $1;
  33681. };
  33682. return lookup;
  33683. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  33684. },
  33685. args: ["aNode"],
  33686. 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",
  33687. referencedClasses: [],
  33688. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  33689. }),
  33690. $globals.LexicalScope);
  33691. $core.addMethod(
  33692. $core.method({
  33693. selector: "methodScope",
  33694. protocol: 'accessing',
  33695. fn: function (){
  33696. var self=this;
  33697. return $core.withContext(function($ctx1) {
  33698. var $1,$receiver;
  33699. $1=self._outerScope();
  33700. $ctx1.sendIdx["outerScope"]=1;
  33701. if(($receiver = $1) == null || $receiver.isNil){
  33702. return $1;
  33703. } else {
  33704. return $recv(self._outerScope())._methodScope();
  33705. };
  33706. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  33707. },
  33708. args: [],
  33709. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  33710. referencedClasses: [],
  33711. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  33712. }),
  33713. $globals.LexicalScope);
  33714. $core.addMethod(
  33715. $core.method({
  33716. selector: "node",
  33717. protocol: 'accessing',
  33718. fn: function (){
  33719. var self=this;
  33720. return self["@node"];
  33721. },
  33722. args: [],
  33723. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  33724. referencedClasses: [],
  33725. messageSends: []
  33726. }),
  33727. $globals.LexicalScope);
  33728. $core.addMethod(
  33729. $core.method({
  33730. selector: "node:",
  33731. protocol: 'accessing',
  33732. fn: function (aNode){
  33733. var self=this;
  33734. self["@node"]=aNode;
  33735. return self;
  33736. },
  33737. args: ["aNode"],
  33738. source: "node: aNode\x0a\x09node := aNode",
  33739. referencedClasses: [],
  33740. messageSends: []
  33741. }),
  33742. $globals.LexicalScope);
  33743. $core.addMethod(
  33744. $core.method({
  33745. selector: "outerScope",
  33746. protocol: 'accessing',
  33747. fn: function (){
  33748. var self=this;
  33749. return self["@outerScope"];
  33750. },
  33751. args: [],
  33752. source: "outerScope\x0a\x09^ outerScope",
  33753. referencedClasses: [],
  33754. messageSends: []
  33755. }),
  33756. $globals.LexicalScope);
  33757. $core.addMethod(
  33758. $core.method({
  33759. selector: "outerScope:",
  33760. protocol: 'accessing',
  33761. fn: function (aLexicalScope){
  33762. var self=this;
  33763. self["@outerScope"]=aLexicalScope;
  33764. return self;
  33765. },
  33766. args: ["aLexicalScope"],
  33767. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  33768. referencedClasses: [],
  33769. messageSends: []
  33770. }),
  33771. $globals.LexicalScope);
  33772. $core.addMethod(
  33773. $core.method({
  33774. selector: "pseudoVars",
  33775. protocol: 'accessing',
  33776. fn: function (){
  33777. var self=this;
  33778. return $core.withContext(function($ctx1) {
  33779. return $recv(self._methodScope())._pseudoVars();
  33780. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  33781. },
  33782. args: [],
  33783. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  33784. referencedClasses: [],
  33785. messageSends: ["pseudoVars", "methodScope"]
  33786. }),
  33787. $globals.LexicalScope);
  33788. $core.addMethod(
  33789. $core.method({
  33790. selector: "scopeLevel",
  33791. protocol: 'accessing',
  33792. fn: function (){
  33793. var self=this;
  33794. return $core.withContext(function($ctx1) {
  33795. var $1,$2,$4,$3,$receiver;
  33796. $1=self._outerScope();
  33797. $ctx1.sendIdx["outerScope"]=1;
  33798. if(($receiver = $1) == null || $receiver.isNil){
  33799. return (1);
  33800. } else {
  33801. $1;
  33802. };
  33803. $2=self._isInlined();
  33804. if($core.assert($2)){
  33805. $4=self._outerScope();
  33806. $ctx1.sendIdx["outerScope"]=2;
  33807. $3=$recv($4)._scopeLevel();
  33808. $ctx1.sendIdx["scopeLevel"]=1;
  33809. return $3;
  33810. };
  33811. return $recv($recv(self._outerScope())._scopeLevel()).__plus((1));
  33812. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  33813. },
  33814. args: [],
  33815. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  33816. referencedClasses: [],
  33817. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  33818. }),
  33819. $globals.LexicalScope);
  33820. $core.addMethod(
  33821. $core.method({
  33822. selector: "temps",
  33823. protocol: 'accessing',
  33824. fn: function (){
  33825. var self=this;
  33826. return $core.withContext(function($ctx1) {
  33827. var $1,$receiver;
  33828. $1=self["@temps"];
  33829. if(($receiver = $1) == null || $receiver.isNil){
  33830. self["@temps"]=$recv($globals.Dictionary)._new();
  33831. return self["@temps"];
  33832. } else {
  33833. return $1;
  33834. };
  33835. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  33836. },
  33837. args: [],
  33838. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  33839. referencedClasses: ["Dictionary"],
  33840. messageSends: ["ifNil:", "new"]
  33841. }),
  33842. $globals.LexicalScope);
  33843. $core.addClass('MethodLexicalScope', $globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  33844. $globals.MethodLexicalScope.comment="I represent a method scope.";
  33845. $core.addMethod(
  33846. $core.method({
  33847. selector: "addIVar:",
  33848. protocol: 'adding',
  33849. fn: function (aString){
  33850. var self=this;
  33851. return $core.withContext(function($ctx1) {
  33852. var $1;
  33853. $1=self._iVars();
  33854. $ctx1.sendIdx["iVars"]=1;
  33855. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  33856. $recv($recv(self._iVars())._at_(aString))._scope_(self);
  33857. return self;
  33858. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  33859. },
  33860. args: ["aString"],
  33861. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  33862. referencedClasses: ["InstanceVar"],
  33863. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  33864. }),
  33865. $globals.MethodLexicalScope);
  33866. $core.addMethod(
  33867. $core.method({
  33868. selector: "addNonLocalReturn:",
  33869. protocol: 'adding',
  33870. fn: function (aScope){
  33871. var self=this;
  33872. return $core.withContext(function($ctx1) {
  33873. $recv(self._nonLocalReturns())._add_(aScope);
  33874. return self;
  33875. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  33876. },
  33877. args: ["aScope"],
  33878. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  33879. referencedClasses: [],
  33880. messageSends: ["add:", "nonLocalReturns"]
  33881. }),
  33882. $globals.MethodLexicalScope);
  33883. $core.addMethod(
  33884. $core.method({
  33885. selector: "allVariableNames",
  33886. protocol: 'accessing',
  33887. fn: function (){
  33888. var self=this;
  33889. return $core.withContext(function($ctx1) {
  33890. var $1;
  33891. $1=(
  33892. $ctx1.supercall = true,
  33893. ($globals.MethodLexicalScope.superclass||$boot.dnu).fn.prototype._allVariableNames.apply($recv(self), []));
  33894. $ctx1.supercall = false;
  33895. return $recv($1).__comma($recv(self._iVars())._keys());
  33896. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  33897. },
  33898. args: [],
  33899. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  33900. referencedClasses: [],
  33901. messageSends: [",", "allVariableNames", "keys", "iVars"]
  33902. }),
  33903. $globals.MethodLexicalScope);
  33904. $core.addMethod(
  33905. $core.method({
  33906. selector: "bindingFor:",
  33907. protocol: 'accessing',
  33908. fn: function (aNode){
  33909. var self=this;
  33910. return $core.withContext(function($ctx1) {
  33911. var $1,$receiver;
  33912. $1=(
  33913. $ctx1.supercall = true,
  33914. ($globals.MethodLexicalScope.superclass||$boot.dnu).fn.prototype._bindingFor_.apply($recv(self), [aNode]));
  33915. $ctx1.supercall = false;
  33916. if(($receiver = $1) == null || $receiver.isNil){
  33917. return $recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  33918. return nil;
  33919. }));
  33920. } else {
  33921. return $1;
  33922. };
  33923. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  33924. },
  33925. args: ["aNode"],
  33926. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  33927. referencedClasses: [],
  33928. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  33929. }),
  33930. $globals.MethodLexicalScope);
  33931. $core.addMethod(
  33932. $core.method({
  33933. selector: "canInlineNonLocalReturns",
  33934. protocol: 'testing',
  33935. fn: function (){
  33936. var self=this;
  33937. return true;
  33938. },
  33939. args: [],
  33940. source: "canInlineNonLocalReturns\x0a\x09^ true",
  33941. referencedClasses: [],
  33942. messageSends: []
  33943. }),
  33944. $globals.MethodLexicalScope);
  33945. $core.addMethod(
  33946. $core.method({
  33947. selector: "hasLocalReturn",
  33948. protocol: 'testing',
  33949. fn: function (){
  33950. var self=this;
  33951. return $core.withContext(function($ctx1) {
  33952. return self._localReturn();
  33953. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  33954. },
  33955. args: [],
  33956. source: "hasLocalReturn\x0a\x09^ self localReturn",
  33957. referencedClasses: [],
  33958. messageSends: ["localReturn"]
  33959. }),
  33960. $globals.MethodLexicalScope);
  33961. $core.addMethod(
  33962. $core.method({
  33963. selector: "hasNonLocalReturn",
  33964. protocol: 'testing',
  33965. fn: function (){
  33966. var self=this;
  33967. return $core.withContext(function($ctx1) {
  33968. return $recv(self._nonLocalReturns())._notEmpty();
  33969. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  33970. },
  33971. args: [],
  33972. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  33973. referencedClasses: [],
  33974. messageSends: ["notEmpty", "nonLocalReturns"]
  33975. }),
  33976. $globals.MethodLexicalScope);
  33977. $core.addMethod(
  33978. $core.method({
  33979. selector: "iVars",
  33980. protocol: 'accessing',
  33981. fn: function (){
  33982. var self=this;
  33983. return $core.withContext(function($ctx1) {
  33984. var $1,$receiver;
  33985. $1=self["@iVars"];
  33986. if(($receiver = $1) == null || $receiver.isNil){
  33987. self["@iVars"]=$recv($globals.Dictionary)._new();
  33988. return self["@iVars"];
  33989. } else {
  33990. return $1;
  33991. };
  33992. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  33993. },
  33994. args: [],
  33995. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  33996. referencedClasses: ["Dictionary"],
  33997. messageSends: ["ifNil:", "new"]
  33998. }),
  33999. $globals.MethodLexicalScope);
  34000. $core.addMethod(
  34001. $core.method({
  34002. selector: "isMethodScope",
  34003. protocol: 'testing',
  34004. fn: function (){
  34005. var self=this;
  34006. return true;
  34007. },
  34008. args: [],
  34009. source: "isMethodScope\x0a\x09^ true",
  34010. referencedClasses: [],
  34011. messageSends: []
  34012. }),
  34013. $globals.MethodLexicalScope);
  34014. $core.addMethod(
  34015. $core.method({
  34016. selector: "localReturn",
  34017. protocol: 'accessing',
  34018. fn: function (){
  34019. var self=this;
  34020. return $core.withContext(function($ctx1) {
  34021. var $1,$receiver;
  34022. $1=self["@localReturn"];
  34023. if(($receiver = $1) == null || $receiver.isNil){
  34024. return false;
  34025. } else {
  34026. return $1;
  34027. };
  34028. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  34029. },
  34030. args: [],
  34031. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  34032. referencedClasses: [],
  34033. messageSends: ["ifNil:"]
  34034. }),
  34035. $globals.MethodLexicalScope);
  34036. $core.addMethod(
  34037. $core.method({
  34038. selector: "localReturn:",
  34039. protocol: 'accessing',
  34040. fn: function (aBoolean){
  34041. var self=this;
  34042. self["@localReturn"]=aBoolean;
  34043. return self;
  34044. },
  34045. args: ["aBoolean"],
  34046. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  34047. referencedClasses: [],
  34048. messageSends: []
  34049. }),
  34050. $globals.MethodLexicalScope);
  34051. $core.addMethod(
  34052. $core.method({
  34053. selector: "methodScope",
  34054. protocol: 'accessing',
  34055. fn: function (){
  34056. var self=this;
  34057. return self;
  34058. },
  34059. args: [],
  34060. source: "methodScope\x0a\x09^ self",
  34061. referencedClasses: [],
  34062. messageSends: []
  34063. }),
  34064. $globals.MethodLexicalScope);
  34065. $core.addMethod(
  34066. $core.method({
  34067. selector: "nonLocalReturns",
  34068. protocol: 'accessing',
  34069. fn: function (){
  34070. var self=this;
  34071. return $core.withContext(function($ctx1) {
  34072. var $1,$receiver;
  34073. $1=self["@nonLocalReturns"];
  34074. if(($receiver = $1) == null || $receiver.isNil){
  34075. self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  34076. return self["@nonLocalReturns"];
  34077. } else {
  34078. return $1;
  34079. };
  34080. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  34081. },
  34082. args: [],
  34083. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  34084. referencedClasses: ["OrderedCollection"],
  34085. messageSends: ["ifNil:", "new"]
  34086. }),
  34087. $globals.MethodLexicalScope);
  34088. $core.addMethod(
  34089. $core.method({
  34090. selector: "pseudoVars",
  34091. protocol: 'accessing',
  34092. fn: function (){
  34093. var self=this;
  34094. return $core.withContext(function($ctx1) {
  34095. var $1,$2,$4,$3,$receiver;
  34096. $1=self["@pseudoVars"];
  34097. if(($receiver = $1) == null || $receiver.isNil){
  34098. self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  34099. self["@pseudoVars"];
  34100. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  34101. return $core.withContext(function($ctx2) {
  34102. $2=self["@pseudoVars"];
  34103. $4=$recv($globals.PseudoVar)._on_(each);
  34104. $recv($4)._scope_(self._methodScope());
  34105. $3=$recv($4)._yourself();
  34106. return $recv($2)._at_put_(each,$3);
  34107. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  34108. }));
  34109. } else {
  34110. $1;
  34111. };
  34112. return self["@pseudoVars"];
  34113. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  34114. },
  34115. args: [],
  34116. 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",
  34117. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  34118. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  34119. }),
  34120. $globals.MethodLexicalScope);
  34121. $core.addMethod(
  34122. $core.method({
  34123. selector: "removeNonLocalReturn:",
  34124. protocol: 'adding',
  34125. fn: function (aScope){
  34126. var self=this;
  34127. return $core.withContext(function($ctx1) {
  34128. $recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  34129. }));
  34130. return self;
  34131. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  34132. },
  34133. args: ["aScope"],
  34134. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  34135. referencedClasses: [],
  34136. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  34137. }),
  34138. $globals.MethodLexicalScope);
  34139. $core.addMethod(
  34140. $core.method({
  34141. selector: "unknownVariables",
  34142. protocol: 'accessing',
  34143. fn: function (){
  34144. var self=this;
  34145. return $core.withContext(function($ctx1) {
  34146. var $1,$receiver;
  34147. $1=self["@unknownVariables"];
  34148. if(($receiver = $1) == null || $receiver.isNil){
  34149. self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  34150. return self["@unknownVariables"];
  34151. } else {
  34152. return $1;
  34153. };
  34154. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  34155. },
  34156. args: [],
  34157. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  34158. referencedClasses: ["OrderedCollection"],
  34159. messageSends: ["ifNil:", "new"]
  34160. }),
  34161. $globals.MethodLexicalScope);
  34162. $core.addClass('ScopeVar', $globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  34163. $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.";
  34164. $core.addMethod(
  34165. $core.method({
  34166. selector: "alias",
  34167. protocol: 'accessing',
  34168. fn: function (){
  34169. var self=this;
  34170. return $core.withContext(function($ctx1) {
  34171. return $recv(self._name())._asVariableName();
  34172. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  34173. },
  34174. args: [],
  34175. source: "alias\x0a\x09^ self name asVariableName",
  34176. referencedClasses: [],
  34177. messageSends: ["asVariableName", "name"]
  34178. }),
  34179. $globals.ScopeVar);
  34180. $core.addMethod(
  34181. $core.method({
  34182. selector: "isArgVar",
  34183. protocol: 'testing',
  34184. fn: function (){
  34185. var self=this;
  34186. return false;
  34187. },
  34188. args: [],
  34189. source: "isArgVar\x0a\x09^ false",
  34190. referencedClasses: [],
  34191. messageSends: []
  34192. }),
  34193. $globals.ScopeVar);
  34194. $core.addMethod(
  34195. $core.method({
  34196. selector: "isClassRefVar",
  34197. protocol: 'testing',
  34198. fn: function (){
  34199. var self=this;
  34200. return false;
  34201. },
  34202. args: [],
  34203. source: "isClassRefVar\x0a\x09^ false",
  34204. referencedClasses: [],
  34205. messageSends: []
  34206. }),
  34207. $globals.ScopeVar);
  34208. $core.addMethod(
  34209. $core.method({
  34210. selector: "isImmutable",
  34211. protocol: 'testing',
  34212. fn: function (){
  34213. var self=this;
  34214. return false;
  34215. },
  34216. args: [],
  34217. source: "isImmutable\x0a\x09^ false",
  34218. referencedClasses: [],
  34219. messageSends: []
  34220. }),
  34221. $globals.ScopeVar);
  34222. $core.addMethod(
  34223. $core.method({
  34224. selector: "isInstanceVar",
  34225. protocol: 'testing',
  34226. fn: function (){
  34227. var self=this;
  34228. return false;
  34229. },
  34230. args: [],
  34231. source: "isInstanceVar\x0a\x09^ false",
  34232. referencedClasses: [],
  34233. messageSends: []
  34234. }),
  34235. $globals.ScopeVar);
  34236. $core.addMethod(
  34237. $core.method({
  34238. selector: "isPseudoVar",
  34239. protocol: 'testing',
  34240. fn: function (){
  34241. var self=this;
  34242. return false;
  34243. },
  34244. args: [],
  34245. source: "isPseudoVar\x0a\x09^ false",
  34246. referencedClasses: [],
  34247. messageSends: []
  34248. }),
  34249. $globals.ScopeVar);
  34250. $core.addMethod(
  34251. $core.method({
  34252. selector: "isTempVar",
  34253. protocol: 'testing',
  34254. fn: function (){
  34255. var self=this;
  34256. return false;
  34257. },
  34258. args: [],
  34259. source: "isTempVar\x0a\x09^ false",
  34260. referencedClasses: [],
  34261. messageSends: []
  34262. }),
  34263. $globals.ScopeVar);
  34264. $core.addMethod(
  34265. $core.method({
  34266. selector: "isUnknownVar",
  34267. protocol: 'testing',
  34268. fn: function (){
  34269. var self=this;
  34270. return false;
  34271. },
  34272. args: [],
  34273. source: "isUnknownVar\x0a\x09^ false",
  34274. referencedClasses: [],
  34275. messageSends: []
  34276. }),
  34277. $globals.ScopeVar);
  34278. $core.addMethod(
  34279. $core.method({
  34280. selector: "name",
  34281. protocol: 'accessing',
  34282. fn: function (){
  34283. var self=this;
  34284. return self["@name"];
  34285. },
  34286. args: [],
  34287. source: "name\x0a\x09^ name",
  34288. referencedClasses: [],
  34289. messageSends: []
  34290. }),
  34291. $globals.ScopeVar);
  34292. $core.addMethod(
  34293. $core.method({
  34294. selector: "name:",
  34295. protocol: 'accessing',
  34296. fn: function (aString){
  34297. var self=this;
  34298. self["@name"]=aString;
  34299. return self;
  34300. },
  34301. args: ["aString"],
  34302. source: "name: aString\x0a\x09name := aString",
  34303. referencedClasses: [],
  34304. messageSends: []
  34305. }),
  34306. $globals.ScopeVar);
  34307. $core.addMethod(
  34308. $core.method({
  34309. selector: "scope",
  34310. protocol: 'accessing',
  34311. fn: function (){
  34312. var self=this;
  34313. return self["@scope"];
  34314. },
  34315. args: [],
  34316. source: "scope\x0a\x09^ scope",
  34317. referencedClasses: [],
  34318. messageSends: []
  34319. }),
  34320. $globals.ScopeVar);
  34321. $core.addMethod(
  34322. $core.method({
  34323. selector: "scope:",
  34324. protocol: 'accessing',
  34325. fn: function (aScope){
  34326. var self=this;
  34327. self["@scope"]=aScope;
  34328. return self;
  34329. },
  34330. args: ["aScope"],
  34331. source: "scope: aScope\x0a\x09scope := aScope",
  34332. referencedClasses: [],
  34333. messageSends: []
  34334. }),
  34335. $globals.ScopeVar);
  34336. $core.addMethod(
  34337. $core.method({
  34338. selector: "validateAssignment",
  34339. protocol: 'testing',
  34340. fn: function (){
  34341. var self=this;
  34342. return $core.withContext(function($ctx1) {
  34343. var $1,$2;
  34344. $1=$recv(self._isArgVar())._or_((function(){
  34345. return $core.withContext(function($ctx2) {
  34346. return self._isPseudoVar();
  34347. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34348. }));
  34349. if($core.assert($1)){
  34350. $2=$recv($globals.InvalidAssignmentError)._new();
  34351. $recv($2)._variableName_(self._name());
  34352. $recv($2)._signal();
  34353. };
  34354. return self;
  34355. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  34356. },
  34357. args: [],
  34358. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  34359. referencedClasses: ["InvalidAssignmentError"],
  34360. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  34361. }),
  34362. $globals.ScopeVar);
  34363. $core.addMethod(
  34364. $core.method({
  34365. selector: "on:",
  34366. protocol: 'instance creation',
  34367. fn: function (aString){
  34368. var self=this;
  34369. return $core.withContext(function($ctx1) {
  34370. var $1;
  34371. $1=self._new();
  34372. $recv($1)._name_(aString);
  34373. return $recv($1)._yourself();
  34374. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)});
  34375. },
  34376. args: ["aString"],
  34377. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  34378. referencedClasses: [],
  34379. messageSends: ["name:", "new", "yourself"]
  34380. }),
  34381. $globals.ScopeVar.klass);
  34382. $core.addClass('AliasVar', $globals.ScopeVar, ['node'], 'Compiler-Semantic');
  34383. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  34384. $core.addMethod(
  34385. $core.method({
  34386. selector: "isImmutable",
  34387. protocol: 'testing',
  34388. fn: function (){
  34389. var self=this;
  34390. return true;
  34391. },
  34392. args: [],
  34393. source: "isImmutable\x0a\x09^ true",
  34394. referencedClasses: [],
  34395. messageSends: []
  34396. }),
  34397. $globals.AliasVar);
  34398. $core.addMethod(
  34399. $core.method({
  34400. selector: "node",
  34401. protocol: 'accessing',
  34402. fn: function (){
  34403. var self=this;
  34404. return self["@node"];
  34405. },
  34406. args: [],
  34407. source: "node\x0a\x09^ node",
  34408. referencedClasses: [],
  34409. messageSends: []
  34410. }),
  34411. $globals.AliasVar);
  34412. $core.addMethod(
  34413. $core.method({
  34414. selector: "node:",
  34415. protocol: 'accessing',
  34416. fn: function (aNode){
  34417. var self=this;
  34418. self["@node"]=aNode;
  34419. return self;
  34420. },
  34421. args: ["aNode"],
  34422. source: "node: aNode\x0a\x09node := aNode",
  34423. referencedClasses: [],
  34424. messageSends: []
  34425. }),
  34426. $globals.AliasVar);
  34427. $core.addClass('ArgVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34428. $globals.ArgVar.comment="I am an argument of a method or block.";
  34429. $core.addMethod(
  34430. $core.method({
  34431. selector: "isArgVar",
  34432. protocol: 'testing',
  34433. fn: function (){
  34434. var self=this;
  34435. return true;
  34436. },
  34437. args: [],
  34438. source: "isArgVar\x0a\x09^ true",
  34439. referencedClasses: [],
  34440. messageSends: []
  34441. }),
  34442. $globals.ArgVar);
  34443. $core.addMethod(
  34444. $core.method({
  34445. selector: "isImmutable",
  34446. protocol: 'testing',
  34447. fn: function (){
  34448. var self=this;
  34449. return true;
  34450. },
  34451. args: [],
  34452. source: "isImmutable\x0a\x09^ true",
  34453. referencedClasses: [],
  34454. messageSends: []
  34455. }),
  34456. $globals.ArgVar);
  34457. $core.addClass('ClassRefVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34458. $globals.ClassRefVar.comment="I am an class reference variable";
  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 "$globals.".__comma(self._name());
  34467. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  34468. },
  34469. args: [],
  34470. 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",
  34471. referencedClasses: [],
  34472. messageSends: [",", "name"]
  34473. }),
  34474. $globals.ClassRefVar);
  34475. $core.addMethod(
  34476. $core.method({
  34477. selector: "isClassRefVar",
  34478. protocol: 'testing',
  34479. fn: function (){
  34480. var self=this;
  34481. return true;
  34482. },
  34483. args: [],
  34484. source: "isClassRefVar\x0a\x09^ true",
  34485. referencedClasses: [],
  34486. messageSends: []
  34487. }),
  34488. $globals.ClassRefVar);
  34489. $core.addMethod(
  34490. $core.method({
  34491. selector: "isImmutable",
  34492. protocol: 'testing',
  34493. fn: function (){
  34494. var self=this;
  34495. return true;
  34496. },
  34497. args: [],
  34498. source: "isImmutable\x0a\x09^ true",
  34499. referencedClasses: [],
  34500. messageSends: []
  34501. }),
  34502. $globals.ClassRefVar);
  34503. $core.addClass('InstanceVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34504. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  34505. $core.addMethod(
  34506. $core.method({
  34507. selector: "alias",
  34508. protocol: 'testing',
  34509. fn: function (){
  34510. var self=this;
  34511. return $core.withContext(function($ctx1) {
  34512. var $1;
  34513. $1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]");
  34514. $ctx1.sendIdx[","]=1;
  34515. return $1;
  34516. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  34517. },
  34518. args: [],
  34519. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  34520. referencedClasses: [],
  34521. messageSends: [",", "name"]
  34522. }),
  34523. $globals.InstanceVar);
  34524. $core.addMethod(
  34525. $core.method({
  34526. selector: "isInstanceVar",
  34527. protocol: 'testing',
  34528. fn: function (){
  34529. var self=this;
  34530. return true;
  34531. },
  34532. args: [],
  34533. source: "isInstanceVar\x0a\x09^ true",
  34534. referencedClasses: [],
  34535. messageSends: []
  34536. }),
  34537. $globals.InstanceVar);
  34538. $core.addClass('PseudoVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34539. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  34540. $core.addMethod(
  34541. $core.method({
  34542. selector: "alias",
  34543. protocol: 'accessing',
  34544. fn: function (){
  34545. var self=this;
  34546. return $core.withContext(function($ctx1) {
  34547. return self._name();
  34548. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  34549. },
  34550. args: [],
  34551. source: "alias\x0a\x09^ self name",
  34552. referencedClasses: [],
  34553. messageSends: ["name"]
  34554. }),
  34555. $globals.PseudoVar);
  34556. $core.addMethod(
  34557. $core.method({
  34558. selector: "isImmutable",
  34559. protocol: 'testing',
  34560. fn: function (){
  34561. var self=this;
  34562. return true;
  34563. },
  34564. args: [],
  34565. source: "isImmutable\x0a\x09^ true",
  34566. referencedClasses: [],
  34567. messageSends: []
  34568. }),
  34569. $globals.PseudoVar);
  34570. $core.addMethod(
  34571. $core.method({
  34572. selector: "isPseudoVar",
  34573. protocol: 'testing',
  34574. fn: function (){
  34575. var self=this;
  34576. return true;
  34577. },
  34578. args: [],
  34579. source: "isPseudoVar\x0a\x09^ true",
  34580. referencedClasses: [],
  34581. messageSends: []
  34582. }),
  34583. $globals.PseudoVar);
  34584. $core.addClass('TempVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34585. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  34586. $core.addMethod(
  34587. $core.method({
  34588. selector: "isTempVar",
  34589. protocol: 'testing',
  34590. fn: function (){
  34591. var self=this;
  34592. return true;
  34593. },
  34594. args: [],
  34595. source: "isTempVar\x0a\x09^ true",
  34596. referencedClasses: [],
  34597. messageSends: []
  34598. }),
  34599. $globals.TempVar);
  34600. $core.addClass('UnknownVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34601. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  34602. $core.addMethod(
  34603. $core.method({
  34604. selector: "isUnknownVar",
  34605. protocol: 'testing',
  34606. fn: function (){
  34607. var self=this;
  34608. return true;
  34609. },
  34610. args: [],
  34611. source: "isUnknownVar\x0a\x09^ true",
  34612. referencedClasses: [],
  34613. messageSends: []
  34614. }),
  34615. $globals.UnknownVar);
  34616. $core.addClass('SemanticAnalyzer', $globals.NodeVisitor, ['currentScope', 'blockIndex', 'thePackage', 'theClass', 'classReferences', 'messageSends'], 'Compiler-Semantic');
  34617. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  34618. $core.addMethod(
  34619. $core.method({
  34620. selector: "classReferences",
  34621. protocol: 'accessing',
  34622. fn: function (){
  34623. var self=this;
  34624. return $core.withContext(function($ctx1) {
  34625. var $1,$receiver;
  34626. $1=self["@classReferences"];
  34627. if(($receiver = $1) == null || $receiver.isNil){
  34628. self["@classReferences"]=$recv($globals.Set)._new();
  34629. return self["@classReferences"];
  34630. } else {
  34631. return $1;
  34632. };
  34633. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  34634. },
  34635. args: [],
  34636. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  34637. referencedClasses: ["Set"],
  34638. messageSends: ["ifNil:", "new"]
  34639. }),
  34640. $globals.SemanticAnalyzer);
  34641. $core.addMethod(
  34642. $core.method({
  34643. selector: "errorShadowingVariable:",
  34644. protocol: 'error handling',
  34645. fn: function (aString){
  34646. var self=this;
  34647. return $core.withContext(function($ctx1) {
  34648. var $1;
  34649. $1=$recv($globals.ShadowingVariableError)._new();
  34650. $recv($1)._variableName_(aString);
  34651. $recv($1)._signal();
  34652. return self;
  34653. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  34654. },
  34655. args: ["aString"],
  34656. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  34657. referencedClasses: ["ShadowingVariableError"],
  34658. messageSends: ["variableName:", "new", "signal"]
  34659. }),
  34660. $globals.SemanticAnalyzer);
  34661. $core.addMethod(
  34662. $core.method({
  34663. selector: "errorUnknownVariable:",
  34664. protocol: 'error handling',
  34665. fn: function (aNode){
  34666. var self=this;
  34667. var identifier;
  34668. return $core.withContext(function($ctx1) {
  34669. var $1,$2,$3;
  34670. identifier=$recv(aNode)._value();
  34671. $ctx1.sendIdx["value"]=1;
  34672. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  34673. return $core.withContext(function($ctx2) {
  34674. return self._isVariableUndefined_inPackage_(identifier,self._thePackage());
  34675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34676. }));
  34677. if($core.assert($1)){
  34678. $2=$recv($globals.UnknownVariableError)._new();
  34679. $3=$recv(aNode)._value();
  34680. $ctx1.sendIdx["value"]=2;
  34681. $recv($2)._variableName_($3);
  34682. $recv($2)._signal();
  34683. } else {
  34684. $recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  34685. };
  34686. return self;
  34687. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  34688. },
  34689. args: ["aNode"],
  34690. 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 ]",
  34691. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  34692. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  34693. }),
  34694. $globals.SemanticAnalyzer);
  34695. $core.addMethod(
  34696. $core.method({
  34697. selector: "isVariableUndefined:inPackage:",
  34698. protocol: 'testing',
  34699. fn: function (aString,aPackage){
  34700. var self=this;
  34701. return $core.withContext(function($ctx1) {
  34702. var $1,$2,$3,$receiver;
  34703. if(($receiver = aPackage) == null || $receiver.isNil){
  34704. aPackage;
  34705. } else {
  34706. var packageKnownVars;
  34707. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  34708. packageKnownVars;
  34709. $1=$recv(packageKnownVars)._includes_(aString);
  34710. if($core.assert($1)){
  34711. return false;
  34712. };
  34713. };
  34714. $2=$recv($globals.Compiler)._new();
  34715. $3=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
  34716. $ctx1.sendIdx[","]=1;
  34717. return $recv($2)._eval_($3);
  34718. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  34719. },
  34720. args: ["aString", "aPackage"],
  34721. 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'",
  34722. referencedClasses: ["Compiler"],
  34723. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","]
  34724. }),
  34725. $globals.SemanticAnalyzer);
  34726. $core.addMethod(
  34727. $core.method({
  34728. selector: "messageSends",
  34729. protocol: 'accessing',
  34730. fn: function (){
  34731. var self=this;
  34732. return $core.withContext(function($ctx1) {
  34733. var $1,$receiver;
  34734. $1=self["@messageSends"];
  34735. if(($receiver = $1) == null || $receiver.isNil){
  34736. self["@messageSends"]=$recv($globals.Dictionary)._new();
  34737. return self["@messageSends"];
  34738. } else {
  34739. return $1;
  34740. };
  34741. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  34742. },
  34743. args: [],
  34744. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  34745. referencedClasses: ["Dictionary"],
  34746. messageSends: ["ifNil:", "new"]
  34747. }),
  34748. $globals.SemanticAnalyzer);
  34749. $core.addMethod(
  34750. $core.method({
  34751. selector: "newBlockScope",
  34752. protocol: 'factory',
  34753. fn: function (){
  34754. var self=this;
  34755. return $core.withContext(function($ctx1) {
  34756. return self._newScopeOfClass_($globals.LexicalScope);
  34757. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  34758. },
  34759. args: [],
  34760. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  34761. referencedClasses: ["LexicalScope"],
  34762. messageSends: ["newScopeOfClass:"]
  34763. }),
  34764. $globals.SemanticAnalyzer);
  34765. $core.addMethod(
  34766. $core.method({
  34767. selector: "newMethodScope",
  34768. protocol: 'factory',
  34769. fn: function (){
  34770. var self=this;
  34771. return $core.withContext(function($ctx1) {
  34772. return self._newScopeOfClass_($globals.MethodLexicalScope);
  34773. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  34774. },
  34775. args: [],
  34776. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  34777. referencedClasses: ["MethodLexicalScope"],
  34778. messageSends: ["newScopeOfClass:"]
  34779. }),
  34780. $globals.SemanticAnalyzer);
  34781. $core.addMethod(
  34782. $core.method({
  34783. selector: "newScopeOfClass:",
  34784. protocol: 'factory',
  34785. fn: function (aLexicalScopeClass){
  34786. var self=this;
  34787. return $core.withContext(function($ctx1) {
  34788. var $1;
  34789. $1=$recv(aLexicalScopeClass)._new();
  34790. $recv($1)._outerScope_(self["@currentScope"]);
  34791. return $recv($1)._yourself();
  34792. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  34793. },
  34794. args: ["aLexicalScopeClass"],
  34795. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  34796. referencedClasses: [],
  34797. messageSends: ["outerScope:", "new", "yourself"]
  34798. }),
  34799. $globals.SemanticAnalyzer);
  34800. $core.addMethod(
  34801. $core.method({
  34802. selector: "nextBlockIndex",
  34803. protocol: 'private',
  34804. fn: function (){
  34805. var self=this;
  34806. return $core.withContext(function($ctx1) {
  34807. var $1,$receiver;
  34808. $1=self["@blockIndex"];
  34809. if(($receiver = $1) == null || $receiver.isNil){
  34810. self["@blockIndex"]=(0);
  34811. self["@blockIndex"];
  34812. } else {
  34813. $1;
  34814. };
  34815. self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
  34816. return self["@blockIndex"];
  34817. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  34818. },
  34819. args: [],
  34820. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  34821. referencedClasses: [],
  34822. messageSends: ["ifNil:", "+"]
  34823. }),
  34824. $globals.SemanticAnalyzer);
  34825. $core.addMethod(
  34826. $core.method({
  34827. selector: "popScope",
  34828. protocol: 'scope',
  34829. fn: function (){
  34830. var self=this;
  34831. return $core.withContext(function($ctx1) {
  34832. var $1,$receiver;
  34833. $1=self["@currentScope"];
  34834. if(($receiver = $1) == null || $receiver.isNil){
  34835. $1;
  34836. } else {
  34837. self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
  34838. self["@currentScope"];
  34839. };
  34840. return self;
  34841. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  34842. },
  34843. args: [],
  34844. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  34845. referencedClasses: [],
  34846. messageSends: ["ifNotNil:", "outerScope"]
  34847. }),
  34848. $globals.SemanticAnalyzer);
  34849. $core.addMethod(
  34850. $core.method({
  34851. selector: "pushScope:",
  34852. protocol: 'scope',
  34853. fn: function (aScope){
  34854. var self=this;
  34855. return $core.withContext(function($ctx1) {
  34856. $recv(aScope)._outerScope_(self["@currentScope"]);
  34857. self["@currentScope"]=aScope;
  34858. return self;
  34859. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  34860. },
  34861. args: ["aScope"],
  34862. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  34863. referencedClasses: [],
  34864. messageSends: ["outerScope:"]
  34865. }),
  34866. $globals.SemanticAnalyzer);
  34867. $core.addMethod(
  34868. $core.method({
  34869. selector: "theClass",
  34870. protocol: 'accessing',
  34871. fn: function (){
  34872. var self=this;
  34873. return self["@theClass"];
  34874. },
  34875. args: [],
  34876. source: "theClass\x0a\x09^ theClass",
  34877. referencedClasses: [],
  34878. messageSends: []
  34879. }),
  34880. $globals.SemanticAnalyzer);
  34881. $core.addMethod(
  34882. $core.method({
  34883. selector: "theClass:",
  34884. protocol: 'accessing',
  34885. fn: function (aClass){
  34886. var self=this;
  34887. self["@theClass"]=aClass;
  34888. return self;
  34889. },
  34890. args: ["aClass"],
  34891. source: "theClass: aClass\x0a\x09theClass := aClass",
  34892. referencedClasses: [],
  34893. messageSends: []
  34894. }),
  34895. $globals.SemanticAnalyzer);
  34896. $core.addMethod(
  34897. $core.method({
  34898. selector: "thePackage",
  34899. protocol: 'accessing',
  34900. fn: function (){
  34901. var self=this;
  34902. return self["@thePackage"];
  34903. },
  34904. args: [],
  34905. source: "thePackage\x0a\x09^ thePackage",
  34906. referencedClasses: [],
  34907. messageSends: []
  34908. }),
  34909. $globals.SemanticAnalyzer);
  34910. $core.addMethod(
  34911. $core.method({
  34912. selector: "thePackage:",
  34913. protocol: 'accessing',
  34914. fn: function (aPackage){
  34915. var self=this;
  34916. self["@thePackage"]=aPackage;
  34917. return self;
  34918. },
  34919. args: ["aPackage"],
  34920. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  34921. referencedClasses: [],
  34922. messageSends: []
  34923. }),
  34924. $globals.SemanticAnalyzer);
  34925. $core.addMethod(
  34926. $core.method({
  34927. selector: "validateVariableScope:",
  34928. protocol: 'scope',
  34929. fn: function (aString){
  34930. var self=this;
  34931. return $core.withContext(function($ctx1) {
  34932. var $1,$receiver;
  34933. $1=$recv(self["@currentScope"])._lookupVariable_(aString);
  34934. if(($receiver = $1) == null || $receiver.isNil){
  34935. $1;
  34936. } else {
  34937. self._errorShadowingVariable_(aString);
  34938. };
  34939. return self;
  34940. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  34941. },
  34942. args: ["aString"],
  34943. 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 ]",
  34944. referencedClasses: [],
  34945. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  34946. }),
  34947. $globals.SemanticAnalyzer);
  34948. $core.addMethod(
  34949. $core.method({
  34950. selector: "visitAssignmentNode:",
  34951. protocol: 'visiting',
  34952. fn: function (aNode){
  34953. var self=this;
  34954. return $core.withContext(function($ctx1) {
  34955. (
  34956. $ctx1.supercall = true,
  34957. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
  34958. $ctx1.supercall = false;
  34959. $recv($recv(aNode)._left())._beAssigned();
  34960. return self;
  34961. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34962. },
  34963. args: ["aNode"],
  34964. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  34965. referencedClasses: [],
  34966. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  34967. }),
  34968. $globals.SemanticAnalyzer);
  34969. $core.addMethod(
  34970. $core.method({
  34971. selector: "visitBlockNode:",
  34972. protocol: 'visiting',
  34973. fn: function (aNode){
  34974. var self=this;
  34975. return $core.withContext(function($ctx1) {
  34976. self._pushScope_(self._newBlockScope());
  34977. $recv(aNode)._scope_(self["@currentScope"]);
  34978. $recv(self["@currentScope"])._node_(aNode);
  34979. $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  34980. $recv($recv(aNode)._parameters())._do_((function(each){
  34981. return $core.withContext(function($ctx2) {
  34982. self._validateVariableScope_(each);
  34983. return $recv(self["@currentScope"])._addArg_(each);
  34984. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34985. }));
  34986. (
  34987. $ctx1.supercall = true,
  34988. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
  34989. $ctx1.supercall = false;
  34990. self._popScope();
  34991. return self;
  34992. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34993. },
  34994. args: ["aNode"],
  34995. 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",
  34996. referencedClasses: [],
  34997. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  34998. }),
  34999. $globals.SemanticAnalyzer);
  35000. $core.addMethod(
  35001. $core.method({
  35002. selector: "visitCascadeNode:",
  35003. protocol: 'visiting',
  35004. fn: function (aNode){
  35005. var self=this;
  35006. return $core.withContext(function($ctx1) {
  35007. $recv(aNode)._receiver_($recv($recv($recv(aNode)._nodes())._first())._receiver());
  35008. (
  35009. $ctx1.supercall = true,
  35010. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
  35011. $ctx1.supercall = false;
  35012. return self;
  35013. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35014. },
  35015. args: ["aNode"],
  35016. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode nodes first receiver.\x0a\x09super visitCascadeNode: aNode",
  35017. referencedClasses: [],
  35018. messageSends: ["receiver:", "receiver", "first", "nodes", "visitCascadeNode:"]
  35019. }),
  35020. $globals.SemanticAnalyzer);
  35021. $core.addMethod(
  35022. $core.method({
  35023. selector: "visitMethodNode:",
  35024. protocol: 'visiting',
  35025. fn: function (aNode){
  35026. var self=this;
  35027. return $core.withContext(function($ctx1) {
  35028. self._pushScope_(self._newMethodScope());
  35029. $recv(aNode)._scope_(self["@currentScope"]);
  35030. $recv(self["@currentScope"])._node_(aNode);
  35031. $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
  35032. return $core.withContext(function($ctx2) {
  35033. return $recv(self["@currentScope"])._addIVar_(each);
  35034. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35035. }));
  35036. $ctx1.sendIdx["do:"]=1;
  35037. $recv($recv(aNode)._arguments())._do_((function(each){
  35038. return $core.withContext(function($ctx2) {
  35039. self._validateVariableScope_(each);
  35040. return $recv(self["@currentScope"])._addArg_(each);
  35041. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35042. }));
  35043. (
  35044. $ctx1.supercall = true,
  35045. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
  35046. $ctx1.supercall = false;
  35047. $recv(aNode)._classReferences_(self._classReferences());
  35048. $recv(aNode)._sendIndexes_(self._messageSends());
  35049. self._popScope();
  35050. return self;
  35051. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35052. },
  35053. args: ["aNode"],
  35054. 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",
  35055. referencedClasses: [],
  35056. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  35057. }),
  35058. $globals.SemanticAnalyzer);
  35059. $core.addMethod(
  35060. $core.method({
  35061. selector: "visitReturnNode:",
  35062. protocol: 'visiting',
  35063. fn: function (aNode){
  35064. var self=this;
  35065. return $core.withContext(function($ctx1) {
  35066. var $1;
  35067. $recv(aNode)._scope_(self["@currentScope"]);
  35068. $1=$recv(self["@currentScope"])._isMethodScope();
  35069. if($core.assert($1)){
  35070. $recv(self["@currentScope"])._localReturn_(true);
  35071. } else {
  35072. $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  35073. };
  35074. (
  35075. $ctx1.supercall = true,
  35076. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
  35077. $ctx1.supercall = false;
  35078. return self;
  35079. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35080. },
  35081. args: ["aNode"],
  35082. 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",
  35083. referencedClasses: [],
  35084. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  35085. }),
  35086. $globals.SemanticAnalyzer);
  35087. $core.addMethod(
  35088. $core.method({
  35089. selector: "visitSendNode:",
  35090. protocol: 'visiting',
  35091. fn: function (aNode){
  35092. var self=this;
  35093. return $core.withContext(function($ctx1) {
  35094. var $3,$2,$1,$5,$6,$4,$7,$8,$9,$11,$12,$10,$receiver;
  35095. $3=$recv(aNode)._receiver();
  35096. $ctx1.sendIdx["receiver"]=1;
  35097. $2=$recv($3)._value();
  35098. $1=$recv($2).__eq("super");
  35099. if(!$core.assert($1)){
  35100. $5=$recv($globals.IRSendInliner)._inlinedSelectors();
  35101. $6=$recv(aNode)._selector();
  35102. $ctx1.sendIdx["selector"]=1;
  35103. $4=$recv($5)._includes_($6);
  35104. if($core.assert($4)){
  35105. $recv(aNode)._shouldBeInlined_(true);
  35106. $7=$recv(aNode)._receiver();
  35107. if(($receiver = $7) == null || $receiver.isNil){
  35108. $7;
  35109. } else {
  35110. var receiver;
  35111. receiver=$receiver;
  35112. $recv(receiver)._shouldBeAliased_(true);
  35113. };
  35114. };
  35115. };
  35116. $8=self._messageSends();
  35117. $ctx1.sendIdx["messageSends"]=1;
  35118. $9=$recv(aNode)._selector();
  35119. $ctx1.sendIdx["selector"]=2;
  35120. $recv($8)._at_ifAbsentPut_($9,(function(){
  35121. return $core.withContext(function($ctx2) {
  35122. return $recv($globals.Set)._new();
  35123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  35124. }));
  35125. $11=self._messageSends();
  35126. $ctx1.sendIdx["messageSends"]=2;
  35127. $12=$recv(aNode)._selector();
  35128. $ctx1.sendIdx["selector"]=3;
  35129. $10=$recv($11)._at_($12);
  35130. $ctx1.sendIdx["at:"]=1;
  35131. $recv($10)._add_(aNode);
  35132. $recv(aNode)._index_($recv($recv(self._messageSends())._at_($recv(aNode)._selector()))._size());
  35133. (
  35134. $ctx1.supercall = true,
  35135. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  35136. $ctx1.supercall = false;
  35137. return self;
  35138. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35139. },
  35140. args: ["aNode"],
  35141. source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super'\x0a\x09\x09ifFalse: [ (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\x09self messageSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09(self messageSends at: aNode selector) add: aNode.\x0a\x0a\x09aNode index: (self messageSends at: aNode selector) size.\x0a\x0a\x09super visitSendNode: aNode",
  35142. referencedClasses: ["IRSendInliner", "Set"],
  35143. messageSends: ["ifFalse:", "=", "value", "receiver", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "at:ifAbsentPut:", "messageSends", "new", "add:", "at:", "index:", "size", "visitSendNode:"]
  35144. }),
  35145. $globals.SemanticAnalyzer);
  35146. $core.addMethod(
  35147. $core.method({
  35148. selector: "visitSequenceNode:",
  35149. protocol: 'visiting',
  35150. fn: function (aNode){
  35151. var self=this;
  35152. return $core.withContext(function($ctx1) {
  35153. $recv($recv(aNode)._temps())._do_((function(each){
  35154. return $core.withContext(function($ctx2) {
  35155. self._validateVariableScope_(each);
  35156. return $recv(self["@currentScope"])._addTemp_(each);
  35157. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35158. }));
  35159. (
  35160. $ctx1.supercall = true,
  35161. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  35162. $ctx1.supercall = false;
  35163. return self;
  35164. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35165. },
  35166. args: ["aNode"],
  35167. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  35168. referencedClasses: [],
  35169. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  35170. }),
  35171. $globals.SemanticAnalyzer);
  35172. $core.addMethod(
  35173. $core.method({
  35174. selector: "visitVariableNode:",
  35175. protocol: 'visiting',
  35176. fn: function (aNode){
  35177. var self=this;
  35178. var binding;
  35179. return $core.withContext(function($ctx1) {
  35180. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  35181. binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
  35182. $1=binding;
  35183. if(($receiver = $1) == null || $receiver.isNil){
  35184. $3=$recv(aNode)._value();
  35185. $ctx1.sendIdx["value"]=1;
  35186. $2=$recv($3)._isCapitalized();
  35187. if($core.assert($2)){
  35188. $4=$recv($globals.ClassRefVar)._new();
  35189. $ctx1.sendIdx["new"]=1;
  35190. $5=$recv(aNode)._value();
  35191. $ctx1.sendIdx["value"]=2;
  35192. $recv($4)._name_($5);
  35193. $ctx1.sendIdx["name:"]=1;
  35194. $6=$recv($4)._yourself();
  35195. $ctx1.sendIdx["yourself"]=1;
  35196. binding=$6;
  35197. binding;
  35198. $7=self._classReferences();
  35199. $8=$recv(aNode)._value();
  35200. $ctx1.sendIdx["value"]=3;
  35201. $recv($7)._add_($8);
  35202. } else {
  35203. self._errorUnknownVariable_(aNode);
  35204. $9=$recv($globals.UnknownVar)._new();
  35205. $recv($9)._name_($recv(aNode)._value());
  35206. binding=$recv($9)._yourself();
  35207. binding;
  35208. };
  35209. } else {
  35210. $1;
  35211. };
  35212. $recv(aNode)._binding_(binding);
  35213. return self;
  35214. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  35215. },
  35216. args: ["aNode"],
  35217. 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.",
  35218. referencedClasses: ["ClassRefVar", "UnknownVar"],
  35219. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  35220. }),
  35221. $globals.SemanticAnalyzer);
  35222. $core.addMethod(
  35223. $core.method({
  35224. selector: "on:",
  35225. protocol: 'instance creation',
  35226. fn: function (aClass){
  35227. var self=this;
  35228. return $core.withContext(function($ctx1) {
  35229. var $1;
  35230. $1=self._new();
  35231. $recv($1)._theClass_(aClass);
  35232. return $recv($1)._yourself();
  35233. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
  35234. },
  35235. args: ["aClass"],
  35236. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  35237. referencedClasses: [],
  35238. messageSends: ["theClass:", "new", "yourself"]
  35239. }),
  35240. $globals.SemanticAnalyzer.klass);
  35241. $core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Semantic');
  35242. $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";
  35243. $core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35244. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  35245. $core.addMethod(
  35246. $core.method({
  35247. selector: "messageText",
  35248. protocol: 'accessing',
  35249. fn: function (){
  35250. var self=this;
  35251. return $core.withContext(function($ctx1) {
  35252. return " Invalid assignment to variable: ".__comma(self._variableName());
  35253. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  35254. },
  35255. args: [],
  35256. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  35257. referencedClasses: [],
  35258. messageSends: [",", "variableName"]
  35259. }),
  35260. $globals.InvalidAssignmentError);
  35261. $core.addMethod(
  35262. $core.method({
  35263. selector: "variableName",
  35264. protocol: 'accessing',
  35265. fn: function (){
  35266. var self=this;
  35267. return self["@variableName"];
  35268. },
  35269. args: [],
  35270. source: "variableName\x0a\x09^ variableName",
  35271. referencedClasses: [],
  35272. messageSends: []
  35273. }),
  35274. $globals.InvalidAssignmentError);
  35275. $core.addMethod(
  35276. $core.method({
  35277. selector: "variableName:",
  35278. protocol: 'accessing',
  35279. fn: function (aString){
  35280. var self=this;
  35281. self["@variableName"]=aString;
  35282. return self;
  35283. },
  35284. args: ["aString"],
  35285. source: "variableName: aString\x0a\x09variableName := aString",
  35286. referencedClasses: [],
  35287. messageSends: []
  35288. }),
  35289. $globals.InvalidAssignmentError);
  35290. $core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35291. $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.";
  35292. $core.addMethod(
  35293. $core.method({
  35294. selector: "messageText",
  35295. protocol: 'accessing',
  35296. fn: function (){
  35297. var self=this;
  35298. return $core.withContext(function($ctx1) {
  35299. var $1;
  35300. $1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  35301. $ctx1.sendIdx[","]=1;
  35302. return $1;
  35303. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  35304. },
  35305. args: [],
  35306. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  35307. referencedClasses: [],
  35308. messageSends: [",", "variableName"]
  35309. }),
  35310. $globals.ShadowingVariableError);
  35311. $core.addMethod(
  35312. $core.method({
  35313. selector: "variableName",
  35314. protocol: 'accessing',
  35315. fn: function (){
  35316. var self=this;
  35317. return self["@variableName"];
  35318. },
  35319. args: [],
  35320. source: "variableName\x0a\x09^ variableName",
  35321. referencedClasses: [],
  35322. messageSends: []
  35323. }),
  35324. $globals.ShadowingVariableError);
  35325. $core.addMethod(
  35326. $core.method({
  35327. selector: "variableName:",
  35328. protocol: 'accessing',
  35329. fn: function (aString){
  35330. var self=this;
  35331. self["@variableName"]=aString;
  35332. return self;
  35333. },
  35334. args: ["aString"],
  35335. source: "variableName: aString\x0a\x09variableName := aString",
  35336. referencedClasses: [],
  35337. messageSends: []
  35338. }),
  35339. $globals.ShadowingVariableError);
  35340. $core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35341. $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.";
  35342. $core.addMethod(
  35343. $core.method({
  35344. selector: "messageText",
  35345. protocol: 'accessing',
  35346. fn: function (){
  35347. var self=this;
  35348. return $core.withContext(function($ctx1) {
  35349. var $1;
  35350. $1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  35351. $ctx1.sendIdx[","]=1;
  35352. return $1;
  35353. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  35354. },
  35355. args: [],
  35356. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  35357. referencedClasses: [],
  35358. messageSends: [",", "variableName"]
  35359. }),
  35360. $globals.UnknownVariableError);
  35361. $core.addMethod(
  35362. $core.method({
  35363. selector: "variableName",
  35364. protocol: 'accessing',
  35365. fn: function (){
  35366. var self=this;
  35367. return self["@variableName"];
  35368. },
  35369. args: [],
  35370. source: "variableName\x0a\x09^ variableName",
  35371. referencedClasses: [],
  35372. messageSends: []
  35373. }),
  35374. $globals.UnknownVariableError);
  35375. $core.addMethod(
  35376. $core.method({
  35377. selector: "variableName:",
  35378. protocol: 'accessing',
  35379. fn: function (aString){
  35380. var self=this;
  35381. self["@variableName"]=aString;
  35382. return self;
  35383. },
  35384. args: ["aString"],
  35385. source: "variableName: aString\x0a\x09variableName := aString",
  35386. referencedClasses: [],
  35387. messageSends: []
  35388. }),
  35389. $globals.UnknownVariableError);
  35390. });
  35391. define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
  35392. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  35393. $core.addPackage('Compiler-IR');
  35394. $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  35395. $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35396. $core.addClass('IRASTTranslator', $globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  35397. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  35398. $core.addMethod(
  35399. $core.method({
  35400. selector: "alias:",
  35401. protocol: 'visiting',
  35402. fn: function (aNode){
  35403. var self=this;
  35404. var variable;
  35405. return $core.withContext(function($ctx1) {
  35406. var $1,$2,$3,$5,$4,$6,$7,$9,$8;
  35407. $1=$recv(aNode)._isImmutable();
  35408. if($core.assert($1)){
  35409. $2=self._visit_(aNode);
  35410. $ctx1.sendIdx["visit:"]=1;
  35411. return $2;
  35412. };
  35413. $3=$recv($globals.IRVariable)._new();
  35414. $ctx1.sendIdx["new"]=1;
  35415. $5=$recv($globals.AliasVar)._new();
  35416. $ctx1.sendIdx["new"]=2;
  35417. $4=$recv($5)._name_("$".__comma(self._nextAlias()));
  35418. $recv($3)._variable_($4);
  35419. $6=$recv($3)._yourself();
  35420. $ctx1.sendIdx["yourself"]=1;
  35421. variable=$6;
  35422. $7=self._sequence();
  35423. $9=$recv($globals.IRAssignment)._new();
  35424. $recv($9)._add_(variable);
  35425. $ctx1.sendIdx["add:"]=2;
  35426. $recv($9)._add_(self._visit_(aNode));
  35427. $ctx1.sendIdx["add:"]=3;
  35428. $8=$recv($9)._yourself();
  35429. $recv($7)._add_($8);
  35430. $ctx1.sendIdx["add:"]=1;
  35431. $recv($recv(self._method())._internalVariables())._add_(variable);
  35432. return variable;
  35433. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  35434. },
  35435. args: ["aNode"],
  35436. 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",
  35437. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  35438. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  35439. }),
  35440. $globals.IRASTTranslator);
  35441. $core.addMethod(
  35442. $core.method({
  35443. selector: "aliasTemporally:",
  35444. protocol: 'visiting',
  35445. fn: function (aCollection){
  35446. var self=this;
  35447. var threshold,result;
  35448. return $core.withContext(function($ctx1) {
  35449. var $1,$2,$4,$3;
  35450. threshold=(0);
  35451. $recv(aCollection)._withIndexDo_((function(each,i){
  35452. return $core.withContext(function($ctx2) {
  35453. $1=$recv(each)._subtreeNeedsAliasing();
  35454. if($core.assert($1)){
  35455. threshold=i;
  35456. return threshold;
  35457. };
  35458. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  35459. }));
  35460. $ctx1.sendIdx["withIndexDo:"]=1;
  35461. result=$recv($globals.OrderedCollection)._new();
  35462. $recv(aCollection)._withIndexDo_((function(each,i){
  35463. return $core.withContext(function($ctx2) {
  35464. $2=result;
  35465. $4=$recv(i).__lt_eq(threshold);
  35466. if($core.assert($4)){
  35467. $3=self._alias_(each);
  35468. } else {
  35469. $3=self._visit_(each);
  35470. };
  35471. return $recv($2)._add_($3);
  35472. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  35473. }));
  35474. return result;
  35475. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  35476. },
  35477. args: ["aCollection"],
  35478. 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",
  35479. referencedClasses: ["OrderedCollection"],
  35480. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  35481. }),
  35482. $globals.IRASTTranslator);
  35483. $core.addMethod(
  35484. $core.method({
  35485. selector: "method",
  35486. protocol: 'accessing',
  35487. fn: function (){
  35488. var self=this;
  35489. return self["@method"];
  35490. },
  35491. args: [],
  35492. source: "method\x0a\x09^ method",
  35493. referencedClasses: [],
  35494. messageSends: []
  35495. }),
  35496. $globals.IRASTTranslator);
  35497. $core.addMethod(
  35498. $core.method({
  35499. selector: "method:",
  35500. protocol: 'accessing',
  35501. fn: function (anIRMethod){
  35502. var self=this;
  35503. self["@method"]=anIRMethod;
  35504. return self;
  35505. },
  35506. args: ["anIRMethod"],
  35507. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  35508. referencedClasses: [],
  35509. messageSends: []
  35510. }),
  35511. $globals.IRASTTranslator);
  35512. $core.addMethod(
  35513. $core.method({
  35514. selector: "nextAlias",
  35515. protocol: 'accessing',
  35516. fn: function (){
  35517. var self=this;
  35518. return $core.withContext(function($ctx1) {
  35519. var $1,$receiver;
  35520. $1=self["@nextAlias"];
  35521. if(($receiver = $1) == null || $receiver.isNil){
  35522. self["@nextAlias"]=(0);
  35523. self["@nextAlias"];
  35524. } else {
  35525. $1;
  35526. };
  35527. self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1));
  35528. return $recv(self["@nextAlias"])._asString();
  35529. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  35530. },
  35531. args: [],
  35532. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  35533. referencedClasses: [],
  35534. messageSends: ["ifNil:", "+", "asString"]
  35535. }),
  35536. $globals.IRASTTranslator);
  35537. $core.addMethod(
  35538. $core.method({
  35539. selector: "sequence",
  35540. protocol: 'accessing',
  35541. fn: function (){
  35542. var self=this;
  35543. return self["@sequence"];
  35544. },
  35545. args: [],
  35546. source: "sequence\x0a\x09^ sequence",
  35547. referencedClasses: [],
  35548. messageSends: []
  35549. }),
  35550. $globals.IRASTTranslator);
  35551. $core.addMethod(
  35552. $core.method({
  35553. selector: "sequence:",
  35554. protocol: 'accessing',
  35555. fn: function (anIRSequence){
  35556. var self=this;
  35557. self["@sequence"]=anIRSequence;
  35558. return self;
  35559. },
  35560. args: ["anIRSequence"],
  35561. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  35562. referencedClasses: [],
  35563. messageSends: []
  35564. }),
  35565. $globals.IRASTTranslator);
  35566. $core.addMethod(
  35567. $core.method({
  35568. selector: "source",
  35569. protocol: 'accessing',
  35570. fn: function (){
  35571. var self=this;
  35572. return self["@source"];
  35573. },
  35574. args: [],
  35575. source: "source\x0a\x09^ source",
  35576. referencedClasses: [],
  35577. messageSends: []
  35578. }),
  35579. $globals.IRASTTranslator);
  35580. $core.addMethod(
  35581. $core.method({
  35582. selector: "source:",
  35583. protocol: 'accessing',
  35584. fn: function (aString){
  35585. var self=this;
  35586. self["@source"]=aString;
  35587. return self;
  35588. },
  35589. args: ["aString"],
  35590. source: "source: aString\x0a\x09source := aString",
  35591. referencedClasses: [],
  35592. messageSends: []
  35593. }),
  35594. $globals.IRASTTranslator);
  35595. $core.addMethod(
  35596. $core.method({
  35597. selector: "theClass",
  35598. protocol: 'accessing',
  35599. fn: function (){
  35600. var self=this;
  35601. return self["@theClass"];
  35602. },
  35603. args: [],
  35604. source: "theClass\x0a\x09^ theClass",
  35605. referencedClasses: [],
  35606. messageSends: []
  35607. }),
  35608. $globals.IRASTTranslator);
  35609. $core.addMethod(
  35610. $core.method({
  35611. selector: "theClass:",
  35612. protocol: 'accessing',
  35613. fn: function (aClass){
  35614. var self=this;
  35615. self["@theClass"]=aClass;
  35616. return self;
  35617. },
  35618. args: ["aClass"],
  35619. source: "theClass: aClass\x0a\x09theClass := aClass",
  35620. referencedClasses: [],
  35621. messageSends: []
  35622. }),
  35623. $globals.IRASTTranslator);
  35624. $core.addMethod(
  35625. $core.method({
  35626. selector: "visitAssignmentNode:",
  35627. protocol: 'visiting',
  35628. fn: function (aNode){
  35629. var self=this;
  35630. var left,right,assignment;
  35631. return $core.withContext(function($ctx1) {
  35632. var $1,$3,$2;
  35633. right=self._visit_($recv(aNode)._right());
  35634. $ctx1.sendIdx["visit:"]=1;
  35635. left=self._visit_($recv(aNode)._left());
  35636. $1=self._sequence();
  35637. $3=$recv($globals.IRAssignment)._new();
  35638. $recv($3)._add_(left);
  35639. $ctx1.sendIdx["add:"]=2;
  35640. $recv($3)._add_(right);
  35641. $2=$recv($3)._yourself();
  35642. $recv($1)._add_($2);
  35643. $ctx1.sendIdx["add:"]=1;
  35644. return left;
  35645. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  35646. },
  35647. args: ["aNode"],
  35648. 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",
  35649. referencedClasses: ["IRAssignment"],
  35650. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  35651. }),
  35652. $globals.IRASTTranslator);
  35653. $core.addMethod(
  35654. $core.method({
  35655. selector: "visitBlockNode:",
  35656. protocol: 'visiting',
  35657. fn: function (aNode){
  35658. var self=this;
  35659. var closure;
  35660. return $core.withContext(function($ctx1) {
  35661. var $1,$2,$3,$5,$4,$6,$8,$7;
  35662. $1=$recv($globals.IRClosure)._new();
  35663. $ctx1.sendIdx["new"]=1;
  35664. $recv($1)._arguments_($recv(aNode)._parameters());
  35665. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  35666. $2=$recv(aNode)._scope();
  35667. $ctx1.sendIdx["scope"]=1;
  35668. $recv($1)._scope_($2);
  35669. $ctx1.sendIdx["scope:"]=1;
  35670. $3=$recv($1)._yourself();
  35671. $ctx1.sendIdx["yourself"]=1;
  35672. closure=$3;
  35673. $5=$recv(aNode)._scope();
  35674. $ctx1.sendIdx["scope"]=2;
  35675. $4=$recv($5)._temps();
  35676. $recv($4)._do_((function(each){
  35677. return $core.withContext(function($ctx2) {
  35678. $6=closure;
  35679. $8=$recv($globals.IRTempDeclaration)._new();
  35680. $recv($8)._name_($recv(each)._name());
  35681. $recv($8)._scope_($recv(aNode)._scope());
  35682. $7=$recv($8)._yourself();
  35683. return $recv($6)._add_($7);
  35684. $ctx2.sendIdx["add:"]=1;
  35685. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35686. }));
  35687. $ctx1.sendIdx["do:"]=1;
  35688. $recv($recv(aNode)._nodes())._do_((function(each){
  35689. return $core.withContext(function($ctx2) {
  35690. return $recv(closure)._add_(self._visit_(each));
  35691. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35692. }));
  35693. return closure;
  35694. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  35695. },
  35696. args: ["aNode"],
  35697. 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 nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  35698. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  35699. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"]
  35700. }),
  35701. $globals.IRASTTranslator);
  35702. $core.addMethod(
  35703. $core.method({
  35704. selector: "visitBlockSequenceNode:",
  35705. protocol: 'visiting',
  35706. fn: function (aNode){
  35707. var self=this;
  35708. return $core.withContext(function($ctx1) {
  35709. var $1,$2,$4,$3,$5,$6,$9,$8,$7,$10,$12,$15,$14,$13,$11;
  35710. $1=$recv($globals.IRBlockSequence)._new();
  35711. $ctx1.sendIdx["new"]=1;
  35712. return self._withSequence_do_($1,(function(){
  35713. return $core.withContext(function($ctx2) {
  35714. $2=$recv(aNode)._nodes();
  35715. $ctx2.sendIdx["nodes"]=1;
  35716. return $recv($2)._ifNotEmpty_((function(){
  35717. return $core.withContext(function($ctx3) {
  35718. $4=$recv(aNode)._nodes();
  35719. $ctx3.sendIdx["nodes"]=2;
  35720. $3=$recv($4)._allButLast();
  35721. $recv($3)._do_((function(each){
  35722. return $core.withContext(function($ctx4) {
  35723. $5=self._sequence();
  35724. $ctx4.sendIdx["sequence"]=1;
  35725. $6=self._visitOrAlias_(each);
  35726. $ctx4.sendIdx["visitOrAlias:"]=1;
  35727. return $recv($5)._add_($6);
  35728. $ctx4.sendIdx["add:"]=1;
  35729. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  35730. }));
  35731. $9=$recv(aNode)._nodes();
  35732. $ctx3.sendIdx["nodes"]=3;
  35733. $8=$recv($9)._last();
  35734. $ctx3.sendIdx["last"]=1;
  35735. $7=$recv($8)._isReturnNode();
  35736. if($core.assert($7)){
  35737. return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._nodes())._last()));
  35738. } else {
  35739. $10=self._sequence();
  35740. $ctx3.sendIdx["sequence"]=2;
  35741. $12=$recv($globals.IRBlockReturn)._new();
  35742. $15=$recv(aNode)._nodes();
  35743. $ctx3.sendIdx["nodes"]=4;
  35744. $14=$recv($15)._last();
  35745. $ctx3.sendIdx["last"]=2;
  35746. $13=self._visitOrAlias_($14);
  35747. $ctx3.sendIdx["visitOrAlias:"]=2;
  35748. $recv($12)._add_($13);
  35749. $ctx3.sendIdx["add:"]=3;
  35750. $11=$recv($12)._yourself();
  35751. return $recv($10)._add_($11);
  35752. $ctx3.sendIdx["add:"]=2;
  35753. };
  35754. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  35755. }));
  35756. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35757. }));
  35758. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35759. },
  35760. args: ["aNode"],
  35761. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes ifNotEmpty: [\x0a\x09\x09\x09\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode nodes last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode nodes last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode nodes last) ] ]]",
  35762. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  35763. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  35764. }),
  35765. $globals.IRASTTranslator);
  35766. $core.addMethod(
  35767. $core.method({
  35768. selector: "visitCascadeNode:",
  35769. protocol: 'visiting',
  35770. fn: function (aNode){
  35771. var self=this;
  35772. return $core.withContext(function($ctx1) {
  35773. var $1,$2,$4,$3;
  35774. $1=$recv(aNode)._nodes();
  35775. $ctx1.sendIdx["nodes"]=1;
  35776. $recv($1)._inject_into_($recv(aNode)._receiver(),(function(previous,each){
  35777. var receiver;
  35778. return $core.withContext(function($ctx2) {
  35779. $2=$recv(previous)._isImmutable();
  35780. if($core.assert($2)){
  35781. receiver=previous;
  35782. } else {
  35783. var alias;
  35784. alias=self._alias_(previous);
  35785. alias;
  35786. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  35787. };
  35788. receiver;
  35789. $recv(each)._receiver_(receiver);
  35790. return receiver;
  35791. }, function($ctx2) {$ctx2.fillBlock({previous:previous,each:each,receiver:receiver},$ctx1,1)});
  35792. }));
  35793. $4=$recv(aNode)._nodes();
  35794. $ctx1.sendIdx["nodes"]=2;
  35795. $3=$recv($4)._allButLast();
  35796. $recv($3)._do_((function(each){
  35797. return $core.withContext(function($ctx2) {
  35798. return $recv(self._sequence())._add_(self._visit_(each));
  35799. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  35800. }));
  35801. return self._visitOrAlias_($recv($recv(aNode)._nodes())._last());
  35802. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35803. },
  35804. args: ["aNode"],
  35805. source: "visitCascadeNode: aNode\x0a\x09aNode nodes inject: aNode receiver into: [ :previous :each |\x0a\x09\x09| receiver |\x0a\x09\x09receiver := previous isImmutable \x0a\x09\x09\x09ifTrue: [ previous ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09| alias |\x0a\x09\x09\x09\x09alias := self alias: previous.\x0a\x09\x09\x09\x09VariableNode new binding: alias variable ].\x0a\x09\x09each receiver: receiver.\x0a\x09\x09receiver ].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode nodes last",
  35806. referencedClasses: ["VariableNode"],
  35807. messageSends: ["inject:into:", "nodes", "receiver", "ifTrue:ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "receiver:", "do:", "allButLast", "add:", "sequence", "visit:", "visitOrAlias:", "last"]
  35808. }),
  35809. $globals.IRASTTranslator);
  35810. $core.addMethod(
  35811. $core.method({
  35812. selector: "visitDynamicArrayNode:",
  35813. protocol: 'visiting',
  35814. fn: function (aNode){
  35815. var self=this;
  35816. var array;
  35817. return $core.withContext(function($ctx1) {
  35818. array=$recv($globals.IRDynamicArray)._new();
  35819. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  35820. return $core.withContext(function($ctx2) {
  35821. return $recv(array)._add_(each);
  35822. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35823. }));
  35824. return array;
  35825. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  35826. },
  35827. args: ["aNode"],
  35828. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
  35829. referencedClasses: ["IRDynamicArray"],
  35830. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  35831. }),
  35832. $globals.IRASTTranslator);
  35833. $core.addMethod(
  35834. $core.method({
  35835. selector: "visitDynamicDictionaryNode:",
  35836. protocol: 'visiting',
  35837. fn: function (aNode){
  35838. var self=this;
  35839. var dictionary;
  35840. return $core.withContext(function($ctx1) {
  35841. dictionary=$recv($globals.IRDynamicDictionary)._new();
  35842. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  35843. return $core.withContext(function($ctx2) {
  35844. return $recv(dictionary)._add_(each);
  35845. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35846. }));
  35847. return dictionary;
  35848. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  35849. },
  35850. args: ["aNode"],
  35851. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  35852. referencedClasses: ["IRDynamicDictionary"],
  35853. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  35854. }),
  35855. $globals.IRASTTranslator);
  35856. $core.addMethod(
  35857. $core.method({
  35858. selector: "visitJSStatementNode:",
  35859. protocol: 'visiting',
  35860. fn: function (aNode){
  35861. var self=this;
  35862. return $core.withContext(function($ctx1) {
  35863. var $1;
  35864. $1=$recv($globals.IRVerbatim)._new();
  35865. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  35866. return $recv($1)._yourself();
  35867. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35868. },
  35869. args: ["aNode"],
  35870. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  35871. referencedClasses: ["IRVerbatim"],
  35872. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  35873. }),
  35874. $globals.IRASTTranslator);
  35875. $core.addMethod(
  35876. $core.method({
  35877. selector: "visitMethodNode:",
  35878. protocol: 'visiting',
  35879. fn: function (aNode){
  35880. var self=this;
  35881. return $core.withContext(function($ctx1) {
  35882. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  35883. $2=$recv($globals.IRMethod)._new();
  35884. $ctx1.sendIdx["new"]=1;
  35885. $recv($2)._source_($recv(self._source())._crlfSanitized());
  35886. $ctx1.sendIdx["source:"]=1;
  35887. $recv($2)._theClass_(self._theClass());
  35888. $recv($2)._arguments_($recv(aNode)._arguments());
  35889. $recv($2)._selector_($recv(aNode)._selector());
  35890. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  35891. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  35892. $recv($2)._classReferences_($recv(aNode)._classReferences());
  35893. $3=$recv(aNode)._scope();
  35894. $ctx1.sendIdx["scope"]=1;
  35895. $recv($2)._scope_($3);
  35896. $ctx1.sendIdx["scope:"]=1;
  35897. $4=$recv($2)._yourself();
  35898. $ctx1.sendIdx["yourself"]=1;
  35899. $1=$4;
  35900. self._method_($1);
  35901. $6=$recv(aNode)._scope();
  35902. $ctx1.sendIdx["scope"]=2;
  35903. $5=$recv($6)._temps();
  35904. $recv($5)._do_((function(each){
  35905. return $core.withContext(function($ctx2) {
  35906. $7=self._method();
  35907. $ctx2.sendIdx["method"]=1;
  35908. $9=$recv($globals.IRTempDeclaration)._new();
  35909. $ctx2.sendIdx["new"]=2;
  35910. $recv($9)._name_($recv(each)._name());
  35911. $10=$recv(aNode)._scope();
  35912. $ctx2.sendIdx["scope"]=3;
  35913. $recv($9)._scope_($10);
  35914. $11=$recv($9)._yourself();
  35915. $ctx2.sendIdx["yourself"]=2;
  35916. $8=$11;
  35917. return $recv($7)._add_($8);
  35918. $ctx2.sendIdx["add:"]=1;
  35919. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35920. }));
  35921. $ctx1.sendIdx["do:"]=1;
  35922. $recv($recv(aNode)._nodes())._do_((function(each){
  35923. return $core.withContext(function($ctx2) {
  35924. $12=self._method();
  35925. $ctx2.sendIdx["method"]=2;
  35926. return $recv($12)._add_(self._visit_(each));
  35927. $ctx2.sendIdx["add:"]=2;
  35928. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35929. }));
  35930. $14=$recv(aNode)._scope();
  35931. $ctx1.sendIdx["scope"]=4;
  35932. $13=$recv($14)._hasLocalReturn();
  35933. if(!$core.assert($13)){
  35934. $15=self._method();
  35935. $ctx1.sendIdx["method"]=3;
  35936. $17=$recv($globals.IRReturn)._new();
  35937. $ctx1.sendIdx["new"]=3;
  35938. $19=$recv($globals.IRVariable)._new();
  35939. $ctx1.sendIdx["new"]=4;
  35940. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  35941. $20=$recv($19)._yourself();
  35942. $ctx1.sendIdx["yourself"]=3;
  35943. $18=$20;
  35944. $recv($17)._add_($18);
  35945. $ctx1.sendIdx["add:"]=4;
  35946. $21=$recv($17)._yourself();
  35947. $ctx1.sendIdx["yourself"]=4;
  35948. $16=$21;
  35949. $recv($15)._add_($16);
  35950. $ctx1.sendIdx["add:"]=3;
  35951. $23=$recv($globals.IRVerbatim)._new();
  35952. $recv($23)._source_("");
  35953. $22=$recv($23)._yourself();
  35954. $recv($15)._add_($22);
  35955. };
  35956. return self._method();
  35957. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35958. },
  35959. args: ["aNode"],
  35960. 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 nodes 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",
  35961. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  35962. 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", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"]
  35963. }),
  35964. $globals.IRASTTranslator);
  35965. $core.addMethod(
  35966. $core.method({
  35967. selector: "visitOrAlias:",
  35968. protocol: 'visiting',
  35969. fn: function (aNode){
  35970. var self=this;
  35971. return $core.withContext(function($ctx1) {
  35972. var $1;
  35973. $1=$recv(aNode)._shouldBeAliased();
  35974. if($core.assert($1)){
  35975. return self._alias_(aNode);
  35976. } else {
  35977. return self._visit_(aNode);
  35978. };
  35979. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  35980. },
  35981. args: ["aNode"],
  35982. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  35983. referencedClasses: [],
  35984. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  35985. }),
  35986. $globals.IRASTTranslator);
  35987. $core.addMethod(
  35988. $core.method({
  35989. selector: "visitReturnNode:",
  35990. protocol: 'visiting',
  35991. fn: function (aNode){
  35992. var self=this;
  35993. var return_;
  35994. return $core.withContext(function($ctx1) {
  35995. var $1;
  35996. $1=$recv(aNode)._nonLocalReturn();
  35997. if($core.assert($1)){
  35998. return_=$recv($globals.IRNonLocalReturn)._new();
  35999. $ctx1.sendIdx["new"]=1;
  36000. } else {
  36001. return_=$recv($globals.IRReturn)._new();
  36002. };
  36003. $recv(return_)._scope_($recv(aNode)._scope());
  36004. $recv($recv(aNode)._nodes())._do_((function(each){
  36005. return $core.withContext(function($ctx2) {
  36006. return $recv(return_)._add_(self._visitOrAlias_(each));
  36007. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  36008. }));
  36009. return return_;
  36010. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  36011. },
  36012. args: ["aNode"],
  36013. 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 nodes do: [ :each |\x0a\x09\x09return add: (self visitOrAlias: each) ].\x0a\x09^ return",
  36014. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  36015. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "visitOrAlias:"]
  36016. }),
  36017. $globals.IRASTTranslator);
  36018. $core.addMethod(
  36019. $core.method({
  36020. selector: "visitSendNode:",
  36021. protocol: 'visiting',
  36022. fn: function (aNode){
  36023. var self=this;
  36024. var send;
  36025. return $core.withContext(function($ctx1) {
  36026. var $1;
  36027. send=$recv($globals.IRSend)._new();
  36028. $1=send;
  36029. $recv($1)._selector_($recv(aNode)._selector());
  36030. $recv($1)._index_($recv(aNode)._index());
  36031. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  36032. return $core.withContext(function($ctx2) {
  36033. return $recv(send)._add_(each);
  36034. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36035. }));
  36036. return send;
  36037. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  36038. },
  36039. args: ["aNode"],
  36040. 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 nodes) do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  36041. referencedClasses: ["IRSend"],
  36042. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "nodes", "add:"]
  36043. }),
  36044. $globals.IRASTTranslator);
  36045. $core.addMethod(
  36046. $core.method({
  36047. selector: "visitSequenceNode:",
  36048. protocol: 'visiting',
  36049. fn: function (aNode){
  36050. var self=this;
  36051. return $core.withContext(function($ctx1) {
  36052. var $1;
  36053. return self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  36054. return $core.withContext(function($ctx2) {
  36055. return $recv($recv(aNode)._nodes())._do_((function(each){
  36056. var instruction;
  36057. return $core.withContext(function($ctx3) {
  36058. instruction=self._visitOrAlias_(each);
  36059. instruction;
  36060. $1=$recv(instruction)._isVariable();
  36061. if(!$core.assert($1)){
  36062. return $recv(self._sequence())._add_(instruction);
  36063. };
  36064. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  36065. }));
  36066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36067. }));
  36068. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36069. },
  36070. args: ["aNode"],
  36071. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes 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 ] ]]",
  36072. referencedClasses: ["IRSequence"],
  36073. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  36074. }),
  36075. $globals.IRASTTranslator);
  36076. $core.addMethod(
  36077. $core.method({
  36078. selector: "visitValueNode:",
  36079. protocol: 'visiting',
  36080. fn: function (aNode){
  36081. var self=this;
  36082. return $core.withContext(function($ctx1) {
  36083. var $1;
  36084. $1=$recv($globals.IRValue)._new();
  36085. $recv($1)._value_($recv(aNode)._value());
  36086. return $recv($1)._yourself();
  36087. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36088. },
  36089. args: ["aNode"],
  36090. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  36091. referencedClasses: ["IRValue"],
  36092. messageSends: ["value:", "new", "value", "yourself"]
  36093. }),
  36094. $globals.IRASTTranslator);
  36095. $core.addMethod(
  36096. $core.method({
  36097. selector: "visitVariableNode:",
  36098. protocol: 'visiting',
  36099. fn: function (aNode){
  36100. var self=this;
  36101. return $core.withContext(function($ctx1) {
  36102. var $1;
  36103. $1=$recv($globals.IRVariable)._new();
  36104. $recv($1)._variable_($recv(aNode)._binding());
  36105. return $recv($1)._yourself();
  36106. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36107. },
  36108. args: ["aNode"],
  36109. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  36110. referencedClasses: ["IRVariable"],
  36111. messageSends: ["variable:", "new", "binding", "yourself"]
  36112. }),
  36113. $globals.IRASTTranslator);
  36114. $core.addMethod(
  36115. $core.method({
  36116. selector: "withSequence:do:",
  36117. protocol: 'accessing',
  36118. fn: function (aSequence,aBlock){
  36119. var self=this;
  36120. var outerSequence;
  36121. return $core.withContext(function($ctx1) {
  36122. outerSequence=self._sequence();
  36123. self._sequence_(aSequence);
  36124. $ctx1.sendIdx["sequence:"]=1;
  36125. $recv(aBlock)._value();
  36126. self._sequence_(outerSequence);
  36127. return aSequence;
  36128. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  36129. },
  36130. args: ["aSequence", "aBlock"],
  36131. 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",
  36132. referencedClasses: [],
  36133. messageSends: ["sequence", "sequence:", "value"]
  36134. }),
  36135. $globals.IRASTTranslator);
  36136. $core.addClass('IRInstruction', $globals.Object, ['parent', 'instructions'], 'Compiler-IR');
  36137. $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.";
  36138. $core.addMethod(
  36139. $core.method({
  36140. selector: "accept:",
  36141. protocol: 'visiting',
  36142. fn: function (aVisitor){
  36143. var self=this;
  36144. return $core.withContext(function($ctx1) {
  36145. return $recv(aVisitor)._visitIRInstruction_(self);
  36146. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInstruction)});
  36147. },
  36148. args: ["aVisitor"],
  36149. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  36150. referencedClasses: [],
  36151. messageSends: ["visitIRInstruction:"]
  36152. }),
  36153. $globals.IRInstruction);
  36154. $core.addMethod(
  36155. $core.method({
  36156. selector: "add:",
  36157. protocol: 'building',
  36158. fn: function (anObject){
  36159. var self=this;
  36160. return $core.withContext(function($ctx1) {
  36161. $recv(anObject)._parent_(self);
  36162. return $recv(self._instructions())._add_(anObject);
  36163. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  36164. },
  36165. args: ["anObject"],
  36166. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  36167. referencedClasses: [],
  36168. messageSends: ["parent:", "add:", "instructions"]
  36169. }),
  36170. $globals.IRInstruction);
  36171. $core.addMethod(
  36172. $core.method({
  36173. selector: "canBeAssigned",
  36174. protocol: 'testing',
  36175. fn: function (){
  36176. var self=this;
  36177. return true;
  36178. },
  36179. args: [],
  36180. source: "canBeAssigned\x0a\x09^ true",
  36181. referencedClasses: [],
  36182. messageSends: []
  36183. }),
  36184. $globals.IRInstruction);
  36185. $core.addMethod(
  36186. $core.method({
  36187. selector: "instructions",
  36188. protocol: 'accessing',
  36189. fn: function (){
  36190. var self=this;
  36191. return $core.withContext(function($ctx1) {
  36192. var $1,$receiver;
  36193. $1=self["@instructions"];
  36194. if(($receiver = $1) == null || $receiver.isNil){
  36195. self["@instructions"]=$recv($globals.OrderedCollection)._new();
  36196. return self["@instructions"];
  36197. } else {
  36198. return $1;
  36199. };
  36200. }, function($ctx1) {$ctx1.fill(self,"instructions",{},$globals.IRInstruction)});
  36201. },
  36202. args: [],
  36203. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  36204. referencedClasses: ["OrderedCollection"],
  36205. messageSends: ["ifNil:", "new"]
  36206. }),
  36207. $globals.IRInstruction);
  36208. $core.addMethod(
  36209. $core.method({
  36210. selector: "isClosure",
  36211. protocol: 'testing',
  36212. fn: function (){
  36213. var self=this;
  36214. return false;
  36215. },
  36216. args: [],
  36217. source: "isClosure\x0a\x09^ false",
  36218. referencedClasses: [],
  36219. messageSends: []
  36220. }),
  36221. $globals.IRInstruction);
  36222. $core.addMethod(
  36223. $core.method({
  36224. selector: "isInlined",
  36225. protocol: 'testing',
  36226. fn: function (){
  36227. var self=this;
  36228. return false;
  36229. },
  36230. args: [],
  36231. source: "isInlined\x0a\x09^ false",
  36232. referencedClasses: [],
  36233. messageSends: []
  36234. }),
  36235. $globals.IRInstruction);
  36236. $core.addMethod(
  36237. $core.method({
  36238. selector: "isLocalReturn",
  36239. protocol: 'testing',
  36240. fn: function (){
  36241. var self=this;
  36242. return false;
  36243. },
  36244. args: [],
  36245. source: "isLocalReturn\x0a\x09^ false",
  36246. referencedClasses: [],
  36247. messageSends: []
  36248. }),
  36249. $globals.IRInstruction);
  36250. $core.addMethod(
  36251. $core.method({
  36252. selector: "isMethod",
  36253. protocol: 'testing',
  36254. fn: function (){
  36255. var self=this;
  36256. return false;
  36257. },
  36258. args: [],
  36259. source: "isMethod\x0a\x09^ false",
  36260. referencedClasses: [],
  36261. messageSends: []
  36262. }),
  36263. $globals.IRInstruction);
  36264. $core.addMethod(
  36265. $core.method({
  36266. selector: "isReturn",
  36267. protocol: 'testing',
  36268. fn: function (){
  36269. var self=this;
  36270. return false;
  36271. },
  36272. args: [],
  36273. source: "isReturn\x0a\x09^ false",
  36274. referencedClasses: [],
  36275. messageSends: []
  36276. }),
  36277. $globals.IRInstruction);
  36278. $core.addMethod(
  36279. $core.method({
  36280. selector: "isSend",
  36281. protocol: 'testing',
  36282. fn: function (){
  36283. var self=this;
  36284. return false;
  36285. },
  36286. args: [],
  36287. source: "isSend\x0a\x09^ false",
  36288. referencedClasses: [],
  36289. messageSends: []
  36290. }),
  36291. $globals.IRInstruction);
  36292. $core.addMethod(
  36293. $core.method({
  36294. selector: "isSequence",
  36295. protocol: 'testing',
  36296. fn: function (){
  36297. var self=this;
  36298. return false;
  36299. },
  36300. args: [],
  36301. source: "isSequence\x0a\x09^ false",
  36302. referencedClasses: [],
  36303. messageSends: []
  36304. }),
  36305. $globals.IRInstruction);
  36306. $core.addMethod(
  36307. $core.method({
  36308. selector: "isTempDeclaration",
  36309. protocol: 'testing',
  36310. fn: function (){
  36311. var self=this;
  36312. return false;
  36313. },
  36314. args: [],
  36315. source: "isTempDeclaration\x0a\x09^ false",
  36316. referencedClasses: [],
  36317. messageSends: []
  36318. }),
  36319. $globals.IRInstruction);
  36320. $core.addMethod(
  36321. $core.method({
  36322. selector: "isVariable",
  36323. protocol: 'testing',
  36324. fn: function (){
  36325. var self=this;
  36326. return false;
  36327. },
  36328. args: [],
  36329. source: "isVariable\x0a\x09^ false",
  36330. referencedClasses: [],
  36331. messageSends: []
  36332. }),
  36333. $globals.IRInstruction);
  36334. $core.addMethod(
  36335. $core.method({
  36336. selector: "method",
  36337. protocol: 'accessing',
  36338. fn: function (){
  36339. var self=this;
  36340. return $core.withContext(function($ctx1) {
  36341. return $recv(self._parent())._method();
  36342. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  36343. },
  36344. args: [],
  36345. source: "method\x0a\x09^ self parent method",
  36346. referencedClasses: [],
  36347. messageSends: ["method", "parent"]
  36348. }),
  36349. $globals.IRInstruction);
  36350. $core.addMethod(
  36351. $core.method({
  36352. selector: "needsBoxingAsReceiver",
  36353. protocol: 'testing',
  36354. fn: function (){
  36355. var self=this;
  36356. return true;
  36357. },
  36358. args: [],
  36359. source: "needsBoxingAsReceiver\x0a\x09^ true",
  36360. referencedClasses: [],
  36361. messageSends: []
  36362. }),
  36363. $globals.IRInstruction);
  36364. $core.addMethod(
  36365. $core.method({
  36366. selector: "parent",
  36367. protocol: 'accessing',
  36368. fn: function (){
  36369. var self=this;
  36370. return self["@parent"];
  36371. },
  36372. args: [],
  36373. source: "parent\x0a\x09^ parent",
  36374. referencedClasses: [],
  36375. messageSends: []
  36376. }),
  36377. $globals.IRInstruction);
  36378. $core.addMethod(
  36379. $core.method({
  36380. selector: "parent:",
  36381. protocol: 'accessing',
  36382. fn: function (anIRInstruction){
  36383. var self=this;
  36384. self["@parent"]=anIRInstruction;
  36385. return self;
  36386. },
  36387. args: ["anIRInstruction"],
  36388. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  36389. referencedClasses: [],
  36390. messageSends: []
  36391. }),
  36392. $globals.IRInstruction);
  36393. $core.addMethod(
  36394. $core.method({
  36395. selector: "remove",
  36396. protocol: 'building',
  36397. fn: function (){
  36398. var self=this;
  36399. return $core.withContext(function($ctx1) {
  36400. $recv(self._parent())._remove_(self);
  36401. return self;
  36402. }, function($ctx1) {$ctx1.fill(self,"remove",{},$globals.IRInstruction)});
  36403. },
  36404. args: [],
  36405. source: "remove\x0a\x09self parent remove: self",
  36406. referencedClasses: [],
  36407. messageSends: ["remove:", "parent"]
  36408. }),
  36409. $globals.IRInstruction);
  36410. $core.addMethod(
  36411. $core.method({
  36412. selector: "remove:",
  36413. protocol: 'building',
  36414. fn: function (anIRInstruction){
  36415. var self=this;
  36416. return $core.withContext(function($ctx1) {
  36417. $recv(self._instructions())._remove_(anIRInstruction);
  36418. return self;
  36419. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  36420. },
  36421. args: ["anIRInstruction"],
  36422. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  36423. referencedClasses: [],
  36424. messageSends: ["remove:", "instructions"]
  36425. }),
  36426. $globals.IRInstruction);
  36427. $core.addMethod(
  36428. $core.method({
  36429. selector: "replace:with:",
  36430. protocol: 'building',
  36431. fn: function (anIRInstruction,anotherIRInstruction){
  36432. var self=this;
  36433. return $core.withContext(function($ctx1) {
  36434. var $1;
  36435. $recv(anotherIRInstruction)._parent_(self);
  36436. $1=self._instructions();
  36437. $ctx1.sendIdx["instructions"]=1;
  36438. $recv($1)._at_put_($recv(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  36439. return self;
  36440. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  36441. },
  36442. args: ["anIRInstruction", "anotherIRInstruction"],
  36443. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  36444. referencedClasses: [],
  36445. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"]
  36446. }),
  36447. $globals.IRInstruction);
  36448. $core.addMethod(
  36449. $core.method({
  36450. selector: "replaceWith:",
  36451. protocol: 'building',
  36452. fn: function (anIRInstruction){
  36453. var self=this;
  36454. return $core.withContext(function($ctx1) {
  36455. $recv(self._parent())._replace_with_(self,anIRInstruction);
  36456. return self;
  36457. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  36458. },
  36459. args: ["anIRInstruction"],
  36460. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  36461. referencedClasses: [],
  36462. messageSends: ["replace:with:", "parent"]
  36463. }),
  36464. $globals.IRInstruction);
  36465. $core.addMethod(
  36466. $core.method({
  36467. selector: "scope",
  36468. protocol: 'accessing',
  36469. fn: function (){
  36470. var self=this;
  36471. return $core.withContext(function($ctx1) {
  36472. var $1,$receiver;
  36473. $1=self._parent();
  36474. if(($receiver = $1) == null || $receiver.isNil){
  36475. return $1;
  36476. } else {
  36477. var node;
  36478. node=$receiver;
  36479. return $recv(node)._scope();
  36480. };
  36481. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  36482. },
  36483. args: [],
  36484. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  36485. referencedClasses: [],
  36486. messageSends: ["ifNotNil:", "parent", "scope"]
  36487. }),
  36488. $globals.IRInstruction);
  36489. $core.addMethod(
  36490. $core.method({
  36491. selector: "on:",
  36492. protocol: 'instance creation',
  36493. fn: function (aBuilder){
  36494. var self=this;
  36495. return $core.withContext(function($ctx1) {
  36496. var $1;
  36497. $1=self._new();
  36498. $recv($1)._builder_(aBuilder);
  36499. return $recv($1)._yourself();
  36500. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)});
  36501. },
  36502. args: ["aBuilder"],
  36503. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  36504. referencedClasses: [],
  36505. messageSends: ["builder:", "new", "yourself"]
  36506. }),
  36507. $globals.IRInstruction.klass);
  36508. $core.addClass('IRAssignment', $globals.IRInstruction, [], 'Compiler-IR');
  36509. $core.addMethod(
  36510. $core.method({
  36511. selector: "accept:",
  36512. protocol: 'visiting',
  36513. fn: function (aVisitor){
  36514. var self=this;
  36515. return $core.withContext(function($ctx1) {
  36516. return $recv(aVisitor)._visitIRAssignment_(self);
  36517. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRAssignment)});
  36518. },
  36519. args: ["aVisitor"],
  36520. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  36521. referencedClasses: [],
  36522. messageSends: ["visitIRAssignment:"]
  36523. }),
  36524. $globals.IRAssignment);
  36525. $core.addClass('IRDynamicArray', $globals.IRInstruction, [], 'Compiler-IR');
  36526. $core.addMethod(
  36527. $core.method({
  36528. selector: "accept:",
  36529. protocol: 'visiting',
  36530. fn: function (aVisitor){
  36531. var self=this;
  36532. return $core.withContext(function($ctx1) {
  36533. return $recv(aVisitor)._visitIRDynamicArray_(self);
  36534. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  36535. },
  36536. args: ["aVisitor"],
  36537. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  36538. referencedClasses: [],
  36539. messageSends: ["visitIRDynamicArray:"]
  36540. }),
  36541. $globals.IRDynamicArray);
  36542. $core.addClass('IRDynamicDictionary', $globals.IRInstruction, [], 'Compiler-IR');
  36543. $core.addMethod(
  36544. $core.method({
  36545. selector: "accept:",
  36546. protocol: 'visiting',
  36547. fn: function (aVisitor){
  36548. var self=this;
  36549. return $core.withContext(function($ctx1) {
  36550. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  36551. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  36552. },
  36553. args: ["aVisitor"],
  36554. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  36555. referencedClasses: [],
  36556. messageSends: ["visitIRDynamicDictionary:"]
  36557. }),
  36558. $globals.IRDynamicDictionary);
  36559. $core.addClass('IRScopedInstruction', $globals.IRInstruction, ['scope'], 'Compiler-IR');
  36560. $core.addMethod(
  36561. $core.method({
  36562. selector: "scope",
  36563. protocol: 'accessing',
  36564. fn: function (){
  36565. var self=this;
  36566. return self["@scope"];
  36567. },
  36568. args: [],
  36569. source: "scope\x0a\x09^ scope",
  36570. referencedClasses: [],
  36571. messageSends: []
  36572. }),
  36573. $globals.IRScopedInstruction);
  36574. $core.addMethod(
  36575. $core.method({
  36576. selector: "scope:",
  36577. protocol: 'accessing',
  36578. fn: function (aScope){
  36579. var self=this;
  36580. self["@scope"]=aScope;
  36581. return self;
  36582. },
  36583. args: ["aScope"],
  36584. source: "scope: aScope\x0a\x09scope := aScope",
  36585. referencedClasses: [],
  36586. messageSends: []
  36587. }),
  36588. $globals.IRScopedInstruction);
  36589. $core.addClass('IRClosureInstruction', $globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  36590. $core.addMethod(
  36591. $core.method({
  36592. selector: "arguments",
  36593. protocol: 'accessing',
  36594. fn: function (){
  36595. var self=this;
  36596. return $core.withContext(function($ctx1) {
  36597. var $1,$receiver;
  36598. $1=self["@arguments"];
  36599. if(($receiver = $1) == null || $receiver.isNil){
  36600. return [];
  36601. } else {
  36602. return $1;
  36603. };
  36604. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  36605. },
  36606. args: [],
  36607. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  36608. referencedClasses: [],
  36609. messageSends: ["ifNil:"]
  36610. }),
  36611. $globals.IRClosureInstruction);
  36612. $core.addMethod(
  36613. $core.method({
  36614. selector: "arguments:",
  36615. protocol: 'accessing',
  36616. fn: function (aCollection){
  36617. var self=this;
  36618. self["@arguments"]=aCollection;
  36619. return self;
  36620. },
  36621. args: ["aCollection"],
  36622. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  36623. referencedClasses: [],
  36624. messageSends: []
  36625. }),
  36626. $globals.IRClosureInstruction);
  36627. $core.addMethod(
  36628. $core.method({
  36629. selector: "locals",
  36630. protocol: 'accessing',
  36631. fn: function (){
  36632. var self=this;
  36633. return $core.withContext(function($ctx1) {
  36634. var $1;
  36635. $1=$recv(self._arguments())._copy();
  36636. $recv($1)._addAll_($recv(self._tempDeclarations())._collect_((function(each){
  36637. return $core.withContext(function($ctx2) {
  36638. return $recv(each)._name();
  36639. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36640. })));
  36641. return $recv($1)._yourself();
  36642. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  36643. },
  36644. args: [],
  36645. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  36646. referencedClasses: [],
  36647. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  36648. }),
  36649. $globals.IRClosureInstruction);
  36650. $core.addMethod(
  36651. $core.method({
  36652. selector: "requiresSmalltalkContext",
  36653. protocol: 'accessing',
  36654. fn: function (){
  36655. var self=this;
  36656. return $core.withContext(function($ctx1) {
  36657. var $1,$receiver;
  36658. $1=self["@requiresSmalltalkContext"];
  36659. if(($receiver = $1) == null || $receiver.isNil){
  36660. return false;
  36661. } else {
  36662. return $1;
  36663. };
  36664. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  36665. },
  36666. args: [],
  36667. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  36668. referencedClasses: [],
  36669. messageSends: ["ifNil:"]
  36670. }),
  36671. $globals.IRClosureInstruction);
  36672. $core.addMethod(
  36673. $core.method({
  36674. selector: "requiresSmalltalkContext:",
  36675. protocol: 'accessing',
  36676. fn: function (anObject){
  36677. var self=this;
  36678. self["@requiresSmalltalkContext"]=anObject;
  36679. return self;
  36680. },
  36681. args: ["anObject"],
  36682. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  36683. referencedClasses: [],
  36684. messageSends: []
  36685. }),
  36686. $globals.IRClosureInstruction);
  36687. $core.addMethod(
  36688. $core.method({
  36689. selector: "scope:",
  36690. protocol: 'accessing',
  36691. fn: function (aScope){
  36692. var self=this;
  36693. return $core.withContext(function($ctx1) {
  36694. (
  36695. $ctx1.supercall = true,
  36696. ($globals.IRClosureInstruction.superclass||$boot.dnu).fn.prototype._scope_.apply($recv(self), [aScope]));
  36697. $ctx1.supercall = false;
  36698. $recv(aScope)._instruction_(self);
  36699. return self;
  36700. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  36701. },
  36702. args: ["aScope"],
  36703. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  36704. referencedClasses: [],
  36705. messageSends: ["scope:", "instruction:"]
  36706. }),
  36707. $globals.IRClosureInstruction);
  36708. $core.addMethod(
  36709. $core.method({
  36710. selector: "tempDeclarations",
  36711. protocol: 'accessing',
  36712. fn: function (){
  36713. var self=this;
  36714. return $core.withContext(function($ctx1) {
  36715. return $recv(self._instructions())._select_((function(each){
  36716. return $core.withContext(function($ctx2) {
  36717. return $recv(each)._isTempDeclaration();
  36718. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36719. }));
  36720. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  36721. },
  36722. args: [],
  36723. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  36724. referencedClasses: [],
  36725. messageSends: ["select:", "instructions", "isTempDeclaration"]
  36726. }),
  36727. $globals.IRClosureInstruction);
  36728. $core.addClass('IRClosure', $globals.IRClosureInstruction, [], 'Compiler-IR');
  36729. $core.addMethod(
  36730. $core.method({
  36731. selector: "accept:",
  36732. protocol: 'visiting',
  36733. fn: function (aVisitor){
  36734. var self=this;
  36735. return $core.withContext(function($ctx1) {
  36736. return $recv(aVisitor)._visitIRClosure_(self);
  36737. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRClosure)});
  36738. },
  36739. args: ["aVisitor"],
  36740. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  36741. referencedClasses: [],
  36742. messageSends: ["visitIRClosure:"]
  36743. }),
  36744. $globals.IRClosure);
  36745. $core.addMethod(
  36746. $core.method({
  36747. selector: "isClosure",
  36748. protocol: 'testing',
  36749. fn: function (){
  36750. var self=this;
  36751. return true;
  36752. },
  36753. args: [],
  36754. source: "isClosure\x0a\x09^ true",
  36755. referencedClasses: [],
  36756. messageSends: []
  36757. }),
  36758. $globals.IRClosure);
  36759. $core.addMethod(
  36760. $core.method({
  36761. selector: "sequence",
  36762. protocol: 'accessing',
  36763. fn: function (){
  36764. var self=this;
  36765. return $core.withContext(function($ctx1) {
  36766. return $recv(self._instructions())._last();
  36767. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  36768. },
  36769. args: [],
  36770. source: "sequence\x0a\x09^ self instructions last",
  36771. referencedClasses: [],
  36772. messageSends: ["last", "instructions"]
  36773. }),
  36774. $globals.IRClosure);
  36775. $core.addClass('IRMethod', $globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  36776. $globals.IRMethod.comment="I am a method instruction";
  36777. $core.addMethod(
  36778. $core.method({
  36779. selector: "accept:",
  36780. protocol: 'visiting',
  36781. fn: function (aVisitor){
  36782. var self=this;
  36783. return $core.withContext(function($ctx1) {
  36784. return $recv(aVisitor)._visitIRMethod_(self);
  36785. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRMethod)});
  36786. },
  36787. args: ["aVisitor"],
  36788. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  36789. referencedClasses: [],
  36790. messageSends: ["visitIRMethod:"]
  36791. }),
  36792. $globals.IRMethod);
  36793. $core.addMethod(
  36794. $core.method({
  36795. selector: "classReferences",
  36796. protocol: 'accessing',
  36797. fn: function (){
  36798. var self=this;
  36799. return self["@classReferences"];
  36800. },
  36801. args: [],
  36802. source: "classReferences\x0a\x09^ classReferences",
  36803. referencedClasses: [],
  36804. messageSends: []
  36805. }),
  36806. $globals.IRMethod);
  36807. $core.addMethod(
  36808. $core.method({
  36809. selector: "classReferences:",
  36810. protocol: 'accessing',
  36811. fn: function (aCollection){
  36812. var self=this;
  36813. self["@classReferences"]=aCollection;
  36814. return self;
  36815. },
  36816. args: ["aCollection"],
  36817. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  36818. referencedClasses: [],
  36819. messageSends: []
  36820. }),
  36821. $globals.IRMethod);
  36822. $core.addMethod(
  36823. $core.method({
  36824. selector: "internalVariables",
  36825. protocol: 'accessing',
  36826. fn: function (){
  36827. var self=this;
  36828. return $core.withContext(function($ctx1) {
  36829. var $1,$receiver;
  36830. $1=self["@internalVariables"];
  36831. if(($receiver = $1) == null || $receiver.isNil){
  36832. self["@internalVariables"]=$recv($globals.Set)._new();
  36833. return self["@internalVariables"];
  36834. } else {
  36835. return $1;
  36836. };
  36837. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  36838. },
  36839. args: [],
  36840. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  36841. referencedClasses: ["Set"],
  36842. messageSends: ["ifNil:", "new"]
  36843. }),
  36844. $globals.IRMethod);
  36845. $core.addMethod(
  36846. $core.method({
  36847. selector: "isMethod",
  36848. protocol: 'accessing',
  36849. fn: function (){
  36850. var self=this;
  36851. return true;
  36852. },
  36853. args: [],
  36854. source: "isMethod\x0a\x09^ true",
  36855. referencedClasses: [],
  36856. messageSends: []
  36857. }),
  36858. $globals.IRMethod);
  36859. $core.addMethod(
  36860. $core.method({
  36861. selector: "messageSends",
  36862. protocol: 'accessing',
  36863. fn: function (){
  36864. var self=this;
  36865. return $core.withContext(function($ctx1) {
  36866. return $recv(self._sendIndexes())._keys();
  36867. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  36868. },
  36869. args: [],
  36870. source: "messageSends\x0a\x09^ self sendIndexes keys",
  36871. referencedClasses: [],
  36872. messageSends: ["keys", "sendIndexes"]
  36873. }),
  36874. $globals.IRMethod);
  36875. $core.addMethod(
  36876. $core.method({
  36877. selector: "method",
  36878. protocol: 'accessing',
  36879. fn: function (){
  36880. var self=this;
  36881. return self;
  36882. },
  36883. args: [],
  36884. source: "method\x0a\x09^ self",
  36885. referencedClasses: [],
  36886. messageSends: []
  36887. }),
  36888. $globals.IRMethod);
  36889. $core.addMethod(
  36890. $core.method({
  36891. selector: "selector",
  36892. protocol: 'accessing',
  36893. fn: function (){
  36894. var self=this;
  36895. return self["@selector"];
  36896. },
  36897. args: [],
  36898. source: "selector\x0a\x09^ selector",
  36899. referencedClasses: [],
  36900. messageSends: []
  36901. }),
  36902. $globals.IRMethod);
  36903. $core.addMethod(
  36904. $core.method({
  36905. selector: "selector:",
  36906. protocol: 'accessing',
  36907. fn: function (aString){
  36908. var self=this;
  36909. self["@selector"]=aString;
  36910. return self;
  36911. },
  36912. args: ["aString"],
  36913. source: "selector: aString\x0a\x09selector := aString",
  36914. referencedClasses: [],
  36915. messageSends: []
  36916. }),
  36917. $globals.IRMethod);
  36918. $core.addMethod(
  36919. $core.method({
  36920. selector: "sendIndexes",
  36921. protocol: 'accessing',
  36922. fn: function (){
  36923. var self=this;
  36924. return self["@sendIndexes"];
  36925. },
  36926. args: [],
  36927. source: "sendIndexes\x0a\x09^ sendIndexes",
  36928. referencedClasses: [],
  36929. messageSends: []
  36930. }),
  36931. $globals.IRMethod);
  36932. $core.addMethod(
  36933. $core.method({
  36934. selector: "sendIndexes:",
  36935. protocol: 'accessing',
  36936. fn: function (aDictionary){
  36937. var self=this;
  36938. self["@sendIndexes"]=aDictionary;
  36939. return self;
  36940. },
  36941. args: ["aDictionary"],
  36942. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  36943. referencedClasses: [],
  36944. messageSends: []
  36945. }),
  36946. $globals.IRMethod);
  36947. $core.addMethod(
  36948. $core.method({
  36949. selector: "source",
  36950. protocol: 'accessing',
  36951. fn: function (){
  36952. var self=this;
  36953. return self["@source"];
  36954. },
  36955. args: [],
  36956. source: "source\x0a\x09^ source",
  36957. referencedClasses: [],
  36958. messageSends: []
  36959. }),
  36960. $globals.IRMethod);
  36961. $core.addMethod(
  36962. $core.method({
  36963. selector: "source:",
  36964. protocol: 'accessing',
  36965. fn: function (aString){
  36966. var self=this;
  36967. self["@source"]=aString;
  36968. return self;
  36969. },
  36970. args: ["aString"],
  36971. source: "source: aString\x0a\x09source := aString",
  36972. referencedClasses: [],
  36973. messageSends: []
  36974. }),
  36975. $globals.IRMethod);
  36976. $core.addMethod(
  36977. $core.method({
  36978. selector: "theClass",
  36979. protocol: 'accessing',
  36980. fn: function (){
  36981. var self=this;
  36982. return self["@theClass"];
  36983. },
  36984. args: [],
  36985. source: "theClass\x0a\x09^ theClass",
  36986. referencedClasses: [],
  36987. messageSends: []
  36988. }),
  36989. $globals.IRMethod);
  36990. $core.addMethod(
  36991. $core.method({
  36992. selector: "theClass:",
  36993. protocol: 'accessing',
  36994. fn: function (aClass){
  36995. var self=this;
  36996. self["@theClass"]=aClass;
  36997. return self;
  36998. },
  36999. args: ["aClass"],
  37000. source: "theClass: aClass\x0a\x09theClass := aClass",
  37001. referencedClasses: [],
  37002. messageSends: []
  37003. }),
  37004. $globals.IRMethod);
  37005. $core.addClass('IRReturn', $globals.IRScopedInstruction, [], 'Compiler-IR');
  37006. $globals.IRReturn.comment="I am a local return instruction.";
  37007. $core.addMethod(
  37008. $core.method({
  37009. selector: "accept:",
  37010. protocol: 'visiting',
  37011. fn: function (aVisitor){
  37012. var self=this;
  37013. return $core.withContext(function($ctx1) {
  37014. return $recv(aVisitor)._visitIRReturn_(self);
  37015. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRReturn)});
  37016. },
  37017. args: ["aVisitor"],
  37018. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  37019. referencedClasses: [],
  37020. messageSends: ["visitIRReturn:"]
  37021. }),
  37022. $globals.IRReturn);
  37023. $core.addMethod(
  37024. $core.method({
  37025. selector: "canBeAssigned",
  37026. protocol: 'testing',
  37027. fn: function (){
  37028. var self=this;
  37029. return false;
  37030. },
  37031. args: [],
  37032. source: "canBeAssigned\x0a\x09^ false",
  37033. referencedClasses: [],
  37034. messageSends: []
  37035. }),
  37036. $globals.IRReturn);
  37037. $core.addMethod(
  37038. $core.method({
  37039. selector: "isBlockReturn",
  37040. protocol: 'testing',
  37041. fn: function (){
  37042. var self=this;
  37043. return false;
  37044. },
  37045. args: [],
  37046. source: "isBlockReturn\x0a\x09^ false",
  37047. referencedClasses: [],
  37048. messageSends: []
  37049. }),
  37050. $globals.IRReturn);
  37051. $core.addMethod(
  37052. $core.method({
  37053. selector: "isLocalReturn",
  37054. protocol: 'testing',
  37055. fn: function (){
  37056. var self=this;
  37057. return true;
  37058. },
  37059. args: [],
  37060. source: "isLocalReturn\x0a\x09^ true",
  37061. referencedClasses: [],
  37062. messageSends: []
  37063. }),
  37064. $globals.IRReturn);
  37065. $core.addMethod(
  37066. $core.method({
  37067. selector: "isNonLocalReturn",
  37068. protocol: 'testing',
  37069. fn: function (){
  37070. var self=this;
  37071. return $core.withContext(function($ctx1) {
  37072. return $recv(self._isLocalReturn())._not();
  37073. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},$globals.IRReturn)});
  37074. },
  37075. args: [],
  37076. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  37077. referencedClasses: [],
  37078. messageSends: ["not", "isLocalReturn"]
  37079. }),
  37080. $globals.IRReturn);
  37081. $core.addMethod(
  37082. $core.method({
  37083. selector: "isReturn",
  37084. protocol: 'testing',
  37085. fn: function (){
  37086. var self=this;
  37087. return true;
  37088. },
  37089. args: [],
  37090. source: "isReturn\x0a\x09^ true",
  37091. referencedClasses: [],
  37092. messageSends: []
  37093. }),
  37094. $globals.IRReturn);
  37095. $core.addMethod(
  37096. $core.method({
  37097. selector: "scope",
  37098. protocol: 'accessing',
  37099. fn: function (){
  37100. var self=this;
  37101. return $core.withContext(function($ctx1) {
  37102. var $1,$receiver;
  37103. $1=self["@scope"];
  37104. if(($receiver = $1) == null || $receiver.isNil){
  37105. return $recv(self._parent())._scope();
  37106. } else {
  37107. return $1;
  37108. };
  37109. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  37110. },
  37111. args: [],
  37112. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  37113. referencedClasses: [],
  37114. messageSends: ["ifNil:", "scope", "parent"]
  37115. }),
  37116. $globals.IRReturn);
  37117. $core.addClass('IRBlockReturn', $globals.IRReturn, [], 'Compiler-IR');
  37118. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  37119. $core.addMethod(
  37120. $core.method({
  37121. selector: "accept:",
  37122. protocol: 'visiting',
  37123. fn: function (aVisitor){
  37124. var self=this;
  37125. return $core.withContext(function($ctx1) {
  37126. return $recv(aVisitor)._visitIRBlockReturn_(self);
  37127. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  37128. },
  37129. args: ["aVisitor"],
  37130. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  37131. referencedClasses: [],
  37132. messageSends: ["visitIRBlockReturn:"]
  37133. }),
  37134. $globals.IRBlockReturn);
  37135. $core.addMethod(
  37136. $core.method({
  37137. selector: "isBlockReturn",
  37138. protocol: 'testing',
  37139. fn: function (){
  37140. var self=this;
  37141. return true;
  37142. },
  37143. args: [],
  37144. source: "isBlockReturn\x0a\x09^ true",
  37145. referencedClasses: [],
  37146. messageSends: []
  37147. }),
  37148. $globals.IRBlockReturn);
  37149. $core.addClass('IRNonLocalReturn', $globals.IRReturn, [], 'Compiler-IR');
  37150. $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.";
  37151. $core.addMethod(
  37152. $core.method({
  37153. selector: "accept:",
  37154. protocol: 'visiting',
  37155. fn: function (aVisitor){
  37156. var self=this;
  37157. return $core.withContext(function($ctx1) {
  37158. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  37159. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  37160. },
  37161. args: ["aVisitor"],
  37162. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  37163. referencedClasses: [],
  37164. messageSends: ["visitIRNonLocalReturn:"]
  37165. }),
  37166. $globals.IRNonLocalReturn);
  37167. $core.addMethod(
  37168. $core.method({
  37169. selector: "isLocalReturn",
  37170. protocol: 'testing',
  37171. fn: function (){
  37172. var self=this;
  37173. return false;
  37174. },
  37175. args: [],
  37176. source: "isLocalReturn\x0a\x09^ false",
  37177. referencedClasses: [],
  37178. messageSends: []
  37179. }),
  37180. $globals.IRNonLocalReturn);
  37181. $core.addClass('IRTempDeclaration', $globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  37182. $core.addMethod(
  37183. $core.method({
  37184. selector: "accept:",
  37185. protocol: 'visiting',
  37186. fn: function (aVisitor){
  37187. var self=this;
  37188. return $core.withContext(function($ctx1) {
  37189. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  37190. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  37191. },
  37192. args: ["aVisitor"],
  37193. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  37194. referencedClasses: [],
  37195. messageSends: ["visitIRTempDeclaration:"]
  37196. }),
  37197. $globals.IRTempDeclaration);
  37198. $core.addMethod(
  37199. $core.method({
  37200. selector: "isTempDeclaration",
  37201. protocol: 'testing',
  37202. fn: function (){
  37203. var self=this;
  37204. return true;
  37205. },
  37206. args: [],
  37207. source: "isTempDeclaration\x0a\x09^ true",
  37208. referencedClasses: [],
  37209. messageSends: []
  37210. }),
  37211. $globals.IRTempDeclaration);
  37212. $core.addMethod(
  37213. $core.method({
  37214. selector: "name",
  37215. protocol: 'accessing',
  37216. fn: function (){
  37217. var self=this;
  37218. return self["@name"];
  37219. },
  37220. args: [],
  37221. source: "name\x0a\x09^ name",
  37222. referencedClasses: [],
  37223. messageSends: []
  37224. }),
  37225. $globals.IRTempDeclaration);
  37226. $core.addMethod(
  37227. $core.method({
  37228. selector: "name:",
  37229. protocol: 'accessing',
  37230. fn: function (aString){
  37231. var self=this;
  37232. self["@name"]=aString;
  37233. return self;
  37234. },
  37235. args: ["aString"],
  37236. source: "name: aString\x0a\x09name := aString",
  37237. referencedClasses: [],
  37238. messageSends: []
  37239. }),
  37240. $globals.IRTempDeclaration);
  37241. $core.addClass('IRSend', $globals.IRInstruction, ['selector', 'index'], 'Compiler-IR');
  37242. $globals.IRSend.comment="I am a message send instruction.";
  37243. $core.addMethod(
  37244. $core.method({
  37245. selector: "accept:",
  37246. protocol: 'visiting',
  37247. fn: function (aVisitor){
  37248. var self=this;
  37249. return $core.withContext(function($ctx1) {
  37250. return $recv(aVisitor)._visitIRSend_(self);
  37251. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSend)});
  37252. },
  37253. args: ["aVisitor"],
  37254. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  37255. referencedClasses: [],
  37256. messageSends: ["visitIRSend:"]
  37257. }),
  37258. $globals.IRSend);
  37259. $core.addMethod(
  37260. $core.method({
  37261. selector: "index",
  37262. protocol: 'accessing',
  37263. fn: function (){
  37264. var self=this;
  37265. return self["@index"];
  37266. },
  37267. args: [],
  37268. source: "index\x0a\x09^ index",
  37269. referencedClasses: [],
  37270. messageSends: []
  37271. }),
  37272. $globals.IRSend);
  37273. $core.addMethod(
  37274. $core.method({
  37275. selector: "index:",
  37276. protocol: 'accessing',
  37277. fn: function (anInteger){
  37278. var self=this;
  37279. self["@index"]=anInteger;
  37280. return self;
  37281. },
  37282. args: ["anInteger"],
  37283. source: "index: anInteger\x0a\x09index := anInteger",
  37284. referencedClasses: [],
  37285. messageSends: []
  37286. }),
  37287. $globals.IRSend);
  37288. $core.addMethod(
  37289. $core.method({
  37290. selector: "isSend",
  37291. protocol: 'testing',
  37292. fn: function (){
  37293. var self=this;
  37294. return true;
  37295. },
  37296. args: [],
  37297. source: "isSend\x0a\x09^ true",
  37298. referencedClasses: [],
  37299. messageSends: []
  37300. }),
  37301. $globals.IRSend);
  37302. $core.addMethod(
  37303. $core.method({
  37304. selector: "isSuperSend",
  37305. protocol: 'accessing',
  37306. fn: function (){
  37307. var self=this;
  37308. var receiver;
  37309. return $core.withContext(function($ctx1) {
  37310. receiver=$recv(self._instructions())._first();
  37311. return $recv($recv(receiver)._isVariable())._and_((function(){
  37312. return $core.withContext(function($ctx2) {
  37313. return $recv($recv($recv(receiver)._variable())._name()).__eq("super");
  37314. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37315. }));
  37316. }, function($ctx1) {$ctx1.fill(self,"isSuperSend",{receiver:receiver},$globals.IRSend)});
  37317. },
  37318. args: [],
  37319. source: "isSuperSend\x0a\x09| receiver |\x0a\x09receiver := self instructions first.\x0a\x09^ receiver isVariable and: [ receiver variable name = 'super' ]",
  37320. referencedClasses: [],
  37321. messageSends: ["first", "instructions", "and:", "isVariable", "=", "name", "variable"]
  37322. }),
  37323. $globals.IRSend);
  37324. $core.addMethod(
  37325. $core.method({
  37326. selector: "selector",
  37327. protocol: 'accessing',
  37328. fn: function (){
  37329. var self=this;
  37330. return self["@selector"];
  37331. },
  37332. args: [],
  37333. source: "selector\x0a\x09^ selector",
  37334. referencedClasses: [],
  37335. messageSends: []
  37336. }),
  37337. $globals.IRSend);
  37338. $core.addMethod(
  37339. $core.method({
  37340. selector: "selector:",
  37341. protocol: 'accessing',
  37342. fn: function (aString){
  37343. var self=this;
  37344. self["@selector"]=aString;
  37345. return self;
  37346. },
  37347. args: ["aString"],
  37348. source: "selector: aString\x0a\x09selector := aString",
  37349. referencedClasses: [],
  37350. messageSends: []
  37351. }),
  37352. $globals.IRSend);
  37353. $core.addClass('IRSequence', $globals.IRInstruction, [], 'Compiler-IR');
  37354. $core.addMethod(
  37355. $core.method({
  37356. selector: "accept:",
  37357. protocol: 'visiting',
  37358. fn: function (aVisitor){
  37359. var self=this;
  37360. return $core.withContext(function($ctx1) {
  37361. return $recv(aVisitor)._visitIRSequence_(self);
  37362. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSequence)});
  37363. },
  37364. args: ["aVisitor"],
  37365. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  37366. referencedClasses: [],
  37367. messageSends: ["visitIRSequence:"]
  37368. }),
  37369. $globals.IRSequence);
  37370. $core.addMethod(
  37371. $core.method({
  37372. selector: "isSequence",
  37373. protocol: 'testing',
  37374. fn: function (){
  37375. var self=this;
  37376. return true;
  37377. },
  37378. args: [],
  37379. source: "isSequence\x0a\x09^ true",
  37380. referencedClasses: [],
  37381. messageSends: []
  37382. }),
  37383. $globals.IRSequence);
  37384. $core.addClass('IRBlockSequence', $globals.IRSequence, [], 'Compiler-IR');
  37385. $core.addMethod(
  37386. $core.method({
  37387. selector: "accept:",
  37388. protocol: 'visiting',
  37389. fn: function (aVisitor){
  37390. var self=this;
  37391. return $core.withContext(function($ctx1) {
  37392. return $recv(aVisitor)._visitIRBlockSequence_(self);
  37393. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  37394. },
  37395. args: ["aVisitor"],
  37396. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  37397. referencedClasses: [],
  37398. messageSends: ["visitIRBlockSequence:"]
  37399. }),
  37400. $globals.IRBlockSequence);
  37401. $core.addClass('IRValue', $globals.IRInstruction, ['value'], 'Compiler-IR');
  37402. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  37403. $core.addMethod(
  37404. $core.method({
  37405. selector: "accept:",
  37406. protocol: 'visiting',
  37407. fn: function (aVisitor){
  37408. var self=this;
  37409. return $core.withContext(function($ctx1) {
  37410. return $recv(aVisitor)._visitIRValue_(self);
  37411. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRValue)});
  37412. },
  37413. args: ["aVisitor"],
  37414. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  37415. referencedClasses: [],
  37416. messageSends: ["visitIRValue:"]
  37417. }),
  37418. $globals.IRValue);
  37419. $core.addMethod(
  37420. $core.method({
  37421. selector: "needsBoxingAsReceiver",
  37422. protocol: 'testing',
  37423. fn: function (){
  37424. var self=this;
  37425. return false;
  37426. },
  37427. args: [],
  37428. source: "needsBoxingAsReceiver\x0a\x09^ false",
  37429. referencedClasses: [],
  37430. messageSends: []
  37431. }),
  37432. $globals.IRValue);
  37433. $core.addMethod(
  37434. $core.method({
  37435. selector: "value",
  37436. protocol: 'accessing',
  37437. fn: function (){
  37438. var self=this;
  37439. return self["@value"];
  37440. },
  37441. args: [],
  37442. source: "value\x0a\x09^ value",
  37443. referencedClasses: [],
  37444. messageSends: []
  37445. }),
  37446. $globals.IRValue);
  37447. $core.addMethod(
  37448. $core.method({
  37449. selector: "value:",
  37450. protocol: 'accessing',
  37451. fn: function (aString){
  37452. var self=this;
  37453. self["@value"]=aString;
  37454. return self;
  37455. },
  37456. args: ["aString"],
  37457. source: "value: aString\x0a\x09value := aString",
  37458. referencedClasses: [],
  37459. messageSends: []
  37460. }),
  37461. $globals.IRValue);
  37462. $core.addClass('IRVariable', $globals.IRInstruction, ['variable'], 'Compiler-IR');
  37463. $globals.IRVariable.comment="I am a variable instruction.";
  37464. $core.addMethod(
  37465. $core.method({
  37466. selector: "accept:",
  37467. protocol: 'visiting',
  37468. fn: function (aVisitor){
  37469. var self=this;
  37470. return $core.withContext(function($ctx1) {
  37471. return $recv(aVisitor)._visitIRVariable_(self);
  37472. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVariable)});
  37473. },
  37474. args: ["aVisitor"],
  37475. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  37476. referencedClasses: [],
  37477. messageSends: ["visitIRVariable:"]
  37478. }),
  37479. $globals.IRVariable);
  37480. $core.addMethod(
  37481. $core.method({
  37482. selector: "isVariable",
  37483. protocol: 'testing',
  37484. fn: function (){
  37485. var self=this;
  37486. return true;
  37487. },
  37488. args: [],
  37489. source: "isVariable\x0a\x09^ true",
  37490. referencedClasses: [],
  37491. messageSends: []
  37492. }),
  37493. $globals.IRVariable);
  37494. $core.addMethod(
  37495. $core.method({
  37496. selector: "needsBoxingAsReceiver",
  37497. protocol: 'testing',
  37498. fn: function (){
  37499. var self=this;
  37500. return $core.withContext(function($ctx1) {
  37501. return $recv($recv(self._variable())._isPseudoVar())._not();
  37502. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  37503. },
  37504. args: [],
  37505. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  37506. referencedClasses: [],
  37507. messageSends: ["not", "isPseudoVar", "variable"]
  37508. }),
  37509. $globals.IRVariable);
  37510. $core.addMethod(
  37511. $core.method({
  37512. selector: "variable",
  37513. protocol: 'accessing',
  37514. fn: function (){
  37515. var self=this;
  37516. return self["@variable"];
  37517. },
  37518. args: [],
  37519. source: "variable\x0a\x09^ variable",
  37520. referencedClasses: [],
  37521. messageSends: []
  37522. }),
  37523. $globals.IRVariable);
  37524. $core.addMethod(
  37525. $core.method({
  37526. selector: "variable:",
  37527. protocol: 'accessing',
  37528. fn: function (aScopeVariable){
  37529. var self=this;
  37530. self["@variable"]=aScopeVariable;
  37531. return self;
  37532. },
  37533. args: ["aScopeVariable"],
  37534. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  37535. referencedClasses: [],
  37536. messageSends: []
  37537. }),
  37538. $globals.IRVariable);
  37539. $core.addClass('IRVerbatim', $globals.IRInstruction, ['source'], 'Compiler-IR');
  37540. $core.addMethod(
  37541. $core.method({
  37542. selector: "accept:",
  37543. protocol: 'visiting',
  37544. fn: function (aVisitor){
  37545. var self=this;
  37546. return $core.withContext(function($ctx1) {
  37547. return $recv(aVisitor)._visitIRVerbatim_(self);
  37548. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  37549. },
  37550. args: ["aVisitor"],
  37551. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  37552. referencedClasses: [],
  37553. messageSends: ["visitIRVerbatim:"]
  37554. }),
  37555. $globals.IRVerbatim);
  37556. $core.addMethod(
  37557. $core.method({
  37558. selector: "source",
  37559. protocol: 'accessing',
  37560. fn: function (){
  37561. var self=this;
  37562. return self["@source"];
  37563. },
  37564. args: [],
  37565. source: "source\x0a\x09^ source",
  37566. referencedClasses: [],
  37567. messageSends: []
  37568. }),
  37569. $globals.IRVerbatim);
  37570. $core.addMethod(
  37571. $core.method({
  37572. selector: "source:",
  37573. protocol: 'accessing',
  37574. fn: function (aString){
  37575. var self=this;
  37576. self["@source"]=aString;
  37577. return self;
  37578. },
  37579. args: ["aString"],
  37580. source: "source: aString\x0a\x09source := aString",
  37581. referencedClasses: [],
  37582. messageSends: []
  37583. }),
  37584. $globals.IRVerbatim);
  37585. $core.addClass('IRVisitor', $globals.Object, [], 'Compiler-IR');
  37586. $core.addMethod(
  37587. $core.method({
  37588. selector: "visit:",
  37589. protocol: 'visiting',
  37590. fn: function (anIRInstruction){
  37591. var self=this;
  37592. return $core.withContext(function($ctx1) {
  37593. return $recv(anIRInstruction)._accept_(self);
  37594. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  37595. },
  37596. args: ["anIRInstruction"],
  37597. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  37598. referencedClasses: [],
  37599. messageSends: ["accept:"]
  37600. }),
  37601. $globals.IRVisitor);
  37602. $core.addMethod(
  37603. $core.method({
  37604. selector: "visitIRAssignment:",
  37605. protocol: 'visiting',
  37606. fn: function (anIRAssignment){
  37607. var self=this;
  37608. return $core.withContext(function($ctx1) {
  37609. return self._visitIRInstruction_(anIRAssignment);
  37610. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  37611. },
  37612. args: ["anIRAssignment"],
  37613. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  37614. referencedClasses: [],
  37615. messageSends: ["visitIRInstruction:"]
  37616. }),
  37617. $globals.IRVisitor);
  37618. $core.addMethod(
  37619. $core.method({
  37620. selector: "visitIRBlockReturn:",
  37621. protocol: 'visiting',
  37622. fn: function (anIRBlockReturn){
  37623. var self=this;
  37624. return $core.withContext(function($ctx1) {
  37625. return self._visitIRReturn_(anIRBlockReturn);
  37626. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  37627. },
  37628. args: ["anIRBlockReturn"],
  37629. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  37630. referencedClasses: [],
  37631. messageSends: ["visitIRReturn:"]
  37632. }),
  37633. $globals.IRVisitor);
  37634. $core.addMethod(
  37635. $core.method({
  37636. selector: "visitIRBlockSequence:",
  37637. protocol: 'visiting',
  37638. fn: function (anIRBlockSequence){
  37639. var self=this;
  37640. return $core.withContext(function($ctx1) {
  37641. return self._visitIRSequence_(anIRBlockSequence);
  37642. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  37643. },
  37644. args: ["anIRBlockSequence"],
  37645. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  37646. referencedClasses: [],
  37647. messageSends: ["visitIRSequence:"]
  37648. }),
  37649. $globals.IRVisitor);
  37650. $core.addMethod(
  37651. $core.method({
  37652. selector: "visitIRClosure:",
  37653. protocol: 'visiting',
  37654. fn: function (anIRClosure){
  37655. var self=this;
  37656. return $core.withContext(function($ctx1) {
  37657. return self._visitIRInstruction_(anIRClosure);
  37658. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  37659. },
  37660. args: ["anIRClosure"],
  37661. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  37662. referencedClasses: [],
  37663. messageSends: ["visitIRInstruction:"]
  37664. }),
  37665. $globals.IRVisitor);
  37666. $core.addMethod(
  37667. $core.method({
  37668. selector: "visitIRDynamicArray:",
  37669. protocol: 'visiting',
  37670. fn: function (anIRDynamicArray){
  37671. var self=this;
  37672. return $core.withContext(function($ctx1) {
  37673. return self._visitIRInstruction_(anIRDynamicArray);
  37674. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  37675. },
  37676. args: ["anIRDynamicArray"],
  37677. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  37678. referencedClasses: [],
  37679. messageSends: ["visitIRInstruction:"]
  37680. }),
  37681. $globals.IRVisitor);
  37682. $core.addMethod(
  37683. $core.method({
  37684. selector: "visitIRDynamicDictionary:",
  37685. protocol: 'visiting',
  37686. fn: function (anIRDynamicDictionary){
  37687. var self=this;
  37688. return $core.withContext(function($ctx1) {
  37689. return self._visitIRInstruction_(anIRDynamicDictionary);
  37690. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  37691. },
  37692. args: ["anIRDynamicDictionary"],
  37693. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  37694. referencedClasses: [],
  37695. messageSends: ["visitIRInstruction:"]
  37696. }),
  37697. $globals.IRVisitor);
  37698. $core.addMethod(
  37699. $core.method({
  37700. selector: "visitIRInlinedClosure:",
  37701. protocol: 'visiting',
  37702. fn: function (anIRInlinedClosure){
  37703. var self=this;
  37704. return $core.withContext(function($ctx1) {
  37705. return self._visitIRClosure_(anIRInlinedClosure);
  37706. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  37707. },
  37708. args: ["anIRInlinedClosure"],
  37709. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  37710. referencedClasses: [],
  37711. messageSends: ["visitIRClosure:"]
  37712. }),
  37713. $globals.IRVisitor);
  37714. $core.addMethod(
  37715. $core.method({
  37716. selector: "visitIRInlinedSequence:",
  37717. protocol: 'visiting',
  37718. fn: function (anIRInlinedSequence){
  37719. var self=this;
  37720. return $core.withContext(function($ctx1) {
  37721. return self._visitIRSequence_(anIRInlinedSequence);
  37722. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  37723. },
  37724. args: ["anIRInlinedSequence"],
  37725. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  37726. referencedClasses: [],
  37727. messageSends: ["visitIRSequence:"]
  37728. }),
  37729. $globals.IRVisitor);
  37730. $core.addMethod(
  37731. $core.method({
  37732. selector: "visitIRInstruction:",
  37733. protocol: 'visiting',
  37734. fn: function (anIRInstruction){
  37735. var self=this;
  37736. return $core.withContext(function($ctx1) {
  37737. $recv($recv(anIRInstruction)._instructions())._do_((function(each){
  37738. return $core.withContext(function($ctx2) {
  37739. return self._visit_(each);
  37740. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37741. }));
  37742. return anIRInstruction;
  37743. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  37744. },
  37745. args: ["anIRInstruction"],
  37746. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  37747. referencedClasses: [],
  37748. messageSends: ["do:", "instructions", "visit:"]
  37749. }),
  37750. $globals.IRVisitor);
  37751. $core.addMethod(
  37752. $core.method({
  37753. selector: "visitIRMethod:",
  37754. protocol: 'visiting',
  37755. fn: function (anIRMethod){
  37756. var self=this;
  37757. return $core.withContext(function($ctx1) {
  37758. return self._visitIRInstruction_(anIRMethod);
  37759. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  37760. },
  37761. args: ["anIRMethod"],
  37762. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  37763. referencedClasses: [],
  37764. messageSends: ["visitIRInstruction:"]
  37765. }),
  37766. $globals.IRVisitor);
  37767. $core.addMethod(
  37768. $core.method({
  37769. selector: "visitIRNonLocalReturn:",
  37770. protocol: 'visiting',
  37771. fn: function (anIRNonLocalReturn){
  37772. var self=this;
  37773. return $core.withContext(function($ctx1) {
  37774. return self._visitIRInstruction_(anIRNonLocalReturn);
  37775. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  37776. },
  37777. args: ["anIRNonLocalReturn"],
  37778. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  37779. referencedClasses: [],
  37780. messageSends: ["visitIRInstruction:"]
  37781. }),
  37782. $globals.IRVisitor);
  37783. $core.addMethod(
  37784. $core.method({
  37785. selector: "visitIRNonLocalReturnHandling:",
  37786. protocol: 'visiting',
  37787. fn: function (anIRNonLocalReturnHandling){
  37788. var self=this;
  37789. return $core.withContext(function($ctx1) {
  37790. return self._visitIRInstruction_(anIRNonLocalReturnHandling);
  37791. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  37792. },
  37793. args: ["anIRNonLocalReturnHandling"],
  37794. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  37795. referencedClasses: [],
  37796. messageSends: ["visitIRInstruction:"]
  37797. }),
  37798. $globals.IRVisitor);
  37799. $core.addMethod(
  37800. $core.method({
  37801. selector: "visitIRReturn:",
  37802. protocol: 'visiting',
  37803. fn: function (anIRReturn){
  37804. var self=this;
  37805. return $core.withContext(function($ctx1) {
  37806. return self._visitIRInstruction_(anIRReturn);
  37807. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  37808. },
  37809. args: ["anIRReturn"],
  37810. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  37811. referencedClasses: [],
  37812. messageSends: ["visitIRInstruction:"]
  37813. }),
  37814. $globals.IRVisitor);
  37815. $core.addMethod(
  37816. $core.method({
  37817. selector: "visitIRSend:",
  37818. protocol: 'visiting',
  37819. fn: function (anIRSend){
  37820. var self=this;
  37821. return $core.withContext(function($ctx1) {
  37822. return self._visitIRInstruction_(anIRSend);
  37823. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  37824. },
  37825. args: ["anIRSend"],
  37826. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  37827. referencedClasses: [],
  37828. messageSends: ["visitIRInstruction:"]
  37829. }),
  37830. $globals.IRVisitor);
  37831. $core.addMethod(
  37832. $core.method({
  37833. selector: "visitIRSequence:",
  37834. protocol: 'visiting',
  37835. fn: function (anIRSequence){
  37836. var self=this;
  37837. return $core.withContext(function($ctx1) {
  37838. return self._visitIRInstruction_(anIRSequence);
  37839. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  37840. },
  37841. args: ["anIRSequence"],
  37842. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  37843. referencedClasses: [],
  37844. messageSends: ["visitIRInstruction:"]
  37845. }),
  37846. $globals.IRVisitor);
  37847. $core.addMethod(
  37848. $core.method({
  37849. selector: "visitIRTempDeclaration:",
  37850. protocol: 'visiting',
  37851. fn: function (anIRTempDeclaration){
  37852. var self=this;
  37853. return $core.withContext(function($ctx1) {
  37854. return self._visitIRInstruction_(anIRTempDeclaration);
  37855. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  37856. },
  37857. args: ["anIRTempDeclaration"],
  37858. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  37859. referencedClasses: [],
  37860. messageSends: ["visitIRInstruction:"]
  37861. }),
  37862. $globals.IRVisitor);
  37863. $core.addMethod(
  37864. $core.method({
  37865. selector: "visitIRValue:",
  37866. protocol: 'visiting',
  37867. fn: function (anIRValue){
  37868. var self=this;
  37869. return $core.withContext(function($ctx1) {
  37870. return self._visitIRInstruction_(anIRValue);
  37871. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  37872. },
  37873. args: ["anIRValue"],
  37874. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  37875. referencedClasses: [],
  37876. messageSends: ["visitIRInstruction:"]
  37877. }),
  37878. $globals.IRVisitor);
  37879. $core.addMethod(
  37880. $core.method({
  37881. selector: "visitIRVariable:",
  37882. protocol: 'visiting',
  37883. fn: function (anIRVariable){
  37884. var self=this;
  37885. return $core.withContext(function($ctx1) {
  37886. return self._visitIRInstruction_(anIRVariable);
  37887. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  37888. },
  37889. args: ["anIRVariable"],
  37890. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  37891. referencedClasses: [],
  37892. messageSends: ["visitIRInstruction:"]
  37893. }),
  37894. $globals.IRVisitor);
  37895. $core.addMethod(
  37896. $core.method({
  37897. selector: "visitIRVerbatim:",
  37898. protocol: 'visiting',
  37899. fn: function (anIRVerbatim){
  37900. var self=this;
  37901. return $core.withContext(function($ctx1) {
  37902. return self._visitIRInstruction_(anIRVerbatim);
  37903. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  37904. },
  37905. args: ["anIRVerbatim"],
  37906. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  37907. referencedClasses: [],
  37908. messageSends: ["visitIRInstruction:"]
  37909. }),
  37910. $globals.IRVisitor);
  37911. $core.addClass('IRJSTranslator', $globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  37912. $core.addMethod(
  37913. $core.method({
  37914. selector: "contents",
  37915. protocol: 'accessing',
  37916. fn: function (){
  37917. var self=this;
  37918. return $core.withContext(function($ctx1) {
  37919. return $recv(self._stream())._contents();
  37920. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  37921. },
  37922. args: [],
  37923. source: "contents\x0a\x09^ self stream contents",
  37924. referencedClasses: [],
  37925. messageSends: ["contents", "stream"]
  37926. }),
  37927. $globals.IRJSTranslator);
  37928. $core.addMethod(
  37929. $core.method({
  37930. selector: "currentClass",
  37931. protocol: 'accessing',
  37932. fn: function (){
  37933. var self=this;
  37934. return self["@currentClass"];
  37935. },
  37936. args: [],
  37937. source: "currentClass\x0a\x09^ currentClass",
  37938. referencedClasses: [],
  37939. messageSends: []
  37940. }),
  37941. $globals.IRJSTranslator);
  37942. $core.addMethod(
  37943. $core.method({
  37944. selector: "currentClass:",
  37945. protocol: 'accessing',
  37946. fn: function (aClass){
  37947. var self=this;
  37948. self["@currentClass"]=aClass;
  37949. return self;
  37950. },
  37951. args: ["aClass"],
  37952. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  37953. referencedClasses: [],
  37954. messageSends: []
  37955. }),
  37956. $globals.IRJSTranslator);
  37957. $core.addMethod(
  37958. $core.method({
  37959. selector: "initialize",
  37960. protocol: 'initialization',
  37961. fn: function (){
  37962. var self=this;
  37963. return $core.withContext(function($ctx1) {
  37964. (
  37965. $ctx1.supercall = true,
  37966. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  37967. $ctx1.supercall = false;
  37968. self["@stream"]=$recv($globals.JSStream)._new();
  37969. return self;
  37970. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  37971. },
  37972. args: [],
  37973. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  37974. referencedClasses: ["JSStream"],
  37975. messageSends: ["initialize", "new"]
  37976. }),
  37977. $globals.IRJSTranslator);
  37978. $core.addMethod(
  37979. $core.method({
  37980. selector: "stream",
  37981. protocol: 'accessing',
  37982. fn: function (){
  37983. var self=this;
  37984. return self["@stream"];
  37985. },
  37986. args: [],
  37987. source: "stream\x0a\x09^ stream",
  37988. referencedClasses: [],
  37989. messageSends: []
  37990. }),
  37991. $globals.IRJSTranslator);
  37992. $core.addMethod(
  37993. $core.method({
  37994. selector: "stream:",
  37995. protocol: 'accessing',
  37996. fn: function (aStream){
  37997. var self=this;
  37998. self["@stream"]=aStream;
  37999. return self;
  38000. },
  38001. args: ["aStream"],
  38002. source: "stream: aStream\x0a\x09stream := aStream",
  38003. referencedClasses: [],
  38004. messageSends: []
  38005. }),
  38006. $globals.IRJSTranslator);
  38007. $core.addMethod(
  38008. $core.method({
  38009. selector: "visitIRAssignment:",
  38010. protocol: 'visiting',
  38011. fn: function (anIRAssignment){
  38012. var self=this;
  38013. return $core.withContext(function($ctx1) {
  38014. var $2,$1;
  38015. $recv(self._stream())._nextPutAssignLhs_rhs_((function(){
  38016. return $core.withContext(function($ctx2) {
  38017. $2=$recv(anIRAssignment)._instructions();
  38018. $ctx2.sendIdx["instructions"]=1;
  38019. $1=$recv($2)._first();
  38020. return self._visit_($1);
  38021. $ctx2.sendIdx["visit:"]=1;
  38022. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38023. }),(function(){
  38024. return $core.withContext(function($ctx2) {
  38025. return self._visit_($recv($recv(anIRAssignment)._instructions())._last());
  38026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38027. }));
  38028. return self;
  38029. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  38030. },
  38031. args: ["anIRAssignment"],
  38032. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment instructions first]\x0a\x09\x09rhs: [self visit: anIRAssignment instructions last].",
  38033. referencedClasses: [],
  38034. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "first", "instructions", "last"]
  38035. }),
  38036. $globals.IRJSTranslator);
  38037. $core.addMethod(
  38038. $core.method({
  38039. selector: "visitIRClosure:",
  38040. protocol: 'visiting',
  38041. fn: function (anIRClosure){
  38042. var self=this;
  38043. return $core.withContext(function($ctx1) {
  38044. var $1,$2;
  38045. $1=self._stream();
  38046. $ctx1.sendIdx["stream"]=1;
  38047. $recv($1)._nextPutClosureWith_arguments_((function(){
  38048. return $core.withContext(function($ctx2) {
  38049. $2=self._stream();
  38050. $ctx2.sendIdx["stream"]=2;
  38051. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  38052. return $core.withContext(function($ctx3) {
  38053. return $recv($recv(each)._name())._asVariableName();
  38054. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38055. })));
  38056. return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  38057. return $core.withContext(function($ctx3) {
  38058. return (
  38059. $ctx3.supercall = true,
  38060. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure]));
  38061. $ctx3.supercall = false;
  38062. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  38063. }));
  38064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38065. }),$recv(anIRClosure)._arguments());
  38066. return self;
  38067. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  38068. },
  38069. args: ["anIRClosure"],
  38070. 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",
  38071. referencedClasses: [],
  38072. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  38073. }),
  38074. $globals.IRJSTranslator);
  38075. $core.addMethod(
  38076. $core.method({
  38077. selector: "visitIRDynamicArray:",
  38078. protocol: 'visiting',
  38079. fn: function (anIRDynamicArray){
  38080. var self=this;
  38081. return $core.withContext(function($ctx1) {
  38082. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._instructions(),"[","]");
  38083. return self;
  38084. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  38085. },
  38086. args: ["anIRDynamicArray"],
  38087. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray instructions\x0a\x09\x09enclosedBetween: '[' and: ']'",
  38088. referencedClasses: [],
  38089. messageSends: ["visitInstructionList:enclosedBetween:and:", "instructions"]
  38090. }),
  38091. $globals.IRJSTranslator);
  38092. $core.addMethod(
  38093. $core.method({
  38094. selector: "visitIRDynamicDictionary:",
  38095. protocol: 'visiting',
  38096. fn: function (anIRDynamicDictionary){
  38097. var self=this;
  38098. return $core.withContext(function($ctx1) {
  38099. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._instructions(),"$globals.HashedCollection._newFromPairs_([","])");
  38100. return self;
  38101. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  38102. },
  38103. args: ["anIRDynamicDictionary"],
  38104. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary instructions\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  38105. referencedClasses: [],
  38106. messageSends: ["visitInstructionList:enclosedBetween:and:", "instructions"]
  38107. }),
  38108. $globals.IRJSTranslator);
  38109. $core.addMethod(
  38110. $core.method({
  38111. selector: "visitIRMethod:",
  38112. protocol: 'visiting',
  38113. fn: function (anIRMethod){
  38114. var self=this;
  38115. return $core.withContext(function($ctx1) {
  38116. var $1,$2,$3,$4,$5,$7,$6,$8,$9;
  38117. $1=self._stream();
  38118. $ctx1.sendIdx["stream"]=1;
  38119. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  38120. return $core.withContext(function($ctx2) {
  38121. $2=self._stream();
  38122. $ctx2.sendIdx["stream"]=2;
  38123. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  38124. return $core.withContext(function($ctx3) {
  38125. $3=self._stream();
  38126. $ctx3.sendIdx["stream"]=3;
  38127. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  38128. return $core.withContext(function($ctx4) {
  38129. return $recv($recv(each)._name())._asVariableName();
  38130. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  38131. }));
  38132. $ctx3.sendIdx["collect:"]=1;
  38133. $recv($3)._nextPutVars_($4);
  38134. $ctx3.sendIdx["nextPutVars:"]=1;
  38135. $5=self._stream();
  38136. $ctx3.sendIdx["stream"]=4;
  38137. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  38138. return $core.withContext(function($ctx4) {
  38139. $7=$recv(anIRMethod)._internalVariables();
  38140. $ctx4.sendIdx["internalVariables"]=1;
  38141. $6=$recv($7)._notEmpty();
  38142. if($core.assert($6)){
  38143. $8=self._stream();
  38144. $ctx4.sendIdx["stream"]=5;
  38145. $recv($8)._nextPutVars_($recv($recv($recv(anIRMethod)._internalVariables())._asSet())._collect_((function(each){
  38146. return $core.withContext(function($ctx5) {
  38147. return $recv($recv(each)._variable())._alias();
  38148. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,6)});
  38149. })));
  38150. };
  38151. $9=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  38152. if($core.assert($9)){
  38153. return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  38154. return $core.withContext(function($ctx5) {
  38155. return (
  38156. $ctx5.supercall = true,
  38157. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  38158. $ctx5.supercall = false;
  38159. $ctx5.sendIdx["visitIRMethod:"]=1;
  38160. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  38161. }));
  38162. } else {
  38163. return (
  38164. $ctx4.supercall = true,
  38165. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  38166. $ctx4.supercall = false;
  38167. };
  38168. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  38169. }));
  38170. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  38171. }),$recv(anIRMethod)._arguments());
  38172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38173. }));
  38174. return self;
  38175. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  38176. },
  38177. args: ["anIRMethod"],
  38178. 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\x09anIRMethod internalVariables notEmpty ifTrue: [\x0a\x09\x09\x09\x09\x09self stream nextPutVars: (anIRMethod internalVariables asSet collect: [ :each |\x0a\x09\x09\x09\x09\x09\x09each 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 ]",
  38179. referencedClasses: [],
  38180. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutContextFor:during:", "ifTrue:", "notEmpty", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"]
  38181. }),
  38182. $globals.IRJSTranslator);
  38183. $core.addMethod(
  38184. $core.method({
  38185. selector: "visitIRNonLocalReturn:",
  38186. protocol: 'visiting',
  38187. fn: function (anIRNonLocalReturn){
  38188. var self=this;
  38189. return $core.withContext(function($ctx1) {
  38190. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  38191. return $core.withContext(function($ctx2) {
  38192. return (
  38193. $ctx2.supercall = true,
  38194. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  38195. $ctx2.supercall = false;
  38196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38197. }));
  38198. return self;
  38199. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  38200. },
  38201. args: ["anIRNonLocalReturn"],
  38202. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  38203. referencedClasses: [],
  38204. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  38205. }),
  38206. $globals.IRJSTranslator);
  38207. $core.addMethod(
  38208. $core.method({
  38209. selector: "visitIRReturn:",
  38210. protocol: 'visiting',
  38211. fn: function (anIRReturn){
  38212. var self=this;
  38213. return $core.withContext(function($ctx1) {
  38214. $recv(self._stream())._nextPutReturnWith_((function(){
  38215. return $core.withContext(function($ctx2) {
  38216. return (
  38217. $ctx2.supercall = true,
  38218. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  38219. $ctx2.supercall = false;
  38220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38221. }));
  38222. return self;
  38223. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  38224. },
  38225. args: ["anIRReturn"],
  38226. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  38227. referencedClasses: [],
  38228. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  38229. }),
  38230. $globals.IRJSTranslator);
  38231. $core.addMethod(
  38232. $core.method({
  38233. selector: "visitIRSend:",
  38234. protocol: 'visiting',
  38235. fn: function (anIRSend){
  38236. var self=this;
  38237. var sends,superclass;
  38238. return $core.withContext(function($ctx1) {
  38239. var $1,$2;
  38240. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  38241. $1=$recv(anIRSend)._isSuperSend();
  38242. if($core.assert($1)){
  38243. self._visitSuperSend_(anIRSend);
  38244. } else {
  38245. self._visitSend_(anIRSend);
  38246. };
  38247. $2=$recv($recv(sends).__gt((1)))._and_((function(){
  38248. return $core.withContext(function($ctx2) {
  38249. return $recv($recv(anIRSend)._index()).__lt(sends);
  38250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38251. }));
  38252. if($core.assert($2)){
  38253. $recv(self._stream())._nextPutSendIndexFor_(anIRSend);
  38254. };
  38255. return self;
  38256. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  38257. },
  38258. args: ["anIRSend"],
  38259. 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\x09(sends > 1 and: [ anIRSend index < sends ])\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  38260. referencedClasses: [],
  38261. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuperSend", "visitSuperSend:", "visitSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"]
  38262. }),
  38263. $globals.IRJSTranslator);
  38264. $core.addMethod(
  38265. $core.method({
  38266. selector: "visitIRSequence:",
  38267. protocol: 'visiting',
  38268. fn: function (anIRSequence){
  38269. var self=this;
  38270. return $core.withContext(function($ctx1) {
  38271. var $1;
  38272. $1=self._stream();
  38273. $ctx1.sendIdx["stream"]=1;
  38274. $recv($1)._nextPutSequenceWith_((function(){
  38275. return $core.withContext(function($ctx2) {
  38276. return $recv($recv(anIRSequence)._instructions())._do_((function(each){
  38277. return $core.withContext(function($ctx3) {
  38278. return $recv(self._stream())._nextPutStatementWith_(self._visit_(each));
  38279. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38280. }));
  38281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38282. }));
  38283. return self;
  38284. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  38285. },
  38286. args: ["anIRSequence"],
  38287. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  38288. referencedClasses: [],
  38289. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"]
  38290. }),
  38291. $globals.IRJSTranslator);
  38292. $core.addMethod(
  38293. $core.method({
  38294. selector: "visitIRTempDeclaration:",
  38295. protocol: 'visiting',
  38296. fn: function (anIRTempDeclaration){
  38297. var self=this;
  38298. return self;
  38299. },
  38300. args: ["anIRTempDeclaration"],
  38301. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  38302. referencedClasses: [],
  38303. messageSends: []
  38304. }),
  38305. $globals.IRJSTranslator);
  38306. $core.addMethod(
  38307. $core.method({
  38308. selector: "visitIRValue:",
  38309. protocol: 'visiting',
  38310. fn: function (anIRValue){
  38311. var self=this;
  38312. return $core.withContext(function($ctx1) {
  38313. $recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavascript());
  38314. return self;
  38315. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  38316. },
  38317. args: ["anIRValue"],
  38318. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  38319. referencedClasses: [],
  38320. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"]
  38321. }),
  38322. $globals.IRJSTranslator);
  38323. $core.addMethod(
  38324. $core.method({
  38325. selector: "visitIRVariable:",
  38326. protocol: 'visiting',
  38327. fn: function (anIRVariable){
  38328. var self=this;
  38329. return $core.withContext(function($ctx1) {
  38330. var $3,$2,$1,$4;
  38331. $3=$recv(anIRVariable)._variable();
  38332. $ctx1.sendIdx["variable"]=1;
  38333. $2=$recv($3)._name();
  38334. $1=$recv($2).__eq("thisContext");
  38335. if($core.assert($1)){
  38336. $4=self._stream();
  38337. $ctx1.sendIdx["stream"]=1;
  38338. $recv($4)._nextPutAll_("$core.getThisContext()");
  38339. $ctx1.sendIdx["nextPutAll:"]=1;
  38340. } else {
  38341. $recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  38342. };
  38343. return self;
  38344. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  38345. },
  38346. args: ["anIRVariable"],
  38347. 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 ]",
  38348. referencedClasses: [],
  38349. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  38350. }),
  38351. $globals.IRJSTranslator);
  38352. $core.addMethod(
  38353. $core.method({
  38354. selector: "visitIRVerbatim:",
  38355. protocol: 'visiting',
  38356. fn: function (anIRVerbatim){
  38357. var self=this;
  38358. return $core.withContext(function($ctx1) {
  38359. var $1;
  38360. $1=self._stream();
  38361. $ctx1.sendIdx["stream"]=1;
  38362. $recv($1)._nextPutStatementWith_((function(){
  38363. return $core.withContext(function($ctx2) {
  38364. return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  38365. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38366. }));
  38367. return self;
  38368. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  38369. },
  38370. args: ["anIRVerbatim"],
  38371. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  38372. referencedClasses: [],
  38373. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  38374. }),
  38375. $globals.IRJSTranslator);
  38376. $core.addMethod(
  38377. $core.method({
  38378. selector: "visitInstructionList:enclosedBetween:and:",
  38379. protocol: 'visiting',
  38380. fn: function (anArray,aString,anotherString){
  38381. var self=this;
  38382. return $core.withContext(function($ctx1) {
  38383. var $1;
  38384. $1=self._stream();
  38385. $ctx1.sendIdx["stream"]=1;
  38386. $recv($1)._nextPutAll_(aString);
  38387. $ctx1.sendIdx["nextPutAll:"]=1;
  38388. $recv(anArray)._do_separatedBy_((function(each){
  38389. return $core.withContext(function($ctx2) {
  38390. return self._visit_(each);
  38391. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38392. }),(function(){
  38393. return $core.withContext(function($ctx2) {
  38394. return $recv(self._stream())._nextPutAll_(",");
  38395. $ctx2.sendIdx["nextPutAll:"]=2;
  38396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38397. }));
  38398. $recv(self["@stream"])._nextPutAll_(anotherString);
  38399. return self;
  38400. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  38401. },
  38402. args: ["anArray", "aString", "anotherString"],
  38403. 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",
  38404. referencedClasses: [],
  38405. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  38406. }),
  38407. $globals.IRJSTranslator);
  38408. $core.addMethod(
  38409. $core.method({
  38410. selector: "visitReceiver:",
  38411. protocol: 'visiting',
  38412. fn: function (anIRInstruction){
  38413. var self=this;
  38414. return $core.withContext(function($ctx1) {
  38415. var $1,$2,$3;
  38416. $1=$recv(anIRInstruction)._needsBoxingAsReceiver();
  38417. if(!$core.assert($1)){
  38418. $2=self._visit_(anIRInstruction);
  38419. $ctx1.sendIdx["visit:"]=1;
  38420. return $2;
  38421. };
  38422. $3=self._stream();
  38423. $ctx1.sendIdx["stream"]=1;
  38424. $recv($3)._nextPutAll_("$recv(");
  38425. $ctx1.sendIdx["nextPutAll:"]=1;
  38426. self._visit_(anIRInstruction);
  38427. $recv(self._stream())._nextPutAll_(")");
  38428. return self;
  38429. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)});
  38430. },
  38431. args: ["anIRInstruction"],
  38432. 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: ')'",
  38433. referencedClasses: [],
  38434. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  38435. }),
  38436. $globals.IRJSTranslator);
  38437. $core.addMethod(
  38438. $core.method({
  38439. selector: "visitSend:",
  38440. protocol: 'visiting',
  38441. fn: function (anIRSend){
  38442. var self=this;
  38443. return $core.withContext(function($ctx1) {
  38444. var $2,$1;
  38445. $2=$recv(anIRSend)._instructions();
  38446. $ctx1.sendIdx["instructions"]=1;
  38447. $1=$recv($2)._first();
  38448. self._visitReceiver_($1);
  38449. $recv(self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  38450. self._visitInstructionList_enclosedBetween_and_($recv($recv(anIRSend)._instructions())._allButFirst(),"(",")");
  38451. return self;
  38452. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  38453. },
  38454. args: ["anIRSend"],
  38455. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend instructions allButFirst\x0a\x09\x09enclosedBetween: '(' and: ')'",
  38456. referencedClasses: [],
  38457. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "allButFirst"]
  38458. }),
  38459. $globals.IRJSTranslator);
  38460. $core.addMethod(
  38461. $core.method({
  38462. selector: "visitSuperSend:",
  38463. protocol: 'visiting',
  38464. fn: function (anIRSend){
  38465. var self=this;
  38466. return $core.withContext(function($ctx1) {
  38467. var $1,$4,$3,$2,$5,$6,$7,$8;
  38468. $1=self._stream();
  38469. $ctx1.sendIdx["stream"]=1;
  38470. $recv($1)._nextPutAll_("(");
  38471. $ctx1.sendIdx["nextPutAll:"]=1;
  38472. $recv($1)._lf();
  38473. $ctx1.sendIdx["lf"]=1;
  38474. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38475. $ctx1.sendIdx["nextPutAll:"]=2;
  38476. $recv($1)._lf();
  38477. $ctx1.sendIdx["lf"]=2;
  38478. $4=$recv(anIRSend)._scope();
  38479. $ctx1.sendIdx["scope"]=1;
  38480. $3=$recv($4)._alias();
  38481. $ctx1.sendIdx["alias"]=1;
  38482. $2=$recv($3).__comma(".supercall = true,");
  38483. $ctx1.sendIdx[","]=1;
  38484. $recv($1)._nextPutAll_($2);
  38485. $ctx1.sendIdx["nextPutAll:"]=3;
  38486. $recv($1)._lf();
  38487. $ctx1.sendIdx["lf"]=3;
  38488. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38489. $ctx1.sendIdx["nextPutAll:"]=4;
  38490. $recv($1)._lf();
  38491. $ctx1.sendIdx["lf"]=4;
  38492. $5="(".__comma($recv(self._currentClass())._asJavascript());
  38493. $ctx1.sendIdx[","]=2;
  38494. $recv($1)._nextPutAll_($5);
  38495. $ctx1.sendIdx["nextPutAll:"]=5;
  38496. $recv($1)._nextPutAll_(".superclass||$boot.dnu).fn.prototype.");
  38497. $ctx1.sendIdx["nextPutAll:"]=6;
  38498. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  38499. $ctx1.sendIdx[","]=3;
  38500. $recv($1)._nextPutAll_($6);
  38501. $ctx1.sendIdx["nextPutAll:"]=7;
  38502. $7=$recv($1)._nextPutAll_("$recv(self), ");
  38503. $ctx1.sendIdx["nextPutAll:"]=8;
  38504. self._visitInstructionList_enclosedBetween_and_($recv($recv(anIRSend)._instructions())._allButFirst(),"[","]");
  38505. $8=self._stream();
  38506. $recv($8)._nextPutAll_("));");
  38507. $ctx1.sendIdx["nextPutAll:"]=9;
  38508. $recv($8)._lf();
  38509. $ctx1.sendIdx["lf"]=5;
  38510. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38511. $ctx1.sendIdx["nextPutAll:"]=10;
  38512. $recv($8)._lf();
  38513. $ctx1.sendIdx["lf"]=6;
  38514. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  38515. $ctx1.sendIdx["nextPutAll:"]=11;
  38516. $recv($8)._lf();
  38517. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38518. return self;
  38519. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  38520. },
  38521. args: ["anIRSend"],
  38522. 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.dnu).fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$recv(self), '.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend instructions allButFirst\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);'",
  38523. referencedClasses: [],
  38524. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "allButFirst", "instructions"]
  38525. }),
  38526. $globals.IRJSTranslator);
  38527. $core.addClass('JSStream', $globals.Object, ['stream'], 'Compiler-IR');
  38528. $core.addMethod(
  38529. $core.method({
  38530. selector: "contents",
  38531. protocol: 'accessing',
  38532. fn: function (){
  38533. var self=this;
  38534. return $core.withContext(function($ctx1) {
  38535. return $recv(self["@stream"])._contents();
  38536. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  38537. },
  38538. args: [],
  38539. source: "contents\x0a\x09^ stream contents",
  38540. referencedClasses: [],
  38541. messageSends: ["contents"]
  38542. }),
  38543. $globals.JSStream);
  38544. $core.addMethod(
  38545. $core.method({
  38546. selector: "initialize",
  38547. protocol: 'initialization',
  38548. fn: function (){
  38549. var self=this;
  38550. return $core.withContext(function($ctx1) {
  38551. (
  38552. $ctx1.supercall = true,
  38553. ($globals.JSStream.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  38554. $ctx1.supercall = false;
  38555. self["@stream"]=""._writeStream();
  38556. return self;
  38557. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  38558. },
  38559. args: [],
  38560. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  38561. referencedClasses: [],
  38562. messageSends: ["initialize", "writeStream"]
  38563. }),
  38564. $globals.JSStream);
  38565. $core.addMethod(
  38566. $core.method({
  38567. selector: "lf",
  38568. protocol: 'streaming',
  38569. fn: function (){
  38570. var self=this;
  38571. return $core.withContext(function($ctx1) {
  38572. $recv(self["@stream"])._lf();
  38573. return self;
  38574. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  38575. },
  38576. args: [],
  38577. source: "lf\x0a\x09stream lf",
  38578. referencedClasses: [],
  38579. messageSends: ["lf"]
  38580. }),
  38581. $globals.JSStream);
  38582. $core.addMethod(
  38583. $core.method({
  38584. selector: "nextPut:",
  38585. protocol: 'streaming',
  38586. fn: function (aString){
  38587. var self=this;
  38588. return $core.withContext(function($ctx1) {
  38589. $recv(self["@stream"])._nextPut_(aString);
  38590. return self;
  38591. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  38592. },
  38593. args: ["aString"],
  38594. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  38595. referencedClasses: [],
  38596. messageSends: ["nextPut:"]
  38597. }),
  38598. $globals.JSStream);
  38599. $core.addMethod(
  38600. $core.method({
  38601. selector: "nextPutAll:",
  38602. protocol: 'streaming',
  38603. fn: function (aString){
  38604. var self=this;
  38605. return $core.withContext(function($ctx1) {
  38606. $recv(self["@stream"])._nextPutAll_(aString);
  38607. return self;
  38608. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  38609. },
  38610. args: ["aString"],
  38611. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  38612. referencedClasses: [],
  38613. messageSends: ["nextPutAll:"]
  38614. }),
  38615. $globals.JSStream);
  38616. $core.addMethod(
  38617. $core.method({
  38618. selector: "nextPutAssignLhs:rhs:",
  38619. protocol: 'streaming',
  38620. fn: function (aBlock,anotherBlock){
  38621. var self=this;
  38622. return $core.withContext(function($ctx1) {
  38623. $recv(aBlock)._value();
  38624. $ctx1.sendIdx["value"]=1;
  38625. $recv(self["@stream"])._nextPutAll_("=");
  38626. $recv(anotherBlock)._value();
  38627. return self;
  38628. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  38629. },
  38630. args: ["aBlock", "anotherBlock"],
  38631. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  38632. referencedClasses: [],
  38633. messageSends: ["value", "nextPutAll:"]
  38634. }),
  38635. $globals.JSStream);
  38636. $core.addMethod(
  38637. $core.method({
  38638. selector: "nextPutBlockContextFor:during:",
  38639. protocol: 'streaming',
  38640. fn: function (anIRClosure,aBlock){
  38641. var self=this;
  38642. return $core.withContext(function($ctx1) {
  38643. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  38644. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  38645. if(!$core.assert($1)){
  38646. $2=$recv(aBlock)._value();
  38647. $ctx1.sendIdx["value"]=1;
  38648. return $2;
  38649. };
  38650. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38651. $ctx1.sendIdx["nextPutAll:"]=1;
  38652. self._lf();
  38653. $ctx1.sendIdx["lf"]=1;
  38654. $6=$recv(anIRClosure)._scope();
  38655. $ctx1.sendIdx["scope"]=1;
  38656. $5=$recv($6)._alias();
  38657. $ctx1.sendIdx["alias"]=1;
  38658. $4="return $core.withContext(function(".__comma($5);
  38659. $ctx1.sendIdx[","]=2;
  38660. $3=$recv($4).__comma(") {");
  38661. $ctx1.sendIdx[","]=1;
  38662. self._nextPutAll_($3);
  38663. $ctx1.sendIdx["nextPutAll:"]=2;
  38664. self._lf();
  38665. $ctx1.sendIdx["lf"]=2;
  38666. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38667. $ctx1.sendIdx["nextPutAll:"]=3;
  38668. $7=self._lf();
  38669. $ctx1.sendIdx["lf"]=3;
  38670. $recv(aBlock)._value();
  38671. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38672. $ctx1.sendIdx["nextPutAll:"]=4;
  38673. self._lf();
  38674. $ctx1.sendIdx["lf"]=4;
  38675. $11=$recv(anIRClosure)._scope();
  38676. $ctx1.sendIdx["scope"]=2;
  38677. $10=$recv($11)._alias();
  38678. $ctx1.sendIdx["alias"]=2;
  38679. $9="}, function(".__comma($10);
  38680. $ctx1.sendIdx[","]=4;
  38681. $8=$recv($9).__comma(") {");
  38682. $ctx1.sendIdx[","]=3;
  38683. self._nextPutAll_($8);
  38684. $ctx1.sendIdx["nextPutAll:"]=5;
  38685. $15=$recv(anIRClosure)._scope();
  38686. $ctx1.sendIdx["scope"]=3;
  38687. $14=$recv($15)._alias();
  38688. $ctx1.sendIdx["alias"]=3;
  38689. $13=$recv($14).__comma(".fillBlock({");
  38690. $ctx1.sendIdx[","]=5;
  38691. $12=self._nextPutAll_($13);
  38692. $ctx1.sendIdx["nextPutAll:"]=6;
  38693. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  38694. return $core.withContext(function($ctx2) {
  38695. $16=$recv(each)._asVariableName();
  38696. $ctx2.sendIdx["asVariableName"]=1;
  38697. self._nextPutAll_($16);
  38698. $ctx2.sendIdx["nextPutAll:"]=7;
  38699. self._nextPutAll_(":");
  38700. $ctx2.sendIdx["nextPutAll:"]=8;
  38701. $17=self._nextPutAll_($recv(each)._asVariableName());
  38702. $ctx2.sendIdx["nextPutAll:"]=9;
  38703. return $17;
  38704. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38705. }),(function(){
  38706. return $core.withContext(function($ctx2) {
  38707. return self._nextPutAll_(",");
  38708. $ctx2.sendIdx["nextPutAll:"]=10;
  38709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38710. }));
  38711. self._nextPutAll_("},");
  38712. $ctx1.sendIdx["nextPutAll:"]=11;
  38713. $23=$recv(anIRClosure)._scope();
  38714. $ctx1.sendIdx["scope"]=4;
  38715. $22=$recv($23)._outerScope();
  38716. $21=$recv($22)._alias();
  38717. $20=$recv($21).__comma(",");
  38718. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  38719. $ctx1.sendIdx[","]=7;
  38720. $18=$recv($19).__comma(")});");
  38721. $ctx1.sendIdx[","]=6;
  38722. self._nextPutAll_($18);
  38723. $ctx1.sendIdx["nextPutAll:"]=12;
  38724. self._lf();
  38725. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38726. return self;
  38727. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  38728. },
  38729. args: ["anIRClosure", "aBlock"],
  38730. 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);'",
  38731. referencedClasses: [],
  38732. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  38733. }),
  38734. $globals.JSStream);
  38735. $core.addMethod(
  38736. $core.method({
  38737. selector: "nextPutClosureWith:arguments:",
  38738. protocol: 'streaming',
  38739. fn: function (aBlock,anArray){
  38740. var self=this;
  38741. return $core.withContext(function($ctx1) {
  38742. var $1,$2,$3;
  38743. $recv(self["@stream"])._nextPutAll_("(function(");
  38744. $ctx1.sendIdx["nextPutAll:"]=1;
  38745. $recv(anArray)._do_separatedBy_((function(each){
  38746. return $core.withContext(function($ctx2) {
  38747. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  38748. $ctx2.sendIdx["nextPutAll:"]=2;
  38749. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38750. }),(function(){
  38751. return $core.withContext(function($ctx2) {
  38752. return $recv(self["@stream"])._nextPut_(",");
  38753. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38754. }));
  38755. $1=self["@stream"];
  38756. $recv($1)._nextPutAll_("){");
  38757. $ctx1.sendIdx["nextPutAll:"]=3;
  38758. $2=$recv($1)._lf();
  38759. $ctx1.sendIdx["lf"]=1;
  38760. $recv(aBlock)._value();
  38761. $3=self["@stream"];
  38762. $recv($3)._lf();
  38763. $recv($3)._nextPutAll_("})");
  38764. return self;
  38765. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  38766. },
  38767. args: ["aBlock", "anArray"],
  38768. 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: '})'",
  38769. referencedClasses: [],
  38770. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  38771. }),
  38772. $globals.JSStream);
  38773. $core.addMethod(
  38774. $core.method({
  38775. selector: "nextPutContextFor:during:",
  38776. protocol: 'streaming',
  38777. fn: function (aMethod,aBlock){
  38778. var self=this;
  38779. return $core.withContext(function($ctx1) {
  38780. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  38781. $1=$recv(aMethod)._requiresSmalltalkContext();
  38782. if(!$core.assert($1)){
  38783. $2=$recv(aBlock)._value();
  38784. $ctx1.sendIdx["value"]=1;
  38785. return $2;
  38786. };
  38787. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38788. $ctx1.sendIdx["nextPutAll:"]=1;
  38789. self._lf();
  38790. $ctx1.sendIdx["lf"]=1;
  38791. $6=$recv(aMethod)._scope();
  38792. $ctx1.sendIdx["scope"]=1;
  38793. $5=$recv($6)._alias();
  38794. $ctx1.sendIdx["alias"]=1;
  38795. $4="return $core.withContext(function(".__comma($5);
  38796. $ctx1.sendIdx[","]=2;
  38797. $3=$recv($4).__comma(") {");
  38798. $ctx1.sendIdx[","]=1;
  38799. self._nextPutAll_($3);
  38800. $ctx1.sendIdx["nextPutAll:"]=2;
  38801. self._lf();
  38802. $ctx1.sendIdx["lf"]=2;
  38803. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38804. $ctx1.sendIdx["nextPutAll:"]=3;
  38805. $7=self._lf();
  38806. $ctx1.sendIdx["lf"]=3;
  38807. $recv(aBlock)._value();
  38808. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38809. $ctx1.sendIdx["nextPutAll:"]=4;
  38810. self._lf();
  38811. $ctx1.sendIdx["lf"]=4;
  38812. $12=$recv(aMethod)._scope();
  38813. $ctx1.sendIdx["scope"]=2;
  38814. $11=$recv($12)._alias();
  38815. $ctx1.sendIdx["alias"]=2;
  38816. $10="}, function(".__comma($11);
  38817. $ctx1.sendIdx[","]=5;
  38818. $9=$recv($10).__comma(") {");
  38819. $ctx1.sendIdx[","]=4;
  38820. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  38821. $ctx1.sendIdx[","]=3;
  38822. self._nextPutAll_($8);
  38823. $ctx1.sendIdx["nextPutAll:"]=5;
  38824. $16=$recv($recv(aMethod)._selector())._asJavascript();
  38825. $ctx1.sendIdx["asJavascript"]=1;
  38826. $15=".fill(self,".__comma($16);
  38827. $14=$recv($15).__comma(",{");
  38828. $ctx1.sendIdx[","]=6;
  38829. $13=self._nextPutAll_($14);
  38830. $ctx1.sendIdx["nextPutAll:"]=6;
  38831. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  38832. return $core.withContext(function($ctx2) {
  38833. $17=$recv(each)._asVariableName();
  38834. $ctx2.sendIdx["asVariableName"]=1;
  38835. self._nextPutAll_($17);
  38836. $ctx2.sendIdx["nextPutAll:"]=7;
  38837. self._nextPutAll_(":");
  38838. $ctx2.sendIdx["nextPutAll:"]=8;
  38839. $18=self._nextPutAll_($recv(each)._asVariableName());
  38840. $ctx2.sendIdx["nextPutAll:"]=9;
  38841. return $18;
  38842. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38843. }),(function(){
  38844. return $core.withContext(function($ctx2) {
  38845. return self._nextPutAll_(",");
  38846. $ctx2.sendIdx["nextPutAll:"]=10;
  38847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38848. }));
  38849. self._nextPutAll_("},");
  38850. $ctx1.sendIdx["nextPutAll:"]=11;
  38851. self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavascript());
  38852. $ctx1.sendIdx["nextPutAll:"]=12;
  38853. self._nextPutAll_(")});");
  38854. $ctx1.sendIdx["nextPutAll:"]=13;
  38855. self._lf();
  38856. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38857. return self;
  38858. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  38859. },
  38860. args: ["aMethod", "aBlock"],
  38861. 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);'",
  38862. referencedClasses: [],
  38863. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  38864. }),
  38865. $globals.JSStream);
  38866. $core.addMethod(
  38867. $core.method({
  38868. selector: "nextPutFunctionWith:arguments:",
  38869. protocol: 'streaming',
  38870. fn: function (aBlock,anArray){
  38871. var self=this;
  38872. return $core.withContext(function($ctx1) {
  38873. var $1,$2,$3,$4,$5;
  38874. $recv(self["@stream"])._nextPutAll_("fn: function(");
  38875. $ctx1.sendIdx["nextPutAll:"]=1;
  38876. $recv(anArray)._do_separatedBy_((function(each){
  38877. return $core.withContext(function($ctx2) {
  38878. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  38879. $ctx2.sendIdx["nextPutAll:"]=2;
  38880. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38881. }),(function(){
  38882. return $core.withContext(function($ctx2) {
  38883. return $recv(self["@stream"])._nextPut_(",");
  38884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38885. }));
  38886. $1=self["@stream"];
  38887. $recv($1)._nextPutAll_("){");
  38888. $ctx1.sendIdx["nextPutAll:"]=3;
  38889. $2=$recv($1)._lf();
  38890. $ctx1.sendIdx["lf"]=1;
  38891. $3=self["@stream"];
  38892. $recv($3)._nextPutAll_("var self=this;");
  38893. $ctx1.sendIdx["nextPutAll:"]=4;
  38894. $4=$recv($3)._lf();
  38895. $ctx1.sendIdx["lf"]=2;
  38896. $recv(aBlock)._value();
  38897. $5=self["@stream"];
  38898. $recv($5)._lf();
  38899. $recv($5)._nextPutAll_("}");
  38900. return self;
  38901. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  38902. },
  38903. args: ["aBlock", "anArray"],
  38904. 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: '}'",
  38905. referencedClasses: [],
  38906. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  38907. }),
  38908. $globals.JSStream);
  38909. $core.addMethod(
  38910. $core.method({
  38911. selector: "nextPutIf:then:",
  38912. protocol: 'streaming',
  38913. fn: function (aBlock,anotherBlock){
  38914. var self=this;
  38915. return $core.withContext(function($ctx1) {
  38916. var $1;
  38917. $recv(self["@stream"])._nextPutAll_("if(");
  38918. $ctx1.sendIdx["nextPutAll:"]=1;
  38919. $recv(aBlock)._value();
  38920. $ctx1.sendIdx["value"]=1;
  38921. $1=self["@stream"];
  38922. $recv($1)._nextPutAll_("){");
  38923. $ctx1.sendIdx["nextPutAll:"]=2;
  38924. $recv($1)._lf();
  38925. $recv(anotherBlock)._value();
  38926. $recv(self["@stream"])._nextPutAll_("}");
  38927. return self;
  38928. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  38929. },
  38930. args: ["aBlock", "anotherBlock"],
  38931. source: "nextPutIf: aBlock then: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  38932. referencedClasses: [],
  38933. messageSends: ["nextPutAll:", "value", "lf"]
  38934. }),
  38935. $globals.JSStream);
  38936. $core.addMethod(
  38937. $core.method({
  38938. selector: "nextPutIf:then:else:",
  38939. protocol: 'streaming',
  38940. fn: function (aBlock,ifBlock,elseBlock){
  38941. var self=this;
  38942. return $core.withContext(function($ctx1) {
  38943. var $1,$2,$3;
  38944. $recv(self["@stream"])._nextPutAll_("if(");
  38945. $ctx1.sendIdx["nextPutAll:"]=1;
  38946. $recv(aBlock)._value();
  38947. $ctx1.sendIdx["value"]=1;
  38948. $1=self["@stream"];
  38949. $recv($1)._nextPutAll_("){");
  38950. $ctx1.sendIdx["nextPutAll:"]=2;
  38951. $2=$recv($1)._lf();
  38952. $ctx1.sendIdx["lf"]=1;
  38953. $recv(ifBlock)._value();
  38954. $ctx1.sendIdx["value"]=2;
  38955. $3=self["@stream"];
  38956. $recv($3)._nextPutAll_("} else {");
  38957. $ctx1.sendIdx["nextPutAll:"]=3;
  38958. $recv($3)._lf();
  38959. $recv(elseBlock)._value();
  38960. $recv(self["@stream"])._nextPutAll_("}");
  38961. return self;
  38962. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  38963. },
  38964. args: ["aBlock", "ifBlock", "elseBlock"],
  38965. 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: '}'",
  38966. referencedClasses: [],
  38967. messageSends: ["nextPutAll:", "value", "lf"]
  38968. }),
  38969. $globals.JSStream);
  38970. $core.addMethod(
  38971. $core.method({
  38972. selector: "nextPutMethodDeclaration:with:",
  38973. protocol: 'streaming',
  38974. fn: function (aMethod,aBlock){
  38975. var self=this;
  38976. return $core.withContext(function($ctx1) {
  38977. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  38978. $1=self["@stream"];
  38979. $recv($1)._nextPutAll_("$core.method({");
  38980. $ctx1.sendIdx["nextPutAll:"]=1;
  38981. $recv($1)._lf();
  38982. $ctx1.sendIdx["lf"]=1;
  38983. $4=$recv($recv(aMethod)._selector())._asJavascript();
  38984. $ctx1.sendIdx["asJavascript"]=1;
  38985. $3="selector: ".__comma($4);
  38986. $ctx1.sendIdx[","]=2;
  38987. $2=$recv($3).__comma(",");
  38988. $ctx1.sendIdx[","]=1;
  38989. $recv($1)._nextPutAll_($2);
  38990. $ctx1.sendIdx["nextPutAll:"]=2;
  38991. $recv($1)._lf();
  38992. $ctx1.sendIdx["lf"]=2;
  38993. $7=$recv($recv(aMethod)._source())._asJavascript();
  38994. $ctx1.sendIdx["asJavascript"]=2;
  38995. $6="source: ".__comma($7);
  38996. $ctx1.sendIdx[","]=4;
  38997. $5=$recv($6).__comma(",");
  38998. $ctx1.sendIdx[","]=3;
  38999. $recv($1)._nextPutAll_($5);
  39000. $ctx1.sendIdx["nextPutAll:"]=3;
  39001. $8=$recv($1)._lf();
  39002. $ctx1.sendIdx["lf"]=3;
  39003. $recv(aBlock)._value();
  39004. $ctx1.sendIdx["value"]=1;
  39005. $9=self["@stream"];
  39006. $12=$recv($globals.String)._lf();
  39007. $ctx1.sendIdx["lf"]=4;
  39008. $11=",".__comma($12);
  39009. $ctx1.sendIdx[","]=6;
  39010. $10=$recv($11).__comma("messageSends: ");
  39011. $ctx1.sendIdx[","]=5;
  39012. $recv($9)._nextPutAll_($10);
  39013. $ctx1.sendIdx["nextPutAll:"]=4;
  39014. $15=$recv($recv(aMethod)._messageSends())._asArray();
  39015. $ctx1.sendIdx["asArray"]=1;
  39016. $14=$recv($15)._asJavascript();
  39017. $ctx1.sendIdx["asJavascript"]=3;
  39018. $13=$recv($14).__comma(",");
  39019. $ctx1.sendIdx[","]=7;
  39020. $recv($9)._nextPutAll_($13);
  39021. $ctx1.sendIdx["nextPutAll:"]=5;
  39022. $recv($9)._lf();
  39023. $ctx1.sendIdx["lf"]=5;
  39024. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  39025. return $core.withContext(function($ctx2) {
  39026. return $recv(each)._value();
  39027. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39028. })))._asArray())._asJavascript();
  39029. $ctx1.sendIdx["asJavascript"]=4;
  39030. $17="args: ".__comma($18);
  39031. $16=$recv($17).__comma(",");
  39032. $ctx1.sendIdx[","]=8;
  39033. $recv($9)._nextPutAll_($16);
  39034. $ctx1.sendIdx["nextPutAll:"]=6;
  39035. $recv($9)._lf();
  39036. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  39037. $ctx1.sendIdx["nextPutAll:"]=7;
  39038. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  39039. return $core.withContext(function($ctx2) {
  39040. return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavascript());
  39041. $ctx2.sendIdx["nextPutAll:"]=8;
  39042. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39043. }),(function(){
  39044. return $core.withContext(function($ctx2) {
  39045. return $recv(self["@stream"])._nextPutAll_(",");
  39046. $ctx2.sendIdx["nextPutAll:"]=9;
  39047. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39048. }));
  39049. $20=self["@stream"];
  39050. $recv($20)._nextPutAll_("]");
  39051. $ctx1.sendIdx["nextPutAll:"]=10;
  39052. $recv($20)._nextPutAll_("})");
  39053. return self;
  39054. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  39055. },
  39056. args: ["aMethod", "aBlock"],
  39057. 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: '})'",
  39058. referencedClasses: ["String"],
  39059. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  39060. }),
  39061. $globals.JSStream);
  39062. $core.addMethod(
  39063. $core.method({
  39064. selector: "nextPutNonLocalReturnHandlingWith:",
  39065. protocol: 'streaming',
  39066. fn: function (aBlock){
  39067. var self=this;
  39068. return $core.withContext(function($ctx1) {
  39069. var $1,$2,$3;
  39070. $1=self["@stream"];
  39071. $recv($1)._nextPutAll_("var $early={};");
  39072. $ctx1.sendIdx["nextPutAll:"]=1;
  39073. $recv($1)._lf();
  39074. $ctx1.sendIdx["lf"]=1;
  39075. $recv($1)._nextPutAll_("try {");
  39076. $ctx1.sendIdx["nextPutAll:"]=2;
  39077. $2=$recv($1)._lf();
  39078. $ctx1.sendIdx["lf"]=2;
  39079. $recv(aBlock)._value();
  39080. $3=self["@stream"];
  39081. $recv($3)._nextPutAll_("}");
  39082. $ctx1.sendIdx["nextPutAll:"]=3;
  39083. $recv($3)._lf();
  39084. $ctx1.sendIdx["lf"]=3;
  39085. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  39086. $recv($3)._lf();
  39087. return self;
  39088. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  39089. },
  39090. args: ["aBlock"],
  39091. 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",
  39092. referencedClasses: [],
  39093. messageSends: ["nextPutAll:", "lf", "value"]
  39094. }),
  39095. $globals.JSStream);
  39096. $core.addMethod(
  39097. $core.method({
  39098. selector: "nextPutNonLocalReturnWith:",
  39099. protocol: 'streaming',
  39100. fn: function (aBlock){
  39101. var self=this;
  39102. return $core.withContext(function($ctx1) {
  39103. $recv(self["@stream"])._nextPutAll_("throw $early=[");
  39104. $ctx1.sendIdx["nextPutAll:"]=1;
  39105. $recv(aBlock)._value();
  39106. $recv(self["@stream"])._nextPutAll_("]");
  39107. return self;
  39108. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  39109. },
  39110. args: ["aBlock"],
  39111. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  39112. referencedClasses: [],
  39113. messageSends: ["nextPutAll:", "value"]
  39114. }),
  39115. $globals.JSStream);
  39116. $core.addMethod(
  39117. $core.method({
  39118. selector: "nextPutReturnWith:",
  39119. protocol: 'streaming',
  39120. fn: function (aBlock){
  39121. var self=this;
  39122. return $core.withContext(function($ctx1) {
  39123. $recv(self["@stream"])._nextPutAll_("return ");
  39124. $recv(aBlock)._value();
  39125. return self;
  39126. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  39127. },
  39128. args: ["aBlock"],
  39129. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  39130. referencedClasses: [],
  39131. messageSends: ["nextPutAll:", "value"]
  39132. }),
  39133. $globals.JSStream);
  39134. $core.addMethod(
  39135. $core.method({
  39136. selector: "nextPutSendIndexFor:",
  39137. protocol: 'streaming',
  39138. fn: function (anIRSend){
  39139. var self=this;
  39140. return $core.withContext(function($ctx1) {
  39141. self._nextPutAll_(";");
  39142. $ctx1.sendIdx["nextPutAll:"]=1;
  39143. self._lf();
  39144. $ctx1.sendIdx["lf"]=1;
  39145. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39146. $ctx1.sendIdx["nextPutAll:"]=2;
  39147. self._lf();
  39148. $ctx1.sendIdx["lf"]=2;
  39149. self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  39150. $ctx1.sendIdx["nextPutAll:"]=3;
  39151. self._nextPutAll_(".sendIdx[");
  39152. $ctx1.sendIdx["nextPutAll:"]=4;
  39153. self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavascript());
  39154. $ctx1.sendIdx["nextPutAll:"]=5;
  39155. self._nextPutAll_("]=");
  39156. $ctx1.sendIdx["nextPutAll:"]=6;
  39157. self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  39158. $ctx1.sendIdx["nextPutAll:"]=7;
  39159. self._nextPutAll_(";");
  39160. $ctx1.sendIdx["nextPutAll:"]=8;
  39161. self._lf();
  39162. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  39163. return self;
  39164. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  39165. },
  39166. args: ["anIRSend"],
  39167. 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)'",
  39168. referencedClasses: [],
  39169. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"]
  39170. }),
  39171. $globals.JSStream);
  39172. $core.addMethod(
  39173. $core.method({
  39174. selector: "nextPutSequenceWith:",
  39175. protocol: 'streaming',
  39176. fn: function (aBlock){
  39177. var self=this;
  39178. return $core.withContext(function($ctx1) {
  39179. $recv(aBlock)._value();
  39180. return self;
  39181. }, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},$globals.JSStream)});
  39182. },
  39183. args: ["aBlock"],
  39184. 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",
  39185. referencedClasses: [],
  39186. messageSends: ["value"]
  39187. }),
  39188. $globals.JSStream);
  39189. $core.addMethod(
  39190. $core.method({
  39191. selector: "nextPutStatementWith:",
  39192. protocol: 'streaming',
  39193. fn: function (aBlock){
  39194. var self=this;
  39195. return $core.withContext(function($ctx1) {
  39196. var $1;
  39197. $recv(aBlock)._value();
  39198. $1=self["@stream"];
  39199. $recv($1)._nextPutAll_(";");
  39200. $recv($1)._lf();
  39201. return self;
  39202. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  39203. },
  39204. args: ["aBlock"],
  39205. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  39206. referencedClasses: [],
  39207. messageSends: ["value", "nextPutAll:", "lf"]
  39208. }),
  39209. $globals.JSStream);
  39210. $core.addMethod(
  39211. $core.method({
  39212. selector: "nextPutVars:",
  39213. protocol: 'streaming',
  39214. fn: function (aCollection){
  39215. var self=this;
  39216. return $core.withContext(function($ctx1) {
  39217. var $1;
  39218. $recv(aCollection)._ifNotEmpty_((function(){
  39219. return $core.withContext(function($ctx2) {
  39220. $recv(self["@stream"])._nextPutAll_("var ");
  39221. $ctx2.sendIdx["nextPutAll:"]=1;
  39222. $recv(aCollection)._do_separatedBy_((function(each){
  39223. return $core.withContext(function($ctx3) {
  39224. return $recv(self["@stream"])._nextPutAll_(each);
  39225. $ctx3.sendIdx["nextPutAll:"]=2;
  39226. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39227. }),(function(){
  39228. return $core.withContext(function($ctx3) {
  39229. return $recv(self["@stream"])._nextPutAll_(",");
  39230. $ctx3.sendIdx["nextPutAll:"]=3;
  39231. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  39232. }));
  39233. $1=self["@stream"];
  39234. $recv($1)._nextPutAll_(";");
  39235. return $recv($1)._lf();
  39236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39237. }));
  39238. return self;
  39239. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  39240. },
  39241. args: ["aCollection"],
  39242. 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 ]",
  39243. referencedClasses: [],
  39244. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  39245. }),
  39246. $globals.JSStream);
  39247. $core.addMethod(
  39248. $core.method({
  39249. selector: "appendToInstruction:",
  39250. protocol: '*Compiler-IR',
  39251. fn: function (anIRInstruction){
  39252. var self=this;
  39253. return $core.withContext(function($ctx1) {
  39254. $recv(anIRInstruction)._appendBlock_(self);
  39255. return self;
  39256. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  39257. },
  39258. args: ["anIRInstruction"],
  39259. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  39260. referencedClasses: [],
  39261. messageSends: ["appendBlock:"]
  39262. }),
  39263. $globals.BlockClosure);
  39264. });
  39265. define("amber_core/Compiler-Inlining", ["amber/boot", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Compiler-Semantic"], function($boot){"use strict";
  39266. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  39267. $core.addPackage('Compiler-Inlining');
  39268. $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  39269. $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  39270. $core.addClass('IRInlinedAssignment', $globals.IRAssignment, [], 'Compiler-Inlining');
  39271. $globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  39272. $core.addMethod(
  39273. $core.method({
  39274. selector: "accept:",
  39275. protocol: 'visiting',
  39276. fn: function (aVisitor){
  39277. var self=this;
  39278. return $core.withContext(function($ctx1) {
  39279. return $recv(aVisitor)._visitIRInlinedAssignment_(self);
  39280. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedAssignment)});
  39281. },
  39282. args: ["aVisitor"],
  39283. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  39284. referencedClasses: [],
  39285. messageSends: ["visitIRInlinedAssignment:"]
  39286. }),
  39287. $globals.IRInlinedAssignment);
  39288. $core.addMethod(
  39289. $core.method({
  39290. selector: "isInlined",
  39291. protocol: 'testing',
  39292. fn: function (){
  39293. var self=this;
  39294. return true;
  39295. },
  39296. args: [],
  39297. source: "isInlined\x0a\x09^ true",
  39298. referencedClasses: [],
  39299. messageSends: []
  39300. }),
  39301. $globals.IRInlinedAssignment);
  39302. $core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining');
  39303. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  39304. $core.addMethod(
  39305. $core.method({
  39306. selector: "accept:",
  39307. protocol: 'visiting',
  39308. fn: function (aVisitor){
  39309. var self=this;
  39310. return $core.withContext(function($ctx1) {
  39311. $recv(aVisitor)._visitIRInlinedClosure_(self);
  39312. return self;
  39313. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  39314. },
  39315. args: ["aVisitor"],
  39316. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  39317. referencedClasses: [],
  39318. messageSends: ["visitIRInlinedClosure:"]
  39319. }),
  39320. $globals.IRInlinedClosure);
  39321. $core.addMethod(
  39322. $core.method({
  39323. selector: "isInlined",
  39324. protocol: 'testing',
  39325. fn: function (){
  39326. var self=this;
  39327. return true;
  39328. },
  39329. args: [],
  39330. source: "isInlined\x0a\x09^ true",
  39331. referencedClasses: [],
  39332. messageSends: []
  39333. }),
  39334. $globals.IRInlinedClosure);
  39335. $core.addClass('IRInlinedReturn', $globals.IRReturn, [], 'Compiler-Inlining');
  39336. $globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  39337. $core.addMethod(
  39338. $core.method({
  39339. selector: "accept:",
  39340. protocol: 'visiting',
  39341. fn: function (aVisitor){
  39342. var self=this;
  39343. return $core.withContext(function($ctx1) {
  39344. return $recv(aVisitor)._visitIRInlinedReturn_(self);
  39345. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedReturn)});
  39346. },
  39347. args: ["aVisitor"],
  39348. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  39349. referencedClasses: [],
  39350. messageSends: ["visitIRInlinedReturn:"]
  39351. }),
  39352. $globals.IRInlinedReturn);
  39353. $core.addMethod(
  39354. $core.method({
  39355. selector: "isInlined",
  39356. protocol: 'testing',
  39357. fn: function (){
  39358. var self=this;
  39359. return true;
  39360. },
  39361. args: [],
  39362. source: "isInlined\x0a\x09^ true",
  39363. referencedClasses: [],
  39364. messageSends: []
  39365. }),
  39366. $globals.IRInlinedReturn);
  39367. $core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining');
  39368. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  39369. $core.addMethod(
  39370. $core.method({
  39371. selector: "accept:",
  39372. protocol: 'visiting',
  39373. fn: function (aVisitor){
  39374. var self=this;
  39375. return $core.withContext(function($ctx1) {
  39376. $recv(aVisitor)._visitInlinedSend_(self);
  39377. return self;
  39378. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  39379. },
  39380. args: ["aVisitor"],
  39381. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  39382. referencedClasses: [],
  39383. messageSends: ["visitInlinedSend:"]
  39384. }),
  39385. $globals.IRInlinedSend);
  39386. $core.addMethod(
  39387. $core.method({
  39388. selector: "internalVariables",
  39389. protocol: 'accessing',
  39390. fn: function (){
  39391. var self=this;
  39392. return [];
  39393. },
  39394. args: [],
  39395. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  39396. referencedClasses: [],
  39397. messageSends: []
  39398. }),
  39399. $globals.IRInlinedSend);
  39400. $core.addMethod(
  39401. $core.method({
  39402. selector: "isInlined",
  39403. protocol: 'testing',
  39404. fn: function (){
  39405. var self=this;
  39406. return true;
  39407. },
  39408. args: [],
  39409. source: "isInlined\x0a\x09^ true",
  39410. referencedClasses: [],
  39411. messageSends: []
  39412. }),
  39413. $globals.IRInlinedSend);
  39414. $core.addClass('IRInlinedIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39415. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  39416. $core.addMethod(
  39417. $core.method({
  39418. selector: "accept:",
  39419. protocol: 'visiting',
  39420. fn: function (aVisitor){
  39421. var self=this;
  39422. return $core.withContext(function($ctx1) {
  39423. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  39424. return self;
  39425. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  39426. },
  39427. args: ["aVisitor"],
  39428. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  39429. referencedClasses: [],
  39430. messageSends: ["visitIRInlinedIfFalse:"]
  39431. }),
  39432. $globals.IRInlinedIfFalse);
  39433. $core.addClass('IRInlinedIfNilIfNotNil', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39434. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  39435. $core.addMethod(
  39436. $core.method({
  39437. selector: "accept:",
  39438. protocol: 'visiting',
  39439. fn: function (aVisitor){
  39440. var self=this;
  39441. return $core.withContext(function($ctx1) {
  39442. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  39443. return self;
  39444. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  39445. },
  39446. args: ["aVisitor"],
  39447. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  39448. referencedClasses: [],
  39449. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  39450. }),
  39451. $globals.IRInlinedIfNilIfNotNil);
  39452. $core.addMethod(
  39453. $core.method({
  39454. selector: "internalVariables",
  39455. protocol: 'accessing',
  39456. fn: function (){
  39457. var self=this;
  39458. return $core.withContext(function($ctx1) {
  39459. return $recv($globals.Array)._with_(self._receiverInternalVariable());
  39460. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  39461. },
  39462. args: [],
  39463. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  39464. referencedClasses: ["Array"],
  39465. messageSends: ["with:", "receiverInternalVariable"]
  39466. }),
  39467. $globals.IRInlinedIfNilIfNotNil);
  39468. $core.addMethod(
  39469. $core.method({
  39470. selector: "receiverInternalVariable",
  39471. protocol: 'accessing',
  39472. fn: function (){
  39473. var self=this;
  39474. return $core.withContext(function($ctx1) {
  39475. var $1;
  39476. $1=$recv($globals.IRVariable)._new();
  39477. $ctx1.sendIdx["new"]=1;
  39478. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_(self._receiverInternalVariableName()));
  39479. return $recv($1)._yourself();
  39480. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  39481. },
  39482. args: [],
  39483. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  39484. referencedClasses: ["IRVariable", "AliasVar"],
  39485. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  39486. }),
  39487. $globals.IRInlinedIfNilIfNotNil);
  39488. $core.addMethod(
  39489. $core.method({
  39490. selector: "receiverInternalVariableName",
  39491. protocol: 'accessing',
  39492. fn: function (){
  39493. var self=this;
  39494. return "$receiver";
  39495. },
  39496. args: [],
  39497. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  39498. referencedClasses: [],
  39499. messageSends: []
  39500. }),
  39501. $globals.IRInlinedIfNilIfNotNil);
  39502. $core.addClass('IRInlinedIfTrue', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39503. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  39504. $core.addMethod(
  39505. $core.method({
  39506. selector: "accept:",
  39507. protocol: 'visiting',
  39508. fn: function (aVisitor){
  39509. var self=this;
  39510. return $core.withContext(function($ctx1) {
  39511. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  39512. return self;
  39513. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  39514. },
  39515. args: ["aVisitor"],
  39516. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  39517. referencedClasses: [],
  39518. messageSends: ["visitIRInlinedIfTrue:"]
  39519. }),
  39520. $globals.IRInlinedIfTrue);
  39521. $core.addClass('IRInlinedIfTrueIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39522. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  39523. $core.addMethod(
  39524. $core.method({
  39525. selector: "accept:",
  39526. protocol: 'visiting',
  39527. fn: function (aVisitor){
  39528. var self=this;
  39529. return $core.withContext(function($ctx1) {
  39530. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  39531. return self;
  39532. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  39533. },
  39534. args: ["aVisitor"],
  39535. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  39536. referencedClasses: [],
  39537. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  39538. }),
  39539. $globals.IRInlinedIfTrueIfFalse);
  39540. $core.addClass('IRInlinedSequence', $globals.IRBlockSequence, [], 'Compiler-Inlining');
  39541. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  39542. $core.addMethod(
  39543. $core.method({
  39544. selector: "accept:",
  39545. protocol: 'visiting',
  39546. fn: function (aVisitor){
  39547. var self=this;
  39548. return $core.withContext(function($ctx1) {
  39549. $recv(aVisitor)._visitIRInlinedSequence_(self);
  39550. return self;
  39551. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  39552. },
  39553. args: ["aVisitor"],
  39554. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  39555. referencedClasses: [],
  39556. messageSends: ["visitIRInlinedSequence:"]
  39557. }),
  39558. $globals.IRInlinedSequence);
  39559. $core.addMethod(
  39560. $core.method({
  39561. selector: "isInlined",
  39562. protocol: 'testing',
  39563. fn: function (){
  39564. var self=this;
  39565. return true;
  39566. },
  39567. args: [],
  39568. source: "isInlined\x0a\x09^ true",
  39569. referencedClasses: [],
  39570. messageSends: []
  39571. }),
  39572. $globals.IRInlinedSequence);
  39573. $core.addClass('IRInliner', $globals.IRVisitor, [], 'Compiler-Inlining');
  39574. $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`";
  39575. $core.addMethod(
  39576. $core.method({
  39577. selector: "assignmentInliner",
  39578. protocol: 'factory',
  39579. fn: function (){
  39580. var self=this;
  39581. return $core.withContext(function($ctx1) {
  39582. var $1;
  39583. $1=$recv($globals.IRAssignmentInliner)._new();
  39584. $recv($1)._translator_(self);
  39585. return $recv($1)._yourself();
  39586. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  39587. },
  39588. args: [],
  39589. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39590. referencedClasses: ["IRAssignmentInliner"],
  39591. messageSends: ["translator:", "new", "yourself"]
  39592. }),
  39593. $globals.IRInliner);
  39594. $core.addMethod(
  39595. $core.method({
  39596. selector: "returnInliner",
  39597. protocol: 'factory',
  39598. fn: function (){
  39599. var self=this;
  39600. return $core.withContext(function($ctx1) {
  39601. var $1;
  39602. $1=$recv($globals.IRReturnInliner)._new();
  39603. $recv($1)._translator_(self);
  39604. return $recv($1)._yourself();
  39605. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  39606. },
  39607. args: [],
  39608. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39609. referencedClasses: ["IRReturnInliner"],
  39610. messageSends: ["translator:", "new", "yourself"]
  39611. }),
  39612. $globals.IRInliner);
  39613. $core.addMethod(
  39614. $core.method({
  39615. selector: "sendInliner",
  39616. protocol: 'factory',
  39617. fn: function (){
  39618. var self=this;
  39619. return $core.withContext(function($ctx1) {
  39620. var $1;
  39621. $1=$recv($globals.IRSendInliner)._new();
  39622. $recv($1)._translator_(self);
  39623. return $recv($1)._yourself();
  39624. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  39625. },
  39626. args: [],
  39627. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39628. referencedClasses: ["IRSendInliner"],
  39629. messageSends: ["translator:", "new", "yourself"]
  39630. }),
  39631. $globals.IRInliner);
  39632. $core.addMethod(
  39633. $core.method({
  39634. selector: "shouldInlineAssignment:",
  39635. protocol: 'testing',
  39636. fn: function (anIRAssignment){
  39637. var self=this;
  39638. return $core.withContext(function($ctx1) {
  39639. var $4,$3,$2,$1;
  39640. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  39641. return $core.withContext(function($ctx2) {
  39642. $4=$recv(anIRAssignment)._instructions();
  39643. $ctx2.sendIdx["instructions"]=1;
  39644. $3=$recv($4)._last();
  39645. $ctx2.sendIdx["last"]=1;
  39646. $2=$recv($3)._isSend();
  39647. return $recv($2)._and_((function(){
  39648. return $core.withContext(function($ctx3) {
  39649. return self._shouldInlineSend_($recv($recv(anIRAssignment)._instructions())._last());
  39650. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39651. }));
  39652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39653. }));
  39654. $ctx1.sendIdx["and:"]=1;
  39655. return $1;
  39656. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  39657. },
  39658. args: ["anIRAssignment"],
  39659. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  39660. referencedClasses: [],
  39661. messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"]
  39662. }),
  39663. $globals.IRInliner);
  39664. $core.addMethod(
  39665. $core.method({
  39666. selector: "shouldInlineReturn:",
  39667. protocol: 'testing',
  39668. fn: function (anIRReturn){
  39669. var self=this;
  39670. return $core.withContext(function($ctx1) {
  39671. var $4,$3,$2,$1;
  39672. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  39673. return $core.withContext(function($ctx2) {
  39674. $4=$recv(anIRReturn)._instructions();
  39675. $ctx2.sendIdx["instructions"]=1;
  39676. $3=$recv($4)._first();
  39677. $ctx2.sendIdx["first"]=1;
  39678. $2=$recv($3)._isSend();
  39679. return $recv($2)._and_((function(){
  39680. return $core.withContext(function($ctx3) {
  39681. return self._shouldInlineSend_($recv($recv(anIRReturn)._instructions())._first());
  39682. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39683. }));
  39684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39685. }));
  39686. $ctx1.sendIdx["and:"]=1;
  39687. return $1;
  39688. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  39689. },
  39690. args: ["anIRReturn"],
  39691. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  39692. referencedClasses: [],
  39693. messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"]
  39694. }),
  39695. $globals.IRInliner);
  39696. $core.addMethod(
  39697. $core.method({
  39698. selector: "shouldInlineSend:",
  39699. protocol: 'testing',
  39700. fn: function (anIRSend){
  39701. var self=this;
  39702. return $core.withContext(function($ctx1) {
  39703. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  39704. return $core.withContext(function($ctx2) {
  39705. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  39706. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39707. }));
  39708. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  39709. },
  39710. args: ["anIRSend"],
  39711. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  39712. referencedClasses: ["IRSendInliner"],
  39713. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  39714. }),
  39715. $globals.IRInliner);
  39716. $core.addMethod(
  39717. $core.method({
  39718. selector: "transformNonLocalReturn:",
  39719. protocol: 'visiting',
  39720. fn: function (anIRNonLocalReturn){
  39721. var self=this;
  39722. var localReturn;
  39723. return $core.withContext(function($ctx1) {
  39724. var $2,$1,$4,$3,$5,$6,$7;
  39725. $2=$recv(anIRNonLocalReturn)._scope();
  39726. $ctx1.sendIdx["scope"]=1;
  39727. $1=$recv($2)._canInlineNonLocalReturns();
  39728. if($core.assert($1)){
  39729. $4=$recv(anIRNonLocalReturn)._scope();
  39730. $ctx1.sendIdx["scope"]=2;
  39731. $3=$recv($4)._methodScope();
  39732. $5=$recv(anIRNonLocalReturn)._scope();
  39733. $ctx1.sendIdx["scope"]=3;
  39734. $recv($3)._removeNonLocalReturn_($5);
  39735. $6=$recv($globals.IRReturn)._new();
  39736. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  39737. localReturn=$recv($6)._yourself();
  39738. localReturn;
  39739. $recv($recv(anIRNonLocalReturn)._instructions())._do_((function(each){
  39740. return $core.withContext(function($ctx2) {
  39741. return $recv(localReturn)._add_(each);
  39742. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39743. }));
  39744. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  39745. return localReturn;
  39746. };
  39747. $7=(
  39748. $ctx1.supercall = true,
  39749. ($globals.IRInliner.superclass||$boot.dnu).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  39750. $ctx1.supercall = false;
  39751. return $7;
  39752. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  39753. },
  39754. args: ["anIRNonLocalReturn"],
  39755. source: "transformNonLocalReturn: anIRNonLocalReturn\x0a\x09\x22Replace a non local return into a local return\x22\x0a\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 instructions do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ localReturn ].\x0a\x09^ super visitIRNonLocalReturn: anIRNonLocalReturn",
  39756. referencedClasses: ["IRReturn"],
  39757. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"]
  39758. }),
  39759. $globals.IRInliner);
  39760. $core.addMethod(
  39761. $core.method({
  39762. selector: "visitIRAssignment:",
  39763. protocol: 'visiting',
  39764. fn: function (anIRAssignment){
  39765. var self=this;
  39766. return $core.withContext(function($ctx1) {
  39767. var $1;
  39768. $1=self._shouldInlineAssignment_(anIRAssignment);
  39769. if($core.assert($1)){
  39770. return $recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  39771. } else {
  39772. return (
  39773. $ctx1.supercall = true,
  39774. ($globals.IRInliner.superclass||$boot.dnu).fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment]));
  39775. $ctx1.supercall = false;
  39776. };
  39777. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  39778. },
  39779. args: ["anIRAssignment"],
  39780. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  39781. referencedClasses: [],
  39782. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  39783. }),
  39784. $globals.IRInliner);
  39785. $core.addMethod(
  39786. $core.method({
  39787. selector: "visitIRNonLocalReturn:",
  39788. protocol: 'visiting',
  39789. fn: function (anIRNonLocalReturn){
  39790. var self=this;
  39791. return $core.withContext(function($ctx1) {
  39792. return self._transformNonLocalReturn_(anIRNonLocalReturn);
  39793. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRInliner)});
  39794. },
  39795. args: ["anIRNonLocalReturn"],
  39796. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  39797. referencedClasses: [],
  39798. messageSends: ["transformNonLocalReturn:"]
  39799. }),
  39800. $globals.IRInliner);
  39801. $core.addMethod(
  39802. $core.method({
  39803. selector: "visitIRReturn:",
  39804. protocol: 'visiting',
  39805. fn: function (anIRReturn){
  39806. var self=this;
  39807. return $core.withContext(function($ctx1) {
  39808. var $1;
  39809. $1=self._shouldInlineReturn_(anIRReturn);
  39810. if($core.assert($1)){
  39811. return $recv(self._returnInliner())._inlineReturn_(anIRReturn);
  39812. } else {
  39813. return (
  39814. $ctx1.supercall = true,
  39815. ($globals.IRInliner.superclass||$boot.dnu).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  39816. $ctx1.supercall = false;
  39817. };
  39818. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  39819. },
  39820. args: ["anIRReturn"],
  39821. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  39822. referencedClasses: [],
  39823. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  39824. }),
  39825. $globals.IRInliner);
  39826. $core.addMethod(
  39827. $core.method({
  39828. selector: "visitIRSend:",
  39829. protocol: 'visiting',
  39830. fn: function (anIRSend){
  39831. var self=this;
  39832. return $core.withContext(function($ctx1) {
  39833. var $1;
  39834. $1=self._shouldInlineSend_(anIRSend);
  39835. if($core.assert($1)){
  39836. return $recv(self._sendInliner())._inlineSend_(anIRSend);
  39837. } else {
  39838. return (
  39839. $ctx1.supercall = true,
  39840. ($globals.IRInliner.superclass||$boot.dnu).fn.prototype._visitIRSend_.apply($recv(self), [anIRSend]));
  39841. $ctx1.supercall = false;
  39842. };
  39843. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  39844. },
  39845. args: ["anIRSend"],
  39846. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  39847. referencedClasses: [],
  39848. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  39849. }),
  39850. $globals.IRInliner);
  39851. $core.addClass('IRInliningJSTranslator', $globals.IRJSTranslator, [], 'Compiler-Inlining');
  39852. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  39853. $core.addMethod(
  39854. $core.method({
  39855. selector: "visitIRInlinedAssignment:",
  39856. protocol: 'visiting',
  39857. fn: function (anIRInlinedAssignment){
  39858. var self=this;
  39859. return $core.withContext(function($ctx1) {
  39860. self._visit_($recv($recv(anIRInlinedAssignment)._instructions())._last());
  39861. return self;
  39862. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},$globals.IRInliningJSTranslator)});
  39863. },
  39864. args: ["anIRInlinedAssignment"],
  39865. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  39866. referencedClasses: [],
  39867. messageSends: ["visit:", "last", "instructions"]
  39868. }),
  39869. $globals.IRInliningJSTranslator);
  39870. $core.addMethod(
  39871. $core.method({
  39872. selector: "visitIRInlinedClosure:",
  39873. protocol: 'visiting',
  39874. fn: function (anIRInlinedClosure){
  39875. var self=this;
  39876. return $core.withContext(function($ctx1) {
  39877. $recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  39878. return $core.withContext(function($ctx2) {
  39879. return $recv($recv(each)._name())._asVariableName();
  39880. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39881. })));
  39882. $recv($recv(anIRInlinedClosure)._instructions())._do_((function(each){
  39883. return $core.withContext(function($ctx2) {
  39884. return self._visit_(each);
  39885. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39886. }));
  39887. return self;
  39888. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  39889. },
  39890. args: ["anIRInlinedClosure"],
  39891. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09anIRInlinedClosure instructions do: [ :each |\x0a\x09\x09self visit: each ]",
  39892. referencedClasses: [],
  39893. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"]
  39894. }),
  39895. $globals.IRInliningJSTranslator);
  39896. $core.addMethod(
  39897. $core.method({
  39898. selector: "visitIRInlinedIfFalse:",
  39899. protocol: 'visiting',
  39900. fn: function (anIRInlinedIfFalse){
  39901. var self=this;
  39902. return $core.withContext(function($ctx1) {
  39903. var $1,$2,$4,$3;
  39904. $1=self._stream();
  39905. $ctx1.sendIdx["stream"]=1;
  39906. $recv($1)._nextPutIf_then_((function(){
  39907. return $core.withContext(function($ctx2) {
  39908. $2=self._stream();
  39909. $ctx2.sendIdx["stream"]=2;
  39910. $recv($2)._nextPutAll_("!$core.assert(");
  39911. $ctx2.sendIdx["nextPutAll:"]=1;
  39912. $4=$recv(anIRInlinedIfFalse)._instructions();
  39913. $ctx2.sendIdx["instructions"]=1;
  39914. $3=$recv($4)._first();
  39915. self._visit_($3);
  39916. $ctx2.sendIdx["visit:"]=1;
  39917. return $recv(self._stream())._nextPutAll_(")");
  39918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39919. }),(function(){
  39920. return $core.withContext(function($ctx2) {
  39921. return self._visit_($recv($recv(anIRInlinedIfFalse)._instructions())._last());
  39922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39923. }));
  39924. return self;
  39925. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  39926. },
  39927. args: ["anIRInlinedIfFalse"],
  39928. source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '!$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfFalse instructions last ]",
  39929. referencedClasses: [],
  39930. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  39931. }),
  39932. $globals.IRInliningJSTranslator);
  39933. $core.addMethod(
  39934. $core.method({
  39935. selector: "visitIRInlinedIfNilIfNotNil:",
  39936. protocol: 'visiting',
  39937. fn: function (anIRInlinedIfNilIfNotNil){
  39938. var self=this;
  39939. return $core.withContext(function($ctx1) {
  39940. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  39941. $1=self._stream();
  39942. $ctx1.sendIdx["stream"]=1;
  39943. $recv($1)._nextPutIf_then_else_((function(){
  39944. var recvVarName;
  39945. return $core.withContext(function($ctx2) {
  39946. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  39947. recvVarName;
  39948. $2=self._stream();
  39949. $ctx2.sendIdx["stream"]=2;
  39950. $4="(".__comma(recvVarName);
  39951. $ctx2.sendIdx[","]=2;
  39952. $3=$recv($4).__comma(" = ");
  39953. $ctx2.sendIdx[","]=1;
  39954. $recv($2)._nextPutAll_($3);
  39955. $ctx2.sendIdx["nextPutAll:"]=1;
  39956. $6=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  39957. $ctx2.sendIdx["instructions"]=1;
  39958. $5=$recv($6)._first();
  39959. self._visit_($5);
  39960. $ctx2.sendIdx["visit:"]=1;
  39961. $7=self._stream();
  39962. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".isNil");
  39963. $ctx2.sendIdx[","]=3;
  39964. return $recv($7)._nextPutAll_($8);
  39965. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  39966. }),(function(){
  39967. return $core.withContext(function($ctx2) {
  39968. $10=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  39969. $ctx2.sendIdx["instructions"]=2;
  39970. $9=$recv($10)._second();
  39971. return self._visit_($9);
  39972. $ctx2.sendIdx["visit:"]=2;
  39973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39974. }),(function(){
  39975. return $core.withContext(function($ctx2) {
  39976. return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._instructions())._third());
  39977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39978. }));
  39979. return self;
  39980. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  39981. },
  39982. args: ["anIRInlinedIfNilIfNotNil"],
  39983. 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 instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || ', recvVarName, '.isNil' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
  39984. referencedClasses: [],
  39985. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "instructions", "second", "third"]
  39986. }),
  39987. $globals.IRInliningJSTranslator);
  39988. $core.addMethod(
  39989. $core.method({
  39990. selector: "visitIRInlinedIfTrue:",
  39991. protocol: 'visiting',
  39992. fn: function (anIRInlinedIfTrue){
  39993. var self=this;
  39994. return $core.withContext(function($ctx1) {
  39995. var $1,$2,$4,$3;
  39996. $1=self._stream();
  39997. $ctx1.sendIdx["stream"]=1;
  39998. $recv($1)._nextPutIf_then_((function(){
  39999. return $core.withContext(function($ctx2) {
  40000. $2=self._stream();
  40001. $ctx2.sendIdx["stream"]=2;
  40002. $recv($2)._nextPutAll_("$core.assert(");
  40003. $ctx2.sendIdx["nextPutAll:"]=1;
  40004. $4=$recv(anIRInlinedIfTrue)._instructions();
  40005. $ctx2.sendIdx["instructions"]=1;
  40006. $3=$recv($4)._first();
  40007. self._visit_($3);
  40008. $ctx2.sendIdx["visit:"]=1;
  40009. return $recv(self._stream())._nextPutAll_(")");
  40010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40011. }),(function(){
  40012. return $core.withContext(function($ctx2) {
  40013. return self._visit_($recv($recv(anIRInlinedIfTrue)._instructions())._last());
  40014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40015. }));
  40016. return self;
  40017. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  40018. },
  40019. args: ["anIRInlinedIfTrue"],
  40020. source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrue instructions last ]",
  40021. referencedClasses: [],
  40022. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  40023. }),
  40024. $globals.IRInliningJSTranslator);
  40025. $core.addMethod(
  40026. $core.method({
  40027. selector: "visitIRInlinedIfTrueIfFalse:",
  40028. protocol: 'visiting',
  40029. fn: function (anIRInlinedIfTrueIfFalse){
  40030. var self=this;
  40031. return $core.withContext(function($ctx1) {
  40032. var $1,$2,$4,$3,$6,$5;
  40033. $1=self._stream();
  40034. $ctx1.sendIdx["stream"]=1;
  40035. $recv($1)._nextPutIf_then_else_((function(){
  40036. return $core.withContext(function($ctx2) {
  40037. $2=self._stream();
  40038. $ctx2.sendIdx["stream"]=2;
  40039. $recv($2)._nextPutAll_("$core.assert(");
  40040. $ctx2.sendIdx["nextPutAll:"]=1;
  40041. $4=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  40042. $ctx2.sendIdx["instructions"]=1;
  40043. $3=$recv($4)._first();
  40044. self._visit_($3);
  40045. $ctx2.sendIdx["visit:"]=1;
  40046. return $recv(self._stream())._nextPutAll_(")");
  40047. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40048. }),(function(){
  40049. return $core.withContext(function($ctx2) {
  40050. $6=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  40051. $ctx2.sendIdx["instructions"]=2;
  40052. $5=$recv($6)._second();
  40053. return self._visit_($5);
  40054. $ctx2.sendIdx["visit:"]=2;
  40055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40056. }),(function(){
  40057. return $core.withContext(function($ctx2) {
  40058. return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._instructions())._third());
  40059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40060. }));
  40061. return self;
  40062. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  40063. },
  40064. args: ["anIRInlinedIfTrueIfFalse"],
  40065. source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfTrueIfFalse instructions third ]",
  40066. referencedClasses: [],
  40067. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"]
  40068. }),
  40069. $globals.IRInliningJSTranslator);
  40070. $core.addMethod(
  40071. $core.method({
  40072. selector: "visitIRInlinedNonLocalReturn:",
  40073. protocol: 'visiting',
  40074. fn: function (anIRInlinedReturn){
  40075. var self=this;
  40076. return $core.withContext(function($ctx1) {
  40077. var $1;
  40078. $1=self._stream();
  40079. $ctx1.sendIdx["stream"]=1;
  40080. $recv($1)._nextPutStatementWith_((function(){
  40081. return $core.withContext(function($ctx2) {
  40082. return self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  40083. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40084. }));
  40085. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  40086. }));
  40087. return self;
  40088. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  40089. },
  40090. args: ["anIRInlinedReturn"],
  40091. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  40092. referencedClasses: [],
  40093. messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"]
  40094. }),
  40095. $globals.IRInliningJSTranslator);
  40096. $core.addMethod(
  40097. $core.method({
  40098. selector: "visitIRInlinedReturn:",
  40099. protocol: 'visiting',
  40100. fn: function (anIRInlinedReturn){
  40101. var self=this;
  40102. return $core.withContext(function($ctx1) {
  40103. self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  40104. return self;
  40105. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  40106. },
  40107. args: ["anIRInlinedReturn"],
  40108. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  40109. referencedClasses: [],
  40110. messageSends: ["visit:", "last", "instructions"]
  40111. }),
  40112. $globals.IRInliningJSTranslator);
  40113. $core.addMethod(
  40114. $core.method({
  40115. selector: "visitIRInlinedSequence:",
  40116. protocol: 'visiting',
  40117. fn: function (anIRInlinedSequence){
  40118. var self=this;
  40119. return $core.withContext(function($ctx1) {
  40120. $recv($recv(anIRInlinedSequence)._instructions())._do_((function(each){
  40121. return $core.withContext(function($ctx2) {
  40122. return $recv(self._stream())._nextPutStatementWith_((function(){
  40123. return $core.withContext(function($ctx3) {
  40124. return self._visit_(each);
  40125. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40126. }));
  40127. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40128. }));
  40129. return self;
  40130. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRInliningJSTranslator)});
  40131. },
  40132. args: ["anIRInlinedSequence"],
  40133. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  40134. referencedClasses: [],
  40135. messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"]
  40136. }),
  40137. $globals.IRInliningJSTranslator);
  40138. $core.addClass('IRSendInliner', $globals.Object, ['send', 'translator'], 'Compiler-Inlining');
  40139. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  40140. $core.addMethod(
  40141. $core.method({
  40142. selector: "ifFalse:",
  40143. protocol: 'inlining',
  40144. fn: function (anIRInstruction){
  40145. var self=this;
  40146. return $core.withContext(function($ctx1) {
  40147. return self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  40148. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40149. },
  40150. args: ["anIRInstruction"],
  40151. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  40152. referencedClasses: ["IRInlinedIfFalse"],
  40153. messageSends: ["inlinedSend:withBlock:", "new"]
  40154. }),
  40155. $globals.IRSendInliner);
  40156. $core.addMethod(
  40157. $core.method({
  40158. selector: "ifFalse:ifTrue:",
  40159. protocol: 'inlining',
  40160. fn: function (anIRInstruction,anotherIRInstruction){
  40161. var self=this;
  40162. return $core.withContext(function($ctx1) {
  40163. return self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  40164. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40165. },
  40166. args: ["anIRInstruction", "anotherIRInstruction"],
  40167. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  40168. referencedClasses: [],
  40169. messageSends: ["perform:withArguments:"]
  40170. }),
  40171. $globals.IRSendInliner);
  40172. $core.addMethod(
  40173. $core.method({
  40174. selector: "ifNil:",
  40175. protocol: 'inlining',
  40176. fn: function (anIRInstruction){
  40177. var self=this;
  40178. return $core.withContext(function($ctx1) {
  40179. var $1,$3,$5,$6,$4,$2;
  40180. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  40181. $ctx1.sendIdx["new"]=1;
  40182. $3=$recv($globals.IRClosure)._new();
  40183. $ctx1.sendIdx["new"]=2;
  40184. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  40185. $5=$recv($globals.IRBlockSequence)._new();
  40186. $recv($5)._add_($recv($recv(self._send())._instructions())._first());
  40187. $6=$recv($5)._yourself();
  40188. $ctx1.sendIdx["yourself"]=1;
  40189. $4=$6;
  40190. $recv($3)._add_($4);
  40191. $ctx1.sendIdx["add:"]=1;
  40192. $2=$recv($3)._yourself();
  40193. return self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  40194. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40195. },
  40196. args: ["anIRInstruction"],
  40197. 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 instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
  40198. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  40199. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  40200. }),
  40201. $globals.IRSendInliner);
  40202. $core.addMethod(
  40203. $core.method({
  40204. selector: "ifNil:ifNotNil:",
  40205. protocol: 'inlining',
  40206. fn: function (anIRInstruction,anotherIRInstruction){
  40207. var self=this;
  40208. return $core.withContext(function($ctx1) {
  40209. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  40210. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40211. },
  40212. args: ["anIRInstruction", "anotherIRInstruction"],
  40213. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  40214. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  40215. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40216. }),
  40217. $globals.IRSendInliner);
  40218. $core.addMethod(
  40219. $core.method({
  40220. selector: "ifNotNil:",
  40221. protocol: 'inlining',
  40222. fn: function (anIRInstruction){
  40223. var self=this;
  40224. return $core.withContext(function($ctx1) {
  40225. var $1,$3,$5,$6,$4,$2;
  40226. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  40227. $ctx1.sendIdx["new"]=1;
  40228. $3=$recv($globals.IRClosure)._new();
  40229. $ctx1.sendIdx["new"]=2;
  40230. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  40231. $5=$recv($globals.IRBlockSequence)._new();
  40232. $recv($5)._add_($recv($recv(self._send())._instructions())._first());
  40233. $6=$recv($5)._yourself();
  40234. $ctx1.sendIdx["yourself"]=1;
  40235. $4=$6;
  40236. $recv($3)._add_($4);
  40237. $ctx1.sendIdx["add:"]=1;
  40238. $2=$recv($3)._yourself();
  40239. return self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  40240. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40241. },
  40242. args: ["anIRInstruction"],
  40243. 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 instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09withBlock: anIRInstruction",
  40244. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  40245. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  40246. }),
  40247. $globals.IRSendInliner);
  40248. $core.addMethod(
  40249. $core.method({
  40250. selector: "ifNotNil:ifNil:",
  40251. protocol: 'inlining',
  40252. fn: function (anIRInstruction,anotherIRInstruction){
  40253. var self=this;
  40254. return $core.withContext(function($ctx1) {
  40255. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  40256. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40257. },
  40258. args: ["anIRInstruction", "anotherIRInstruction"],
  40259. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  40260. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  40261. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40262. }),
  40263. $globals.IRSendInliner);
  40264. $core.addMethod(
  40265. $core.method({
  40266. selector: "ifTrue:",
  40267. protocol: 'inlining',
  40268. fn: function (anIRInstruction){
  40269. var self=this;
  40270. return $core.withContext(function($ctx1) {
  40271. return self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  40272. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40273. },
  40274. args: ["anIRInstruction"],
  40275. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  40276. referencedClasses: ["IRInlinedIfTrue"],
  40277. messageSends: ["inlinedSend:withBlock:", "new"]
  40278. }),
  40279. $globals.IRSendInliner);
  40280. $core.addMethod(
  40281. $core.method({
  40282. selector: "ifTrue:ifFalse:",
  40283. protocol: 'inlining',
  40284. fn: function (anIRInstruction,anotherIRInstruction){
  40285. var self=this;
  40286. return $core.withContext(function($ctx1) {
  40287. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  40288. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40289. },
  40290. args: ["anIRInstruction", "anotherIRInstruction"],
  40291. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  40292. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  40293. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40294. }),
  40295. $globals.IRSendInliner);
  40296. $core.addMethod(
  40297. $core.method({
  40298. selector: "inlineClosure:",
  40299. protocol: 'inlining',
  40300. fn: function (anIRClosure){
  40301. var self=this;
  40302. var inlinedClosure,sequence,statements;
  40303. return $core.withContext(function($ctx1) {
  40304. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8,$22,$21,$25,$24,$26,$23,$27,$30,$29,$28;
  40305. inlinedClosure=self._inlinedClosure();
  40306. $1=inlinedClosure;
  40307. $2=$recv(anIRClosure)._scope();
  40308. $ctx1.sendIdx["scope"]=1;
  40309. $recv($1)._scope_($2);
  40310. $ctx1.sendIdx["scope:"]=1;
  40311. $recv($1)._parent_($recv(anIRClosure)._parent());
  40312. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  40313. return $core.withContext(function($ctx2) {
  40314. return $recv(inlinedClosure)._add_(each);
  40315. $ctx2.sendIdx["add:"]=1;
  40316. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40317. }));
  40318. $ctx1.sendIdx["do:"]=1;
  40319. sequence=self._inlinedSequence();
  40320. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  40321. return $core.withContext(function($ctx2) {
  40322. $3=inlinedClosure;
  40323. $5=$recv($globals.IRTempDeclaration)._new();
  40324. $ctx2.sendIdx["new"]=1;
  40325. $recv($5)._name_(each);
  40326. $ctx2.sendIdx["name:"]=1;
  40327. $6=$recv($5)._yourself();
  40328. $ctx2.sendIdx["yourself"]=1;
  40329. $4=$6;
  40330. $recv($3)._add_($4);
  40331. $ctx2.sendIdx["add:"]=2;
  40332. $7=sequence;
  40333. $9=$recv($globals.IRAssignment)._new();
  40334. $ctx2.sendIdx["new"]=2;
  40335. $11=$recv($globals.IRVariable)._new();
  40336. $ctx2.sendIdx["new"]=3;
  40337. $13=$recv($globals.AliasVar)._new();
  40338. $ctx2.sendIdx["new"]=4;
  40339. $14=$recv(inlinedClosure)._scope();
  40340. $ctx2.sendIdx["scope"]=2;
  40341. $recv($13)._scope_($14);
  40342. $ctx2.sendIdx["scope:"]=2;
  40343. $recv($13)._name_(each);
  40344. $ctx2.sendIdx["name:"]=2;
  40345. $15=$recv($13)._yourself();
  40346. $ctx2.sendIdx["yourself"]=2;
  40347. $12=$15;
  40348. $10=$recv($11)._variable_($12);
  40349. $ctx2.sendIdx["variable:"]=1;
  40350. $recv($9)._add_($10);
  40351. $ctx2.sendIdx["add:"]=4;
  40352. $17=$recv($globals.IRVariable)._new();
  40353. $ctx2.sendIdx["new"]=5;
  40354. $19=$recv($globals.AliasVar)._new();
  40355. $recv($19)._scope_($recv(inlinedClosure)._scope());
  40356. $recv($19)._name_("$receiver");
  40357. $20=$recv($19)._yourself();
  40358. $ctx2.sendIdx["yourself"]=3;
  40359. $18=$20;
  40360. $16=$recv($17)._variable_($18);
  40361. $recv($9)._add_($16);
  40362. $ctx2.sendIdx["add:"]=5;
  40363. $8=$recv($9)._yourself();
  40364. return $recv($7)._add_($8);
  40365. $ctx2.sendIdx["add:"]=3;
  40366. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40367. }));
  40368. $ctx1.sendIdx["do:"]=2;
  40369. $recv(inlinedClosure)._add_(sequence);
  40370. $ctx1.sendIdx["add:"]=6;
  40371. $22=$recv(anIRClosure)._instructions();
  40372. $ctx1.sendIdx["instructions"]=2;
  40373. $21=$recv($22)._last();
  40374. $ctx1.sendIdx["last"]=1;
  40375. statements=$recv($21)._instructions();
  40376. $ctx1.sendIdx["instructions"]=1;
  40377. $recv(statements)._ifNotEmpty_((function(){
  40378. return $core.withContext(function($ctx2) {
  40379. $recv($recv(statements)._allButLast())._do_((function(each){
  40380. return $core.withContext(function($ctx3) {
  40381. return $recv(sequence)._add_(each);
  40382. $ctx3.sendIdx["add:"]=7;
  40383. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  40384. }));
  40385. $25=$recv(statements)._last();
  40386. $ctx2.sendIdx["last"]=2;
  40387. $24=$recv($25)._isReturn();
  40388. $23=$recv($24)._and_((function(){
  40389. return $core.withContext(function($ctx3) {
  40390. $26=$recv(statements)._last();
  40391. $ctx3.sendIdx["last"]=3;
  40392. return $recv($26)._isBlockReturn();
  40393. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  40394. }));
  40395. if($core.assert($23)){
  40396. $27=sequence;
  40397. $30=$recv(statements)._last();
  40398. $ctx2.sendIdx["last"]=4;
  40399. $29=$recv($30)._instructions();
  40400. $28=$recv($29)._first();
  40401. return $recv($27)._add_($28);
  40402. $ctx2.sendIdx["add:"]=8;
  40403. } else {
  40404. return $recv(sequence)._add_($recv(statements)._last());
  40405. };
  40406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40407. }));
  40408. return inlinedClosure;
  40409. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  40410. },
  40411. args: ["anIRClosure"],
  40412. 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 instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures don't have implicit local returns\x22\x0a\x09\x09(statements last isReturn and: [ statements last isBlockReturn ])\x0a\x09\x09\x09ifTrue: [ sequence add: statements last instructions first ]\x0a\x09\x09\x09ifFalse: [ sequence add: statements last ] ].\x0a\x0a\x09^ inlinedClosure",
  40413. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  40414. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "instructions", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "and:", "isReturn", "isBlockReturn", "first"]
  40415. }),
  40416. $globals.IRSendInliner);
  40417. $core.addMethod(
  40418. $core.method({
  40419. selector: "inlineSend:",
  40420. protocol: 'inlining',
  40421. fn: function (anIRSend){
  40422. var self=this;
  40423. return $core.withContext(function($ctx1) {
  40424. var $2,$1;
  40425. self._send_(anIRSend);
  40426. $2=self._send();
  40427. $ctx1.sendIdx["send"]=1;
  40428. $1=$recv($2)._selector();
  40429. return self._perform_withArguments_($1,$recv($recv(self._send())._instructions())._allButFirst());
  40430. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  40431. },
  40432. args: ["anIRSend"],
  40433. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
  40434. referencedClasses: [],
  40435. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"]
  40436. }),
  40437. $globals.IRSendInliner);
  40438. $core.addMethod(
  40439. $core.method({
  40440. selector: "inlinedClosure",
  40441. protocol: 'factory',
  40442. fn: function (){
  40443. var self=this;
  40444. return $core.withContext(function($ctx1) {
  40445. return $recv($globals.IRInlinedClosure)._new();
  40446. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  40447. },
  40448. args: [],
  40449. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  40450. referencedClasses: ["IRInlinedClosure"],
  40451. messageSends: ["new"]
  40452. }),
  40453. $globals.IRSendInliner);
  40454. $core.addMethod(
  40455. $core.method({
  40456. selector: "inlinedSend:withBlock:",
  40457. protocol: 'inlining',
  40458. fn: function (inlinedSend,anIRInstruction){
  40459. var self=this;
  40460. var inlinedClosure;
  40461. return $core.withContext(function($ctx1) {
  40462. var $1,$2,$5,$4,$3,$6;
  40463. $1=$recv(anIRInstruction)._isClosure();
  40464. if(!$core.assert($1)){
  40465. self._inliningError_("Message argument should be a block");
  40466. $ctx1.sendIdx["inliningError:"]=1;
  40467. };
  40468. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  40469. if(!$core.assert($2)){
  40470. self._inliningError_("Inlined block should have zero argument");
  40471. };
  40472. inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  40473. $5=self._send();
  40474. $ctx1.sendIdx["send"]=1;
  40475. $4=$recv($5)._instructions();
  40476. $3=$recv($4)._first();
  40477. $recv(inlinedSend)._add_($3);
  40478. $ctx1.sendIdx["add:"]=1;
  40479. $recv(inlinedSend)._add_(inlinedClosure);
  40480. $recv(self._send())._replaceWith_(inlinedSend);
  40481. $6=$recv($recv(inlinedSend)._method())._internalVariables();
  40482. $ctx1.sendIdx["internalVariables"]=1;
  40483. $recv($6)._addAll_($recv(inlinedSend)._internalVariables());
  40484. return inlinedSend;
  40485. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  40486. },
  40487. args: ["inlinedSend", "anIRInstruction"],
  40488. 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 instructions first;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend",
  40489. referencedClasses: [],
  40490. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  40491. }),
  40492. $globals.IRSendInliner);
  40493. $core.addMethod(
  40494. $core.method({
  40495. selector: "inlinedSend:withBlock:withBlock:",
  40496. protocol: 'inlining',
  40497. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  40498. var self=this;
  40499. var inlinedClosure1,inlinedClosure2;
  40500. return $core.withContext(function($ctx1) {
  40501. var $1,$2,$3,$4,$7,$6,$5,$8;
  40502. $1=$recv(anIRInstruction)._isClosure();
  40503. $ctx1.sendIdx["isClosure"]=1;
  40504. if(!$core.assert($1)){
  40505. self._inliningError_("Message argument should be a block");
  40506. $ctx1.sendIdx["inliningError:"]=1;
  40507. };
  40508. $2=$recv(anotherIRInstruction)._isClosure();
  40509. if(!$core.assert($2)){
  40510. self._inliningError_("Message argument should be a block");
  40511. };
  40512. $3=self._translator();
  40513. $ctx1.sendIdx["translator"]=1;
  40514. $4=self._inlineClosure_(anIRInstruction);
  40515. $ctx1.sendIdx["inlineClosure:"]=1;
  40516. inlinedClosure1=$recv($3)._visit_($4);
  40517. $ctx1.sendIdx["visit:"]=1;
  40518. inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  40519. $7=self._send();
  40520. $ctx1.sendIdx["send"]=1;
  40521. $6=$recv($7)._instructions();
  40522. $5=$recv($6)._first();
  40523. $recv(inlinedSend)._add_($5);
  40524. $ctx1.sendIdx["add:"]=1;
  40525. $recv(inlinedSend)._add_(inlinedClosure1);
  40526. $ctx1.sendIdx["add:"]=2;
  40527. $recv(inlinedSend)._add_(inlinedClosure2);
  40528. $recv(self._send())._replaceWith_(inlinedSend);
  40529. $8=$recv($recv(inlinedSend)._method())._internalVariables();
  40530. $ctx1.sendIdx["internalVariables"]=1;
  40531. $recv($8)._addAll_($recv(inlinedSend)._internalVariables());
  40532. return inlinedSend;
  40533. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  40534. },
  40535. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  40536. 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 instructions first;\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",
  40537. referencedClasses: [],
  40538. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  40539. }),
  40540. $globals.IRSendInliner);
  40541. $core.addMethod(
  40542. $core.method({
  40543. selector: "inlinedSequence",
  40544. protocol: 'factory',
  40545. fn: function (){
  40546. var self=this;
  40547. return $core.withContext(function($ctx1) {
  40548. return $recv($globals.IRInlinedSequence)._new();
  40549. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  40550. },
  40551. args: [],
  40552. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  40553. referencedClasses: ["IRInlinedSequence"],
  40554. messageSends: ["new"]
  40555. }),
  40556. $globals.IRSendInliner);
  40557. $core.addMethod(
  40558. $core.method({
  40559. selector: "inliningError:",
  40560. protocol: 'error handling',
  40561. fn: function (aString){
  40562. var self=this;
  40563. return $core.withContext(function($ctx1) {
  40564. $recv($globals.InliningError)._signal_(aString);
  40565. return self;
  40566. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  40567. },
  40568. args: ["aString"],
  40569. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  40570. referencedClasses: ["InliningError"],
  40571. messageSends: ["signal:"]
  40572. }),
  40573. $globals.IRSendInliner);
  40574. $core.addMethod(
  40575. $core.method({
  40576. selector: "send",
  40577. protocol: 'accessing',
  40578. fn: function (){
  40579. var self=this;
  40580. return self["@send"];
  40581. },
  40582. args: [],
  40583. source: "send\x0a\x09^ send",
  40584. referencedClasses: [],
  40585. messageSends: []
  40586. }),
  40587. $globals.IRSendInliner);
  40588. $core.addMethod(
  40589. $core.method({
  40590. selector: "send:",
  40591. protocol: 'accessing',
  40592. fn: function (anIRSend){
  40593. var self=this;
  40594. self["@send"]=anIRSend;
  40595. return self;
  40596. },
  40597. args: ["anIRSend"],
  40598. source: "send: anIRSend\x0a\x09send := anIRSend",
  40599. referencedClasses: [],
  40600. messageSends: []
  40601. }),
  40602. $globals.IRSendInliner);
  40603. $core.addMethod(
  40604. $core.method({
  40605. selector: "translator",
  40606. protocol: 'accessing',
  40607. fn: function (){
  40608. var self=this;
  40609. return self["@translator"];
  40610. },
  40611. args: [],
  40612. source: "translator\x0a\x09^ translator",
  40613. referencedClasses: [],
  40614. messageSends: []
  40615. }),
  40616. $globals.IRSendInliner);
  40617. $core.addMethod(
  40618. $core.method({
  40619. selector: "translator:",
  40620. protocol: 'accessing',
  40621. fn: function (anASTTranslator){
  40622. var self=this;
  40623. self["@translator"]=anASTTranslator;
  40624. return self;
  40625. },
  40626. args: ["anASTTranslator"],
  40627. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  40628. referencedClasses: [],
  40629. messageSends: []
  40630. }),
  40631. $globals.IRSendInliner);
  40632. $core.addMethod(
  40633. $core.method({
  40634. selector: "inlinedSelectors",
  40635. protocol: 'accessing',
  40636. fn: function (){
  40637. var self=this;
  40638. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  40639. },
  40640. args: [],
  40641. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  40642. referencedClasses: [],
  40643. messageSends: []
  40644. }),
  40645. $globals.IRSendInliner.klass);
  40646. $core.addMethod(
  40647. $core.method({
  40648. selector: "shouldInline:",
  40649. protocol: 'accessing',
  40650. fn: function (anIRInstruction){
  40651. var self=this;
  40652. return $core.withContext(function($ctx1) {
  40653. var $1;
  40654. $1=$recv(self._inlinedSelectors())._includes_($recv(anIRInstruction)._selector());
  40655. if(!$core.assert($1)){
  40656. return false;
  40657. };
  40658. return $recv($recv($recv(anIRInstruction)._instructions())._allButFirst())._allSatisfy_((function(each){
  40659. return $core.withContext(function($ctx2) {
  40660. return $recv(each)._isClosure();
  40661. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40662. }));
  40663. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner.klass)});
  40664. },
  40665. args: ["anIRInstruction"],
  40666. source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09^ anIRInstruction instructions allButFirst allSatisfy: [ :each | each isClosure]",
  40667. referencedClasses: [],
  40668. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "allButFirst", "instructions", "isClosure"]
  40669. }),
  40670. $globals.IRSendInliner.klass);
  40671. $core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  40672. $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};";
  40673. $core.addMethod(
  40674. $core.method({
  40675. selector: "assignment",
  40676. protocol: 'accessing',
  40677. fn: function (){
  40678. var self=this;
  40679. return self["@assignment"];
  40680. },
  40681. args: [],
  40682. source: "assignment\x0a\x09^ assignment",
  40683. referencedClasses: [],
  40684. messageSends: []
  40685. }),
  40686. $globals.IRAssignmentInliner);
  40687. $core.addMethod(
  40688. $core.method({
  40689. selector: "assignment:",
  40690. protocol: 'accessing',
  40691. fn: function (aNode){
  40692. var self=this;
  40693. self["@assignment"]=aNode;
  40694. return self;
  40695. },
  40696. args: ["aNode"],
  40697. source: "assignment: aNode\x0a\x09assignment := aNode",
  40698. referencedClasses: [],
  40699. messageSends: []
  40700. }),
  40701. $globals.IRAssignmentInliner);
  40702. $core.addMethod(
  40703. $core.method({
  40704. selector: "inlineAssignment:",
  40705. protocol: 'inlining',
  40706. fn: function (anIRAssignment){
  40707. var self=this;
  40708. var inlinedAssignment;
  40709. return $core.withContext(function($ctx1) {
  40710. var $1;
  40711. self._assignment_(anIRAssignment);
  40712. inlinedAssignment=$recv($globals.IRInlinedAssignment)._new();
  40713. $1=$recv(anIRAssignment)._instructions();
  40714. $ctx1.sendIdx["instructions"]=1;
  40715. $recv($1)._do_((function(each){
  40716. return $core.withContext(function($ctx2) {
  40717. return $recv(inlinedAssignment)._add_(each);
  40718. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40719. }));
  40720. $recv(anIRAssignment)._replaceWith_(inlinedAssignment);
  40721. self._inlineSend_($recv($recv(inlinedAssignment)._instructions())._last());
  40722. return inlinedAssignment;
  40723. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},$globals.IRAssignmentInliner)});
  40724. },
  40725. args: ["anIRAssignment"],
  40726. source: "inlineAssignment: anIRAssignment\x0a\x09| inlinedAssignment |\x0a\x09self assignment: anIRAssignment.\x0a\x09inlinedAssignment := IRInlinedAssignment new.\x0a\x09anIRAssignment instructions do: [ :each |\x0a\x09\x09inlinedAssignment add: each ].\x0a\x09anIRAssignment replaceWith: inlinedAssignment.\x0a\x09self inlineSend: inlinedAssignment instructions last.\x0a\x09^ inlinedAssignment",
  40727. referencedClasses: ["IRInlinedAssignment"],
  40728. messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  40729. }),
  40730. $globals.IRAssignmentInliner);
  40731. $core.addMethod(
  40732. $core.method({
  40733. selector: "inlineClosure:",
  40734. protocol: 'inlining',
  40735. fn: function (anIRClosure){
  40736. var self=this;
  40737. var inlinedClosure,statements;
  40738. return $core.withContext(function($ctx1) {
  40739. var $2,$1,$4,$3,$5,$7,$6;
  40740. inlinedClosure=(
  40741. $ctx1.supercall = true,
  40742. ($globals.IRAssignmentInliner.superclass||$boot.dnu).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  40743. $ctx1.supercall = false;
  40744. $2=$recv(inlinedClosure)._instructions();
  40745. $ctx1.sendIdx["instructions"]=2;
  40746. $1=$recv($2)._last();
  40747. $ctx1.sendIdx["last"]=1;
  40748. statements=$recv($1)._instructions();
  40749. $ctx1.sendIdx["instructions"]=1;
  40750. $recv(statements)._ifNotEmpty_((function(){
  40751. return $core.withContext(function($ctx2) {
  40752. $4=$recv(statements)._last();
  40753. $ctx2.sendIdx["last"]=2;
  40754. $3=$recv($4)._canBeAssigned();
  40755. if($core.assert($3)){
  40756. $5=$recv(statements)._last();
  40757. $ctx2.sendIdx["last"]=3;
  40758. $7=$recv($globals.IRAssignment)._new();
  40759. $recv($7)._add_($recv($recv(self._assignment())._instructions())._first());
  40760. $ctx2.sendIdx["add:"]=1;
  40761. $recv($7)._add_($recv($recv(statements)._last())._copy());
  40762. $6=$recv($7)._yourself();
  40763. return $recv($5)._replaceWith_($6);
  40764. };
  40765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40766. }));
  40767. return inlinedClosure;
  40768. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},$globals.IRAssignmentInliner)});
  40769. },
  40770. args: ["anIRClosure"],
  40771. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure statements |\x0a\x0a\x09inlinedClosure := super inlineClosure: anIRClosure.\x0a\x09statements := inlinedClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last canBeAssigned ifTrue: [\x0a\x09\x09\x09statements last replaceWith: (IRAssignment new\x0a\x09\x09\x09\x09add: self assignment instructions first;\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ inlinedClosure",
  40772. referencedClasses: ["IRAssignment"],
  40773. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"]
  40774. }),
  40775. $globals.IRAssignmentInliner);
  40776. $core.addClass('IRReturnInliner', $globals.IRSendInliner, [], 'Compiler-Inlining');
  40777. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  40778. $core.addMethod(
  40779. $core.method({
  40780. selector: "inlineClosure:",
  40781. protocol: 'inlining',
  40782. fn: function (anIRClosure){
  40783. var self=this;
  40784. var closure,statements;
  40785. return $core.withContext(function($ctx1) {
  40786. var $1,$3,$2,$4,$6,$5;
  40787. closure=(
  40788. $ctx1.supercall = true,
  40789. ($globals.IRReturnInliner.superclass||$boot.dnu).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  40790. $ctx1.supercall = false;
  40791. $1=$recv($recv(closure)._instructions())._last();
  40792. $ctx1.sendIdx["last"]=1;
  40793. statements=$recv($1)._instructions();
  40794. $ctx1.sendIdx["instructions"]=1;
  40795. $recv(statements)._ifNotEmpty_((function(){
  40796. return $core.withContext(function($ctx2) {
  40797. $3=$recv(statements)._last();
  40798. $ctx2.sendIdx["last"]=2;
  40799. $2=$recv($3)._isReturn();
  40800. if(!$core.assert($2)){
  40801. $4=$recv(statements)._last();
  40802. $ctx2.sendIdx["last"]=3;
  40803. $6=$recv($globals.IRReturn)._new();
  40804. $recv($6)._add_($recv($recv(statements)._last())._copy());
  40805. $5=$recv($6)._yourself();
  40806. return $recv($4)._replaceWith_($5);
  40807. };
  40808. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40809. }));
  40810. return closure;
  40811. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},$globals.IRReturnInliner)});
  40812. },
  40813. args: ["anIRClosure"],
  40814. source: "inlineClosure: anIRClosure\x0a\x09| closure statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09statements := closure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last isReturn\x0a\x09\x09\x09ifFalse: [ statements last replaceWith: (IRReturn new\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself)] ].\x0a\x0a\x09^ closure",
  40815. referencedClasses: ["IRReturn"],
  40816. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"]
  40817. }),
  40818. $globals.IRReturnInliner);
  40819. $core.addMethod(
  40820. $core.method({
  40821. selector: "inlineReturn:",
  40822. protocol: 'inlining',
  40823. fn: function (anIRReturn){
  40824. var self=this;
  40825. var return_;
  40826. return $core.withContext(function($ctx1) {
  40827. var $1;
  40828. return_=self._inlinedReturn();
  40829. $1=$recv(anIRReturn)._instructions();
  40830. $ctx1.sendIdx["instructions"]=1;
  40831. $recv($1)._do_((function(each){
  40832. return $core.withContext(function($ctx2) {
  40833. return $recv(return_)._add_(each);
  40834. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40835. }));
  40836. $recv(anIRReturn)._replaceWith_(return_);
  40837. self._inlineSend_($recv($recv(return_)._instructions())._last());
  40838. return return_;
  40839. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},$globals.IRReturnInliner)});
  40840. },
  40841. args: ["anIRReturn"],
  40842. source: "inlineReturn: anIRReturn\x0a\x09| return |\x0a\x09return := self inlinedReturn.\x0a\x09anIRReturn instructions do: [ :each |\x0a\x09\x09return add: each ].\x0a\x09anIRReturn replaceWith: return.\x0a\x09self inlineSend: return instructions last.\x0a\x09^ return",
  40843. referencedClasses: [],
  40844. messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  40845. }),
  40846. $globals.IRReturnInliner);
  40847. $core.addMethod(
  40848. $core.method({
  40849. selector: "inlinedReturn",
  40850. protocol: 'factory',
  40851. fn: function (){
  40852. var self=this;
  40853. return $core.withContext(function($ctx1) {
  40854. return $recv($globals.IRInlinedReturn)._new();
  40855. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},$globals.IRReturnInliner)});
  40856. },
  40857. args: [],
  40858. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  40859. referencedClasses: ["IRInlinedReturn"],
  40860. messageSends: ["new"]
  40861. }),
  40862. $globals.IRReturnInliner);
  40863. $core.addClass('InliningCodeGenerator', $globals.CodeGenerator, [], 'Compiler-Inlining');
  40864. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  40865. $core.addMethod(
  40866. $core.method({
  40867. selector: "compileNode:",
  40868. protocol: 'compiling',
  40869. fn: function (aNode){
  40870. var self=this;
  40871. var ir,stream;
  40872. return $core.withContext(function($ctx1) {
  40873. var $1;
  40874. $recv(self._semanticAnalyzer())._visit_(aNode);
  40875. $ctx1.sendIdx["visit:"]=1;
  40876. ir=$recv(self._translator())._visit_(aNode);
  40877. $ctx1.sendIdx["visit:"]=2;
  40878. $recv(self._inliner())._visit_(ir);
  40879. $ctx1.sendIdx["visit:"]=3;
  40880. $1=self._irTranslator();
  40881. $recv($1)._currentClass_(self._currentClass());
  40882. $recv($1)._visit_(ir);
  40883. return $recv($1)._contents();
  40884. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.InliningCodeGenerator)});
  40885. },
  40886. args: ["aNode"],
  40887. 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",
  40888. referencedClasses: [],
  40889. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"]
  40890. }),
  40891. $globals.InliningCodeGenerator);
  40892. $core.addMethod(
  40893. $core.method({
  40894. selector: "inliner",
  40895. protocol: 'compiling',
  40896. fn: function (){
  40897. var self=this;
  40898. return $core.withContext(function($ctx1) {
  40899. return $recv($globals.IRInliner)._new();
  40900. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  40901. },
  40902. args: [],
  40903. source: "inliner\x0a\x09^ IRInliner new",
  40904. referencedClasses: ["IRInliner"],
  40905. messageSends: ["new"]
  40906. }),
  40907. $globals.InliningCodeGenerator);
  40908. $core.addMethod(
  40909. $core.method({
  40910. selector: "irTranslator",
  40911. protocol: 'compiling',
  40912. fn: function (){
  40913. var self=this;
  40914. return $core.withContext(function($ctx1) {
  40915. return $recv($globals.IRInliningJSTranslator)._new();
  40916. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.InliningCodeGenerator)});
  40917. },
  40918. args: [],
  40919. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  40920. referencedClasses: ["IRInliningJSTranslator"],
  40921. messageSends: ["new"]
  40922. }),
  40923. $globals.InliningCodeGenerator);
  40924. $core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Inlining');
  40925. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  40926. });
  40927. define("amber_core/Compiler-Interpreter", ["amber/boot", "amber_core/Kernel-Methods", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects", "amber_core/Compiler-AST", "amber_core/Kernel-Exceptions"], function($boot){"use strict";
  40928. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  40929. $core.addPackage('Compiler-Interpreter');
  40930. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  40931. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  40932. $core.addClass('AIBlockClosure', $globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  40933. $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`).";
  40934. $core.addMethod(
  40935. $core.method({
  40936. selector: "applyTo:arguments:",
  40937. protocol: 'evaluating',
  40938. fn: function (anObject,aCollection){
  40939. var self=this;
  40940. return $core.withContext(function($ctx1) {
  40941. self._interpreterError();
  40942. return self;
  40943. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  40944. },
  40945. args: ["anObject", "aCollection"],
  40946. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  40947. referencedClasses: [],
  40948. messageSends: ["interpreterError"]
  40949. }),
  40950. $globals.AIBlockClosure);
  40951. $core.addMethod(
  40952. $core.method({
  40953. selector: "compiledSource",
  40954. protocol: 'accessing',
  40955. fn: function (){
  40956. var self=this;
  40957. return "[ AST Block closure ]";
  40958. },
  40959. args: [],
  40960. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  40961. referencedClasses: [],
  40962. messageSends: []
  40963. }),
  40964. $globals.AIBlockClosure);
  40965. $core.addMethod(
  40966. $core.method({
  40967. selector: "currySelf",
  40968. protocol: 'converting',
  40969. fn: function (){
  40970. var self=this;
  40971. return $core.withContext(function($ctx1) {
  40972. self._interpreterError();
  40973. return self;
  40974. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  40975. },
  40976. args: [],
  40977. source: "currySelf\x0a\x09self interpreterError",
  40978. referencedClasses: [],
  40979. messageSends: ["interpreterError"]
  40980. }),
  40981. $globals.AIBlockClosure);
  40982. $core.addMethod(
  40983. $core.method({
  40984. selector: "initializeWithContext:node:",
  40985. protocol: 'initialization',
  40986. fn: function (aContext,aNode){
  40987. var self=this;
  40988. self["@node"]=aNode;
  40989. self["@outerContext"]=aContext;
  40990. return self;
  40991. },
  40992. args: ["aContext", "aNode"],
  40993. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  40994. referencedClasses: [],
  40995. messageSends: []
  40996. }),
  40997. $globals.AIBlockClosure);
  40998. $core.addMethod(
  40999. $core.method({
  41000. selector: "interpreterError",
  41001. protocol: 'error handling',
  41002. fn: function (){
  41003. var self=this;
  41004. return $core.withContext(function($ctx1) {
  41005. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  41006. return self;
  41007. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  41008. },
  41009. args: [],
  41010. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  41011. referencedClasses: ["ASTInterpreterError"],
  41012. messageSends: ["signal:"]
  41013. }),
  41014. $globals.AIBlockClosure);
  41015. $core.addMethod(
  41016. $core.method({
  41017. selector: "numArgs",
  41018. protocol: 'accessing',
  41019. fn: function (){
  41020. var self=this;
  41021. return $core.withContext(function($ctx1) {
  41022. return $recv($recv(self["@node"])._temps())._size();
  41023. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  41024. },
  41025. args: [],
  41026. source: "numArgs\x0a\x09^ node temps size",
  41027. referencedClasses: [],
  41028. messageSends: ["size", "temps"]
  41029. }),
  41030. $globals.AIBlockClosure);
  41031. $core.addMethod(
  41032. $core.method({
  41033. selector: "value",
  41034. protocol: 'evaluating',
  41035. fn: function (){
  41036. var self=this;
  41037. return $core.withContext(function($ctx1) {
  41038. return self._valueWithPossibleArguments_([]);
  41039. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  41040. },
  41041. args: [],
  41042. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  41043. referencedClasses: [],
  41044. messageSends: ["valueWithPossibleArguments:"]
  41045. }),
  41046. $globals.AIBlockClosure);
  41047. $core.addMethod(
  41048. $core.method({
  41049. selector: "value:",
  41050. protocol: 'evaluating',
  41051. fn: function (anArgument){
  41052. var self=this;
  41053. return $core.withContext(function($ctx1) {
  41054. return self._valueWithPossibleArguments_([anArgument]);
  41055. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  41056. },
  41057. args: ["anArgument"],
  41058. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  41059. referencedClasses: [],
  41060. messageSends: ["valueWithPossibleArguments:"]
  41061. }),
  41062. $globals.AIBlockClosure);
  41063. $core.addMethod(
  41064. $core.method({
  41065. selector: "value:value:",
  41066. protocol: 'evaluating',
  41067. fn: function (firstArgument,secondArgument){
  41068. var self=this;
  41069. return $core.withContext(function($ctx1) {
  41070. return self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  41071. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  41072. },
  41073. args: ["firstArgument", "secondArgument"],
  41074. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  41075. referencedClasses: [],
  41076. messageSends: ["valueWithPossibleArguments:"]
  41077. }),
  41078. $globals.AIBlockClosure);
  41079. $core.addMethod(
  41080. $core.method({
  41081. selector: "value:value:value:",
  41082. protocol: 'evaluating',
  41083. fn: function (firstArgument,secondArgument,thirdArgument){
  41084. var self=this;
  41085. return $core.withContext(function($ctx1) {
  41086. return self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  41087. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  41088. },
  41089. args: ["firstArgument", "secondArgument", "thirdArgument"],
  41090. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  41091. referencedClasses: [],
  41092. messageSends: ["valueWithPossibleArguments:"]
  41093. }),
  41094. $globals.AIBlockClosure);
  41095. $core.addMethod(
  41096. $core.method({
  41097. selector: "valueWithPossibleArguments:",
  41098. protocol: 'evaluating',
  41099. fn: function (aCollection){
  41100. var self=this;
  41101. var context,sequenceNode;
  41102. return $core.withContext(function($ctx1) {
  41103. var $1,$2,$3;
  41104. context=$recv(self["@outerContext"])._newInnerContext();
  41105. $1=$recv($recv($recv(self["@node"])._nodes())._first())._copy();
  41106. $recv($1)._parent_(nil);
  41107. sequenceNode=$recv($1)._yourself();
  41108. $recv($recv(sequenceNode)._temps())._do_((function(each){
  41109. return $core.withContext(function($ctx2) {
  41110. return $recv(context)._defineLocal_(each);
  41111. $ctx2.sendIdx["defineLocal:"]=1;
  41112. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41113. }));
  41114. $recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){
  41115. return $core.withContext(function($ctx2) {
  41116. $recv(context)._defineLocal_(each);
  41117. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  41118. return nil;
  41119. })));
  41120. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  41121. }));
  41122. $2=$recv(context)._interpreter();
  41123. $ctx1.sendIdx["interpreter"]=1;
  41124. $recv($2)._node_(sequenceNode);
  41125. $recv($2)._enterNode();
  41126. $recv($2)._proceed();
  41127. $3=$recv(self["@outerContext"])._interpreter();
  41128. $ctx1.sendIdx["interpreter"]=2;
  41129. $recv($3)._setNonLocalReturnFromContext_(context);
  41130. return $recv($recv(context)._interpreter())._pop();
  41131. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  41132. },
  41133. args: ["aCollection"],
  41134. 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 nodes 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",
  41135. referencedClasses: [],
  41136. messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  41137. }),
  41138. $globals.AIBlockClosure);
  41139. $core.addMethod(
  41140. $core.method({
  41141. selector: "forContext:node:",
  41142. protocol: 'instance creation',
  41143. fn: function (aContext,aNode){
  41144. var self=this;
  41145. return $core.withContext(function($ctx1) {
  41146. var $1;
  41147. $1=self._new();
  41148. $recv($1)._initializeWithContext_node_(aContext,aNode);
  41149. return $recv($1)._yourself();
  41150. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)});
  41151. },
  41152. args: ["aContext", "aNode"],
  41153. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  41154. referencedClasses: [],
  41155. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  41156. }),
  41157. $globals.AIBlockClosure.klass);
  41158. $core.addClass('AIContext', $globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
  41159. $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)";
  41160. $core.addMethod(
  41161. $core.method({
  41162. selector: "arguments",
  41163. protocol: 'interpreting',
  41164. fn: function (){
  41165. var self=this;
  41166. return $core.withContext(function($ctx1) {
  41167. return $recv($recv(self._ast())._arguments())._collect_((function(each){
  41168. return $core.withContext(function($ctx2) {
  41169. return self._localAt_ifAbsent_(each,(function(){
  41170. return $core.withContext(function($ctx3) {
  41171. return self._error_("Argument not in context");
  41172. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41173. }));
  41174. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41175. }));
  41176. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  41177. },
  41178. args: [],
  41179. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  41180. referencedClasses: [],
  41181. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  41182. }),
  41183. $globals.AIContext);
  41184. $core.addMethod(
  41185. $core.method({
  41186. selector: "ast",
  41187. protocol: 'interpreting',
  41188. fn: function (){
  41189. var self=this;
  41190. return $core.withContext(function($ctx1) {
  41191. var $1,$2,$3,$receiver;
  41192. $1=self._isBlockContext();
  41193. if($core.assert($1)){
  41194. $2=self._outerContext();
  41195. return $recv($2)._ifNotNil_((function(context){
  41196. return $core.withContext(function($ctx2) {
  41197. return $recv(context)._ast();
  41198. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,2)});
  41199. }));
  41200. };
  41201. $3=self["@ast"];
  41202. if(($receiver = $3) == null || $receiver.isNil){
  41203. self._initializeAST();
  41204. } else {
  41205. $3;
  41206. };
  41207. return self["@ast"];
  41208. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  41209. },
  41210. args: [],
  41211. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  41212. referencedClasses: [],
  41213. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  41214. }),
  41215. $globals.AIContext);
  41216. $core.addMethod(
  41217. $core.method({
  41218. selector: "basicLocalAt:",
  41219. protocol: 'private',
  41220. fn: function (aString){
  41221. var self=this;
  41222. return $core.withContext(function($ctx1) {
  41223. return $recv(self._locals())._at_(aString);
  41224. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  41225. },
  41226. args: ["aString"],
  41227. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  41228. referencedClasses: [],
  41229. messageSends: ["at:", "locals"]
  41230. }),
  41231. $globals.AIContext);
  41232. $core.addMethod(
  41233. $core.method({
  41234. selector: "basicLocalAt:put:",
  41235. protocol: 'private',
  41236. fn: function (aString,anObject){
  41237. var self=this;
  41238. return $core.withContext(function($ctx1) {
  41239. $recv(self._locals())._at_put_(aString,anObject);
  41240. return self;
  41241. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  41242. },
  41243. args: ["aString", "anObject"],
  41244. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  41245. referencedClasses: [],
  41246. messageSends: ["at:put:", "locals"]
  41247. }),
  41248. $globals.AIContext);
  41249. $core.addMethod(
  41250. $core.method({
  41251. selector: "basicReceiver",
  41252. protocol: 'interpreting',
  41253. fn: function (){
  41254. var self=this;
  41255. return $core.withContext(function($ctx1) {
  41256. return self._localAt_("self");
  41257. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  41258. },
  41259. args: [],
  41260. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  41261. referencedClasses: [],
  41262. messageSends: ["localAt:"]
  41263. }),
  41264. $globals.AIContext);
  41265. $core.addMethod(
  41266. $core.method({
  41267. selector: "defineLocal:",
  41268. protocol: 'accessing',
  41269. fn: function (aString){
  41270. var self=this;
  41271. return $core.withContext(function($ctx1) {
  41272. $recv(self._locals())._at_put_(aString,nil);
  41273. return self;
  41274. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  41275. },
  41276. args: ["aString"],
  41277. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  41278. referencedClasses: [],
  41279. messageSends: ["at:put:", "locals"]
  41280. }),
  41281. $globals.AIContext);
  41282. $core.addMethod(
  41283. $core.method({
  41284. selector: "evaluate:on:",
  41285. protocol: 'evaluating',
  41286. fn: function (aString,anEvaluator){
  41287. var self=this;
  41288. return $core.withContext(function($ctx1) {
  41289. return $recv(anEvaluator)._evaluate_context_(aString,self);
  41290. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  41291. },
  41292. args: ["aString", "anEvaluator"],
  41293. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  41294. referencedClasses: [],
  41295. messageSends: ["evaluate:context:"]
  41296. }),
  41297. $globals.AIContext);
  41298. $core.addMethod(
  41299. $core.method({
  41300. selector: "evaluateNode:",
  41301. protocol: 'evaluating',
  41302. fn: function (aNode){
  41303. var self=this;
  41304. return $core.withContext(function($ctx1) {
  41305. var $1;
  41306. $1=$recv($globals.ASTInterpreter)._new();
  41307. $recv($1)._context_(self);
  41308. $recv($1)._node_(aNode);
  41309. $recv($1)._enterNode();
  41310. $recv($1)._proceed();
  41311. return $recv($1)._result();
  41312. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  41313. },
  41314. args: ["aNode"],
  41315. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  41316. referencedClasses: ["ASTInterpreter"],
  41317. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  41318. }),
  41319. $globals.AIContext);
  41320. $core.addMethod(
  41321. $core.method({
  41322. selector: "evaluatedSelector",
  41323. protocol: 'accessing',
  41324. fn: function (){
  41325. var self=this;
  41326. return self["@evaluatedSelector"];
  41327. },
  41328. args: [],
  41329. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  41330. referencedClasses: [],
  41331. messageSends: []
  41332. }),
  41333. $globals.AIContext);
  41334. $core.addMethod(
  41335. $core.method({
  41336. selector: "evaluatedSelector:",
  41337. protocol: 'accessing',
  41338. fn: function (aString){
  41339. var self=this;
  41340. self["@evaluatedSelector"]=aString;
  41341. return self;
  41342. },
  41343. args: ["aString"],
  41344. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  41345. referencedClasses: [],
  41346. messageSends: []
  41347. }),
  41348. $globals.AIContext);
  41349. $core.addMethod(
  41350. $core.method({
  41351. selector: "index",
  41352. protocol: 'accessing',
  41353. fn: function (){
  41354. var self=this;
  41355. return $core.withContext(function($ctx1) {
  41356. var $1,$receiver;
  41357. $1=self["@index"];
  41358. if(($receiver = $1) == null || $receiver.isNil){
  41359. return (0);
  41360. } else {
  41361. return $1;
  41362. };
  41363. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  41364. },
  41365. args: [],
  41366. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  41367. referencedClasses: [],
  41368. messageSends: ["ifNil:"]
  41369. }),
  41370. $globals.AIContext);
  41371. $core.addMethod(
  41372. $core.method({
  41373. selector: "index:",
  41374. protocol: 'accessing',
  41375. fn: function (anInteger){
  41376. var self=this;
  41377. self["@index"]=anInteger;
  41378. return self;
  41379. },
  41380. args: ["anInteger"],
  41381. source: "index: anInteger\x0a\x09index := anInteger",
  41382. referencedClasses: [],
  41383. messageSends: []
  41384. }),
  41385. $globals.AIContext);
  41386. $core.addMethod(
  41387. $core.method({
  41388. selector: "initializeAST",
  41389. protocol: 'initialization',
  41390. fn: function (){
  41391. var self=this;
  41392. return $core.withContext(function($ctx1) {
  41393. var $1;
  41394. $1=self._method();
  41395. $ctx1.sendIdx["method"]=1;
  41396. self["@ast"]=$recv($1)._ast();
  41397. $recv($recv($globals.SemanticAnalyzer)._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]);
  41398. return self;
  41399. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  41400. },
  41401. args: [],
  41402. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  41403. referencedClasses: ["SemanticAnalyzer"],
  41404. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  41405. }),
  41406. $globals.AIContext);
  41407. $core.addMethod(
  41408. $core.method({
  41409. selector: "initializeFromMethodContext:",
  41410. protocol: 'initialization',
  41411. fn: function (aMethodContext){
  41412. var self=this;
  41413. return $core.withContext(function($ctx1) {
  41414. var $1,$2,$3,$receiver;
  41415. self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  41416. self._index_($recv(aMethodContext)._index());
  41417. self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  41418. self._receiver_($recv(aMethodContext)._receiver());
  41419. self._supercall_($recv(aMethodContext)._supercall());
  41420. self._selector_($recv(aMethodContext)._selector());
  41421. $1=$recv(aMethodContext)._outerContext();
  41422. $ctx1.sendIdx["outerContext"]=1;
  41423. if(($receiver = $1) == null || $receiver.isNil){
  41424. $1;
  41425. } else {
  41426. var outer;
  41427. outer=$receiver;
  41428. $2=$recv(outer)._methodContext();
  41429. if(($receiver = $2) == null || $receiver.isNil){
  41430. $2;
  41431. } else {
  41432. self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  41433. };
  41434. $3=$recv(aMethodContext)._locals();
  41435. $ctx1.sendIdx["locals"]=1;
  41436. $recv($3)._keysAndValuesDo_((function(key,value){
  41437. return $core.withContext(function($ctx2) {
  41438. return $recv(self._locals())._at_put_(key,value);
  41439. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  41440. }));
  41441. };
  41442. return self;
  41443. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  41444. },
  41445. args: ["aMethodContext"],
  41446. 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 ] ]",
  41447. referencedClasses: [],
  41448. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  41449. }),
  41450. $globals.AIContext);
  41451. $core.addMethod(
  41452. $core.method({
  41453. selector: "initializeInterpreter",
  41454. protocol: 'initialization',
  41455. fn: function (){
  41456. var self=this;
  41457. return $core.withContext(function($ctx1) {
  41458. var $1,$2,$receiver;
  41459. $1=$recv($globals.ASTInterpreter)._new();
  41460. $recv($1)._context_(self);
  41461. self["@interpreter"]=$recv($1)._yourself();
  41462. $2=self._innerContext();
  41463. if(($receiver = $2) == null || $receiver.isNil){
  41464. $2;
  41465. } else {
  41466. self._setupInterpreter_(self["@interpreter"]);
  41467. };
  41468. return self;
  41469. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  41470. },
  41471. args: [],
  41472. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  41473. referencedClasses: ["ASTInterpreter"],
  41474. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  41475. }),
  41476. $globals.AIContext);
  41477. $core.addMethod(
  41478. $core.method({
  41479. selector: "initializeLocals",
  41480. protocol: 'initialization',
  41481. fn: function (){
  41482. var self=this;
  41483. return $core.withContext(function($ctx1) {
  41484. self["@locals"]=$recv($globals.Dictionary)._new();
  41485. $recv(self["@locals"])._at_put_("thisContext",self);
  41486. return self;
  41487. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  41488. },
  41489. args: [],
  41490. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  41491. referencedClasses: ["Dictionary"],
  41492. messageSends: ["new", "at:put:"]
  41493. }),
  41494. $globals.AIContext);
  41495. $core.addMethod(
  41496. $core.method({
  41497. selector: "innerContext",
  41498. protocol: 'accessing',
  41499. fn: function (){
  41500. var self=this;
  41501. return self["@innerContext"];
  41502. },
  41503. args: [],
  41504. source: "innerContext\x0a\x09^ innerContext",
  41505. referencedClasses: [],
  41506. messageSends: []
  41507. }),
  41508. $globals.AIContext);
  41509. $core.addMethod(
  41510. $core.method({
  41511. selector: "innerContext:",
  41512. protocol: 'accessing',
  41513. fn: function (anAIContext){
  41514. var self=this;
  41515. self["@innerContext"]=anAIContext;
  41516. return self;
  41517. },
  41518. args: ["anAIContext"],
  41519. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  41520. referencedClasses: [],
  41521. messageSends: []
  41522. }),
  41523. $globals.AIContext);
  41524. $core.addMethod(
  41525. $core.method({
  41526. selector: "interpreter",
  41527. protocol: 'interpreting',
  41528. fn: function (){
  41529. var self=this;
  41530. return $core.withContext(function($ctx1) {
  41531. var $1,$receiver;
  41532. $1=self["@interpreter"];
  41533. if(($receiver = $1) == null || $receiver.isNil){
  41534. self._initializeInterpreter();
  41535. } else {
  41536. $1;
  41537. };
  41538. return self["@interpreter"];
  41539. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  41540. },
  41541. args: [],
  41542. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  41543. referencedClasses: [],
  41544. messageSends: ["ifNil:", "initializeInterpreter"]
  41545. }),
  41546. $globals.AIContext);
  41547. $core.addMethod(
  41548. $core.method({
  41549. selector: "interpreter:",
  41550. protocol: 'interpreting',
  41551. fn: function (anInterpreter){
  41552. var self=this;
  41553. self["@interpreter"]=anInterpreter;
  41554. return self;
  41555. },
  41556. args: ["anInterpreter"],
  41557. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  41558. referencedClasses: [],
  41559. messageSends: []
  41560. }),
  41561. $globals.AIContext);
  41562. $core.addMethod(
  41563. $core.method({
  41564. selector: "isTopContext",
  41565. protocol: 'testing',
  41566. fn: function (){
  41567. var self=this;
  41568. return $core.withContext(function($ctx1) {
  41569. return $recv(self._innerContext())._isNil();
  41570. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  41571. },
  41572. args: [],
  41573. source: "isTopContext\x0a\x09^ self innerContext isNil",
  41574. referencedClasses: [],
  41575. messageSends: ["isNil", "innerContext"]
  41576. }),
  41577. $globals.AIContext);
  41578. $core.addMethod(
  41579. $core.method({
  41580. selector: "localAt:",
  41581. protocol: 'accessing',
  41582. fn: function (aString){
  41583. var self=this;
  41584. var context;
  41585. return $core.withContext(function($ctx1) {
  41586. context=self._lookupContextForLocal_(aString);
  41587. return $recv(context)._basicLocalAt_(aString);
  41588. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  41589. },
  41590. args: ["aString"],
  41591. 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",
  41592. referencedClasses: [],
  41593. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  41594. }),
  41595. $globals.AIContext);
  41596. $core.addMethod(
  41597. $core.method({
  41598. selector: "localAt:ifAbsent:",
  41599. protocol: 'accessing',
  41600. fn: function (aString,aBlock){
  41601. var self=this;
  41602. var context;
  41603. return $core.withContext(function($ctx1) {
  41604. var $early={};
  41605. try {
  41606. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  41607. return $core.withContext(function($ctx2) {
  41608. throw $early=[$recv(aBlock)._value()];
  41609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41610. }));
  41611. return $recv(context)._basicLocalAt_(aString);
  41612. }
  41613. catch(e) {if(e===$early)return e[0]; throw e}
  41614. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  41615. },
  41616. args: ["aString", "aBlock"],
  41617. 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",
  41618. referencedClasses: [],
  41619. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  41620. }),
  41621. $globals.AIContext);
  41622. $core.addMethod(
  41623. $core.method({
  41624. selector: "localAt:put:",
  41625. protocol: 'accessing',
  41626. fn: function (aString,anObject){
  41627. var self=this;
  41628. var context;
  41629. return $core.withContext(function($ctx1) {
  41630. context=self._lookupContextForLocal_(aString);
  41631. $recv(context)._basicLocalAt_put_(aString,anObject);
  41632. return self;
  41633. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  41634. },
  41635. args: ["aString", "anObject"],
  41636. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  41637. referencedClasses: [],
  41638. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  41639. }),
  41640. $globals.AIContext);
  41641. $core.addMethod(
  41642. $core.method({
  41643. selector: "locals",
  41644. protocol: 'accessing',
  41645. fn: function (){
  41646. var self=this;
  41647. return $core.withContext(function($ctx1) {
  41648. var $1,$receiver;
  41649. $1=self["@locals"];
  41650. if(($receiver = $1) == null || $receiver.isNil){
  41651. self._initializeLocals();
  41652. } else {
  41653. $1;
  41654. };
  41655. return self["@locals"];
  41656. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  41657. },
  41658. args: [],
  41659. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  41660. referencedClasses: [],
  41661. messageSends: ["ifNil:", "initializeLocals"]
  41662. }),
  41663. $globals.AIContext);
  41664. $core.addMethod(
  41665. $core.method({
  41666. selector: "lookupContextForLocal:",
  41667. protocol: 'private',
  41668. fn: function (aString){
  41669. var self=this;
  41670. return $core.withContext(function($ctx1) {
  41671. return self._lookupContextForLocal_ifNone_(aString,(function(){
  41672. return $core.withContext(function($ctx2) {
  41673. return self._variableNotFound();
  41674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41675. }));
  41676. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  41677. },
  41678. args: ["aString"],
  41679. 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 ]",
  41680. referencedClasses: [],
  41681. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  41682. }),
  41683. $globals.AIContext);
  41684. $core.addMethod(
  41685. $core.method({
  41686. selector: "lookupContextForLocal:ifNone:",
  41687. protocol: 'private',
  41688. fn: function (aString,aBlock){
  41689. var self=this;
  41690. return $core.withContext(function($ctx1) {
  41691. var $1;
  41692. return $recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  41693. return self;
  41694. }),(function(){
  41695. return $core.withContext(function($ctx2) {
  41696. $1=self._outerContext();
  41697. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  41698. return $core.withContext(function($ctx3) {
  41699. return $recv(context)._lookupContextForLocal_(aString);
  41700. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  41701. }));
  41702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41703. }));
  41704. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  41705. },
  41706. args: ["aString", "aBlock"],
  41707. 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 ] ]",
  41708. referencedClasses: [],
  41709. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  41710. }),
  41711. $globals.AIContext);
  41712. $core.addMethod(
  41713. $core.method({
  41714. selector: "newInnerContext",
  41715. protocol: 'factory',
  41716. fn: function (){
  41717. var self=this;
  41718. return $core.withContext(function($ctx1) {
  41719. var $1;
  41720. $1=$recv(self._class())._new();
  41721. $recv($1)._outerContext_(self);
  41722. return $recv($1)._yourself();
  41723. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  41724. },
  41725. args: [],
  41726. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  41727. referencedClasses: [],
  41728. messageSends: ["outerContext:", "new", "class", "yourself"]
  41729. }),
  41730. $globals.AIContext);
  41731. $core.addMethod(
  41732. $core.method({
  41733. selector: "outerContext",
  41734. protocol: 'accessing',
  41735. fn: function (){
  41736. var self=this;
  41737. return self["@outerContext"];
  41738. },
  41739. args: [],
  41740. source: "outerContext\x0a\x09^ outerContext",
  41741. referencedClasses: [],
  41742. messageSends: []
  41743. }),
  41744. $globals.AIContext);
  41745. $core.addMethod(
  41746. $core.method({
  41747. selector: "outerContext:",
  41748. protocol: 'accessing',
  41749. fn: function (anAIContext){
  41750. var self=this;
  41751. return $core.withContext(function($ctx1) {
  41752. var $1,$receiver;
  41753. self["@outerContext"]=anAIContext;
  41754. $1=self["@outerContext"];
  41755. if(($receiver = $1) == null || $receiver.isNil){
  41756. $1;
  41757. } else {
  41758. var context;
  41759. context=$receiver;
  41760. $recv(context)._innerContext_(self);
  41761. };
  41762. return self;
  41763. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  41764. },
  41765. args: ["anAIContext"],
  41766. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  41767. referencedClasses: [],
  41768. messageSends: ["ifNotNil:", "innerContext:"]
  41769. }),
  41770. $globals.AIContext);
  41771. $core.addMethod(
  41772. $core.method({
  41773. selector: "receiver:",
  41774. protocol: 'interpreting',
  41775. fn: function (anObject){
  41776. var self=this;
  41777. return $core.withContext(function($ctx1) {
  41778. $recv(self._locals())._at_put_("self",anObject);
  41779. return self;
  41780. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  41781. },
  41782. args: ["anObject"],
  41783. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  41784. referencedClasses: [],
  41785. messageSends: ["at:put:", "locals"]
  41786. }),
  41787. $globals.AIContext);
  41788. $core.addMethod(
  41789. $core.method({
  41790. selector: "selector",
  41791. protocol: 'accessing',
  41792. fn: function (){
  41793. var self=this;
  41794. return self["@selector"];
  41795. },
  41796. args: [],
  41797. source: "selector\x0a\x09^ selector",
  41798. referencedClasses: [],
  41799. messageSends: []
  41800. }),
  41801. $globals.AIContext);
  41802. $core.addMethod(
  41803. $core.method({
  41804. selector: "selector:",
  41805. protocol: 'accessing',
  41806. fn: function (aString){
  41807. var self=this;
  41808. self["@selector"]=aString;
  41809. return self;
  41810. },
  41811. args: ["aString"],
  41812. source: "selector: aString\x0a\x09selector := aString",
  41813. referencedClasses: [],
  41814. messageSends: []
  41815. }),
  41816. $globals.AIContext);
  41817. $core.addMethod(
  41818. $core.method({
  41819. selector: "sendIndexAt:",
  41820. protocol: 'accessing',
  41821. fn: function (aString){
  41822. var self=this;
  41823. return $core.withContext(function($ctx1) {
  41824. return $recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  41825. return (0);
  41826. }));
  41827. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  41828. },
  41829. args: ["aString"],
  41830. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  41831. referencedClasses: [],
  41832. messageSends: ["at:ifAbsent:", "sendIndexes"]
  41833. }),
  41834. $globals.AIContext);
  41835. $core.addMethod(
  41836. $core.method({
  41837. selector: "sendIndexes",
  41838. protocol: 'accessing',
  41839. fn: function (){
  41840. var self=this;
  41841. return $core.withContext(function($ctx1) {
  41842. var $1,$receiver;
  41843. $1=self["@sendIndexes"];
  41844. if(($receiver = $1) == null || $receiver.isNil){
  41845. return $recv($globals.Dictionary)._new();
  41846. } else {
  41847. return $1;
  41848. };
  41849. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  41850. },
  41851. args: [],
  41852. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  41853. referencedClasses: ["Dictionary"],
  41854. messageSends: ["ifNil:", "new"]
  41855. }),
  41856. $globals.AIContext);
  41857. $core.addMethod(
  41858. $core.method({
  41859. selector: "sendIndexes:",
  41860. protocol: 'accessing',
  41861. fn: function (aDictionary){
  41862. var self=this;
  41863. self["@sendIndexes"]=aDictionary;
  41864. return self;
  41865. },
  41866. args: ["aDictionary"],
  41867. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  41868. referencedClasses: [],
  41869. messageSends: []
  41870. }),
  41871. $globals.AIContext);
  41872. $core.addMethod(
  41873. $core.method({
  41874. selector: "setupInterpreter:",
  41875. protocol: 'interpreting',
  41876. fn: function (anInterpreter){
  41877. var self=this;
  41878. var currentNode;
  41879. return $core.withContext(function($ctx1) {
  41880. var $1,$2,$3,$6,$5,$4,$receiver;
  41881. $1=$recv($globals.ASTPCNodeVisitor)._new();
  41882. $recv($1)._selector_(self._evaluatedSelector());
  41883. $recv($1)._context_(self);
  41884. $2=self._ast();
  41885. $ctx1.sendIdx["ast"]=1;
  41886. $recv($1)._visit_($2);
  41887. currentNode=$recv($1)._currentNode();
  41888. $3=$recv(self._ast())._sequenceNode();
  41889. if(($receiver = $3) == null || $receiver.isNil){
  41890. $3;
  41891. } else {
  41892. var sequence;
  41893. sequence=$receiver;
  41894. $recv($recv(sequence)._temps())._do_((function(each){
  41895. return $core.withContext(function($ctx2) {
  41896. return self._defineLocal_(each);
  41897. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41898. }));
  41899. $ctx1.sendIdx["do:"]=1;
  41900. };
  41901. $recv(anInterpreter)._node_(currentNode);
  41902. $6=self._innerContext();
  41903. $ctx1.sendIdx["innerContext"]=1;
  41904. $5=$recv($6)._arguments();
  41905. $4=$recv($5)._reversed();
  41906. $recv($4)._do_((function(each){
  41907. return $core.withContext(function($ctx2) {
  41908. return $recv(anInterpreter)._push_(each);
  41909. $ctx2.sendIdx["push:"]=1;
  41910. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  41911. }));
  41912. $recv(anInterpreter)._push_($recv(self._innerContext())._receiver());
  41913. return self;
  41914. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  41915. },
  41916. args: ["anInterpreter"],
  41917. 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\x09context: self;\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)",
  41918. referencedClasses: ["ASTPCNodeVisitor"],
  41919. messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  41920. }),
  41921. $globals.AIContext);
  41922. $core.addMethod(
  41923. $core.method({
  41924. selector: "supercall",
  41925. protocol: 'interpreting',
  41926. fn: function (){
  41927. var self=this;
  41928. return $core.withContext(function($ctx1) {
  41929. var $1,$receiver;
  41930. $1=self["@supercall"];
  41931. if(($receiver = $1) == null || $receiver.isNil){
  41932. return false;
  41933. } else {
  41934. return $1;
  41935. };
  41936. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  41937. },
  41938. args: [],
  41939. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  41940. referencedClasses: [],
  41941. messageSends: ["ifNil:"]
  41942. }),
  41943. $globals.AIContext);
  41944. $core.addMethod(
  41945. $core.method({
  41946. selector: "supercall:",
  41947. protocol: 'interpreting',
  41948. fn: function (aBoolean){
  41949. var self=this;
  41950. self["@supercall"]=aBoolean;
  41951. return self;
  41952. },
  41953. args: ["aBoolean"],
  41954. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  41955. referencedClasses: [],
  41956. messageSends: []
  41957. }),
  41958. $globals.AIContext);
  41959. $core.addMethod(
  41960. $core.method({
  41961. selector: "variableNotFound",
  41962. protocol: 'error handling',
  41963. fn: function (){
  41964. var self=this;
  41965. return $core.withContext(function($ctx1) {
  41966. self._error_("Variable missing");
  41967. return self;
  41968. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  41969. },
  41970. args: [],
  41971. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  41972. referencedClasses: [],
  41973. messageSends: ["error:"]
  41974. }),
  41975. $globals.AIContext);
  41976. $core.addMethod(
  41977. $core.method({
  41978. selector: "fromMethodContext:",
  41979. protocol: 'instance creation',
  41980. fn: function (aMethodContext){
  41981. var self=this;
  41982. return $core.withContext(function($ctx1) {
  41983. var $1;
  41984. $1=self._new();
  41985. $recv($1)._initializeFromMethodContext_(aMethodContext);
  41986. return $recv($1)._yourself();
  41987. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)});
  41988. },
  41989. args: ["aMethodContext"],
  41990. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  41991. referencedClasses: [],
  41992. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  41993. }),
  41994. $globals.AIContext.klass);
  41995. $core.addClass('AISemanticAnalyzer', $globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
  41996. $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.";
  41997. $core.addMethod(
  41998. $core.method({
  41999. selector: "context",
  42000. protocol: 'accessing',
  42001. fn: function (){
  42002. var self=this;
  42003. return self["@context"];
  42004. },
  42005. args: [],
  42006. source: "context\x0a\x09^ context",
  42007. referencedClasses: [],
  42008. messageSends: []
  42009. }),
  42010. $globals.AISemanticAnalyzer);
  42011. $core.addMethod(
  42012. $core.method({
  42013. selector: "context:",
  42014. protocol: 'accessing',
  42015. fn: function (anAIContext){
  42016. var self=this;
  42017. self["@context"]=anAIContext;
  42018. return self;
  42019. },
  42020. args: ["anAIContext"],
  42021. source: "context: anAIContext\x0a\x09context := anAIContext",
  42022. referencedClasses: [],
  42023. messageSends: []
  42024. }),
  42025. $globals.AISemanticAnalyzer);
  42026. $core.addMethod(
  42027. $core.method({
  42028. selector: "visitVariableNode:",
  42029. protocol: 'visiting',
  42030. fn: function (aNode){
  42031. var self=this;
  42032. return $core.withContext(function($ctx1) {
  42033. var $1;
  42034. var $early={};
  42035. try {
  42036. $recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  42037. return $core.withContext(function($ctx2) {
  42038. $1=(
  42039. $ctx2.supercall = true,
  42040. ($globals.AISemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitVariableNode_.apply($recv(self), [aNode]));
  42041. $ctx2.supercall = false;
  42042. throw $early=[$1];
  42043. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42044. }));
  42045. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  42046. return self;
  42047. }
  42048. catch(e) {if(e===$early)return e[0]; throw e}
  42049. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  42050. },
  42051. args: ["aNode"],
  42052. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  42053. referencedClasses: ["ASTContextVar"],
  42054. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  42055. }),
  42056. $globals.AISemanticAnalyzer);
  42057. $core.addClass('ASTContextVar', $globals.ScopeVar, ['context'], 'Compiler-Interpreter');
  42058. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  42059. $core.addMethod(
  42060. $core.method({
  42061. selector: "context",
  42062. protocol: 'accessing',
  42063. fn: function (){
  42064. var self=this;
  42065. return self["@context"];
  42066. },
  42067. args: [],
  42068. source: "context\x0a\x09^ context",
  42069. referencedClasses: [],
  42070. messageSends: []
  42071. }),
  42072. $globals.ASTContextVar);
  42073. $core.addMethod(
  42074. $core.method({
  42075. selector: "context:",
  42076. protocol: 'accessing',
  42077. fn: function (anObject){
  42078. var self=this;
  42079. self["@context"]=anObject;
  42080. return self;
  42081. },
  42082. args: ["anObject"],
  42083. source: "context: anObject\x0a\x09context := anObject",
  42084. referencedClasses: [],
  42085. messageSends: []
  42086. }),
  42087. $globals.ASTContextVar);
  42088. $core.addClass('ASTDebugger', $globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
  42089. $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.";
  42090. $core.addMethod(
  42091. $core.method({
  42092. selector: "atEnd",
  42093. protocol: 'testing',
  42094. fn: function (){
  42095. var self=this;
  42096. return $core.withContext(function($ctx1) {
  42097. var $1,$receiver;
  42098. $1=self._context();
  42099. $ctx1.sendIdx["context"]=1;
  42100. if(($receiver = $1) == null || $receiver.isNil){
  42101. return true;
  42102. } else {
  42103. $1;
  42104. };
  42105. return $recv($recv(self._interpreter())._atEnd())._and_((function(){
  42106. return $core.withContext(function($ctx2) {
  42107. return $recv(self._context())._isTopContext();
  42108. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42109. }));
  42110. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  42111. },
  42112. args: [],
  42113. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  42114. referencedClasses: [],
  42115. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  42116. }),
  42117. $globals.ASTDebugger);
  42118. $core.addMethod(
  42119. $core.method({
  42120. selector: "context",
  42121. protocol: 'accessing',
  42122. fn: function (){
  42123. var self=this;
  42124. return self["@context"];
  42125. },
  42126. args: [],
  42127. source: "context\x0a\x09^ context",
  42128. referencedClasses: [],
  42129. messageSends: []
  42130. }),
  42131. $globals.ASTDebugger);
  42132. $core.addMethod(
  42133. $core.method({
  42134. selector: "context:",
  42135. protocol: 'accessing',
  42136. fn: function (aContext){
  42137. var self=this;
  42138. self["@context"]=aContext;
  42139. return self;
  42140. },
  42141. args: ["aContext"],
  42142. source: "context: aContext\x0a\x09context := aContext",
  42143. referencedClasses: [],
  42144. messageSends: []
  42145. }),
  42146. $globals.ASTDebugger);
  42147. $core.addMethod(
  42148. $core.method({
  42149. selector: "flushInnerContexts",
  42150. protocol: 'actions',
  42151. fn: function (){
  42152. var self=this;
  42153. return $core.withContext(function($ctx1) {
  42154. var $1,$receiver;
  42155. $1=self._context();
  42156. if(($receiver = $1) == null || $receiver.isNil){
  42157. $1;
  42158. } else {
  42159. var cxt;
  42160. cxt=$receiver;
  42161. $recv(cxt)._innerContext_(nil);
  42162. };
  42163. return self;
  42164. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  42165. },
  42166. args: [],
  42167. 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 ]",
  42168. referencedClasses: [],
  42169. messageSends: ["ifNotNil:", "context", "innerContext:"]
  42170. }),
  42171. $globals.ASTDebugger);
  42172. $core.addMethod(
  42173. $core.method({
  42174. selector: "interpreter",
  42175. protocol: 'accessing',
  42176. fn: function (){
  42177. var self=this;
  42178. return $core.withContext(function($ctx1) {
  42179. var $1,$receiver;
  42180. $1=self._context();
  42181. if(($receiver = $1) == null || $receiver.isNil){
  42182. return $1;
  42183. } else {
  42184. var ctx;
  42185. ctx=$receiver;
  42186. return $recv(ctx)._interpreter();
  42187. };
  42188. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  42189. },
  42190. args: [],
  42191. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  42192. referencedClasses: [],
  42193. messageSends: ["ifNotNil:", "context", "interpreter"]
  42194. }),
  42195. $globals.ASTDebugger);
  42196. $core.addMethod(
  42197. $core.method({
  42198. selector: "method",
  42199. protocol: 'accessing',
  42200. fn: function (){
  42201. var self=this;
  42202. return $core.withContext(function($ctx1) {
  42203. return $recv(self._context())._method();
  42204. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  42205. },
  42206. args: [],
  42207. source: "method\x0a\x09^ self context method",
  42208. referencedClasses: [],
  42209. messageSends: ["method", "context"]
  42210. }),
  42211. $globals.ASTDebugger);
  42212. $core.addMethod(
  42213. $core.method({
  42214. selector: "node",
  42215. protocol: 'accessing',
  42216. fn: function (){
  42217. var self=this;
  42218. return $core.withContext(function($ctx1) {
  42219. var $1,$receiver;
  42220. $1=self._interpreter();
  42221. $ctx1.sendIdx["interpreter"]=1;
  42222. if(($receiver = $1) == null || $receiver.isNil){
  42223. return $1;
  42224. } else {
  42225. return $recv(self._interpreter())._node();
  42226. };
  42227. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  42228. },
  42229. args: [],
  42230. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  42231. referencedClasses: [],
  42232. messageSends: ["ifNotNil:", "interpreter", "node"]
  42233. }),
  42234. $globals.ASTDebugger);
  42235. $core.addMethod(
  42236. $core.method({
  42237. selector: "onStep",
  42238. protocol: 'private',
  42239. fn: function (){
  42240. var self=this;
  42241. return $core.withContext(function($ctx1) {
  42242. var $1,$3,$2,$4,$6,$5,$receiver;
  42243. $1=self._interpreter();
  42244. $ctx1.sendIdx["interpreter"]=1;
  42245. self["@result"]=$recv($1)._result();
  42246. $3=self._interpreter();
  42247. $ctx1.sendIdx["interpreter"]=2;
  42248. $2=$recv($3)._atEnd();
  42249. $ctx1.sendIdx["atEnd"]=1;
  42250. if($core.assert($2)){
  42251. $4=$recv(self._context())._outerContext();
  42252. if(($receiver = $4) == null || $receiver.isNil){
  42253. $4;
  42254. } else {
  42255. var outerContext;
  42256. outerContext=$receiver;
  42257. self._context_(outerContext);
  42258. };
  42259. $6=self._interpreter();
  42260. $ctx1.sendIdx["interpreter"]=3;
  42261. $5=$recv($6)._atEnd();
  42262. if(!$core.assert($5)){
  42263. $recv(self._interpreter())._skip();
  42264. };
  42265. };
  42266. self._flushInnerContexts();
  42267. return self;
  42268. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  42269. },
  42270. args: [],
  42271. 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",
  42272. referencedClasses: [],
  42273. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  42274. }),
  42275. $globals.ASTDebugger);
  42276. $core.addMethod(
  42277. $core.method({
  42278. selector: "proceed",
  42279. protocol: 'stepping',
  42280. fn: function (){
  42281. var self=this;
  42282. return $core.withContext(function($ctx1) {
  42283. $recv((function(){
  42284. return $core.withContext(function($ctx2) {
  42285. return self._atEnd();
  42286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42287. }))._whileFalse_((function(){
  42288. return $core.withContext(function($ctx2) {
  42289. return self._stepOver();
  42290. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42291. }));
  42292. return self;
  42293. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  42294. },
  42295. args: [],
  42296. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  42297. referencedClasses: [],
  42298. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  42299. }),
  42300. $globals.ASTDebugger);
  42301. $core.addMethod(
  42302. $core.method({
  42303. selector: "restart",
  42304. protocol: 'stepping',
  42305. fn: function (){
  42306. var self=this;
  42307. return $core.withContext(function($ctx1) {
  42308. $recv(self._interpreter())._restart();
  42309. self._flushInnerContexts();
  42310. return self;
  42311. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  42312. },
  42313. args: [],
  42314. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  42315. referencedClasses: [],
  42316. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  42317. }),
  42318. $globals.ASTDebugger);
  42319. $core.addMethod(
  42320. $core.method({
  42321. selector: "result",
  42322. protocol: 'accessing',
  42323. fn: function (){
  42324. var self=this;
  42325. return self["@result"];
  42326. },
  42327. args: [],
  42328. source: "result\x0a\x09^ result",
  42329. referencedClasses: [],
  42330. messageSends: []
  42331. }),
  42332. $globals.ASTDebugger);
  42333. $core.addMethod(
  42334. $core.method({
  42335. selector: "stepInto",
  42336. protocol: 'stepping',
  42337. fn: function (){
  42338. var self=this;
  42339. return $core.withContext(function($ctx1) {
  42340. self._shouldBeImplemented();
  42341. return self;
  42342. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  42343. },
  42344. args: [],
  42345. source: "stepInto\x0a\x09self shouldBeImplemented",
  42346. referencedClasses: [],
  42347. messageSends: ["shouldBeImplemented"]
  42348. }),
  42349. $globals.ASTDebugger);
  42350. $core.addMethod(
  42351. $core.method({
  42352. selector: "stepOver",
  42353. protocol: 'stepping',
  42354. fn: function (){
  42355. var self=this;
  42356. return $core.withContext(function($ctx1) {
  42357. var $1,$2;
  42358. $1=$recv(self._context())._isTopContext();
  42359. if($core.assert($1)){
  42360. $recv(self._interpreter())._stepOver();
  42361. } else {
  42362. $2=self._interpreter();
  42363. $ctx1.sendIdx["interpreter"]=1;
  42364. $recv($2)._skip();
  42365. };
  42366. self._onStep();
  42367. return self;
  42368. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  42369. },
  42370. args: [],
  42371. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  42372. referencedClasses: [],
  42373. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  42374. }),
  42375. $globals.ASTDebugger);
  42376. $core.addMethod(
  42377. $core.method({
  42378. selector: "context:",
  42379. protocol: 'instance creation',
  42380. fn: function (aContext){
  42381. var self=this;
  42382. return $core.withContext(function($ctx1) {
  42383. var $1;
  42384. $1=self._new();
  42385. $recv($1)._context_(aContext);
  42386. return $recv($1)._yourself();
  42387. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)});
  42388. },
  42389. args: ["aContext"],
  42390. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  42391. referencedClasses: [],
  42392. messageSends: ["context:", "new", "yourself"]
  42393. }),
  42394. $globals.ASTDebugger.klass);
  42395. $core.addClass('ASTEnterNode', $globals.NodeVisitor, ['interpreter'], 'Compiler-Interpreter');
  42396. $core.addMethod(
  42397. $core.method({
  42398. selector: "interpreter",
  42399. protocol: 'accessing',
  42400. fn: function (){
  42401. var self=this;
  42402. return self["@interpreter"];
  42403. },
  42404. args: [],
  42405. source: "interpreter\x0a\x09^ interpreter",
  42406. referencedClasses: [],
  42407. messageSends: []
  42408. }),
  42409. $globals.ASTEnterNode);
  42410. $core.addMethod(
  42411. $core.method({
  42412. selector: "interpreter:",
  42413. protocol: 'accessing',
  42414. fn: function (anObject){
  42415. var self=this;
  42416. self["@interpreter"]=anObject;
  42417. return self;
  42418. },
  42419. args: ["anObject"],
  42420. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  42421. referencedClasses: [],
  42422. messageSends: []
  42423. }),
  42424. $globals.ASTEnterNode);
  42425. $core.addMethod(
  42426. $core.method({
  42427. selector: "visitBlockNode:",
  42428. protocol: 'visiting',
  42429. fn: function (aNode){
  42430. var self=this;
  42431. return aNode;
  42432. },
  42433. args: ["aNode"],
  42434. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  42435. referencedClasses: [],
  42436. messageSends: []
  42437. }),
  42438. $globals.ASTEnterNode);
  42439. $core.addMethod(
  42440. $core.method({
  42441. selector: "visitNode:",
  42442. protocol: 'visiting',
  42443. fn: function (aNode){
  42444. var self=this;
  42445. return $core.withContext(function($ctx1) {
  42446. var $early={};
  42447. try {
  42448. $recv($recv(aNode)._nodes())._ifEmpty_ifNotEmpty_((function(){
  42449. throw $early=[aNode];
  42450. }),(function(nodes){
  42451. return $core.withContext(function($ctx2) {
  42452. throw $early=[self._visit_($recv(nodes)._first())];
  42453. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  42454. }));
  42455. return self;
  42456. }
  42457. catch(e) {if(e===$early)return e[0]; throw e}
  42458. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.ASTEnterNode)});
  42459. },
  42460. args: ["aNode"],
  42461. source: "visitNode: aNode\x0a\x09aNode nodes\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  42462. referencedClasses: [],
  42463. messageSends: ["ifEmpty:ifNotEmpty:", "nodes", "visit:", "first"]
  42464. }),
  42465. $globals.ASTEnterNode);
  42466. $core.addMethod(
  42467. $core.method({
  42468. selector: "visitSequenceNode:",
  42469. protocol: 'visiting',
  42470. fn: function (aNode){
  42471. var self=this;
  42472. return $core.withContext(function($ctx1) {
  42473. var $1;
  42474. $recv($recv(aNode)._temps())._do_((function(each){
  42475. return $core.withContext(function($ctx2) {
  42476. return $recv($recv(self._interpreter())._context())._defineLocal_(each);
  42477. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42478. }));
  42479. $1=(
  42480. $ctx1.supercall = true,
  42481. ($globals.ASTEnterNode.superclass||$boot.dnu).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  42482. $ctx1.supercall = false;
  42483. return $1;
  42484. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  42485. },
  42486. args: ["aNode"],
  42487. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  42488. referencedClasses: [],
  42489. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  42490. }),
  42491. $globals.ASTEnterNode);
  42492. $core.addMethod(
  42493. $core.method({
  42494. selector: "on:",
  42495. protocol: 'instance creation',
  42496. fn: function (anInterpreter){
  42497. var self=this;
  42498. return $core.withContext(function($ctx1) {
  42499. var $1;
  42500. $1=self._new();
  42501. $recv($1)._interpreter_(anInterpreter);
  42502. return $recv($1)._yourself();
  42503. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.klass)});
  42504. },
  42505. args: ["anInterpreter"],
  42506. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  42507. referencedClasses: [],
  42508. messageSends: ["interpreter:", "new", "yourself"]
  42509. }),
  42510. $globals.ASTEnterNode.klass);
  42511. $core.addClass('ASTInterpreter', $globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
  42512. $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";
  42513. $core.addMethod(
  42514. $core.method({
  42515. selector: "assign:to:",
  42516. protocol: 'private',
  42517. fn: function (aNode,anObject){
  42518. var self=this;
  42519. return $core.withContext(function($ctx1) {
  42520. var $1,$3,$2,$4;
  42521. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  42522. if($core.assert($1)){
  42523. $3=self._context();
  42524. $ctx1.sendIdx["context"]=1;
  42525. $2=$recv($3)._receiver();
  42526. $4=$recv(aNode)._value();
  42527. $ctx1.sendIdx["value"]=1;
  42528. $recv($2)._instVarAt_put_($4,anObject);
  42529. } else {
  42530. $recv(self._context())._localAt_put_($recv(aNode)._value(),anObject);
  42531. };
  42532. return self;
  42533. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  42534. },
  42535. args: ["aNode", "anObject"],
  42536. 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 ]",
  42537. referencedClasses: [],
  42538. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  42539. }),
  42540. $globals.ASTInterpreter);
  42541. $core.addMethod(
  42542. $core.method({
  42543. selector: "atEnd",
  42544. protocol: 'testing',
  42545. fn: function (){
  42546. var self=this;
  42547. return $core.withContext(function($ctx1) {
  42548. var $1;
  42549. $1=self["@forceAtEnd"];
  42550. if($core.assert($1)){
  42551. return true;
  42552. };
  42553. return $recv(self._hasReturned())._or_((function(){
  42554. return $core.withContext(function($ctx2) {
  42555. return $recv(self._node())._isNil();
  42556. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42557. }));
  42558. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  42559. },
  42560. args: [],
  42561. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  42562. referencedClasses: [],
  42563. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  42564. }),
  42565. $globals.ASTInterpreter);
  42566. $core.addMethod(
  42567. $core.method({
  42568. selector: "context",
  42569. protocol: 'accessing',
  42570. fn: function (){
  42571. var self=this;
  42572. return self["@context"];
  42573. },
  42574. args: [],
  42575. source: "context\x0a\x09^ context",
  42576. referencedClasses: [],
  42577. messageSends: []
  42578. }),
  42579. $globals.ASTInterpreter);
  42580. $core.addMethod(
  42581. $core.method({
  42582. selector: "context:",
  42583. protocol: 'accessing',
  42584. fn: function (aContext){
  42585. var self=this;
  42586. self["@context"]=aContext;
  42587. return self;
  42588. },
  42589. args: ["aContext"],
  42590. source: "context: aContext\x0a\x09context := aContext",
  42591. referencedClasses: [],
  42592. messageSends: []
  42593. }),
  42594. $globals.ASTInterpreter);
  42595. $core.addMethod(
  42596. $core.method({
  42597. selector: "enterNode",
  42598. protocol: 'interpreting',
  42599. fn: function (){
  42600. var self=this;
  42601. return $core.withContext(function($ctx1) {
  42602. self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_(self._node()));
  42603. return self;
  42604. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  42605. },
  42606. args: [],
  42607. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  42608. referencedClasses: ["ASTEnterNode"],
  42609. messageSends: ["node:", "visit:", "on:", "node"]
  42610. }),
  42611. $globals.ASTInterpreter);
  42612. $core.addMethod(
  42613. $core.method({
  42614. selector: "eval:",
  42615. protocol: 'private',
  42616. fn: function (aString){
  42617. var self=this;
  42618. var source,function_;
  42619. return $core.withContext(function($ctx1) {
  42620. var $3,$2,$1;
  42621. source=$recv($globals.String)._streamContents_((function(str){
  42622. return $core.withContext(function($ctx2) {
  42623. $recv(str)._nextPutAll_("0,(function(");
  42624. $ctx2.sendIdx["nextPutAll:"]=1;
  42625. $3=self._context();
  42626. $ctx2.sendIdx["context"]=1;
  42627. $2=$recv($3)._locals();
  42628. $ctx2.sendIdx["locals"]=1;
  42629. $1=$recv($2)._keys();
  42630. $recv($1)._do_separatedBy_((function(each){
  42631. return $core.withContext(function($ctx3) {
  42632. return $recv(str)._nextPutAll_(each);
  42633. $ctx3.sendIdx["nextPutAll:"]=2;
  42634. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42635. }),(function(){
  42636. return $core.withContext(function($ctx3) {
  42637. return $recv(str)._nextPutAll_(",");
  42638. $ctx3.sendIdx["nextPutAll:"]=3;
  42639. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42640. }));
  42641. $recv(str)._nextPutAll_("){ return (function() {");
  42642. $ctx2.sendIdx["nextPutAll:"]=4;
  42643. $recv(str)._nextPutAll_(aString);
  42644. $ctx2.sendIdx["nextPutAll:"]=5;
  42645. return $recv(str)._nextPutAll_("})()})");
  42646. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  42647. }));
  42648. function_=$recv($recv($globals.Compiler)._new())._eval_(source);
  42649. return $recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values());
  42650. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  42651. },
  42652. args: ["aString"],
  42653. 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",
  42654. referencedClasses: ["String", "Compiler"],
  42655. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  42656. }),
  42657. $globals.ASTInterpreter);
  42658. $core.addMethod(
  42659. $core.method({
  42660. selector: "hasReturned",
  42661. protocol: 'testing',
  42662. fn: function (){
  42663. var self=this;
  42664. return $core.withContext(function($ctx1) {
  42665. var $1,$receiver;
  42666. $1=self["@returned"];
  42667. if(($receiver = $1) == null || $receiver.isNil){
  42668. return false;
  42669. } else {
  42670. return $1;
  42671. };
  42672. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  42673. },
  42674. args: [],
  42675. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  42676. referencedClasses: [],
  42677. messageSends: ["ifNil:"]
  42678. }),
  42679. $globals.ASTInterpreter);
  42680. $core.addMethod(
  42681. $core.method({
  42682. selector: "initialize",
  42683. protocol: 'initialization',
  42684. fn: function (){
  42685. var self=this;
  42686. return $core.withContext(function($ctx1) {
  42687. (
  42688. $ctx1.supercall = true,
  42689. ($globals.ASTInterpreter.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  42690. $ctx1.supercall = false;
  42691. self["@forceAtEnd"]=false;
  42692. return self;
  42693. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  42694. },
  42695. args: [],
  42696. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  42697. referencedClasses: [],
  42698. messageSends: ["initialize"]
  42699. }),
  42700. $globals.ASTInterpreter);
  42701. $core.addMethod(
  42702. $core.method({
  42703. selector: "interpret",
  42704. protocol: 'interpreting',
  42705. fn: function (){
  42706. var self=this;
  42707. return $core.withContext(function($ctx1) {
  42708. self._visit_(self._node());
  42709. return self;
  42710. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  42711. },
  42712. args: [],
  42713. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  42714. referencedClasses: [],
  42715. messageSends: ["visit:", "node"]
  42716. }),
  42717. $globals.ASTInterpreter);
  42718. $core.addMethod(
  42719. $core.method({
  42720. selector: "messageFromSendNode:arguments:",
  42721. protocol: 'private',
  42722. fn: function (aSendNode,aCollection){
  42723. var self=this;
  42724. return $core.withContext(function($ctx1) {
  42725. var $1;
  42726. $1=$recv($globals.Message)._new();
  42727. $recv($1)._selector_($recv(aSendNode)._selector());
  42728. $recv($1)._arguments_(aCollection);
  42729. return $recv($1)._yourself();
  42730. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  42731. },
  42732. args: ["aSendNode", "aCollection"],
  42733. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  42734. referencedClasses: ["Message"],
  42735. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  42736. }),
  42737. $globals.ASTInterpreter);
  42738. $core.addMethod(
  42739. $core.method({
  42740. selector: "messageNotUnderstood:receiver:",
  42741. protocol: 'private',
  42742. fn: function (aMessage,anObject){
  42743. var self=this;
  42744. return $core.withContext(function($ctx1) {
  42745. var $1;
  42746. $1=$recv($globals.MessageNotUnderstood)._new();
  42747. $recv($1)._message_(aMessage);
  42748. $recv($1)._receiver_(anObject);
  42749. $recv($1)._signal();
  42750. return self;
  42751. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  42752. },
  42753. args: ["aMessage", "anObject"],
  42754. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  42755. referencedClasses: ["MessageNotUnderstood"],
  42756. messageSends: ["message:", "new", "receiver:", "signal"]
  42757. }),
  42758. $globals.ASTInterpreter);
  42759. $core.addMethod(
  42760. $core.method({
  42761. selector: "next",
  42762. protocol: 'interpreting',
  42763. fn: function (){
  42764. var self=this;
  42765. var nd,nextNode;
  42766. return $core.withContext(function($ctx1) {
  42767. var $1,$2,$receiver;
  42768. nd=self._node();
  42769. $1=$recv(nd)._parent();
  42770. if(($receiver = $1) == null || $receiver.isNil){
  42771. nextNode=$1;
  42772. } else {
  42773. var parent;
  42774. parent=$receiver;
  42775. $2=$recv(parent)._nextSiblingNode_(nd);
  42776. if(($receiver = $2) == null || $receiver.isNil){
  42777. nextNode=parent;
  42778. } else {
  42779. var sibling;
  42780. sibling=$receiver;
  42781. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  42782. };
  42783. };
  42784. self._node_(nextNode);
  42785. return self;
  42786. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  42787. },
  42788. args: [],
  42789. 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",
  42790. referencedClasses: ["ASTEnterNode"],
  42791. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  42792. }),
  42793. $globals.ASTInterpreter);
  42794. $core.addMethod(
  42795. $core.method({
  42796. selector: "node",
  42797. protocol: 'accessing',
  42798. fn: function (){
  42799. var self=this;
  42800. return self["@node"];
  42801. },
  42802. args: [],
  42803. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  42804. referencedClasses: [],
  42805. messageSends: []
  42806. }),
  42807. $globals.ASTInterpreter);
  42808. $core.addMethod(
  42809. $core.method({
  42810. selector: "node:",
  42811. protocol: 'accessing',
  42812. fn: function (aNode){
  42813. var self=this;
  42814. self["@node"]=aNode;
  42815. return self;
  42816. },
  42817. args: ["aNode"],
  42818. source: "node: aNode\x0a\x09node := aNode",
  42819. referencedClasses: [],
  42820. messageSends: []
  42821. }),
  42822. $globals.ASTInterpreter);
  42823. $core.addMethod(
  42824. $core.method({
  42825. selector: "peek",
  42826. protocol: 'stack',
  42827. fn: function (){
  42828. var self=this;
  42829. return $core.withContext(function($ctx1) {
  42830. var $1;
  42831. var $early={};
  42832. try {
  42833. $1=self._stack();
  42834. $ctx1.sendIdx["stack"]=1;
  42835. $recv($1)._ifEmpty_((function(){
  42836. throw $early=[nil];
  42837. }));
  42838. return $recv(self._stack())._last();
  42839. }
  42840. catch(e) {if(e===$early)return e[0]; throw e}
  42841. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  42842. },
  42843. args: [],
  42844. 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",
  42845. referencedClasses: [],
  42846. messageSends: ["ifEmpty:", "stack", "last"]
  42847. }),
  42848. $globals.ASTInterpreter);
  42849. $core.addMethod(
  42850. $core.method({
  42851. selector: "pop",
  42852. protocol: 'stack',
  42853. fn: function (){
  42854. var self=this;
  42855. var peekedValue;
  42856. return $core.withContext(function($ctx1) {
  42857. peekedValue=self._peek();
  42858. $recv(self._stack())._removeLast();
  42859. return peekedValue;
  42860. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  42861. },
  42862. args: [],
  42863. 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",
  42864. referencedClasses: [],
  42865. messageSends: ["peek", "removeLast", "stack"]
  42866. }),
  42867. $globals.ASTInterpreter);
  42868. $core.addMethod(
  42869. $core.method({
  42870. selector: "proceed",
  42871. protocol: 'interpreting',
  42872. fn: function (){
  42873. var self=this;
  42874. return $core.withContext(function($ctx1) {
  42875. $recv((function(){
  42876. return $core.withContext(function($ctx2) {
  42877. return self._atEnd();
  42878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42879. }))._whileFalse_((function(){
  42880. return $core.withContext(function($ctx2) {
  42881. return self._step();
  42882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42883. }));
  42884. return self;
  42885. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  42886. },
  42887. args: [],
  42888. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  42889. referencedClasses: [],
  42890. messageSends: ["whileFalse:", "atEnd", "step"]
  42891. }),
  42892. $globals.ASTInterpreter);
  42893. $core.addMethod(
  42894. $core.method({
  42895. selector: "push:",
  42896. protocol: 'stack',
  42897. fn: function (anObject){
  42898. var self=this;
  42899. return $core.withContext(function($ctx1) {
  42900. return $recv(self._stack())._add_(anObject);
  42901. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  42902. },
  42903. args: ["anObject"],
  42904. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  42905. referencedClasses: [],
  42906. messageSends: ["add:", "stack"]
  42907. }),
  42908. $globals.ASTInterpreter);
  42909. $core.addMethod(
  42910. $core.method({
  42911. selector: "restart",
  42912. protocol: 'interpreting',
  42913. fn: function (){
  42914. var self=this;
  42915. return $core.withContext(function($ctx1) {
  42916. self._node_($recv(self._context())._ast());
  42917. self._enterNode();
  42918. return self;
  42919. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  42920. },
  42921. args: [],
  42922. source: "restart\x0a\x09self node: self context ast; enterNode",
  42923. referencedClasses: [],
  42924. messageSends: ["node:", "ast", "context", "enterNode"]
  42925. }),
  42926. $globals.ASTInterpreter);
  42927. $core.addMethod(
  42928. $core.method({
  42929. selector: "result",
  42930. protocol: 'accessing',
  42931. fn: function (){
  42932. var self=this;
  42933. return $core.withContext(function($ctx1) {
  42934. var $1;
  42935. $1=self._hasReturned();
  42936. if($core.assert($1)){
  42937. return self._returnValue();
  42938. } else {
  42939. return $recv(self._context())._receiver();
  42940. };
  42941. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  42942. },
  42943. args: [],
  42944. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  42945. referencedClasses: [],
  42946. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  42947. }),
  42948. $globals.ASTInterpreter);
  42949. $core.addMethod(
  42950. $core.method({
  42951. selector: "returnValue",
  42952. protocol: 'accessing',
  42953. fn: function (){
  42954. var self=this;
  42955. return self["@returnValue"];
  42956. },
  42957. args: [],
  42958. source: "returnValue\x0a\x09^ returnValue",
  42959. referencedClasses: [],
  42960. messageSends: []
  42961. }),
  42962. $globals.ASTInterpreter);
  42963. $core.addMethod(
  42964. $core.method({
  42965. selector: "returnValue:",
  42966. protocol: 'accessing',
  42967. fn: function (anObject){
  42968. var self=this;
  42969. self["@returnValue"]=anObject;
  42970. return self;
  42971. },
  42972. args: ["anObject"],
  42973. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  42974. referencedClasses: [],
  42975. messageSends: []
  42976. }),
  42977. $globals.ASTInterpreter);
  42978. $core.addMethod(
  42979. $core.method({
  42980. selector: "sendMessage:to:superSend:",
  42981. protocol: 'private',
  42982. fn: function (aMessage,anObject,aBoolean){
  42983. var self=this;
  42984. var method;
  42985. return $core.withContext(function($ctx1) {
  42986. var $2,$1,$3,$receiver;
  42987. var $early={};
  42988. try {
  42989. if(!$core.assert(aBoolean)){
  42990. return $recv(aMessage)._sendTo_(anObject);
  42991. };
  42992. $2=$recv(anObject)._class();
  42993. $ctx1.sendIdx["class"]=1;
  42994. $1=$recv($2)._superclass();
  42995. $ctx1.sendIdx["superclass"]=1;
  42996. if(($receiver = $1) == null || $receiver.isNil){
  42997. $3=self._messageNotUnderstood_receiver_(aMessage,anObject);
  42998. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  42999. return $3;
  43000. } else {
  43001. $1;
  43002. };
  43003. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  43004. return $core.withContext(function($ctx2) {
  43005. throw $early=[self._messageNotUnderstood_receiver_(aMessage,anObject)];
  43006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43007. }));
  43008. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  43009. }
  43010. catch(e) {if(e===$early)return e[0]; throw e}
  43011. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  43012. },
  43013. args: ["aMessage", "anObject", "aBoolean"],
  43014. 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",
  43015. referencedClasses: [],
  43016. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  43017. }),
  43018. $globals.ASTInterpreter);
  43019. $core.addMethod(
  43020. $core.method({
  43021. selector: "setNonLocalReturnFromContext:",
  43022. protocol: 'interpreting',
  43023. fn: function (aContext){
  43024. var self=this;
  43025. return $core.withContext(function($ctx1) {
  43026. var $2,$1;
  43027. $2=$recv(aContext)._interpreter();
  43028. $ctx1.sendIdx["interpreter"]=1;
  43029. $1=$recv($2)._hasReturned();
  43030. if($core.assert($1)){
  43031. self["@returned"]=true;
  43032. self["@returned"];
  43033. self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  43034. };
  43035. return self;
  43036. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  43037. },
  43038. args: ["aContext"],
  43039. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  43040. referencedClasses: [],
  43041. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  43042. }),
  43043. $globals.ASTInterpreter);
  43044. $core.addMethod(
  43045. $core.method({
  43046. selector: "skip",
  43047. protocol: 'interpreting',
  43048. fn: function (){
  43049. var self=this;
  43050. return $core.withContext(function($ctx1) {
  43051. self._next();
  43052. return self;
  43053. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  43054. },
  43055. args: [],
  43056. source: "skip\x0a\x09self next",
  43057. referencedClasses: [],
  43058. messageSends: ["next"]
  43059. }),
  43060. $globals.ASTInterpreter);
  43061. $core.addMethod(
  43062. $core.method({
  43063. selector: "stack",
  43064. protocol: 'accessing',
  43065. fn: function (){
  43066. var self=this;
  43067. return $core.withContext(function($ctx1) {
  43068. var $1,$receiver;
  43069. $1=self["@stack"];
  43070. if(($receiver = $1) == null || $receiver.isNil){
  43071. self["@stack"]=$recv($globals.OrderedCollection)._new();
  43072. return self["@stack"];
  43073. } else {
  43074. return $1;
  43075. };
  43076. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  43077. },
  43078. args: [],
  43079. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  43080. referencedClasses: ["OrderedCollection"],
  43081. messageSends: ["ifNil:", "new"]
  43082. }),
  43083. $globals.ASTInterpreter);
  43084. $core.addMethod(
  43085. $core.method({
  43086. selector: "step",
  43087. protocol: 'interpreting',
  43088. fn: function (){
  43089. var self=this;
  43090. return $core.withContext(function($ctx1) {
  43091. self._interpret();
  43092. self._next();
  43093. return self;
  43094. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  43095. },
  43096. args: [],
  43097. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  43098. referencedClasses: [],
  43099. messageSends: ["interpret", "next"]
  43100. }),
  43101. $globals.ASTInterpreter);
  43102. $core.addMethod(
  43103. $core.method({
  43104. selector: "stepOver",
  43105. protocol: 'interpreting',
  43106. fn: function (){
  43107. var self=this;
  43108. return $core.withContext(function($ctx1) {
  43109. var $2,$1;
  43110. self._step();
  43111. $ctx1.sendIdx["step"]=1;
  43112. $recv((function(){
  43113. return $core.withContext(function($ctx2) {
  43114. $2=self._node();
  43115. $ctx2.sendIdx["node"]=1;
  43116. $1=$recv($2)._isNil();
  43117. return $recv($1)._or_((function(){
  43118. return $core.withContext(function($ctx3) {
  43119. return $recv(self._node())._isSteppingNode();
  43120. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43121. }));
  43122. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43123. }))._whileFalse_((function(){
  43124. return $core.withContext(function($ctx2) {
  43125. return self._step();
  43126. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43127. }));
  43128. return self;
  43129. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  43130. },
  43131. args: [],
  43132. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  43133. referencedClasses: [],
  43134. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  43135. }),
  43136. $globals.ASTInterpreter);
  43137. $core.addMethod(
  43138. $core.method({
  43139. selector: "visit:",
  43140. protocol: 'visiting',
  43141. fn: function (aNode){
  43142. var self=this;
  43143. return $core.withContext(function($ctx1) {
  43144. var $1;
  43145. $1=self._hasReturned();
  43146. if(!$core.assert($1)){
  43147. (
  43148. $ctx1.supercall = true,
  43149. ($globals.ASTInterpreter.superclass||$boot.dnu).fn.prototype._visit_.apply($recv(self), [aNode]));
  43150. $ctx1.supercall = false;
  43151. };
  43152. return self;
  43153. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  43154. },
  43155. args: ["aNode"],
  43156. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  43157. referencedClasses: [],
  43158. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  43159. }),
  43160. $globals.ASTInterpreter);
  43161. $core.addMethod(
  43162. $core.method({
  43163. selector: "visitAssignmentNode:",
  43164. protocol: 'visiting',
  43165. fn: function (aNode){
  43166. var self=this;
  43167. var poppedValue;
  43168. return $core.withContext(function($ctx1) {
  43169. poppedValue=self._pop();
  43170. $ctx1.sendIdx["pop"]=1;
  43171. self._pop();
  43172. self._push_(poppedValue);
  43173. self._assign_to_($recv(aNode)._left(),poppedValue);
  43174. return self;
  43175. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  43176. },
  43177. args: ["aNode"],
  43178. 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",
  43179. referencedClasses: [],
  43180. messageSends: ["pop", "push:", "assign:to:", "left"]
  43181. }),
  43182. $globals.ASTInterpreter);
  43183. $core.addMethod(
  43184. $core.method({
  43185. selector: "visitBlockNode:",
  43186. protocol: 'visiting',
  43187. fn: function (aNode){
  43188. var self=this;
  43189. var block;
  43190. return $core.withContext(function($ctx1) {
  43191. block=$recv($globals.AIBlockClosure)._forContext_node_(self._context(),aNode);
  43192. self._push_(block);
  43193. return self;
  43194. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  43195. },
  43196. args: ["aNode"],
  43197. 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",
  43198. referencedClasses: ["AIBlockClosure"],
  43199. messageSends: ["forContext:node:", "context", "push:"]
  43200. }),
  43201. $globals.ASTInterpreter);
  43202. $core.addMethod(
  43203. $core.method({
  43204. selector: "visitBlockSequenceNode:",
  43205. protocol: 'visiting',
  43206. fn: function (aNode){
  43207. var self=this;
  43208. return $core.withContext(function($ctx1) {
  43209. (
  43210. $ctx1.supercall = true,
  43211. ($globals.ASTInterpreter.superclass||$boot.dnu).fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode]));
  43212. $ctx1.supercall = false;
  43213. self["@forceAtEnd"]=true;
  43214. return self;
  43215. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43216. },
  43217. args: ["aNode"],
  43218. 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",
  43219. referencedClasses: [],
  43220. messageSends: ["visitBlockSequenceNode:"]
  43221. }),
  43222. $globals.ASTInterpreter);
  43223. $core.addMethod(
  43224. $core.method({
  43225. selector: "visitDynamicArrayNode:",
  43226. protocol: 'visiting',
  43227. fn: function (aNode){
  43228. var self=this;
  43229. var array;
  43230. return $core.withContext(function($ctx1) {
  43231. array=[];
  43232. $recv($recv(aNode)._nodes())._do_((function(each){
  43233. return $core.withContext(function($ctx2) {
  43234. return $recv(array)._addFirst_(self._pop());
  43235. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43236. }));
  43237. self._push_(array);
  43238. return self;
  43239. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  43240. },
  43241. args: ["aNode"],
  43242. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09\x0a\x09array := #().\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09array addFirst: self pop ].\x0a\x09\x0a\x09self push: array",
  43243. referencedClasses: [],
  43244. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"]
  43245. }),
  43246. $globals.ASTInterpreter);
  43247. $core.addMethod(
  43248. $core.method({
  43249. selector: "visitDynamicDictionaryNode:",
  43250. protocol: 'visiting',
  43251. fn: function (aNode){
  43252. var self=this;
  43253. var keyValueList;
  43254. return $core.withContext(function($ctx1) {
  43255. keyValueList=$recv($globals.OrderedCollection)._new();
  43256. $recv($recv(aNode)._nodes())._do_((function(each){
  43257. return $core.withContext(function($ctx2) {
  43258. return $recv(keyValueList)._add_(self._pop());
  43259. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43260. }));
  43261. self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  43262. return self;
  43263. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  43264. },
  43265. args: ["aNode"],
  43266. source: "visitDynamicDictionaryNode: aNode\x0a\x09| keyValueList |\x0a\x09\x0a\x09keyValueList := OrderedCollection new.\x0a\x09\x0a\x09aNode nodes do: [ :each | \x0a\x09\x09keyValueList add: self pop ].\x0a\x09\x0a\x09self push: (HashedCollection newFromPairs: keyValueList reversed)",
  43267. referencedClasses: ["OrderedCollection", "HashedCollection"],
  43268. messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  43269. }),
  43270. $globals.ASTInterpreter);
  43271. $core.addMethod(
  43272. $core.method({
  43273. selector: "visitJSStatementNode:",
  43274. protocol: 'visiting',
  43275. fn: function (aNode){
  43276. var self=this;
  43277. return $core.withContext(function($ctx1) {
  43278. self["@returned"]=true;
  43279. self._returnValue_(self._eval_($recv(aNode)._source()));
  43280. return self;
  43281. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43282. },
  43283. args: ["aNode"],
  43284. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  43285. referencedClasses: [],
  43286. messageSends: ["returnValue:", "eval:", "source"]
  43287. }),
  43288. $globals.ASTInterpreter);
  43289. $core.addMethod(
  43290. $core.method({
  43291. selector: "visitNode:",
  43292. protocol: 'visiting',
  43293. fn: function (aNode){
  43294. var self=this;
  43295. return self;
  43296. },
  43297. args: ["aNode"],
  43298. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  43299. referencedClasses: [],
  43300. messageSends: []
  43301. }),
  43302. $globals.ASTInterpreter);
  43303. $core.addMethod(
  43304. $core.method({
  43305. selector: "visitReturnNode:",
  43306. protocol: 'visiting',
  43307. fn: function (aNode){
  43308. var self=this;
  43309. return $core.withContext(function($ctx1) {
  43310. self["@returned"]=true;
  43311. self._returnValue_(self._pop());
  43312. return self;
  43313. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43314. },
  43315. args: ["aNode"],
  43316. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  43317. referencedClasses: [],
  43318. messageSends: ["returnValue:", "pop"]
  43319. }),
  43320. $globals.ASTInterpreter);
  43321. $core.addMethod(
  43322. $core.method({
  43323. selector: "visitSendNode:",
  43324. protocol: 'visiting',
  43325. fn: function (aNode){
  43326. var self=this;
  43327. var receiver,args,message,result;
  43328. return $core.withContext(function($ctx1) {
  43329. var $1;
  43330. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  43331. return $core.withContext(function($ctx2) {
  43332. return self._pop();
  43333. $ctx2.sendIdx["pop"]=1;
  43334. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43335. }));
  43336. receiver=self._peek();
  43337. message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  43338. result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  43339. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  43340. return $core.withContext(function($ctx2) {
  43341. return $recv($recv(aNode)._isLastChild())._not();
  43342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43343. }));
  43344. if(!$core.assert($1)){
  43345. self._pop();
  43346. self._push_(result);
  43347. };
  43348. return self;
  43349. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  43350. },
  43351. args: ["aNode"],
  43352. 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 ]",
  43353. referencedClasses: [],
  43354. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  43355. }),
  43356. $globals.ASTInterpreter);
  43357. $core.addMethod(
  43358. $core.method({
  43359. selector: "visitValueNode:",
  43360. protocol: 'visiting',
  43361. fn: function (aNode){
  43362. var self=this;
  43363. return $core.withContext(function($ctx1) {
  43364. self._push_($recv(aNode)._value());
  43365. return self;
  43366. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43367. },
  43368. args: ["aNode"],
  43369. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  43370. referencedClasses: [],
  43371. messageSends: ["push:", "value"]
  43372. }),
  43373. $globals.ASTInterpreter);
  43374. $core.addMethod(
  43375. $core.method({
  43376. selector: "visitVariableNode:",
  43377. protocol: 'visiting',
  43378. fn: function (aNode){
  43379. var self=this;
  43380. return $core.withContext(function($ctx1) {
  43381. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  43382. $2=$recv(aNode)._binding();
  43383. $ctx1.sendIdx["binding"]=1;
  43384. $1=$recv($2)._isUnknownVar();
  43385. if($core.assert($1)){
  43386. $5=$recv($globals.Platform)._globals();
  43387. $ctx1.sendIdx["globals"]=1;
  43388. $6=$recv(aNode)._value();
  43389. $ctx1.sendIdx["value"]=1;
  43390. $4=$recv($5)._at_ifAbsent_($6,(function(){
  43391. return $core.withContext(function($ctx2) {
  43392. return self._error_("Unknown variable");
  43393. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43394. }));
  43395. $ctx1.sendIdx["at:ifAbsent:"]=1;
  43396. $3=self._push_($4);
  43397. $ctx1.sendIdx["push:"]=1;
  43398. return $3;
  43399. };
  43400. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  43401. if($core.assert($8)){
  43402. $10=self._context();
  43403. $ctx1.sendIdx["context"]=1;
  43404. $9=$recv($10)._receiver();
  43405. $11=$recv(aNode)._value();
  43406. $ctx1.sendIdx["value"]=2;
  43407. $7=$recv($9)._instVarAt_($11);
  43408. } else {
  43409. $12=self._context();
  43410. $13=$recv(aNode)._value();
  43411. $ctx1.sendIdx["value"]=3;
  43412. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  43413. return $core.withContext(function($ctx2) {
  43414. $15=$recv(aNode)._value();
  43415. $ctx2.sendIdx["value"]=4;
  43416. $14=$recv($15)._isCapitalized();
  43417. if($core.assert($14)){
  43418. $16=$recv($globals.Smalltalk)._globals();
  43419. $ctx2.sendIdx["globals"]=2;
  43420. $17=$recv(aNode)._value();
  43421. $ctx2.sendIdx["value"]=5;
  43422. return $recv($16)._at_ifAbsent_($17,(function(){
  43423. return $core.withContext(function($ctx3) {
  43424. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  43425. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  43426. }));
  43427. };
  43428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  43429. }));
  43430. };
  43431. self._push_($7);
  43432. return self;
  43433. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43434. },
  43435. args: ["aNode"],
  43436. 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 ] ] ] ])",
  43437. referencedClasses: ["Platform", "Smalltalk"],
  43438. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  43439. }),
  43440. $globals.ASTInterpreter);
  43441. $core.addClass('ASTInterpreterError', $globals.Error, [], 'Compiler-Interpreter');
  43442. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  43443. $core.addClass('ASTPCNodeVisitor', $globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
  43444. $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`";
  43445. $core.addMethod(
  43446. $core.method({
  43447. selector: "context",
  43448. protocol: 'accessing',
  43449. fn: function (){
  43450. var self=this;
  43451. return self["@context"];
  43452. },
  43453. args: [],
  43454. source: "context\x0a\x09^ context",
  43455. referencedClasses: [],
  43456. messageSends: []
  43457. }),
  43458. $globals.ASTPCNodeVisitor);
  43459. $core.addMethod(
  43460. $core.method({
  43461. selector: "context:",
  43462. protocol: 'accessing',
  43463. fn: function (aContext){
  43464. var self=this;
  43465. self["@context"]=aContext;
  43466. return self;
  43467. },
  43468. args: ["aContext"],
  43469. source: "context: aContext\x0a\x09context := aContext",
  43470. referencedClasses: [],
  43471. messageSends: []
  43472. }),
  43473. $globals.ASTPCNodeVisitor);
  43474. $core.addMethod(
  43475. $core.method({
  43476. selector: "currentNode",
  43477. protocol: 'accessing',
  43478. fn: function (){
  43479. var self=this;
  43480. return self["@currentNode"];
  43481. },
  43482. args: [],
  43483. source: "currentNode\x0a\x09^ currentNode",
  43484. referencedClasses: [],
  43485. messageSends: []
  43486. }),
  43487. $globals.ASTPCNodeVisitor);
  43488. $core.addMethod(
  43489. $core.method({
  43490. selector: "increaseIndex",
  43491. protocol: 'accessing',
  43492. fn: function (){
  43493. var self=this;
  43494. return $core.withContext(function($ctx1) {
  43495. self["@index"]=$recv(self._index()).__plus((1));
  43496. return self;
  43497. }, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},$globals.ASTPCNodeVisitor)});
  43498. },
  43499. args: [],
  43500. source: "increaseIndex\x0a\x09index := self index + 1",
  43501. referencedClasses: [],
  43502. messageSends: ["+", "index"]
  43503. }),
  43504. $globals.ASTPCNodeVisitor);
  43505. $core.addMethod(
  43506. $core.method({
  43507. selector: "index",
  43508. protocol: 'accessing',
  43509. fn: function (){
  43510. var self=this;
  43511. return $core.withContext(function($ctx1) {
  43512. var $1,$receiver;
  43513. $1=self["@index"];
  43514. if(($receiver = $1) == null || $receiver.isNil){
  43515. self["@index"]=(0);
  43516. return self["@index"];
  43517. } else {
  43518. return $1;
  43519. };
  43520. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.ASTPCNodeVisitor)});
  43521. },
  43522. args: [],
  43523. source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
  43524. referencedClasses: [],
  43525. messageSends: ["ifNil:"]
  43526. }),
  43527. $globals.ASTPCNodeVisitor);
  43528. $core.addMethod(
  43529. $core.method({
  43530. selector: "selector",
  43531. protocol: 'accessing',
  43532. fn: function (){
  43533. var self=this;
  43534. return self["@selector"];
  43535. },
  43536. args: [],
  43537. source: "selector\x0a\x09^ selector",
  43538. referencedClasses: [],
  43539. messageSends: []
  43540. }),
  43541. $globals.ASTPCNodeVisitor);
  43542. $core.addMethod(
  43543. $core.method({
  43544. selector: "selector:",
  43545. protocol: 'accessing',
  43546. fn: function (aString){
  43547. var self=this;
  43548. self["@selector"]=aString;
  43549. return self;
  43550. },
  43551. args: ["aString"],
  43552. source: "selector: aString\x0a\x09selector := aString",
  43553. referencedClasses: [],
  43554. messageSends: []
  43555. }),
  43556. $globals.ASTPCNodeVisitor);
  43557. $core.addMethod(
  43558. $core.method({
  43559. selector: "visitJSStatementNode:",
  43560. protocol: 'visiting',
  43561. fn: function (aNode){
  43562. var self=this;
  43563. self["@currentNode"]=aNode;
  43564. return self;
  43565. },
  43566. args: ["aNode"],
  43567. 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",
  43568. referencedClasses: [],
  43569. messageSends: []
  43570. }),
  43571. $globals.ASTPCNodeVisitor);
  43572. $core.addMethod(
  43573. $core.method({
  43574. selector: "visitSendNode:",
  43575. protocol: 'visiting',
  43576. fn: function (aNode){
  43577. var self=this;
  43578. var sendIndex;
  43579. return $core.withContext(function($ctx1) {
  43580. var $1,$2,$4,$3,$5;
  43581. $1=self._context();
  43582. $2=self._selector();
  43583. $ctx1.sendIdx["selector"]=1;
  43584. sendIndex=$recv($1)._sendIndexAt_($2);
  43585. (
  43586. $ctx1.supercall = true,
  43587. ($globals.ASTPCNodeVisitor.superclass||$boot.dnu).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  43588. $ctx1.supercall = false;
  43589. $4=self._selector();
  43590. $ctx1.sendIdx["selector"]=2;
  43591. $3=$recv($4).__eq($recv(aNode)._selector());
  43592. $ctx1.sendIdx["="]=1;
  43593. if($core.assert($3)){
  43594. $5=$recv(self._index()).__eq(sendIndex);
  43595. if($core.assert($5)){
  43596. self["@currentNode"]=aNode;
  43597. self["@currentNode"];
  43598. };
  43599. self._increaseIndex();
  43600. };
  43601. return self;
  43602. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},$globals.ASTPCNodeVisitor)});
  43603. },
  43604. args: ["aNode"],
  43605. source: "visitSendNode: aNode\x0a\x09| sendIndex |\x0a\x09sendIndex := self context sendIndexAt: self selector.\x0a\x09\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self selector = aNode selector ifTrue: [\x0a\x09\x09self index = sendIndex ifTrue: [ currentNode := aNode ].\x0a\x09\x09self increaseIndex ]",
  43606. referencedClasses: [],
  43607. messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"]
  43608. }),
  43609. $globals.ASTPCNodeVisitor);
  43610. $core.addMethod(
  43611. $core.method({
  43612. selector: "isSteppingNode",
  43613. protocol: '*Compiler-Interpreter',
  43614. fn: function (){
  43615. var self=this;
  43616. return true;
  43617. },
  43618. args: [],
  43619. source: "isSteppingNode\x0a\x09^ true",
  43620. referencedClasses: [],
  43621. messageSends: []
  43622. }),
  43623. $globals.AssignmentNode);
  43624. $core.addMethod(
  43625. $core.method({
  43626. selector: "isSteppingNode",
  43627. protocol: '*Compiler-Interpreter',
  43628. fn: function (){
  43629. var self=this;
  43630. return true;
  43631. },
  43632. args: [],
  43633. source: "isSteppingNode\x0a\x09^ true",
  43634. referencedClasses: [],
  43635. messageSends: []
  43636. }),
  43637. $globals.BlockNode);
  43638. $core.addMethod(
  43639. $core.method({
  43640. selector: "nextSiblingNode:",
  43641. protocol: '*Compiler-Interpreter',
  43642. fn: function (aNode){
  43643. var self=this;
  43644. return nil;
  43645. },
  43646. args: ["aNode"],
  43647. 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",
  43648. referencedClasses: [],
  43649. messageSends: []
  43650. }),
  43651. $globals.BlockNode);
  43652. $core.addMethod(
  43653. $core.method({
  43654. selector: "isSteppingNode",
  43655. protocol: '*Compiler-Interpreter',
  43656. fn: function (){
  43657. var self=this;
  43658. return true;
  43659. },
  43660. args: [],
  43661. source: "isSteppingNode\x0a\x09^ true",
  43662. referencedClasses: [],
  43663. messageSends: []
  43664. }),
  43665. $globals.DynamicArrayNode);
  43666. $core.addMethod(
  43667. $core.method({
  43668. selector: "isSteppingNode",
  43669. protocol: '*Compiler-Interpreter',
  43670. fn: function (){
  43671. var self=this;
  43672. return true;
  43673. },
  43674. args: [],
  43675. source: "isSteppingNode\x0a\x09^ true",
  43676. referencedClasses: [],
  43677. messageSends: []
  43678. }),
  43679. $globals.DynamicDictionaryNode);
  43680. $core.addMethod(
  43681. $core.method({
  43682. selector: "isSteppingNode",
  43683. protocol: '*Compiler-Interpreter',
  43684. fn: function (){
  43685. var self=this;
  43686. return true;
  43687. },
  43688. args: [],
  43689. source: "isSteppingNode\x0a\x09^ true",
  43690. referencedClasses: [],
  43691. messageSends: []
  43692. }),
  43693. $globals.JSStatementNode);
  43694. $core.addMethod(
  43695. $core.method({
  43696. selector: "isSteppingNode",
  43697. protocol: '*Compiler-Interpreter',
  43698. fn: function (){
  43699. var self=this;
  43700. return false;
  43701. },
  43702. args: [],
  43703. source: "isSteppingNode\x0a\x09^ false",
  43704. referencedClasses: [],
  43705. messageSends: []
  43706. }),
  43707. $globals.Node);
  43708. $core.addMethod(
  43709. $core.method({
  43710. selector: "nextSiblingNode:",
  43711. protocol: '*Compiler-Interpreter',
  43712. fn: function (aNode){
  43713. var self=this;
  43714. return $core.withContext(function($ctx1) {
  43715. var $1;
  43716. var $early={};
  43717. try {
  43718. $1=self._nodes();
  43719. $ctx1.sendIdx["nodes"]=1;
  43720. return $recv($1)._at_ifAbsent_($recv($recv(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  43721. throw $early=[nil];
  43722. }));
  43723. }
  43724. catch(e) {if(e===$early)return e[0]; throw e}
  43725. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.Node)});
  43726. },
  43727. args: ["aNode"],
  43728. source: "nextSiblingNode: aNode\x0a\x09\x22Answer the next node after aNode or nil\x22\x0a\x09\x0a\x09^ self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ nil ]",
  43729. referencedClasses: [],
  43730. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:"]
  43731. }),
  43732. $globals.Node);
  43733. $core.addMethod(
  43734. $core.method({
  43735. selector: "isSteppingNode",
  43736. protocol: '*Compiler-Interpreter',
  43737. fn: function (){
  43738. var self=this;
  43739. return true;
  43740. },
  43741. args: [],
  43742. source: "isSteppingNode\x0a\x09^ true",
  43743. referencedClasses: [],
  43744. messageSends: []
  43745. }),
  43746. $globals.SendNode);
  43747. });
  43748. define('amber/lang',[
  43749. './deploy',
  43750. './compatibility', // pre-fetch, dep of ./boot
  43751. './boot', // pre-fetch, dep of ./helpers
  43752. './helpers', // pre-fetch, dep of ./deploy
  43753. './parser',
  43754. // --- packages for the Amber reflection begin here ---
  43755. 'amber_core/Platform-ImportExport',
  43756. 'amber_core/Compiler-Core',
  43757. 'amber_core/Compiler-AST',
  43758. 'amber_core/Compiler-Semantic',
  43759. 'amber_core/Compiler-IR',
  43760. 'amber_core/Compiler-Inlining',
  43761. 'amber_core/Compiler-Interpreter'
  43762. // --- packages for the Amber reflection end here ---
  43763. ], function (amber) { return amber; });
  43764. define("amber_core/SUnit", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Classes"], function($boot){"use strict";
  43765. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  43766. $core.addPackage('SUnit');
  43767. $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
  43768. $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  43769. $core.addClass('ResultAnnouncement', $globals.Object, ['result'], 'SUnit');
  43770. $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.";
  43771. $core.addMethod(
  43772. $core.method({
  43773. selector: "result",
  43774. protocol: 'accessing',
  43775. fn: function (){
  43776. var self=this;
  43777. return self["@result"];
  43778. },
  43779. args: [],
  43780. source: "result\x0a\x09^ result",
  43781. referencedClasses: [],
  43782. messageSends: []
  43783. }),
  43784. $globals.ResultAnnouncement);
  43785. $core.addMethod(
  43786. $core.method({
  43787. selector: "result:",
  43788. protocol: 'accessing',
  43789. fn: function (aTestResult){
  43790. var self=this;
  43791. self["@result"]=aTestResult;
  43792. return self;
  43793. },
  43794. args: ["aTestResult"],
  43795. source: "result: aTestResult\x0a\x09result := aTestResult",
  43796. referencedClasses: [],
  43797. messageSends: []
  43798. }),
  43799. $globals.ResultAnnouncement);
  43800. $core.addClass('TestCase', $globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
  43801. $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.";
  43802. $core.addMethod(
  43803. $core.method({
  43804. selector: "assert:",
  43805. protocol: 'testing',
  43806. fn: function (aBoolean){
  43807. var self=this;
  43808. return $core.withContext(function($ctx1) {
  43809. self._assert_description_(aBoolean,"Assertion failed");
  43810. return self;
  43811. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  43812. },
  43813. args: ["aBoolean"],
  43814. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  43815. referencedClasses: [],
  43816. messageSends: ["assert:description:"]
  43817. }),
  43818. $globals.TestCase);
  43819. $core.addMethod(
  43820. $core.method({
  43821. selector: "assert:description:",
  43822. protocol: 'testing',
  43823. fn: function (aBoolean,aString){
  43824. var self=this;
  43825. return $core.withContext(function($ctx1) {
  43826. if(!$core.assert(aBoolean)){
  43827. self._signalFailure_(aString);
  43828. };
  43829. return self;
  43830. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  43831. },
  43832. args: ["aBoolean", "aString"],
  43833. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  43834. referencedClasses: [],
  43835. messageSends: ["ifFalse:", "signalFailure:"]
  43836. }),
  43837. $globals.TestCase);
  43838. $core.addMethod(
  43839. $core.method({
  43840. selector: "assert:equals:",
  43841. protocol: 'testing',
  43842. fn: function (actual,expected){
  43843. var self=this;
  43844. return $core.withContext(function($ctx1) {
  43845. var $1,$5,$4,$3,$2;
  43846. $1=$recv(actual).__eq(expected);
  43847. $5=$recv(expected)._printString();
  43848. $ctx1.sendIdx["printString"]=1;
  43849. $4="Expected: ".__comma($5);
  43850. $3=$recv($4).__comma(" but was: ");
  43851. $ctx1.sendIdx[","]=2;
  43852. $2=$recv($3).__comma($recv(actual)._printString());
  43853. $ctx1.sendIdx[","]=1;
  43854. return self._assert_description_($1,$2);
  43855. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  43856. },
  43857. args: ["actual", "expected"],
  43858. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  43859. referencedClasses: [],
  43860. messageSends: ["assert:description:", "=", ",", "printString"]
  43861. }),
  43862. $globals.TestCase);
  43863. $core.addMethod(
  43864. $core.method({
  43865. selector: "async:",
  43866. protocol: 'async',
  43867. fn: function (aBlock){
  43868. var self=this;
  43869. var c;
  43870. return $core.withContext(function($ctx1) {
  43871. var $1;
  43872. self._errorIfNotAsync_("#async");
  43873. c=self["@context"];
  43874. return (function(){
  43875. return $core.withContext(function($ctx2) {
  43876. $1=self._isAsync();
  43877. if($core.assert($1)){
  43878. return $recv(c)._execute_(aBlock);
  43879. };
  43880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43881. });
  43882. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  43883. },
  43884. args: ["aBlock"],
  43885. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  43886. referencedClasses: [],
  43887. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  43888. }),
  43889. $globals.TestCase);
  43890. $core.addMethod(
  43891. $core.method({
  43892. selector: "context:",
  43893. protocol: 'accessing',
  43894. fn: function (aRunningTestContext){
  43895. var self=this;
  43896. self["@context"]=aRunningTestContext;
  43897. return self;
  43898. },
  43899. args: ["aRunningTestContext"],
  43900. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  43901. referencedClasses: [],
  43902. messageSends: []
  43903. }),
  43904. $globals.TestCase);
  43905. $core.addMethod(
  43906. $core.method({
  43907. selector: "deny:",
  43908. protocol: 'testing',
  43909. fn: function (aBoolean){
  43910. var self=this;
  43911. return $core.withContext(function($ctx1) {
  43912. self._assert_($recv(aBoolean)._not());
  43913. return self;
  43914. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  43915. },
  43916. args: ["aBoolean"],
  43917. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  43918. referencedClasses: [],
  43919. messageSends: ["assert:", "not"]
  43920. }),
  43921. $globals.TestCase);
  43922. $core.addMethod(
  43923. $core.method({
  43924. selector: "errorIfNotAsync:",
  43925. protocol: 'error handling',
  43926. fn: function (aString){
  43927. var self=this;
  43928. return $core.withContext(function($ctx1) {
  43929. var $1;
  43930. $1=self._isAsync();
  43931. if(!$core.assert($1)){
  43932. self._error_($recv(aString).__comma(" used without prior #timeout:"));
  43933. };
  43934. return self;
  43935. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  43936. },
  43937. args: ["aString"],
  43938. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  43939. referencedClasses: [],
  43940. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  43941. }),
  43942. $globals.TestCase);
  43943. $core.addMethod(
  43944. $core.method({
  43945. selector: "finished",
  43946. protocol: 'async',
  43947. fn: function (){
  43948. var self=this;
  43949. return $core.withContext(function($ctx1) {
  43950. self._errorIfNotAsync_("#finished");
  43951. self["@asyncTimeout"]=nil;
  43952. return self;
  43953. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  43954. },
  43955. args: [],
  43956. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  43957. referencedClasses: [],
  43958. messageSends: ["errorIfNotAsync:"]
  43959. }),
  43960. $globals.TestCase);
  43961. $core.addMethod(
  43962. $core.method({
  43963. selector: "isAsync",
  43964. protocol: 'testing',
  43965. fn: function (){
  43966. var self=this;
  43967. return $core.withContext(function($ctx1) {
  43968. return $recv(self["@asyncTimeout"])._notNil();
  43969. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  43970. },
  43971. args: [],
  43972. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  43973. referencedClasses: [],
  43974. messageSends: ["notNil"]
  43975. }),
  43976. $globals.TestCase);
  43977. $core.addMethod(
  43978. $core.method({
  43979. selector: "performTest",
  43980. protocol: 'running',
  43981. fn: function (){
  43982. var self=this;
  43983. return $core.withContext(function($ctx1) {
  43984. self["@asyncTimeout"]=nil;
  43985. self._perform_(self._selector());
  43986. return self;
  43987. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  43988. },
  43989. args: [],
  43990. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  43991. referencedClasses: [],
  43992. messageSends: ["perform:", "selector"]
  43993. }),
  43994. $globals.TestCase);
  43995. $core.addMethod(
  43996. $core.method({
  43997. selector: "runCase",
  43998. protocol: 'running',
  43999. fn: function (){
  44000. var self=this;
  44001. return $core.withContext(function($ctx1) {
  44002. $recv($recv($globals.TestContext)._testCase_(self))._start();
  44003. return self;
  44004. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  44005. },
  44006. args: [],
  44007. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  44008. referencedClasses: ["TestContext"],
  44009. messageSends: ["start", "testCase:"]
  44010. }),
  44011. $globals.TestCase);
  44012. $core.addMethod(
  44013. $core.method({
  44014. selector: "selector",
  44015. protocol: 'accessing',
  44016. fn: function (){
  44017. var self=this;
  44018. return self["@testSelector"];
  44019. },
  44020. args: [],
  44021. source: "selector\x0a\x09^ testSelector",
  44022. referencedClasses: [],
  44023. messageSends: []
  44024. }),
  44025. $globals.TestCase);
  44026. $core.addMethod(
  44027. $core.method({
  44028. selector: "setTestSelector:",
  44029. protocol: 'accessing',
  44030. fn: function (aSelector){
  44031. var self=this;
  44032. self["@testSelector"]=aSelector;
  44033. return self;
  44034. },
  44035. args: ["aSelector"],
  44036. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  44037. referencedClasses: [],
  44038. messageSends: []
  44039. }),
  44040. $globals.TestCase);
  44041. $core.addMethod(
  44042. $core.method({
  44043. selector: "setUp",
  44044. protocol: 'running',
  44045. fn: function (){
  44046. var self=this;
  44047. return self;
  44048. },
  44049. args: [],
  44050. source: "setUp",
  44051. referencedClasses: [],
  44052. messageSends: []
  44053. }),
  44054. $globals.TestCase);
  44055. $core.addMethod(
  44056. $core.method({
  44057. selector: "should:",
  44058. protocol: 'testing',
  44059. fn: function (aBlock){
  44060. var self=this;
  44061. return $core.withContext(function($ctx1) {
  44062. self._assert_($recv(aBlock)._value());
  44063. return self;
  44064. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  44065. },
  44066. args: ["aBlock"],
  44067. source: "should: aBlock\x0a\x09self assert: aBlock value",
  44068. referencedClasses: [],
  44069. messageSends: ["assert:", "value"]
  44070. }),
  44071. $globals.TestCase);
  44072. $core.addMethod(
  44073. $core.method({
  44074. selector: "should:raise:",
  44075. protocol: 'testing',
  44076. fn: function (aBlock,anExceptionClass){
  44077. var self=this;
  44078. return $core.withContext(function($ctx1) {
  44079. self._assert_($recv((function(){
  44080. return $core.withContext(function($ctx2) {
  44081. $recv(aBlock)._value();
  44082. return false;
  44083. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44084. }))._on_do_(anExceptionClass,(function(ex){
  44085. return true;
  44086. })));
  44087. return self;
  44088. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  44089. },
  44090. args: ["aBlock", "anExceptionClass"],
  44091. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  44092. referencedClasses: [],
  44093. messageSends: ["assert:", "on:do:", "value"]
  44094. }),
  44095. $globals.TestCase);
  44096. $core.addMethod(
  44097. $core.method({
  44098. selector: "shouldnt:raise:",
  44099. protocol: 'testing',
  44100. fn: function (aBlock,anExceptionClass){
  44101. var self=this;
  44102. return $core.withContext(function($ctx1) {
  44103. self._assert_($recv((function(){
  44104. return $core.withContext(function($ctx2) {
  44105. $recv(aBlock)._value();
  44106. return true;
  44107. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44108. }))._on_do_(anExceptionClass,(function(ex){
  44109. return false;
  44110. })));
  44111. return self;
  44112. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  44113. },
  44114. args: ["aBlock", "anExceptionClass"],
  44115. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  44116. referencedClasses: [],
  44117. messageSends: ["assert:", "on:do:", "value"]
  44118. }),
  44119. $globals.TestCase);
  44120. $core.addMethod(
  44121. $core.method({
  44122. selector: "signalFailure:",
  44123. protocol: 'private',
  44124. fn: function (aString){
  44125. var self=this;
  44126. return $core.withContext(function($ctx1) {
  44127. var $1;
  44128. $1=$recv($globals.TestFailure)._new();
  44129. $recv($1)._messageText_(aString);
  44130. $recv($1)._signal();
  44131. return self;
  44132. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  44133. },
  44134. args: ["aString"],
  44135. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  44136. referencedClasses: ["TestFailure"],
  44137. messageSends: ["messageText:", "new", "signal"]
  44138. }),
  44139. $globals.TestCase);
  44140. $core.addMethod(
  44141. $core.method({
  44142. selector: "tearDown",
  44143. protocol: 'running',
  44144. fn: function (){
  44145. var self=this;
  44146. return self;
  44147. },
  44148. args: [],
  44149. source: "tearDown",
  44150. referencedClasses: [],
  44151. messageSends: []
  44152. }),
  44153. $globals.TestCase);
  44154. $core.addMethod(
  44155. $core.method({
  44156. selector: "timeout:",
  44157. protocol: 'async',
  44158. fn: function (aNumber){
  44159. var self=this;
  44160. return $core.withContext(function($ctx1) {
  44161. var $1,$receiver;
  44162. $1=self["@asyncTimeout"];
  44163. if(($receiver = $1) == null || $receiver.isNil){
  44164. $1;
  44165. } else {
  44166. $recv(self["@asyncTimeout"])._clearTimeout();
  44167. };
  44168. self["@asyncTimeout"]=(0);
  44169. self["@asyncTimeout"]=$recv(self._async_((function(){
  44170. return $core.withContext(function($ctx2) {
  44171. return self._assert_description_(false,"SUnit grace time exhausted");
  44172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44173. })))._valueWithTimeout_(aNumber);
  44174. return self;
  44175. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  44176. },
  44177. args: ["aNumber"],
  44178. 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",
  44179. referencedClasses: [],
  44180. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  44181. }),
  44182. $globals.TestCase);
  44183. $core.addMethod(
  44184. $core.method({
  44185. selector: "allTestSelectors",
  44186. protocol: 'accessing',
  44187. fn: function (){
  44188. var self=this;
  44189. var selectors;
  44190. return $core.withContext(function($ctx1) {
  44191. var $1;
  44192. selectors=self._testSelectors();
  44193. $1=self._shouldInheritSelectors();
  44194. if($core.assert($1)){
  44195. $recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors());
  44196. };
  44197. return selectors;
  44198. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)});
  44199. },
  44200. args: [],
  44201. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  44202. referencedClasses: [],
  44203. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  44204. }),
  44205. $globals.TestCase.klass);
  44206. $core.addMethod(
  44207. $core.method({
  44208. selector: "buildSuite",
  44209. protocol: 'accessing',
  44210. fn: function (){
  44211. var self=this;
  44212. return $core.withContext(function($ctx1) {
  44213. return $recv(self._allTestSelectors())._collect_((function(each){
  44214. return $core.withContext(function($ctx2) {
  44215. return self._selector_(each);
  44216. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44217. }));
  44218. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)});
  44219. },
  44220. args: [],
  44221. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  44222. referencedClasses: [],
  44223. messageSends: ["collect:", "allTestSelectors", "selector:"]
  44224. }),
  44225. $globals.TestCase.klass);
  44226. $core.addMethod(
  44227. $core.method({
  44228. selector: "classTag",
  44229. protocol: 'accessing',
  44230. fn: function (){
  44231. var self=this;
  44232. return "test";
  44233. },
  44234. args: [],
  44235. 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'",
  44236. referencedClasses: [],
  44237. messageSends: []
  44238. }),
  44239. $globals.TestCase.klass);
  44240. $core.addMethod(
  44241. $core.method({
  44242. selector: "isAbstract",
  44243. protocol: 'testing',
  44244. fn: function (){
  44245. var self=this;
  44246. return $core.withContext(function($ctx1) {
  44247. return $recv(self._name()).__eq("TestCase");
  44248. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)});
  44249. },
  44250. args: [],
  44251. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  44252. referencedClasses: [],
  44253. messageSends: ["=", "name"]
  44254. }),
  44255. $globals.TestCase.klass);
  44256. $core.addMethod(
  44257. $core.method({
  44258. selector: "lookupHierarchyRoot",
  44259. protocol: 'accessing',
  44260. fn: function (){
  44261. var self=this;
  44262. return $globals.TestCase;
  44263. },
  44264. args: [],
  44265. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  44266. referencedClasses: ["TestCase"],
  44267. messageSends: []
  44268. }),
  44269. $globals.TestCase.klass);
  44270. $core.addMethod(
  44271. $core.method({
  44272. selector: "selector:",
  44273. protocol: 'accessing',
  44274. fn: function (aSelector){
  44275. var self=this;
  44276. return $core.withContext(function($ctx1) {
  44277. var $1;
  44278. $1=self._new();
  44279. $recv($1)._setTestSelector_(aSelector);
  44280. return $recv($1)._yourself();
  44281. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)});
  44282. },
  44283. args: ["aSelector"],
  44284. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  44285. referencedClasses: [],
  44286. messageSends: ["setTestSelector:", "new", "yourself"]
  44287. }),
  44288. $globals.TestCase.klass);
  44289. $core.addMethod(
  44290. $core.method({
  44291. selector: "shouldInheritSelectors",
  44292. protocol: 'testing',
  44293. fn: function (){
  44294. var self=this;
  44295. return $core.withContext(function($ctx1) {
  44296. return self.__tild_eq(self._lookupHierarchyRoot());
  44297. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)});
  44298. },
  44299. args: [],
  44300. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  44301. referencedClasses: [],
  44302. messageSends: ["~=", "lookupHierarchyRoot"]
  44303. }),
  44304. $globals.TestCase.klass);
  44305. $core.addMethod(
  44306. $core.method({
  44307. selector: "testSelectors",
  44308. protocol: 'accessing',
  44309. fn: function (){
  44310. var self=this;
  44311. return $core.withContext(function($ctx1) {
  44312. return $recv($recv(self._methodDictionary())._keys())._select_((function(each){
  44313. return $core.withContext(function($ctx2) {
  44314. return $recv(each)._match_("^test");
  44315. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44316. }));
  44317. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)});
  44318. },
  44319. args: [],
  44320. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  44321. referencedClasses: [],
  44322. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  44323. }),
  44324. $globals.TestCase.klass);
  44325. $core.addClass('TestContext', $globals.Object, ['testCase'], 'SUnit');
  44326. $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).";
  44327. $core.addMethod(
  44328. $core.method({
  44329. selector: "execute:",
  44330. protocol: 'running',
  44331. fn: function (aBlock){
  44332. var self=this;
  44333. var failed;
  44334. return $core.withContext(function($ctx1) {
  44335. var $1,$2;
  44336. $recv(self["@testCase"])._context_(self);
  44337. $ctx1.sendIdx["context:"]=1;
  44338. $recv((function(){
  44339. return $core.withContext(function($ctx2) {
  44340. failed=true;
  44341. failed;
  44342. $recv(aBlock)._value();
  44343. failed=false;
  44344. return failed;
  44345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44346. }))._ensure_((function(){
  44347. return $core.withContext(function($ctx2) {
  44348. $recv(self["@testCase"])._context_(nil);
  44349. $1=$recv(failed)._and_((function(){
  44350. return $core.withContext(function($ctx3) {
  44351. return $recv(self["@testCase"])._isAsync();
  44352. $ctx3.sendIdx["isAsync"]=1;
  44353. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  44354. }));
  44355. if($core.assert($1)){
  44356. $recv(self["@testCase"])._finished();
  44357. };
  44358. $2=$recv(self["@testCase"])._isAsync();
  44359. if(!$core.assert($2)){
  44360. return $recv(self["@testCase"])._tearDown();
  44361. };
  44362. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44363. }));
  44364. return self;
  44365. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  44366. },
  44367. args: ["aBlock"],
  44368. 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 ] ]",
  44369. referencedClasses: [],
  44370. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  44371. }),
  44372. $globals.TestContext);
  44373. $core.addMethod(
  44374. $core.method({
  44375. selector: "start",
  44376. protocol: 'running',
  44377. fn: function (){
  44378. var self=this;
  44379. return $core.withContext(function($ctx1) {
  44380. self._execute_((function(){
  44381. return $core.withContext(function($ctx2) {
  44382. $recv(self["@testCase"])._setUp();
  44383. return $recv(self["@testCase"])._performTest();
  44384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44385. }));
  44386. return self;
  44387. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  44388. },
  44389. args: [],
  44390. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  44391. referencedClasses: [],
  44392. messageSends: ["execute:", "setUp", "performTest"]
  44393. }),
  44394. $globals.TestContext);
  44395. $core.addMethod(
  44396. $core.method({
  44397. selector: "testCase:",
  44398. protocol: 'accessing',
  44399. fn: function (aTestCase){
  44400. var self=this;
  44401. self["@testCase"]=aTestCase;
  44402. return self;
  44403. },
  44404. args: ["aTestCase"],
  44405. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  44406. referencedClasses: [],
  44407. messageSends: []
  44408. }),
  44409. $globals.TestContext);
  44410. $core.addMethod(
  44411. $core.method({
  44412. selector: "testCase:",
  44413. protocol: 'instance creation',
  44414. fn: function (aTestCase){
  44415. var self=this;
  44416. return $core.withContext(function($ctx1) {
  44417. var $1;
  44418. $1=self._new();
  44419. $recv($1)._testCase_(aTestCase);
  44420. return $recv($1)._yourself();
  44421. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)});
  44422. },
  44423. args: ["aTestCase"],
  44424. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  44425. referencedClasses: [],
  44426. messageSends: ["testCase:", "new", "yourself"]
  44427. }),
  44428. $globals.TestContext.klass);
  44429. $core.addClass('ReportingTestContext', $globals.TestContext, ['finished', 'result'], 'SUnit');
  44430. $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`.";
  44431. $core.addMethod(
  44432. $core.method({
  44433. selector: "execute:",
  44434. protocol: 'running',
  44435. fn: function (aBlock){
  44436. var self=this;
  44437. return $core.withContext(function($ctx1) {
  44438. var $1;
  44439. $recv((function(){
  44440. return $core.withContext(function($ctx2) {
  44441. return self._withErrorReporting_((function(){
  44442. return $core.withContext(function($ctx3) {
  44443. return (
  44444. $ctx3.supercall = true,
  44445. ($globals.ReportingTestContext.superclass||$boot.dnu).fn.prototype._execute_.apply($recv(self), [aBlock]));
  44446. $ctx3.supercall = false;
  44447. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44448. }));
  44449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44450. }))._ensure_((function(){
  44451. return $core.withContext(function($ctx2) {
  44452. $1=$recv(self["@testCase"])._isAsync();
  44453. if(!$core.assert($1)){
  44454. $recv(self["@result"])._increaseRuns();
  44455. return $recv(self["@finished"])._value();
  44456. };
  44457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44458. }));
  44459. return self;
  44460. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  44461. },
  44462. args: ["aBlock"],
  44463. 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 ] ]",
  44464. referencedClasses: [],
  44465. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  44466. }),
  44467. $globals.ReportingTestContext);
  44468. $core.addMethod(
  44469. $core.method({
  44470. selector: "finished:",
  44471. protocol: 'accessing',
  44472. fn: function (aBlock){
  44473. var self=this;
  44474. self["@finished"]=aBlock;
  44475. return self;
  44476. },
  44477. args: ["aBlock"],
  44478. source: "finished: aBlock\x0a\x09finished := aBlock",
  44479. referencedClasses: [],
  44480. messageSends: []
  44481. }),
  44482. $globals.ReportingTestContext);
  44483. $core.addMethod(
  44484. $core.method({
  44485. selector: "result:",
  44486. protocol: 'accessing',
  44487. fn: function (aTestResult){
  44488. var self=this;
  44489. self["@result"]=aTestResult;
  44490. return self;
  44491. },
  44492. args: ["aTestResult"],
  44493. source: "result: aTestResult\x0a\x09result := aTestResult",
  44494. referencedClasses: [],
  44495. messageSends: []
  44496. }),
  44497. $globals.ReportingTestContext);
  44498. $core.addMethod(
  44499. $core.method({
  44500. selector: "withErrorReporting:",
  44501. protocol: 'private',
  44502. fn: function (aBlock){
  44503. var self=this;
  44504. return $core.withContext(function($ctx1) {
  44505. $recv((function(){
  44506. return $core.withContext(function($ctx2) {
  44507. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  44508. return $core.withContext(function($ctx3) {
  44509. return $recv(self["@result"])._addFailure_(self["@testCase"]);
  44510. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  44511. }));
  44512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44513. }))._on_do_($globals.Error,(function(ex){
  44514. return $core.withContext(function($ctx2) {
  44515. return $recv(self["@result"])._addError_(self["@testCase"]);
  44516. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  44517. }));
  44518. $ctx1.sendIdx["on:do:"]=1;
  44519. return self;
  44520. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  44521. },
  44522. args: ["aBlock"],
  44523. 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 ]",
  44524. referencedClasses: ["TestFailure", "Error"],
  44525. messageSends: ["on:do:", "addFailure:", "addError:"]
  44526. }),
  44527. $globals.ReportingTestContext);
  44528. $core.addMethod(
  44529. $core.method({
  44530. selector: "testCase:result:finished:",
  44531. protocol: 'instance creation',
  44532. fn: function (aTestCase,aTestResult,aBlock){
  44533. var self=this;
  44534. return $core.withContext(function($ctx1) {
  44535. var $1;
  44536. $1=(
  44537. $ctx1.supercall = true,
  44538. ($globals.ReportingTestContext.klass.superclass||$boot.dnu).fn.prototype._testCase_.apply($recv(self), [aTestCase]));
  44539. $ctx1.supercall = false;
  44540. $recv($1)._result_(aTestResult);
  44541. $recv($1)._finished_(aBlock);
  44542. return $recv($1)._yourself();
  44543. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)});
  44544. },
  44545. args: ["aTestCase", "aTestResult", "aBlock"],
  44546. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  44547. referencedClasses: [],
  44548. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  44549. }),
  44550. $globals.ReportingTestContext.klass);
  44551. $core.addClass('TestFailure', $globals.Error, [], 'SUnit');
  44552. $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.";
  44553. $core.addClass('TestResult', $globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  44554. $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";
  44555. $core.addMethod(
  44556. $core.method({
  44557. selector: "addError:",
  44558. protocol: 'accessing',
  44559. fn: function (anError){
  44560. var self=this;
  44561. return $core.withContext(function($ctx1) {
  44562. $recv(self._errors())._add_(anError);
  44563. return self;
  44564. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  44565. },
  44566. args: ["anError"],
  44567. source: "addError: anError\x0a\x09self errors add: anError",
  44568. referencedClasses: [],
  44569. messageSends: ["add:", "errors"]
  44570. }),
  44571. $globals.TestResult);
  44572. $core.addMethod(
  44573. $core.method({
  44574. selector: "addFailure:",
  44575. protocol: 'accessing',
  44576. fn: function (aFailure){
  44577. var self=this;
  44578. return $core.withContext(function($ctx1) {
  44579. $recv(self._failures())._add_(aFailure);
  44580. return self;
  44581. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  44582. },
  44583. args: ["aFailure"],
  44584. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  44585. referencedClasses: [],
  44586. messageSends: ["add:", "failures"]
  44587. }),
  44588. $globals.TestResult);
  44589. $core.addMethod(
  44590. $core.method({
  44591. selector: "errors",
  44592. protocol: 'accessing',
  44593. fn: function (){
  44594. var self=this;
  44595. return self["@errors"];
  44596. },
  44597. args: [],
  44598. source: "errors\x0a\x09^ errors",
  44599. referencedClasses: [],
  44600. messageSends: []
  44601. }),
  44602. $globals.TestResult);
  44603. $core.addMethod(
  44604. $core.method({
  44605. selector: "failures",
  44606. protocol: 'accessing',
  44607. fn: function (){
  44608. var self=this;
  44609. return self["@failures"];
  44610. },
  44611. args: [],
  44612. source: "failures\x0a\x09^ failures",
  44613. referencedClasses: [],
  44614. messageSends: []
  44615. }),
  44616. $globals.TestResult);
  44617. $core.addMethod(
  44618. $core.method({
  44619. selector: "increaseRuns",
  44620. protocol: 'accessing',
  44621. fn: function (){
  44622. var self=this;
  44623. return $core.withContext(function($ctx1) {
  44624. self["@runs"]=$recv(self["@runs"]).__plus((1));
  44625. return self;
  44626. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  44627. },
  44628. args: [],
  44629. source: "increaseRuns\x0a\x09runs := runs + 1",
  44630. referencedClasses: [],
  44631. messageSends: ["+"]
  44632. }),
  44633. $globals.TestResult);
  44634. $core.addMethod(
  44635. $core.method({
  44636. selector: "initialize",
  44637. protocol: 'initialization',
  44638. fn: function (){
  44639. var self=this;
  44640. return $core.withContext(function($ctx1) {
  44641. (
  44642. $ctx1.supercall = true,
  44643. ($globals.TestResult.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  44644. $ctx1.supercall = false;
  44645. self["@timestamp"]=$recv($globals.Date)._now();
  44646. self["@runs"]=(0);
  44647. self["@errors"]=$recv($globals.Array)._new();
  44648. $ctx1.sendIdx["new"]=1;
  44649. self["@failures"]=$recv($globals.Array)._new();
  44650. self["@total"]=(0);
  44651. return self;
  44652. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  44653. },
  44654. args: [],
  44655. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  44656. referencedClasses: ["Date", "Array"],
  44657. messageSends: ["initialize", "now", "new"]
  44658. }),
  44659. $globals.TestResult);
  44660. $core.addMethod(
  44661. $core.method({
  44662. selector: "nextRunDo:",
  44663. protocol: 'running',
  44664. fn: function (aBlock){
  44665. var self=this;
  44666. return $core.withContext(function($ctx1) {
  44667. var $2,$1;
  44668. $2=self._runs();
  44669. $ctx1.sendIdx["runs"]=1;
  44670. $1=$recv($2).__eq_eq(self._total());
  44671. if(!$core.assert($1)){
  44672. return $recv(aBlock)._value_($recv(self._runs()).__plus((1)));
  44673. };
  44674. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  44675. },
  44676. args: ["aBlock"],
  44677. 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 ]",
  44678. referencedClasses: [],
  44679. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  44680. }),
  44681. $globals.TestResult);
  44682. $core.addMethod(
  44683. $core.method({
  44684. selector: "runCase:",
  44685. protocol: 'running',
  44686. fn: function (aTestCase){
  44687. var self=this;
  44688. return $core.withContext(function($ctx1) {
  44689. $recv((function(){
  44690. return $core.withContext(function($ctx2) {
  44691. return $recv((function(){
  44692. return $core.withContext(function($ctx3) {
  44693. self._increaseRuns();
  44694. return $recv(aTestCase)._runCase();
  44695. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44696. }))._on_do_($globals.TestFailure,(function(ex){
  44697. return $core.withContext(function($ctx3) {
  44698. return self._addFailure_(aTestCase);
  44699. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  44700. }));
  44701. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44702. }))._on_do_($globals.Error,(function(ex){
  44703. return $core.withContext(function($ctx2) {
  44704. return self._addError_(aTestCase);
  44705. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  44706. }));
  44707. $ctx1.sendIdx["on:do:"]=1;
  44708. return self;
  44709. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  44710. },
  44711. args: ["aTestCase"],
  44712. 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 ]",
  44713. referencedClasses: ["TestFailure", "Error"],
  44714. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  44715. }),
  44716. $globals.TestResult);
  44717. $core.addMethod(
  44718. $core.method({
  44719. selector: "runs",
  44720. protocol: 'accessing',
  44721. fn: function (){
  44722. var self=this;
  44723. return self["@runs"];
  44724. },
  44725. args: [],
  44726. source: "runs\x0a\x09^ runs",
  44727. referencedClasses: [],
  44728. messageSends: []
  44729. }),
  44730. $globals.TestResult);
  44731. $core.addMethod(
  44732. $core.method({
  44733. selector: "status",
  44734. protocol: 'accessing',
  44735. fn: function (){
  44736. var self=this;
  44737. return $core.withContext(function($ctx1) {
  44738. var $2,$3,$1;
  44739. $2=$recv(self._errors())._isEmpty();
  44740. $ctx1.sendIdx["isEmpty"]=1;
  44741. if($core.assert($2)){
  44742. $3=$recv(self._failures())._isEmpty();
  44743. if($core.assert($3)){
  44744. $1="success";
  44745. } else {
  44746. $1="failure";
  44747. };
  44748. } else {
  44749. $1="error";
  44750. };
  44751. return $1;
  44752. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  44753. },
  44754. args: [],
  44755. source: "status\x0a\x09^ self errors isEmpty\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09self failures isEmpty\x0a\x09\x09\x09\x09ifTrue: [ 'success' ]\x0a\x09\x09\x09\x09ifFalse: [ 'failure' ]]\x0a\x09\x09ifFalse: [ 'error' ]",
  44756. referencedClasses: [],
  44757. messageSends: ["ifTrue:ifFalse:", "isEmpty", "errors", "failures"]
  44758. }),
  44759. $globals.TestResult);
  44760. $core.addMethod(
  44761. $core.method({
  44762. selector: "timestamp",
  44763. protocol: 'accessing',
  44764. fn: function (){
  44765. var self=this;
  44766. return self["@timestamp"];
  44767. },
  44768. args: [],
  44769. source: "timestamp\x0a\x09^ timestamp",
  44770. referencedClasses: [],
  44771. messageSends: []
  44772. }),
  44773. $globals.TestResult);
  44774. $core.addMethod(
  44775. $core.method({
  44776. selector: "total",
  44777. protocol: 'accessing',
  44778. fn: function (){
  44779. var self=this;
  44780. return self["@total"];
  44781. },
  44782. args: [],
  44783. source: "total\x0a\x09^ total",
  44784. referencedClasses: [],
  44785. messageSends: []
  44786. }),
  44787. $globals.TestResult);
  44788. $core.addMethod(
  44789. $core.method({
  44790. selector: "total:",
  44791. protocol: 'accessing',
  44792. fn: function (aNumber){
  44793. var self=this;
  44794. self["@total"]=aNumber;
  44795. return self;
  44796. },
  44797. args: ["aNumber"],
  44798. source: "total: aNumber\x0a\x09total := aNumber",
  44799. referencedClasses: [],
  44800. messageSends: []
  44801. }),
  44802. $globals.TestResult);
  44803. $core.addClass('TestSuiteRunner', $globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  44804. $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`.";
  44805. $core.addMethod(
  44806. $core.method({
  44807. selector: "announcer",
  44808. protocol: 'accessing',
  44809. fn: function (){
  44810. var self=this;
  44811. return self["@announcer"];
  44812. },
  44813. args: [],
  44814. source: "announcer\x0a\x09^ announcer",
  44815. referencedClasses: [],
  44816. messageSends: []
  44817. }),
  44818. $globals.TestSuiteRunner);
  44819. $core.addMethod(
  44820. $core.method({
  44821. selector: "contextOf:",
  44822. protocol: 'private',
  44823. fn: function (anInteger){
  44824. var self=this;
  44825. return $core.withContext(function($ctx1) {
  44826. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){
  44827. return $core.withContext(function($ctx2) {
  44828. return self._resume();
  44829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44830. }));
  44831. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  44832. },
  44833. args: ["anInteger"],
  44834. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  44835. referencedClasses: ["ReportingTestContext"],
  44836. messageSends: ["testCase:result:finished:", "at:", "resume"]
  44837. }),
  44838. $globals.TestSuiteRunner);
  44839. $core.addMethod(
  44840. $core.method({
  44841. selector: "initialize",
  44842. protocol: 'initialization',
  44843. fn: function (){
  44844. var self=this;
  44845. return $core.withContext(function($ctx1) {
  44846. var $1;
  44847. (
  44848. $ctx1.supercall = true,
  44849. ($globals.TestSuiteRunner.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  44850. $ctx1.supercall = false;
  44851. self["@announcer"]=$recv($globals.Announcer)._new();
  44852. $ctx1.sendIdx["new"]=1;
  44853. self["@result"]=$recv($globals.TestResult)._new();
  44854. self["@runNextTest"]=(function(){
  44855. var runs;
  44856. return $core.withContext(function($ctx2) {
  44857. runs=$recv(self["@result"])._runs();
  44858. runs;
  44859. $1=$recv(runs).__lt($recv(self["@result"])._total());
  44860. if($core.assert($1)){
  44861. return $recv(self._contextOf_($recv(runs).__plus((1))))._start();
  44862. };
  44863. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  44864. });
  44865. return self;
  44866. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  44867. },
  44868. args: [],
  44869. 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 ] ].",
  44870. referencedClasses: ["Announcer", "TestResult"],
  44871. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  44872. }),
  44873. $globals.TestSuiteRunner);
  44874. $core.addMethod(
  44875. $core.method({
  44876. selector: "result",
  44877. protocol: 'accessing',
  44878. fn: function (){
  44879. var self=this;
  44880. return self["@result"];
  44881. },
  44882. args: [],
  44883. source: "result\x0a\x09^ result",
  44884. referencedClasses: [],
  44885. messageSends: []
  44886. }),
  44887. $globals.TestSuiteRunner);
  44888. $core.addMethod(
  44889. $core.method({
  44890. selector: "resume",
  44891. protocol: 'actions',
  44892. fn: function (){
  44893. var self=this;
  44894. return $core.withContext(function($ctx1) {
  44895. $recv(self["@runNextTest"])._fork();
  44896. $recv(self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_(self["@result"]));
  44897. return self;
  44898. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  44899. },
  44900. args: [],
  44901. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  44902. referencedClasses: ["ResultAnnouncement"],
  44903. messageSends: ["fork", "announce:", "result:", "new"]
  44904. }),
  44905. $globals.TestSuiteRunner);
  44906. $core.addMethod(
  44907. $core.method({
  44908. selector: "run",
  44909. protocol: 'actions',
  44910. fn: function (){
  44911. var self=this;
  44912. return $core.withContext(function($ctx1) {
  44913. $recv(self["@result"])._total_($recv(self["@suite"])._size());
  44914. self._resume();
  44915. return self;
  44916. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  44917. },
  44918. args: [],
  44919. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  44920. referencedClasses: [],
  44921. messageSends: ["total:", "size", "resume"]
  44922. }),
  44923. $globals.TestSuiteRunner);
  44924. $core.addMethod(
  44925. $core.method({
  44926. selector: "suite:",
  44927. protocol: 'accessing',
  44928. fn: function (aCollection){
  44929. var self=this;
  44930. self["@suite"]=aCollection;
  44931. return self;
  44932. },
  44933. args: ["aCollection"],
  44934. source: "suite: aCollection\x0a\x09suite := aCollection",
  44935. referencedClasses: [],
  44936. messageSends: []
  44937. }),
  44938. $globals.TestSuiteRunner);
  44939. $core.addMethod(
  44940. $core.method({
  44941. selector: "new",
  44942. protocol: 'instance creation',
  44943. fn: function (){
  44944. var self=this;
  44945. return $core.withContext(function($ctx1) {
  44946. self._shouldNotImplement();
  44947. return self;
  44948. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)});
  44949. },
  44950. args: [],
  44951. source: "new\x0a\x09self shouldNotImplement",
  44952. referencedClasses: [],
  44953. messageSends: ["shouldNotImplement"]
  44954. }),
  44955. $globals.TestSuiteRunner.klass);
  44956. $core.addMethod(
  44957. $core.method({
  44958. selector: "on:",
  44959. protocol: 'instance creation',
  44960. fn: function (aCollection){
  44961. var self=this;
  44962. return $core.withContext(function($ctx1) {
  44963. var $1;
  44964. $1=(
  44965. $ctx1.supercall = true,
  44966. ($globals.TestSuiteRunner.klass.superclass||$boot.dnu).fn.prototype._new.apply($recv(self), []));
  44967. $ctx1.supercall = false;
  44968. return $recv($1)._suite_(aCollection);
  44969. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)});
  44970. },
  44971. args: ["aCollection"],
  44972. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  44973. referencedClasses: [],
  44974. messageSends: ["suite:", "new"]
  44975. }),
  44976. $globals.TestSuiteRunner.klass);
  44977. $core.addMethod(
  44978. $core.method({
  44979. selector: "isTestClass",
  44980. protocol: '*SUnit',
  44981. fn: function (){
  44982. var self=this;
  44983. return $core.withContext(function($ctx1) {
  44984. return $recv(self._includesBehavior_($globals.TestCase))._and_((function(){
  44985. return $core.withContext(function($ctx2) {
  44986. return $recv(self._isAbstract())._not();
  44987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44988. }));
  44989. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.Behavior)});
  44990. },
  44991. args: [],
  44992. source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
  44993. referencedClasses: ["TestCase"],
  44994. messageSends: ["and:", "includesBehavior:", "not", "isAbstract"]
  44995. }),
  44996. $globals.Behavior);
  44997. $core.addMethod(
  44998. $core.method({
  44999. selector: "isTestPackage",
  45000. protocol: '*SUnit',
  45001. fn: function (){
  45002. var self=this;
  45003. return $core.withContext(function($ctx1) {
  45004. return $recv(self._classes())._anySatisfy_((function(each){
  45005. return $core.withContext(function($ctx2) {
  45006. return $recv(each)._isTestClass();
  45007. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45008. }));
  45009. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  45010. },
  45011. args: [],
  45012. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  45013. referencedClasses: [],
  45014. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  45015. }),
  45016. $globals.Package);
  45017. });
  45018. define("amber_core/Compiler-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  45019. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  45020. $core.addPackage('Compiler-Tests');
  45021. $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  45022. $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  45023. $core.addClass('ASTParsingTest', $globals.TestCase, [], 'Compiler-Tests');
  45024. $core.addMethod(
  45025. $core.method({
  45026. selector: "analyze:forClass:",
  45027. protocol: 'convenience',
  45028. fn: function (aNode,aClass){
  45029. var self=this;
  45030. return $core.withContext(function($ctx1) {
  45031. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  45032. return aNode;
  45033. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  45034. },
  45035. args: ["aNode", "aClass"],
  45036. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  45037. referencedClasses: ["SemanticAnalyzer"],
  45038. messageSends: ["visit:", "on:"]
  45039. }),
  45040. $globals.ASTParsingTest);
  45041. $core.addMethod(
  45042. $core.method({
  45043. selector: "parse:",
  45044. protocol: 'parsing',
  45045. fn: function (aString){
  45046. var self=this;
  45047. return $core.withContext(function($ctx1) {
  45048. return $recv($globals.Smalltalk)._parse_(aString);
  45049. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  45050. },
  45051. args: ["aString"],
  45052. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  45053. referencedClasses: ["Smalltalk"],
  45054. messageSends: ["parse:"]
  45055. }),
  45056. $globals.ASTParsingTest);
  45057. $core.addMethod(
  45058. $core.method({
  45059. selector: "parse:forClass:",
  45060. protocol: 'parsing',
  45061. fn: function (aString,aClass){
  45062. var self=this;
  45063. return $core.withContext(function($ctx1) {
  45064. return self._analyze_forClass_(self._parse_(aString),aClass);
  45065. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  45066. },
  45067. args: ["aString", "aClass"],
  45068. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  45069. referencedClasses: [],
  45070. messageSends: ["analyze:forClass:", "parse:"]
  45071. }),
  45072. $globals.ASTParsingTest);
  45073. $core.addClass('ASTPCNodeVisitorTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  45074. $core.addMethod(
  45075. $core.method({
  45076. selector: "astPCNodeVisitor",
  45077. protocol: 'factory',
  45078. fn: function (){
  45079. var self=this;
  45080. return $core.withContext(function($ctx1) {
  45081. var $1,$2;
  45082. $1=$recv($globals.ASTPCNodeVisitor)._new();
  45083. $ctx1.sendIdx["new"]=1;
  45084. $2=$recv($recv($globals.AIContext)._new())._yourself();
  45085. $ctx1.sendIdx["yourself"]=1;
  45086. $recv($1)._context_($2);
  45087. return $recv($1)._yourself();
  45088. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  45089. },
  45090. args: [],
  45091. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  45092. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  45093. messageSends: ["context:", "new", "yourself"]
  45094. }),
  45095. $globals.ASTPCNodeVisitorTest);
  45096. $core.addMethod(
  45097. $core.method({
  45098. selector: "astPCNodeVisitorForSelector:",
  45099. protocol: 'factory',
  45100. fn: function (aString){
  45101. var self=this;
  45102. return $core.withContext(function($ctx1) {
  45103. var $1,$2;
  45104. $1=$recv($globals.ASTPCNodeVisitor)._new();
  45105. $ctx1.sendIdx["new"]=1;
  45106. $recv($1)._selector_(aString);
  45107. $2=$recv($recv($globals.AIContext)._new())._yourself();
  45108. $ctx1.sendIdx["yourself"]=1;
  45109. $recv($1)._context_($2);
  45110. return $recv($1)._yourself();
  45111. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  45112. },
  45113. args: ["aString"],
  45114. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  45115. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  45116. messageSends: ["selector:", "new", "context:", "yourself"]
  45117. }),
  45118. $globals.ASTPCNodeVisitorTest);
  45119. $core.addMethod(
  45120. $core.method({
  45121. selector: "testJSStatementNode",
  45122. protocol: 'tests',
  45123. fn: function (){
  45124. var self=this;
  45125. var ast,visitor;
  45126. return $core.withContext(function($ctx1) {
  45127. var $3,$2,$1;
  45128. ast=self._parse_forClass_("foo <consolee.log(1)>",$globals.Object);
  45129. $3=self._astPCNodeVisitor();
  45130. $recv($3)._visit_(ast);
  45131. $2=$recv($3)._currentNode();
  45132. $1=$recv($2)._isJSStatementNode();
  45133. self._assert_($1);
  45134. return self;
  45135. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  45136. },
  45137. args: [],
  45138. source: "testJSStatementNode\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",
  45139. referencedClasses: ["Object"],
  45140. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  45141. }),
  45142. $globals.ASTPCNodeVisitorTest);
  45143. $core.addMethod(
  45144. $core.method({
  45145. selector: "testMessageSend",
  45146. protocol: 'tests',
  45147. fn: function (){
  45148. var self=this;
  45149. var ast;
  45150. return $core.withContext(function($ctx1) {
  45151. var $3,$2,$1;
  45152. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  45153. $3=self._astPCNodeVisitorForSelector_("yourself");
  45154. $recv($3)._visit_(ast);
  45155. $2=$recv($3)._currentNode();
  45156. $1=$recv($2)._selector();
  45157. self._assert_equals_($1,"yourself");
  45158. return self;
  45159. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45160. },
  45161. args: [],
  45162. 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'",
  45163. referencedClasses: ["Object"],
  45164. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  45165. }),
  45166. $globals.ASTPCNodeVisitorTest);
  45167. $core.addMethod(
  45168. $core.method({
  45169. selector: "testMessageSendWithBlocks",
  45170. protocol: 'tests',
  45171. fn: function (){
  45172. var self=this;
  45173. var ast;
  45174. return $core.withContext(function($ctx1) {
  45175. var $3,$2,$1;
  45176. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  45177. $3=self._astPCNodeVisitorForSelector_("yourself");
  45178. $recv($3)._visit_(ast);
  45179. $2=$recv($3)._currentNode();
  45180. $1=$recv($2)._selector();
  45181. self._assert_equals_($1,"yourself");
  45182. return self;
  45183. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45184. },
  45185. args: [],
  45186. 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'",
  45187. referencedClasses: ["Object"],
  45188. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  45189. }),
  45190. $globals.ASTPCNodeVisitorTest);
  45191. $core.addMethod(
  45192. $core.method({
  45193. selector: "testMessageSendWithInlining",
  45194. protocol: 'tests',
  45195. fn: function (){
  45196. var self=this;
  45197. var ast;
  45198. return $core.withContext(function($ctx1) {
  45199. var $3,$4,$2,$1,$7,$6,$5;
  45200. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  45201. $ctx1.sendIdx["parse:forClass:"]=1;
  45202. $3=self._astPCNodeVisitorForSelector_("yourself");
  45203. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  45204. $recv($3)._visit_(ast);
  45205. $ctx1.sendIdx["visit:"]=1;
  45206. $4=$recv($3)._currentNode();
  45207. $ctx1.sendIdx["currentNode"]=1;
  45208. $2=$4;
  45209. $1=$recv($2)._selector();
  45210. $ctx1.sendIdx["selector"]=1;
  45211. self._assert_equals_($1,"yourself");
  45212. $ctx1.sendIdx["assert:equals:"]=1;
  45213. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  45214. $7=self._astPCNodeVisitorForSelector_("asBoolean");
  45215. $recv($7)._visit_(ast);
  45216. $6=$recv($7)._currentNode();
  45217. $5=$recv($6)._selector();
  45218. self._assert_equals_($5,"asBoolean");
  45219. return self;
  45220. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45221. },
  45222. args: [],
  45223. 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'",
  45224. referencedClasses: ["Object"],
  45225. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  45226. }),
  45227. $globals.ASTPCNodeVisitorTest);
  45228. $core.addMethod(
  45229. $core.method({
  45230. selector: "testNoMessageSend",
  45231. protocol: 'tests',
  45232. fn: function (){
  45233. var self=this;
  45234. var ast;
  45235. return $core.withContext(function($ctx1) {
  45236. var $3,$2,$1;
  45237. ast=self._parse_forClass_("foo ^ self",$globals.Object);
  45238. $3=self._astPCNodeVisitor();
  45239. $recv($3)._visit_(ast);
  45240. $2=$recv($3)._currentNode();
  45241. $1=$recv($2)._isNil();
  45242. self._assert_($1);
  45243. return self;
  45244. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45245. },
  45246. args: [],
  45247. 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",
  45248. referencedClasses: ["Object"],
  45249. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  45250. }),
  45251. $globals.ASTPCNodeVisitorTest);
  45252. $core.addMethod(
  45253. $core.method({
  45254. selector: "testPC",
  45255. protocol: 'tests',
  45256. fn: function (){
  45257. var self=this;
  45258. var ast,visitor;
  45259. return $core.withContext(function($ctx1) {
  45260. var $3,$2,$1;
  45261. ast=self._parse_forClass_("foo <console.log(1)>",$globals.Object);
  45262. $3=self._astPCNodeVisitor();
  45263. $recv($3)._visit_(ast);
  45264. $2=$recv($3)._currentNode();
  45265. $1=$recv($2)._isJSStatementNode();
  45266. self._assert_($1);
  45267. return self;
  45268. }, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  45269. },
  45270. args: [],
  45271. source: "testPC\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <console.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  45272. referencedClasses: ["Object"],
  45273. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  45274. }),
  45275. $globals.ASTPCNodeVisitorTest);
  45276. $core.addClass('ASTPositionTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  45277. $core.addMethod(
  45278. $core.method({
  45279. selector: "testNodeAtPosition",
  45280. protocol: 'tests',
  45281. fn: function (){
  45282. var self=this;
  45283. var node;
  45284. return $core.withContext(function($ctx1) {
  45285. var $3,$4,$2,$1,$7,$8,$6,$5;
  45286. node=self._parse_("yourself\x0a\x09^ self");
  45287. $ctx1.sendIdx["parse:"]=1;
  45288. $3=node;
  45289. $4=(2).__at((4));
  45290. $ctx1.sendIdx["@"]=1;
  45291. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  45292. return nil;
  45293. }));
  45294. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  45295. $1=$recv($2)._source();
  45296. self._assert_equals_($1,"self");
  45297. $ctx1.sendIdx["assert:equals:"]=1;
  45298. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  45299. $ctx1.sendIdx["parse:"]=2;
  45300. $7=node;
  45301. $8=(2).__at((7));
  45302. $ctx1.sendIdx["@"]=2;
  45303. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  45304. return nil;
  45305. }));
  45306. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  45307. $5=$recv($6)._selector();
  45308. $ctx1.sendIdx["selector"]=1;
  45309. self._assert_equals_($5,"ifTrue:");
  45310. $ctx1.sendIdx["assert:equals:"]=2;
  45311. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  45312. self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  45313. return nil;
  45314. })))._selector(),"foo");
  45315. return self;
  45316. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  45317. },
  45318. args: [],
  45319. 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'",
  45320. referencedClasses: [],
  45321. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  45322. }),
  45323. $globals.ASTPositionTest);
  45324. $core.addClass('CodeGeneratorTest', $globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
  45325. $core.addMethod(
  45326. $core.method({
  45327. selector: "codeGeneratorClass",
  45328. protocol: 'accessing',
  45329. fn: function (){
  45330. var self=this;
  45331. return $globals.CodeGenerator;
  45332. },
  45333. args: [],
  45334. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  45335. referencedClasses: ["CodeGenerator"],
  45336. messageSends: []
  45337. }),
  45338. $globals.CodeGeneratorTest);
  45339. $core.addMethod(
  45340. $core.method({
  45341. selector: "compiler",
  45342. protocol: 'factory',
  45343. fn: function (){
  45344. var self=this;
  45345. return $core.withContext(function($ctx1) {
  45346. var $1;
  45347. $1=$recv($globals.Compiler)._new();
  45348. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  45349. return $recv($1)._yourself();
  45350. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  45351. },
  45352. args: [],
  45353. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  45354. referencedClasses: ["Compiler"],
  45355. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  45356. }),
  45357. $globals.CodeGeneratorTest);
  45358. $core.addMethod(
  45359. $core.method({
  45360. selector: "setUp",
  45361. protocol: 'initialization',
  45362. fn: function (){
  45363. var self=this;
  45364. return $core.withContext(function($ctx1) {
  45365. self["@receiver"]=$recv($globals.DoIt)._new();
  45366. return self;
  45367. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  45368. },
  45369. args: [],
  45370. source: "setUp\x0a\x09receiver := DoIt new",
  45371. referencedClasses: ["DoIt"],
  45372. messageSends: ["new"]
  45373. }),
  45374. $globals.CodeGeneratorTest);
  45375. $core.addMethod(
  45376. $core.method({
  45377. selector: "should:receiver:raise:",
  45378. protocol: 'testing',
  45379. fn: function (aString,anObject,anErrorClass){
  45380. var self=this;
  45381. var method,result;
  45382. return $core.withContext(function($ctx1) {
  45383. var $1,$2,$3,$receiver;
  45384. self["@receiver"]=anObject;
  45385. $recv((function(){
  45386. return $core.withContext(function($ctx2) {
  45387. return self._should_raise_((function(){
  45388. return $core.withContext(function($ctx3) {
  45389. $1=self._compiler();
  45390. $2=$recv(anObject)._class();
  45391. $ctx3.sendIdx["class"]=1;
  45392. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  45393. method;
  45394. return $recv(self["@receiver"])._perform_($recv(method)._selector());
  45395. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45396. }),anErrorClass);
  45397. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45398. }))._ensure_((function(){
  45399. return $core.withContext(function($ctx2) {
  45400. $3=method;
  45401. if(($receiver = $3) == null || $receiver.isNil){
  45402. return $3;
  45403. } else {
  45404. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  45405. };
  45406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45407. }));
  45408. return self;
  45409. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  45410. },
  45411. args: ["aString", "anObject", "anErrorClass"],
  45412. 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 ] ]",
  45413. referencedClasses: [],
  45414. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  45415. }),
  45416. $globals.CodeGeneratorTest);
  45417. $core.addMethod(
  45418. $core.method({
  45419. selector: "should:receiver:return:",
  45420. protocol: 'testing',
  45421. fn: function (aString,anObject,aResult){
  45422. var self=this;
  45423. var method,result;
  45424. return $core.withContext(function($ctx1) {
  45425. var $1,$2;
  45426. self["@receiver"]=anObject;
  45427. $1=self._compiler();
  45428. $2=$recv(anObject)._class();
  45429. $ctx1.sendIdx["class"]=1;
  45430. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  45431. result=$recv(self["@receiver"])._perform_($recv(method)._selector());
  45432. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  45433. self._assert_equals_(aResult,result);
  45434. return self;
  45435. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  45436. },
  45437. args: ["aString", "anObject", "aResult"],
  45438. 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",
  45439. referencedClasses: [],
  45440. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  45441. }),
  45442. $globals.CodeGeneratorTest);
  45443. $core.addMethod(
  45444. $core.method({
  45445. selector: "should:return:",
  45446. protocol: 'testing',
  45447. fn: function (aString,anObject){
  45448. var self=this;
  45449. return $core.withContext(function($ctx1) {
  45450. return self._should_receiver_return_(aString,self["@receiver"],anObject);
  45451. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  45452. },
  45453. args: ["aString", "anObject"],
  45454. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  45455. referencedClasses: [],
  45456. messageSends: ["should:receiver:return:"]
  45457. }),
  45458. $globals.CodeGeneratorTest);
  45459. $core.addMethod(
  45460. $core.method({
  45461. selector: "tearDown",
  45462. protocol: 'initialization',
  45463. fn: function (){
  45464. var self=this;
  45465. return self;
  45466. },
  45467. args: [],
  45468. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  45469. referencedClasses: [],
  45470. messageSends: []
  45471. }),
  45472. $globals.CodeGeneratorTest);
  45473. $core.addMethod(
  45474. $core.method({
  45475. selector: "testAssignment",
  45476. protocol: 'tests',
  45477. fn: function (){
  45478. var self=this;
  45479. return $core.withContext(function($ctx1) {
  45480. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  45481. $ctx1.sendIdx["should:return:"]=1;
  45482. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  45483. $ctx1.sendIdx["should:return:"]=2;
  45484. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  45485. return self;
  45486. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  45487. },
  45488. args: [],
  45489. 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",
  45490. referencedClasses: [],
  45491. messageSends: ["should:return:"]
  45492. }),
  45493. $globals.CodeGeneratorTest);
  45494. $core.addMethod(
  45495. $core.method({
  45496. selector: "testBackslashSelectors",
  45497. protocol: 'tests',
  45498. fn: function (){
  45499. var self=this;
  45500. return $core.withContext(function($ctx1) {
  45501. self._should_return_("\x5c arg ^ 4",(4));
  45502. $ctx1.sendIdx["should:return:"]=1;
  45503. self._should_return_("\x5c\x5c arg ^ 42",(42));
  45504. return self;
  45505. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  45506. },
  45507. args: [],
  45508. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  45509. referencedClasses: [],
  45510. messageSends: ["should:return:"]
  45511. }),
  45512. $globals.CodeGeneratorTest);
  45513. $core.addMethod(
  45514. $core.method({
  45515. selector: "testBlockReturn",
  45516. protocol: 'tests',
  45517. fn: function (){
  45518. var self=this;
  45519. return $core.withContext(function($ctx1) {
  45520. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  45521. $ctx1.sendIdx["should:return:"]=1;
  45522. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  45523. $ctx1.sendIdx["should:return:"]=2;
  45524. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  45525. return self;
  45526. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  45527. },
  45528. args: [],
  45529. 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).",
  45530. referencedClasses: [],
  45531. messageSends: ["should:return:"]
  45532. }),
  45533. $globals.CodeGeneratorTest);
  45534. $core.addMethod(
  45535. $core.method({
  45536. selector: "testCascades",
  45537. protocol: 'tests',
  45538. fn: function (){
  45539. var self=this;
  45540. return $core.withContext(function($ctx1) {
  45541. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  45542. return self;
  45543. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  45544. },
  45545. args: [],
  45546. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  45547. referencedClasses: [],
  45548. messageSends: ["should:return:"]
  45549. }),
  45550. $globals.CodeGeneratorTest);
  45551. $core.addMethod(
  45552. $core.method({
  45553. selector: "testCascadesInDynamicArray",
  45554. protocol: 'tests',
  45555. fn: function (){
  45556. var self=this;
  45557. return $core.withContext(function($ctx1) {
  45558. self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  45559. return self;
  45560. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  45561. },
  45562. args: [],
  45563. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  45564. referencedClasses: [],
  45565. messageSends: ["should:return:"]
  45566. }),
  45567. $globals.CodeGeneratorTest);
  45568. $core.addMethod(
  45569. $core.method({
  45570. selector: "testCascadesInDynamicDictioary",
  45571. protocol: 'tests',
  45572. fn: function (){
  45573. var self=this;
  45574. return $core.withContext(function($ctx1) {
  45575. self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  45576. return self;
  45577. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  45578. },
  45579. args: [],
  45580. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  45581. referencedClasses: [],
  45582. messageSends: ["should:return:"]
  45583. }),
  45584. $globals.CodeGeneratorTest);
  45585. $core.addMethod(
  45586. $core.method({
  45587. selector: "testCascadesInSend",
  45588. protocol: 'tests',
  45589. fn: function (){
  45590. var self=this;
  45591. return $core.withContext(function($ctx1) {
  45592. self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  45593. return self;
  45594. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  45595. },
  45596. args: [],
  45597. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  45598. referencedClasses: [],
  45599. messageSends: ["should:return:"]
  45600. }),
  45601. $globals.CodeGeneratorTest);
  45602. $core.addMethod(
  45603. $core.method({
  45604. selector: "testCascadesWithInlining",
  45605. protocol: 'tests',
  45606. fn: function (){
  45607. var self=this;
  45608. return $core.withContext(function($ctx1) {
  45609. self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  45610. $ctx1.sendIdx["should:return:"]=1;
  45611. self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  45612. return self;
  45613. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  45614. },
  45615. args: [],
  45616. 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",
  45617. referencedClasses: [],
  45618. messageSends: ["should:return:"]
  45619. }),
  45620. $globals.CodeGeneratorTest);
  45621. $core.addMethod(
  45622. $core.method({
  45623. selector: "testDynamicArrayElementsOrdered",
  45624. protocol: 'tests',
  45625. fn: function (){
  45626. var self=this;
  45627. return $core.withContext(function($ctx1) {
  45628. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  45629. $ctx1.sendIdx["should:return:"]=1;
  45630. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  45631. return self;
  45632. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  45633. },
  45634. args: [],
  45635. 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).",
  45636. referencedClasses: [],
  45637. messageSends: ["should:return:"]
  45638. }),
  45639. $globals.CodeGeneratorTest);
  45640. $core.addMethod(
  45641. $core.method({
  45642. selector: "testDynamicDictionaryElementsOrdered",
  45643. protocol: 'tests',
  45644. fn: function (){
  45645. var self=this;
  45646. return $core.withContext(function($ctx1) {
  45647. 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)]));
  45648. return self;
  45649. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  45650. },
  45651. args: [],
  45652. 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}.",
  45653. referencedClasses: [],
  45654. messageSends: ["should:return:"]
  45655. }),
  45656. $globals.CodeGeneratorTest);
  45657. $core.addMethod(
  45658. $core.method({
  45659. selector: "testDynamicDictionaryWithMoreArrows",
  45660. protocol: 'tests',
  45661. fn: function (){
  45662. var self=this;
  45663. return $core.withContext(function($ctx1) {
  45664. var $2,$1;
  45665. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  45666. $ctx1.sendIdx["->"]=1;
  45667. $1=$recv($globals.HashedCollection)._with_($2);
  45668. self._should_return_("foo ^ #{1->2->3}",$1);
  45669. return self;
  45670. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  45671. },
  45672. args: [],
  45673. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  45674. referencedClasses: ["HashedCollection"],
  45675. messageSends: ["should:return:", "with:", "->"]
  45676. }),
  45677. $globals.CodeGeneratorTest);
  45678. $core.addMethod(
  45679. $core.method({
  45680. selector: "testGlobalVar",
  45681. protocol: 'tests',
  45682. fn: function (){
  45683. var self=this;
  45684. return $core.withContext(function($ctx1) {
  45685. self._should_return_("foo ^ eval class",$globals.BlockClosure);
  45686. $ctx1.sendIdx["should:return:"]=1;
  45687. self._should_return_("foo ^ Math cos: 0",(1));
  45688. $ctx1.sendIdx["should:return:"]=2;
  45689. self._should_return_("foo ^ NonExistingVar",nil);
  45690. return self;
  45691. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  45692. },
  45693. args: [],
  45694. 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",
  45695. referencedClasses: ["BlockClosure"],
  45696. messageSends: ["should:return:"]
  45697. }),
  45698. $globals.CodeGeneratorTest);
  45699. $core.addMethod(
  45700. $core.method({
  45701. selector: "testInnerTemporalDependentElementsOrdered",
  45702. protocol: 'tests',
  45703. fn: function (){
  45704. var self=this;
  45705. return $core.withContext(function($ctx1) {
  45706. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  45707. $2="foo".__minus_gt($globals.Array);
  45708. $ctx1.sendIdx["->"]=1;
  45709. $3="bar".__minus_gt((2));
  45710. $ctx1.sendIdx["->"]=2;
  45711. $1=[$2,$3];
  45712. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  45713. $ctx1.sendIdx["should:return:"]=1;
  45714. $5="foo".__minus_gt($globals.Array);
  45715. $ctx1.sendIdx["->"]=3;
  45716. $6="bar".__minus_gt((2));
  45717. $ctx1.sendIdx["->"]=4;
  45718. $4=[$5,$6];
  45719. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  45720. $ctx1.sendIdx["should:return:"]=2;
  45721. $8="foo".__minus_gt((1));
  45722. $ctx1.sendIdx["->"]=5;
  45723. $9="bar".__minus_gt((2));
  45724. $ctx1.sendIdx["->"]=6;
  45725. $7=[$8,$9];
  45726. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  45727. $ctx1.sendIdx["should:return:"]=3;
  45728. $11="foo".__minus_gt((1));
  45729. $ctx1.sendIdx["->"]=7;
  45730. $10=[$11,"bar".__minus_gt((2))];
  45731. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  45732. $ctx1.sendIdx["should:return:"]=4;
  45733. 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)]));
  45734. return self;
  45735. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  45736. },
  45737. args: [],
  45738. 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}.",
  45739. referencedClasses: ["Array"],
  45740. messageSends: ["should:return:", "->"]
  45741. }),
  45742. $globals.CodeGeneratorTest);
  45743. $core.addMethod(
  45744. $core.method({
  45745. selector: "testJSStatement",
  45746. protocol: 'tests',
  45747. fn: function (){
  45748. var self=this;
  45749. return $core.withContext(function($ctx1) {
  45750. self._should_return_("foo <return 2+3>",(5));
  45751. return self;
  45752. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  45753. },
  45754. args: [],
  45755. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  45756. referencedClasses: [],
  45757. messageSends: ["should:return:"]
  45758. }),
  45759. $globals.CodeGeneratorTest);
  45760. $core.addMethod(
  45761. $core.method({
  45762. selector: "testLexicalScope",
  45763. protocol: 'tests',
  45764. fn: function (){
  45765. var self=this;
  45766. return $core.withContext(function($ctx1) {
  45767. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  45768. return self;
  45769. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  45770. },
  45771. args: [],
  45772. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  45773. referencedClasses: [],
  45774. messageSends: ["should:return:"]
  45775. }),
  45776. $globals.CodeGeneratorTest);
  45777. $core.addMethod(
  45778. $core.method({
  45779. selector: "testLiterals",
  45780. protocol: 'tests',
  45781. fn: function (){
  45782. var self=this;
  45783. return $core.withContext(function($ctx1) {
  45784. self._should_return_("foo ^ 1",(1));
  45785. $ctx1.sendIdx["should:return:"]=1;
  45786. self._should_return_("foo ^ 'hello'","hello");
  45787. $ctx1.sendIdx["should:return:"]=2;
  45788. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  45789. $ctx1.sendIdx["should:return:"]=3;
  45790. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  45791. $ctx1.sendIdx["should:return:"]=4;
  45792. self._should_return_("foo ^ true",true);
  45793. $ctx1.sendIdx["should:return:"]=5;
  45794. self._should_return_("foo ^ false",false);
  45795. $ctx1.sendIdx["should:return:"]=6;
  45796. self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  45797. $ctx1.sendIdx["should:return:"]=7;
  45798. self._should_return_("foo ^ #hello","hello");
  45799. $ctx1.sendIdx["should:return:"]=8;
  45800. self._should_return_("foo ^ $h","h");
  45801. $ctx1.sendIdx["should:return:"]=9;
  45802. self._should_return_("foo ^ -123.456",(-123.456));
  45803. $ctx1.sendIdx["should:return:"]=10;
  45804. self._should_return_("foo ^ -2.5e4",(-25000));
  45805. return self;
  45806. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  45807. },
  45808. args: [],
  45809. 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.",
  45810. referencedClasses: [],
  45811. messageSends: ["should:return:"]
  45812. }),
  45813. $globals.CodeGeneratorTest);
  45814. $core.addMethod(
  45815. $core.method({
  45816. selector: "testLocalReturn",
  45817. protocol: 'tests',
  45818. fn: function (){
  45819. var self=this;
  45820. return $core.withContext(function($ctx1) {
  45821. self._should_return_("foo ^ 1",(1));
  45822. $ctx1.sendIdx["should:return:"]=1;
  45823. self._should_return_("foo ^ 1 + 1",(2));
  45824. $ctx1.sendIdx["should:return:"]=2;
  45825. self._should_return_("foo ",self["@receiver"]);
  45826. $ctx1.sendIdx["should:return:"]=3;
  45827. self._should_return_("foo self asString",self["@receiver"]);
  45828. $ctx1.sendIdx["should:return:"]=4;
  45829. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  45830. return self;
  45831. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  45832. },
  45833. args: [],
  45834. 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",
  45835. referencedClasses: [],
  45836. messageSends: ["should:return:"]
  45837. }),
  45838. $globals.CodeGeneratorTest);
  45839. $core.addMethod(
  45840. $core.method({
  45841. selector: "testMessageSends",
  45842. protocol: 'tests',
  45843. fn: function (){
  45844. var self=this;
  45845. return $core.withContext(function($ctx1) {
  45846. self._should_return_("foo ^ 1 asString","1");
  45847. $ctx1.sendIdx["should:return:"]=1;
  45848. self._should_return_("foo ^ 1 + 1",(2));
  45849. $ctx1.sendIdx["should:return:"]=2;
  45850. self._should_return_("foo ^ 1 + 2 * 3",(9));
  45851. $ctx1.sendIdx["should:return:"]=3;
  45852. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  45853. $ctx1.sendIdx["should:return:"]=4;
  45854. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  45855. return self;
  45856. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  45857. },
  45858. args: [],
  45859. 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)",
  45860. referencedClasses: [],
  45861. messageSends: ["should:return:"]
  45862. }),
  45863. $globals.CodeGeneratorTest);
  45864. $core.addMethod(
  45865. $core.method({
  45866. selector: "testMultipleSequences",
  45867. protocol: 'tests',
  45868. fn: function (){
  45869. var self=this;
  45870. return $core.withContext(function($ctx1) {
  45871. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  45872. return self;
  45873. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  45874. },
  45875. args: [],
  45876. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  45877. referencedClasses: [],
  45878. messageSends: ["should:return:"]
  45879. }),
  45880. $globals.CodeGeneratorTest);
  45881. $core.addMethod(
  45882. $core.method({
  45883. selector: "testMutableLiterals",
  45884. protocol: 'tests',
  45885. fn: function (){
  45886. var self=this;
  45887. return $core.withContext(function($ctx1) {
  45888. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  45889. return self;
  45890. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  45891. },
  45892. args: [],
  45893. 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)",
  45894. referencedClasses: [],
  45895. messageSends: ["should:return:"]
  45896. }),
  45897. $globals.CodeGeneratorTest);
  45898. $core.addMethod(
  45899. $core.method({
  45900. selector: "testNestedIfTrue",
  45901. protocol: 'tests',
  45902. fn: function (){
  45903. var self=this;
  45904. return $core.withContext(function($ctx1) {
  45905. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  45906. $ctx1.sendIdx["should:return:"]=1;
  45907. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  45908. $ctx1.sendIdx["should:return:"]=2;
  45909. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  45910. $ctx1.sendIdx["should:return:"]=3;
  45911. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  45912. return self;
  45913. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  45914. },
  45915. args: [],
  45916. 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.",
  45917. referencedClasses: [],
  45918. messageSends: ["should:return:"]
  45919. }),
  45920. $globals.CodeGeneratorTest);
  45921. $core.addMethod(
  45922. $core.method({
  45923. selector: "testNestedSends",
  45924. protocol: 'tests',
  45925. fn: function (){
  45926. var self=this;
  45927. return $core.withContext(function($ctx1) {
  45928. 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());
  45929. return self;
  45930. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  45931. },
  45932. args: [],
  45933. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  45934. referencedClasses: ["Point"],
  45935. messageSends: ["should:return:", "asString", "x:y:", "@"]
  45936. }),
  45937. $globals.CodeGeneratorTest);
  45938. $core.addMethod(
  45939. $core.method({
  45940. selector: "testNonLocalReturn",
  45941. protocol: 'tests',
  45942. fn: function (){
  45943. var self=this;
  45944. return $core.withContext(function($ctx1) {
  45945. self._should_return_("foo [ ^ 1 ] value",(1));
  45946. $ctx1.sendIdx["should:return:"]=1;
  45947. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  45948. $ctx1.sendIdx["should:return:"]=2;
  45949. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  45950. $ctx1.sendIdx["should:return:"]=3;
  45951. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  45952. return self;
  45953. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  45954. },
  45955. args: [],
  45956. 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",
  45957. referencedClasses: [],
  45958. messageSends: ["should:return:"]
  45959. }),
  45960. $globals.CodeGeneratorTest);
  45961. $core.addMethod(
  45962. $core.method({
  45963. selector: "testPascalCaseGlobal",
  45964. protocol: 'tests',
  45965. fn: function (){
  45966. var self=this;
  45967. return $core.withContext(function($ctx1) {
  45968. self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  45969. $ctx1.sendIdx["should:return:"]=1;
  45970. self._should_return_("foo ^NonExistent",nil);
  45971. return self;
  45972. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  45973. },
  45974. args: [],
  45975. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  45976. referencedClasses: ["Smalltalk"],
  45977. messageSends: ["should:return:", "at:", "globals"]
  45978. }),
  45979. $globals.CodeGeneratorTest);
  45980. $core.addMethod(
  45981. $core.method({
  45982. selector: "testRootSuperSend",
  45983. protocol: 'tests',
  45984. fn: function (){
  45985. var self=this;
  45986. return $core.withContext(function($ctx1) {
  45987. self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  45988. return self;
  45989. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  45990. },
  45991. args: [],
  45992. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  45993. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  45994. messageSends: ["should:receiver:raise:", "new"]
  45995. }),
  45996. $globals.CodeGeneratorTest);
  45997. $core.addMethod(
  45998. $core.method({
  45999. selector: "testSendReceiverAndArgumentsOrdered",
  46000. protocol: 'tests',
  46001. fn: function (){
  46002. var self=this;
  46003. return $core.withContext(function($ctx1) {
  46004. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  46005. $ctx1.sendIdx["should:return:"]=1;
  46006. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  46007. return self;
  46008. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  46009. },
  46010. args: [],
  46011. 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}.",
  46012. referencedClasses: ["Array"],
  46013. messageSends: ["should:return:"]
  46014. }),
  46015. $globals.CodeGeneratorTest);
  46016. $core.addMethod(
  46017. $core.method({
  46018. selector: "testSuperSend",
  46019. protocol: 'tests',
  46020. fn: function (){
  46021. var self=this;
  46022. return $core.withContext(function($ctx1) {
  46023. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  46024. return self;
  46025. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  46026. },
  46027. args: [],
  46028. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  46029. referencedClasses: [],
  46030. messageSends: ["should:receiver:return:"]
  46031. }),
  46032. $globals.CodeGeneratorTest);
  46033. $core.addMethod(
  46034. $core.method({
  46035. selector: "testTempVariables",
  46036. protocol: 'tests',
  46037. fn: function (){
  46038. var self=this;
  46039. return $core.withContext(function($ctx1) {
  46040. self._should_return_("foo | a | ^ a",nil);
  46041. $ctx1.sendIdx["should:return:"]=1;
  46042. self._should_return_("foo | AVariable | ^ AVariable",nil);
  46043. $ctx1.sendIdx["should:return:"]=2;
  46044. self._should_return_("foo | a b c | ^ c",nil);
  46045. $ctx1.sendIdx["should:return:"]=3;
  46046. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  46047. $ctx1.sendIdx["should:return:"]=4;
  46048. self._should_return_("foo | a | a:= 1. ^ a",(1));
  46049. $ctx1.sendIdx["should:return:"]=5;
  46050. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  46051. return self;
  46052. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  46053. },
  46054. args: [],
  46055. 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.",
  46056. referencedClasses: [],
  46057. messageSends: ["should:return:"]
  46058. }),
  46059. $globals.CodeGeneratorTest);
  46060. $core.addMethod(
  46061. $core.method({
  46062. selector: "testThisContext",
  46063. protocol: 'tests',
  46064. fn: function (){
  46065. var self=this;
  46066. return $core.withContext(function($ctx1) {
  46067. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  46068. return self;
  46069. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  46070. },
  46071. args: [],
  46072. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  46073. referencedClasses: [],
  46074. messageSends: ["should:return:"]
  46075. }),
  46076. $globals.CodeGeneratorTest);
  46077. $core.addMethod(
  46078. $core.method({
  46079. selector: "testifFalse",
  46080. protocol: 'tests',
  46081. fn: function (){
  46082. var self=this;
  46083. return $core.withContext(function($ctx1) {
  46084. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  46085. $ctx1.sendIdx["should:return:"]=1;
  46086. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  46087. $ctx1.sendIdx["should:return:"]=2;
  46088. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  46089. $ctx1.sendIdx["should:return:"]=3;
  46090. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  46091. return self;
  46092. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  46093. },
  46094. args: [],
  46095. 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.",
  46096. referencedClasses: [],
  46097. messageSends: ["should:return:"]
  46098. }),
  46099. $globals.CodeGeneratorTest);
  46100. $core.addMethod(
  46101. $core.method({
  46102. selector: "testifFalseIfTrue",
  46103. protocol: 'tests',
  46104. fn: function (){
  46105. var self=this;
  46106. return $core.withContext(function($ctx1) {
  46107. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  46108. $ctx1.sendIdx["should:return:"]=1;
  46109. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  46110. $ctx1.sendIdx["should:return:"]=2;
  46111. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  46112. $ctx1.sendIdx["should:return:"]=3;
  46113. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  46114. return self;
  46115. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  46116. },
  46117. args: [],
  46118. 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.",
  46119. referencedClasses: [],
  46120. messageSends: ["should:return:"]
  46121. }),
  46122. $globals.CodeGeneratorTest);
  46123. $core.addMethod(
  46124. $core.method({
  46125. selector: "testifNil",
  46126. protocol: 'tests',
  46127. fn: function (){
  46128. var self=this;
  46129. return $core.withContext(function($ctx1) {
  46130. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  46131. $ctx1.sendIdx["should:return:"]=1;
  46132. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  46133. $ctx1.sendIdx["should:return:"]=2;
  46134. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  46135. $ctx1.sendIdx["should:return:"]=3;
  46136. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  46137. return self;
  46138. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  46139. },
  46140. args: [],
  46141. 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.",
  46142. referencedClasses: [],
  46143. messageSends: ["should:return:"]
  46144. }),
  46145. $globals.CodeGeneratorTest);
  46146. $core.addMethod(
  46147. $core.method({
  46148. selector: "testifNilIfNotNil",
  46149. protocol: 'tests',
  46150. fn: function (){
  46151. var self=this;
  46152. return $core.withContext(function($ctx1) {
  46153. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  46154. $ctx1.sendIdx["should:return:"]=1;
  46155. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  46156. $ctx1.sendIdx["should:return:"]=2;
  46157. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  46158. $ctx1.sendIdx["should:return:"]=3;
  46159. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  46160. return self;
  46161. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  46162. },
  46163. args: [],
  46164. 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.",
  46165. referencedClasses: [],
  46166. messageSends: ["should:return:"]
  46167. }),
  46168. $globals.CodeGeneratorTest);
  46169. $core.addMethod(
  46170. $core.method({
  46171. selector: "testifNotNil",
  46172. protocol: 'tests',
  46173. fn: function (){
  46174. var self=this;
  46175. return $core.withContext(function($ctx1) {
  46176. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  46177. $ctx1.sendIdx["should:return:"]=1;
  46178. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  46179. $ctx1.sendIdx["should:return:"]=2;
  46180. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  46181. $ctx1.sendIdx["should:return:"]=3;
  46182. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  46183. return self;
  46184. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  46185. },
  46186. args: [],
  46187. 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.",
  46188. referencedClasses: [],
  46189. messageSends: ["should:return:"]
  46190. }),
  46191. $globals.CodeGeneratorTest);
  46192. $core.addMethod(
  46193. $core.method({
  46194. selector: "testifNotNilWithArgument",
  46195. protocol: 'tests',
  46196. fn: function (){
  46197. var self=this;
  46198. return $core.withContext(function($ctx1) {
  46199. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  46200. $ctx1.sendIdx["should:return:"]=1;
  46201. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  46202. $ctx1.sendIdx["should:return:"]=2;
  46203. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  46204. $ctx1.sendIdx["should:return:"]=3;
  46205. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  46206. $ctx1.sendIdx["should:return:"]=4;
  46207. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  46208. $ctx1.sendIdx["should:return:"]=5;
  46209. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  46210. return self;
  46211. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  46212. },
  46213. args: [],
  46214. 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",
  46215. referencedClasses: [],
  46216. messageSends: ["should:return:"]
  46217. }),
  46218. $globals.CodeGeneratorTest);
  46219. $core.addMethod(
  46220. $core.method({
  46221. selector: "testifTrue",
  46222. protocol: 'tests',
  46223. fn: function (){
  46224. var self=this;
  46225. return $core.withContext(function($ctx1) {
  46226. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  46227. $ctx1.sendIdx["should:return:"]=1;
  46228. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  46229. $ctx1.sendIdx["should:return:"]=2;
  46230. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  46231. $ctx1.sendIdx["should:return:"]=3;
  46232. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  46233. return self;
  46234. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  46235. },
  46236. args: [],
  46237. 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.",
  46238. referencedClasses: [],
  46239. messageSends: ["should:return:"]
  46240. }),
  46241. $globals.CodeGeneratorTest);
  46242. $core.addMethod(
  46243. $core.method({
  46244. selector: "testifTrueIfFalse",
  46245. protocol: 'tests',
  46246. fn: function (){
  46247. var self=this;
  46248. return $core.withContext(function($ctx1) {
  46249. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  46250. $ctx1.sendIdx["should:return:"]=1;
  46251. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  46252. $ctx1.sendIdx["should:return:"]=2;
  46253. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  46254. $ctx1.sendIdx["should:return:"]=3;
  46255. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  46256. return self;
  46257. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  46258. },
  46259. args: [],
  46260. 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.",
  46261. referencedClasses: [],
  46262. messageSends: ["should:return:"]
  46263. }),
  46264. $globals.CodeGeneratorTest);
  46265. $core.addClass('ASTInterpreterTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  46266. $core.addMethod(
  46267. $core.method({
  46268. selector: "analyze:forClass:",
  46269. protocol: 'parsing',
  46270. fn: function (aNode,aClass){
  46271. var self=this;
  46272. return $core.withContext(function($ctx1) {
  46273. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  46274. return aNode;
  46275. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  46276. },
  46277. args: ["aNode", "aClass"],
  46278. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  46279. referencedClasses: ["SemanticAnalyzer"],
  46280. messageSends: ["visit:", "on:"]
  46281. }),
  46282. $globals.ASTInterpreterTest);
  46283. $core.addMethod(
  46284. $core.method({
  46285. selector: "interpret:receiver:withArguments:",
  46286. protocol: 'private',
  46287. fn: function (aString,anObject,aDictionary){
  46288. var self=this;
  46289. var ctx,ast,interpreter;
  46290. return $core.withContext(function($ctx1) {
  46291. var $1,$2,$3,$receiver;
  46292. interpreter=$recv($globals.ASTInterpreter)._new();
  46293. $ctx1.sendIdx["new"]=1;
  46294. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  46295. $1=$recv($globals.AIContext)._new();
  46296. $recv($1)._receiver_(anObject);
  46297. $recv($1)._interpreter_(interpreter);
  46298. ctx=$recv($1)._yourself();
  46299. $2=$recv(ast)._sequenceNode();
  46300. if(($receiver = $2) == null || $receiver.isNil){
  46301. $2;
  46302. } else {
  46303. var sequence;
  46304. sequence=$receiver;
  46305. $recv($recv(sequence)._temps())._do_((function(each){
  46306. return $core.withContext(function($ctx2) {
  46307. return $recv(ctx)._defineLocal_(each);
  46308. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  46309. }));
  46310. };
  46311. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  46312. return $core.withContext(function($ctx2) {
  46313. return $recv(ctx)._localAt_put_(key,value);
  46314. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  46315. }));
  46316. $3=interpreter;
  46317. $recv($3)._context_(ctx);
  46318. $recv($3)._node_(ast);
  46319. $recv($3)._enterNode();
  46320. $recv($3)._proceed();
  46321. return $recv($3)._result();
  46322. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  46323. },
  46324. args: ["aString", "anObject", "aDictionary"],
  46325. 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",
  46326. referencedClasses: ["ASTInterpreter", "AIContext"],
  46327. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  46328. }),
  46329. $globals.ASTInterpreterTest);
  46330. $core.addMethod(
  46331. $core.method({
  46332. selector: "parse:",
  46333. protocol: 'parsing',
  46334. fn: function (aString){
  46335. var self=this;
  46336. return $core.withContext(function($ctx1) {
  46337. return $recv($globals.Smalltalk)._parse_(aString);
  46338. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  46339. },
  46340. args: ["aString"],
  46341. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  46342. referencedClasses: ["Smalltalk"],
  46343. messageSends: ["parse:"]
  46344. }),
  46345. $globals.ASTInterpreterTest);
  46346. $core.addMethod(
  46347. $core.method({
  46348. selector: "parse:forClass:",
  46349. protocol: 'parsing',
  46350. fn: function (aString,aClass){
  46351. var self=this;
  46352. return $core.withContext(function($ctx1) {
  46353. return self._analyze_forClass_(self._parse_(aString),aClass);
  46354. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  46355. },
  46356. args: ["aString", "aClass"],
  46357. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  46358. referencedClasses: [],
  46359. messageSends: ["analyze:forClass:", "parse:"]
  46360. }),
  46361. $globals.ASTInterpreterTest);
  46362. $core.addMethod(
  46363. $core.method({
  46364. selector: "should:receiver:return:",
  46365. protocol: 'testing',
  46366. fn: function (aString,anObject,aResult){
  46367. var self=this;
  46368. return $core.withContext(function($ctx1) {
  46369. self["@receiver"]=anObject;
  46370. return self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  46371. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  46372. },
  46373. args: ["aString", "anObject", "aResult"],
  46374. 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",
  46375. referencedClasses: [],
  46376. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  46377. }),
  46378. $globals.ASTInterpreterTest);
  46379. $core.addClass('ASTDebuggerTest', $globals.ASTInterpreterTest, [], 'Compiler-Tests');
  46380. $core.addMethod(
  46381. $core.method({
  46382. selector: "interpret:receiver:withArguments:",
  46383. protocol: 'private',
  46384. fn: function (aString,anObject,aDictionary){
  46385. var self=this;
  46386. var ctx,ast,debugger_;
  46387. return $core.withContext(function($ctx1) {
  46388. var $1,$2,$3,$4,$5,$receiver;
  46389. $1=$recv($globals.AIContext)._new();
  46390. $ctx1.sendIdx["new"]=1;
  46391. $recv($1)._receiver_(anObject);
  46392. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  46393. ctx=$recv($1)._yourself();
  46394. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  46395. $2=$recv(ast)._sequenceNode();
  46396. if(($receiver = $2) == null || $receiver.isNil){
  46397. $2;
  46398. } else {
  46399. var sequence;
  46400. sequence=$receiver;
  46401. $recv($recv(sequence)._temps())._do_((function(each){
  46402. return $core.withContext(function($ctx2) {
  46403. return $recv(ctx)._defineLocal_(each);
  46404. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  46405. }));
  46406. };
  46407. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  46408. return $core.withContext(function($ctx2) {
  46409. return $recv(ctx)._localAt_put_(key,value);
  46410. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  46411. }));
  46412. $3=$recv(ctx)._interpreter();
  46413. $ctx1.sendIdx["interpreter"]=1;
  46414. $recv($3)._context_(ctx);
  46415. $ctx1.sendIdx["context:"]=1;
  46416. $4=$recv(ctx)._interpreter();
  46417. $recv($4)._node_(ast);
  46418. $recv($4)._enterNode();
  46419. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  46420. $5=debugger_;
  46421. $recv($5)._proceed();
  46422. return $recv($5)._result();
  46423. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  46424. },
  46425. args: ["aString", "anObject", "aDictionary"],
  46426. 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",
  46427. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  46428. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  46429. }),
  46430. $globals.ASTDebuggerTest);
  46431. $core.addClass('InliningCodeGeneratorTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  46432. $core.addMethod(
  46433. $core.method({
  46434. selector: "codeGeneratorClass",
  46435. protocol: 'accessing',
  46436. fn: function (){
  46437. var self=this;
  46438. return $globals.InliningCodeGenerator;
  46439. },
  46440. args: [],
  46441. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  46442. referencedClasses: ["InliningCodeGenerator"],
  46443. messageSends: []
  46444. }),
  46445. $globals.InliningCodeGeneratorTest);
  46446. $core.addClass('ScopeVarTest', $globals.TestCase, [], 'Compiler-Tests');
  46447. $core.addMethod(
  46448. $core.method({
  46449. selector: "testClassRefVar",
  46450. protocol: 'tests',
  46451. fn: function (){
  46452. var self=this;
  46453. var node;
  46454. return $core.withContext(function($ctx1) {
  46455. var $1,$2;
  46456. $1=$recv($globals.VariableNode)._new();
  46457. $ctx1.sendIdx["new"]=1;
  46458. $recv($1)._value_("Object");
  46459. node=$recv($1)._yourself();
  46460. $2=$recv($globals.SemanticAnalyzer)._new();
  46461. $ctx1.sendIdx["new"]=2;
  46462. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  46463. $recv($2)._visit_(node);
  46464. self._assert_($recv($recv(node)._binding())._isClassRefVar());
  46465. return self;
  46466. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  46467. },
  46468. args: [],
  46469. 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",
  46470. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  46471. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  46472. }),
  46473. $globals.ScopeVarTest);
  46474. $core.addMethod(
  46475. $core.method({
  46476. selector: "testInstanceVar",
  46477. protocol: 'tests',
  46478. fn: function (){
  46479. var self=this;
  46480. var node,scope;
  46481. return $core.withContext(function($ctx1) {
  46482. var $1;
  46483. $1=$recv($globals.VariableNode)._new();
  46484. $ctx1.sendIdx["new"]=1;
  46485. $recv($1)._value_("bzzz");
  46486. node=$recv($1)._yourself();
  46487. scope=$recv($globals.MethodLexicalScope)._new();
  46488. $recv(scope)._addIVar_("bzzz");
  46489. self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  46490. return self;
  46491. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  46492. },
  46493. args: [],
  46494. 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",
  46495. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46496. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  46497. }),
  46498. $globals.ScopeVarTest);
  46499. $core.addMethod(
  46500. $core.method({
  46501. selector: "testPseudoVar",
  46502. protocol: 'tests',
  46503. fn: function (){
  46504. var self=this;
  46505. var node,pseudoVars;
  46506. return $core.withContext(function($ctx1) {
  46507. var $1;
  46508. pseudoVars=["self", "super", "true", "false", "nil"];
  46509. $recv(pseudoVars)._do_((function(each){
  46510. return $core.withContext(function($ctx2) {
  46511. $1=$recv($globals.VariableNode)._new();
  46512. $ctx2.sendIdx["new"]=1;
  46513. $recv($1)._value_(each);
  46514. node=$recv($1)._yourself();
  46515. node;
  46516. return self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  46517. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46518. }));
  46519. return self;
  46520. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  46521. },
  46522. args: [],
  46523. 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]",
  46524. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46525. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  46526. }),
  46527. $globals.ScopeVarTest);
  46528. $core.addMethod(
  46529. $core.method({
  46530. selector: "testTempVar",
  46531. protocol: 'tests',
  46532. fn: function (){
  46533. var self=this;
  46534. var node,scope;
  46535. return $core.withContext(function($ctx1) {
  46536. var $1;
  46537. $1=$recv($globals.VariableNode)._new();
  46538. $ctx1.sendIdx["new"]=1;
  46539. $recv($1)._value_("bzzz");
  46540. node=$recv($1)._yourself();
  46541. scope=$recv($globals.MethodLexicalScope)._new();
  46542. $recv(scope)._addTemp_("bzzz");
  46543. self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  46544. return self;
  46545. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  46546. },
  46547. args: [],
  46548. 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",
  46549. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46550. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  46551. }),
  46552. $globals.ScopeVarTest);
  46553. $core.addMethod(
  46554. $core.method({
  46555. selector: "testUnknownVar",
  46556. protocol: 'tests',
  46557. fn: function (){
  46558. var self=this;
  46559. var node;
  46560. return $core.withContext(function($ctx1) {
  46561. var $1;
  46562. $1=$recv($globals.VariableNode)._new();
  46563. $ctx1.sendIdx["new"]=1;
  46564. $recv($1)._value_("bzzz");
  46565. node=$recv($1)._yourself();
  46566. self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  46567. return self;
  46568. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  46569. },
  46570. args: [],
  46571. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  46572. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46573. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  46574. }),
  46575. $globals.ScopeVarTest);
  46576. $core.addClass('SemanticAnalyzerTest', $globals.TestCase, ['analyzer'], 'Compiler-Tests');
  46577. $core.addMethod(
  46578. $core.method({
  46579. selector: "setUp",
  46580. protocol: 'running',
  46581. fn: function (){
  46582. var self=this;
  46583. return $core.withContext(function($ctx1) {
  46584. self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  46585. return self;
  46586. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  46587. },
  46588. args: [],
  46589. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  46590. referencedClasses: ["SemanticAnalyzer", "Object"],
  46591. messageSends: ["on:"]
  46592. }),
  46593. $globals.SemanticAnalyzerTest);
  46594. $core.addMethod(
  46595. $core.method({
  46596. selector: "testAssignment",
  46597. protocol: 'tests',
  46598. fn: function (){
  46599. var self=this;
  46600. var src,ast;
  46601. return $core.withContext(function($ctx1) {
  46602. src="foo self := 1";
  46603. ast=$recv($globals.Smalltalk)._parse_(src);
  46604. self._should_raise_((function(){
  46605. return $core.withContext(function($ctx2) {
  46606. return $recv(self["@analyzer"])._visit_(ast);
  46607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46608. }),$globals.InvalidAssignmentError);
  46609. return self;
  46610. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46611. },
  46612. args: [],
  46613. 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",
  46614. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  46615. messageSends: ["parse:", "should:raise:", "visit:"]
  46616. }),
  46617. $globals.SemanticAnalyzerTest);
  46618. $core.addMethod(
  46619. $core.method({
  46620. selector: "testNonLocalReturn",
  46621. protocol: 'tests',
  46622. fn: function (){
  46623. var self=this;
  46624. var src,ast;
  46625. return $core.withContext(function($ctx1) {
  46626. src="foo | a | a + 1. ^ a";
  46627. ast=$recv($globals.Smalltalk)._parse_(src);
  46628. $recv(self["@analyzer"])._visit_(ast);
  46629. self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  46630. return self;
  46631. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46632. },
  46633. args: [],
  46634. 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",
  46635. referencedClasses: ["Smalltalk"],
  46636. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  46637. }),
  46638. $globals.SemanticAnalyzerTest);
  46639. $core.addMethod(
  46640. $core.method({
  46641. selector: "testNonLocalReturn2",
  46642. protocol: 'tests',
  46643. fn: function (){
  46644. var self=this;
  46645. var src,ast;
  46646. return $core.withContext(function($ctx1) {
  46647. src="foo | a | a + 1. [ [ ^ a] ]";
  46648. ast=$recv($globals.Smalltalk)._parse_(src);
  46649. $recv(self["@analyzer"])._visit_(ast);
  46650. self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  46651. return self;
  46652. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46653. },
  46654. args: [],
  46655. 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",
  46656. referencedClasses: ["Smalltalk"],
  46657. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  46658. }),
  46659. $globals.SemanticAnalyzerTest);
  46660. $core.addMethod(
  46661. $core.method({
  46662. selector: "testScope",
  46663. protocol: 'tests',
  46664. fn: function (){
  46665. var self=this;
  46666. var src,ast;
  46667. return $core.withContext(function($ctx1) {
  46668. var $4,$3,$2,$1;
  46669. src="foo | a | a + 1. [ | b | b := a ]";
  46670. ast=$recv($globals.Smalltalk)._parse_(src);
  46671. $recv(self["@analyzer"])._visit_(ast);
  46672. $4=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46673. $ctx1.sendIdx["nodes"]=1;
  46674. $3=$recv($4)._last();
  46675. $2=$recv($3)._scope();
  46676. $ctx1.sendIdx["scope"]=1;
  46677. $1=$recv($2).__eq_eq($recv(ast)._scope());
  46678. self._deny_($1);
  46679. return self;
  46680. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46681. },
  46682. args: [],
  46683. 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 nodes first nodes last scope == ast scope.",
  46684. referencedClasses: ["Smalltalk"],
  46685. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"]
  46686. }),
  46687. $globals.SemanticAnalyzerTest);
  46688. $core.addMethod(
  46689. $core.method({
  46690. selector: "testScope2",
  46691. protocol: 'tests',
  46692. fn: function (){
  46693. var self=this;
  46694. var src,ast;
  46695. return $core.withContext(function($ctx1) {
  46696. var $8,$7,$6,$5,$4,$3,$2,$1;
  46697. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  46698. ast=$recv($globals.Smalltalk)._parse_(src);
  46699. $recv(self["@analyzer"])._visit_(ast);
  46700. $8=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46701. $ctx1.sendIdx["nodes"]=3;
  46702. $7=$recv($8)._last();
  46703. $6=$recv($7)._nodes();
  46704. $ctx1.sendIdx["nodes"]=2;
  46705. $5=$recv($6)._first();
  46706. $ctx1.sendIdx["first"]=2;
  46707. $4=$recv($5)._nodes();
  46708. $ctx1.sendIdx["nodes"]=1;
  46709. $3=$recv($4)._first();
  46710. $ctx1.sendIdx["first"]=1;
  46711. $2=$recv($3)._scope();
  46712. $ctx1.sendIdx["scope"]=1;
  46713. $1=$recv($2).__eq_eq($recv(ast)._scope());
  46714. self._deny_($1);
  46715. return self;
  46716. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46717. },
  46718. args: [],
  46719. 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 nodes first nodes last nodes first nodes first scope == ast scope.",
  46720. referencedClasses: ["Smalltalk"],
  46721. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"]
  46722. }),
  46723. $globals.SemanticAnalyzerTest);
  46724. $core.addMethod(
  46725. $core.method({
  46726. selector: "testScopeLevel",
  46727. protocol: 'tests',
  46728. fn: function (){
  46729. var self=this;
  46730. var src,ast;
  46731. return $core.withContext(function($ctx1) {
  46732. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  46733. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  46734. ast=$recv($globals.Smalltalk)._parse_(src);
  46735. $recv(self["@analyzer"])._visit_(ast);
  46736. $2=$recv(ast)._scope();
  46737. $ctx1.sendIdx["scope"]=1;
  46738. $1=$recv($2)._scopeLevel();
  46739. $ctx1.sendIdx["scopeLevel"]=1;
  46740. self._assert_equals_($1,(1));
  46741. $ctx1.sendIdx["assert:equals:"]=1;
  46742. $10=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46743. $ctx1.sendIdx["nodes"]=3;
  46744. $9=$recv($10)._last();
  46745. $8=$recv($9)._nodes();
  46746. $ctx1.sendIdx["nodes"]=2;
  46747. $7=$recv($8)._first();
  46748. $ctx1.sendIdx["first"]=2;
  46749. $6=$recv($7)._nodes();
  46750. $ctx1.sendIdx["nodes"]=1;
  46751. $5=$recv($6)._first();
  46752. $ctx1.sendIdx["first"]=1;
  46753. $4=$recv($5)._scope();
  46754. $3=$recv($4)._scopeLevel();
  46755. self._assert_equals_($3,(3));
  46756. return self;
  46757. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46758. },
  46759. args: [],
  46760. 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 nodes first nodes last nodes first nodes first scope scopeLevel equals: 3",
  46761. referencedClasses: ["Smalltalk"],
  46762. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"]
  46763. }),
  46764. $globals.SemanticAnalyzerTest);
  46765. $core.addMethod(
  46766. $core.method({
  46767. selector: "testUnknownVariables",
  46768. protocol: 'tests',
  46769. fn: function (){
  46770. var self=this;
  46771. var src,ast;
  46772. return $core.withContext(function($ctx1) {
  46773. src="foo | a | b + a";
  46774. ast=$recv($globals.Smalltalk)._parse_(src);
  46775. self._should_raise_((function(){
  46776. return $core.withContext(function($ctx2) {
  46777. return $recv(self["@analyzer"])._visit_(ast);
  46778. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46779. }),$globals.UnknownVariableError);
  46780. return self;
  46781. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46782. },
  46783. args: [],
  46784. 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",
  46785. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46786. messageSends: ["parse:", "should:raise:", "visit:"]
  46787. }),
  46788. $globals.SemanticAnalyzerTest);
  46789. $core.addMethod(
  46790. $core.method({
  46791. selector: "testUnknownVariablesWithScope",
  46792. protocol: 'tests',
  46793. fn: function (){
  46794. var self=this;
  46795. var src,ast;
  46796. return $core.withContext(function($ctx1) {
  46797. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  46798. ast=$recv($globals.Smalltalk)._parse_(src);
  46799. self._should_raise_((function(){
  46800. return $core.withContext(function($ctx2) {
  46801. return $recv(self["@analyzer"])._visit_(ast);
  46802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46803. }),$globals.UnknownVariableError);
  46804. return self;
  46805. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46806. },
  46807. args: [],
  46808. 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",
  46809. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46810. messageSends: ["parse:", "should:raise:", "visit:"]
  46811. }),
  46812. $globals.SemanticAnalyzerTest);
  46813. $core.addMethod(
  46814. $core.method({
  46815. selector: "testVariableShadowing",
  46816. protocol: 'tests',
  46817. fn: function (){
  46818. var self=this;
  46819. var src,ast;
  46820. return $core.withContext(function($ctx1) {
  46821. src="foo | a | a + 1";
  46822. ast=$recv($globals.Smalltalk)._parse_(src);
  46823. $recv(self["@analyzer"])._visit_(ast);
  46824. return self;
  46825. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46826. },
  46827. args: [],
  46828. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46829. referencedClasses: ["Smalltalk"],
  46830. messageSends: ["parse:", "visit:"]
  46831. }),
  46832. $globals.SemanticAnalyzerTest);
  46833. $core.addMethod(
  46834. $core.method({
  46835. selector: "testVariableShadowing2",
  46836. protocol: 'tests',
  46837. fn: function (){
  46838. var self=this;
  46839. var src,ast;
  46840. return $core.withContext(function($ctx1) {
  46841. src="foo | a | a + 1. [ | a | a := 2 ]";
  46842. ast=$recv($globals.Smalltalk)._parse_(src);
  46843. self._should_raise_((function(){
  46844. return $core.withContext(function($ctx2) {
  46845. return $recv(self["@analyzer"])._visit_(ast);
  46846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46847. }),$globals.ShadowingVariableError);
  46848. return self;
  46849. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46850. },
  46851. args: [],
  46852. 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",
  46853. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  46854. messageSends: ["parse:", "should:raise:", "visit:"]
  46855. }),
  46856. $globals.SemanticAnalyzerTest);
  46857. $core.addMethod(
  46858. $core.method({
  46859. selector: "testVariableShadowing3",
  46860. protocol: 'tests',
  46861. fn: function (){
  46862. var self=this;
  46863. var src,ast;
  46864. return $core.withContext(function($ctx1) {
  46865. src="foo | a | a + 1. [ | b | b := 2 ]";
  46866. ast=$recv($globals.Smalltalk)._parse_(src);
  46867. $recv(self["@analyzer"])._visit_(ast);
  46868. return self;
  46869. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46870. },
  46871. args: [],
  46872. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46873. referencedClasses: ["Smalltalk"],
  46874. messageSends: ["parse:", "visit:"]
  46875. }),
  46876. $globals.SemanticAnalyzerTest);
  46877. $core.addMethod(
  46878. $core.method({
  46879. selector: "testVariableShadowing4",
  46880. protocol: 'tests',
  46881. fn: function (){
  46882. var self=this;
  46883. var src,ast;
  46884. return $core.withContext(function($ctx1) {
  46885. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  46886. ast=$recv($globals.Smalltalk)._parse_(src);
  46887. $recv(self["@analyzer"])._visit_(ast);
  46888. return self;
  46889. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46890. },
  46891. args: [],
  46892. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46893. referencedClasses: ["Smalltalk"],
  46894. messageSends: ["parse:", "visit:"]
  46895. }),
  46896. $globals.SemanticAnalyzerTest);
  46897. $core.addMethod(
  46898. $core.method({
  46899. selector: "testVariableShadowing5",
  46900. protocol: 'tests',
  46901. fn: function (){
  46902. var self=this;
  46903. var src,ast;
  46904. return $core.withContext(function($ctx1) {
  46905. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  46906. ast=$recv($globals.Smalltalk)._parse_(src);
  46907. self._should_raise_((function(){
  46908. return $core.withContext(function($ctx2) {
  46909. return $recv(self["@analyzer"])._visit_(ast);
  46910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46911. }),$globals.ShadowingVariableError);
  46912. return self;
  46913. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46914. },
  46915. args: [],
  46916. 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",
  46917. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  46918. messageSends: ["parse:", "should:raise:", "visit:"]
  46919. }),
  46920. $globals.SemanticAnalyzerTest);
  46921. $core.addMethod(
  46922. $core.method({
  46923. selector: "testVariablesLookup",
  46924. protocol: 'tests',
  46925. fn: function (){
  46926. var self=this;
  46927. var src,ast;
  46928. return $core.withContext(function($ctx1) {
  46929. 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;
  46930. src="foo | a | a + 1. [ | b | b := a ]";
  46931. ast=$recv($globals.Smalltalk)._parse_(src);
  46932. $recv(self["@analyzer"])._visit_(ast);
  46933. $7=$recv(ast)._nodes();
  46934. $ctx1.sendIdx["nodes"]=2;
  46935. $6=$recv($7)._first();
  46936. $ctx1.sendIdx["first"]=2;
  46937. $5=$recv($6)._nodes();
  46938. $ctx1.sendIdx["nodes"]=1;
  46939. $4=$recv($5)._first();
  46940. $ctx1.sendIdx["first"]=1;
  46941. $3=$recv($4)._receiver();
  46942. $ctx1.sendIdx["receiver"]=1;
  46943. $2=$recv($3)._binding();
  46944. $ctx1.sendIdx["binding"]=1;
  46945. $1=$recv($2)._isTempVar();
  46946. $ctx1.sendIdx["isTempVar"]=1;
  46947. self._assert_($1);
  46948. $ctx1.sendIdx["assert:"]=1;
  46949. $15=$recv(ast)._nodes();
  46950. $ctx1.sendIdx["nodes"]=4;
  46951. $14=$recv($15)._first();
  46952. $ctx1.sendIdx["first"]=4;
  46953. $13=$recv($14)._nodes();
  46954. $ctx1.sendIdx["nodes"]=3;
  46955. $12=$recv($13)._first();
  46956. $ctx1.sendIdx["first"]=3;
  46957. $11=$recv($12)._receiver();
  46958. $10=$recv($11)._binding();
  46959. $ctx1.sendIdx["binding"]=2;
  46960. $9=$recv($10)._scope();
  46961. $ctx1.sendIdx["scope"]=1;
  46962. $16=$recv(ast)._scope();
  46963. $ctx1.sendIdx["scope"]=2;
  46964. $8=$recv($9).__eq_eq($16);
  46965. $ctx1.sendIdx["=="]=1;
  46966. self._assert_($8);
  46967. $ctx1.sendIdx["assert:"]=2;
  46968. $27=$recv(ast)._nodes();
  46969. $ctx1.sendIdx["nodes"]=8;
  46970. $26=$recv($27)._first();
  46971. $ctx1.sendIdx["first"]=7;
  46972. $25=$recv($26)._nodes();
  46973. $ctx1.sendIdx["nodes"]=7;
  46974. $24=$recv($25)._last();
  46975. $ctx1.sendIdx["last"]=1;
  46976. $23=$recv($24)._nodes();
  46977. $ctx1.sendIdx["nodes"]=6;
  46978. $22=$recv($23)._first();
  46979. $ctx1.sendIdx["first"]=6;
  46980. $21=$recv($22)._nodes();
  46981. $ctx1.sendIdx["nodes"]=5;
  46982. $20=$recv($21)._first();
  46983. $ctx1.sendIdx["first"]=5;
  46984. $19=$recv($20)._left();
  46985. $ctx1.sendIdx["left"]=1;
  46986. $18=$recv($19)._binding();
  46987. $ctx1.sendIdx["binding"]=3;
  46988. $17=$recv($18)._isTempVar();
  46989. self._assert_($17);
  46990. $ctx1.sendIdx["assert:"]=3;
  46991. $39=$recv(ast)._nodes();
  46992. $ctx1.sendIdx["nodes"]=12;
  46993. $38=$recv($39)._first();
  46994. $ctx1.sendIdx["first"]=10;
  46995. $37=$recv($38)._nodes();
  46996. $ctx1.sendIdx["nodes"]=11;
  46997. $36=$recv($37)._last();
  46998. $ctx1.sendIdx["last"]=2;
  46999. $35=$recv($36)._nodes();
  47000. $ctx1.sendIdx["nodes"]=10;
  47001. $34=$recv($35)._first();
  47002. $ctx1.sendIdx["first"]=9;
  47003. $33=$recv($34)._nodes();
  47004. $ctx1.sendIdx["nodes"]=9;
  47005. $32=$recv($33)._first();
  47006. $ctx1.sendIdx["first"]=8;
  47007. $31=$recv($32)._left();
  47008. $30=$recv($31)._binding();
  47009. $29=$recv($30)._scope();
  47010. $ctx1.sendIdx["scope"]=3;
  47011. $42=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47012. $ctx1.sendIdx["nodes"]=13;
  47013. $41=$recv($42)._last();
  47014. $40=$recv($41)._scope();
  47015. $28=$recv($29).__eq_eq($40);
  47016. self._assert_($28);
  47017. return self;
  47018. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47019. },
  47020. args: [],
  47021. 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 nodes first nodes first receiver binding isTempVar.\x0a\x09self assert: ast nodes first nodes first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding isTempVar.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding scope == ast nodes first nodes last scope.",
  47022. referencedClasses: ["Smalltalk"],
  47023. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"]
  47024. }),
  47025. $globals.SemanticAnalyzerTest);
  47026. $core.addClass('AISemanticAnalyzerTest', $globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
  47027. $core.addMethod(
  47028. $core.method({
  47029. selector: "setUp",
  47030. protocol: 'running',
  47031. fn: function (){
  47032. var self=this;
  47033. return $core.withContext(function($ctx1) {
  47034. var $1,$3,$4,$2;
  47035. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  47036. $3=$recv($globals.AIContext)._new();
  47037. $recv($3)._defineLocal_("local");
  47038. $recv($3)._localAt_put_("local",(3));
  47039. $4=$recv($3)._yourself();
  47040. $ctx1.sendIdx["yourself"]=1;
  47041. $2=$4;
  47042. $recv($1)._context_($2);
  47043. self["@analyzer"]=$recv($1)._yourself();
  47044. return self;
  47045. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  47046. },
  47047. args: [],
  47048. 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",
  47049. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  47050. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  47051. }),
  47052. $globals.AISemanticAnalyzerTest);
  47053. $core.addMethod(
  47054. $core.method({
  47055. selector: "testContextVariables",
  47056. protocol: 'tests',
  47057. fn: function (){
  47058. var self=this;
  47059. var src,ast;
  47060. return $core.withContext(function($ctx1) {
  47061. src="foo | a | local + a";
  47062. ast=$recv($globals.Smalltalk)._parse_(src);
  47063. self._shouldnt_raise_((function(){
  47064. return $core.withContext(function($ctx2) {
  47065. return $recv(self["@analyzer"])._visit_(ast);
  47066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47067. }),$globals.UnknownVariableError);
  47068. return self;
  47069. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  47070. },
  47071. args: [],
  47072. 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",
  47073. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  47074. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  47075. }),
  47076. $globals.AISemanticAnalyzerTest);
  47077. });
  47078. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){"use strict";
  47079. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  47080. $core.addPackage('Kernel-Tests');
  47081. $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  47082. $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  47083. $core.addClass('AnnouncementSubscriptionTest', $globals.TestCase, [], 'Kernel-Tests');
  47084. $core.addMethod(
  47085. $core.method({
  47086. selector: "testAddExtensionMethod",
  47087. protocol: 'tests',
  47088. fn: function (){
  47089. var self=this;
  47090. var method,dirty;
  47091. return $core.withContext(function($ctx1) {
  47092. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  47093. $2=self._class();
  47094. $ctx1.sendIdx["class"]=1;
  47095. $1=$recv($2)._package();
  47096. $ctx1.sendIdx["package"]=1;
  47097. dirty=$recv($1)._isDirty();
  47098. $ctx1.sendIdx["isDirty"]=1;
  47099. $4=self._class();
  47100. $ctx1.sendIdx["class"]=2;
  47101. $3=$recv($4)._package();
  47102. $ctx1.sendIdx["package"]=2;
  47103. $recv($3)._beClean();
  47104. $5=self._class();
  47105. $ctx1.sendIdx["class"]=3;
  47106. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  47107. $8=self._class();
  47108. $ctx1.sendIdx["class"]=4;
  47109. $7=$recv($8)._package();
  47110. $ctx1.sendIdx["package"]=3;
  47111. $6=$recv($7)._isDirty();
  47112. self._deny_($6);
  47113. $9=self._class();
  47114. $ctx1.sendIdx["class"]=5;
  47115. $recv($9)._removeCompiledMethod_(method);
  47116. $10=dirty;
  47117. if($core.assert($10)){
  47118. $recv($recv(self._class())._package())._beDirty();
  47119. };
  47120. return self;
  47121. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  47122. },
  47123. args: [],
  47124. 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 ]",
  47125. referencedClasses: [],
  47126. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  47127. }),
  47128. $globals.AnnouncementSubscriptionTest);
  47129. $core.addMethod(
  47130. $core.method({
  47131. selector: "testHandlesAnnouncement",
  47132. protocol: 'tests',
  47133. fn: function (){
  47134. var self=this;
  47135. var subscription,announcementClass1,announcementClass2,classBuilder;
  47136. return $core.withContext(function($ctx1) {
  47137. var $1,$2;
  47138. classBuilder=$recv($globals.ClassBuilder)._new();
  47139. $ctx1.sendIdx["new"]=1;
  47140. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  47141. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  47142. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  47143. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  47144. self._assert_equals_($1,true);
  47145. $ctx1.sendIdx["assert:equals:"]=1;
  47146. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  47147. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  47148. self._assert_equals_($2,true);
  47149. $ctx1.sendIdx["assert:equals:"]=2;
  47150. self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  47151. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  47152. return self;
  47153. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  47154. },
  47155. args: [],
  47156. 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.",
  47157. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  47158. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  47159. }),
  47160. $globals.AnnouncementSubscriptionTest);
  47161. $core.addClass('AnnouncerTest', $globals.TestCase, [], 'Kernel-Tests');
  47162. $core.addMethod(
  47163. $core.method({
  47164. selector: "testOnDo",
  47165. protocol: 'tests',
  47166. fn: function (){
  47167. var self=this;
  47168. var counter,announcer;
  47169. return $core.withContext(function($ctx1) {
  47170. var $1,$2;
  47171. counter=(0);
  47172. announcer=$recv($globals.Announcer)._new();
  47173. $ctx1.sendIdx["new"]=1;
  47174. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  47175. return $core.withContext(function($ctx2) {
  47176. counter=$recv(counter).__plus((1));
  47177. return counter;
  47178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47179. }));
  47180. $1=announcer;
  47181. $2=$recv($globals.SystemAnnouncement)._new();
  47182. $ctx1.sendIdx["new"]=2;
  47183. $recv($1)._announce_($2);
  47184. $ctx1.sendIdx["announce:"]=1;
  47185. self._assert_equals_(counter,(1));
  47186. $ctx1.sendIdx["assert:equals:"]=1;
  47187. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47188. self._assert_equals_(counter,(2));
  47189. return self;
  47190. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47191. },
  47192. args: [],
  47193. 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.",
  47194. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47195. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  47196. }),
  47197. $globals.AnnouncerTest);
  47198. $core.addMethod(
  47199. $core.method({
  47200. selector: "testOnDoFor",
  47201. protocol: 'tests',
  47202. fn: function (){
  47203. var self=this;
  47204. var counter,announcer;
  47205. return $core.withContext(function($ctx1) {
  47206. var $1,$2,$3,$4;
  47207. counter=(0);
  47208. announcer=$recv($globals.Announcer)._new();
  47209. $ctx1.sendIdx["new"]=1;
  47210. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  47211. return $core.withContext(function($ctx2) {
  47212. counter=$recv(counter).__plus((1));
  47213. return counter;
  47214. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47215. }),self);
  47216. $1=announcer;
  47217. $2=$recv($globals.SystemAnnouncement)._new();
  47218. $ctx1.sendIdx["new"]=2;
  47219. $recv($1)._announce_($2);
  47220. $ctx1.sendIdx["announce:"]=1;
  47221. self._assert_equals_(counter,(1));
  47222. $ctx1.sendIdx["assert:equals:"]=1;
  47223. $3=announcer;
  47224. $4=$recv($globals.SystemAnnouncement)._new();
  47225. $ctx1.sendIdx["new"]=3;
  47226. $recv($3)._announce_($4);
  47227. $ctx1.sendIdx["announce:"]=2;
  47228. self._assert_equals_(counter,(2));
  47229. $ctx1.sendIdx["assert:equals:"]=2;
  47230. $recv(announcer)._unsubscribe_(self);
  47231. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47232. self._assert_equals_(counter,(2));
  47233. return self;
  47234. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47235. },
  47236. args: [],
  47237. 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.",
  47238. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47239. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  47240. }),
  47241. $globals.AnnouncerTest);
  47242. $core.addMethod(
  47243. $core.method({
  47244. selector: "testOnDoOnce",
  47245. protocol: 'tests',
  47246. fn: function (){
  47247. var self=this;
  47248. var counter,announcer;
  47249. return $core.withContext(function($ctx1) {
  47250. var $1,$2;
  47251. counter=(0);
  47252. announcer=$recv($globals.Announcer)._new();
  47253. $ctx1.sendIdx["new"]=1;
  47254. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  47255. return $core.withContext(function($ctx2) {
  47256. counter=$recv(counter).__plus((1));
  47257. return counter;
  47258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47259. }));
  47260. $1=announcer;
  47261. $2=$recv($globals.SystemAnnouncement)._new();
  47262. $ctx1.sendIdx["new"]=2;
  47263. $recv($1)._announce_($2);
  47264. $ctx1.sendIdx["announce:"]=1;
  47265. self._assert_equals_(counter,(1));
  47266. $ctx1.sendIdx["assert:equals:"]=1;
  47267. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47268. self._assert_equals_(counter,(1));
  47269. return self;
  47270. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47271. },
  47272. args: [],
  47273. 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.",
  47274. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47275. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  47276. }),
  47277. $globals.AnnouncerTest);
  47278. $core.addClass('BlockClosureTest', $globals.TestCase, [], 'Kernel-Tests');
  47279. $core.addMethod(
  47280. $core.method({
  47281. selector: "localReturnOnDoCatch",
  47282. protocol: 'fixture',
  47283. fn: function (){
  47284. var self=this;
  47285. return $core.withContext(function($ctx1) {
  47286. var $early={};
  47287. try {
  47288. $recv((function(){
  47289. throw $early=[(2)];
  47290. }))._on_do_($globals.Error,(function(){
  47291. }));
  47292. return (3);
  47293. }
  47294. catch(e) {if(e===$early)return e[0]; throw e}
  47295. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  47296. },
  47297. args: [],
  47298. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  47299. referencedClasses: ["Error"],
  47300. messageSends: ["on:do:"]
  47301. }),
  47302. $globals.BlockClosureTest);
  47303. $core.addMethod(
  47304. $core.method({
  47305. selector: "localReturnOnDoMiss",
  47306. protocol: 'fixture',
  47307. fn: function (){
  47308. var self=this;
  47309. return $core.withContext(function($ctx1) {
  47310. var $early={};
  47311. try {
  47312. $recv((function(){
  47313. throw $early=[(2)];
  47314. }))._on_do_($globals.Class,(function(){
  47315. }));
  47316. return (3);
  47317. }
  47318. catch(e) {if(e===$early)return e[0]; throw e}
  47319. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  47320. },
  47321. args: [],
  47322. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  47323. referencedClasses: ["Class"],
  47324. messageSends: ["on:do:"]
  47325. }),
  47326. $globals.BlockClosureTest);
  47327. $core.addMethod(
  47328. $core.method({
  47329. selector: "testCanClearInterval",
  47330. protocol: 'tests',
  47331. fn: function (){
  47332. var self=this;
  47333. return $core.withContext(function($ctx1) {
  47334. self._shouldnt_raise_((function(){
  47335. return $core.withContext(function($ctx2) {
  47336. return $recv($recv((function(){
  47337. return $core.withContext(function($ctx3) {
  47338. return $recv($recv($globals.Error)._new())._signal();
  47339. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47340. }))._valueWithInterval_((0)))._clearInterval();
  47341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47342. }),$globals.Error);
  47343. return self;
  47344. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  47345. },
  47346. args: [],
  47347. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  47348. referencedClasses: ["Error"],
  47349. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  47350. }),
  47351. $globals.BlockClosureTest);
  47352. $core.addMethod(
  47353. $core.method({
  47354. selector: "testCanClearTimeout",
  47355. protocol: 'tests',
  47356. fn: function (){
  47357. var self=this;
  47358. return $core.withContext(function($ctx1) {
  47359. self._shouldnt_raise_((function(){
  47360. return $core.withContext(function($ctx2) {
  47361. return $recv($recv((function(){
  47362. return $core.withContext(function($ctx3) {
  47363. return $recv($recv($globals.Error)._new())._signal();
  47364. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47365. }))._valueWithTimeout_((0)))._clearTimeout();
  47366. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47367. }),$globals.Error);
  47368. return self;
  47369. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  47370. },
  47371. args: [],
  47372. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  47373. referencedClasses: ["Error"],
  47374. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  47375. }),
  47376. $globals.BlockClosureTest);
  47377. $core.addMethod(
  47378. $core.method({
  47379. selector: "testCompiledSource",
  47380. protocol: 'tests',
  47381. fn: function (){
  47382. var self=this;
  47383. return $core.withContext(function($ctx1) {
  47384. self._assert_($recv($recv((function(){
  47385. return $core.withContext(function($ctx2) {
  47386. return (1).__plus((1));
  47387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47388. }))._compiledSource())._includesSubString_("function"));
  47389. return self;
  47390. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  47391. },
  47392. args: [],
  47393. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  47394. referencedClasses: [],
  47395. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  47396. }),
  47397. $globals.BlockClosureTest);
  47398. $core.addMethod(
  47399. $core.method({
  47400. selector: "testCurrySelf",
  47401. protocol: 'tests',
  47402. fn: function (){
  47403. var self=this;
  47404. var curriedMethod,array;
  47405. return $core.withContext(function($ctx1) {
  47406. curriedMethod=$recv($recv((function(selfarg,x){
  47407. return $core.withContext(function($ctx2) {
  47408. return $recv(selfarg)._at_(x);
  47409. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  47410. }))._currySelf())._asCompiledMethod_("foo:");
  47411. array=[(3), (1), (4)];
  47412. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  47413. $recv((function(){
  47414. return $core.withContext(function($ctx2) {
  47415. return self._assert_equals_($recv(array)._foo_((2)),(1));
  47416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47417. }))._ensure_((function(){
  47418. return $core.withContext(function($ctx2) {
  47419. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  47420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47421. }));
  47422. return self;
  47423. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  47424. },
  47425. args: [],
  47426. 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 ]",
  47427. referencedClasses: ["ClassBuilder", "Array"],
  47428. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  47429. }),
  47430. $globals.BlockClosureTest);
  47431. $core.addMethod(
  47432. $core.method({
  47433. selector: "testEnsure",
  47434. protocol: 'tests',
  47435. fn: function (){
  47436. var self=this;
  47437. return $core.withContext(function($ctx1) {
  47438. self._assert_equals_($recv((function(){
  47439. return (3);
  47440. }))._ensure_((function(){
  47441. return (4);
  47442. })),(3));
  47443. return self;
  47444. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  47445. },
  47446. args: [],
  47447. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  47448. referencedClasses: [],
  47449. messageSends: ["assert:equals:", "ensure:"]
  47450. }),
  47451. $globals.BlockClosureTest);
  47452. $core.addMethod(
  47453. $core.method({
  47454. selector: "testEnsureRaises",
  47455. protocol: 'tests',
  47456. fn: function (){
  47457. var self=this;
  47458. return $core.withContext(function($ctx1) {
  47459. self._should_raise_((function(){
  47460. return $core.withContext(function($ctx2) {
  47461. return $recv((function(){
  47462. return $core.withContext(function($ctx3) {
  47463. return $recv($recv($globals.Error)._new())._signal();
  47464. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47465. }))._ensure_((function(){
  47466. return true;
  47467. }));
  47468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47469. }),$globals.Error);
  47470. return self;
  47471. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  47472. },
  47473. args: [],
  47474. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  47475. referencedClasses: ["Error"],
  47476. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  47477. }),
  47478. $globals.BlockClosureTest);
  47479. $core.addMethod(
  47480. $core.method({
  47481. selector: "testExceptionSemantics",
  47482. protocol: 'tests',
  47483. fn: function (){
  47484. var self=this;
  47485. return $core.withContext(function($ctx1) {
  47486. self._timeout_((100));
  47487. $recv(self._async_((function(){
  47488. return $core.withContext(function($ctx2) {
  47489. return $recv((function(){
  47490. return $core.withContext(function($ctx3) {
  47491. self._assert_(true);
  47492. $recv($globals.Error)._signal();
  47493. self._deny_(true);
  47494. return self._finished();
  47495. $ctx3.sendIdx["finished"]=1;
  47496. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47497. }))._on_do_($globals.Error,(function(ex){
  47498. return $core.withContext(function($ctx3) {
  47499. return self._finished();
  47500. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  47501. }));
  47502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47503. })))._valueWithTimeout_((0));
  47504. return self;
  47505. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  47506. },
  47507. args: [],
  47508. 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",
  47509. referencedClasses: ["Error"],
  47510. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  47511. }),
  47512. $globals.BlockClosureTest);
  47513. $core.addMethod(
  47514. $core.method({
  47515. selector: "testLocalReturnOnDoCatch",
  47516. protocol: 'tests',
  47517. fn: function (){
  47518. var self=this;
  47519. return $core.withContext(function($ctx1) {
  47520. self._assert_equals_(self._localReturnOnDoCatch(),(2));
  47521. return self;
  47522. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  47523. },
  47524. args: [],
  47525. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  47526. referencedClasses: [],
  47527. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  47528. }),
  47529. $globals.BlockClosureTest);
  47530. $core.addMethod(
  47531. $core.method({
  47532. selector: "testLocalReturnOnDoMiss",
  47533. protocol: 'tests',
  47534. fn: function (){
  47535. var self=this;
  47536. return $core.withContext(function($ctx1) {
  47537. self._assert_equals_(self._localReturnOnDoMiss(),(2));
  47538. return self;
  47539. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  47540. },
  47541. args: [],
  47542. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  47543. referencedClasses: [],
  47544. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  47545. }),
  47546. $globals.BlockClosureTest);
  47547. $core.addMethod(
  47548. $core.method({
  47549. selector: "testNewWithValues",
  47550. protocol: 'tests',
  47551. fn: function (){
  47552. var self=this;
  47553. return $core.withContext(function($ctx1) {
  47554. function TestConstructor(arg1, arg2, arg3) {}
  47555. TestConstructor.prototype.name = 'theTestPrototype';
  47556. var wrappedConstructor = $recv(TestConstructor);
  47557. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  47558. self._assert_(result instanceof TestConstructor);
  47559. self._assert_equals_(result.name, 'theTestPrototype');
  47560. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  47561. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);;
  47562. return self;
  47563. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  47564. },
  47565. args: [],
  47566. source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\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, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);\x0a>",
  47567. referencedClasses: [],
  47568. messageSends: []
  47569. }),
  47570. $globals.BlockClosureTest);
  47571. $core.addMethod(
  47572. $core.method({
  47573. selector: "testNumArgs",
  47574. protocol: 'tests',
  47575. fn: function (){
  47576. var self=this;
  47577. return $core.withContext(function($ctx1) {
  47578. var $1;
  47579. $1=$recv((function(){
  47580. }))._numArgs();
  47581. $ctx1.sendIdx["numArgs"]=1;
  47582. self._assert_equals_($1,(0));
  47583. $ctx1.sendIdx["assert:equals:"]=1;
  47584. self._assert_equals_($recv((function(a,b){
  47585. }))._numArgs(),(2));
  47586. return self;
  47587. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  47588. },
  47589. args: [],
  47590. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  47591. referencedClasses: [],
  47592. messageSends: ["assert:equals:", "numArgs"]
  47593. }),
  47594. $globals.BlockClosureTest);
  47595. $core.addMethod(
  47596. $core.method({
  47597. selector: "testOnDo",
  47598. protocol: 'tests',
  47599. fn: function (){
  47600. var self=this;
  47601. return $core.withContext(function($ctx1) {
  47602. self._assert_($recv((function(){
  47603. return $core.withContext(function($ctx2) {
  47604. return $recv($recv($globals.Error)._new())._signal();
  47605. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47606. }))._on_do_($globals.Error,(function(ex){
  47607. return true;
  47608. })));
  47609. return self;
  47610. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  47611. },
  47612. args: [],
  47613. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  47614. referencedClasses: ["Error"],
  47615. messageSends: ["assert:", "on:do:", "signal", "new"]
  47616. }),
  47617. $globals.BlockClosureTest);
  47618. $core.addMethod(
  47619. $core.method({
  47620. selector: "testValue",
  47621. protocol: 'tests',
  47622. fn: function (){
  47623. var self=this;
  47624. return $core.withContext(function($ctx1) {
  47625. var $1;
  47626. $1=$recv((function(){
  47627. return $core.withContext(function($ctx2) {
  47628. return (1).__plus((1));
  47629. $ctx2.sendIdx["+"]=1;
  47630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47631. }))._value();
  47632. $ctx1.sendIdx["value"]=1;
  47633. self._assert_equals_($1,(2));
  47634. $ctx1.sendIdx["assert:equals:"]=1;
  47635. self._assert_equals_($recv((function(x){
  47636. return $core.withContext(function($ctx2) {
  47637. return $recv(x).__plus((1));
  47638. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  47639. }))._value_((2)),(3));
  47640. $ctx1.sendIdx["assert:equals:"]=2;
  47641. self._assert_equals_($recv((function(x,y){
  47642. return $core.withContext(function($ctx2) {
  47643. return $recv(x).__star(y);
  47644. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  47645. }))._value_value_((2),(4)),(8));
  47646. $ctx1.sendIdx["assert:equals:"]=3;
  47647. self._assert_equals_($recv((function(a,b,c){
  47648. return (1);
  47649. }))._value(),(1));
  47650. return self;
  47651. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  47652. },
  47653. args: [],
  47654. 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",
  47655. referencedClasses: [],
  47656. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  47657. }),
  47658. $globals.BlockClosureTest);
  47659. $core.addMethod(
  47660. $core.method({
  47661. selector: "testValueWithPossibleArguments",
  47662. protocol: 'tests',
  47663. fn: function (){
  47664. var self=this;
  47665. return $core.withContext(function($ctx1) {
  47666. var $1,$2;
  47667. $1=$recv((function(){
  47668. return (1);
  47669. }))._valueWithPossibleArguments_([(3), (4)]);
  47670. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  47671. self._assert_equals_($1,(1));
  47672. $ctx1.sendIdx["assert:equals:"]=1;
  47673. $2=$recv((function(a){
  47674. return $core.withContext(function($ctx2) {
  47675. return $recv(a).__plus((4));
  47676. $ctx2.sendIdx["+"]=1;
  47677. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  47678. }))._valueWithPossibleArguments_([(3), (4)]);
  47679. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  47680. self._assert_equals_($2,(7));
  47681. $ctx1.sendIdx["assert:equals:"]=2;
  47682. self._assert_equals_($recv((function(a,b){
  47683. return $core.withContext(function($ctx2) {
  47684. return $recv(a).__plus(b);
  47685. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  47686. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  47687. return self;
  47688. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  47689. },
  47690. args: [],
  47691. 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.",
  47692. referencedClasses: [],
  47693. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  47694. }),
  47695. $globals.BlockClosureTest);
  47696. $core.addMethod(
  47697. $core.method({
  47698. selector: "testWhileFalse",
  47699. protocol: 'tests',
  47700. fn: function (){
  47701. var self=this;
  47702. var i;
  47703. return $core.withContext(function($ctx1) {
  47704. i=(0);
  47705. $recv((function(){
  47706. return $core.withContext(function($ctx2) {
  47707. return $recv(i).__gt((5));
  47708. $ctx2.sendIdx[">"]=1;
  47709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47710. }))._whileFalse_((function(){
  47711. return $core.withContext(function($ctx2) {
  47712. i=$recv(i).__plus((1));
  47713. $ctx2.sendIdx["+"]=1;
  47714. return i;
  47715. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47716. }));
  47717. self._assert_equals_(i,(6));
  47718. $ctx1.sendIdx["assert:equals:"]=1;
  47719. i=(0);
  47720. $recv((function(){
  47721. return $core.withContext(function($ctx2) {
  47722. i=$recv(i).__plus((1));
  47723. i;
  47724. return $recv(i).__gt((5));
  47725. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47726. }))._whileFalse();
  47727. self._assert_equals_(i,(6));
  47728. return self;
  47729. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  47730. },
  47731. args: [],
  47732. 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",
  47733. referencedClasses: [],
  47734. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  47735. }),
  47736. $globals.BlockClosureTest);
  47737. $core.addMethod(
  47738. $core.method({
  47739. selector: "testWhileTrue",
  47740. protocol: 'tests',
  47741. fn: function (){
  47742. var self=this;
  47743. var i;
  47744. return $core.withContext(function($ctx1) {
  47745. i=(0);
  47746. $recv((function(){
  47747. return $core.withContext(function($ctx2) {
  47748. return $recv(i).__lt((5));
  47749. $ctx2.sendIdx["<"]=1;
  47750. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47751. }))._whileTrue_((function(){
  47752. return $core.withContext(function($ctx2) {
  47753. i=$recv(i).__plus((1));
  47754. $ctx2.sendIdx["+"]=1;
  47755. return i;
  47756. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47757. }));
  47758. self._assert_equals_(i,(5));
  47759. $ctx1.sendIdx["assert:equals:"]=1;
  47760. i=(0);
  47761. $recv((function(){
  47762. return $core.withContext(function($ctx2) {
  47763. i=$recv(i).__plus((1));
  47764. i;
  47765. return $recv(i).__lt((5));
  47766. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47767. }))._whileTrue();
  47768. self._assert_equals_(i,(5));
  47769. return self;
  47770. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  47771. },
  47772. args: [],
  47773. 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",
  47774. referencedClasses: [],
  47775. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  47776. }),
  47777. $globals.BlockClosureTest);
  47778. $core.addClass('BooleanTest', $globals.TestCase, [], 'Kernel-Tests');
  47779. $core.addMethod(
  47780. $core.method({
  47781. selector: "testEquality",
  47782. protocol: 'tests',
  47783. fn: function (){
  47784. var self=this;
  47785. return $core.withContext(function($ctx1) {
  47786. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  47787. $1=(0).__eq(false);
  47788. $ctx1.sendIdx["="]=1;
  47789. self._deny_($1);
  47790. $ctx1.sendIdx["deny:"]=1;
  47791. $2=false.__eq((0));
  47792. $ctx1.sendIdx["="]=2;
  47793. self._deny_($2);
  47794. $ctx1.sendIdx["deny:"]=2;
  47795. $3="".__eq(false);
  47796. $ctx1.sendIdx["="]=3;
  47797. self._deny_($3);
  47798. $ctx1.sendIdx["deny:"]=3;
  47799. $4=false.__eq("");
  47800. $ctx1.sendIdx["="]=4;
  47801. self._deny_($4);
  47802. $ctx1.sendIdx["deny:"]=4;
  47803. $5=true.__eq(true);
  47804. $ctx1.sendIdx["="]=5;
  47805. self._assert_($5);
  47806. $ctx1.sendIdx["assert:"]=1;
  47807. $6=false.__eq(true);
  47808. $ctx1.sendIdx["="]=6;
  47809. self._deny_($6);
  47810. $ctx1.sendIdx["deny:"]=5;
  47811. $7=true.__eq(false);
  47812. $ctx1.sendIdx["="]=7;
  47813. self._deny_($7);
  47814. $8=false.__eq(false);
  47815. $ctx1.sendIdx["="]=8;
  47816. self._assert_($8);
  47817. $ctx1.sendIdx["assert:"]=2;
  47818. $10=true._yourself();
  47819. $ctx1.sendIdx["yourself"]=1;
  47820. $9=$recv($10).__eq(true);
  47821. $ctx1.sendIdx["="]=9;
  47822. self._assert_($9);
  47823. $ctx1.sendIdx["assert:"]=3;
  47824. $12=true._yourself();
  47825. $ctx1.sendIdx["yourself"]=2;
  47826. $11=$recv($12).__eq(true._yourself());
  47827. self._assert_($11);
  47828. return self;
  47829. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  47830. },
  47831. args: [],
  47832. 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)",
  47833. referencedClasses: [],
  47834. messageSends: ["deny:", "=", "assert:", "yourself"]
  47835. }),
  47836. $globals.BooleanTest);
  47837. $core.addMethod(
  47838. $core.method({
  47839. selector: "testIdentity",
  47840. protocol: 'tests',
  47841. fn: function (){
  47842. var self=this;
  47843. return $core.withContext(function($ctx1) {
  47844. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  47845. $1=(0).__eq_eq(false);
  47846. $ctx1.sendIdx["=="]=1;
  47847. self._deny_($1);
  47848. $ctx1.sendIdx["deny:"]=1;
  47849. $2=false.__eq_eq((0));
  47850. $ctx1.sendIdx["=="]=2;
  47851. self._deny_($2);
  47852. $ctx1.sendIdx["deny:"]=2;
  47853. $3="".__eq_eq(false);
  47854. $ctx1.sendIdx["=="]=3;
  47855. self._deny_($3);
  47856. $ctx1.sendIdx["deny:"]=3;
  47857. $4=false.__eq_eq("");
  47858. $ctx1.sendIdx["=="]=4;
  47859. self._deny_($4);
  47860. $ctx1.sendIdx["deny:"]=4;
  47861. $5=true.__eq_eq(true);
  47862. $ctx1.sendIdx["=="]=5;
  47863. self._assert_($5);
  47864. $ctx1.sendIdx["assert:"]=1;
  47865. $6=false.__eq_eq(true);
  47866. $ctx1.sendIdx["=="]=6;
  47867. self._deny_($6);
  47868. $ctx1.sendIdx["deny:"]=5;
  47869. $7=true.__eq_eq(false);
  47870. $ctx1.sendIdx["=="]=7;
  47871. self._deny_($7);
  47872. $8=false.__eq_eq(false);
  47873. $ctx1.sendIdx["=="]=8;
  47874. self._assert_($8);
  47875. $ctx1.sendIdx["assert:"]=2;
  47876. $10=true._yourself();
  47877. $ctx1.sendIdx["yourself"]=1;
  47878. $9=$recv($10).__eq_eq(true);
  47879. $ctx1.sendIdx["=="]=9;
  47880. self._assert_($9);
  47881. $ctx1.sendIdx["assert:"]=3;
  47882. $12=true._yourself();
  47883. $ctx1.sendIdx["yourself"]=2;
  47884. $11=$recv($12).__eq_eq(true._yourself());
  47885. self._assert_($11);
  47886. return self;
  47887. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  47888. },
  47889. args: [],
  47890. 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",
  47891. referencedClasses: [],
  47892. messageSends: ["deny:", "==", "assert:", "yourself"]
  47893. }),
  47894. $globals.BooleanTest);
  47895. $core.addMethod(
  47896. $core.method({
  47897. selector: "testIfTrueIfFalse",
  47898. protocol: 'tests',
  47899. fn: function (){
  47900. var self=this;
  47901. return $core.withContext(function($ctx1) {
  47902. var $1,$2,$3,$4,$5,$6,$7,$8;
  47903. if($core.assert(true)){
  47904. $1="alternative block";
  47905. };
  47906. self._assert_equals_($1,"alternative block");
  47907. $ctx1.sendIdx["assert:equals:"]=1;
  47908. if(!$core.assert(true)){
  47909. $2="alternative block";
  47910. };
  47911. self._assert_equals_($2,nil);
  47912. $ctx1.sendIdx["assert:equals:"]=2;
  47913. if($core.assert(false)){
  47914. $3="alternative block";
  47915. };
  47916. self._assert_equals_($3,nil);
  47917. $ctx1.sendIdx["assert:equals:"]=3;
  47918. if(!$core.assert(false)){
  47919. $4="alternative block";
  47920. };
  47921. self._assert_equals_($4,"alternative block");
  47922. $ctx1.sendIdx["assert:equals:"]=4;
  47923. if($core.assert(false)){
  47924. $5="alternative block";
  47925. } else {
  47926. $5="alternative block2";
  47927. };
  47928. self._assert_equals_($5,"alternative block2");
  47929. $ctx1.sendIdx["assert:equals:"]=5;
  47930. if($core.assert(false)){
  47931. $6="alternative block2";
  47932. } else {
  47933. $6="alternative block";
  47934. };
  47935. self._assert_equals_($6,"alternative block");
  47936. $ctx1.sendIdx["assert:equals:"]=6;
  47937. if($core.assert(true)){
  47938. $7="alternative block";
  47939. } else {
  47940. $7="alternative block2";
  47941. };
  47942. self._assert_equals_($7,"alternative block");
  47943. $ctx1.sendIdx["assert:equals:"]=7;
  47944. if($core.assert(true)){
  47945. $8="alternative block2";
  47946. } else {
  47947. $8="alternative block";
  47948. };
  47949. self._assert_equals_($8,"alternative block2");
  47950. return self;
  47951. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  47952. },
  47953. args: [],
  47954. 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'.",
  47955. referencedClasses: [],
  47956. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  47957. }),
  47958. $globals.BooleanTest);
  47959. $core.addMethod(
  47960. $core.method({
  47961. selector: "testIfTrueIfFalseWithBoxing",
  47962. protocol: 'tests',
  47963. fn: function (){
  47964. var self=this;
  47965. return $core.withContext(function($ctx1) {
  47966. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  47967. $2=true._yourself();
  47968. $ctx1.sendIdx["yourself"]=1;
  47969. if($core.assert($2)){
  47970. $1="alternative block";
  47971. };
  47972. self._assert_equals_($1,"alternative block");
  47973. $ctx1.sendIdx["assert:equals:"]=1;
  47974. $4=true._yourself();
  47975. $ctx1.sendIdx["yourself"]=2;
  47976. if(!$core.assert($4)){
  47977. $3="alternative block";
  47978. };
  47979. self._assert_equals_($3,nil);
  47980. $ctx1.sendIdx["assert:equals:"]=2;
  47981. $6=false._yourself();
  47982. $ctx1.sendIdx["yourself"]=3;
  47983. if($core.assert($6)){
  47984. $5="alternative block";
  47985. };
  47986. self._assert_equals_($5,nil);
  47987. $ctx1.sendIdx["assert:equals:"]=3;
  47988. $8=false._yourself();
  47989. $ctx1.sendIdx["yourself"]=4;
  47990. if(!$core.assert($8)){
  47991. $7="alternative block";
  47992. };
  47993. self._assert_equals_($7,"alternative block");
  47994. $ctx1.sendIdx["assert:equals:"]=4;
  47995. $10=false._yourself();
  47996. $ctx1.sendIdx["yourself"]=5;
  47997. if($core.assert($10)){
  47998. $9="alternative block";
  47999. } else {
  48000. $9="alternative block2";
  48001. };
  48002. self._assert_equals_($9,"alternative block2");
  48003. $ctx1.sendIdx["assert:equals:"]=5;
  48004. $12=false._yourself();
  48005. $ctx1.sendIdx["yourself"]=6;
  48006. if($core.assert($12)){
  48007. $11="alternative block2";
  48008. } else {
  48009. $11="alternative block";
  48010. };
  48011. self._assert_equals_($11,"alternative block");
  48012. $ctx1.sendIdx["assert:equals:"]=6;
  48013. $14=true._yourself();
  48014. $ctx1.sendIdx["yourself"]=7;
  48015. if($core.assert($14)){
  48016. $13="alternative block";
  48017. } else {
  48018. $13="alternative block2";
  48019. };
  48020. self._assert_equals_($13,"alternative block");
  48021. $ctx1.sendIdx["assert:equals:"]=7;
  48022. $16=true._yourself();
  48023. if($core.assert($16)){
  48024. $15="alternative block2";
  48025. } else {
  48026. $15="alternative block";
  48027. };
  48028. self._assert_equals_($15,"alternative block2");
  48029. return self;
  48030. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  48031. },
  48032. args: [],
  48033. 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'.",
  48034. referencedClasses: [],
  48035. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  48036. }),
  48037. $globals.BooleanTest);
  48038. $core.addMethod(
  48039. $core.method({
  48040. selector: "testLogic",
  48041. protocol: 'tests',
  48042. fn: function (){
  48043. var self=this;
  48044. return $core.withContext(function($ctx1) {
  48045. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  48046. $1=true.__and(true);
  48047. $ctx1.sendIdx["&"]=1;
  48048. self._assert_($1);
  48049. $ctx1.sendIdx["assert:"]=1;
  48050. $2=true.__and(false);
  48051. $ctx1.sendIdx["&"]=2;
  48052. self._deny_($2);
  48053. $ctx1.sendIdx["deny:"]=1;
  48054. $3=false.__and(true);
  48055. $ctx1.sendIdx["&"]=3;
  48056. self._deny_($3);
  48057. $ctx1.sendIdx["deny:"]=2;
  48058. $5=false.__and(false);
  48059. $ctx1.sendIdx["&"]=4;
  48060. $4=self._deny_($5);
  48061. $ctx1.sendIdx["deny:"]=3;
  48062. $6=true.__or(true);
  48063. $ctx1.sendIdx["|"]=1;
  48064. self._assert_($6);
  48065. $ctx1.sendIdx["assert:"]=2;
  48066. $7=true.__or(false);
  48067. $ctx1.sendIdx["|"]=2;
  48068. self._assert_($7);
  48069. $ctx1.sendIdx["assert:"]=3;
  48070. $8=false.__or(true);
  48071. $ctx1.sendIdx["|"]=3;
  48072. self._assert_($8);
  48073. $ctx1.sendIdx["assert:"]=4;
  48074. $10=false.__or(false);
  48075. $ctx1.sendIdx["|"]=4;
  48076. $9=self._deny_($10);
  48077. $ctx1.sendIdx["deny:"]=4;
  48078. $12=(1).__gt((0));
  48079. $ctx1.sendIdx[">"]=1;
  48080. $11=true.__and($12);
  48081. $ctx1.sendIdx["&"]=5;
  48082. self._assert_($11);
  48083. $ctx1.sendIdx["assert:"]=5;
  48084. $14=(1).__gt((0));
  48085. $ctx1.sendIdx[">"]=2;
  48086. $13=$recv($14).__and(false);
  48087. $ctx1.sendIdx["&"]=6;
  48088. self._deny_($13);
  48089. $ctx1.sendIdx["deny:"]=5;
  48090. $16=(1).__gt((0));
  48091. $ctx1.sendIdx[">"]=3;
  48092. $17=(1).__gt((2));
  48093. $ctx1.sendIdx[">"]=4;
  48094. $15=$recv($16).__and($17);
  48095. self._deny_($15);
  48096. $19=(1).__gt((0));
  48097. $ctx1.sendIdx[">"]=5;
  48098. $18=false.__or($19);
  48099. $ctx1.sendIdx["|"]=5;
  48100. self._assert_($18);
  48101. $ctx1.sendIdx["assert:"]=6;
  48102. $21=(1).__gt((0));
  48103. $ctx1.sendIdx[">"]=6;
  48104. $20=$recv($21).__or(false);
  48105. $ctx1.sendIdx["|"]=6;
  48106. self._assert_($20);
  48107. $ctx1.sendIdx["assert:"]=7;
  48108. $23=(1).__gt((0));
  48109. $ctx1.sendIdx[">"]=7;
  48110. $22=$recv($23).__or((1).__gt((2)));
  48111. self._assert_($22);
  48112. return self;
  48113. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  48114. },
  48115. args: [],
  48116. 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))",
  48117. referencedClasses: [],
  48118. messageSends: ["assert:", "&", "deny:", "|", ">"]
  48119. }),
  48120. $globals.BooleanTest);
  48121. $core.addMethod(
  48122. $core.method({
  48123. selector: "testLogicKeywords",
  48124. protocol: 'tests',
  48125. fn: function (){
  48126. var self=this;
  48127. return $core.withContext(function($ctx1) {
  48128. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  48129. $1=true._and_((function(){
  48130. return true;
  48131. }));
  48132. $ctx1.sendIdx["and:"]=1;
  48133. self._assert_($1);
  48134. $ctx1.sendIdx["assert:"]=1;
  48135. $2=true._and_((function(){
  48136. return false;
  48137. }));
  48138. $ctx1.sendIdx["and:"]=2;
  48139. self._deny_($2);
  48140. $ctx1.sendIdx["deny:"]=1;
  48141. $3=false._and_((function(){
  48142. return true;
  48143. }));
  48144. $ctx1.sendIdx["and:"]=3;
  48145. self._deny_($3);
  48146. $ctx1.sendIdx["deny:"]=2;
  48147. $5=false._and_((function(){
  48148. return false;
  48149. }));
  48150. $ctx1.sendIdx["and:"]=4;
  48151. $4=self._deny_($5);
  48152. $ctx1.sendIdx["deny:"]=3;
  48153. $6=true._or_((function(){
  48154. return true;
  48155. }));
  48156. $ctx1.sendIdx["or:"]=1;
  48157. self._assert_($6);
  48158. $ctx1.sendIdx["assert:"]=2;
  48159. $7=true._or_((function(){
  48160. return false;
  48161. }));
  48162. $ctx1.sendIdx["or:"]=2;
  48163. self._assert_($7);
  48164. $ctx1.sendIdx["assert:"]=3;
  48165. $8=false._or_((function(){
  48166. return true;
  48167. }));
  48168. $ctx1.sendIdx["or:"]=3;
  48169. self._assert_($8);
  48170. $ctx1.sendIdx["assert:"]=4;
  48171. $10=false._or_((function(){
  48172. return false;
  48173. }));
  48174. $ctx1.sendIdx["or:"]=4;
  48175. $9=self._deny_($10);
  48176. $ctx1.sendIdx["deny:"]=4;
  48177. $11=true._and_((function(){
  48178. return $core.withContext(function($ctx2) {
  48179. return (1).__gt((0));
  48180. $ctx2.sendIdx[">"]=1;
  48181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  48182. }));
  48183. $ctx1.sendIdx["and:"]=5;
  48184. self._assert_($11);
  48185. $ctx1.sendIdx["assert:"]=5;
  48186. $13=(1).__gt((0));
  48187. $ctx1.sendIdx[">"]=2;
  48188. $12=$recv($13)._and_((function(){
  48189. return false;
  48190. }));
  48191. $ctx1.sendIdx["and:"]=6;
  48192. self._deny_($12);
  48193. $ctx1.sendIdx["deny:"]=5;
  48194. $15=(1).__gt((0));
  48195. $ctx1.sendIdx[">"]=3;
  48196. $14=$recv($15)._and_((function(){
  48197. return $core.withContext(function($ctx2) {
  48198. return (1).__gt((2));
  48199. $ctx2.sendIdx[">"]=4;
  48200. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  48201. }));
  48202. self._deny_($14);
  48203. $16=false._or_((function(){
  48204. return $core.withContext(function($ctx2) {
  48205. return (1).__gt((0));
  48206. $ctx2.sendIdx[">"]=5;
  48207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  48208. }));
  48209. $ctx1.sendIdx["or:"]=5;
  48210. self._assert_($16);
  48211. $ctx1.sendIdx["assert:"]=6;
  48212. $18=(1).__gt((0));
  48213. $ctx1.sendIdx[">"]=6;
  48214. $17=$recv($18)._or_((function(){
  48215. return false;
  48216. }));
  48217. $ctx1.sendIdx["or:"]=6;
  48218. self._assert_($17);
  48219. $ctx1.sendIdx["assert:"]=7;
  48220. $20=(1).__gt((0));
  48221. $ctx1.sendIdx[">"]=7;
  48222. $19=$recv($20)._or_((function(){
  48223. return $core.withContext(function($ctx2) {
  48224. return (1).__gt((2));
  48225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  48226. }));
  48227. self._assert_($19);
  48228. return self;
  48229. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  48230. },
  48231. args: [],
  48232. 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 ])",
  48233. referencedClasses: [],
  48234. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  48235. }),
  48236. $globals.BooleanTest);
  48237. $core.addMethod(
  48238. $core.method({
  48239. selector: "testNonBooleanError",
  48240. protocol: 'tests',
  48241. fn: function (){
  48242. var self=this;
  48243. return $core.withContext(function($ctx1) {
  48244. self._should_raise_((function(){
  48245. return $core.withContext(function($ctx2) {
  48246. if($core.assert("")){
  48247. } else {
  48248. };
  48249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48250. }),$globals.NonBooleanReceiver);
  48251. return self;
  48252. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  48253. },
  48254. args: [],
  48255. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  48256. referencedClasses: ["NonBooleanReceiver"],
  48257. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  48258. }),
  48259. $globals.BooleanTest);
  48260. $core.addClass('ClassBuilderTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  48261. $core.addMethod(
  48262. $core.method({
  48263. selector: "setUp",
  48264. protocol: 'running',
  48265. fn: function (){
  48266. var self=this;
  48267. return $core.withContext(function($ctx1) {
  48268. self["@builder"]=$recv($globals.ClassBuilder)._new();
  48269. return self;
  48270. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  48271. },
  48272. args: [],
  48273. source: "setUp\x0a\x09builder := ClassBuilder new",
  48274. referencedClasses: ["ClassBuilder"],
  48275. messageSends: ["new"]
  48276. }),
  48277. $globals.ClassBuilderTest);
  48278. $core.addMethod(
  48279. $core.method({
  48280. selector: "tearDown",
  48281. protocol: 'running',
  48282. fn: function (){
  48283. var self=this;
  48284. return $core.withContext(function($ctx1) {
  48285. var $1,$receiver;
  48286. $1=self["@theClass"];
  48287. if(($receiver = $1) == null || $receiver.isNil){
  48288. $1;
  48289. } else {
  48290. $recv($globals.Smalltalk)._removeClass_(self["@theClass"]);
  48291. self["@theClass"]=nil;
  48292. self["@theClass"];
  48293. };
  48294. return self;
  48295. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  48296. },
  48297. args: [],
  48298. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  48299. referencedClasses: ["Smalltalk"],
  48300. messageSends: ["ifNotNil:", "removeClass:"]
  48301. }),
  48302. $globals.ClassBuilderTest);
  48303. $core.addMethod(
  48304. $core.method({
  48305. selector: "testClassCopy",
  48306. protocol: 'tests',
  48307. fn: function (){
  48308. var self=this;
  48309. return $core.withContext(function($ctx1) {
  48310. var $2,$1,$4,$3,$6,$5,$8,$7;
  48311. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48312. $2=$recv(self["@theClass"])._superclass();
  48313. $ctx1.sendIdx["superclass"]=1;
  48314. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48315. $ctx1.sendIdx["=="]=1;
  48316. self._assert_($1);
  48317. $ctx1.sendIdx["assert:"]=1;
  48318. $4=$recv(self["@theClass"])._instanceVariableNames();
  48319. $ctx1.sendIdx["instanceVariableNames"]=1;
  48320. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48321. $ctx1.sendIdx["=="]=2;
  48322. self._assert_($3);
  48323. $ctx1.sendIdx["assert:"]=2;
  48324. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48325. $ctx1.sendIdx["assert:equals:"]=1;
  48326. $6=$recv(self["@theClass"])._package();
  48327. $ctx1.sendIdx["package"]=1;
  48328. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48329. self._assert_($5);
  48330. $8=$recv(self["@theClass"])._methodDictionary();
  48331. $ctx1.sendIdx["methodDictionary"]=1;
  48332. $7=$recv($8)._keys();
  48333. $ctx1.sendIdx["keys"]=1;
  48334. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48335. return self;
  48336. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  48337. },
  48338. args: [],
  48339. 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",
  48340. referencedClasses: ["ObjectMock"],
  48341. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  48342. }),
  48343. $globals.ClassBuilderTest);
  48344. $core.addMethod(
  48345. $core.method({
  48346. selector: "testClassMigration",
  48347. protocol: 'tests',
  48348. fn: function (){
  48349. var self=this;
  48350. var instance,oldClass;
  48351. return $core.withContext(function($ctx1) {
  48352. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  48353. oldClass=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48354. $2=$recv($globals.Smalltalk)._globals();
  48355. $ctx1.sendIdx["globals"]=1;
  48356. $1=$recv($2)._at_("ObjectMock2");
  48357. $ctx1.sendIdx["at:"]=1;
  48358. instance=$recv($1)._new();
  48359. $4=$recv($globals.Smalltalk)._globals();
  48360. $ctx1.sendIdx["globals"]=2;
  48361. $3=$recv($4)._at_("ObjectMock2");
  48362. $ctx1.sendIdx["at:"]=2;
  48363. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  48364. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  48365. $ctx1.sendIdx["=="]=1;
  48366. self._deny_($5);
  48367. $ctx1.sendIdx["deny:"]=1;
  48368. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  48369. $ctx1.sendIdx["=="]=2;
  48370. self._assert_($6);
  48371. $ctx1.sendIdx["assert:"]=1;
  48372. self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  48373. $ctx1.sendIdx["assert:"]=2;
  48374. $7=$recv($globals.ObjectMock2)._selectors();
  48375. $ctx1.sendIdx["selectors"]=1;
  48376. self._assert_equals_($7,$recv(oldClass)._selectors());
  48377. $ctx1.sendIdx["assert:equals:"]=1;
  48378. $8=$recv($globals.ObjectMock2)._comment();
  48379. $ctx1.sendIdx["comment"]=1;
  48380. self._assert_equals_($8,$recv(oldClass)._comment());
  48381. $ctx1.sendIdx["assert:equals:"]=2;
  48382. $9=$recv($recv($globals.ObjectMock2)._package())._name();
  48383. $ctx1.sendIdx["name"]=1;
  48384. self._assert_equals_($9,"Kernel-Tests");
  48385. $11=$recv(instance)._class();
  48386. $ctx1.sendIdx["class"]=1;
  48387. $10=$recv($11).__eq_eq($globals.ObjectMock2);
  48388. self._deny_($10);
  48389. self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  48390. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  48391. return self;
  48392. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  48393. },
  48394. args: [],
  48395. 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",
  48396. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  48397. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  48398. }),
  48399. $globals.ClassBuilderTest);
  48400. $core.addMethod(
  48401. $core.method({
  48402. selector: "testClassMigrationWithClassInstanceVariables",
  48403. protocol: 'tests',
  48404. fn: function (){
  48405. var self=this;
  48406. return $core.withContext(function($ctx1) {
  48407. var $1;
  48408. $recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48409. $1=$recv($globals.ObjectMock2)._class();
  48410. $ctx1.sendIdx["class"]=1;
  48411. $recv($1)._instanceVariableNames_("foo bar");
  48412. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  48413. self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  48414. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  48415. return self;
  48416. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  48417. },
  48418. args: [],
  48419. 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",
  48420. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  48421. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  48422. }),
  48423. $globals.ClassBuilderTest);
  48424. $core.addMethod(
  48425. $core.method({
  48426. selector: "testClassMigrationWithSubclasses",
  48427. protocol: 'tests',
  48428. fn: function (){
  48429. var self=this;
  48430. return $core.withContext(function($ctx1) {
  48431. var $2,$1,$4,$3;
  48432. $recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48433. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  48434. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  48435. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  48436. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  48437. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  48438. $2=$recv($globals.ObjectMock)._subclasses();
  48439. $ctx1.sendIdx["subclasses"]=1;
  48440. $1=$recv($2)._includes_($globals.ObjectMock2);
  48441. $ctx1.sendIdx["includes:"]=1;
  48442. self._assert_($1);
  48443. $ctx1.sendIdx["assert:"]=1;
  48444. $4=$recv($globals.ObjectMock2)._subclasses();
  48445. $ctx1.sendIdx["subclasses"]=2;
  48446. $3=$recv($4)._includes_($globals.ObjectMock3);
  48447. $ctx1.sendIdx["includes:"]=2;
  48448. self._assert_($3);
  48449. $ctx1.sendIdx["assert:"]=2;
  48450. self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  48451. $recv($recv($globals.ObjectMock)._allSubclasses())._do_((function(each){
  48452. return $core.withContext(function($ctx2) {
  48453. return $recv($globals.Smalltalk)._removeClass_(each);
  48454. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48455. }));
  48456. return self;
  48457. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  48458. },
  48459. args: [],
  48460. 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 ]",
  48461. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  48462. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"]
  48463. }),
  48464. $globals.ClassBuilderTest);
  48465. $core.addMethod(
  48466. $core.method({
  48467. selector: "testInstanceVariableNames",
  48468. protocol: 'tests',
  48469. fn: function (){
  48470. var self=this;
  48471. return $core.withContext(function($ctx1) {
  48472. self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  48473. return self;
  48474. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  48475. },
  48476. args: [],
  48477. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  48478. referencedClasses: [],
  48479. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  48480. }),
  48481. $globals.ClassBuilderTest);
  48482. $core.addClass('ClassTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  48483. $core.addMethod(
  48484. $core.method({
  48485. selector: "jsConstructor",
  48486. protocol: 'running',
  48487. fn: function (){
  48488. var self=this;
  48489. return $core.withContext(function($ctx1) {
  48490. function Foo(){}
  48491. Foo.prototype.valueOf = function () {return 4;};
  48492. return Foo;
  48493. ;
  48494. return self;
  48495. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  48496. },
  48497. args: [],
  48498. source: "jsConstructor\x0a\x09<\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09>",
  48499. referencedClasses: [],
  48500. messageSends: []
  48501. }),
  48502. $globals.ClassTest);
  48503. $core.addMethod(
  48504. $core.method({
  48505. selector: "setUp",
  48506. protocol: 'running',
  48507. fn: function (){
  48508. var self=this;
  48509. return $core.withContext(function($ctx1) {
  48510. self["@builder"]=$recv($globals.ClassBuilder)._new();
  48511. return self;
  48512. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  48513. },
  48514. args: [],
  48515. source: "setUp\x0a\x09builder := ClassBuilder new",
  48516. referencedClasses: ["ClassBuilder"],
  48517. messageSends: ["new"]
  48518. }),
  48519. $globals.ClassTest);
  48520. $core.addMethod(
  48521. $core.method({
  48522. selector: "tearDown",
  48523. protocol: 'running',
  48524. fn: function (){
  48525. var self=this;
  48526. return $core.withContext(function($ctx1) {
  48527. var $1,$receiver;
  48528. $1=self["@theClass"];
  48529. if(($receiver = $1) == null || $receiver.isNil){
  48530. $1;
  48531. } else {
  48532. $recv($globals.Smalltalk)._removeClass_(self["@theClass"]);
  48533. self["@theClass"]=nil;
  48534. self["@theClass"];
  48535. };
  48536. return self;
  48537. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  48538. },
  48539. args: [],
  48540. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  48541. referencedClasses: ["Smalltalk"],
  48542. messageSends: ["ifNotNil:", "removeClass:"]
  48543. }),
  48544. $globals.ClassTest);
  48545. $core.addMethod(
  48546. $core.method({
  48547. selector: "testAllSubclasses",
  48548. protocol: 'tests',
  48549. fn: function (){
  48550. var self=this;
  48551. var subclasses,index;
  48552. return $core.withContext(function($ctx1) {
  48553. subclasses=$recv($globals.Object)._subclasses();
  48554. $ctx1.sendIdx["subclasses"]=1;
  48555. index=(1);
  48556. $recv((function(){
  48557. return $core.withContext(function($ctx2) {
  48558. return $recv(index).__gt($recv(subclasses)._size());
  48559. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48560. }))._whileFalse_((function(){
  48561. return $core.withContext(function($ctx2) {
  48562. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  48563. index=$recv(index).__plus((1));
  48564. return index;
  48565. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48566. }));
  48567. self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  48568. return self;
  48569. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  48570. },
  48571. args: [],
  48572. 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",
  48573. referencedClasses: ["Object"],
  48574. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  48575. }),
  48576. $globals.ClassTest);
  48577. $core.addMethod(
  48578. $core.method({
  48579. selector: "testMetaclassSubclasses",
  48580. protocol: 'tests',
  48581. fn: function (){
  48582. var self=this;
  48583. var subclasses;
  48584. return $core.withContext(function($ctx1) {
  48585. var $4,$3,$2,$1;
  48586. $4=$recv($globals.Object)._class();
  48587. $ctx1.sendIdx["class"]=1;
  48588. $3=$recv($4)._instanceClass();
  48589. $2=$recv($3)._subclasses();
  48590. $ctx1.sendIdx["subclasses"]=1;
  48591. $1=$recv($2)._select_((function(each){
  48592. return $core.withContext(function($ctx2) {
  48593. return $recv($recv(each)._isMetaclass())._not();
  48594. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48595. }));
  48596. subclasses=$recv($1)._collect_((function(each){
  48597. return $core.withContext(function($ctx2) {
  48598. return $recv(each)._theMetaClass();
  48599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48600. }));
  48601. self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  48602. return self;
  48603. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  48604. },
  48605. args: [],
  48606. 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",
  48607. referencedClasses: ["Object"],
  48608. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  48609. }),
  48610. $globals.ClassTest);
  48611. $core.addMethod(
  48612. $core.method({
  48613. selector: "testSetJavaScriptConstructor",
  48614. protocol: 'tests',
  48615. fn: function (){
  48616. var self=this;
  48617. var instance;
  48618. return $core.withContext(function($ctx1) {
  48619. var $2,$1,$4,$3,$6,$5,$8,$7;
  48620. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48621. $recv(self["@theClass"])._javascriptConstructor_(self._jsConstructor());
  48622. $2=$recv(self["@theClass"])._superclass();
  48623. $ctx1.sendIdx["superclass"]=1;
  48624. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48625. $ctx1.sendIdx["=="]=1;
  48626. self._assert_($1);
  48627. $ctx1.sendIdx["assert:"]=1;
  48628. $4=$recv(self["@theClass"])._instanceVariableNames();
  48629. $ctx1.sendIdx["instanceVariableNames"]=1;
  48630. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48631. $ctx1.sendIdx["=="]=2;
  48632. self._assert_($3);
  48633. $ctx1.sendIdx["assert:"]=2;
  48634. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48635. $ctx1.sendIdx["assert:equals:"]=1;
  48636. $6=$recv(self["@theClass"])._package();
  48637. $ctx1.sendIdx["package"]=1;
  48638. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48639. $ctx1.sendIdx["=="]=3;
  48640. self._assert_($5);
  48641. $ctx1.sendIdx["assert:"]=3;
  48642. $8=$recv(self["@theClass"])._methodDictionary();
  48643. $ctx1.sendIdx["methodDictionary"]=1;
  48644. $7=$recv($8)._keys();
  48645. $ctx1.sendIdx["keys"]=1;
  48646. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48647. $ctx1.sendIdx["assert:equals:"]=2;
  48648. instance=$recv(self["@theClass"])._new();
  48649. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  48650. self._assert_equals_($recv(instance)._value(),(4));
  48651. $ctx1.sendIdx["assert:equals:"]=3;
  48652. self._shouldnt_raise_((function(){
  48653. return $core.withContext(function($ctx2) {
  48654. return $recv(instance)._foo_((9));
  48655. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48656. }),$globals.Error);
  48657. self._assert_equals_($recv(instance)._foo(),(9));
  48658. return self;
  48659. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  48660. },
  48661. args: [],
  48662. 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",
  48663. referencedClasses: ["ObjectMock", "Error"],
  48664. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  48665. }),
  48666. $globals.ClassTest);
  48667. $core.addMethod(
  48668. $core.method({
  48669. selector: "testTrickySetJavaScriptConstructor",
  48670. protocol: 'tests',
  48671. fn: function (){
  48672. var self=this;
  48673. var instance;
  48674. return $core.withContext(function($ctx1) {
  48675. var $2,$1,$4,$3,$6,$5,$8,$7;
  48676. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48677. $recv(self["@theClass"])._javascriptConstructor_(self._trickyJsConstructor());
  48678. $2=$recv(self["@theClass"])._superclass();
  48679. $ctx1.sendIdx["superclass"]=1;
  48680. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48681. $ctx1.sendIdx["=="]=1;
  48682. self._assert_($1);
  48683. $ctx1.sendIdx["assert:"]=1;
  48684. $4=$recv(self["@theClass"])._instanceVariableNames();
  48685. $ctx1.sendIdx["instanceVariableNames"]=1;
  48686. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48687. $ctx1.sendIdx["=="]=2;
  48688. self._assert_($3);
  48689. $ctx1.sendIdx["assert:"]=2;
  48690. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48691. $ctx1.sendIdx["assert:equals:"]=1;
  48692. $6=$recv(self["@theClass"])._package();
  48693. $ctx1.sendIdx["package"]=1;
  48694. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48695. $ctx1.sendIdx["=="]=3;
  48696. self._assert_($5);
  48697. $ctx1.sendIdx["assert:"]=3;
  48698. $8=$recv(self["@theClass"])._methodDictionary();
  48699. $ctx1.sendIdx["methodDictionary"]=1;
  48700. $7=$recv($8)._keys();
  48701. $ctx1.sendIdx["keys"]=1;
  48702. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48703. $ctx1.sendIdx["assert:equals:"]=2;
  48704. instance=$recv(self["@theClass"])._new();
  48705. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  48706. self._assert_equals_($recv(instance)._value(),(4));
  48707. $ctx1.sendIdx["assert:equals:"]=3;
  48708. self._shouldnt_raise_((function(){
  48709. return $core.withContext(function($ctx2) {
  48710. return $recv(instance)._foo_((9));
  48711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48712. }),$globals.Error);
  48713. self._assert_equals_($recv(instance)._foo(),(9));
  48714. return self;
  48715. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  48716. },
  48717. args: [],
  48718. 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",
  48719. referencedClasses: ["ObjectMock", "Error"],
  48720. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  48721. }),
  48722. $globals.ClassTest);
  48723. $core.addMethod(
  48724. $core.method({
  48725. selector: "trickyJsConstructor",
  48726. protocol: 'running',
  48727. fn: function (){
  48728. var self=this;
  48729. return $core.withContext(function($ctx1) {
  48730. function Foo(){}
  48731. Foo.prototype.valueOf = function () {return 4;};
  48732. Foo.prototype._foo = function () {return "bar";};
  48733. return Foo;
  48734. ;
  48735. return self;
  48736. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  48737. },
  48738. args: [],
  48739. source: "trickyJsConstructor\x0a\x09<\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>",
  48740. referencedClasses: [],
  48741. messageSends: []
  48742. }),
  48743. $globals.ClassTest);
  48744. $core.addClass('CollectionTest', $globals.TestCase, ['sampleBlock'], 'Kernel-Tests');
  48745. $core.addMethod(
  48746. $core.method({
  48747. selector: "assertSameContents:as:",
  48748. protocol: 'convenience',
  48749. fn: function (aCollection,anotherCollection){
  48750. var self=this;
  48751. return $core.withContext(function($ctx1) {
  48752. var $2,$1,$4,$3;
  48753. $2=$recv(aCollection)._size();
  48754. $ctx1.sendIdx["size"]=1;
  48755. $1=$recv($2).__eq($recv(anotherCollection)._size());
  48756. $ctx1.sendIdx["="]=1;
  48757. self._assert_($1);
  48758. $ctx1.sendIdx["assert:"]=1;
  48759. $recv(aCollection)._do_((function(each){
  48760. return $core.withContext(function($ctx2) {
  48761. $4=$recv(aCollection)._occurrencesOf_(each);
  48762. $ctx2.sendIdx["occurrencesOf:"]=1;
  48763. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  48764. return self._assert_($3);
  48765. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48766. }));
  48767. return self;
  48768. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  48769. },
  48770. args: ["aCollection", "anotherCollection"],
  48771. 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)) ]",
  48772. referencedClasses: [],
  48773. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  48774. }),
  48775. $globals.CollectionTest);
  48776. $core.addMethod(
  48777. $core.method({
  48778. selector: "collection",
  48779. protocol: 'fixture',
  48780. fn: function (){
  48781. var self=this;
  48782. return $core.withContext(function($ctx1) {
  48783. self._subclassResponsibility();
  48784. return self;
  48785. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  48786. },
  48787. args: [],
  48788. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  48789. referencedClasses: [],
  48790. messageSends: ["subclassResponsibility"]
  48791. }),
  48792. $globals.CollectionTest);
  48793. $core.addMethod(
  48794. $core.method({
  48795. selector: "collectionClass",
  48796. protocol: 'fixture',
  48797. fn: function (){
  48798. var self=this;
  48799. return $core.withContext(function($ctx1) {
  48800. return $recv(self._class())._collectionClass();
  48801. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  48802. },
  48803. args: [],
  48804. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  48805. referencedClasses: [],
  48806. messageSends: ["collectionClass", "class"]
  48807. }),
  48808. $globals.CollectionTest);
  48809. $core.addMethod(
  48810. $core.method({
  48811. selector: "collectionOfPrintStrings",
  48812. protocol: 'fixture',
  48813. fn: function (){
  48814. var self=this;
  48815. return $core.withContext(function($ctx1) {
  48816. self._subclassResponsibility();
  48817. return self;
  48818. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  48819. },
  48820. args: [],
  48821. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  48822. referencedClasses: [],
  48823. messageSends: ["subclassResponsibility"]
  48824. }),
  48825. $globals.CollectionTest);
  48826. $core.addMethod(
  48827. $core.method({
  48828. selector: "collectionSize",
  48829. protocol: 'fixture',
  48830. fn: function (){
  48831. var self=this;
  48832. return $core.withContext(function($ctx1) {
  48833. self._subclassResponsibility();
  48834. return self;
  48835. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  48836. },
  48837. args: [],
  48838. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  48839. referencedClasses: [],
  48840. messageSends: ["subclassResponsibility"]
  48841. }),
  48842. $globals.CollectionTest);
  48843. $core.addMethod(
  48844. $core.method({
  48845. selector: "collectionWithDuplicates",
  48846. protocol: 'fixture',
  48847. fn: function (){
  48848. var self=this;
  48849. return $core.withContext(function($ctx1) {
  48850. self._subclassResponsibility();
  48851. return self;
  48852. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  48853. },
  48854. args: [],
  48855. 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",
  48856. referencedClasses: [],
  48857. messageSends: ["subclassResponsibility"]
  48858. }),
  48859. $globals.CollectionTest);
  48860. $core.addMethod(
  48861. $core.method({
  48862. selector: "collectionWithNewValue",
  48863. protocol: 'fixture',
  48864. fn: function (){
  48865. var self=this;
  48866. return $core.withContext(function($ctx1) {
  48867. self._subclassResponsibility();
  48868. return self;
  48869. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  48870. },
  48871. args: [],
  48872. 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",
  48873. referencedClasses: [],
  48874. messageSends: ["subclassResponsibility"]
  48875. }),
  48876. $globals.CollectionTest);
  48877. $core.addMethod(
  48878. $core.method({
  48879. selector: "initialize",
  48880. protocol: 'initialization',
  48881. fn: function (){
  48882. var self=this;
  48883. return $core.withContext(function($ctx1) {
  48884. (
  48885. $ctx1.supercall = true,
  48886. ($globals.CollectionTest.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  48887. $ctx1.supercall = false;
  48888. self["@sampleBlock"]=(function(){
  48889. });
  48890. return self;
  48891. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  48892. },
  48893. args: [],
  48894. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  48895. referencedClasses: [],
  48896. messageSends: ["initialize"]
  48897. }),
  48898. $globals.CollectionTest);
  48899. $core.addMethod(
  48900. $core.method({
  48901. selector: "isCollectionReadOnly",
  48902. protocol: 'testing',
  48903. fn: function (){
  48904. var self=this;
  48905. return false;
  48906. },
  48907. args: [],
  48908. source: "isCollectionReadOnly\x0a\x09^ false",
  48909. referencedClasses: [],
  48910. messageSends: []
  48911. }),
  48912. $globals.CollectionTest);
  48913. $core.addMethod(
  48914. $core.method({
  48915. selector: "sampleNewValue",
  48916. protocol: 'fixture',
  48917. fn: function (){
  48918. var self=this;
  48919. return "N";
  48920. },
  48921. args: [],
  48922. 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'",
  48923. referencedClasses: [],
  48924. messageSends: []
  48925. }),
  48926. $globals.CollectionTest);
  48927. $core.addMethod(
  48928. $core.method({
  48929. selector: "sampleNewValueAsCollection",
  48930. protocol: 'fixture',
  48931. fn: function (){
  48932. var self=this;
  48933. return $core.withContext(function($ctx1) {
  48934. return $recv(self._collectionClass())._with_(self._sampleNewValue());
  48935. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  48936. },
  48937. args: [],
  48938. 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",
  48939. referencedClasses: [],
  48940. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  48941. }),
  48942. $globals.CollectionTest);
  48943. $core.addMethod(
  48944. $core.method({
  48945. selector: "testAddAll",
  48946. protocol: 'tests',
  48947. fn: function (){
  48948. var self=this;
  48949. return $core.withContext(function($ctx1) {
  48950. 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;
  48951. $2=self._collection();
  48952. $ctx1.sendIdx["collection"]=1;
  48953. $4=self._collectionClass();
  48954. $ctx1.sendIdx["collectionClass"]=1;
  48955. $3=$recv($4)._new();
  48956. $ctx1.sendIdx["new"]=1;
  48957. $recv($2)._addAll_($3);
  48958. $ctx1.sendIdx["addAll:"]=1;
  48959. $5=$recv($2)._yourself();
  48960. $ctx1.sendIdx["yourself"]=1;
  48961. $1=$5;
  48962. $6=self._collection();
  48963. $ctx1.sendIdx["collection"]=2;
  48964. self._assert_equals_($1,$6);
  48965. $ctx1.sendIdx["assert:equals:"]=1;
  48966. $9=self._collectionClass();
  48967. $ctx1.sendIdx["collectionClass"]=2;
  48968. $8=$recv($9)._new();
  48969. $ctx1.sendIdx["new"]=2;
  48970. $10=self._collection();
  48971. $ctx1.sendIdx["collection"]=3;
  48972. $recv($8)._addAll_($10);
  48973. $ctx1.sendIdx["addAll:"]=2;
  48974. $11=$recv($8)._yourself();
  48975. $ctx1.sendIdx["yourself"]=2;
  48976. $7=$11;
  48977. $12=self._collection();
  48978. $ctx1.sendIdx["collection"]=4;
  48979. self._assert_equals_($7,$12);
  48980. $ctx1.sendIdx["assert:equals:"]=2;
  48981. $15=self._collectionClass();
  48982. $ctx1.sendIdx["collectionClass"]=3;
  48983. $14=$recv($15)._new();
  48984. $ctx1.sendIdx["new"]=3;
  48985. $17=self._collectionClass();
  48986. $ctx1.sendIdx["collectionClass"]=4;
  48987. $16=$recv($17)._new();
  48988. $ctx1.sendIdx["new"]=4;
  48989. $recv($14)._addAll_($16);
  48990. $ctx1.sendIdx["addAll:"]=3;
  48991. $18=$recv($14)._yourself();
  48992. $ctx1.sendIdx["yourself"]=3;
  48993. $13=$18;
  48994. self._assert_equals_($13,$recv(self._collectionClass())._new());
  48995. $ctx1.sendIdx["assert:equals:"]=3;
  48996. $20=self._collection();
  48997. $ctx1.sendIdx["collection"]=5;
  48998. $21=self._sampleNewValueAsCollection();
  48999. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  49000. $recv($20)._addAll_($21);
  49001. $ctx1.sendIdx["addAll:"]=4;
  49002. $22=$recv($20)._yourself();
  49003. $ctx1.sendIdx["yourself"]=4;
  49004. $19=$22;
  49005. $23=self._collectionWithNewValue();
  49006. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49007. self._assert_equals_($19,$23);
  49008. $25=self._sampleNewValueAsCollection();
  49009. $recv($25)._addAll_(self._collection());
  49010. $24=$recv($25)._yourself();
  49011. self._assertSameContents_as_($24,self._collectionWithNewValue());
  49012. return self;
  49013. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  49014. },
  49015. args: [],
  49016. 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",
  49017. referencedClasses: [],
  49018. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  49019. }),
  49020. $globals.CollectionTest);
  49021. $core.addMethod(
  49022. $core.method({
  49023. selector: "testAllSatisfy",
  49024. protocol: 'tests',
  49025. fn: function (){
  49026. var self=this;
  49027. var collection,anyOne;
  49028. return $core.withContext(function($ctx1) {
  49029. var $1;
  49030. collection=self._collection();
  49031. anyOne=$recv(collection)._anyOne();
  49032. $1=$recv(collection)._allSatisfy_((function(each){
  49033. return $core.withContext(function($ctx2) {
  49034. return $recv(collection)._includes_(each);
  49035. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49036. }));
  49037. $ctx1.sendIdx["allSatisfy:"]=1;
  49038. self._assert_($1);
  49039. self._deny_($recv(collection)._allSatisfy_((function(each){
  49040. return $core.withContext(function($ctx2) {
  49041. return $recv(each).__tild_eq(anyOne);
  49042. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49043. })));
  49044. return self;
  49045. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  49046. },
  49047. args: [],
  49048. 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 ])",
  49049. referencedClasses: [],
  49050. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  49051. }),
  49052. $globals.CollectionTest);
  49053. $core.addMethod(
  49054. $core.method({
  49055. selector: "testAnyOne",
  49056. protocol: 'tests',
  49057. fn: function (){
  49058. var self=this;
  49059. return $core.withContext(function($ctx1) {
  49060. var $2,$1;
  49061. self._should_raise_((function(){
  49062. return $core.withContext(function($ctx2) {
  49063. return $recv($recv(self._collectionClass())._new())._anyOne();
  49064. $ctx2.sendIdx["anyOne"]=1;
  49065. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49066. }),$globals.Error);
  49067. $2=self._collection();
  49068. $ctx1.sendIdx["collection"]=1;
  49069. $1=$recv($2)._includes_($recv(self._collection())._anyOne());
  49070. self._assert_($1);
  49071. return self;
  49072. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  49073. },
  49074. args: [],
  49075. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  49076. referencedClasses: ["Error"],
  49077. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  49078. }),
  49079. $globals.CollectionTest);
  49080. $core.addMethod(
  49081. $core.method({
  49082. selector: "testAnySatisfy",
  49083. protocol: 'tests',
  49084. fn: function (){
  49085. var self=this;
  49086. var anyOne;
  49087. return $core.withContext(function($ctx1) {
  49088. var $1,$3,$2;
  49089. $1=self._collection();
  49090. $ctx1.sendIdx["collection"]=1;
  49091. anyOne=$recv($1)._anyOne();
  49092. $3=self._collection();
  49093. $ctx1.sendIdx["collection"]=2;
  49094. $2=$recv($3)._anySatisfy_((function(each){
  49095. return $core.withContext(function($ctx2) {
  49096. return $recv(each).__eq(anyOne);
  49097. $ctx2.sendIdx["="]=1;
  49098. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49099. }));
  49100. $ctx1.sendIdx["anySatisfy:"]=1;
  49101. self._assert_($2);
  49102. self._deny_($recv(self._collection())._anySatisfy_((function(each){
  49103. return $core.withContext(function($ctx2) {
  49104. return $recv(each).__eq($recv($globals.Object)._new());
  49105. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49106. })));
  49107. return self;
  49108. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  49109. },
  49110. args: [],
  49111. 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 ])",
  49112. referencedClasses: ["Object"],
  49113. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  49114. }),
  49115. $globals.CollectionTest);
  49116. $core.addMethod(
  49117. $core.method({
  49118. selector: "testAsArray",
  49119. protocol: 'tests',
  49120. fn: function (){
  49121. var self=this;
  49122. return $core.withContext(function($ctx1) {
  49123. var $1;
  49124. $1=self._collection();
  49125. $ctx1.sendIdx["collection"]=1;
  49126. self._assertSameContents_as_($1,$recv(self._collection())._asArray());
  49127. return self;
  49128. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  49129. },
  49130. args: [],
  49131. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  49132. referencedClasses: [],
  49133. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  49134. }),
  49135. $globals.CollectionTest);
  49136. $core.addMethod(
  49137. $core.method({
  49138. selector: "testAsOrderedCollection",
  49139. protocol: 'tests',
  49140. fn: function (){
  49141. var self=this;
  49142. return $core.withContext(function($ctx1) {
  49143. var $1;
  49144. $1=self._collection();
  49145. $ctx1.sendIdx["collection"]=1;
  49146. self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection());
  49147. return self;
  49148. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  49149. },
  49150. args: [],
  49151. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  49152. referencedClasses: [],
  49153. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  49154. }),
  49155. $globals.CollectionTest);
  49156. $core.addMethod(
  49157. $core.method({
  49158. selector: "testAsSet",
  49159. protocol: 'tests',
  49160. fn: function (){
  49161. var self=this;
  49162. var c,set;
  49163. return $core.withContext(function($ctx1) {
  49164. c=self._collectionWithDuplicates();
  49165. set=$recv(c)._asSet();
  49166. self._assert_equals_($recv(set)._size(),(6));
  49167. $recv(c)._do_((function(each){
  49168. return $core.withContext(function($ctx2) {
  49169. return self._assert_($recv(set)._includes_(each));
  49170. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49171. }));
  49172. return self;
  49173. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  49174. },
  49175. args: [],
  49176. 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) ]",
  49177. referencedClasses: [],
  49178. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  49179. }),
  49180. $globals.CollectionTest);
  49181. $core.addMethod(
  49182. $core.method({
  49183. selector: "testCollect",
  49184. protocol: 'tests',
  49185. fn: function (){
  49186. var self=this;
  49187. return $core.withContext(function($ctx1) {
  49188. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  49189. $2=self._collection();
  49190. $ctx1.sendIdx["collection"]=1;
  49191. $1=$recv($2)._collect_((function(each){
  49192. return each;
  49193. }));
  49194. $ctx1.sendIdx["collect:"]=1;
  49195. $3=self._collection();
  49196. $ctx1.sendIdx["collection"]=2;
  49197. self._assert_equals_($1,$3);
  49198. $ctx1.sendIdx["assert:equals:"]=1;
  49199. $5=self._collectionWithNewValue();
  49200. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49201. $4=$recv($5)._collect_((function(each){
  49202. return each;
  49203. }));
  49204. $ctx1.sendIdx["collect:"]=2;
  49205. self._assert_equals_($4,self._collectionWithNewValue());
  49206. $ctx1.sendIdx["assert:equals:"]=2;
  49207. $8=self._collectionClass();
  49208. $ctx1.sendIdx["collectionClass"]=1;
  49209. $7=$recv($8)._new();
  49210. $ctx1.sendIdx["new"]=1;
  49211. $6=$recv($7)._collect_((function(each){
  49212. return $core.withContext(function($ctx2) {
  49213. return $recv(each)._printString();
  49214. $ctx2.sendIdx["printString"]=1;
  49215. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  49216. }));
  49217. $ctx1.sendIdx["collect:"]=3;
  49218. self._assert_equals_($6,$recv(self._collectionClass())._new());
  49219. $ctx1.sendIdx["assert:equals:"]=3;
  49220. $11=self._collection();
  49221. $ctx1.sendIdx["collection"]=3;
  49222. $10=$recv($11)._collect_((function(){
  49223. return $core.withContext(function($ctx2) {
  49224. return self._sampleNewValue();
  49225. $ctx2.sendIdx["sampleNewValue"]=1;
  49226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  49227. }));
  49228. $ctx1.sendIdx["collect:"]=4;
  49229. $9=$recv($10)._detect_((function(){
  49230. return true;
  49231. }));
  49232. self._assert_equals_($9,self._sampleNewValue());
  49233. $ctx1.sendIdx["assert:equals:"]=4;
  49234. self._assert_equals_($recv(self._collection())._collect_((function(each){
  49235. return $core.withContext(function($ctx2) {
  49236. return $recv(each)._printString();
  49237. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49238. })),self._collectionOfPrintStrings());
  49239. return self;
  49240. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  49241. },
  49242. args: [],
  49243. 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",
  49244. referencedClasses: [],
  49245. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  49246. }),
  49247. $globals.CollectionTest);
  49248. $core.addMethod(
  49249. $core.method({
  49250. selector: "testComma",
  49251. protocol: 'tests',
  49252. fn: function (){
  49253. var self=this;
  49254. return $core.withContext(function($ctx1) {
  49255. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  49256. $2=self._collection();
  49257. $ctx1.sendIdx["collection"]=1;
  49258. $4=self._collectionClass();
  49259. $ctx1.sendIdx["collectionClass"]=1;
  49260. $3=$recv($4)._new();
  49261. $ctx1.sendIdx["new"]=1;
  49262. $1=$recv($2).__comma($3);
  49263. $ctx1.sendIdx[","]=1;
  49264. $5=self._collection();
  49265. $ctx1.sendIdx["collection"]=2;
  49266. self._assert_equals_($1,$5);
  49267. $ctx1.sendIdx["assert:equals:"]=1;
  49268. $8=self._collectionClass();
  49269. $ctx1.sendIdx["collectionClass"]=2;
  49270. $7=$recv($8)._new();
  49271. $ctx1.sendIdx["new"]=2;
  49272. $9=self._collection();
  49273. $ctx1.sendIdx["collection"]=3;
  49274. $6=$recv($7).__comma($9);
  49275. $ctx1.sendIdx[","]=2;
  49276. $10=self._collection();
  49277. $ctx1.sendIdx["collection"]=4;
  49278. self._assert_equals_($6,$10);
  49279. $ctx1.sendIdx["assert:equals:"]=2;
  49280. $13=self._collectionClass();
  49281. $ctx1.sendIdx["collectionClass"]=3;
  49282. $12=$recv($13)._new();
  49283. $ctx1.sendIdx["new"]=3;
  49284. $15=self._collectionClass();
  49285. $ctx1.sendIdx["collectionClass"]=4;
  49286. $14=$recv($15)._new();
  49287. $ctx1.sendIdx["new"]=4;
  49288. $11=$recv($12).__comma($14);
  49289. $ctx1.sendIdx[","]=3;
  49290. self._assert_equals_($11,$recv(self._collectionClass())._new());
  49291. $ctx1.sendIdx["assert:equals:"]=3;
  49292. $17=self._collection();
  49293. $ctx1.sendIdx["collection"]=5;
  49294. $18=self._sampleNewValueAsCollection();
  49295. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  49296. $16=$recv($17).__comma($18);
  49297. $ctx1.sendIdx[","]=4;
  49298. $19=self._collectionWithNewValue();
  49299. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49300. self._assert_equals_($16,$19);
  49301. self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  49302. return self;
  49303. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  49304. },
  49305. args: [],
  49306. 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",
  49307. referencedClasses: [],
  49308. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  49309. }),
  49310. $globals.CollectionTest);
  49311. $core.addMethod(
  49312. $core.method({
  49313. selector: "testCopy",
  49314. protocol: 'tests',
  49315. fn: function (){
  49316. var self=this;
  49317. return $core.withContext(function($ctx1) {
  49318. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  49319. $3=self._collectionClass();
  49320. $ctx1.sendIdx["collectionClass"]=1;
  49321. $2=$recv($3)._new();
  49322. $ctx1.sendIdx["new"]=1;
  49323. $1=$recv($2)._copy();
  49324. $ctx1.sendIdx["copy"]=1;
  49325. $5=self._collectionClass();
  49326. $ctx1.sendIdx["collectionClass"]=2;
  49327. $4=$recv($5)._new();
  49328. $ctx1.sendIdx["new"]=2;
  49329. self._assert_equals_($1,$4);
  49330. $ctx1.sendIdx["assert:equals:"]=1;
  49331. $7=self._collection();
  49332. $ctx1.sendIdx["collection"]=1;
  49333. $6=$recv($7)._copy();
  49334. $ctx1.sendIdx["copy"]=2;
  49335. $8=self._collection();
  49336. $ctx1.sendIdx["collection"]=2;
  49337. self._assert_equals_($6,$8);
  49338. $ctx1.sendIdx["assert:equals:"]=2;
  49339. $10=self._collectionWithNewValue();
  49340. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49341. $9=$recv($10)._copy();
  49342. $ctx1.sendIdx["copy"]=3;
  49343. $11=self._collectionWithNewValue();
  49344. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49345. self._assert_equals_($9,$11);
  49346. $15=self._collectionClass();
  49347. $ctx1.sendIdx["collectionClass"]=3;
  49348. $14=$recv($15)._new();
  49349. $ctx1.sendIdx["new"]=3;
  49350. $13=$recv($14)._copy();
  49351. $ctx1.sendIdx["copy"]=4;
  49352. $16=self._collection();
  49353. $ctx1.sendIdx["collection"]=3;
  49354. $12=$recv($13).__eq($16);
  49355. $ctx1.sendIdx["="]=1;
  49356. self._deny_($12);
  49357. $ctx1.sendIdx["deny:"]=1;
  49358. $19=self._collection();
  49359. $ctx1.sendIdx["collection"]=4;
  49360. $18=$recv($19)._copy();
  49361. $ctx1.sendIdx["copy"]=5;
  49362. $17=$recv($18).__eq($recv(self._collectionClass())._new());
  49363. $ctx1.sendIdx["="]=2;
  49364. self._deny_($17);
  49365. $ctx1.sendIdx["deny:"]=2;
  49366. self._deny_($recv($recv(self._collection())._copy()).__eq(self._collectionWithNewValue()));
  49367. return self;
  49368. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  49369. },
  49370. args: [],
  49371. 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",
  49372. referencedClasses: [],
  49373. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  49374. }),
  49375. $globals.CollectionTest);
  49376. $core.addMethod(
  49377. $core.method({
  49378. selector: "testCopySeparates",
  49379. protocol: 'tests',
  49380. fn: function (){
  49381. var self=this;
  49382. var original,copy;
  49383. return $core.withContext(function($ctx1) {
  49384. original=self._collection();
  49385. $ctx1.sendIdx["collection"]=1;
  49386. copy=$recv(original)._copy();
  49387. $recv(copy)._addAll_(self._sampleNewValueAsCollection());
  49388. self._assert_($recv(original).__eq(self._collection()));
  49389. return self;
  49390. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  49391. },
  49392. args: [],
  49393. 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",
  49394. referencedClasses: [],
  49395. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  49396. }),
  49397. $globals.CollectionTest);
  49398. $core.addMethod(
  49399. $core.method({
  49400. selector: "testDetect",
  49401. protocol: 'tests',
  49402. fn: function (){
  49403. var self=this;
  49404. return $core.withContext(function($ctx1) {
  49405. var $1,$2,$3,$4,$6,$5,$7;
  49406. self._shouldnt_raise_((function(){
  49407. return $core.withContext(function($ctx2) {
  49408. $1=self._collection();
  49409. $ctx2.sendIdx["collection"]=1;
  49410. return $recv($1)._detect_((function(){
  49411. return true;
  49412. }));
  49413. $ctx2.sendIdx["detect:"]=1;
  49414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49415. }),$globals.Error);
  49416. self._should_raise_((function(){
  49417. return $core.withContext(function($ctx2) {
  49418. $2=self._collection();
  49419. $ctx2.sendIdx["collection"]=2;
  49420. return $recv($2)._detect_((function(){
  49421. return false;
  49422. }));
  49423. $ctx2.sendIdx["detect:"]=2;
  49424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49425. }),$globals.Error);
  49426. $ctx1.sendIdx["should:raise:"]=1;
  49427. $3=$recv(self._sampleNewValueAsCollection())._detect_((function(){
  49428. return true;
  49429. }));
  49430. $ctx1.sendIdx["detect:"]=3;
  49431. $4=self._sampleNewValue();
  49432. $ctx1.sendIdx["sampleNewValue"]=1;
  49433. self._assert_equals_($3,$4);
  49434. $ctx1.sendIdx["assert:equals:"]=1;
  49435. $5=$recv(self._collectionWithNewValue())._detect_((function(each){
  49436. return $core.withContext(function($ctx2) {
  49437. $6=self._sampleNewValue();
  49438. $ctx2.sendIdx["sampleNewValue"]=2;
  49439. return $recv(each).__eq($6);
  49440. $ctx2.sendIdx["="]=1;
  49441. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49442. }));
  49443. $ctx1.sendIdx["detect:"]=4;
  49444. $7=self._sampleNewValue();
  49445. $ctx1.sendIdx["sampleNewValue"]=3;
  49446. self._assert_equals_($5,$7);
  49447. self._should_raise_((function(){
  49448. return $core.withContext(function($ctx2) {
  49449. return $recv(self._collection())._detect_((function(each){
  49450. return $core.withContext(function($ctx3) {
  49451. return $recv(each).__eq(self._sampleNewValue());
  49452. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  49453. }));
  49454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  49455. }),$globals.Error);
  49456. return self;
  49457. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  49458. },
  49459. args: [],
  49460. 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",
  49461. referencedClasses: ["Error"],
  49462. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  49463. }),
  49464. $globals.CollectionTest);
  49465. $core.addMethod(
  49466. $core.method({
  49467. selector: "testDetectIfNone",
  49468. protocol: 'tests',
  49469. fn: function (){
  49470. var self=this;
  49471. var sentinel;
  49472. return $core.withContext(function($ctx1) {
  49473. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  49474. sentinel=$recv($globals.Object)._new();
  49475. $3=self._collection();
  49476. $ctx1.sendIdx["collection"]=1;
  49477. $2=$recv($3)._detect_ifNone_((function(){
  49478. return true;
  49479. }),(function(){
  49480. return sentinel;
  49481. }));
  49482. $ctx1.sendIdx["detect:ifNone:"]=1;
  49483. $1=$recv($2).__tild_eq(sentinel);
  49484. self._assert_($1);
  49485. $5=self._collection();
  49486. $ctx1.sendIdx["collection"]=2;
  49487. $4=$recv($5)._detect_ifNone_((function(){
  49488. return false;
  49489. }),(function(){
  49490. return sentinel;
  49491. }));
  49492. $ctx1.sendIdx["detect:ifNone:"]=2;
  49493. self._assert_equals_($4,sentinel);
  49494. $ctx1.sendIdx["assert:equals:"]=1;
  49495. $6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  49496. return true;
  49497. }),(function(){
  49498. return sentinel;
  49499. }));
  49500. $ctx1.sendIdx["detect:ifNone:"]=3;
  49501. $7=self._sampleNewValue();
  49502. $ctx1.sendIdx["sampleNewValue"]=1;
  49503. self._assert_equals_($6,$7);
  49504. $ctx1.sendIdx["assert:equals:"]=2;
  49505. $8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){
  49506. return $core.withContext(function($ctx2) {
  49507. $9=self._sampleNewValue();
  49508. $ctx2.sendIdx["sampleNewValue"]=2;
  49509. return $recv(each).__eq($9);
  49510. $ctx2.sendIdx["="]=1;
  49511. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  49512. }),(function(){
  49513. return sentinel;
  49514. }));
  49515. $ctx1.sendIdx["detect:ifNone:"]=4;
  49516. $10=self._sampleNewValue();
  49517. $ctx1.sendIdx["sampleNewValue"]=3;
  49518. self._assert_equals_($8,$10);
  49519. $ctx1.sendIdx["assert:equals:"]=3;
  49520. self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){
  49521. return $core.withContext(function($ctx2) {
  49522. return $recv(each).__eq(self._sampleNewValue());
  49523. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  49524. }),(function(){
  49525. return sentinel;
  49526. })),sentinel);
  49527. return self;
  49528. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  49529. },
  49530. args: [],
  49531. 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",
  49532. referencedClasses: ["Object"],
  49533. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  49534. }),
  49535. $globals.CollectionTest);
  49536. $core.addMethod(
  49537. $core.method({
  49538. selector: "testDo",
  49539. protocol: 'tests',
  49540. fn: function (){
  49541. var self=this;
  49542. var newCollection;
  49543. return $core.withContext(function($ctx1) {
  49544. var $1,$2;
  49545. newCollection=$recv($globals.OrderedCollection)._new();
  49546. $ctx1.sendIdx["new"]=1;
  49547. $1=self._collection();
  49548. $ctx1.sendIdx["collection"]=1;
  49549. $recv($1)._do_((function(each){
  49550. return $core.withContext(function($ctx2) {
  49551. return $recv(newCollection)._add_(each);
  49552. $ctx2.sendIdx["add:"]=1;
  49553. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49554. }));
  49555. $ctx1.sendIdx["do:"]=1;
  49556. self._assertSameContents_as_(self._collection(),newCollection);
  49557. $ctx1.sendIdx["assertSameContents:as:"]=1;
  49558. newCollection=$recv($globals.OrderedCollection)._new();
  49559. $2=self._collectionWithDuplicates();
  49560. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  49561. $recv($2)._do_((function(each){
  49562. return $core.withContext(function($ctx2) {
  49563. return $recv(newCollection)._add_(each);
  49564. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49565. }));
  49566. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  49567. return self;
  49568. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  49569. },
  49570. args: [],
  49571. 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",
  49572. referencedClasses: ["OrderedCollection"],
  49573. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  49574. }),
  49575. $globals.CollectionTest);
  49576. $core.addMethod(
  49577. $core.method({
  49578. selector: "testEquality",
  49579. protocol: 'tests',
  49580. fn: function (){
  49581. var self=this;
  49582. return $core.withContext(function($ctx1) {
  49583. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  49584. $2=self._collectionClass();
  49585. $ctx1.sendIdx["collectionClass"]=1;
  49586. $1=$recv($2)._new();
  49587. $ctx1.sendIdx["new"]=1;
  49588. $4=self._collectionClass();
  49589. $ctx1.sendIdx["collectionClass"]=2;
  49590. $3=$recv($4)._new();
  49591. $ctx1.sendIdx["new"]=2;
  49592. self._assert_equals_($1,$3);
  49593. $ctx1.sendIdx["assert:equals:"]=1;
  49594. $5=self._collection();
  49595. $ctx1.sendIdx["collection"]=1;
  49596. $6=self._collection();
  49597. $ctx1.sendIdx["collection"]=2;
  49598. self._assert_equals_($5,$6);
  49599. $ctx1.sendIdx["assert:equals:"]=2;
  49600. $7=self._collectionWithNewValue();
  49601. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49602. $8=self._collectionWithNewValue();
  49603. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49604. self._assert_equals_($7,$8);
  49605. $11=self._collectionClass();
  49606. $ctx1.sendIdx["collectionClass"]=3;
  49607. $10=$recv($11)._new();
  49608. $ctx1.sendIdx["new"]=3;
  49609. $12=self._collection();
  49610. $ctx1.sendIdx["collection"]=3;
  49611. $9=$recv($10).__eq($12);
  49612. $ctx1.sendIdx["="]=1;
  49613. self._deny_($9);
  49614. $ctx1.sendIdx["deny:"]=1;
  49615. $14=self._collection();
  49616. $ctx1.sendIdx["collection"]=4;
  49617. $13=$recv($14).__eq($recv(self._collectionClass())._new());
  49618. $ctx1.sendIdx["="]=2;
  49619. self._deny_($13);
  49620. $ctx1.sendIdx["deny:"]=2;
  49621. self._deny_($recv(self._collection()).__eq(self._collectionWithNewValue()));
  49622. return self;
  49623. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  49624. },
  49625. args: [],
  49626. 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",
  49627. referencedClasses: [],
  49628. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  49629. }),
  49630. $globals.CollectionTest);
  49631. $core.addMethod(
  49632. $core.method({
  49633. selector: "testIfEmptyFamily",
  49634. protocol: 'tests',
  49635. fn: function (){
  49636. var self=this;
  49637. return $core.withContext(function($ctx1) {
  49638. 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;
  49639. $3=self._collectionClass();
  49640. $ctx1.sendIdx["collectionClass"]=1;
  49641. $2=$recv($3)._new();
  49642. $ctx1.sendIdx["new"]=1;
  49643. $1=$recv($2)._ifEmpty_((function(){
  49644. return (42);
  49645. }));
  49646. $ctx1.sendIdx["ifEmpty:"]=1;
  49647. self._assert_equals_($1,(42));
  49648. $ctx1.sendIdx["assert:equals:"]=1;
  49649. $5=self._collection();
  49650. $ctx1.sendIdx["collection"]=1;
  49651. $4=$recv($5)._ifEmpty_((function(){
  49652. return (42);
  49653. }));
  49654. $6=self._collection();
  49655. $ctx1.sendIdx["collection"]=2;
  49656. self._assert_equals_($4,$6);
  49657. $ctx1.sendIdx["assert:equals:"]=2;
  49658. $9=self._collectionClass();
  49659. $ctx1.sendIdx["collectionClass"]=2;
  49660. $8=$recv($9)._new();
  49661. $ctx1.sendIdx["new"]=2;
  49662. $7=$recv($8)._ifNotEmpty_((function(){
  49663. return (42);
  49664. }));
  49665. $ctx1.sendIdx["ifNotEmpty:"]=1;
  49666. $11=self._collectionClass();
  49667. $ctx1.sendIdx["collectionClass"]=3;
  49668. $10=$recv($11)._new();
  49669. $ctx1.sendIdx["new"]=3;
  49670. self._assert_equals_($7,$10);
  49671. $ctx1.sendIdx["assert:equals:"]=3;
  49672. $13=self._collection();
  49673. $ctx1.sendIdx["collection"]=3;
  49674. $12=$recv($13)._ifNotEmpty_((function(){
  49675. return (42);
  49676. }));
  49677. $ctx1.sendIdx["ifNotEmpty:"]=2;
  49678. self._assert_equals_($12,(42));
  49679. $ctx1.sendIdx["assert:equals:"]=4;
  49680. $15=self._collection();
  49681. $ctx1.sendIdx["collection"]=4;
  49682. $14=$recv($15)._ifNotEmpty_((function(col){
  49683. return col;
  49684. }));
  49685. $16=self._collection();
  49686. $ctx1.sendIdx["collection"]=5;
  49687. self._assert_equals_($14,$16);
  49688. $ctx1.sendIdx["assert:equals:"]=5;
  49689. $19=self._collectionClass();
  49690. $ctx1.sendIdx["collectionClass"]=4;
  49691. $18=$recv($19)._new();
  49692. $ctx1.sendIdx["new"]=4;
  49693. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  49694. return (42);
  49695. }),(function(){
  49696. return (999);
  49697. }));
  49698. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  49699. self._assert_equals_($17,(42));
  49700. $ctx1.sendIdx["assert:equals:"]=6;
  49701. $21=self._collection();
  49702. $ctx1.sendIdx["collection"]=6;
  49703. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  49704. return (42);
  49705. }),(function(){
  49706. return (999);
  49707. }));
  49708. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  49709. self._assert_equals_($20,(999));
  49710. $ctx1.sendIdx["assert:equals:"]=7;
  49711. $23=self._collection();
  49712. $ctx1.sendIdx["collection"]=7;
  49713. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  49714. return (42);
  49715. }),(function(col){
  49716. return col;
  49717. }));
  49718. $24=self._collection();
  49719. $ctx1.sendIdx["collection"]=8;
  49720. self._assert_equals_($22,$24);
  49721. $ctx1.sendIdx["assert:equals:"]=8;
  49722. $25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  49723. return (42);
  49724. }),(function(){
  49725. return (999);
  49726. }));
  49727. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  49728. self._assert_equals_($25,(999));
  49729. $ctx1.sendIdx["assert:equals:"]=9;
  49730. $27=self._collection();
  49731. $ctx1.sendIdx["collection"]=9;
  49732. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  49733. return (42);
  49734. }),(function(){
  49735. return (999);
  49736. }));
  49737. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  49738. self._assert_equals_($26,(42));
  49739. $ctx1.sendIdx["assert:equals:"]=10;
  49740. $29=self._collection();
  49741. $ctx1.sendIdx["collection"]=10;
  49742. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  49743. return col;
  49744. }),(function(){
  49745. return (999);
  49746. }));
  49747. self._assert_equals_($28,self._collection());
  49748. return self;
  49749. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  49750. },
  49751. args: [],
  49752. 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.",
  49753. referencedClasses: [],
  49754. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  49755. }),
  49756. $globals.CollectionTest);
  49757. $core.addMethod(
  49758. $core.method({
  49759. selector: "testIsEmpty",
  49760. protocol: 'tests',
  49761. fn: function (){
  49762. var self=this;
  49763. return $core.withContext(function($ctx1) {
  49764. var $1;
  49765. $1=$recv($recv(self._collectionClass())._new())._isEmpty();
  49766. $ctx1.sendIdx["isEmpty"]=1;
  49767. self._assert_($1);
  49768. self._deny_($recv(self._collection())._isEmpty());
  49769. return self;
  49770. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  49771. },
  49772. args: [],
  49773. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  49774. referencedClasses: [],
  49775. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  49776. }),
  49777. $globals.CollectionTest);
  49778. $core.addMethod(
  49779. $core.method({
  49780. selector: "testNoneSatisfy",
  49781. protocol: 'tests',
  49782. fn: function (){
  49783. var self=this;
  49784. var anyOne;
  49785. return $core.withContext(function($ctx1) {
  49786. var $1,$3,$2;
  49787. $1=self._collection();
  49788. $ctx1.sendIdx["collection"]=1;
  49789. anyOne=$recv($1)._anyOne();
  49790. $3=self._collection();
  49791. $ctx1.sendIdx["collection"]=2;
  49792. $2=$recv($3)._noneSatisfy_((function(each){
  49793. return $core.withContext(function($ctx2) {
  49794. return $recv(each).__eq(anyOne);
  49795. $ctx2.sendIdx["="]=1;
  49796. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49797. }));
  49798. $ctx1.sendIdx["noneSatisfy:"]=1;
  49799. self._deny_($2);
  49800. self._assert_($recv(self._collection())._noneSatisfy_((function(each){
  49801. return $core.withContext(function($ctx2) {
  49802. return $recv(each).__eq($recv($globals.Object)._new());
  49803. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49804. })));
  49805. return self;
  49806. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  49807. },
  49808. args: [],
  49809. 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 ])",
  49810. referencedClasses: ["Object"],
  49811. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  49812. }),
  49813. $globals.CollectionTest);
  49814. $core.addMethod(
  49815. $core.method({
  49816. selector: "testRemoveAll",
  49817. protocol: 'tests',
  49818. fn: function (){
  49819. var self=this;
  49820. return $core.withContext(function($ctx1) {
  49821. var $2,$1;
  49822. $2=self._collection();
  49823. $recv($2)._removeAll();
  49824. $1=$recv($2)._yourself();
  49825. self._assert_equals_($1,$recv(self._collectionClass())._new());
  49826. return self;
  49827. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  49828. },
  49829. args: [],
  49830. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  49831. referencedClasses: [],
  49832. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  49833. }),
  49834. $globals.CollectionTest);
  49835. $core.addMethod(
  49836. $core.method({
  49837. selector: "testSelect",
  49838. protocol: 'tests',
  49839. fn: function (){
  49840. var self=this;
  49841. return $core.withContext(function($ctx1) {
  49842. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  49843. $2=self._collection();
  49844. $ctx1.sendIdx["collection"]=1;
  49845. $1=$recv($2)._select_((function(){
  49846. return false;
  49847. }));
  49848. $ctx1.sendIdx["select:"]=1;
  49849. $4=self._collectionClass();
  49850. $ctx1.sendIdx["collectionClass"]=1;
  49851. $3=$recv($4)._new();
  49852. $ctx1.sendIdx["new"]=1;
  49853. self._assert_equals_($1,$3);
  49854. $ctx1.sendIdx["assert:equals:"]=1;
  49855. $6=self._collection();
  49856. $ctx1.sendIdx["collection"]=2;
  49857. $5=$recv($6)._select_((function(){
  49858. return true;
  49859. }));
  49860. $ctx1.sendIdx["select:"]=2;
  49861. $7=self._collection();
  49862. $ctx1.sendIdx["collection"]=3;
  49863. self._assert_equals_($5,$7);
  49864. $ctx1.sendIdx["assert:equals:"]=2;
  49865. $9=self._collectionWithNewValue();
  49866. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49867. $8=$recv($9)._select_((function(each){
  49868. return $core.withContext(function($ctx2) {
  49869. $10=self._sampleNewValue();
  49870. $ctx2.sendIdx["sampleNewValue"]=1;
  49871. return $recv(each).__eq($10);
  49872. $ctx2.sendIdx["="]=1;
  49873. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  49874. }));
  49875. $ctx1.sendIdx["select:"]=3;
  49876. self._assert_equals_($8,self._sampleNewValueAsCollection());
  49877. $ctx1.sendIdx["assert:equals:"]=3;
  49878. $12=self._collectionWithNewValue();
  49879. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49880. $11=$recv($12)._select_((function(each){
  49881. return $core.withContext(function($ctx2) {
  49882. $13=self._sampleNewValue();
  49883. $ctx2.sendIdx["sampleNewValue"]=2;
  49884. return $recv(each).__tild_eq($13);
  49885. $ctx2.sendIdx["~="]=1;
  49886. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  49887. }));
  49888. $ctx1.sendIdx["select:"]=4;
  49889. $14=self._collection();
  49890. $ctx1.sendIdx["collection"]=4;
  49891. self._assert_equals_($11,$14);
  49892. $ctx1.sendIdx["assert:equals:"]=4;
  49893. $16=self._collection();
  49894. $ctx1.sendIdx["collection"]=5;
  49895. $15=$recv($16)._select_((function(each){
  49896. return $core.withContext(function($ctx2) {
  49897. $17=self._sampleNewValue();
  49898. $ctx2.sendIdx["sampleNewValue"]=3;
  49899. return $recv(each).__eq($17);
  49900. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  49901. }));
  49902. $ctx1.sendIdx["select:"]=5;
  49903. self._assert_equals_($15,$recv(self._collectionClass())._new());
  49904. $ctx1.sendIdx["assert:equals:"]=5;
  49905. self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){
  49906. return $core.withContext(function($ctx2) {
  49907. return $recv(each).__tild_eq(self._sampleNewValue());
  49908. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49909. })),self._collection());
  49910. return self;
  49911. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  49912. },
  49913. args: [],
  49914. 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",
  49915. referencedClasses: [],
  49916. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  49917. }),
  49918. $globals.CollectionTest);
  49919. $core.addMethod(
  49920. $core.method({
  49921. selector: "testSize",
  49922. protocol: 'tests',
  49923. fn: function (){
  49924. var self=this;
  49925. return $core.withContext(function($ctx1) {
  49926. var $1,$2;
  49927. $1=$recv($recv(self._collectionClass())._new())._size();
  49928. $ctx1.sendIdx["size"]=1;
  49929. self._assert_equals_($1,(0));
  49930. $ctx1.sendIdx["assert:equals:"]=1;
  49931. $2=$recv(self._sampleNewValueAsCollection())._size();
  49932. $ctx1.sendIdx["size"]=2;
  49933. self._assert_equals_($2,(1));
  49934. $ctx1.sendIdx["assert:equals:"]=2;
  49935. self._assert_equals_($recv(self._collection())._size(),self._collectionSize());
  49936. return self;
  49937. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  49938. },
  49939. args: [],
  49940. 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",
  49941. referencedClasses: [],
  49942. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  49943. }),
  49944. $globals.CollectionTest);
  49945. $core.addMethod(
  49946. $core.method({
  49947. selector: "collectionClass",
  49948. protocol: 'fixture',
  49949. fn: function (){
  49950. var self=this;
  49951. return nil;
  49952. },
  49953. args: [],
  49954. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  49955. referencedClasses: [],
  49956. messageSends: []
  49957. }),
  49958. $globals.CollectionTest.klass);
  49959. $core.addMethod(
  49960. $core.method({
  49961. selector: "isAbstract",
  49962. protocol: 'testing',
  49963. fn: function (){
  49964. var self=this;
  49965. return $core.withContext(function($ctx1) {
  49966. return $recv(self._collectionClass())._isNil();
  49967. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)});
  49968. },
  49969. args: [],
  49970. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  49971. referencedClasses: [],
  49972. messageSends: ["isNil", "collectionClass"]
  49973. }),
  49974. $globals.CollectionTest.klass);
  49975. $core.addClass('IndexableCollectionTest', $globals.CollectionTest, [], 'Kernel-Tests');
  49976. $core.addMethod(
  49977. $core.method({
  49978. selector: "collectionWithNewValue",
  49979. protocol: 'fixture',
  49980. fn: function (){
  49981. var self=this;
  49982. return $core.withContext(function($ctx1) {
  49983. self._subclassResponsibility();
  49984. return self;
  49985. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  49986. },
  49987. args: [],
  49988. 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",
  49989. referencedClasses: [],
  49990. messageSends: ["subclassResponsibility"]
  49991. }),
  49992. $globals.IndexableCollectionTest);
  49993. $core.addMethod(
  49994. $core.method({
  49995. selector: "sampleNewIndex",
  49996. protocol: 'fixture',
  49997. fn: function (){
  49998. var self=this;
  49999. return $core.withContext(function($ctx1) {
  50000. self._subclassResponsibility();
  50001. return self;
  50002. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  50003. },
  50004. args: [],
  50005. 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",
  50006. referencedClasses: [],
  50007. messageSends: ["subclassResponsibility"]
  50008. }),
  50009. $globals.IndexableCollectionTest);
  50010. $core.addMethod(
  50011. $core.method({
  50012. selector: "sampleNonIndexesDo:",
  50013. protocol: 'fixture',
  50014. fn: function (aBlock){
  50015. var self=this;
  50016. return $core.withContext(function($ctx1) {
  50017. self._subclassResponsibility();
  50018. return self;
  50019. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  50020. },
  50021. args: ["aBlock"],
  50022. 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",
  50023. referencedClasses: [],
  50024. messageSends: ["subclassResponsibility"]
  50025. }),
  50026. $globals.IndexableCollectionTest);
  50027. $core.addMethod(
  50028. $core.method({
  50029. selector: "samplesDo:",
  50030. protocol: 'fixture',
  50031. fn: function (aBlock){
  50032. var self=this;
  50033. return $core.withContext(function($ctx1) {
  50034. self._subclassResponsibility();
  50035. return self;
  50036. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  50037. },
  50038. args: ["aBlock"],
  50039. 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",
  50040. referencedClasses: [],
  50041. messageSends: ["subclassResponsibility"]
  50042. }),
  50043. $globals.IndexableCollectionTest);
  50044. $core.addMethod(
  50045. $core.method({
  50046. selector: "testAt",
  50047. protocol: 'tests',
  50048. fn: function (){
  50049. var self=this;
  50050. return $core.withContext(function($ctx1) {
  50051. var $1;
  50052. self._nonIndexesDo_((function(each){
  50053. return $core.withContext(function($ctx2) {
  50054. return self._should_raise_((function(){
  50055. return $core.withContext(function($ctx3) {
  50056. $1=self._collection();
  50057. $ctx3.sendIdx["collection"]=1;
  50058. return $recv($1)._at_(each);
  50059. $ctx3.sendIdx["at:"]=1;
  50060. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50061. }),$globals.Error);
  50062. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50063. }));
  50064. self._samplesDo_((function(index,value){
  50065. return $core.withContext(function($ctx2) {
  50066. return self._assert_equals_($recv(self._collection())._at_(index),value);
  50067. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50068. }));
  50069. return self;
  50070. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  50071. },
  50072. args: [],
  50073. 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 ]",
  50074. referencedClasses: ["Error"],
  50075. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  50076. }),
  50077. $globals.IndexableCollectionTest);
  50078. $core.addMethod(
  50079. $core.method({
  50080. selector: "testAtIfAbsent",
  50081. protocol: 'tests',
  50082. fn: function (){
  50083. var self=this;
  50084. return $core.withContext(function($ctx1) {
  50085. var $2,$1,$3;
  50086. self._nonIndexesDo_((function(each){
  50087. return $core.withContext(function($ctx2) {
  50088. $2=self._collection();
  50089. $ctx2.sendIdx["collection"]=1;
  50090. $1=$recv($2)._at_ifAbsent_(each,(function(){
  50091. return $core.withContext(function($ctx3) {
  50092. return self._sampleNewValue();
  50093. $ctx3.sendIdx["sampleNewValue"]=1;
  50094. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50095. }));
  50096. $ctx2.sendIdx["at:ifAbsent:"]=1;
  50097. $3=self._sampleNewValue();
  50098. $ctx2.sendIdx["sampleNewValue"]=2;
  50099. return self._assert_equals_($1,$3);
  50100. $ctx2.sendIdx["assert:equals:"]=1;
  50101. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50102. }));
  50103. self._samplesDo_((function(index,value){
  50104. return $core.withContext(function($ctx2) {
  50105. return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){
  50106. return $core.withContext(function($ctx3) {
  50107. return self._sampleNewValue();
  50108. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  50109. })),value);
  50110. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50111. }));
  50112. return self;
  50113. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  50114. },
  50115. args: [],
  50116. 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 ].",
  50117. referencedClasses: [],
  50118. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  50119. }),
  50120. $globals.IndexableCollectionTest);
  50121. $core.addMethod(
  50122. $core.method({
  50123. selector: "testAtIfAbsentPut",
  50124. protocol: 'tests',
  50125. fn: function (){
  50126. var self=this;
  50127. var newCollection;
  50128. return $core.withContext(function($ctx1) {
  50129. var $1;
  50130. newCollection=self._collection();
  50131. $ctx1.sendIdx["collection"]=1;
  50132. self._samplesDo_((function(index,value){
  50133. return $core.withContext(function($ctx2) {
  50134. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  50135. return $core.withContext(function($ctx3) {
  50136. return self._sampleNewValue();
  50137. $ctx3.sendIdx["sampleNewValue"]=1;
  50138. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50139. }));
  50140. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  50141. return self._assert_equals_($1,value);
  50142. $ctx2.sendIdx["assert:equals:"]=1;
  50143. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50144. }));
  50145. self._assert_equals_(newCollection,self._collection());
  50146. $ctx1.sendIdx["assert:equals:"]=2;
  50147. self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  50148. return $core.withContext(function($ctx2) {
  50149. return self._sampleNewValue();
  50150. $ctx2.sendIdx["sampleNewValue"]=2;
  50151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50152. })),self._sampleNewValue());
  50153. $ctx1.sendIdx["assert:equals:"]=3;
  50154. self._assert_equals_(newCollection,self._collectionWithNewValue());
  50155. return self;
  50156. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  50157. },
  50158. args: [],
  50159. 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",
  50160. referencedClasses: [],
  50161. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  50162. }),
  50163. $globals.IndexableCollectionTest);
  50164. $core.addMethod(
  50165. $core.method({
  50166. selector: "testAtIfPresent",
  50167. protocol: 'tests',
  50168. fn: function (){
  50169. var self=this;
  50170. var visited,sentinel;
  50171. return $core.withContext(function($ctx1) {
  50172. var $2,$1,$4,$3;
  50173. sentinel=$recv($globals.Object)._new();
  50174. self._nonIndexesDo_((function(each){
  50175. return $core.withContext(function($ctx2) {
  50176. visited=nil;
  50177. visited;
  50178. $2=self._collection();
  50179. $ctx2.sendIdx["collection"]=1;
  50180. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  50181. visited=value1;
  50182. visited;
  50183. return sentinel;
  50184. }));
  50185. $ctx2.sendIdx["at:ifPresent:"]=1;
  50186. self._assert_equals_($1,nil);
  50187. $ctx2.sendIdx["assert:equals:"]=1;
  50188. return self._assert_($recv(visited)._isNil());
  50189. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50190. }));
  50191. self._samplesDo_((function(index,value){
  50192. return $core.withContext(function($ctx2) {
  50193. visited=nil;
  50194. visited;
  50195. $4=self._collection();
  50196. $ctx2.sendIdx["collection"]=2;
  50197. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  50198. visited=value2;
  50199. visited;
  50200. return sentinel;
  50201. }));
  50202. self._assert_equals_($3,sentinel);
  50203. $ctx2.sendIdx["assert:equals:"]=2;
  50204. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  50205. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50206. }));
  50207. return self;
  50208. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  50209. },
  50210. args: [],
  50211. 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) ]",
  50212. referencedClasses: ["Object"],
  50213. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  50214. }),
  50215. $globals.IndexableCollectionTest);
  50216. $core.addMethod(
  50217. $core.method({
  50218. selector: "testAtIfPresentIfAbsent",
  50219. protocol: 'tests',
  50220. fn: function (){
  50221. var self=this;
  50222. var visited,sentinel;
  50223. return $core.withContext(function($ctx1) {
  50224. var $2,$1,$3,$5,$4;
  50225. sentinel=$recv($globals.Object)._new();
  50226. self._nonIndexesDo_((function(each){
  50227. return $core.withContext(function($ctx2) {
  50228. visited=nil;
  50229. visited;
  50230. $2=self._collection();
  50231. $ctx2.sendIdx["collection"]=1;
  50232. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  50233. visited=value1;
  50234. visited;
  50235. return sentinel;
  50236. }),(function(){
  50237. return $core.withContext(function($ctx3) {
  50238. return self._sampleNewValue();
  50239. $ctx3.sendIdx["sampleNewValue"]=1;
  50240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  50241. }));
  50242. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  50243. $3=self._sampleNewValue();
  50244. $ctx2.sendIdx["sampleNewValue"]=2;
  50245. self._assert_equals_($1,$3);
  50246. $ctx2.sendIdx["assert:equals:"]=1;
  50247. return self._assert_($recv(visited)._isNil());
  50248. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50249. }));
  50250. self._samplesDo_((function(index,value){
  50251. return $core.withContext(function($ctx2) {
  50252. visited=nil;
  50253. visited;
  50254. $5=self._collection();
  50255. $ctx2.sendIdx["collection"]=2;
  50256. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  50257. visited=value2;
  50258. visited;
  50259. return sentinel;
  50260. }),(function(){
  50261. return $core.withContext(function($ctx3) {
  50262. return self._sampleNewValue();
  50263. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  50264. }));
  50265. self._assert_equals_($4,sentinel);
  50266. $ctx2.sendIdx["assert:equals:"]=2;
  50267. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  50268. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  50269. }));
  50270. return self;
  50271. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  50272. },
  50273. args: [],
  50274. 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) ]",
  50275. referencedClasses: ["Object"],
  50276. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  50277. }),
  50278. $globals.IndexableCollectionTest);
  50279. $core.addMethod(
  50280. $core.method({
  50281. selector: "testAtPut",
  50282. protocol: 'tests',
  50283. fn: function (){
  50284. var self=this;
  50285. var newCollection;
  50286. return $core.withContext(function($ctx1) {
  50287. newCollection=self._collection();
  50288. $ctx1.sendIdx["collection"]=1;
  50289. self._samplesDo_((function(index,value){
  50290. return $core.withContext(function($ctx2) {
  50291. return $recv(newCollection)._at_put_(index,value);
  50292. $ctx2.sendIdx["at:put:"]=1;
  50293. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50294. }));
  50295. self._assert_equals_(newCollection,self._collection());
  50296. $ctx1.sendIdx["assert:equals:"]=1;
  50297. $recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  50298. self._assert_equals_(newCollection,self._collectionWithNewValue());
  50299. return self;
  50300. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  50301. },
  50302. args: [],
  50303. 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",
  50304. referencedClasses: [],
  50305. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  50306. }),
  50307. $globals.IndexableCollectionTest);
  50308. $core.addMethod(
  50309. $core.method({
  50310. selector: "testIndexOf",
  50311. protocol: 'tests',
  50312. fn: function (){
  50313. var self=this;
  50314. return $core.withContext(function($ctx1) {
  50315. var $1;
  50316. self._should_raise_((function(){
  50317. return $core.withContext(function($ctx2) {
  50318. $1=self._collection();
  50319. $ctx2.sendIdx["collection"]=1;
  50320. return $recv($1)._indexOf_(self._sampleNewValue());
  50321. $ctx2.sendIdx["indexOf:"]=1;
  50322. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50323. }),$globals.Error);
  50324. self._samplesDo_((function(index,value){
  50325. return $core.withContext(function($ctx2) {
  50326. return self._assert_equals_($recv(self._collection())._indexOf_(value),index);
  50327. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  50328. }));
  50329. return self;
  50330. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  50331. },
  50332. args: [],
  50333. 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 ]",
  50334. referencedClasses: ["Error"],
  50335. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  50336. }),
  50337. $globals.IndexableCollectionTest);
  50338. $core.addMethod(
  50339. $core.method({
  50340. selector: "testIndexOfWithNull",
  50341. protocol: 'tests',
  50342. fn: function (){
  50343. var self=this;
  50344. var jsNull;
  50345. return $core.withContext(function($ctx1) {
  50346. var $2,$1;
  50347. jsNull=$recv($globals.JSON)._parse_("null");
  50348. self._samplesDo_((function(index,value){
  50349. return $core.withContext(function($ctx2) {
  50350. $2=self._collection();
  50351. $recv($2)._at_put_(index,jsNull);
  50352. $1=$recv($2)._indexOf_(jsNull);
  50353. return self._assert_equals_($1,index);
  50354. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50355. }));
  50356. return self;
  50357. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  50358. },
  50359. args: [],
  50360. 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 ]",
  50361. referencedClasses: ["JSON"],
  50362. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  50363. }),
  50364. $globals.IndexableCollectionTest);
  50365. $core.addMethod(
  50366. $core.method({
  50367. selector: "testWithIndexDo",
  50368. protocol: 'tests',
  50369. fn: function (){
  50370. var self=this;
  50371. var collection;
  50372. return $core.withContext(function($ctx1) {
  50373. collection=self._collection();
  50374. $ctx1.sendIdx["collection"]=1;
  50375. $recv(self._collection())._withIndexDo_((function(each,index){
  50376. return $core.withContext(function($ctx2) {
  50377. return self._assert_equals_($recv(collection)._at_(index),each);
  50378. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  50379. }));
  50380. return self;
  50381. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  50382. },
  50383. args: [],
  50384. 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 ]",
  50385. referencedClasses: [],
  50386. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  50387. }),
  50388. $globals.IndexableCollectionTest);
  50389. $core.addClass('AssociativeCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  50390. $core.addMethod(
  50391. $core.method({
  50392. selector: "collectionKeys",
  50393. protocol: 'fixture',
  50394. fn: function (){
  50395. var self=this;
  50396. return $core.withContext(function($ctx1) {
  50397. self._subclassResponsibility();
  50398. return self;
  50399. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  50400. },
  50401. args: [],
  50402. source: "collectionKeys\x0a\x09self subclassResponsibility",
  50403. referencedClasses: [],
  50404. messageSends: ["subclassResponsibility"]
  50405. }),
  50406. $globals.AssociativeCollectionTest);
  50407. $core.addMethod(
  50408. $core.method({
  50409. selector: "collectionValues",
  50410. protocol: 'fixture',
  50411. fn: function (){
  50412. var self=this;
  50413. return $core.withContext(function($ctx1) {
  50414. self._subclassResponsibility();
  50415. return self;
  50416. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  50417. },
  50418. args: [],
  50419. source: "collectionValues\x0a\x09self subclassResponsibility",
  50420. referencedClasses: [],
  50421. messageSends: ["subclassResponsibility"]
  50422. }),
  50423. $globals.AssociativeCollectionTest);
  50424. $core.addMethod(
  50425. $core.method({
  50426. selector: "nonIndexesDo:",
  50427. protocol: 'fixture',
  50428. fn: function (aBlock){
  50429. var self=this;
  50430. return $core.withContext(function($ctx1) {
  50431. $recv(aBlock)._value_((5));
  50432. $ctx1.sendIdx["value:"]=1;
  50433. $recv(aBlock)._value_((function(){
  50434. }));
  50435. $ctx1.sendIdx["value:"]=2;
  50436. $recv(aBlock)._value_($recv($globals.Object)._new());
  50437. $ctx1.sendIdx["value:"]=3;
  50438. $recv(aBlock)._value_("z");
  50439. return self;
  50440. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  50441. },
  50442. args: ["aBlock"],
  50443. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  50444. referencedClasses: ["Object"],
  50445. messageSends: ["value:", "new"]
  50446. }),
  50447. $globals.AssociativeCollectionTest);
  50448. $core.addMethod(
  50449. $core.method({
  50450. selector: "sampleNewIndex",
  50451. protocol: 'fixture',
  50452. fn: function (){
  50453. var self=this;
  50454. return "new";
  50455. },
  50456. args: [],
  50457. source: "sampleNewIndex\x0a\x09^ 'new'",
  50458. referencedClasses: [],
  50459. messageSends: []
  50460. }),
  50461. $globals.AssociativeCollectionTest);
  50462. $core.addMethod(
  50463. $core.method({
  50464. selector: "samplesDo:",
  50465. protocol: 'fixture',
  50466. fn: function (aBlock){
  50467. var self=this;
  50468. return $core.withContext(function($ctx1) {
  50469. $recv(aBlock)._value_value_("a",(2));
  50470. return self;
  50471. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  50472. },
  50473. args: ["aBlock"],
  50474. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  50475. referencedClasses: [],
  50476. messageSends: ["value:value:"]
  50477. }),
  50478. $globals.AssociativeCollectionTest);
  50479. $core.addMethod(
  50480. $core.method({
  50481. selector: "testAddAll",
  50482. protocol: 'tests',
  50483. fn: function (){
  50484. var self=this;
  50485. return $core.withContext(function($ctx1) {
  50486. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  50487. (
  50488. $ctx1.supercall = true,
  50489. ($globals.AssociativeCollectionTest.superclass||$boot.dnu).fn.prototype._testAddAll.apply($recv(self), []));
  50490. $ctx1.supercall = false;
  50491. $2=self._collection();
  50492. $ctx1.sendIdx["collection"]=1;
  50493. $3=self._collection();
  50494. $ctx1.sendIdx["collection"]=2;
  50495. $recv($2)._addAll_($3);
  50496. $ctx1.sendIdx["addAll:"]=1;
  50497. $4=$recv($2)._yourself();
  50498. $ctx1.sendIdx["yourself"]=1;
  50499. $1=$4;
  50500. $5=self._collection();
  50501. $ctx1.sendIdx["collection"]=3;
  50502. self._assert_equals_($1,$5);
  50503. $ctx1.sendIdx["assert:equals:"]=1;
  50504. $7=self._collection();
  50505. $ctx1.sendIdx["collection"]=4;
  50506. $8=self._collectionWithNewValue();
  50507. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50508. $recv($7)._addAll_($8);
  50509. $ctx1.sendIdx["addAll:"]=2;
  50510. $9=$recv($7)._yourself();
  50511. $ctx1.sendIdx["yourself"]=2;
  50512. $6=$9;
  50513. $10=self._collectionWithNewValue();
  50514. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50515. self._assert_equals_($6,$10);
  50516. $ctx1.sendIdx["assert:equals:"]=2;
  50517. $12=self._collectionWithNewValue();
  50518. $ctx1.sendIdx["collectionWithNewValue"]=3;
  50519. $recv($12)._addAll_(self._collection());
  50520. $11=$recv($12)._yourself();
  50521. self._assert_equals_($11,self._collectionWithNewValue());
  50522. return self;
  50523. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  50524. },
  50525. args: [],
  50526. 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",
  50527. referencedClasses: [],
  50528. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  50529. }),
  50530. $globals.AssociativeCollectionTest);
  50531. $core.addMethod(
  50532. $core.method({
  50533. selector: "testAsDictionary",
  50534. protocol: 'tests',
  50535. fn: function (){
  50536. var self=this;
  50537. return $core.withContext(function($ctx1) {
  50538. self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  50539. return self;
  50540. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  50541. },
  50542. args: [],
  50543. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  50544. referencedClasses: ["Dictionary"],
  50545. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  50546. }),
  50547. $globals.AssociativeCollectionTest);
  50548. $core.addMethod(
  50549. $core.method({
  50550. selector: "testAsHashedCollection",
  50551. protocol: 'tests',
  50552. fn: function (){
  50553. var self=this;
  50554. return $core.withContext(function($ctx1) {
  50555. self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  50556. return self;
  50557. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  50558. },
  50559. args: [],
  50560. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  50561. referencedClasses: ["HashedCollection"],
  50562. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  50563. }),
  50564. $globals.AssociativeCollectionTest);
  50565. $core.addMethod(
  50566. $core.method({
  50567. selector: "testComma",
  50568. protocol: 'tests',
  50569. fn: function (){
  50570. var self=this;
  50571. return $core.withContext(function($ctx1) {
  50572. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  50573. (
  50574. $ctx1.supercall = true,
  50575. ($globals.AssociativeCollectionTest.superclass||$boot.dnu).fn.prototype._testComma.apply($recv(self), []));
  50576. $ctx1.supercall = false;
  50577. $2=self._collection();
  50578. $ctx1.sendIdx["collection"]=1;
  50579. $3=self._collection();
  50580. $ctx1.sendIdx["collection"]=2;
  50581. $1=$recv($2).__comma($3);
  50582. $ctx1.sendIdx[","]=1;
  50583. $4=self._collection();
  50584. $ctx1.sendIdx["collection"]=3;
  50585. self._assert_equals_($1,$4);
  50586. $ctx1.sendIdx["assert:equals:"]=1;
  50587. $6=self._collection();
  50588. $ctx1.sendIdx["collection"]=4;
  50589. $7=self._collectionWithNewValue();
  50590. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50591. $5=$recv($6).__comma($7);
  50592. $ctx1.sendIdx[","]=2;
  50593. $8=self._collectionWithNewValue();
  50594. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50595. self._assert_equals_($5,$8);
  50596. $ctx1.sendIdx["assert:equals:"]=2;
  50597. $10=self._collectionWithNewValue();
  50598. $ctx1.sendIdx["collectionWithNewValue"]=3;
  50599. $9=$recv($10).__comma(self._collection());
  50600. self._assert_equals_($9,self._collectionWithNewValue());
  50601. return self;
  50602. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  50603. },
  50604. args: [],
  50605. 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",
  50606. referencedClasses: [],
  50607. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  50608. }),
  50609. $globals.AssociativeCollectionTest);
  50610. $core.addMethod(
  50611. $core.method({
  50612. selector: "testFrom",
  50613. protocol: 'tests',
  50614. fn: function (){
  50615. var self=this;
  50616. var associations;
  50617. return $core.withContext(function($ctx1) {
  50618. var $1;
  50619. $1="a".__minus_gt((1));
  50620. $ctx1.sendIdx["->"]=1;
  50621. associations=[$1,"b".__minus_gt((2))];
  50622. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  50623. return self;
  50624. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  50625. },
  50626. args: [],
  50627. 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 }.",
  50628. referencedClasses: [],
  50629. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  50630. }),
  50631. $globals.AssociativeCollectionTest);
  50632. $core.addMethod(
  50633. $core.method({
  50634. selector: "testKeys",
  50635. protocol: 'tests',
  50636. fn: function (){
  50637. var self=this;
  50638. return $core.withContext(function($ctx1) {
  50639. var $2,$1,$3,$4;
  50640. $2=$recv($recv(self._collectionClass())._new())._keys();
  50641. $ctx1.sendIdx["keys"]=1;
  50642. $1=$recv($2)._isEmpty();
  50643. self._assert_($1);
  50644. $3=$recv(self._collection())._keys();
  50645. $ctx1.sendIdx["keys"]=2;
  50646. $4=self._collectionKeys();
  50647. $ctx1.sendIdx["collectionKeys"]=1;
  50648. self._assertSameContents_as_($3,$4);
  50649. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50650. self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  50651. return self;
  50652. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  50653. },
  50654. args: [],
  50655. 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 }",
  50656. referencedClasses: [],
  50657. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  50658. }),
  50659. $globals.AssociativeCollectionTest);
  50660. $core.addMethod(
  50661. $core.method({
  50662. selector: "testNewFromPairs",
  50663. protocol: 'tests',
  50664. fn: function (){
  50665. var self=this;
  50666. var flattenedAssociations;
  50667. return $core.withContext(function($ctx1) {
  50668. flattenedAssociations=["a",(1),"b",(2)];
  50669. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  50670. return self;
  50671. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  50672. },
  50673. args: [],
  50674. 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 }.",
  50675. referencedClasses: [],
  50676. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  50677. }),
  50678. $globals.AssociativeCollectionTest);
  50679. $core.addMethod(
  50680. $core.method({
  50681. selector: "testPrintString",
  50682. protocol: 'tests',
  50683. fn: function (){
  50684. var self=this;
  50685. return $core.withContext(function($ctx1) {
  50686. var $3,$2,$1,$4;
  50687. $3=self._collectionClass();
  50688. $ctx1.sendIdx["collectionClass"]=1;
  50689. $2=$recv($3)._new();
  50690. $recv($2)._at_put_("firstname","James");
  50691. $ctx1.sendIdx["at:put:"]=1;
  50692. $recv($2)._at_put_("lastname","Bond");
  50693. $1=$recv($2)._printString();
  50694. $4=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  50695. $ctx1.sendIdx[","]=1;
  50696. self._assert_equals_($1,$4);
  50697. return self;
  50698. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  50699. },
  50700. args: [],
  50701. 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'')'",
  50702. referencedClasses: [],
  50703. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  50704. }),
  50705. $globals.AssociativeCollectionTest);
  50706. $core.addMethod(
  50707. $core.method({
  50708. selector: "testRemoveKey",
  50709. protocol: 'tests',
  50710. fn: function (){
  50711. var self=this;
  50712. return $core.withContext(function($ctx1) {
  50713. var $1,$2,$3,$5,$6,$4,$8,$7;
  50714. self._nonIndexesDo_((function(each){
  50715. var collection;
  50716. return $core.withContext(function($ctx2) {
  50717. collection=self._collection();
  50718. $ctx2.sendIdx["collection"]=1;
  50719. collection;
  50720. self._should_raise_((function(){
  50721. return $core.withContext(function($ctx3) {
  50722. return $recv(collection)._removeKey_(each);
  50723. $ctx3.sendIdx["removeKey:"]=1;
  50724. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50725. }),$globals.Error);
  50726. $1=collection;
  50727. $2=self._collection();
  50728. $ctx2.sendIdx["collection"]=2;
  50729. return self._assert_equals_($1,$2);
  50730. $ctx2.sendIdx["assert:equals:"]=1;
  50731. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  50732. }));
  50733. self._samplesDo_((function(index,value){
  50734. var collection;
  50735. return $core.withContext(function($ctx2) {
  50736. collection=self._collection();
  50737. $ctx2.sendIdx["collection"]=3;
  50738. collection;
  50739. $3=$recv(collection)._removeKey_(index);
  50740. $ctx2.sendIdx["removeKey:"]=2;
  50741. self._assert_equals_($3,value);
  50742. $ctx2.sendIdx["assert:equals:"]=2;
  50743. $5=collection;
  50744. $6=self._collection();
  50745. $ctx2.sendIdx["collection"]=4;
  50746. $4=$recv($5).__eq($6);
  50747. return self._deny_($4);
  50748. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  50749. }));
  50750. $8=self._collectionWithNewValue();
  50751. $recv($8)._removeKey_(self._sampleNewIndex());
  50752. $7=$recv($8)._yourself();
  50753. self._assert_equals_($7,self._collection());
  50754. return self;
  50755. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  50756. },
  50757. args: [],
  50758. 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",
  50759. referencedClasses: ["Error"],
  50760. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  50761. }),
  50762. $globals.AssociativeCollectionTest);
  50763. $core.addMethod(
  50764. $core.method({
  50765. selector: "testRemoveKeyIfAbsent",
  50766. protocol: 'tests',
  50767. fn: function (){
  50768. var self=this;
  50769. return $core.withContext(function($ctx1) {
  50770. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  50771. self._nonIndexesDo_((function(each){
  50772. var collection;
  50773. return $core.withContext(function($ctx2) {
  50774. collection=self._collection();
  50775. $ctx2.sendIdx["collection"]=1;
  50776. collection;
  50777. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  50778. return $core.withContext(function($ctx3) {
  50779. return self._sampleNewValue();
  50780. $ctx3.sendIdx["sampleNewValue"]=1;
  50781. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50782. }));
  50783. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  50784. $2=self._sampleNewValue();
  50785. $ctx2.sendIdx["sampleNewValue"]=2;
  50786. self._assert_equals_($1,$2);
  50787. $ctx2.sendIdx["assert:equals:"]=1;
  50788. $3=collection;
  50789. $4=self._collection();
  50790. $ctx2.sendIdx["collection"]=2;
  50791. return self._assert_equals_($3,$4);
  50792. $ctx2.sendIdx["assert:equals:"]=2;
  50793. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  50794. }));
  50795. self._samplesDo_((function(index,value){
  50796. var collection;
  50797. return $core.withContext(function($ctx2) {
  50798. collection=self._collection();
  50799. $ctx2.sendIdx["collection"]=3;
  50800. collection;
  50801. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  50802. return $core.withContext(function($ctx3) {
  50803. return self._sampleNewValue();
  50804. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  50805. }));
  50806. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  50807. self._assert_equals_($5,value);
  50808. $ctx2.sendIdx["assert:equals:"]=3;
  50809. $7=collection;
  50810. $8=self._collection();
  50811. $ctx2.sendIdx["collection"]=4;
  50812. $6=$recv($7).__eq($8);
  50813. return self._deny_($6);
  50814. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  50815. }));
  50816. $10=self._collectionWithNewValue();
  50817. $recv($10)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  50818. return $core.withContext(function($ctx2) {
  50819. return self._assert_(false);
  50820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  50821. }));
  50822. $9=$recv($10)._yourself();
  50823. self._assert_equals_($9,self._collection());
  50824. return self;
  50825. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  50826. },
  50827. args: [],
  50828. 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",
  50829. referencedClasses: [],
  50830. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  50831. }),
  50832. $globals.AssociativeCollectionTest);
  50833. $core.addMethod(
  50834. $core.method({
  50835. selector: "testValues",
  50836. protocol: 'tests',
  50837. fn: function (){
  50838. var self=this;
  50839. return $core.withContext(function($ctx1) {
  50840. var $2,$1,$3,$4;
  50841. $2=$recv($recv(self._collectionClass())._new())._values();
  50842. $ctx1.sendIdx["values"]=1;
  50843. $1=$recv($2)._isEmpty();
  50844. self._assert_($1);
  50845. $3=$recv(self._collection())._values();
  50846. $ctx1.sendIdx["values"]=2;
  50847. $4=self._collectionValues();
  50848. $ctx1.sendIdx["collectionValues"]=1;
  50849. self._assertSameContents_as_($3,$4);
  50850. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50851. self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()]));
  50852. return self;
  50853. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  50854. },
  50855. args: [],
  50856. 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 }",
  50857. referencedClasses: [],
  50858. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  50859. }),
  50860. $globals.AssociativeCollectionTest);
  50861. $core.addClass('DictionaryTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  50862. $core.addMethod(
  50863. $core.method({
  50864. selector: "collection",
  50865. protocol: 'fixture',
  50866. fn: function (){
  50867. var self=this;
  50868. return $core.withContext(function($ctx1) {
  50869. var $1;
  50870. $1=$recv($globals.Dictionary)._new();
  50871. $recv($1)._at_put_((1),(1));
  50872. $ctx1.sendIdx["at:put:"]=1;
  50873. $recv($1)._at_put_("a",(2));
  50874. $ctx1.sendIdx["at:put:"]=2;
  50875. $recv($1)._at_put_(true,(3));
  50876. $ctx1.sendIdx["at:put:"]=3;
  50877. $recv($1)._at_put_((1).__at((3)),(-4));
  50878. $ctx1.sendIdx["at:put:"]=4;
  50879. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50880. return $recv($1)._yourself();
  50881. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  50882. },
  50883. args: [],
  50884. 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",
  50885. referencedClasses: ["Dictionary"],
  50886. messageSends: ["at:put:", "new", "@", "yourself"]
  50887. }),
  50888. $globals.DictionaryTest);
  50889. $core.addMethod(
  50890. $core.method({
  50891. selector: "collectionKeys",
  50892. protocol: 'fixture',
  50893. fn: function (){
  50894. var self=this;
  50895. return $core.withContext(function($ctx1) {
  50896. return [(1),"a",true,(1).__at((3)),self["@sampleBlock"]];
  50897. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  50898. },
  50899. args: [],
  50900. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  50901. referencedClasses: [],
  50902. messageSends: ["@"]
  50903. }),
  50904. $globals.DictionaryTest);
  50905. $core.addMethod(
  50906. $core.method({
  50907. selector: "collectionOfPrintStrings",
  50908. protocol: 'fixture',
  50909. fn: function (){
  50910. var self=this;
  50911. return $core.withContext(function($ctx1) {
  50912. var $1;
  50913. $1=$recv($globals.Dictionary)._new();
  50914. $recv($1)._at_put_((1),"1");
  50915. $ctx1.sendIdx["at:put:"]=1;
  50916. $recv($1)._at_put_("a","2");
  50917. $ctx1.sendIdx["at:put:"]=2;
  50918. $recv($1)._at_put_(true,"3");
  50919. $ctx1.sendIdx["at:put:"]=3;
  50920. $recv($1)._at_put_((1).__at((3)),"-4");
  50921. $ctx1.sendIdx["at:put:"]=4;
  50922. $recv($1)._at_put_(self["@sampleBlock"],"9");
  50923. return $recv($1)._yourself();
  50924. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  50925. },
  50926. args: [],
  50927. 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",
  50928. referencedClasses: ["Dictionary"],
  50929. messageSends: ["at:put:", "new", "@", "yourself"]
  50930. }),
  50931. $globals.DictionaryTest);
  50932. $core.addMethod(
  50933. $core.method({
  50934. selector: "collectionSize",
  50935. protocol: 'fixture',
  50936. fn: function (){
  50937. var self=this;
  50938. return (5);
  50939. },
  50940. args: [],
  50941. source: "collectionSize\x0a\x09^ 5",
  50942. referencedClasses: [],
  50943. messageSends: []
  50944. }),
  50945. $globals.DictionaryTest);
  50946. $core.addMethod(
  50947. $core.method({
  50948. selector: "collectionValues",
  50949. protocol: 'fixture',
  50950. fn: function (){
  50951. var self=this;
  50952. return [(1),(2),(3),(-4),(9)];
  50953. },
  50954. args: [],
  50955. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  50956. referencedClasses: [],
  50957. messageSends: []
  50958. }),
  50959. $globals.DictionaryTest);
  50960. $core.addMethod(
  50961. $core.method({
  50962. selector: "collectionWithDuplicates",
  50963. protocol: 'fixture',
  50964. fn: function (){
  50965. var self=this;
  50966. return $core.withContext(function($ctx1) {
  50967. var $1;
  50968. $1=$recv($globals.Dictionary)._new();
  50969. $recv($1)._at_put_((1),(1));
  50970. $ctx1.sendIdx["at:put:"]=1;
  50971. $recv($1)._at_put_("a",(2));
  50972. $ctx1.sendIdx["at:put:"]=2;
  50973. $recv($1)._at_put_(true,(3));
  50974. $ctx1.sendIdx["at:put:"]=3;
  50975. $recv($1)._at_put_((4),(-4));
  50976. $ctx1.sendIdx["at:put:"]=4;
  50977. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50978. $ctx1.sendIdx["at:put:"]=5;
  50979. $recv($1)._at_put_("b",(1));
  50980. $ctx1.sendIdx["at:put:"]=6;
  50981. $recv($1)._at_put_((3),(3));
  50982. $ctx1.sendIdx["at:put:"]=7;
  50983. $recv($1)._at_put_(false,(12));
  50984. return $recv($1)._yourself();
  50985. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  50986. },
  50987. args: [],
  50988. 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",
  50989. referencedClasses: ["Dictionary"],
  50990. messageSends: ["at:put:", "new", "yourself"]
  50991. }),
  50992. $globals.DictionaryTest);
  50993. $core.addMethod(
  50994. $core.method({
  50995. selector: "collectionWithNewValue",
  50996. protocol: 'fixture',
  50997. fn: function (){
  50998. var self=this;
  50999. return $core.withContext(function($ctx1) {
  51000. var $1;
  51001. $1=$recv($globals.Dictionary)._new();
  51002. $recv($1)._at_put_((1),(1));
  51003. $ctx1.sendIdx["at:put:"]=1;
  51004. $recv($1)._at_put_("a",(2));
  51005. $ctx1.sendIdx["at:put:"]=2;
  51006. $recv($1)._at_put_(true,(3));
  51007. $ctx1.sendIdx["at:put:"]=3;
  51008. $recv($1)._at_put_((1).__at((3)),(-4));
  51009. $ctx1.sendIdx["at:put:"]=4;
  51010. $recv($1)._at_put_(self["@sampleBlock"],(9));
  51011. $ctx1.sendIdx["at:put:"]=5;
  51012. $recv($1)._at_put_("new","N");
  51013. return $recv($1)._yourself();
  51014. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  51015. },
  51016. args: [],
  51017. 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",
  51018. referencedClasses: ["Dictionary"],
  51019. messageSends: ["at:put:", "new", "@", "yourself"]
  51020. }),
  51021. $globals.DictionaryTest);
  51022. $core.addMethod(
  51023. $core.method({
  51024. selector: "sampleNewValueAsCollection",
  51025. protocol: 'fixture',
  51026. fn: function (){
  51027. var self=this;
  51028. return $core.withContext(function($ctx1) {
  51029. var $1;
  51030. $1=$recv($globals.Dictionary)._new();
  51031. $recv($1)._at_put_("new","N");
  51032. return $recv($1)._yourself();
  51033. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  51034. },
  51035. args: [],
  51036. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  51037. referencedClasses: ["Dictionary"],
  51038. messageSends: ["at:put:", "new", "yourself"]
  51039. }),
  51040. $globals.DictionaryTest);
  51041. $core.addMethod(
  51042. $core.method({
  51043. selector: "samplesDo:",
  51044. protocol: 'fixture',
  51045. fn: function (aBlock){
  51046. var self=this;
  51047. return $core.withContext(function($ctx1) {
  51048. (
  51049. $ctx1.supercall = true,
  51050. ($globals.DictionaryTest.superclass||$boot.dnu).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  51051. $ctx1.supercall = false;
  51052. $recv(aBlock)._value_value_(true,(3));
  51053. $ctx1.sendIdx["value:value:"]=1;
  51054. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  51055. $ctx1.sendIdx["value:value:"]=2;
  51056. $recv(aBlock)._value_value_(self["@sampleBlock"],(9));
  51057. return self;
  51058. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  51059. },
  51060. args: ["aBlock"],
  51061. 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",
  51062. referencedClasses: [],
  51063. messageSends: ["samplesDo:", "value:value:", "@"]
  51064. }),
  51065. $globals.DictionaryTest);
  51066. $core.addMethod(
  51067. $core.method({
  51068. selector: "testAccessing",
  51069. protocol: 'tests',
  51070. fn: function (){
  51071. var self=this;
  51072. var d;
  51073. return $core.withContext(function($ctx1) {
  51074. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  51075. d=$recv($globals.Dictionary)._new();
  51076. $recv(d)._at_put_("hello","world");
  51077. $ctx1.sendIdx["at:put:"]=1;
  51078. $1=$recv(d)._at_("hello");
  51079. $ctx1.sendIdx["at:"]=1;
  51080. self._assert_equals_($1,"world");
  51081. $ctx1.sendIdx["assert:equals:"]=1;
  51082. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  51083. return nil;
  51084. }));
  51085. $ctx1.sendIdx["at:ifAbsent:"]=1;
  51086. self._assert_equals_($2,"world");
  51087. $ctx1.sendIdx["assert:equals:"]=2;
  51088. self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  51089. return nil;
  51090. }))).__eq("world"));
  51091. $ctx1.sendIdx["deny:"]=1;
  51092. $3=$recv(d)._includesKey_("hello");
  51093. $ctx1.sendIdx["includesKey:"]=1;
  51094. self._assert_($3);
  51095. $ctx1.sendIdx["assert:"]=1;
  51096. $4=$recv(d)._includesKey_("foo");
  51097. $ctx1.sendIdx["includesKey:"]=2;
  51098. self._deny_($4);
  51099. $ctx1.sendIdx["deny:"]=2;
  51100. $recv(d)._at_put_((1),(2));
  51101. $ctx1.sendIdx["at:put:"]=2;
  51102. $5=$recv(d)._at_((1));
  51103. $ctx1.sendIdx["at:"]=2;
  51104. self._assert_equals_($5,(2));
  51105. $ctx1.sendIdx["assert:equals:"]=3;
  51106. $6=d;
  51107. $7=(1).__at((3));
  51108. $ctx1.sendIdx["@"]=1;
  51109. $recv($6)._at_put_($7,(3));
  51110. $9=d;
  51111. $10=(1).__at((3));
  51112. $ctx1.sendIdx["@"]=2;
  51113. $8=$recv($9)._at_($10);
  51114. self._assert_equals_($8,(3));
  51115. $12=d;
  51116. $13=(1).__at((3));
  51117. $ctx1.sendIdx["@"]=3;
  51118. $11=$recv($12)._includesKey_($13);
  51119. $ctx1.sendIdx["includesKey:"]=3;
  51120. self._assert_($11);
  51121. self._deny_($recv(d)._includesKey_((3).__at((1))));
  51122. return self;
  51123. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  51124. },
  51125. args: [],
  51126. 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)",
  51127. referencedClasses: ["Dictionary"],
  51128. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  51129. }),
  51130. $globals.DictionaryTest);
  51131. $core.addMethod(
  51132. $core.method({
  51133. selector: "testDynamicDictionaries",
  51134. protocol: 'tests',
  51135. fn: function (){
  51136. var self=this;
  51137. return $core.withContext(function($ctx1) {
  51138. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  51139. return self;
  51140. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  51141. },
  51142. args: [],
  51143. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  51144. referencedClasses: ["Dictionary"],
  51145. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  51146. }),
  51147. $globals.DictionaryTest);
  51148. $core.addMethod(
  51149. $core.method({
  51150. selector: "collectionClass",
  51151. protocol: 'fixture',
  51152. fn: function (){
  51153. var self=this;
  51154. return $globals.Dictionary;
  51155. },
  51156. args: [],
  51157. source: "collectionClass\x0a\x09^ Dictionary",
  51158. referencedClasses: ["Dictionary"],
  51159. messageSends: []
  51160. }),
  51161. $globals.DictionaryTest.klass);
  51162. $core.addClass('HashedCollectionTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  51163. $core.addMethod(
  51164. $core.method({
  51165. selector: "collection",
  51166. protocol: 'fixture',
  51167. fn: function (){
  51168. var self=this;
  51169. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  51170. },
  51171. args: [],
  51172. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  51173. referencedClasses: [],
  51174. messageSends: []
  51175. }),
  51176. $globals.HashedCollectionTest);
  51177. $core.addMethod(
  51178. $core.method({
  51179. selector: "collectionKeys",
  51180. protocol: 'fixture',
  51181. fn: function (){
  51182. var self=this;
  51183. return ["b","a","c","d"];
  51184. },
  51185. args: [],
  51186. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  51187. referencedClasses: [],
  51188. messageSends: []
  51189. }),
  51190. $globals.HashedCollectionTest);
  51191. $core.addMethod(
  51192. $core.method({
  51193. selector: "collectionOfPrintStrings",
  51194. protocol: 'fixture',
  51195. fn: function (){
  51196. var self=this;
  51197. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  51198. },
  51199. args: [],
  51200. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  51201. referencedClasses: [],
  51202. messageSends: []
  51203. }),
  51204. $globals.HashedCollectionTest);
  51205. $core.addMethod(
  51206. $core.method({
  51207. selector: "collectionSize",
  51208. protocol: 'fixture',
  51209. fn: function (){
  51210. var self=this;
  51211. return (4);
  51212. },
  51213. args: [],
  51214. source: "collectionSize\x0a\x09^ 4",
  51215. referencedClasses: [],
  51216. messageSends: []
  51217. }),
  51218. $globals.HashedCollectionTest);
  51219. $core.addMethod(
  51220. $core.method({
  51221. selector: "collectionValues",
  51222. protocol: 'fixture',
  51223. fn: function (){
  51224. var self=this;
  51225. return [(1),(2),(3),(-4)];
  51226. },
  51227. args: [],
  51228. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  51229. referencedClasses: [],
  51230. messageSends: []
  51231. }),
  51232. $globals.HashedCollectionTest);
  51233. $core.addMethod(
  51234. $core.method({
  51235. selector: "collectionWithDuplicates",
  51236. protocol: 'fixture',
  51237. fn: function (){
  51238. var self=this;
  51239. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  51240. },
  51241. args: [],
  51242. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  51243. referencedClasses: [],
  51244. messageSends: []
  51245. }),
  51246. $globals.HashedCollectionTest);
  51247. $core.addMethod(
  51248. $core.method({
  51249. selector: "collectionWithNewValue",
  51250. protocol: 'fixture',
  51251. fn: function (){
  51252. var self=this;
  51253. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  51254. },
  51255. args: [],
  51256. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  51257. referencedClasses: [],
  51258. messageSends: []
  51259. }),
  51260. $globals.HashedCollectionTest);
  51261. $core.addMethod(
  51262. $core.method({
  51263. selector: "sampleNewValueAsCollection",
  51264. protocol: 'fixture',
  51265. fn: function (){
  51266. var self=this;
  51267. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  51268. },
  51269. args: [],
  51270. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  51271. referencedClasses: [],
  51272. messageSends: []
  51273. }),
  51274. $globals.HashedCollectionTest);
  51275. $core.addMethod(
  51276. $core.method({
  51277. selector: "testDynamicDictionaries",
  51278. protocol: 'tests',
  51279. fn: function (){
  51280. var self=this;
  51281. return $core.withContext(function($ctx1) {
  51282. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  51283. return self;
  51284. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  51285. },
  51286. args: [],
  51287. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  51288. referencedClasses: ["HashedCollection"],
  51289. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  51290. }),
  51291. $globals.HashedCollectionTest);
  51292. $core.addMethod(
  51293. $core.method({
  51294. selector: "collectionClass",
  51295. protocol: 'fixture',
  51296. fn: function (){
  51297. var self=this;
  51298. return $globals.HashedCollection;
  51299. },
  51300. args: [],
  51301. source: "collectionClass\x0a\x09^ HashedCollection",
  51302. referencedClasses: ["HashedCollection"],
  51303. messageSends: []
  51304. }),
  51305. $globals.HashedCollectionTest.klass);
  51306. $core.addClass('SequenceableCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  51307. $core.addMethod(
  51308. $core.method({
  51309. selector: "collectionFirst",
  51310. protocol: 'fixture',
  51311. fn: function (){
  51312. var self=this;
  51313. return $core.withContext(function($ctx1) {
  51314. self._subclassResponsibility();
  51315. return self;
  51316. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  51317. },
  51318. args: [],
  51319. source: "collectionFirst\x0a\x09self subclassResponsibility",
  51320. referencedClasses: [],
  51321. messageSends: ["subclassResponsibility"]
  51322. }),
  51323. $globals.SequenceableCollectionTest);
  51324. $core.addMethod(
  51325. $core.method({
  51326. selector: "collectionFirstTwo",
  51327. protocol: 'fixture',
  51328. fn: function (){
  51329. var self=this;
  51330. return $core.withContext(function($ctx1) {
  51331. self._subclassResponsibility();
  51332. return self;
  51333. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  51334. },
  51335. args: [],
  51336. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  51337. referencedClasses: [],
  51338. messageSends: ["subclassResponsibility"]
  51339. }),
  51340. $globals.SequenceableCollectionTest);
  51341. $core.addMethod(
  51342. $core.method({
  51343. selector: "collectionLast",
  51344. protocol: 'fixture',
  51345. fn: function (){
  51346. var self=this;
  51347. return $core.withContext(function($ctx1) {
  51348. self._subclassResponsibility();
  51349. return self;
  51350. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  51351. },
  51352. args: [],
  51353. source: "collectionLast\x0a\x09self subclassResponsibility",
  51354. referencedClasses: [],
  51355. messageSends: ["subclassResponsibility"]
  51356. }),
  51357. $globals.SequenceableCollectionTest);
  51358. $core.addMethod(
  51359. $core.method({
  51360. selector: "collectionLastTwo",
  51361. protocol: 'fixture',
  51362. fn: function (){
  51363. var self=this;
  51364. return $core.withContext(function($ctx1) {
  51365. self._subclassResponsibility();
  51366. return self;
  51367. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  51368. },
  51369. args: [],
  51370. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  51371. referencedClasses: [],
  51372. messageSends: ["subclassResponsibility"]
  51373. }),
  51374. $globals.SequenceableCollectionTest);
  51375. $core.addMethod(
  51376. $core.method({
  51377. selector: "nonIndexesDo:",
  51378. protocol: 'fixture',
  51379. fn: function (aBlock){
  51380. var self=this;
  51381. return $core.withContext(function($ctx1) {
  51382. $recv(aBlock)._value_((0));
  51383. $ctx1.sendIdx["value:"]=1;
  51384. $recv(aBlock)._value_($recv(self._collectionSize()).__plus((1)));
  51385. $ctx1.sendIdx["value:"]=2;
  51386. $recv(aBlock)._value_("z");
  51387. return self;
  51388. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  51389. },
  51390. args: ["aBlock"],
  51391. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  51392. referencedClasses: [],
  51393. messageSends: ["value:", "+", "collectionSize"]
  51394. }),
  51395. $globals.SequenceableCollectionTest);
  51396. $core.addMethod(
  51397. $core.method({
  51398. selector: "samplesDo:",
  51399. protocol: 'fixture',
  51400. fn: function (aBlock){
  51401. var self=this;
  51402. return $core.withContext(function($ctx1) {
  51403. $recv(aBlock)._value_value_((1),self._collectionFirst());
  51404. $ctx1.sendIdx["value:value:"]=1;
  51405. $recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  51406. return self;
  51407. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  51408. },
  51409. args: ["aBlock"],
  51410. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  51411. referencedClasses: [],
  51412. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  51413. }),
  51414. $globals.SequenceableCollectionTest);
  51415. $core.addMethod(
  51416. $core.method({
  51417. selector: "testBeginsWith",
  51418. protocol: 'tests',
  51419. fn: function (){
  51420. var self=this;
  51421. return $core.withContext(function($ctx1) {
  51422. var $2,$1,$4,$5,$3,$7,$6;
  51423. $2=self._collection();
  51424. $ctx1.sendIdx["collection"]=1;
  51425. $1=$recv($2)._beginsWith_($recv(self._collectionClass())._new());
  51426. $ctx1.sendIdx["beginsWith:"]=1;
  51427. self._assert_($1);
  51428. $ctx1.sendIdx["assert:"]=1;
  51429. $4=self._collection();
  51430. $ctx1.sendIdx["collection"]=2;
  51431. $5=self._collection();
  51432. $ctx1.sendIdx["collection"]=3;
  51433. $3=$recv($4)._beginsWith_($5);
  51434. $ctx1.sendIdx["beginsWith:"]=2;
  51435. self._assert_($3);
  51436. $ctx1.sendIdx["assert:"]=2;
  51437. $7=self._collection();
  51438. $ctx1.sendIdx["collection"]=4;
  51439. $6=$recv($7)._beginsWith_(self._collectionFirstTwo());
  51440. $ctx1.sendIdx["beginsWith:"]=3;
  51441. self._assert_($6);
  51442. self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo()));
  51443. return self;
  51444. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  51445. },
  51446. args: [],
  51447. 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)",
  51448. referencedClasses: [],
  51449. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  51450. }),
  51451. $globals.SequenceableCollectionTest);
  51452. $core.addMethod(
  51453. $core.method({
  51454. selector: "testEndsWith",
  51455. protocol: 'tests',
  51456. fn: function (){
  51457. var self=this;
  51458. return $core.withContext(function($ctx1) {
  51459. var $2,$1,$4,$5,$3,$7,$6;
  51460. $2=self._collection();
  51461. $ctx1.sendIdx["collection"]=1;
  51462. $1=$recv($2)._endsWith_($recv(self._collectionClass())._new());
  51463. $ctx1.sendIdx["endsWith:"]=1;
  51464. self._assert_($1);
  51465. $ctx1.sendIdx["assert:"]=1;
  51466. $4=self._collection();
  51467. $ctx1.sendIdx["collection"]=2;
  51468. $5=self._collection();
  51469. $ctx1.sendIdx["collection"]=3;
  51470. $3=$recv($4)._endsWith_($5);
  51471. $ctx1.sendIdx["endsWith:"]=2;
  51472. self._assert_($3);
  51473. $ctx1.sendIdx["assert:"]=2;
  51474. $7=self._collection();
  51475. $ctx1.sendIdx["collection"]=4;
  51476. $6=$recv($7)._endsWith_(self._collectionLastTwo());
  51477. $ctx1.sendIdx["endsWith:"]=3;
  51478. self._assert_($6);
  51479. self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo()));
  51480. return self;
  51481. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  51482. },
  51483. args: [],
  51484. 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)",
  51485. referencedClasses: [],
  51486. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  51487. }),
  51488. $globals.SequenceableCollectionTest);
  51489. $core.addMethod(
  51490. $core.method({
  51491. selector: "testFirst",
  51492. protocol: 'tests',
  51493. fn: function (){
  51494. var self=this;
  51495. return $core.withContext(function($ctx1) {
  51496. self._assert_equals_($recv(self._collection())._first(),self._collectionFirst());
  51497. return self;
  51498. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  51499. },
  51500. args: [],
  51501. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  51502. referencedClasses: [],
  51503. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  51504. }),
  51505. $globals.SequenceableCollectionTest);
  51506. $core.addMethod(
  51507. $core.method({
  51508. selector: "testFirstN",
  51509. protocol: 'tests',
  51510. fn: function (){
  51511. var self=this;
  51512. return $core.withContext(function($ctx1) {
  51513. var $2,$1,$4,$3,$6,$5,$7;
  51514. $2=self._collection();
  51515. $ctx1.sendIdx["collection"]=1;
  51516. $1=$recv($2)._first_((2));
  51517. $ctx1.sendIdx["first:"]=1;
  51518. self._assert_equals_($1,self._collectionFirstTwo());
  51519. $ctx1.sendIdx["assert:equals:"]=1;
  51520. $4=self._collection();
  51521. $ctx1.sendIdx["collection"]=2;
  51522. $3=$recv($4)._first_((0));
  51523. $ctx1.sendIdx["first:"]=2;
  51524. self._assert_equals_($3,$recv(self._collectionClass())._new());
  51525. $ctx1.sendIdx["assert:equals:"]=2;
  51526. $6=self._collection();
  51527. $ctx1.sendIdx["collection"]=3;
  51528. $5=$recv($6)._first_(self._collectionSize());
  51529. $ctx1.sendIdx["first:"]=3;
  51530. $7=self._collection();
  51531. $ctx1.sendIdx["collection"]=4;
  51532. self._assert_equals_($5,$7);
  51533. self._should_raise_((function(){
  51534. return $core.withContext(function($ctx2) {
  51535. return $recv(self._collection())._first_((33));
  51536. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51537. }),$globals.Error);
  51538. return self;
  51539. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  51540. },
  51541. args: [],
  51542. 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",
  51543. referencedClasses: ["Error"],
  51544. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  51545. }),
  51546. $globals.SequenceableCollectionTest);
  51547. $core.addMethod(
  51548. $core.method({
  51549. selector: "testFourth",
  51550. protocol: 'tests',
  51551. fn: function (){
  51552. var self=this;
  51553. return $core.withContext(function($ctx1) {
  51554. var $2,$1;
  51555. $2=self._collection();
  51556. $ctx1.sendIdx["collection"]=1;
  51557. $1=$recv($2)._fourth();
  51558. self._assert_equals_($1,$recv(self._collection())._at_((4)));
  51559. return self;
  51560. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  51561. },
  51562. args: [],
  51563. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  51564. referencedClasses: [],
  51565. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  51566. }),
  51567. $globals.SequenceableCollectionTest);
  51568. $core.addMethod(
  51569. $core.method({
  51570. selector: "testIndexOfStartingAt",
  51571. protocol: 'tests',
  51572. fn: function (){
  51573. var self=this;
  51574. var jsNull;
  51575. return $core.withContext(function($ctx1) {
  51576. var $2,$1,$4,$3;
  51577. jsNull=$recv($globals.JSON)._parse_("null");
  51578. self._samplesDo_((function(index,value){
  51579. return $core.withContext(function($ctx2) {
  51580. $2=self._collection();
  51581. $ctx2.sendIdx["collection"]=1;
  51582. $1=$recv($2)._indexOf_startingAt_(value,(1));
  51583. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  51584. self._assert_equals_($1,index);
  51585. $ctx2.sendIdx["assert:equals:"]=1;
  51586. $4=self._collection();
  51587. $ctx2.sendIdx["collection"]=2;
  51588. $3=$recv($4)._indexOf_startingAt_(value,index);
  51589. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  51590. self._assert_equals_($3,index);
  51591. $ctx2.sendIdx["assert:equals:"]=2;
  51592. return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  51593. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51594. }));
  51595. return self;
  51596. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  51597. },
  51598. args: [],
  51599. 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 ]",
  51600. referencedClasses: ["JSON"],
  51601. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  51602. }),
  51603. $globals.SequenceableCollectionTest);
  51604. $core.addMethod(
  51605. $core.method({
  51606. selector: "testIndexOfStartingAtWithNull",
  51607. protocol: 'tests',
  51608. fn: function (){
  51609. var self=this;
  51610. var jsNull;
  51611. return $core.withContext(function($ctx1) {
  51612. var $1,$2;
  51613. jsNull=$recv($globals.JSON)._parse_("null");
  51614. self._samplesDo_((function(index,value){
  51615. var collection;
  51616. return $core.withContext(function($ctx2) {
  51617. collection=self._collection();
  51618. collection;
  51619. $recv(collection)._at_put_(index,jsNull);
  51620. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  51621. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  51622. self._assert_equals_($1,index);
  51623. $ctx2.sendIdx["assert:equals:"]=1;
  51624. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  51625. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  51626. self._assert_equals_($2,index);
  51627. $ctx2.sendIdx["assert:equals:"]=2;
  51628. return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  51629. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  51630. }));
  51631. return self;
  51632. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  51633. },
  51634. args: [],
  51635. 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 ]",
  51636. referencedClasses: ["JSON"],
  51637. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  51638. }),
  51639. $globals.SequenceableCollectionTest);
  51640. $core.addMethod(
  51641. $core.method({
  51642. selector: "testLast",
  51643. protocol: 'tests',
  51644. fn: function (){
  51645. var self=this;
  51646. return $core.withContext(function($ctx1) {
  51647. self._assert_equals_($recv(self._collection())._last(),self._collectionLast());
  51648. return self;
  51649. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  51650. },
  51651. args: [],
  51652. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  51653. referencedClasses: [],
  51654. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  51655. }),
  51656. $globals.SequenceableCollectionTest);
  51657. $core.addMethod(
  51658. $core.method({
  51659. selector: "testLastN",
  51660. protocol: 'tests',
  51661. fn: function (){
  51662. var self=this;
  51663. return $core.withContext(function($ctx1) {
  51664. var $2,$1,$4,$3,$6,$5,$7;
  51665. $2=self._collection();
  51666. $ctx1.sendIdx["collection"]=1;
  51667. $1=$recv($2)._last_((2));
  51668. $ctx1.sendIdx["last:"]=1;
  51669. self._assert_equals_($1,self._collectionLastTwo());
  51670. $ctx1.sendIdx["assert:equals:"]=1;
  51671. $4=self._collection();
  51672. $ctx1.sendIdx["collection"]=2;
  51673. $3=$recv($4)._last_((0));
  51674. $ctx1.sendIdx["last:"]=2;
  51675. self._assert_equals_($3,$recv(self._collectionClass())._new());
  51676. $ctx1.sendIdx["assert:equals:"]=2;
  51677. $6=self._collection();
  51678. $ctx1.sendIdx["collection"]=3;
  51679. $5=$recv($6)._last_(self._collectionSize());
  51680. $ctx1.sendIdx["last:"]=3;
  51681. $7=self._collection();
  51682. $ctx1.sendIdx["collection"]=4;
  51683. self._assert_equals_($5,$7);
  51684. self._should_raise_((function(){
  51685. return $core.withContext(function($ctx2) {
  51686. return $recv(self._collection())._last_((33));
  51687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51688. }),$globals.Error);
  51689. return self;
  51690. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  51691. },
  51692. args: [],
  51693. 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",
  51694. referencedClasses: ["Error"],
  51695. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  51696. }),
  51697. $globals.SequenceableCollectionTest);
  51698. $core.addMethod(
  51699. $core.method({
  51700. selector: "testSecond",
  51701. protocol: 'tests',
  51702. fn: function (){
  51703. var self=this;
  51704. return $core.withContext(function($ctx1) {
  51705. var $2,$1;
  51706. $2=self._collection();
  51707. $ctx1.sendIdx["collection"]=1;
  51708. $1=$recv($2)._second();
  51709. self._assert_equals_($1,$recv(self._collection())._at_((2)));
  51710. return self;
  51711. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  51712. },
  51713. args: [],
  51714. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  51715. referencedClasses: [],
  51716. messageSends: ["assert:equals:", "second", "collection", "at:"]
  51717. }),
  51718. $globals.SequenceableCollectionTest);
  51719. $core.addMethod(
  51720. $core.method({
  51721. selector: "testThird",
  51722. protocol: 'tests',
  51723. fn: function (){
  51724. var self=this;
  51725. return $core.withContext(function($ctx1) {
  51726. var $2,$1;
  51727. $2=self._collection();
  51728. $ctx1.sendIdx["collection"]=1;
  51729. $1=$recv($2)._third();
  51730. self._assert_equals_($1,$recv(self._collection())._at_((3)));
  51731. return self;
  51732. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  51733. },
  51734. args: [],
  51735. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  51736. referencedClasses: [],
  51737. messageSends: ["assert:equals:", "third", "collection", "at:"]
  51738. }),
  51739. $globals.SequenceableCollectionTest);
  51740. $core.addClass('ArrayTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  51741. $core.addMethod(
  51742. $core.method({
  51743. selector: "collection",
  51744. protocol: 'fixture',
  51745. fn: function (){
  51746. var self=this;
  51747. return [(1), (2), (3), (-4)];
  51748. },
  51749. args: [],
  51750. source: "collection\x0a\x09^ #(1 2 3 -4)",
  51751. referencedClasses: [],
  51752. messageSends: []
  51753. }),
  51754. $globals.ArrayTest);
  51755. $core.addMethod(
  51756. $core.method({
  51757. selector: "collectionFirst",
  51758. protocol: 'fixture',
  51759. fn: function (){
  51760. var self=this;
  51761. return (1);
  51762. },
  51763. args: [],
  51764. source: "collectionFirst\x0a\x09^ 1",
  51765. referencedClasses: [],
  51766. messageSends: []
  51767. }),
  51768. $globals.ArrayTest);
  51769. $core.addMethod(
  51770. $core.method({
  51771. selector: "collectionFirstTwo",
  51772. protocol: 'fixture',
  51773. fn: function (){
  51774. var self=this;
  51775. return [(1), (2)];
  51776. },
  51777. args: [],
  51778. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  51779. referencedClasses: [],
  51780. messageSends: []
  51781. }),
  51782. $globals.ArrayTest);
  51783. $core.addMethod(
  51784. $core.method({
  51785. selector: "collectionLast",
  51786. protocol: 'fixture',
  51787. fn: function (){
  51788. var self=this;
  51789. return (-4);
  51790. },
  51791. args: [],
  51792. source: "collectionLast\x0a\x09^ -4",
  51793. referencedClasses: [],
  51794. messageSends: []
  51795. }),
  51796. $globals.ArrayTest);
  51797. $core.addMethod(
  51798. $core.method({
  51799. selector: "collectionLastTwo",
  51800. protocol: 'fixture',
  51801. fn: function (){
  51802. var self=this;
  51803. return [(3), (-4)];
  51804. },
  51805. args: [],
  51806. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  51807. referencedClasses: [],
  51808. messageSends: []
  51809. }),
  51810. $globals.ArrayTest);
  51811. $core.addMethod(
  51812. $core.method({
  51813. selector: "collectionOfPrintStrings",
  51814. protocol: 'fixture',
  51815. fn: function (){
  51816. var self=this;
  51817. return ["1", "2", "3", "-4"];
  51818. },
  51819. args: [],
  51820. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  51821. referencedClasses: [],
  51822. messageSends: []
  51823. }),
  51824. $globals.ArrayTest);
  51825. $core.addMethod(
  51826. $core.method({
  51827. selector: "collectionSize",
  51828. protocol: 'fixture',
  51829. fn: function (){
  51830. var self=this;
  51831. return (4);
  51832. },
  51833. args: [],
  51834. source: "collectionSize\x0a\x09^ 4",
  51835. referencedClasses: [],
  51836. messageSends: []
  51837. }),
  51838. $globals.ArrayTest);
  51839. $core.addMethod(
  51840. $core.method({
  51841. selector: "collectionWithDuplicates",
  51842. protocol: 'fixture',
  51843. fn: function (){
  51844. var self=this;
  51845. return ["a", "b", "c", (1), (2), (1), "a", []];
  51846. },
  51847. args: [],
  51848. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  51849. referencedClasses: [],
  51850. messageSends: []
  51851. }),
  51852. $globals.ArrayTest);
  51853. $core.addMethod(
  51854. $core.method({
  51855. selector: "collectionWithNewValue",
  51856. protocol: 'fixture',
  51857. fn: function (){
  51858. var self=this;
  51859. return [(1), (2), (3), (-4), "N"];
  51860. },
  51861. args: [],
  51862. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  51863. referencedClasses: [],
  51864. messageSends: []
  51865. }),
  51866. $globals.ArrayTest);
  51867. $core.addMethod(
  51868. $core.method({
  51869. selector: "sampleNewIndex",
  51870. protocol: 'fixture',
  51871. fn: function (){
  51872. var self=this;
  51873. return (5);
  51874. },
  51875. args: [],
  51876. source: "sampleNewIndex\x0a\x09^ 5",
  51877. referencedClasses: [],
  51878. messageSends: []
  51879. }),
  51880. $globals.ArrayTest);
  51881. $core.addMethod(
  51882. $core.method({
  51883. selector: "samplesDo:",
  51884. protocol: 'fixture',
  51885. fn: function (aBlock){
  51886. var self=this;
  51887. return $core.withContext(function($ctx1) {
  51888. (
  51889. $ctx1.supercall = true,
  51890. ($globals.ArrayTest.superclass||$boot.dnu).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  51891. $ctx1.supercall = false;
  51892. $recv(aBlock)._value_value_((3),(3));
  51893. return self;
  51894. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  51895. },
  51896. args: ["aBlock"],
  51897. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  51898. referencedClasses: [],
  51899. messageSends: ["samplesDo:", "value:value:"]
  51900. }),
  51901. $globals.ArrayTest);
  51902. $core.addMethod(
  51903. $core.method({
  51904. selector: "testAdd",
  51905. protocol: 'tests',
  51906. fn: function (){
  51907. var self=this;
  51908. var array;
  51909. return $core.withContext(function($ctx1) {
  51910. array=self._collection();
  51911. $recv(array)._add_((6));
  51912. self._assert_equals_($recv(array)._last(),(6));
  51913. return self;
  51914. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  51915. },
  51916. args: [],
  51917. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  51918. referencedClasses: [],
  51919. messageSends: ["collection", "add:", "assert:equals:", "last"]
  51920. }),
  51921. $globals.ArrayTest);
  51922. $core.addMethod(
  51923. $core.method({
  51924. selector: "testAddFirst",
  51925. protocol: 'tests',
  51926. fn: function (){
  51927. var self=this;
  51928. return $core.withContext(function($ctx1) {
  51929. var $3,$2,$1;
  51930. $3=self._collection();
  51931. $recv($3)._addFirst_((0));
  51932. $2=$recv($3)._yourself();
  51933. $1=$recv($2)._first();
  51934. self._assert_equals_($1,(0));
  51935. return self;
  51936. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  51937. },
  51938. args: [],
  51939. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  51940. referencedClasses: [],
  51941. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  51942. }),
  51943. $globals.ArrayTest);
  51944. $core.addMethod(
  51945. $core.method({
  51946. selector: "testPrintString",
  51947. protocol: 'tests',
  51948. fn: function (){
  51949. var self=this;
  51950. var array;
  51951. return $core.withContext(function($ctx1) {
  51952. var $1,$2,$3,$4,$5,$6,$7,$8;
  51953. array=$recv($globals.Array)._new();
  51954. $1=$recv(array)._printString();
  51955. $ctx1.sendIdx["printString"]=1;
  51956. self._assert_equals_($1,"an Array ()");
  51957. $ctx1.sendIdx["assert:equals:"]=1;
  51958. $2=array;
  51959. $recv($2)._add_((1));
  51960. $ctx1.sendIdx["add:"]=1;
  51961. $3=$recv($2)._add_((3));
  51962. $ctx1.sendIdx["add:"]=2;
  51963. $4=$recv(array)._printString();
  51964. $ctx1.sendIdx["printString"]=2;
  51965. self._assert_equals_($4,"an Array (1 3)");
  51966. $ctx1.sendIdx["assert:equals:"]=2;
  51967. $recv(array)._add_("foo");
  51968. $5=$recv(array)._printString();
  51969. $ctx1.sendIdx["printString"]=3;
  51970. self._assert_equals_($5,"an Array (1 3 'foo')");
  51971. $ctx1.sendIdx["assert:equals:"]=3;
  51972. $6=array;
  51973. $recv($6)._remove_((1));
  51974. $ctx1.sendIdx["remove:"]=1;
  51975. $recv($6)._remove_((3));
  51976. $7=$recv(array)._printString();
  51977. $ctx1.sendIdx["printString"]=4;
  51978. self._assert_equals_($7,"an Array ('foo')");
  51979. $ctx1.sendIdx["assert:equals:"]=4;
  51980. $recv(array)._addLast_((3));
  51981. $ctx1.sendIdx["addLast:"]=1;
  51982. $8=$recv(array)._printString();
  51983. $ctx1.sendIdx["printString"]=5;
  51984. self._assert_equals_($8,"an Array ('foo' 3)");
  51985. $ctx1.sendIdx["assert:equals:"]=5;
  51986. $recv(array)._addLast_((3));
  51987. self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  51988. return self;
  51989. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  51990. },
  51991. args: [],
  51992. 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)'.",
  51993. referencedClasses: ["Array"],
  51994. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  51995. }),
  51996. $globals.ArrayTest);
  51997. $core.addMethod(
  51998. $core.method({
  51999. selector: "testRemove",
  52000. protocol: 'tests',
  52001. fn: function (){
  52002. var self=this;
  52003. var array;
  52004. return $core.withContext(function($ctx1) {
  52005. array=[(1), (2), (3), (4), (5)];
  52006. $recv(array)._remove_((3));
  52007. $ctx1.sendIdx["remove:"]=1;
  52008. self._assert_equals_(array,[(1), (2), (4), (5)]);
  52009. self._should_raise_((function(){
  52010. return $core.withContext(function($ctx2) {
  52011. return $recv(array)._remove_((3));
  52012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52013. }),$globals.Error);
  52014. return self;
  52015. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  52016. },
  52017. args: [],
  52018. 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",
  52019. referencedClasses: ["Error"],
  52020. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  52021. }),
  52022. $globals.ArrayTest);
  52023. $core.addMethod(
  52024. $core.method({
  52025. selector: "testRemoveFromTo",
  52026. protocol: 'tests',
  52027. fn: function (){
  52028. var self=this;
  52029. return $core.withContext(function($ctx1) {
  52030. var $1,$2;
  52031. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  52032. $ctx1.sendIdx["removeFrom:to:"]=1;
  52033. self._assert_equals_($1,[(4)]);
  52034. $ctx1.sendIdx["assert:equals:"]=1;
  52035. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  52036. $ctx1.sendIdx["removeFrom:to:"]=2;
  52037. self._assert_equals_($2,[(1), (4)]);
  52038. $ctx1.sendIdx["assert:equals:"]=2;
  52039. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  52040. return self;
  52041. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  52042. },
  52043. args: [],
  52044. 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)",
  52045. referencedClasses: [],
  52046. messageSends: ["assert:equals:", "removeFrom:to:"]
  52047. }),
  52048. $globals.ArrayTest);
  52049. $core.addMethod(
  52050. $core.method({
  52051. selector: "testRemoveIndex",
  52052. protocol: 'tests',
  52053. fn: function (){
  52054. var self=this;
  52055. return $core.withContext(function($ctx1) {
  52056. var $1,$2;
  52057. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  52058. $ctx1.sendIdx["removeIndex:"]=1;
  52059. self._assert_equals_($1,[(1), (3), (4)]);
  52060. $ctx1.sendIdx["assert:equals:"]=1;
  52061. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  52062. $ctx1.sendIdx["removeIndex:"]=2;
  52063. self._assert_equals_($2,[(2), (3), (4)]);
  52064. $ctx1.sendIdx["assert:equals:"]=2;
  52065. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  52066. return self;
  52067. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  52068. },
  52069. args: [],
  52070. 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: #()",
  52071. referencedClasses: [],
  52072. messageSends: ["assert:equals:", "removeIndex:"]
  52073. }),
  52074. $globals.ArrayTest);
  52075. $core.addMethod(
  52076. $core.method({
  52077. selector: "testRemoveLast",
  52078. protocol: 'tests',
  52079. fn: function (){
  52080. var self=this;
  52081. var array;
  52082. return $core.withContext(function($ctx1) {
  52083. array=[(1), (2)];
  52084. $recv(array)._removeLast();
  52085. self._assert_equals_($recv(array)._last(),(1));
  52086. return self;
  52087. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  52088. },
  52089. args: [],
  52090. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  52091. referencedClasses: [],
  52092. messageSends: ["removeLast", "assert:equals:", "last"]
  52093. }),
  52094. $globals.ArrayTest);
  52095. $core.addMethod(
  52096. $core.method({
  52097. selector: "testReversed",
  52098. protocol: 'tests',
  52099. fn: function (){
  52100. var self=this;
  52101. var array;
  52102. return $core.withContext(function($ctx1) {
  52103. array=[(5), (4), (3), (2), (1)];
  52104. self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  52105. return self;
  52106. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  52107. },
  52108. args: [],
  52109. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  52110. referencedClasses: [],
  52111. messageSends: ["assert:equals:", "reversed"]
  52112. }),
  52113. $globals.ArrayTest);
  52114. $core.addMethod(
  52115. $core.method({
  52116. selector: "testSort",
  52117. protocol: 'tests',
  52118. fn: function (){
  52119. var self=this;
  52120. var array;
  52121. return $core.withContext(function($ctx1) {
  52122. array=[(10), (1), (5)];
  52123. $recv(array)._sort();
  52124. self._assert_equals_(array,[(1), (5), (10)]);
  52125. return self;
  52126. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  52127. },
  52128. args: [],
  52129. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  52130. referencedClasses: [],
  52131. messageSends: ["sort", "assert:equals:"]
  52132. }),
  52133. $globals.ArrayTest);
  52134. $core.addMethod(
  52135. $core.method({
  52136. selector: "collectionClass",
  52137. protocol: 'fixture',
  52138. fn: function (){
  52139. var self=this;
  52140. return $globals.Array;
  52141. },
  52142. args: [],
  52143. source: "collectionClass\x0a\x09^ Array",
  52144. referencedClasses: ["Array"],
  52145. messageSends: []
  52146. }),
  52147. $globals.ArrayTest.klass);
  52148. $core.addClass('StringTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  52149. $core.addMethod(
  52150. $core.method({
  52151. selector: "collection",
  52152. protocol: 'fixture',
  52153. fn: function (){
  52154. var self=this;
  52155. return "helLo";
  52156. },
  52157. args: [],
  52158. source: "collection\x0a\x09^ 'helLo'",
  52159. referencedClasses: [],
  52160. messageSends: []
  52161. }),
  52162. $globals.StringTest);
  52163. $core.addMethod(
  52164. $core.method({
  52165. selector: "collectionFirst",
  52166. protocol: 'fixture',
  52167. fn: function (){
  52168. var self=this;
  52169. return "h";
  52170. },
  52171. args: [],
  52172. source: "collectionFirst\x0a\x09^ 'h'",
  52173. referencedClasses: [],
  52174. messageSends: []
  52175. }),
  52176. $globals.StringTest);
  52177. $core.addMethod(
  52178. $core.method({
  52179. selector: "collectionFirstTwo",
  52180. protocol: 'fixture',
  52181. fn: function (){
  52182. var self=this;
  52183. return "he";
  52184. },
  52185. args: [],
  52186. source: "collectionFirstTwo\x0a\x09^ 'he'",
  52187. referencedClasses: [],
  52188. messageSends: []
  52189. }),
  52190. $globals.StringTest);
  52191. $core.addMethod(
  52192. $core.method({
  52193. selector: "collectionLast",
  52194. protocol: 'fixture',
  52195. fn: function (){
  52196. var self=this;
  52197. return "o";
  52198. },
  52199. args: [],
  52200. source: "collectionLast\x0a\x09^ 'o'",
  52201. referencedClasses: [],
  52202. messageSends: []
  52203. }),
  52204. $globals.StringTest);
  52205. $core.addMethod(
  52206. $core.method({
  52207. selector: "collectionLastTwo",
  52208. protocol: 'fixture',
  52209. fn: function (){
  52210. var self=this;
  52211. return "Lo";
  52212. },
  52213. args: [],
  52214. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  52215. referencedClasses: [],
  52216. messageSends: []
  52217. }),
  52218. $globals.StringTest);
  52219. $core.addMethod(
  52220. $core.method({
  52221. selector: "collectionOfPrintStrings",
  52222. protocol: 'fixture',
  52223. fn: function (){
  52224. var self=this;
  52225. return "'h''e''l''L''o'";
  52226. },
  52227. args: [],
  52228. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  52229. referencedClasses: [],
  52230. messageSends: []
  52231. }),
  52232. $globals.StringTest);
  52233. $core.addMethod(
  52234. $core.method({
  52235. selector: "collectionSize",
  52236. protocol: 'fixture',
  52237. fn: function (){
  52238. var self=this;
  52239. return (5);
  52240. },
  52241. args: [],
  52242. source: "collectionSize\x0a\x09^ 5",
  52243. referencedClasses: [],
  52244. messageSends: []
  52245. }),
  52246. $globals.StringTest);
  52247. $core.addMethod(
  52248. $core.method({
  52249. selector: "collectionWithDuplicates",
  52250. protocol: 'fixture',
  52251. fn: function (){
  52252. var self=this;
  52253. return "abbaerten";
  52254. },
  52255. args: [],
  52256. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  52257. referencedClasses: [],
  52258. messageSends: []
  52259. }),
  52260. $globals.StringTest);
  52261. $core.addMethod(
  52262. $core.method({
  52263. selector: "collectionWithNewValue",
  52264. protocol: 'fixture',
  52265. fn: function (){
  52266. var self=this;
  52267. return "helLoN";
  52268. },
  52269. args: [],
  52270. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  52271. referencedClasses: [],
  52272. messageSends: []
  52273. }),
  52274. $globals.StringTest);
  52275. $core.addMethod(
  52276. $core.method({
  52277. selector: "sampleNewValueAsCollection",
  52278. protocol: 'fixture',
  52279. fn: function (){
  52280. var self=this;
  52281. return "N";
  52282. },
  52283. args: [],
  52284. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  52285. referencedClasses: [],
  52286. messageSends: []
  52287. }),
  52288. $globals.StringTest);
  52289. $core.addMethod(
  52290. $core.method({
  52291. selector: "samplesDo:",
  52292. protocol: 'fixture',
  52293. fn: function (aBlock){
  52294. var self=this;
  52295. return $core.withContext(function($ctx1) {
  52296. (
  52297. $ctx1.supercall = true,
  52298. ($globals.StringTest.superclass||$boot.dnu).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  52299. $ctx1.supercall = false;
  52300. $recv(aBlock)._value_value_((3),"l");
  52301. return self;
  52302. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  52303. },
  52304. args: ["aBlock"],
  52305. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  52306. referencedClasses: [],
  52307. messageSends: ["samplesDo:", "value:value:"]
  52308. }),
  52309. $globals.StringTest);
  52310. $core.addMethod(
  52311. $core.method({
  52312. selector: "testAddAll",
  52313. protocol: 'tests',
  52314. fn: function (){
  52315. var self=this;
  52316. return $core.withContext(function($ctx1) {
  52317. var $1;
  52318. self._should_raise_((function(){
  52319. return $core.withContext(function($ctx2) {
  52320. $1=self._collection();
  52321. $ctx2.sendIdx["collection"]=1;
  52322. return $recv($1)._addAll_(self._collection());
  52323. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52324. }),$globals.Error);
  52325. return self;
  52326. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  52327. },
  52328. args: [],
  52329. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  52330. referencedClasses: ["Error"],
  52331. messageSends: ["should:raise:", "addAll:", "collection"]
  52332. }),
  52333. $globals.StringTest);
  52334. $core.addMethod(
  52335. $core.method({
  52336. selector: "testAddRemove",
  52337. protocol: 'tests',
  52338. fn: function (){
  52339. var self=this;
  52340. return $core.withContext(function($ctx1) {
  52341. self._should_raise_((function(){
  52342. return $core.withContext(function($ctx2) {
  52343. return "hello"._add_("a");
  52344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52345. }),$globals.Error);
  52346. $ctx1.sendIdx["should:raise:"]=1;
  52347. self._should_raise_((function(){
  52348. return $core.withContext(function($ctx2) {
  52349. return "hello"._remove_("h");
  52350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  52351. }),$globals.Error);
  52352. return self;
  52353. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  52354. },
  52355. args: [],
  52356. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  52357. referencedClasses: ["Error"],
  52358. messageSends: ["should:raise:", "add:", "remove:"]
  52359. }),
  52360. $globals.StringTest);
  52361. $core.addMethod(
  52362. $core.method({
  52363. selector: "testAsArray",
  52364. protocol: 'tests',
  52365. fn: function (){
  52366. var self=this;
  52367. return $core.withContext(function($ctx1) {
  52368. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  52369. return self;
  52370. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  52371. },
  52372. args: [],
  52373. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  52374. referencedClasses: [],
  52375. messageSends: ["assert:equals:", "asArray"]
  52376. }),
  52377. $globals.StringTest);
  52378. $core.addMethod(
  52379. $core.method({
  52380. selector: "testAsLowerCase",
  52381. protocol: 'tests',
  52382. fn: function (){
  52383. var self=this;
  52384. return $core.withContext(function($ctx1) {
  52385. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  52386. return self;
  52387. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  52388. },
  52389. args: [],
  52390. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  52391. referencedClasses: [],
  52392. messageSends: ["assert:equals:", "asLowercase"]
  52393. }),
  52394. $globals.StringTest);
  52395. $core.addMethod(
  52396. $core.method({
  52397. selector: "testAsNumber",
  52398. protocol: 'tests',
  52399. fn: function (){
  52400. var self=this;
  52401. return $core.withContext(function($ctx1) {
  52402. var $1,$2;
  52403. $1="3"._asNumber();
  52404. $ctx1.sendIdx["asNumber"]=1;
  52405. self._assert_equals_($1,(3));
  52406. $ctx1.sendIdx["assert:equals:"]=1;
  52407. $2="-3"._asNumber();
  52408. $ctx1.sendIdx["asNumber"]=2;
  52409. self._assert_equals_($2,(-3));
  52410. $ctx1.sendIdx["assert:equals:"]=2;
  52411. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  52412. return self;
  52413. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  52414. },
  52415. args: [],
  52416. 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.",
  52417. referencedClasses: [],
  52418. messageSends: ["assert:equals:", "asNumber"]
  52419. }),
  52420. $globals.StringTest);
  52421. $core.addMethod(
  52422. $core.method({
  52423. selector: "testAsUpperCase",
  52424. protocol: 'tests',
  52425. fn: function (){
  52426. var self=this;
  52427. return $core.withContext(function($ctx1) {
  52428. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  52429. return self;
  52430. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  52431. },
  52432. args: [],
  52433. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  52434. referencedClasses: [],
  52435. messageSends: ["assert:equals:", "asUppercase"]
  52436. }),
  52437. $globals.StringTest);
  52438. $core.addMethod(
  52439. $core.method({
  52440. selector: "testAsciiValue",
  52441. protocol: 'tests',
  52442. fn: function (){
  52443. var self=this;
  52444. var characterA,characterU;
  52445. return $core.withContext(function($ctx1) {
  52446. var $1;
  52447. characterA="A";
  52448. characterU="U";
  52449. $1=$recv(characterA)._asciiValue();
  52450. $ctx1.sendIdx["asciiValue"]=1;
  52451. self._assert_equals_($1,(65));
  52452. $ctx1.sendIdx["assert:equals:"]=1;
  52453. self._assert_equals_($recv(characterU)._asciiValue(),(85));
  52454. return self;
  52455. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  52456. },
  52457. args: [],
  52458. 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",
  52459. referencedClasses: [],
  52460. messageSends: ["assert:equals:", "asciiValue"]
  52461. }),
  52462. $globals.StringTest);
  52463. $core.addMethod(
  52464. $core.method({
  52465. selector: "testAtIfAbsentPut",
  52466. protocol: 'tests',
  52467. fn: function (){
  52468. var self=this;
  52469. return $core.withContext(function($ctx1) {
  52470. self._should_raise_((function(){
  52471. return $core.withContext(function($ctx2) {
  52472. return "hello"._at_ifAbsentPut_((6),(function(){
  52473. return "a";
  52474. }));
  52475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52476. }),$globals.Error);
  52477. return self;
  52478. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  52479. },
  52480. args: [],
  52481. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  52482. referencedClasses: ["Error"],
  52483. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  52484. }),
  52485. $globals.StringTest);
  52486. $core.addMethod(
  52487. $core.method({
  52488. selector: "testAtPut",
  52489. protocol: 'tests',
  52490. fn: function (){
  52491. var self=this;
  52492. return $core.withContext(function($ctx1) {
  52493. self._should_raise_((function(){
  52494. return $core.withContext(function($ctx2) {
  52495. return "hello"._at_put_((1),"a");
  52496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52497. }),$globals.Error);
  52498. return self;
  52499. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  52500. },
  52501. args: [],
  52502. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  52503. referencedClasses: ["Error"],
  52504. messageSends: ["should:raise:", "at:put:"]
  52505. }),
  52506. $globals.StringTest);
  52507. $core.addMethod(
  52508. $core.method({
  52509. selector: "testCapitalized",
  52510. protocol: 'tests',
  52511. fn: function (){
  52512. var self=this;
  52513. return $core.withContext(function($ctx1) {
  52514. var $1,$2,$3;
  52515. $1="test"._capitalized();
  52516. $ctx1.sendIdx["capitalized"]=1;
  52517. self._assert_equals_($1,"Test");
  52518. $ctx1.sendIdx["assert:equals:"]=1;
  52519. $2="Test"._capitalized();
  52520. $ctx1.sendIdx["capitalized"]=2;
  52521. self._assert_equals_($2,"Test");
  52522. $ctx1.sendIdx["assert:equals:"]=2;
  52523. self._assert_equals_(""._capitalized(),"");
  52524. $ctx1.sendIdx["assert:equals:"]=3;
  52525. $3="Test"._isCapitalized();
  52526. $ctx1.sendIdx["isCapitalized"]=1;
  52527. self._assert_equals_($3,true);
  52528. $ctx1.sendIdx["assert:equals:"]=4;
  52529. self._assert_equals_("test"._isCapitalized(),false);
  52530. return self;
  52531. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  52532. },
  52533. args: [],
  52534. 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.",
  52535. referencedClasses: [],
  52536. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  52537. }),
  52538. $globals.StringTest);
  52539. $core.addMethod(
  52540. $core.method({
  52541. selector: "testCharCodeAt",
  52542. protocol: 'tests',
  52543. fn: function (){
  52544. var self=this;
  52545. return $core.withContext(function($ctx1) {
  52546. var $1,$2,$3,$4,$5;
  52547. $1="jackie"._charCodeAt_((1));
  52548. $ctx1.sendIdx["charCodeAt:"]=1;
  52549. self._assert_equals_($1,(106));
  52550. $ctx1.sendIdx["assert:equals:"]=1;
  52551. $2="jackie"._charCodeAt_((2));
  52552. $ctx1.sendIdx["charCodeAt:"]=2;
  52553. self._assert_equals_($2,(97));
  52554. $ctx1.sendIdx["assert:equals:"]=2;
  52555. $3="jackie"._charCodeAt_((3));
  52556. $ctx1.sendIdx["charCodeAt:"]=3;
  52557. self._assert_equals_($3,(99));
  52558. $ctx1.sendIdx["assert:equals:"]=3;
  52559. $4="jackie"._charCodeAt_((4));
  52560. $ctx1.sendIdx["charCodeAt:"]=4;
  52561. self._assert_equals_($4,(107));
  52562. $ctx1.sendIdx["assert:equals:"]=4;
  52563. $5="jackie"._charCodeAt_((5));
  52564. $ctx1.sendIdx["charCodeAt:"]=5;
  52565. self._assert_equals_($5,(105));
  52566. $ctx1.sendIdx["assert:equals:"]=5;
  52567. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  52568. return self;
  52569. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  52570. },
  52571. args: [],
  52572. 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",
  52573. referencedClasses: [],
  52574. messageSends: ["assert:equals:", "charCodeAt:"]
  52575. }),
  52576. $globals.StringTest);
  52577. $core.addMethod(
  52578. $core.method({
  52579. selector: "testCopyFromTo",
  52580. protocol: 'tests',
  52581. fn: function (){
  52582. var self=this;
  52583. return $core.withContext(function($ctx1) {
  52584. var $1;
  52585. $1="jackie"._copyFrom_to_((1),(3));
  52586. $ctx1.sendIdx["copyFrom:to:"]=1;
  52587. self._assert_equals_($1,"jac");
  52588. $ctx1.sendIdx["assert:equals:"]=1;
  52589. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  52590. return self;
  52591. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  52592. },
  52593. args: [],
  52594. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  52595. referencedClasses: [],
  52596. messageSends: ["assert:equals:", "copyFrom:to:"]
  52597. }),
  52598. $globals.StringTest);
  52599. $core.addMethod(
  52600. $core.method({
  52601. selector: "testCopySeparates",
  52602. protocol: 'tests',
  52603. fn: function (){
  52604. var self=this;
  52605. return $core.withContext(function($ctx1) {
  52606. var $3,$2,$1;
  52607. $3=self._collection();
  52608. $ctx1.sendIdx["collection"]=1;
  52609. $2=$recv($3)._copy();
  52610. $1=$recv($2).__eq_eq(self._collection());
  52611. self._assert_($1);
  52612. return self;
  52613. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  52614. },
  52615. args: [],
  52616. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  52617. referencedClasses: [],
  52618. messageSends: ["assert:", "==", "copy", "collection"]
  52619. }),
  52620. $globals.StringTest);
  52621. $core.addMethod(
  52622. $core.method({
  52623. selector: "testCopyWithoutAll",
  52624. protocol: 'tests',
  52625. fn: function (){
  52626. var self=this;
  52627. return $core.withContext(function($ctx1) {
  52628. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  52629. return self;
  52630. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  52631. },
  52632. args: [],
  52633. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  52634. referencedClasses: [],
  52635. messageSends: ["assert:equals:", "copyWithoutAll:"]
  52636. }),
  52637. $globals.StringTest);
  52638. $core.addMethod(
  52639. $core.method({
  52640. selector: "testEquality",
  52641. protocol: 'tests',
  52642. fn: function (){
  52643. var self=this;
  52644. return $core.withContext(function($ctx1) {
  52645. var $1,$2,$3;
  52646. self._assert_equals_("hello","hello");
  52647. $ctx1.sendIdx["assert:equals:"]=1;
  52648. $1="hello".__eq("world");
  52649. $ctx1.sendIdx["="]=1;
  52650. self._deny_($1);
  52651. $ctx1.sendIdx["deny:"]=1;
  52652. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  52653. })));
  52654. $ctx1.sendIdx["="]=2;
  52655. self._deny_($2);
  52656. $ctx1.sendIdx["deny:"]=2;
  52657. $3="hello"._yourself();
  52658. $ctx1.sendIdx["yourself"]=1;
  52659. self._assert_equals_("hello",$3);
  52660. $ctx1.sendIdx["assert:equals:"]=2;
  52661. self._assert_equals_("hello"._yourself(),"hello");
  52662. self._deny_("".__eq((0)));
  52663. return self;
  52664. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  52665. },
  52666. args: [],
  52667. 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",
  52668. referencedClasses: [],
  52669. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  52670. }),
  52671. $globals.StringTest);
  52672. $core.addMethod(
  52673. $core.method({
  52674. selector: "testIdentity",
  52675. protocol: 'tests',
  52676. fn: function (){
  52677. var self=this;
  52678. return $core.withContext(function($ctx1) {
  52679. var $1,$2,$4,$3,$5;
  52680. $1="hello".__eq_eq("hello");
  52681. $ctx1.sendIdx["=="]=1;
  52682. self._assert_($1);
  52683. $ctx1.sendIdx["assert:"]=1;
  52684. $2="hello".__eq_eq("world");
  52685. $ctx1.sendIdx["=="]=2;
  52686. self._deny_($2);
  52687. $ctx1.sendIdx["deny:"]=1;
  52688. $4="hello"._yourself();
  52689. $ctx1.sendIdx["yourself"]=1;
  52690. $3="hello".__eq_eq($4);
  52691. $ctx1.sendIdx["=="]=3;
  52692. self._assert_($3);
  52693. $ctx1.sendIdx["assert:"]=2;
  52694. $5=$recv("hello"._yourself()).__eq_eq("hello");
  52695. $ctx1.sendIdx["=="]=4;
  52696. self._assert_($5);
  52697. self._deny_("".__eq_eq((0)));
  52698. return self;
  52699. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  52700. },
  52701. args: [],
  52702. 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",
  52703. referencedClasses: [],
  52704. messageSends: ["assert:", "==", "deny:", "yourself"]
  52705. }),
  52706. $globals.StringTest);
  52707. $core.addMethod(
  52708. $core.method({
  52709. selector: "testIncludesSubString",
  52710. protocol: 'tests',
  52711. fn: function (){
  52712. var self=this;
  52713. return $core.withContext(function($ctx1) {
  52714. var $1;
  52715. $1="amber"._includesSubString_("ber");
  52716. $ctx1.sendIdx["includesSubString:"]=1;
  52717. self._assert_($1);
  52718. self._deny_("amber"._includesSubString_("zork"));
  52719. return self;
  52720. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  52721. },
  52722. args: [],
  52723. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  52724. referencedClasses: [],
  52725. messageSends: ["assert:", "includesSubString:", "deny:"]
  52726. }),
  52727. $globals.StringTest);
  52728. $core.addMethod(
  52729. $core.method({
  52730. selector: "testIndexOfStartingAtWithNull",
  52731. protocol: 'tests',
  52732. fn: function (){
  52733. var self=this;
  52734. return self;
  52735. },
  52736. args: [],
  52737. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  52738. referencedClasses: [],
  52739. messageSends: []
  52740. }),
  52741. $globals.StringTest);
  52742. $core.addMethod(
  52743. $core.method({
  52744. selector: "testIndexOfWithNull",
  52745. protocol: 'tests',
  52746. fn: function (){
  52747. var self=this;
  52748. return self;
  52749. },
  52750. args: [],
  52751. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  52752. referencedClasses: [],
  52753. messageSends: []
  52754. }),
  52755. $globals.StringTest);
  52756. $core.addMethod(
  52757. $core.method({
  52758. selector: "testIsVowel",
  52759. protocol: 'tests',
  52760. fn: function (){
  52761. var self=this;
  52762. var vowel,consonant;
  52763. return $core.withContext(function($ctx1) {
  52764. var $1;
  52765. vowel="u";
  52766. consonant="z";
  52767. $1=$recv(vowel)._isVowel();
  52768. $ctx1.sendIdx["isVowel"]=1;
  52769. self._assert_equals_($1,true);
  52770. $ctx1.sendIdx["assert:equals:"]=1;
  52771. self._assert_equals_($recv(consonant)._isVowel(),false);
  52772. return self;
  52773. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  52774. },
  52775. args: [],
  52776. 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",
  52777. referencedClasses: [],
  52778. messageSends: ["assert:equals:", "isVowel"]
  52779. }),
  52780. $globals.StringTest);
  52781. $core.addMethod(
  52782. $core.method({
  52783. selector: "testJoin",
  52784. protocol: 'tests',
  52785. fn: function (){
  52786. var self=this;
  52787. return $core.withContext(function($ctx1) {
  52788. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  52789. return self;
  52790. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  52791. },
  52792. args: [],
  52793. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  52794. referencedClasses: [],
  52795. messageSends: ["assert:equals:", "join:"]
  52796. }),
  52797. $globals.StringTest);
  52798. $core.addMethod(
  52799. $core.method({
  52800. selector: "testRemoveAll",
  52801. protocol: 'tests',
  52802. fn: function (){
  52803. var self=this;
  52804. return $core.withContext(function($ctx1) {
  52805. self._should_raise_((function(){
  52806. return $core.withContext(function($ctx2) {
  52807. return $recv(self._collection())._removeAll();
  52808. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52809. }),$globals.Error);
  52810. return self;
  52811. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  52812. },
  52813. args: [],
  52814. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  52815. referencedClasses: ["Error"],
  52816. messageSends: ["should:raise:", "removeAll", "collection"]
  52817. }),
  52818. $globals.StringTest);
  52819. $core.addMethod(
  52820. $core.method({
  52821. selector: "testReversed",
  52822. protocol: 'tests',
  52823. fn: function (){
  52824. var self=this;
  52825. return $core.withContext(function($ctx1) {
  52826. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  52827. return self;
  52828. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  52829. },
  52830. args: [],
  52831. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  52832. referencedClasses: [],
  52833. messageSends: ["assert:equals:", "reversed"]
  52834. }),
  52835. $globals.StringTest);
  52836. $core.addMethod(
  52837. $core.method({
  52838. selector: "testStreamContents",
  52839. protocol: 'tests',
  52840. fn: function (){
  52841. var self=this;
  52842. return $core.withContext(function($ctx1) {
  52843. self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  52844. return $core.withContext(function($ctx2) {
  52845. $recv(aStream)._nextPutAll_("hello");
  52846. $ctx2.sendIdx["nextPutAll:"]=1;
  52847. $recv(aStream)._space();
  52848. return $recv(aStream)._nextPutAll_("world");
  52849. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  52850. })),"hello world");
  52851. return self;
  52852. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  52853. },
  52854. args: [],
  52855. 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'",
  52856. referencedClasses: ["String"],
  52857. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  52858. }),
  52859. $globals.StringTest);
  52860. $core.addMethod(
  52861. $core.method({
  52862. selector: "testSubStrings",
  52863. protocol: 'tests',
  52864. fn: function (){
  52865. var self=this;
  52866. return $core.withContext(function($ctx1) {
  52867. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  52868. return self;
  52869. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  52870. },
  52871. args: [],
  52872. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  52873. referencedClasses: [],
  52874. messageSends: ["assert:equals:", "subStrings:"]
  52875. }),
  52876. $globals.StringTest);
  52877. $core.addMethod(
  52878. $core.method({
  52879. selector: "testTrim",
  52880. protocol: 'tests',
  52881. fn: function (){
  52882. var self=this;
  52883. return $core.withContext(function($ctx1) {
  52884. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  52885. $ctx1.sendIdx["assert:equals:"]=1;
  52886. self._assert_equals_("jackie "._trimRight(),"jackie");
  52887. return self;
  52888. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  52889. },
  52890. args: [],
  52891. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  52892. referencedClasses: [],
  52893. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  52894. }),
  52895. $globals.StringTest);
  52896. $core.addMethod(
  52897. $core.method({
  52898. selector: "testValue",
  52899. protocol: 'tests',
  52900. fn: function (){
  52901. var self=this;
  52902. return $core.withContext(function($ctx1) {
  52903. self._assert_equals_("asString"._value_((1)),"1");
  52904. $ctx1.sendIdx["assert:equals:"]=1;
  52905. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  52906. return self;
  52907. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  52908. },
  52909. args: [],
  52910. 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')",
  52911. referencedClasses: [],
  52912. messageSends: ["assert:equals:", "value:", "collect:"]
  52913. }),
  52914. $globals.StringTest);
  52915. $core.addMethod(
  52916. $core.method({
  52917. selector: "collectionClass",
  52918. protocol: 'fixture',
  52919. fn: function (){
  52920. var self=this;
  52921. return $globals.String;
  52922. },
  52923. args: [],
  52924. source: "collectionClass\x0a\x09^ String",
  52925. referencedClasses: ["String"],
  52926. messageSends: []
  52927. }),
  52928. $globals.StringTest.klass);
  52929. $core.addClass('SetTest', $globals.CollectionTest, [], 'Kernel-Tests');
  52930. $core.addMethod(
  52931. $core.method({
  52932. selector: "collection",
  52933. protocol: 'fixture',
  52934. fn: function (){
  52935. var self=this;
  52936. return $core.withContext(function($ctx1) {
  52937. var $1;
  52938. $1=$recv($globals.Set)._new();
  52939. $recv($1)._add_($globals.Smalltalk);
  52940. $ctx1.sendIdx["add:"]=1;
  52941. $recv($1)._add_(nil);
  52942. $ctx1.sendIdx["add:"]=2;
  52943. $recv($1)._add_((3).__at((3)));
  52944. $ctx1.sendIdx["add:"]=3;
  52945. $recv($1)._add_(false);
  52946. $ctx1.sendIdx["add:"]=4;
  52947. $recv($1)._add_(self["@sampleBlock"]);
  52948. return $recv($1)._yourself();
  52949. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  52950. },
  52951. args: [],
  52952. 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",
  52953. referencedClasses: ["Set", "Smalltalk"],
  52954. messageSends: ["add:", "new", "@", "yourself"]
  52955. }),
  52956. $globals.SetTest);
  52957. $core.addMethod(
  52958. $core.method({
  52959. selector: "collectionOfPrintStrings",
  52960. protocol: 'fixture',
  52961. fn: function (){
  52962. var self=this;
  52963. return $core.withContext(function($ctx1) {
  52964. var $1;
  52965. $1=$recv($globals.Set)._new();
  52966. $recv($1)._add_("a SmalltalkImage");
  52967. $ctx1.sendIdx["add:"]=1;
  52968. $recv($1)._add_("nil");
  52969. $ctx1.sendIdx["add:"]=2;
  52970. $recv($1)._add_("3@3");
  52971. $ctx1.sendIdx["add:"]=3;
  52972. $recv($1)._add_("false");
  52973. $ctx1.sendIdx["add:"]=4;
  52974. $recv($1)._add_("a BlockClosure");
  52975. return $recv($1)._yourself();
  52976. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  52977. },
  52978. args: [],
  52979. 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",
  52980. referencedClasses: ["Set"],
  52981. messageSends: ["add:", "new", "yourself"]
  52982. }),
  52983. $globals.SetTest);
  52984. $core.addMethod(
  52985. $core.method({
  52986. selector: "collectionSize",
  52987. protocol: 'fixture',
  52988. fn: function (){
  52989. var self=this;
  52990. return (5);
  52991. },
  52992. args: [],
  52993. source: "collectionSize\x0a\x09^ 5",
  52994. referencedClasses: [],
  52995. messageSends: []
  52996. }),
  52997. $globals.SetTest);
  52998. $core.addMethod(
  52999. $core.method({
  53000. selector: "collectionWithDuplicates",
  53001. protocol: 'fixture',
  53002. fn: function (){
  53003. var self=this;
  53004. return $core.withContext(function($ctx1) {
  53005. var $1;
  53006. $1=self._collection();
  53007. $recv($1)._add_((0));
  53008. return $recv($1)._yourself();
  53009. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  53010. },
  53011. args: [],
  53012. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  53013. referencedClasses: [],
  53014. messageSends: ["add:", "collection", "yourself"]
  53015. }),
  53016. $globals.SetTest);
  53017. $core.addMethod(
  53018. $core.method({
  53019. selector: "collectionWithNewValue",
  53020. protocol: 'fixture',
  53021. fn: function (){
  53022. var self=this;
  53023. return $core.withContext(function($ctx1) {
  53024. var $1;
  53025. $1=$recv($globals.Set)._new();
  53026. $recv($1)._add_($globals.Smalltalk);
  53027. $ctx1.sendIdx["add:"]=1;
  53028. $recv($1)._add_(nil);
  53029. $ctx1.sendIdx["add:"]=2;
  53030. $recv($1)._add_((3).__at((3)));
  53031. $ctx1.sendIdx["add:"]=3;
  53032. $recv($1)._add_("N");
  53033. $ctx1.sendIdx["add:"]=4;
  53034. $recv($1)._add_(false);
  53035. $ctx1.sendIdx["add:"]=5;
  53036. $recv($1)._add_(self["@sampleBlock"]);
  53037. return $recv($1)._yourself();
  53038. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  53039. },
  53040. args: [],
  53041. 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",
  53042. referencedClasses: ["Set", "Smalltalk"],
  53043. messageSends: ["add:", "new", "@", "yourself"]
  53044. }),
  53045. $globals.SetTest);
  53046. $core.addMethod(
  53047. $core.method({
  53048. selector: "testAddAll",
  53049. protocol: 'tests',
  53050. fn: function (){
  53051. var self=this;
  53052. return $core.withContext(function($ctx1) {
  53053. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  53054. (
  53055. $ctx1.supercall = true,
  53056. ($globals.SetTest.superclass||$boot.dnu).fn.prototype._testAddAll.apply($recv(self), []));
  53057. $ctx1.supercall = false;
  53058. $2=self._collection();
  53059. $ctx1.sendIdx["collection"]=1;
  53060. $3=self._collection();
  53061. $ctx1.sendIdx["collection"]=2;
  53062. $recv($2)._addAll_($3);
  53063. $ctx1.sendIdx["addAll:"]=1;
  53064. $4=$recv($2)._yourself();
  53065. $ctx1.sendIdx["yourself"]=1;
  53066. $1=$4;
  53067. $5=self._collection();
  53068. $ctx1.sendIdx["collection"]=3;
  53069. self._assert_equals_($1,$5);
  53070. $ctx1.sendIdx["assert:equals:"]=1;
  53071. $7=self._collection();
  53072. $ctx1.sendIdx["collection"]=4;
  53073. $8=self._collectionWithNewValue();
  53074. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53075. $recv($7)._addAll_($8);
  53076. $ctx1.sendIdx["addAll:"]=2;
  53077. $9=$recv($7)._yourself();
  53078. $ctx1.sendIdx["yourself"]=2;
  53079. $6=$9;
  53080. $10=self._collectionWithNewValue();
  53081. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53082. self._assert_equals_($6,$10);
  53083. $ctx1.sendIdx["assert:equals:"]=2;
  53084. $12=self._collectionWithNewValue();
  53085. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53086. $recv($12)._addAll_(self._collection());
  53087. $11=$recv($12)._yourself();
  53088. self._assert_equals_($11,self._collectionWithNewValue());
  53089. return self;
  53090. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  53091. },
  53092. args: [],
  53093. 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",
  53094. referencedClasses: [],
  53095. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  53096. }),
  53097. $globals.SetTest);
  53098. $core.addMethod(
  53099. $core.method({
  53100. selector: "testAddRemove",
  53101. protocol: 'tests',
  53102. fn: function (){
  53103. var self=this;
  53104. var set;
  53105. return $core.withContext(function($ctx1) {
  53106. var $1,$2;
  53107. set=$recv($globals.Set)._new();
  53108. self._assert_($recv(set)._isEmpty());
  53109. $ctx1.sendIdx["assert:"]=1;
  53110. $recv(set)._add_((3));
  53111. $ctx1.sendIdx["add:"]=1;
  53112. $1=$recv(set)._includes_((3));
  53113. $ctx1.sendIdx["includes:"]=1;
  53114. self._assert_($1);
  53115. $ctx1.sendIdx["assert:"]=2;
  53116. $recv(set)._add_((5));
  53117. $2=$recv(set)._includes_((5));
  53118. $ctx1.sendIdx["includes:"]=2;
  53119. self._assert_($2);
  53120. $recv(set)._remove_((3));
  53121. self._deny_($recv(set)._includes_((3)));
  53122. return self;
  53123. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  53124. },
  53125. args: [],
  53126. 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)",
  53127. referencedClasses: ["Set"],
  53128. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  53129. }),
  53130. $globals.SetTest);
  53131. $core.addMethod(
  53132. $core.method({
  53133. selector: "testAt",
  53134. protocol: 'tests',
  53135. fn: function (){
  53136. var self=this;
  53137. return $core.withContext(function($ctx1) {
  53138. self._should_raise_((function(){
  53139. return $core.withContext(function($ctx2) {
  53140. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  53141. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53142. }),$globals.Error);
  53143. return self;
  53144. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  53145. },
  53146. args: [],
  53147. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  53148. referencedClasses: ["Set", "Error"],
  53149. messageSends: ["should:raise:", "at:put:", "new"]
  53150. }),
  53151. $globals.SetTest);
  53152. $core.addMethod(
  53153. $core.method({
  53154. selector: "testCollect",
  53155. protocol: 'tests',
  53156. fn: function (){
  53157. var self=this;
  53158. return $core.withContext(function($ctx1) {
  53159. var $2,$1;
  53160. (
  53161. $ctx1.supercall = true,
  53162. ($globals.SetTest.superclass||$boot.dnu).fn.prototype._testCollect.apply($recv(self), []));
  53163. $ctx1.supercall = false;
  53164. $2=[(5), (6), (8)]._asSet();
  53165. $ctx1.sendIdx["asSet"]=1;
  53166. $1=$recv($2)._collect_((function(x){
  53167. return $core.withContext(function($ctx2) {
  53168. return $recv(x).__backslash_backslash((3));
  53169. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53170. }));
  53171. self._assert_equals_($1,[(0), (2)]._asSet());
  53172. return self;
  53173. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  53174. },
  53175. args: [],
  53176. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  53177. referencedClasses: [],
  53178. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  53179. }),
  53180. $globals.SetTest);
  53181. $core.addMethod(
  53182. $core.method({
  53183. selector: "testComma",
  53184. protocol: 'tests',
  53185. fn: function (){
  53186. var self=this;
  53187. return $core.withContext(function($ctx1) {
  53188. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  53189. (
  53190. $ctx1.supercall = true,
  53191. ($globals.SetTest.superclass||$boot.dnu).fn.prototype._testComma.apply($recv(self), []));
  53192. $ctx1.supercall = false;
  53193. $2=self._collection();
  53194. $ctx1.sendIdx["collection"]=1;
  53195. $3=self._collection();
  53196. $ctx1.sendIdx["collection"]=2;
  53197. $1=$recv($2).__comma($3);
  53198. $ctx1.sendIdx[","]=1;
  53199. $4=self._collection();
  53200. $ctx1.sendIdx["collection"]=3;
  53201. self._assert_equals_($1,$4);
  53202. $ctx1.sendIdx["assert:equals:"]=1;
  53203. $6=self._collection();
  53204. $ctx1.sendIdx["collection"]=4;
  53205. $7=self._collectionWithNewValue();
  53206. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53207. $5=$recv($6).__comma($7);
  53208. $ctx1.sendIdx[","]=2;
  53209. $8=self._collectionWithNewValue();
  53210. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53211. self._assert_equals_($5,$8);
  53212. $ctx1.sendIdx["assert:equals:"]=2;
  53213. $10=self._collectionWithNewValue();
  53214. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53215. $9=$recv($10).__comma(self._collection());
  53216. self._assert_equals_($9,self._collectionWithNewValue());
  53217. return self;
  53218. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  53219. },
  53220. args: [],
  53221. 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",
  53222. referencedClasses: [],
  53223. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  53224. }),
  53225. $globals.SetTest);
  53226. $core.addMethod(
  53227. $core.method({
  53228. selector: "testComparing",
  53229. protocol: 'tests',
  53230. fn: function (){
  53231. var self=this;
  53232. return $core.withContext(function($ctx1) {
  53233. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  53234. $1=[(0), (2)]._asSet();
  53235. $ctx1.sendIdx["asSet"]=1;
  53236. $2=[(0), (2)]._asSet();
  53237. $ctx1.sendIdx["asSet"]=2;
  53238. self._assert_equals_($1,$2);
  53239. $ctx1.sendIdx["assert:equals:"]=1;
  53240. $3=[(2), (0)]._asSet();
  53241. $ctx1.sendIdx["asSet"]=3;
  53242. $4=[(0), (2)]._asSet();
  53243. $ctx1.sendIdx["asSet"]=4;
  53244. self._assert_equals_($3,$4);
  53245. $6=[(0), (2), (3)]._asSet();
  53246. $ctx1.sendIdx["asSet"]=5;
  53247. $7=[(0), (2)]._asSet();
  53248. $ctx1.sendIdx["asSet"]=6;
  53249. $5=$recv($6).__eq($7);
  53250. $ctx1.sendIdx["="]=1;
  53251. self._deny_($5);
  53252. $ctx1.sendIdx["deny:"]=1;
  53253. $9=[(1), (2)]._asSet();
  53254. $ctx1.sendIdx["asSet"]=7;
  53255. $8=$recv($9).__eq([(0), (2)]._asSet());
  53256. self._deny_($8);
  53257. return self;
  53258. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  53259. },
  53260. args: [],
  53261. 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",
  53262. referencedClasses: [],
  53263. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  53264. }),
  53265. $globals.SetTest);
  53266. $core.addMethod(
  53267. $core.method({
  53268. selector: "testPrintString",
  53269. protocol: 'tests',
  53270. fn: function (){
  53271. var self=this;
  53272. var set;
  53273. return $core.withContext(function($ctx1) {
  53274. var $1,$2,$3,$4,$5,$6,$7,$8;
  53275. set=$recv($globals.Set)._new();
  53276. $1=$recv(set)._printString();
  53277. $ctx1.sendIdx["printString"]=1;
  53278. self._assert_equals_($1,"a Set ()");
  53279. $ctx1.sendIdx["assert:equals:"]=1;
  53280. $2=set;
  53281. $recv($2)._add_((1));
  53282. $ctx1.sendIdx["add:"]=1;
  53283. $3=$recv($2)._add_((3));
  53284. $ctx1.sendIdx["add:"]=2;
  53285. $4=$recv(set)._printString();
  53286. $ctx1.sendIdx["printString"]=2;
  53287. self._assert_equals_($4,"a Set (1 3)");
  53288. $ctx1.sendIdx["assert:equals:"]=2;
  53289. $recv(set)._add_("foo");
  53290. $ctx1.sendIdx["add:"]=3;
  53291. $5=$recv(set)._printString();
  53292. $ctx1.sendIdx["printString"]=3;
  53293. self._assert_equals_($5,"a Set (1 3 'foo')");
  53294. $ctx1.sendIdx["assert:equals:"]=3;
  53295. $6=set;
  53296. $recv($6)._remove_((1));
  53297. $ctx1.sendIdx["remove:"]=1;
  53298. $recv($6)._remove_((3));
  53299. $7=$recv(set)._printString();
  53300. $ctx1.sendIdx["printString"]=4;
  53301. self._assert_equals_($7,"a Set ('foo')");
  53302. $ctx1.sendIdx["assert:equals:"]=4;
  53303. $recv(set)._add_((3));
  53304. $ctx1.sendIdx["add:"]=4;
  53305. $8=$recv(set)._printString();
  53306. $ctx1.sendIdx["printString"]=5;
  53307. self._assert_equals_($8,"a Set (3 'foo')");
  53308. $ctx1.sendIdx["assert:equals:"]=5;
  53309. $recv(set)._add_((3));
  53310. self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  53311. return self;
  53312. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  53313. },
  53314. args: [],
  53315. 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'')'",
  53316. referencedClasses: ["Set"],
  53317. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  53318. }),
  53319. $globals.SetTest);
  53320. $core.addMethod(
  53321. $core.method({
  53322. selector: "testUnboxedObjects",
  53323. protocol: 'tests',
  53324. fn: function (){
  53325. var self=this;
  53326. return $core.withContext(function($ctx1) {
  53327. var $4,$3,$2,$1;
  53328. $4="foo"._yourself();
  53329. $ctx1.sendIdx["yourself"]=1;
  53330. $3=[$4,"foo"._yourself()];
  53331. $2=$recv($3)._asSet();
  53332. $1=$recv($2)._asArray();
  53333. self._assert_equals_($1,["foo"]);
  53334. return self;
  53335. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  53336. },
  53337. args: [],
  53338. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  53339. referencedClasses: [],
  53340. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  53341. }),
  53342. $globals.SetTest);
  53343. $core.addMethod(
  53344. $core.method({
  53345. selector: "testUnicity",
  53346. protocol: 'tests',
  53347. fn: function (){
  53348. var self=this;
  53349. var set;
  53350. return $core.withContext(function($ctx1) {
  53351. var $1;
  53352. set=$recv($globals.Set)._new();
  53353. $recv(set)._add_((21));
  53354. $ctx1.sendIdx["add:"]=1;
  53355. $recv(set)._add_("hello");
  53356. $ctx1.sendIdx["add:"]=2;
  53357. $recv(set)._add_((21));
  53358. $ctx1.sendIdx["add:"]=3;
  53359. $1=$recv(set)._size();
  53360. $ctx1.sendIdx["size"]=1;
  53361. self._assert_equals_($1,(2));
  53362. $ctx1.sendIdx["assert:equals:"]=1;
  53363. $recv(set)._add_("hello");
  53364. self._assert_equals_($recv(set)._size(),(2));
  53365. $ctx1.sendIdx["assert:equals:"]=2;
  53366. self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  53367. return self;
  53368. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  53369. },
  53370. args: [],
  53371. 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')",
  53372. referencedClasses: ["Set"],
  53373. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  53374. }),
  53375. $globals.SetTest);
  53376. $core.addMethod(
  53377. $core.method({
  53378. selector: "collectionClass",
  53379. protocol: 'fixture',
  53380. fn: function (){
  53381. var self=this;
  53382. return $globals.Set;
  53383. },
  53384. args: [],
  53385. source: "collectionClass\x0a\x09^ Set",
  53386. referencedClasses: ["Set"],
  53387. messageSends: []
  53388. }),
  53389. $globals.SetTest.klass);
  53390. $core.addClass('ConsoleTranscriptTest', $globals.TestCase, [], 'Kernel-Tests');
  53391. $core.addMethod(
  53392. $core.method({
  53393. selector: "testShow",
  53394. protocol: 'tests',
  53395. fn: function (){
  53396. var self=this;
  53397. var originalTranscript;
  53398. return $core.withContext(function($ctx1) {
  53399. originalTranscript=$recv($globals.Transcript)._current();
  53400. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  53401. $ctx1.sendIdx["register:"]=1;
  53402. self._shouldnt_raise_((function(){
  53403. return $core.withContext(function($ctx2) {
  53404. return $recv($globals.Transcript)._show_("Hello console!");
  53405. $ctx2.sendIdx["show:"]=1;
  53406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53407. }),$globals.Error);
  53408. $ctx1.sendIdx["shouldnt:raise:"]=1;
  53409. self._shouldnt_raise_((function(){
  53410. return $core.withContext(function($ctx2) {
  53411. return $recv($globals.Transcript)._show_(console);
  53412. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53413. }),$globals.Error);
  53414. $recv($globals.Transcript)._register_(originalTranscript);
  53415. return self;
  53416. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  53417. },
  53418. args: [],
  53419. 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.",
  53420. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  53421. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  53422. }),
  53423. $globals.ConsoleTranscriptTest);
  53424. $core.addClass('DateTest', $globals.TestCase, [], 'Kernel-Tests');
  53425. $core.addMethod(
  53426. $core.method({
  53427. selector: "testEquality",
  53428. protocol: 'tests',
  53429. fn: function (){
  53430. var self=this;
  53431. var now;
  53432. return $core.withContext(function($ctx1) {
  53433. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  53434. now=$recv($globals.Date)._new();
  53435. $1=$recv(now).__eq(now);
  53436. $ctx1.sendIdx["="]=1;
  53437. self._assert_($1);
  53438. $ctx1.sendIdx["assert:"]=1;
  53439. $3=now;
  53440. $4=$recv($globals.Date)._fromMilliseconds_((0));
  53441. $ctx1.sendIdx["fromMilliseconds:"]=1;
  53442. $2=$recv($3).__eq($4);
  53443. $ctx1.sendIdx["="]=2;
  53444. self._deny_($2);
  53445. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  53446. $ctx1.sendIdx["fromMilliseconds:"]=2;
  53447. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  53448. $ctx1.sendIdx["fromMilliseconds:"]=3;
  53449. $5=$recv($6).__eq($7);
  53450. $ctx1.sendIdx["="]=3;
  53451. self._assert_($5);
  53452. $ctx1.sendIdx["assert:"]=2;
  53453. $9=now;
  53454. $11=$recv(now)._asMilliseconds();
  53455. $ctx1.sendIdx["asMilliseconds"]=1;
  53456. $10=$recv($globals.Date)._fromMilliseconds_($11);
  53457. $ctx1.sendIdx["fromMilliseconds:"]=4;
  53458. $8=$recv($9).__eq($10);
  53459. $ctx1.sendIdx["="]=4;
  53460. self._assert_($8);
  53461. $ctx1.sendIdx["assert:"]=3;
  53462. self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  53463. return self;
  53464. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  53465. },
  53466. args: [],
  53467. 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",
  53468. referencedClasses: ["Date"],
  53469. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  53470. }),
  53471. $globals.DateTest);
  53472. $core.addMethod(
  53473. $core.method({
  53474. selector: "testIdentity",
  53475. protocol: 'tests',
  53476. fn: function (){
  53477. var self=this;
  53478. var now;
  53479. return $core.withContext(function($ctx1) {
  53480. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  53481. now=$recv($globals.Date)._new();
  53482. $1=$recv(now).__eq_eq(now);
  53483. $ctx1.sendIdx["=="]=1;
  53484. self._assert_($1);
  53485. $3=now;
  53486. $4=$recv($globals.Date)._fromMilliseconds_((0));
  53487. $ctx1.sendIdx["fromMilliseconds:"]=1;
  53488. $2=$recv($3).__eq_eq($4);
  53489. $ctx1.sendIdx["=="]=2;
  53490. self._deny_($2);
  53491. $ctx1.sendIdx["deny:"]=1;
  53492. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  53493. $ctx1.sendIdx["fromMilliseconds:"]=2;
  53494. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  53495. $ctx1.sendIdx["fromMilliseconds:"]=3;
  53496. $5=$recv($6).__eq_eq($7);
  53497. $ctx1.sendIdx["=="]=3;
  53498. self._deny_($5);
  53499. $ctx1.sendIdx["deny:"]=2;
  53500. $9=now;
  53501. $11=$recv(now)._asMilliseconds();
  53502. $ctx1.sendIdx["asMilliseconds"]=1;
  53503. $10=$recv($globals.Date)._fromMilliseconds_($11);
  53504. $ctx1.sendIdx["fromMilliseconds:"]=4;
  53505. $8=$recv($9).__eq_eq($10);
  53506. $ctx1.sendIdx["=="]=4;
  53507. self._deny_($8);
  53508. $ctx1.sendIdx["deny:"]=3;
  53509. self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  53510. return self;
  53511. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  53512. },
  53513. args: [],
  53514. 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",
  53515. referencedClasses: ["Date"],
  53516. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  53517. }),
  53518. $globals.DateTest);
  53519. $core.addClass('JSObjectProxyTest', $globals.TestCase, [], 'Kernel-Tests');
  53520. $core.addMethod(
  53521. $core.method({
  53522. selector: "jsNull",
  53523. protocol: 'accessing',
  53524. fn: function (){
  53525. var self=this;
  53526. return $core.withContext(function($ctx1) {
  53527. return null;
  53528. return self;
  53529. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  53530. },
  53531. args: [],
  53532. source: "jsNull\x0a\x09<return null>",
  53533. referencedClasses: [],
  53534. messageSends: []
  53535. }),
  53536. $globals.JSObjectProxyTest);
  53537. $core.addMethod(
  53538. $core.method({
  53539. selector: "jsObject",
  53540. protocol: 'accessing',
  53541. fn: function (){
  53542. var self=this;
  53543. return $core.withContext(function($ctx1) {
  53544. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  53545. return self;
  53546. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  53547. },
  53548. args: [],
  53549. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  53550. referencedClasses: [],
  53551. messageSends: []
  53552. }),
  53553. $globals.JSObjectProxyTest);
  53554. $core.addMethod(
  53555. $core.method({
  53556. selector: "jsUndefined",
  53557. protocol: 'accessing',
  53558. fn: function (){
  53559. var self=this;
  53560. return $core.withContext(function($ctx1) {
  53561. return;
  53562. return self;
  53563. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  53564. },
  53565. args: [],
  53566. source: "jsUndefined\x0a\x09<return>",
  53567. referencedClasses: [],
  53568. messageSends: []
  53569. }),
  53570. $globals.JSObjectProxyTest);
  53571. $core.addMethod(
  53572. $core.method({
  53573. selector: "testAtIfAbsent",
  53574. protocol: 'tests',
  53575. fn: function (){
  53576. var self=this;
  53577. var testObject;
  53578. return $core.withContext(function($ctx1) {
  53579. var $1,$2,$3;
  53580. testObject=self._jsObject();
  53581. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  53582. return "Property does not exist";
  53583. }));
  53584. $ctx1.sendIdx["at:ifAbsent:"]=1;
  53585. self._assert_equals_($1,"Property does not exist");
  53586. $ctx1.sendIdx["assert:equals:"]=1;
  53587. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  53588. return "Property does not exist";
  53589. }));
  53590. $ctx1.sendIdx["at:ifAbsent:"]=2;
  53591. self._assert_equals_($2,nil);
  53592. $ctx1.sendIdx["assert:equals:"]=2;
  53593. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  53594. return "Property does not exist";
  53595. }));
  53596. $ctx1.sendIdx["at:ifAbsent:"]=3;
  53597. self._assert_equals_($3,(1));
  53598. $ctx1.sendIdx["assert:equals:"]=3;
  53599. self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  53600. return "Property does not exist";
  53601. })),nil);
  53602. return self;
  53603. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53604. },
  53605. args: [],
  53606. 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.",
  53607. referencedClasses: [],
  53608. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  53609. }),
  53610. $globals.JSObjectProxyTest);
  53611. $core.addMethod(
  53612. $core.method({
  53613. selector: "testAtIfPresent",
  53614. protocol: 'tests',
  53615. fn: function (){
  53616. var self=this;
  53617. var testObject;
  53618. return $core.withContext(function($ctx1) {
  53619. var $2,$1,$4,$3,$6,$5;
  53620. testObject=self._jsObject();
  53621. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  53622. return $core.withContext(function($ctx2) {
  53623. $2=$recv(x)._asString();
  53624. $ctx2.sendIdx["asString"]=1;
  53625. return "hello ".__comma($2);
  53626. $ctx2.sendIdx[","]=1;
  53627. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53628. }));
  53629. $ctx1.sendIdx["at:ifPresent:"]=1;
  53630. self._assert_equals_($1,nil);
  53631. $ctx1.sendIdx["assert:equals:"]=1;
  53632. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  53633. return $core.withContext(function($ctx2) {
  53634. $4=$recv(x)._asString();
  53635. $ctx2.sendIdx["asString"]=2;
  53636. return "hello ".__comma($4);
  53637. $ctx2.sendIdx[","]=2;
  53638. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  53639. }));
  53640. $ctx1.sendIdx["at:ifPresent:"]=2;
  53641. self._assert_equals_($3,"hello nil");
  53642. $ctx1.sendIdx["assert:equals:"]=2;
  53643. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  53644. return $core.withContext(function($ctx2) {
  53645. $6=$recv(x)._asString();
  53646. $ctx2.sendIdx["asString"]=3;
  53647. return "hello ".__comma($6);
  53648. $ctx2.sendIdx[","]=3;
  53649. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  53650. }));
  53651. $ctx1.sendIdx["at:ifPresent:"]=3;
  53652. self._assert_equals_($5,"hello 1");
  53653. $ctx1.sendIdx["assert:equals:"]=3;
  53654. self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  53655. return $core.withContext(function($ctx2) {
  53656. return "hello ".__comma($recv(x)._asString());
  53657. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  53658. })),"hello nil");
  53659. return self;
  53660. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53661. },
  53662. args: [],
  53663. 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'.",
  53664. referencedClasses: [],
  53665. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  53666. }),
  53667. $globals.JSObjectProxyTest);
  53668. $core.addMethod(
  53669. $core.method({
  53670. selector: "testAtIfPresentIfAbsent",
  53671. protocol: 'tests',
  53672. fn: function (){
  53673. var self=this;
  53674. var testObject;
  53675. return $core.withContext(function($ctx1) {
  53676. var $2,$1,$4,$3,$6,$5;
  53677. testObject=self._jsObject();
  53678. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  53679. return $core.withContext(function($ctx2) {
  53680. $2=$recv(x)._asString();
  53681. $ctx2.sendIdx["asString"]=1;
  53682. return "hello ".__comma($2);
  53683. $ctx2.sendIdx[","]=1;
  53684. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53685. }),(function(){
  53686. return "not present";
  53687. }));
  53688. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  53689. self._assert_equals_($1,"not present");
  53690. $ctx1.sendIdx["assert:equals:"]=1;
  53691. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  53692. return $core.withContext(function($ctx2) {
  53693. $4=$recv(x)._asString();
  53694. $ctx2.sendIdx["asString"]=2;
  53695. return "hello ".__comma($4);
  53696. $ctx2.sendIdx[","]=2;
  53697. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  53698. }),(function(){
  53699. return "not present";
  53700. }));
  53701. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  53702. self._assert_equals_($3,"hello nil");
  53703. $ctx1.sendIdx["assert:equals:"]=2;
  53704. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  53705. return $core.withContext(function($ctx2) {
  53706. $6=$recv(x)._asString();
  53707. $ctx2.sendIdx["asString"]=3;
  53708. return "hello ".__comma($6);
  53709. $ctx2.sendIdx[","]=3;
  53710. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  53711. }),(function(){
  53712. return "not present";
  53713. }));
  53714. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  53715. self._assert_equals_($5,"hello 1");
  53716. $ctx1.sendIdx["assert:equals:"]=3;
  53717. self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  53718. return $core.withContext(function($ctx2) {
  53719. return "hello ".__comma($recv(x)._asString());
  53720. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  53721. }),(function(){
  53722. return "not present";
  53723. })),"hello nil");
  53724. return self;
  53725. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53726. },
  53727. args: [],
  53728. 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'.",
  53729. referencedClasses: [],
  53730. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  53731. }),
  53732. $globals.JSObjectProxyTest);
  53733. $core.addMethod(
  53734. $core.method({
  53735. selector: "testAtPut",
  53736. protocol: 'tests',
  53737. fn: function (){
  53738. var self=this;
  53739. var testObject;
  53740. return $core.withContext(function($ctx1) {
  53741. var $2,$1;
  53742. testObject=self._jsObject();
  53743. $2=$recv(testObject)._at_("abc");
  53744. $ctx1.sendIdx["at:"]=1;
  53745. $1=$recv($2).__tild_eq("xyz");
  53746. self._assert_($1);
  53747. self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  53748. $ctx1.sendIdx["assert:equals:"]=1;
  53749. self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  53750. return self;
  53751. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  53752. },
  53753. args: [],
  53754. 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'",
  53755. referencedClasses: [],
  53756. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  53757. }),
  53758. $globals.JSObjectProxyTest);
  53759. $core.addMethod(
  53760. $core.method({
  53761. selector: "testComparison",
  53762. protocol: 'tests',
  53763. fn: function (){
  53764. var self=this;
  53765. return $core.withContext(function($ctx1) {
  53766. var $1,$2;
  53767. self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  53768. $1=$recv(console).__eq(console);
  53769. $ctx1.sendIdx["="]=1;
  53770. self._assert_($1);
  53771. $2=$recv(console).__eq($recv($globals.Object)._new());
  53772. $ctx1.sendIdx["="]=2;
  53773. self._deny_($2);
  53774. $ctx1.sendIdx["deny:"]=1;
  53775. self._deny_($recv(console).__eq(self._jsObject()));
  53776. return self;
  53777. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  53778. },
  53779. args: [],
  53780. 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",
  53781. referencedClasses: ["Object"],
  53782. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  53783. }),
  53784. $globals.JSObjectProxyTest);
  53785. $core.addMethod(
  53786. $core.method({
  53787. selector: "testDNU",
  53788. protocol: 'tests',
  53789. fn: function (){
  53790. var self=this;
  53791. return $core.withContext(function($ctx1) {
  53792. self._should_raise_((function(){
  53793. return $core.withContext(function($ctx2) {
  53794. return $recv(self._jsObject())._foo();
  53795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53796. }),$globals.MessageNotUnderstood);
  53797. return self;
  53798. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  53799. },
  53800. args: [],
  53801. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  53802. referencedClasses: ["MessageNotUnderstood"],
  53803. messageSends: ["should:raise:", "foo", "jsObject"]
  53804. }),
  53805. $globals.JSObjectProxyTest);
  53806. $core.addMethod(
  53807. $core.method({
  53808. selector: "testDNURegression1057",
  53809. protocol: 'tests',
  53810. fn: function (){
  53811. var self=this;
  53812. var jsObject;
  53813. return $core.withContext(function($ctx1) {
  53814. var $1;
  53815. jsObject=[];
  53816. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53817. $ctx1.sendIdx["basicAt:put:"]=1;
  53818. $recv(jsObject)._basicAt_put_("foo",(3));
  53819. self._shouldnt_raise_((function(){
  53820. return $core.withContext(function($ctx2) {
  53821. return $recv(jsObject)._foo();
  53822. $ctx2.sendIdx["foo"]=1;
  53823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53824. }),$globals.Error);
  53825. $ctx1.sendIdx["shouldnt:raise:"]=1;
  53826. $1=$recv(jsObject)._foo();
  53827. $ctx1.sendIdx["foo"]=2;
  53828. self._assert_equals_($1,(3));
  53829. $ctx1.sendIdx["assert:equals:"]=1;
  53830. self._shouldnt_raise_((function(){
  53831. return $core.withContext(function($ctx2) {
  53832. return $recv(jsObject)._foo_((4));
  53833. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53834. }),$globals.Error);
  53835. self._assert_equals_($recv(jsObject)._foo(),(4));
  53836. return self;
  53837. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53838. },
  53839. args: [],
  53840. 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",
  53841. referencedClasses: ["Error"],
  53842. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
  53843. }),
  53844. $globals.JSObjectProxyTest);
  53845. $core.addMethod(
  53846. $core.method({
  53847. selector: "testDNURegression1059",
  53848. protocol: 'tests',
  53849. fn: function (){
  53850. var self=this;
  53851. var jsObject;
  53852. return $core.withContext(function($ctx1) {
  53853. jsObject=[];
  53854. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53855. $ctx1.sendIdx["basicAt:put:"]=1;
  53856. $recv(jsObject)._basicAt_put_("x",(3));
  53857. $ctx1.sendIdx["basicAt:put:"]=2;
  53858. $recv(jsObject)._basicAt_put_("x:",(function(){
  53859. return $core.withContext(function($ctx2) {
  53860. return self._error();
  53861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53862. }));
  53863. self._shouldnt_raise_((function(){
  53864. return $core.withContext(function($ctx2) {
  53865. return $recv(jsObject)._x_((4));
  53866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53867. }),$globals.Error);
  53868. self._assert_equals_($recv(jsObject)._x(),(4));
  53869. return self;
  53870. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53871. },
  53872. args: [],
  53873. 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",
  53874. referencedClasses: ["Error"],
  53875. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
  53876. }),
  53877. $globals.JSObjectProxyTest);
  53878. $core.addMethod(
  53879. $core.method({
  53880. selector: "testDNURegression1062",
  53881. protocol: 'tests',
  53882. fn: function (){
  53883. var self=this;
  53884. var jsObject,stored;
  53885. return $core.withContext(function($ctx1) {
  53886. jsObject=[];
  53887. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53888. $ctx1.sendIdx["basicAt:put:"]=1;
  53889. $recv(jsObject)._basicAt_put_("x",(function(v){
  53890. stored=v;
  53891. return stored;
  53892. }));
  53893. self._shouldnt_raise_((function(){
  53894. return $core.withContext(function($ctx2) {
  53895. return $recv(jsObject)._x_((4));
  53896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53897. }),$globals.Error);
  53898. self._assert_equals_(stored,(4));
  53899. return self;
  53900. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)});
  53901. },
  53902. args: [],
  53903. 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",
  53904. referencedClasses: ["Error"],
  53905. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
  53906. }),
  53907. $globals.JSObjectProxyTest);
  53908. $core.addMethod(
  53909. $core.method({
  53910. selector: "testDNUWithAllowJavaScriptCalls",
  53911. protocol: 'tests',
  53912. fn: function (){
  53913. var self=this;
  53914. var jsObject;
  53915. return $core.withContext(function($ctx1) {
  53916. jsObject=[];
  53917. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53918. self._should_raise_((function(){
  53919. return $core.withContext(function($ctx2) {
  53920. return $recv(jsObject)._foo();
  53921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53922. }),$globals.MessageNotUnderstood);
  53923. return self;
  53924. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53925. },
  53926. args: [],
  53927. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  53928. referencedClasses: ["MessageNotUnderstood"],
  53929. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  53930. }),
  53931. $globals.JSObjectProxyTest);
  53932. $core.addMethod(
  53933. $core.method({
  53934. selector: "testMessageSend",
  53935. protocol: 'tests',
  53936. fn: function (){
  53937. var self=this;
  53938. return $core.withContext(function($ctx1) {
  53939. var $2,$1,$4,$3;
  53940. $2=self._jsObject();
  53941. $ctx1.sendIdx["jsObject"]=1;
  53942. $1=$recv($2)._a();
  53943. self._assert_equals_($1,(1));
  53944. $ctx1.sendIdx["assert:equals:"]=1;
  53945. $4=self._jsObject();
  53946. $ctx1.sendIdx["jsObject"]=2;
  53947. $3=$recv($4)._b();
  53948. self._assert_equals_($3,(2));
  53949. $ctx1.sendIdx["assert:equals:"]=2;
  53950. self._assert_equals_($recv(self._jsObject())._c_((3)),(3));
  53951. return self;
  53952. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  53953. },
  53954. args: [],
  53955. 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",
  53956. referencedClasses: [],
  53957. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  53958. }),
  53959. $globals.JSObjectProxyTest);
  53960. $core.addMethod(
  53961. $core.method({
  53962. selector: "testMethodWithArguments",
  53963. protocol: 'tests',
  53964. fn: function (){
  53965. var self=this;
  53966. return $core.withContext(function($ctx1) {
  53967. self._assert_equals_($recv(self._jsObject())._c_((1)),(1));
  53968. return self;
  53969. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  53970. },
  53971. args: [],
  53972. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  53973. referencedClasses: [],
  53974. messageSends: ["assert:equals:", "c:", "jsObject"]
  53975. }),
  53976. $globals.JSObjectProxyTest);
  53977. $core.addMethod(
  53978. $core.method({
  53979. selector: "testPrinting",
  53980. protocol: 'tests',
  53981. fn: function (){
  53982. var self=this;
  53983. return $core.withContext(function($ctx1) {
  53984. self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]");
  53985. return self;
  53986. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  53987. },
  53988. args: [],
  53989. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  53990. referencedClasses: [],
  53991. messageSends: ["assert:equals:", "printString", "jsObject"]
  53992. }),
  53993. $globals.JSObjectProxyTest);
  53994. $core.addMethod(
  53995. $core.method({
  53996. selector: "testPropertyThatReturnsEmptyString",
  53997. protocol: 'tests',
  53998. fn: function (){
  53999. var self=this;
  54000. var object;
  54001. return $core.withContext(function($ctx1) {
  54002. var $1;
  54003. object=self._jsObject();
  54004. $1=$recv(object)._d();
  54005. $ctx1.sendIdx["d"]=1;
  54006. self._assert_equals_($1,"");
  54007. $ctx1.sendIdx["assert:equals:"]=1;
  54008. $recv(object)._d_("hello");
  54009. self._assert_equals_($recv(object)._d(),"hello");
  54010. return self;
  54011. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  54012. },
  54013. args: [],
  54014. 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'",
  54015. referencedClasses: [],
  54016. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  54017. }),
  54018. $globals.JSObjectProxyTest);
  54019. $core.addMethod(
  54020. $core.method({
  54021. selector: "testPropertyThatReturnsUndefined",
  54022. protocol: 'tests',
  54023. fn: function (){
  54024. var self=this;
  54025. var object;
  54026. return $core.withContext(function($ctx1) {
  54027. object=self._jsObject();
  54028. self._shouldnt_raise_((function(){
  54029. return $core.withContext(function($ctx2) {
  54030. return $recv(object)._e();
  54031. $ctx2.sendIdx["e"]=1;
  54032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54033. }),$globals.MessageNotUnderstood);
  54034. self._assert_($recv($recv(object)._e())._isNil());
  54035. return self;
  54036. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  54037. },
  54038. args: [],
  54039. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  54040. referencedClasses: ["MessageNotUnderstood"],
  54041. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  54042. }),
  54043. $globals.JSObjectProxyTest);
  54044. $core.addMethod(
  54045. $core.method({
  54046. selector: "testSetPropertyWithFalsyValue",
  54047. protocol: 'tests',
  54048. fn: function (){
  54049. var self=this;
  54050. var jsObject;
  54051. return $core.withContext(function($ctx1) {
  54052. var $1,$2,$3,$4,$5;
  54053. jsObject=self._jsObject();
  54054. $1=$recv(jsObject)._a();
  54055. $ctx1.sendIdx["a"]=1;
  54056. self._assert_equals_($1,(1));
  54057. $ctx1.sendIdx["assert:equals:"]=1;
  54058. $recv(jsObject)._a_(self._jsNull());
  54059. $ctx1.sendIdx["a:"]=1;
  54060. $2=$recv(jsObject)._a();
  54061. $ctx1.sendIdx["a"]=2;
  54062. self._assert_equals_($2,nil);
  54063. $ctx1.sendIdx["assert:equals:"]=2;
  54064. $recv(jsObject)._a_((0));
  54065. $ctx1.sendIdx["a:"]=2;
  54066. $3=$recv(jsObject)._a();
  54067. $ctx1.sendIdx["a"]=3;
  54068. self._assert_equals_($3,(0));
  54069. $ctx1.sendIdx["assert:equals:"]=3;
  54070. $recv(jsObject)._a_(self._jsUndefined());
  54071. $ctx1.sendIdx["a:"]=3;
  54072. $4=$recv(jsObject)._a();
  54073. $ctx1.sendIdx["a"]=4;
  54074. self._assert_equals_($4,nil);
  54075. $ctx1.sendIdx["assert:equals:"]=4;
  54076. $recv(jsObject)._a_("");
  54077. $ctx1.sendIdx["a:"]=4;
  54078. $5=$recv(jsObject)._a();
  54079. $ctx1.sendIdx["a"]=5;
  54080. self._assert_equals_($5,"");
  54081. $ctx1.sendIdx["assert:equals:"]=5;
  54082. $recv(jsObject)._a_(false);
  54083. self._assert_equals_($recv(jsObject)._a(),false);
  54084. return self;
  54085. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54086. },
  54087. args: [],
  54088. 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",
  54089. referencedClasses: [],
  54090. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  54091. }),
  54092. $globals.JSObjectProxyTest);
  54093. $core.addMethod(
  54094. $core.method({
  54095. selector: "testValue",
  54096. protocol: 'tests',
  54097. fn: function (){
  54098. var self=this;
  54099. var testObject;
  54100. return $core.withContext(function($ctx1) {
  54101. testObject=self._jsObject();
  54102. $recv(testObject)._at_put_("value","aValue");
  54103. self._assert_equals_($recv(testObject)._value(),"aValue");
  54104. return self;
  54105. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  54106. },
  54107. args: [],
  54108. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  54109. referencedClasses: [],
  54110. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  54111. }),
  54112. $globals.JSObjectProxyTest);
  54113. $core.addMethod(
  54114. $core.method({
  54115. selector: "testYourself",
  54116. protocol: 'tests',
  54117. fn: function (){
  54118. var self=this;
  54119. var object;
  54120. return $core.withContext(function($ctx1) {
  54121. var $1;
  54122. $1=self._jsObject();
  54123. $recv($1)._d_("test");
  54124. object=$recv($1)._yourself();
  54125. self._assert_equals_($recv(object)._d(),"test");
  54126. return self;
  54127. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  54128. },
  54129. args: [],
  54130. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  54131. referencedClasses: [],
  54132. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  54133. }),
  54134. $globals.JSObjectProxyTest);
  54135. $core.addClass('JavaScriptExceptionTest', $globals.TestCase, [], 'Kernel-Tests');
  54136. $core.addMethod(
  54137. $core.method({
  54138. selector: "testCatchingException",
  54139. protocol: 'tests',
  54140. fn: function (){
  54141. var self=this;
  54142. return $core.withContext(function($ctx1) {
  54143. $recv((function(){
  54144. return $core.withContext(function($ctx2) {
  54145. return self._throwException();
  54146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54147. }))._on_do_($globals.Error,(function(error){
  54148. return $core.withContext(function($ctx2) {
  54149. return self._assert_($recv($recv(error)._exception()).__eq("test"));
  54150. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  54151. }));
  54152. return self;
  54153. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  54154. },
  54155. args: [],
  54156. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  54157. referencedClasses: ["Error"],
  54158. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  54159. }),
  54160. $globals.JavaScriptExceptionTest);
  54161. $core.addMethod(
  54162. $core.method({
  54163. selector: "testRaisingException",
  54164. protocol: 'tests',
  54165. fn: function (){
  54166. var self=this;
  54167. return $core.withContext(function($ctx1) {
  54168. self._should_raise_((function(){
  54169. return $core.withContext(function($ctx2) {
  54170. return self._throwException();
  54171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54172. }),$globals.JavaScriptException);
  54173. return self;
  54174. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  54175. },
  54176. args: [],
  54177. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  54178. referencedClasses: ["JavaScriptException"],
  54179. messageSends: ["should:raise:", "throwException"]
  54180. }),
  54181. $globals.JavaScriptExceptionTest);
  54182. $core.addMethod(
  54183. $core.method({
  54184. selector: "throwException",
  54185. protocol: 'helpers',
  54186. fn: function (){
  54187. var self=this;
  54188. return $core.withContext(function($ctx1) {
  54189. throw 'test';
  54190. return self;
  54191. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  54192. },
  54193. args: [],
  54194. source: "throwException\x0a\x09<throw 'test'>",
  54195. referencedClasses: [],
  54196. messageSends: []
  54197. }),
  54198. $globals.JavaScriptExceptionTest);
  54199. $core.addClass('MessageSendTest', $globals.TestCase, [], 'Kernel-Tests');
  54200. $core.addMethod(
  54201. $core.method({
  54202. selector: "testValue",
  54203. protocol: 'tests',
  54204. fn: function (){
  54205. var self=this;
  54206. var messageSend;
  54207. return $core.withContext(function($ctx1) {
  54208. var $1;
  54209. $1=$recv($globals.MessageSend)._new();
  54210. $ctx1.sendIdx["new"]=1;
  54211. $recv($1)._receiver_($recv($globals.Object)._new());
  54212. $recv($1)._selector_("asString");
  54213. messageSend=$recv($1)._yourself();
  54214. self._assert_equals_($recv(messageSend)._value(),"an Object");
  54215. return self;
  54216. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  54217. },
  54218. args: [],
  54219. 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'",
  54220. referencedClasses: ["MessageSend", "Object"],
  54221. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  54222. }),
  54223. $globals.MessageSendTest);
  54224. $core.addMethod(
  54225. $core.method({
  54226. selector: "testValueWithArguments",
  54227. protocol: 'tests',
  54228. fn: function (){
  54229. var self=this;
  54230. var messageSend;
  54231. return $core.withContext(function($ctx1) {
  54232. var $1;
  54233. $1=$recv($globals.MessageSend)._new();
  54234. $recv($1)._receiver_((2));
  54235. $recv($1)._selector_("+");
  54236. messageSend=$recv($1)._yourself();
  54237. self._assert_equals_($recv(messageSend)._value_((3)),(5));
  54238. $ctx1.sendIdx["assert:equals:"]=1;
  54239. self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  54240. return self;
  54241. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  54242. },
  54243. args: [],
  54244. 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",
  54245. referencedClasses: ["MessageSend"],
  54246. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  54247. }),
  54248. $globals.MessageSendTest);
  54249. $core.addClass('MethodInheritanceTest', $globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  54250. $core.addMethod(
  54251. $core.method({
  54252. selector: "codeGeneratorClass",
  54253. protocol: 'accessing',
  54254. fn: function (){
  54255. var self=this;
  54256. return $globals.CodeGenerator;
  54257. },
  54258. args: [],
  54259. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  54260. referencedClasses: ["CodeGenerator"],
  54261. messageSends: []
  54262. }),
  54263. $globals.MethodInheritanceTest);
  54264. $core.addMethod(
  54265. $core.method({
  54266. selector: "compiler",
  54267. protocol: 'factory',
  54268. fn: function (){
  54269. var self=this;
  54270. return $core.withContext(function($ctx1) {
  54271. var $1;
  54272. $1=$recv($globals.Compiler)._new();
  54273. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  54274. return $recv($1)._yourself();
  54275. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  54276. },
  54277. args: [],
  54278. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  54279. referencedClasses: ["Compiler"],
  54280. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  54281. }),
  54282. $globals.MethodInheritanceTest);
  54283. $core.addMethod(
  54284. $core.method({
  54285. selector: "deinstallBottom",
  54286. protocol: 'testing',
  54287. fn: function (){
  54288. var self=this;
  54289. return $core.withContext(function($ctx1) {
  54290. $recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  54291. return self;
  54292. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  54293. },
  54294. args: [],
  54295. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  54296. referencedClasses: [],
  54297. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  54298. }),
  54299. $globals.MethodInheritanceTest);
  54300. $core.addMethod(
  54301. $core.method({
  54302. selector: "deinstallMiddle",
  54303. protocol: 'testing',
  54304. fn: function (){
  54305. var self=this;
  54306. return $core.withContext(function($ctx1) {
  54307. $recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  54308. return self;
  54309. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  54310. },
  54311. args: [],
  54312. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  54313. referencedClasses: [],
  54314. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  54315. }),
  54316. $globals.MethodInheritanceTest);
  54317. $core.addMethod(
  54318. $core.method({
  54319. selector: "deinstallTop",
  54320. protocol: 'testing',
  54321. fn: function (){
  54322. var self=this;
  54323. return $core.withContext(function($ctx1) {
  54324. $recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  54325. return self;
  54326. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  54327. },
  54328. args: [],
  54329. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  54330. referencedClasses: [],
  54331. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  54332. }),
  54333. $globals.MethodInheritanceTest);
  54334. $core.addMethod(
  54335. $core.method({
  54336. selector: "installBottom:",
  54337. protocol: 'testing',
  54338. fn: function (aString){
  54339. var self=this;
  54340. return $core.withContext(function($ctx1) {
  54341. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  54342. return self;
  54343. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  54344. },
  54345. args: ["aString"],
  54346. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  54347. referencedClasses: [],
  54348. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  54349. }),
  54350. $globals.MethodInheritanceTest);
  54351. $core.addMethod(
  54352. $core.method({
  54353. selector: "installMiddle:",
  54354. protocol: 'testing',
  54355. fn: function (aString){
  54356. var self=this;
  54357. return $core.withContext(function($ctx1) {
  54358. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  54359. return self;
  54360. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  54361. },
  54362. args: ["aString"],
  54363. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  54364. referencedClasses: [],
  54365. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  54366. }),
  54367. $globals.MethodInheritanceTest);
  54368. $core.addMethod(
  54369. $core.method({
  54370. selector: "installTop:",
  54371. protocol: 'testing',
  54372. fn: function (aString){
  54373. var self=this;
  54374. return $core.withContext(function($ctx1) {
  54375. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  54376. return self;
  54377. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  54378. },
  54379. args: ["aString"],
  54380. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  54381. referencedClasses: [],
  54382. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  54383. }),
  54384. $globals.MethodInheritanceTest);
  54385. $core.addMethod(
  54386. $core.method({
  54387. selector: "setUp",
  54388. protocol: 'initialization',
  54389. fn: function (){
  54390. var self=this;
  54391. return $core.withContext(function($ctx1) {
  54392. self["@receiverTop"]=$recv(self._targetClassTop())._new();
  54393. $ctx1.sendIdx["new"]=1;
  54394. self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new();
  54395. $ctx1.sendIdx["new"]=2;
  54396. self["@receiverBottom"]=$recv(self._targetClassBottom())._new();
  54397. self["@method"]=nil;
  54398. self["@performBlock"]=(function(){
  54399. return $core.withContext(function($ctx2) {
  54400. return self._error_("performBlock not initialized");
  54401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54402. });
  54403. return self;
  54404. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  54405. },
  54406. args: [],
  54407. 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' ]",
  54408. referencedClasses: [],
  54409. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  54410. }),
  54411. $globals.MethodInheritanceTest);
  54412. $core.addMethod(
  54413. $core.method({
  54414. selector: "shouldMNU",
  54415. protocol: 'testing',
  54416. fn: function (){
  54417. var self=this;
  54418. return $core.withContext(function($ctx1) {
  54419. self._shouldMNUTop();
  54420. self._shouldMNUMiddle();
  54421. self._shouldMNUBottom();
  54422. return self;
  54423. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  54424. },
  54425. args: [],
  54426. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  54427. referencedClasses: [],
  54428. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  54429. }),
  54430. $globals.MethodInheritanceTest);
  54431. $core.addMethod(
  54432. $core.method({
  54433. selector: "shouldMNUBottom",
  54434. protocol: 'testing',
  54435. fn: function (){
  54436. var self=this;
  54437. return $core.withContext(function($ctx1) {
  54438. self._should_raise_((function(){
  54439. return $core.withContext(function($ctx2) {
  54440. return $recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54442. }),$globals.MessageNotUnderstood);
  54443. return self;
  54444. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  54445. },
  54446. args: [],
  54447. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  54448. referencedClasses: ["MessageNotUnderstood"],
  54449. messageSends: ["should:raise:", "value:"]
  54450. }),
  54451. $globals.MethodInheritanceTest);
  54452. $core.addMethod(
  54453. $core.method({
  54454. selector: "shouldMNUMiddle",
  54455. protocol: 'testing',
  54456. fn: function (){
  54457. var self=this;
  54458. return $core.withContext(function($ctx1) {
  54459. self._should_raise_((function(){
  54460. return $core.withContext(function($ctx2) {
  54461. return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54462. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54463. }),$globals.MessageNotUnderstood);
  54464. return self;
  54465. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  54466. },
  54467. args: [],
  54468. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  54469. referencedClasses: ["MessageNotUnderstood"],
  54470. messageSends: ["should:raise:", "value:"]
  54471. }),
  54472. $globals.MethodInheritanceTest);
  54473. $core.addMethod(
  54474. $core.method({
  54475. selector: "shouldMNUTop",
  54476. protocol: 'testing',
  54477. fn: function (){
  54478. var self=this;
  54479. return $core.withContext(function($ctx1) {
  54480. self._should_raise_((function(){
  54481. return $core.withContext(function($ctx2) {
  54482. return $recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54484. }),$globals.MessageNotUnderstood);
  54485. return self;
  54486. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  54487. },
  54488. args: [],
  54489. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  54490. referencedClasses: ["MessageNotUnderstood"],
  54491. messageSends: ["should:raise:", "value:"]
  54492. }),
  54493. $globals.MethodInheritanceTest);
  54494. $core.addMethod(
  54495. $core.method({
  54496. selector: "shouldReturn:",
  54497. protocol: 'testing',
  54498. fn: function (anObject){
  54499. var self=this;
  54500. var result;
  54501. return $core.withContext(function($ctx1) {
  54502. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54503. $ctx1.sendIdx["value:"]=1;
  54504. self._assert_equals_(["top",anObject],["top",result]);
  54505. $ctx1.sendIdx["assert:equals:"]=1;
  54506. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54507. $ctx1.sendIdx["value:"]=2;
  54508. self._assert_equals_(["middle",anObject],["middle",result]);
  54509. $ctx1.sendIdx["assert:equals:"]=2;
  54510. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54511. self._assert_equals_(["bottom",anObject],["bottom",result]);
  54512. return self;
  54513. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  54514. },
  54515. args: ["anObject"],
  54516. 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 }",
  54517. referencedClasses: [],
  54518. messageSends: ["value:", "assert:equals:"]
  54519. }),
  54520. $globals.MethodInheritanceTest);
  54521. $core.addMethod(
  54522. $core.method({
  54523. selector: "shouldReturn:and:and:",
  54524. protocol: 'testing',
  54525. fn: function (anObject,anObject2,anObject3){
  54526. var self=this;
  54527. var result;
  54528. return $core.withContext(function($ctx1) {
  54529. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54530. $ctx1.sendIdx["value:"]=1;
  54531. self._assert_equals_(["top",anObject],["top",result]);
  54532. $ctx1.sendIdx["assert:equals:"]=1;
  54533. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54534. $ctx1.sendIdx["value:"]=2;
  54535. self._assert_equals_(["middle",anObject2],["middle",result]);
  54536. $ctx1.sendIdx["assert:equals:"]=2;
  54537. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54538. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  54539. return self;
  54540. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  54541. },
  54542. args: ["anObject", "anObject2", "anObject3"],
  54543. 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 }",
  54544. referencedClasses: [],
  54545. messageSends: ["value:", "assert:equals:"]
  54546. }),
  54547. $globals.MethodInheritanceTest);
  54548. $core.addMethod(
  54549. $core.method({
  54550. selector: "targetClassBottom",
  54551. protocol: 'accessing',
  54552. fn: function (){
  54553. var self=this;
  54554. return $globals.JavaScriptException;
  54555. },
  54556. args: [],
  54557. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  54558. referencedClasses: ["JavaScriptException"],
  54559. messageSends: []
  54560. }),
  54561. $globals.MethodInheritanceTest);
  54562. $core.addMethod(
  54563. $core.method({
  54564. selector: "targetClassMiddle",
  54565. protocol: 'accessing',
  54566. fn: function (){
  54567. var self=this;
  54568. return $globals.Error;
  54569. },
  54570. args: [],
  54571. source: "targetClassMiddle\x0a\x09^ Error",
  54572. referencedClasses: ["Error"],
  54573. messageSends: []
  54574. }),
  54575. $globals.MethodInheritanceTest);
  54576. $core.addMethod(
  54577. $core.method({
  54578. selector: "targetClassTop",
  54579. protocol: 'accessing',
  54580. fn: function (){
  54581. var self=this;
  54582. return $globals.Object;
  54583. },
  54584. args: [],
  54585. source: "targetClassTop\x0a\x09^ Object",
  54586. referencedClasses: ["Object"],
  54587. messageSends: []
  54588. }),
  54589. $globals.MethodInheritanceTest);
  54590. $core.addMethod(
  54591. $core.method({
  54592. selector: "tearDown",
  54593. protocol: 'initialization',
  54594. fn: function (){
  54595. var self=this;
  54596. return $core.withContext(function($ctx1) {
  54597. $recv((function(){
  54598. return $core.withContext(function($ctx2) {
  54599. return self._deinstallTop();
  54600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54601. }))._on_do_($globals.Error,(function(){
  54602. }));
  54603. $ctx1.sendIdx["on:do:"]=1;
  54604. $recv((function(){
  54605. return $core.withContext(function($ctx2) {
  54606. return self._deinstallMiddle();
  54607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  54608. }))._on_do_($globals.Error,(function(){
  54609. }));
  54610. $ctx1.sendIdx["on:do:"]=2;
  54611. $recv((function(){
  54612. return $core.withContext(function($ctx2) {
  54613. return self._deinstallBottom();
  54614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54615. }))._on_do_($globals.Error,(function(){
  54616. }));
  54617. return self;
  54618. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  54619. },
  54620. args: [],
  54621. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  54622. referencedClasses: ["Error"],
  54623. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  54624. }),
  54625. $globals.MethodInheritanceTest);
  54626. $core.addMethod(
  54627. $core.method({
  54628. selector: "testMNU11",
  54629. protocol: 'tests',
  54630. fn: function (){
  54631. var self=this;
  54632. return $core.withContext(function($ctx1) {
  54633. self["@performBlock"]=(function(x){
  54634. return $core.withContext(function($ctx2) {
  54635. return $recv(x)._foo();
  54636. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54637. });
  54638. self._shouldMNU();
  54639. $ctx1.sendIdx["shouldMNU"]=1;
  54640. self._installTop_("foo ^ false");
  54641. $ctx1.sendIdx["installTop:"]=1;
  54642. self._installTop_("foo ^ true");
  54643. self._deinstallTop();
  54644. self._shouldMNU();
  54645. return self;
  54646. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  54647. },
  54648. args: [],
  54649. 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",
  54650. referencedClasses: [],
  54651. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  54652. }),
  54653. $globals.MethodInheritanceTest);
  54654. $core.addMethod(
  54655. $core.method({
  54656. selector: "testMNU22",
  54657. protocol: 'tests',
  54658. fn: function (){
  54659. var self=this;
  54660. return $core.withContext(function($ctx1) {
  54661. self["@performBlock"]=(function(x){
  54662. return $core.withContext(function($ctx2) {
  54663. return $recv(x)._foo();
  54664. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54665. });
  54666. self._shouldMNU();
  54667. $ctx1.sendIdx["shouldMNU"]=1;
  54668. self._installMiddle_("foo ^ false");
  54669. $ctx1.sendIdx["installMiddle:"]=1;
  54670. self._installMiddle_("foo ^ true");
  54671. self._deinstallMiddle();
  54672. self._shouldMNU();
  54673. return self;
  54674. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  54675. },
  54676. args: [],
  54677. 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",
  54678. referencedClasses: [],
  54679. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  54680. }),
  54681. $globals.MethodInheritanceTest);
  54682. $core.addMethod(
  54683. $core.method({
  54684. selector: "testReturns1",
  54685. protocol: 'tests',
  54686. fn: function (){
  54687. var self=this;
  54688. return $core.withContext(function($ctx1) {
  54689. self["@performBlock"]=(function(x){
  54690. return $core.withContext(function($ctx2) {
  54691. return $recv(x)._foo();
  54692. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54693. });
  54694. self._installTop_("foo ^ false");
  54695. $ctx1.sendIdx["installTop:"]=1;
  54696. self._shouldReturn_(false);
  54697. $ctx1.sendIdx["shouldReturn:"]=1;
  54698. self._installTop_("foo ^ true");
  54699. self._shouldReturn_(true);
  54700. return self;
  54701. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  54702. },
  54703. args: [],
  54704. 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",
  54705. referencedClasses: [],
  54706. messageSends: ["foo", "installTop:", "shouldReturn:"]
  54707. }),
  54708. $globals.MethodInheritanceTest);
  54709. $core.addClass('NumberTest', $globals.TestCase, [], 'Kernel-Tests');
  54710. $core.addMethod(
  54711. $core.method({
  54712. selector: "testAbs",
  54713. protocol: 'tests',
  54714. fn: function (){
  54715. var self=this;
  54716. return $core.withContext(function($ctx1) {
  54717. var $1;
  54718. $1=(4)._abs();
  54719. $ctx1.sendIdx["abs"]=1;
  54720. self._assert_equals_($1,(4));
  54721. $ctx1.sendIdx["assert:equals:"]=1;
  54722. self._assert_equals_((-4)._abs(),(4));
  54723. return self;
  54724. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  54725. },
  54726. args: [],
  54727. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  54728. referencedClasses: [],
  54729. messageSends: ["assert:equals:", "abs"]
  54730. }),
  54731. $globals.NumberTest);
  54732. $core.addMethod(
  54733. $core.method({
  54734. selector: "testArithmetic",
  54735. protocol: 'tests',
  54736. fn: function (){
  54737. var self=this;
  54738. return $core.withContext(function($ctx1) {
  54739. var $1,$2,$3,$5,$4;
  54740. $1=(1.5).__plus((1));
  54741. $ctx1.sendIdx["+"]=1;
  54742. self._assert_equals_($1,(2.5));
  54743. $ctx1.sendIdx["assert:equals:"]=1;
  54744. $2=(2).__minus((1));
  54745. $ctx1.sendIdx["-"]=1;
  54746. self._assert_equals_($2,(1));
  54747. $ctx1.sendIdx["assert:equals:"]=2;
  54748. self._assert_equals_((-2).__minus((1)),(-3));
  54749. $ctx1.sendIdx["assert:equals:"]=3;
  54750. self._assert_equals_((12).__slash((2)),(6));
  54751. $ctx1.sendIdx["assert:equals:"]=4;
  54752. $3=(3).__star((4));
  54753. $ctx1.sendIdx["*"]=1;
  54754. self._assert_equals_($3,(12));
  54755. $ctx1.sendIdx["assert:equals:"]=5;
  54756. self._assert_equals_((7).__slash_slash((2)),(3));
  54757. $ctx1.sendIdx["assert:equals:"]=6;
  54758. self._assert_equals_((7).__backslash_backslash((2)),(1));
  54759. $ctx1.sendIdx["assert:equals:"]=7;
  54760. $5=(1).__plus((2));
  54761. $ctx1.sendIdx["+"]=2;
  54762. $4=$recv($5).__star((3));
  54763. $ctx1.sendIdx["*"]=2;
  54764. self._assert_equals_($4,(9));
  54765. $ctx1.sendIdx["assert:equals:"]=8;
  54766. self._assert_equals_((1).__plus((2).__star((3))),(7));
  54767. return self;
  54768. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  54769. },
  54770. args: [],
  54771. 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",
  54772. referencedClasses: [],
  54773. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  54774. }),
  54775. $globals.NumberTest);
  54776. $core.addMethod(
  54777. $core.method({
  54778. selector: "testAsNumber",
  54779. protocol: 'tests',
  54780. fn: function (){
  54781. var self=this;
  54782. return $core.withContext(function($ctx1) {
  54783. self._assert_equals_((3)._asNumber(),(3));
  54784. return self;
  54785. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  54786. },
  54787. args: [],
  54788. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  54789. referencedClasses: [],
  54790. messageSends: ["assert:equals:", "asNumber"]
  54791. }),
  54792. $globals.NumberTest);
  54793. $core.addMethod(
  54794. $core.method({
  54795. selector: "testCeiling",
  54796. protocol: 'tests',
  54797. fn: function (){
  54798. var self=this;
  54799. return $core.withContext(function($ctx1) {
  54800. var $1,$2;
  54801. $1=(1.2)._ceiling();
  54802. $ctx1.sendIdx["ceiling"]=1;
  54803. self._assert_equals_($1,(2));
  54804. $ctx1.sendIdx["assert:equals:"]=1;
  54805. $2=(-1.2)._ceiling();
  54806. $ctx1.sendIdx["ceiling"]=2;
  54807. self._assert_equals_($2,(-1));
  54808. $ctx1.sendIdx["assert:equals:"]=2;
  54809. self._assert_equals_((1)._ceiling(),(1));
  54810. return self;
  54811. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  54812. },
  54813. args: [],
  54814. 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.",
  54815. referencedClasses: [],
  54816. messageSends: ["assert:equals:", "ceiling"]
  54817. }),
  54818. $globals.NumberTest);
  54819. $core.addMethod(
  54820. $core.method({
  54821. selector: "testComparison",
  54822. protocol: 'tests',
  54823. fn: function (){
  54824. var self=this;
  54825. return $core.withContext(function($ctx1) {
  54826. var $1,$2,$3,$4;
  54827. $1=(3).__gt((2));
  54828. $ctx1.sendIdx[">"]=1;
  54829. self._assert_($1);
  54830. $ctx1.sendIdx["assert:"]=1;
  54831. $2=(2).__lt((3));
  54832. $ctx1.sendIdx["<"]=1;
  54833. self._assert_($2);
  54834. $ctx1.sendIdx["assert:"]=2;
  54835. self._deny_((3).__lt((2)));
  54836. $ctx1.sendIdx["deny:"]=1;
  54837. self._deny_((2).__gt((3)));
  54838. $3=(3).__gt_eq((3));
  54839. $ctx1.sendIdx[">="]=1;
  54840. self._assert_($3);
  54841. $ctx1.sendIdx["assert:"]=3;
  54842. self._assert_((3.1).__gt_eq((3)));
  54843. $ctx1.sendIdx["assert:"]=4;
  54844. $4=(3).__lt_eq((3));
  54845. $ctx1.sendIdx["<="]=1;
  54846. self._assert_($4);
  54847. $ctx1.sendIdx["assert:"]=5;
  54848. self._assert_((3).__lt_eq((3.1)));
  54849. return self;
  54850. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  54851. },
  54852. args: [],
  54853. 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",
  54854. referencedClasses: [],
  54855. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  54856. }),
  54857. $globals.NumberTest);
  54858. $core.addMethod(
  54859. $core.method({
  54860. selector: "testCopying",
  54861. protocol: 'tests',
  54862. fn: function (){
  54863. var self=this;
  54864. return $core.withContext(function($ctx1) {
  54865. var $1;
  54866. $1=$recv((1)._copy()).__eq_eq((1));
  54867. $ctx1.sendIdx["=="]=1;
  54868. self._assert_($1);
  54869. $ctx1.sendIdx["assert:"]=1;
  54870. self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  54871. return self;
  54872. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  54873. },
  54874. args: [],
  54875. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  54876. referencedClasses: [],
  54877. messageSends: ["assert:", "==", "copy", "deepCopy"]
  54878. }),
  54879. $globals.NumberTest);
  54880. $core.addMethod(
  54881. $core.method({
  54882. selector: "testEquality",
  54883. protocol: 'tests',
  54884. fn: function (){
  54885. var self=this;
  54886. return $core.withContext(function($ctx1) {
  54887. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  54888. $1=(1).__eq((1));
  54889. $ctx1.sendIdx["="]=1;
  54890. self._assert_($1);
  54891. $ctx1.sendIdx["assert:"]=1;
  54892. $2=(0).__eq((0));
  54893. $ctx1.sendIdx["="]=2;
  54894. self._assert_($2);
  54895. $ctx1.sendIdx["assert:"]=2;
  54896. $3=(1).__eq((0));
  54897. $ctx1.sendIdx["="]=3;
  54898. self._deny_($3);
  54899. $ctx1.sendIdx["deny:"]=1;
  54900. $5=(1)._yourself();
  54901. $ctx1.sendIdx["yourself"]=1;
  54902. $4=$recv($5).__eq((1));
  54903. $ctx1.sendIdx["="]=4;
  54904. self._assert_($4);
  54905. $ctx1.sendIdx["assert:"]=3;
  54906. $7=(1)._yourself();
  54907. $ctx1.sendIdx["yourself"]=2;
  54908. $6=(1).__eq($7);
  54909. $ctx1.sendIdx["="]=5;
  54910. self._assert_($6);
  54911. $ctx1.sendIdx["assert:"]=4;
  54912. $9=(1)._yourself();
  54913. $ctx1.sendIdx["yourself"]=3;
  54914. $8=$recv($9).__eq((1)._yourself());
  54915. $ctx1.sendIdx["="]=6;
  54916. self._assert_($8);
  54917. $10=(0).__eq(false);
  54918. $ctx1.sendIdx["="]=7;
  54919. self._deny_($10);
  54920. $ctx1.sendIdx["deny:"]=2;
  54921. $11=false.__eq((0));
  54922. $ctx1.sendIdx["="]=8;
  54923. self._deny_($11);
  54924. $ctx1.sendIdx["deny:"]=3;
  54925. $12="".__eq((0));
  54926. $ctx1.sendIdx["="]=9;
  54927. self._deny_($12);
  54928. $ctx1.sendIdx["deny:"]=4;
  54929. self._deny_((0).__eq(""));
  54930. return self;
  54931. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  54932. },
  54933. args: [],
  54934. 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 = ''",
  54935. referencedClasses: [],
  54936. messageSends: ["assert:", "=", "deny:", "yourself"]
  54937. }),
  54938. $globals.NumberTest);
  54939. $core.addMethod(
  54940. $core.method({
  54941. selector: "testFloor",
  54942. protocol: 'tests',
  54943. fn: function (){
  54944. var self=this;
  54945. return $core.withContext(function($ctx1) {
  54946. var $1,$2;
  54947. $1=(1.2)._floor();
  54948. $ctx1.sendIdx["floor"]=1;
  54949. self._assert_equals_($1,(1));
  54950. $ctx1.sendIdx["assert:equals:"]=1;
  54951. $2=(-1.2)._floor();
  54952. $ctx1.sendIdx["floor"]=2;
  54953. self._assert_equals_($2,(-2));
  54954. $ctx1.sendIdx["assert:equals:"]=2;
  54955. self._assert_equals_((1)._floor(),(1));
  54956. return self;
  54957. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  54958. },
  54959. args: [],
  54960. 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.",
  54961. referencedClasses: [],
  54962. messageSends: ["assert:equals:", "floor"]
  54963. }),
  54964. $globals.NumberTest);
  54965. $core.addMethod(
  54966. $core.method({
  54967. selector: "testHexNumbers",
  54968. protocol: 'tests',
  54969. fn: function (){
  54970. var self=this;
  54971. return $core.withContext(function($ctx1) {
  54972. var $1,$2,$3,$4,$5;
  54973. self._assert_equals_((9),(9));
  54974. $ctx1.sendIdx["assert:equals:"]=1;
  54975. $1=(10)._truncated();
  54976. $ctx1.sendIdx["truncated"]=1;
  54977. self._assert_equals_($1,(10));
  54978. $ctx1.sendIdx["assert:equals:"]=2;
  54979. $2=(11)._truncated();
  54980. $ctx1.sendIdx["truncated"]=2;
  54981. self._assert_equals_($2,(11));
  54982. $ctx1.sendIdx["assert:equals:"]=3;
  54983. $3=(12)._truncated();
  54984. $ctx1.sendIdx["truncated"]=3;
  54985. self._assert_equals_($3,(12));
  54986. $ctx1.sendIdx["assert:equals:"]=4;
  54987. $4=(13)._truncated();
  54988. $ctx1.sendIdx["truncated"]=4;
  54989. self._assert_equals_($4,(13));
  54990. $ctx1.sendIdx["assert:equals:"]=5;
  54991. $5=(14)._truncated();
  54992. $ctx1.sendIdx["truncated"]=5;
  54993. self._assert_equals_($5,(14));
  54994. $ctx1.sendIdx["assert:equals:"]=6;
  54995. self._assert_equals_((15)._truncated(),(15));
  54996. return self;
  54997. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  54998. },
  54999. args: [],
  55000. 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",
  55001. referencedClasses: [],
  55002. messageSends: ["assert:equals:", "truncated"]
  55003. }),
  55004. $globals.NumberTest);
  55005. $core.addMethod(
  55006. $core.method({
  55007. selector: "testIdentity",
  55008. protocol: 'tests',
  55009. fn: function (){
  55010. var self=this;
  55011. return $core.withContext(function($ctx1) {
  55012. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  55013. $1=(1).__eq_eq((1));
  55014. $ctx1.sendIdx["=="]=1;
  55015. self._assert_($1);
  55016. $ctx1.sendIdx["assert:"]=1;
  55017. $2=(0).__eq_eq((0));
  55018. $ctx1.sendIdx["=="]=2;
  55019. self._assert_($2);
  55020. $ctx1.sendIdx["assert:"]=2;
  55021. $3=(1).__eq_eq((0));
  55022. $ctx1.sendIdx["=="]=3;
  55023. self._deny_($3);
  55024. $ctx1.sendIdx["deny:"]=1;
  55025. $5=(1)._yourself();
  55026. $ctx1.sendIdx["yourself"]=1;
  55027. $4=$recv($5).__eq_eq((1));
  55028. $ctx1.sendIdx["=="]=4;
  55029. self._assert_($4);
  55030. $ctx1.sendIdx["assert:"]=3;
  55031. $7=(1)._yourself();
  55032. $ctx1.sendIdx["yourself"]=2;
  55033. $6=(1).__eq_eq($7);
  55034. $ctx1.sendIdx["=="]=5;
  55035. self._assert_($6);
  55036. $ctx1.sendIdx["assert:"]=4;
  55037. $9=(1)._yourself();
  55038. $ctx1.sendIdx["yourself"]=3;
  55039. $8=$recv($9).__eq_eq((1)._yourself());
  55040. $ctx1.sendIdx["=="]=6;
  55041. self._assert_($8);
  55042. self._deny_((1).__eq_eq((2)));
  55043. return self;
  55044. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  55045. },
  55046. args: [],
  55047. 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",
  55048. referencedClasses: [],
  55049. messageSends: ["assert:", "==", "deny:", "yourself"]
  55050. }),
  55051. $globals.NumberTest);
  55052. $core.addMethod(
  55053. $core.method({
  55054. selector: "testInvalidHexNumbers",
  55055. protocol: 'tests',
  55056. fn: function (){
  55057. var self=this;
  55058. return $core.withContext(function($ctx1) {
  55059. self._should_raise_((function(){
  55060. return $core.withContext(function($ctx2) {
  55061. return (16)._rG();
  55062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55063. }),$globals.MessageNotUnderstood);
  55064. $ctx1.sendIdx["should:raise:"]=1;
  55065. self._should_raise_((function(){
  55066. return $core.withContext(function($ctx2) {
  55067. return (16)._rg();
  55068. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55069. }),$globals.MessageNotUnderstood);
  55070. $ctx1.sendIdx["should:raise:"]=2;
  55071. self._should_raise_((function(){
  55072. return $core.withContext(function($ctx2) {
  55073. return (16)._rH();
  55074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  55075. }),$globals.MessageNotUnderstood);
  55076. $ctx1.sendIdx["should:raise:"]=3;
  55077. self._should_raise_((function(){
  55078. return $core.withContext(function($ctx2) {
  55079. return (16)._rh();
  55080. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  55081. }),$globals.MessageNotUnderstood);
  55082. $ctx1.sendIdx["should:raise:"]=4;
  55083. self._should_raise_((function(){
  55084. return $core.withContext(function($ctx2) {
  55085. return (16)._rI();
  55086. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  55087. }),$globals.MessageNotUnderstood);
  55088. $ctx1.sendIdx["should:raise:"]=5;
  55089. self._should_raise_((function(){
  55090. return $core.withContext(function($ctx2) {
  55091. return (16)._ri();
  55092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  55093. }),$globals.MessageNotUnderstood);
  55094. $ctx1.sendIdx["should:raise:"]=6;
  55095. self._should_raise_((function(){
  55096. return $core.withContext(function($ctx2) {
  55097. return (16)._rJ();
  55098. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  55099. }),$globals.MessageNotUnderstood);
  55100. $ctx1.sendIdx["should:raise:"]=7;
  55101. self._should_raise_((function(){
  55102. return $core.withContext(function($ctx2) {
  55103. return (16)._rj();
  55104. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  55105. }),$globals.MessageNotUnderstood);
  55106. $ctx1.sendIdx["should:raise:"]=8;
  55107. self._should_raise_((function(){
  55108. return $core.withContext(function($ctx2) {
  55109. return (16)._rK();
  55110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  55111. }),$globals.MessageNotUnderstood);
  55112. $ctx1.sendIdx["should:raise:"]=9;
  55113. self._should_raise_((function(){
  55114. return $core.withContext(function($ctx2) {
  55115. return (16)._rk();
  55116. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  55117. }),$globals.MessageNotUnderstood);
  55118. $ctx1.sendIdx["should:raise:"]=10;
  55119. self._should_raise_((function(){
  55120. return $core.withContext(function($ctx2) {
  55121. return (16)._rL();
  55122. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  55123. }),$globals.MessageNotUnderstood);
  55124. $ctx1.sendIdx["should:raise:"]=11;
  55125. self._should_raise_((function(){
  55126. return $core.withContext(function($ctx2) {
  55127. return (16)._rl();
  55128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  55129. }),$globals.MessageNotUnderstood);
  55130. $ctx1.sendIdx["should:raise:"]=12;
  55131. self._should_raise_((function(){
  55132. return $core.withContext(function($ctx2) {
  55133. return (16)._rM();
  55134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  55135. }),$globals.MessageNotUnderstood);
  55136. $ctx1.sendIdx["should:raise:"]=13;
  55137. self._should_raise_((function(){
  55138. return $core.withContext(function($ctx2) {
  55139. return (16)._rm();
  55140. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  55141. }),$globals.MessageNotUnderstood);
  55142. $ctx1.sendIdx["should:raise:"]=14;
  55143. self._should_raise_((function(){
  55144. return $core.withContext(function($ctx2) {
  55145. return (16)._rN();
  55146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  55147. }),$globals.MessageNotUnderstood);
  55148. $ctx1.sendIdx["should:raise:"]=15;
  55149. self._should_raise_((function(){
  55150. return $core.withContext(function($ctx2) {
  55151. return (16)._rn();
  55152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  55153. }),$globals.MessageNotUnderstood);
  55154. $ctx1.sendIdx["should:raise:"]=16;
  55155. self._should_raise_((function(){
  55156. return $core.withContext(function($ctx2) {
  55157. return (16)._rO();
  55158. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  55159. }),$globals.MessageNotUnderstood);
  55160. $ctx1.sendIdx["should:raise:"]=17;
  55161. self._should_raise_((function(){
  55162. return $core.withContext(function($ctx2) {
  55163. return (16)._ro();
  55164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  55165. }),$globals.MessageNotUnderstood);
  55166. $ctx1.sendIdx["should:raise:"]=18;
  55167. self._should_raise_((function(){
  55168. return $core.withContext(function($ctx2) {
  55169. return (16)._rP();
  55170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  55171. }),$globals.MessageNotUnderstood);
  55172. $ctx1.sendIdx["should:raise:"]=19;
  55173. self._should_raise_((function(){
  55174. return $core.withContext(function($ctx2) {
  55175. return (16)._rp();
  55176. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  55177. }),$globals.MessageNotUnderstood);
  55178. $ctx1.sendIdx["should:raise:"]=20;
  55179. self._should_raise_((function(){
  55180. return $core.withContext(function($ctx2) {
  55181. return (16)._rQ();
  55182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  55183. }),$globals.MessageNotUnderstood);
  55184. $ctx1.sendIdx["should:raise:"]=21;
  55185. self._should_raise_((function(){
  55186. return $core.withContext(function($ctx2) {
  55187. return (16)._rq();
  55188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  55189. }),$globals.MessageNotUnderstood);
  55190. $ctx1.sendIdx["should:raise:"]=22;
  55191. self._should_raise_((function(){
  55192. return $core.withContext(function($ctx2) {
  55193. return (16)._rR();
  55194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  55195. }),$globals.MessageNotUnderstood);
  55196. $ctx1.sendIdx["should:raise:"]=23;
  55197. self._should_raise_((function(){
  55198. return $core.withContext(function($ctx2) {
  55199. return (16)._rr();
  55200. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  55201. }),$globals.MessageNotUnderstood);
  55202. $ctx1.sendIdx["should:raise:"]=24;
  55203. self._should_raise_((function(){
  55204. return $core.withContext(function($ctx2) {
  55205. return (16)._rS();
  55206. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  55207. }),$globals.MessageNotUnderstood);
  55208. $ctx1.sendIdx["should:raise:"]=25;
  55209. self._should_raise_((function(){
  55210. return $core.withContext(function($ctx2) {
  55211. return (16)._rs();
  55212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  55213. }),$globals.MessageNotUnderstood);
  55214. $ctx1.sendIdx["should:raise:"]=26;
  55215. self._should_raise_((function(){
  55216. return $core.withContext(function($ctx2) {
  55217. return (16)._rT();
  55218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  55219. }),$globals.MessageNotUnderstood);
  55220. $ctx1.sendIdx["should:raise:"]=27;
  55221. self._should_raise_((function(){
  55222. return $core.withContext(function($ctx2) {
  55223. return (16)._rt();
  55224. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  55225. }),$globals.MessageNotUnderstood);
  55226. $ctx1.sendIdx["should:raise:"]=28;
  55227. self._should_raise_((function(){
  55228. return $core.withContext(function($ctx2) {
  55229. return (16)._rU();
  55230. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  55231. }),$globals.MessageNotUnderstood);
  55232. $ctx1.sendIdx["should:raise:"]=29;
  55233. self._should_raise_((function(){
  55234. return $core.withContext(function($ctx2) {
  55235. return (16)._ru();
  55236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  55237. }),$globals.MessageNotUnderstood);
  55238. $ctx1.sendIdx["should:raise:"]=30;
  55239. self._should_raise_((function(){
  55240. return $core.withContext(function($ctx2) {
  55241. return (16)._rV();
  55242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  55243. }),$globals.MessageNotUnderstood);
  55244. $ctx1.sendIdx["should:raise:"]=31;
  55245. self._should_raise_((function(){
  55246. return $core.withContext(function($ctx2) {
  55247. return (16)._rv();
  55248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  55249. }),$globals.MessageNotUnderstood);
  55250. $ctx1.sendIdx["should:raise:"]=32;
  55251. self._should_raise_((function(){
  55252. return $core.withContext(function($ctx2) {
  55253. return (16)._rW();
  55254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  55255. }),$globals.MessageNotUnderstood);
  55256. $ctx1.sendIdx["should:raise:"]=33;
  55257. self._should_raise_((function(){
  55258. return $core.withContext(function($ctx2) {
  55259. return (16)._rw();
  55260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  55261. }),$globals.MessageNotUnderstood);
  55262. $ctx1.sendIdx["should:raise:"]=34;
  55263. self._should_raise_((function(){
  55264. return $core.withContext(function($ctx2) {
  55265. return (16)._rX();
  55266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  55267. }),$globals.MessageNotUnderstood);
  55268. $ctx1.sendIdx["should:raise:"]=35;
  55269. self._should_raise_((function(){
  55270. return $core.withContext(function($ctx2) {
  55271. return (16)._rx();
  55272. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  55273. }),$globals.MessageNotUnderstood);
  55274. $ctx1.sendIdx["should:raise:"]=36;
  55275. self._should_raise_((function(){
  55276. return $core.withContext(function($ctx2) {
  55277. return (16)._rY();
  55278. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  55279. }),$globals.MessageNotUnderstood);
  55280. $ctx1.sendIdx["should:raise:"]=37;
  55281. self._should_raise_((function(){
  55282. return $core.withContext(function($ctx2) {
  55283. return (16)._ry();
  55284. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  55285. }),$globals.MessageNotUnderstood);
  55286. $ctx1.sendIdx["should:raise:"]=38;
  55287. self._should_raise_((function(){
  55288. return $core.withContext(function($ctx2) {
  55289. return (16)._rZ();
  55290. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  55291. }),$globals.MessageNotUnderstood);
  55292. $ctx1.sendIdx["should:raise:"]=39;
  55293. self._should_raise_((function(){
  55294. return $core.withContext(function($ctx2) {
  55295. return (16)._rz();
  55296. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  55297. }),$globals.MessageNotUnderstood);
  55298. $ctx1.sendIdx["should:raise:"]=40;
  55299. self._should_raise_((function(){
  55300. return $core.withContext(function($ctx2) {
  55301. return (11259375)._Z();
  55302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  55303. }),$globals.MessageNotUnderstood);
  55304. return self;
  55305. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  55306. },
  55307. args: [],
  55308. 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.",
  55309. referencedClasses: ["MessageNotUnderstood"],
  55310. 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"]
  55311. }),
  55312. $globals.NumberTest);
  55313. $core.addMethod(
  55314. $core.method({
  55315. selector: "testLog",
  55316. protocol: 'tests',
  55317. fn: function (){
  55318. var self=this;
  55319. return $core.withContext(function($ctx1) {
  55320. self._assert_equals_((10000)._log(),(4));
  55321. $ctx1.sendIdx["assert:equals:"]=1;
  55322. self._assert_equals_((512)._log_((2)),(9));
  55323. $ctx1.sendIdx["assert:equals:"]=2;
  55324. self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  55325. return self;
  55326. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  55327. },
  55328. args: [],
  55329. 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.",
  55330. referencedClasses: ["Number"],
  55331. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  55332. }),
  55333. $globals.NumberTest);
  55334. $core.addMethod(
  55335. $core.method({
  55336. selector: "testMinMax",
  55337. protocol: 'tests',
  55338. fn: function (){
  55339. var self=this;
  55340. return $core.withContext(function($ctx1) {
  55341. self._assert_equals_((2)._max_((5)),(5));
  55342. $ctx1.sendIdx["assert:equals:"]=1;
  55343. self._assert_equals_((2)._min_((5)),(2));
  55344. return self;
  55345. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  55346. },
  55347. args: [],
  55348. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  55349. referencedClasses: [],
  55350. messageSends: ["assert:equals:", "max:", "min:"]
  55351. }),
  55352. $globals.NumberTest);
  55353. $core.addMethod(
  55354. $core.method({
  55355. selector: "testNegated",
  55356. protocol: 'tests',
  55357. fn: function (){
  55358. var self=this;
  55359. return $core.withContext(function($ctx1) {
  55360. var $1;
  55361. $1=(3)._negated();
  55362. $ctx1.sendIdx["negated"]=1;
  55363. self._assert_equals_($1,(-3));
  55364. $ctx1.sendIdx["assert:equals:"]=1;
  55365. self._assert_equals_((-3)._negated(),(3));
  55366. return self;
  55367. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  55368. },
  55369. args: [],
  55370. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  55371. referencedClasses: [],
  55372. messageSends: ["assert:equals:", "negated"]
  55373. }),
  55374. $globals.NumberTest);
  55375. $core.addMethod(
  55376. $core.method({
  55377. selector: "testPrintShowingDecimalPlaces",
  55378. protocol: 'tests',
  55379. fn: function (){
  55380. var self=this;
  55381. return $core.withContext(function($ctx1) {
  55382. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  55383. $1=(23)._printShowingDecimalPlaces_((2));
  55384. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  55385. self._assert_equals_($1,"23.00");
  55386. $ctx1.sendIdx["assert:equals:"]=1;
  55387. $2=(23.5698)._printShowingDecimalPlaces_((2));
  55388. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  55389. self._assert_equals_($2,"23.57");
  55390. $ctx1.sendIdx["assert:equals:"]=2;
  55391. $4=(234.567)._negated();
  55392. $ctx1.sendIdx["negated"]=1;
  55393. $3=$recv($4)._printShowingDecimalPlaces_((5));
  55394. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  55395. self._assert_equals_($3,"-234.56700");
  55396. $ctx1.sendIdx["assert:equals:"]=3;
  55397. $5=(23.4567)._printShowingDecimalPlaces_((0));
  55398. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  55399. self._assert_equals_($5,"23");
  55400. $ctx1.sendIdx["assert:equals:"]=4;
  55401. $6=(23.5567)._printShowingDecimalPlaces_((0));
  55402. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  55403. self._assert_equals_($6,"24");
  55404. $ctx1.sendIdx["assert:equals:"]=5;
  55405. $8=(23.4567)._negated();
  55406. $ctx1.sendIdx["negated"]=2;
  55407. $7=$recv($8)._printShowingDecimalPlaces_((0));
  55408. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  55409. self._assert_equals_($7,"-23");
  55410. $ctx1.sendIdx["assert:equals:"]=6;
  55411. $10=(23.5567)._negated();
  55412. $ctx1.sendIdx["negated"]=3;
  55413. $9=$recv($10)._printShowingDecimalPlaces_((0));
  55414. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  55415. self._assert_equals_($9,"-24");
  55416. $ctx1.sendIdx["assert:equals:"]=7;
  55417. $11=(100000000)._printShowingDecimalPlaces_((1));
  55418. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  55419. self._assert_equals_($11,"100000000.0");
  55420. $ctx1.sendIdx["assert:equals:"]=8;
  55421. $12=(0.98)._printShowingDecimalPlaces_((5));
  55422. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  55423. self._assert_equals_($12,"0.98000");
  55424. $ctx1.sendIdx["assert:equals:"]=9;
  55425. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  55426. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  55427. self._assert_equals_($13,"-0.98");
  55428. $ctx1.sendIdx["assert:equals:"]=10;
  55429. $14=(2.567)._printShowingDecimalPlaces_((2));
  55430. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  55431. self._assert_equals_($14,"2.57");
  55432. $ctx1.sendIdx["assert:equals:"]=11;
  55433. $15=(-2.567)._printShowingDecimalPlaces_((2));
  55434. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  55435. self._assert_equals_($15,"-2.57");
  55436. $ctx1.sendIdx["assert:equals:"]=12;
  55437. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  55438. return self;
  55439. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  55440. },
  55441. args: [],
  55442. 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'.",
  55443. referencedClasses: [],
  55444. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  55445. }),
  55446. $globals.NumberTest);
  55447. $core.addMethod(
  55448. $core.method({
  55449. selector: "testRaisedTo",
  55450. protocol: 'tests',
  55451. fn: function (){
  55452. var self=this;
  55453. return $core.withContext(function($ctx1) {
  55454. var $1,$2,$3;
  55455. $1=(2)._raisedTo_((4));
  55456. $ctx1.sendIdx["raisedTo:"]=1;
  55457. self._assert_equals_($1,(16));
  55458. $ctx1.sendIdx["assert:equals:"]=1;
  55459. $2=(2)._raisedTo_((0));
  55460. $ctx1.sendIdx["raisedTo:"]=2;
  55461. self._assert_equals_($2,(1));
  55462. $ctx1.sendIdx["assert:equals:"]=2;
  55463. $3=(2)._raisedTo_((-3));
  55464. $ctx1.sendIdx["raisedTo:"]=3;
  55465. self._assert_equals_($3,(0.125));
  55466. $ctx1.sendIdx["assert:equals:"]=3;
  55467. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  55468. $ctx1.sendIdx["assert:equals:"]=4;
  55469. self._assert_equals_((2).__star_star((4)),(16));
  55470. return self;
  55471. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  55472. },
  55473. args: [],
  55474. 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.",
  55475. referencedClasses: [],
  55476. messageSends: ["assert:equals:", "raisedTo:", "**"]
  55477. }),
  55478. $globals.NumberTest);
  55479. $core.addMethod(
  55480. $core.method({
  55481. selector: "testRounded",
  55482. protocol: 'tests',
  55483. fn: function (){
  55484. var self=this;
  55485. return $core.withContext(function($ctx1) {
  55486. var $1,$2;
  55487. $1=(3)._rounded();
  55488. $ctx1.sendIdx["rounded"]=1;
  55489. self._assert_equals_($1,(3));
  55490. $ctx1.sendIdx["assert:equals:"]=1;
  55491. $2=(3.212)._rounded();
  55492. $ctx1.sendIdx["rounded"]=2;
  55493. self._assert_equals_($2,(3));
  55494. $ctx1.sendIdx["assert:equals:"]=2;
  55495. self._assert_equals_((3.51)._rounded(),(4));
  55496. return self;
  55497. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  55498. },
  55499. args: [],
  55500. 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",
  55501. referencedClasses: [],
  55502. messageSends: ["assert:equals:", "rounded"]
  55503. }),
  55504. $globals.NumberTest);
  55505. $core.addMethod(
  55506. $core.method({
  55507. selector: "testSign",
  55508. protocol: 'tests',
  55509. fn: function (){
  55510. var self=this;
  55511. return $core.withContext(function($ctx1) {
  55512. var $1,$2;
  55513. $1=(5)._sign();
  55514. $ctx1.sendIdx["sign"]=1;
  55515. self._assert_equals_($1,(1));
  55516. $ctx1.sendIdx["assert:equals:"]=1;
  55517. $2=(0)._sign();
  55518. $ctx1.sendIdx["sign"]=2;
  55519. self._assert_equals_($2,(0));
  55520. $ctx1.sendIdx["assert:equals:"]=2;
  55521. self._assert_equals_((-1.4)._sign(),(-1));
  55522. return self;
  55523. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  55524. },
  55525. args: [],
  55526. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  55527. referencedClasses: [],
  55528. messageSends: ["assert:equals:", "sign"]
  55529. }),
  55530. $globals.NumberTest);
  55531. $core.addMethod(
  55532. $core.method({
  55533. selector: "testSqrt",
  55534. protocol: 'tests',
  55535. fn: function (){
  55536. var self=this;
  55537. return $core.withContext(function($ctx1) {
  55538. var $1;
  55539. $1=(4)._sqrt();
  55540. $ctx1.sendIdx["sqrt"]=1;
  55541. self._assert_equals_($1,(2));
  55542. $ctx1.sendIdx["assert:equals:"]=1;
  55543. self._assert_equals_((16)._sqrt(),(4));
  55544. return self;
  55545. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  55546. },
  55547. args: [],
  55548. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  55549. referencedClasses: [],
  55550. messageSends: ["assert:equals:", "sqrt"]
  55551. }),
  55552. $globals.NumberTest);
  55553. $core.addMethod(
  55554. $core.method({
  55555. selector: "testSquared",
  55556. protocol: 'tests',
  55557. fn: function (){
  55558. var self=this;
  55559. return $core.withContext(function($ctx1) {
  55560. self._assert_equals_((4)._squared(),(16));
  55561. return self;
  55562. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  55563. },
  55564. args: [],
  55565. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  55566. referencedClasses: [],
  55567. messageSends: ["assert:equals:", "squared"]
  55568. }),
  55569. $globals.NumberTest);
  55570. $core.addMethod(
  55571. $core.method({
  55572. selector: "testTimesRepeat",
  55573. protocol: 'tests',
  55574. fn: function (){
  55575. var self=this;
  55576. var i;
  55577. return $core.withContext(function($ctx1) {
  55578. i=(0);
  55579. (0)._timesRepeat_((function(){
  55580. return $core.withContext(function($ctx2) {
  55581. i=$recv(i).__plus((1));
  55582. $ctx2.sendIdx["+"]=1;
  55583. return i;
  55584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55585. }));
  55586. $ctx1.sendIdx["timesRepeat:"]=1;
  55587. self._assert_equals_(i,(0));
  55588. $ctx1.sendIdx["assert:equals:"]=1;
  55589. (5)._timesRepeat_((function(){
  55590. return $core.withContext(function($ctx2) {
  55591. i=$recv(i).__plus((1));
  55592. return i;
  55593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55594. }));
  55595. self._assert_equals_(i,(5));
  55596. return self;
  55597. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  55598. },
  55599. args: [],
  55600. 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",
  55601. referencedClasses: [],
  55602. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  55603. }),
  55604. $globals.NumberTest);
  55605. $core.addMethod(
  55606. $core.method({
  55607. selector: "testTo",
  55608. protocol: 'tests',
  55609. fn: function (){
  55610. var self=this;
  55611. return $core.withContext(function($ctx1) {
  55612. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  55613. return self;
  55614. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  55615. },
  55616. args: [],
  55617. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  55618. referencedClasses: [],
  55619. messageSends: ["assert:equals:", "to:"]
  55620. }),
  55621. $globals.NumberTest);
  55622. $core.addMethod(
  55623. $core.method({
  55624. selector: "testToBy",
  55625. protocol: 'tests',
  55626. fn: function (){
  55627. var self=this;
  55628. return $core.withContext(function($ctx1) {
  55629. var $1;
  55630. $1=(0)._to_by_((6),(2));
  55631. $ctx1.sendIdx["to:by:"]=1;
  55632. self._assert_equals_($1,[(0), (2), (4), (6)]);
  55633. self._should_raise_((function(){
  55634. return $core.withContext(function($ctx2) {
  55635. return (1)._to_by_((4),(0));
  55636. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55637. }),$globals.Error);
  55638. return self;
  55639. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  55640. },
  55641. args: [],
  55642. 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",
  55643. referencedClasses: ["Error"],
  55644. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  55645. }),
  55646. $globals.NumberTest);
  55647. $core.addMethod(
  55648. $core.method({
  55649. selector: "testTrigonometry",
  55650. protocol: 'tests',
  55651. fn: function (){
  55652. var self=this;
  55653. return $core.withContext(function($ctx1) {
  55654. self._assert_equals_((0)._cos(),(1));
  55655. $ctx1.sendIdx["assert:equals:"]=1;
  55656. self._assert_equals_((0)._sin(),(0));
  55657. $ctx1.sendIdx["assert:equals:"]=2;
  55658. self._assert_equals_((0)._tan(),(0));
  55659. $ctx1.sendIdx["assert:equals:"]=3;
  55660. self._assert_equals_((1)._arcCos(),(0));
  55661. $ctx1.sendIdx["assert:equals:"]=4;
  55662. self._assert_equals_((0)._arcSin(),(0));
  55663. $ctx1.sendIdx["assert:equals:"]=5;
  55664. self._assert_equals_((0)._arcTan(),(0));
  55665. return self;
  55666. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  55667. },
  55668. args: [],
  55669. 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.",
  55670. referencedClasses: [],
  55671. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  55672. }),
  55673. $globals.NumberTest);
  55674. $core.addMethod(
  55675. $core.method({
  55676. selector: "testTruncated",
  55677. protocol: 'tests',
  55678. fn: function (){
  55679. var self=this;
  55680. return $core.withContext(function($ctx1) {
  55681. var $1,$2;
  55682. $1=(3)._truncated();
  55683. $ctx1.sendIdx["truncated"]=1;
  55684. self._assert_equals_($1,(3));
  55685. $ctx1.sendIdx["assert:equals:"]=1;
  55686. $2=(3.212)._truncated();
  55687. $ctx1.sendIdx["truncated"]=2;
  55688. self._assert_equals_($2,(3));
  55689. $ctx1.sendIdx["assert:equals:"]=2;
  55690. self._assert_equals_((3.51)._truncated(),(3));
  55691. return self;
  55692. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  55693. },
  55694. args: [],
  55695. 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",
  55696. referencedClasses: [],
  55697. messageSends: ["assert:equals:", "truncated"]
  55698. }),
  55699. $globals.NumberTest);
  55700. $core.addClass('ObjectMock', $globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  55701. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  55702. $core.addMethod(
  55703. $core.method({
  55704. selector: "foo",
  55705. protocol: 'not yet classified',
  55706. fn: function (){
  55707. var self=this;
  55708. return self["@foo"];
  55709. },
  55710. args: [],
  55711. source: "foo\x0a\x09^ foo",
  55712. referencedClasses: [],
  55713. messageSends: []
  55714. }),
  55715. $globals.ObjectMock);
  55716. $core.addMethod(
  55717. $core.method({
  55718. selector: "foo:",
  55719. protocol: 'not yet classified',
  55720. fn: function (anObject){
  55721. var self=this;
  55722. self["@foo"]=anObject;
  55723. return self;
  55724. },
  55725. args: ["anObject"],
  55726. source: "foo: anObject\x0a\x09foo := anObject",
  55727. referencedClasses: [],
  55728. messageSends: []
  55729. }),
  55730. $globals.ObjectMock);
  55731. $core.addClass('ObjectTest', $globals.TestCase, [], 'Kernel-Tests');
  55732. $core.addMethod(
  55733. $core.method({
  55734. selector: "notDefined",
  55735. protocol: 'tests',
  55736. fn: function (){
  55737. var self=this;
  55738. return $core.withContext(function($ctx1) {
  55739. return void 0;;
  55740. return self;
  55741. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  55742. },
  55743. args: [],
  55744. source: "notDefined\x0a\x09<return void 0;>",
  55745. referencedClasses: [],
  55746. messageSends: []
  55747. }),
  55748. $globals.ObjectTest);
  55749. $core.addMethod(
  55750. $core.method({
  55751. selector: "testBasicAccess",
  55752. protocol: 'tests',
  55753. fn: function (){
  55754. var self=this;
  55755. var o;
  55756. return $core.withContext(function($ctx1) {
  55757. var $1;
  55758. o=$recv($globals.Object)._new();
  55759. $recv(o)._basicAt_put_("a",(1));
  55760. $1=$recv(o)._basicAt_("a");
  55761. $ctx1.sendIdx["basicAt:"]=1;
  55762. self._assert_equals_($1,(1));
  55763. $ctx1.sendIdx["assert:equals:"]=1;
  55764. self._assert_equals_($recv(o)._basicAt_("b"),nil);
  55765. return self;
  55766. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  55767. },
  55768. args: [],
  55769. 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",
  55770. referencedClasses: ["Object"],
  55771. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  55772. }),
  55773. $globals.ObjectTest);
  55774. $core.addMethod(
  55775. $core.method({
  55776. selector: "testBasicPerform",
  55777. protocol: 'tests',
  55778. fn: function (){
  55779. var self=this;
  55780. var o;
  55781. return $core.withContext(function($ctx1) {
  55782. o=$recv($globals.Object)._new();
  55783. $recv(o)._basicAt_put_("func",(function(){
  55784. return "hello";
  55785. }));
  55786. $ctx1.sendIdx["basicAt:put:"]=1;
  55787. $recv(o)._basicAt_put_("func2",(function(a){
  55788. return $core.withContext(function($ctx2) {
  55789. return $recv(a).__plus((1));
  55790. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  55791. }));
  55792. self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  55793. $ctx1.sendIdx["assert:equals:"]=1;
  55794. self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  55795. return self;
  55796. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  55797. },
  55798. args: [],
  55799. 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",
  55800. referencedClasses: ["Object"],
  55801. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  55802. }),
  55803. $globals.ObjectTest);
  55804. $core.addMethod(
  55805. $core.method({
  55806. selector: "testDNU",
  55807. protocol: 'tests',
  55808. fn: function (){
  55809. var self=this;
  55810. return $core.withContext(function($ctx1) {
  55811. self._should_raise_((function(){
  55812. return $core.withContext(function($ctx2) {
  55813. return $recv($recv($globals.Object)._new())._foo();
  55814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55815. }),$globals.MessageNotUnderstood);
  55816. return self;
  55817. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  55818. },
  55819. args: [],
  55820. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  55821. referencedClasses: ["Object", "MessageNotUnderstood"],
  55822. messageSends: ["should:raise:", "foo", "new"]
  55823. }),
  55824. $globals.ObjectTest);
  55825. $core.addMethod(
  55826. $core.method({
  55827. selector: "testEquality",
  55828. protocol: 'tests',
  55829. fn: function (){
  55830. var self=this;
  55831. var o;
  55832. return $core.withContext(function($ctx1) {
  55833. var $1,$2,$4,$3;
  55834. o=$recv($globals.Object)._new();
  55835. $ctx1.sendIdx["new"]=1;
  55836. $1=$recv(o).__eq($recv($globals.Object)._new());
  55837. $ctx1.sendIdx["="]=1;
  55838. self._deny_($1);
  55839. $2=$recv(o).__eq(o);
  55840. $ctx1.sendIdx["="]=2;
  55841. self._assert_($2);
  55842. $ctx1.sendIdx["assert:"]=1;
  55843. $4=$recv(o)._yourself();
  55844. $ctx1.sendIdx["yourself"]=1;
  55845. $3=$recv($4).__eq(o);
  55846. $ctx1.sendIdx["="]=3;
  55847. self._assert_($3);
  55848. $ctx1.sendIdx["assert:"]=2;
  55849. self._assert_($recv(o).__eq($recv(o)._yourself()));
  55850. return self;
  55851. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  55852. },
  55853. args: [],
  55854. 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)",
  55855. referencedClasses: ["Object"],
  55856. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  55857. }),
  55858. $globals.ObjectTest);
  55859. $core.addMethod(
  55860. $core.method({
  55861. selector: "testHalt",
  55862. protocol: 'tests',
  55863. fn: function (){
  55864. var self=this;
  55865. return $core.withContext(function($ctx1) {
  55866. self._should_raise_((function(){
  55867. return $core.withContext(function($ctx2) {
  55868. return $recv($recv($globals.Object)._new())._halt();
  55869. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55870. }),$globals.Error);
  55871. return self;
  55872. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  55873. },
  55874. args: [],
  55875. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  55876. referencedClasses: ["Object", "Error"],
  55877. messageSends: ["should:raise:", "halt", "new"]
  55878. }),
  55879. $globals.ObjectTest);
  55880. $core.addMethod(
  55881. $core.method({
  55882. selector: "testIdentity",
  55883. protocol: 'tests',
  55884. fn: function (){
  55885. var self=this;
  55886. var o;
  55887. return $core.withContext(function($ctx1) {
  55888. var $1,$2,$4,$3;
  55889. o=$recv($globals.Object)._new();
  55890. $ctx1.sendIdx["new"]=1;
  55891. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  55892. $ctx1.sendIdx["=="]=1;
  55893. self._deny_($1);
  55894. $2=$recv(o).__eq_eq(o);
  55895. $ctx1.sendIdx["=="]=2;
  55896. self._assert_($2);
  55897. $ctx1.sendIdx["assert:"]=1;
  55898. $4=$recv(o)._yourself();
  55899. $ctx1.sendIdx["yourself"]=1;
  55900. $3=$recv($4).__eq_eq(o);
  55901. $ctx1.sendIdx["=="]=3;
  55902. self._assert_($3);
  55903. $ctx1.sendIdx["assert:"]=2;
  55904. self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  55905. return self;
  55906. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  55907. },
  55908. args: [],
  55909. 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",
  55910. referencedClasses: ["Object"],
  55911. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  55912. }),
  55913. $globals.ObjectTest);
  55914. $core.addMethod(
  55915. $core.method({
  55916. selector: "testIfNil",
  55917. protocol: 'tests',
  55918. fn: function (){
  55919. var self=this;
  55920. return $core.withContext(function($ctx1) {
  55921. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  55922. $2=$recv($globals.Object)._new();
  55923. $ctx1.sendIdx["new"]=1;
  55924. $1=$recv($2)._isNil();
  55925. self._deny_($1);
  55926. $ctx1.sendIdx["deny:"]=1;
  55927. $5=$recv($globals.Object)._new();
  55928. $ctx1.sendIdx["new"]=2;
  55929. if(($receiver = $5) == null || $receiver.isNil){
  55930. $4=true;
  55931. } else {
  55932. $4=$5;
  55933. };
  55934. $3=$recv($4).__eq(true);
  55935. self._deny_($3);
  55936. $7=$recv($globals.Object)._new();
  55937. $ctx1.sendIdx["new"]=3;
  55938. if(($receiver = $7) == null || $receiver.isNil){
  55939. $6=$7;
  55940. } else {
  55941. $6=true;
  55942. };
  55943. self._assert_equals_($6,true);
  55944. $ctx1.sendIdx["assert:equals:"]=1;
  55945. $9=$recv($globals.Object)._new();
  55946. $ctx1.sendIdx["new"]=4;
  55947. if(($receiver = $9) == null || $receiver.isNil){
  55948. $8=false;
  55949. } else {
  55950. $8=true;
  55951. };
  55952. self._assert_equals_($8,true);
  55953. $ctx1.sendIdx["assert:equals:"]=2;
  55954. $11=$recv($globals.Object)._new();
  55955. if(($receiver = $11) == null || $receiver.isNil){
  55956. $10=false;
  55957. } else {
  55958. $10=true;
  55959. };
  55960. self._assert_equals_($10,true);
  55961. return self;
  55962. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  55963. },
  55964. args: [],
  55965. 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",
  55966. referencedClasses: ["Object"],
  55967. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  55968. }),
  55969. $globals.ObjectTest);
  55970. $core.addMethod(
  55971. $core.method({
  55972. selector: "testInstVars",
  55973. protocol: 'tests',
  55974. fn: function (){
  55975. var self=this;
  55976. var o;
  55977. return $core.withContext(function($ctx1) {
  55978. var $1,$2;
  55979. o=$recv($globals.ObjectMock)._new();
  55980. $1=$recv(o)._instVarAt_("foo");
  55981. $ctx1.sendIdx["instVarAt:"]=1;
  55982. self._assert_equals_($1,nil);
  55983. $ctx1.sendIdx["assert:equals:"]=1;
  55984. $recv(o)._instVarAt_put_("foo",(1));
  55985. $2=$recv(o)._instVarAt_("foo");
  55986. $ctx1.sendIdx["instVarAt:"]=2;
  55987. self._assert_equals_($2,(1));
  55988. $ctx1.sendIdx["assert:equals:"]=2;
  55989. self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  55990. return self;
  55991. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  55992. },
  55993. args: [],
  55994. 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",
  55995. referencedClasses: ["ObjectMock"],
  55996. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  55997. }),
  55998. $globals.ObjectTest);
  55999. $core.addMethod(
  56000. $core.method({
  56001. selector: "testNilUndefined",
  56002. protocol: 'tests',
  56003. fn: function (){
  56004. var self=this;
  56005. return $core.withContext(function($ctx1) {
  56006. self._assert_equals_(self._notDefined(),nil);
  56007. return self;
  56008. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  56009. },
  56010. args: [],
  56011. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  56012. referencedClasses: [],
  56013. messageSends: ["assert:equals:", "notDefined"]
  56014. }),
  56015. $globals.ObjectTest);
  56016. $core.addMethod(
  56017. $core.method({
  56018. selector: "testYourself",
  56019. protocol: 'tests',
  56020. fn: function (){
  56021. var self=this;
  56022. var o;
  56023. return $core.withContext(function($ctx1) {
  56024. o=$recv($globals.ObjectMock)._new();
  56025. self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  56026. return self;
  56027. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  56028. },
  56029. args: [],
  56030. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  56031. referencedClasses: ["ObjectMock"],
  56032. messageSends: ["new", "assert:", "==", "yourself"]
  56033. }),
  56034. $globals.ObjectTest);
  56035. $core.addMethod(
  56036. $core.method({
  56037. selector: "testidentityHash",
  56038. protocol: 'tests',
  56039. fn: function (){
  56040. var self=this;
  56041. var o1,o2;
  56042. return $core.withContext(function($ctx1) {
  56043. var $2,$3,$1,$5,$4;
  56044. o1=$recv($globals.Object)._new();
  56045. $ctx1.sendIdx["new"]=1;
  56046. o2=$recv($globals.Object)._new();
  56047. $2=$recv(o1)._identityHash();
  56048. $ctx1.sendIdx["identityHash"]=1;
  56049. $3=$recv(o1)._identityHash();
  56050. $ctx1.sendIdx["identityHash"]=2;
  56051. $1=$recv($2).__eq_eq($3);
  56052. $ctx1.sendIdx["=="]=1;
  56053. self._assert_($1);
  56054. $5=$recv(o1)._identityHash();
  56055. $ctx1.sendIdx["identityHash"]=3;
  56056. $4=$recv($5).__eq_eq($recv(o2)._identityHash());
  56057. self._deny_($4);
  56058. return self;
  56059. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)});
  56060. },
  56061. args: [],
  56062. 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",
  56063. referencedClasses: ["Object"],
  56064. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  56065. }),
  56066. $globals.ObjectTest);
  56067. $core.addClass('PointTest', $globals.TestCase, [], 'Kernel-Tests');
  56068. $core.addMethod(
  56069. $core.method({
  56070. selector: "testAccessing",
  56071. protocol: 'tests',
  56072. fn: function (){
  56073. var self=this;
  56074. return $core.withContext(function($ctx1) {
  56075. var $2,$1,$3,$6,$5,$4;
  56076. $2=$recv($globals.Point)._x_y_((3),(4));
  56077. $ctx1.sendIdx["x:y:"]=1;
  56078. $1=$recv($2)._x();
  56079. $ctx1.sendIdx["x"]=1;
  56080. self._assert_equals_($1,(3));
  56081. $ctx1.sendIdx["assert:equals:"]=1;
  56082. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  56083. $ctx1.sendIdx["y"]=1;
  56084. self._assert_equals_($3,(4));
  56085. $ctx1.sendIdx["assert:equals:"]=2;
  56086. $6=$recv($globals.Point)._new();
  56087. $ctx1.sendIdx["new"]=1;
  56088. $5=$recv($6)._x_((3));
  56089. $4=$recv($5)._x();
  56090. self._assert_equals_($4,(3));
  56091. $ctx1.sendIdx["assert:equals:"]=3;
  56092. self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  56093. return self;
  56094. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  56095. },
  56096. args: [],
  56097. 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",
  56098. referencedClasses: ["Point"],
  56099. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  56100. }),
  56101. $globals.PointTest);
  56102. $core.addMethod(
  56103. $core.method({
  56104. selector: "testArithmetic",
  56105. protocol: 'tests',
  56106. fn: function (){
  56107. var self=this;
  56108. return $core.withContext(function($ctx1) {
  56109. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  56110. $2=(3).__at((4));
  56111. $ctx1.sendIdx["@"]=1;
  56112. $3=(3).__at((4));
  56113. $ctx1.sendIdx["@"]=2;
  56114. $1=$recv($2).__star($3);
  56115. $4=$recv($globals.Point)._x_y_((9),(16));
  56116. $ctx1.sendIdx["x:y:"]=1;
  56117. self._assert_equals_($1,$4);
  56118. $ctx1.sendIdx["assert:equals:"]=1;
  56119. $6=(3).__at((4));
  56120. $ctx1.sendIdx["@"]=3;
  56121. $7=(3).__at((4));
  56122. $ctx1.sendIdx["@"]=4;
  56123. $5=$recv($6).__plus($7);
  56124. $8=$recv($globals.Point)._x_y_((6),(8));
  56125. $ctx1.sendIdx["x:y:"]=2;
  56126. self._assert_equals_($5,$8);
  56127. $ctx1.sendIdx["assert:equals:"]=2;
  56128. $10=(3).__at((4));
  56129. $ctx1.sendIdx["@"]=5;
  56130. $11=(3).__at((4));
  56131. $ctx1.sendIdx["@"]=6;
  56132. $9=$recv($10).__minus($11);
  56133. $12=$recv($globals.Point)._x_y_((0),(0));
  56134. $ctx1.sendIdx["x:y:"]=3;
  56135. self._assert_equals_($9,$12);
  56136. $ctx1.sendIdx["assert:equals:"]=3;
  56137. $14=(6).__at((8));
  56138. $ctx1.sendIdx["@"]=7;
  56139. $13=$recv($14).__slash((3).__at((4)));
  56140. self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  56141. return self;
  56142. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  56143. },
  56144. args: [],
  56145. 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)",
  56146. referencedClasses: ["Point"],
  56147. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  56148. }),
  56149. $globals.PointTest);
  56150. $core.addMethod(
  56151. $core.method({
  56152. selector: "testAt",
  56153. protocol: 'tests',
  56154. fn: function (){
  56155. var self=this;
  56156. return $core.withContext(function($ctx1) {
  56157. self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  56158. return self;
  56159. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  56160. },
  56161. args: [],
  56162. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  56163. referencedClasses: ["Point"],
  56164. messageSends: ["assert:equals:", "@", "x:y:"]
  56165. }),
  56166. $globals.PointTest);
  56167. $core.addMethod(
  56168. $core.method({
  56169. selector: "testComparison",
  56170. protocol: 'tests',
  56171. fn: function (){
  56172. var self=this;
  56173. return $core.withContext(function($ctx1) {
  56174. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  56175. $2=(3).__at((4));
  56176. $ctx1.sendIdx["@"]=1;
  56177. $3=(4).__at((5));
  56178. $ctx1.sendIdx["@"]=2;
  56179. $1=$recv($2).__lt($3);
  56180. $ctx1.sendIdx["<"]=1;
  56181. self._assert_($1);
  56182. $ctx1.sendIdx["assert:"]=1;
  56183. $5=(3).__at((4));
  56184. $ctx1.sendIdx["@"]=3;
  56185. $6=(4).__at((4));
  56186. $ctx1.sendIdx["@"]=4;
  56187. $4=$recv($5).__lt($6);
  56188. self._deny_($4);
  56189. $ctx1.sendIdx["deny:"]=1;
  56190. $8=(4).__at((5));
  56191. $ctx1.sendIdx["@"]=5;
  56192. $9=(4).__at((5));
  56193. $ctx1.sendIdx["@"]=6;
  56194. $7=$recv($8).__lt_eq($9);
  56195. $ctx1.sendIdx["<="]=1;
  56196. self._assert_($7);
  56197. $ctx1.sendIdx["assert:"]=2;
  56198. $11=(4).__at((5));
  56199. $ctx1.sendIdx["@"]=7;
  56200. $12=(3).__at((5));
  56201. $ctx1.sendIdx["@"]=8;
  56202. $10=$recv($11).__lt_eq($12);
  56203. self._deny_($10);
  56204. $ctx1.sendIdx["deny:"]=2;
  56205. $14=(5).__at((6));
  56206. $ctx1.sendIdx["@"]=9;
  56207. $15=(4).__at((5));
  56208. $ctx1.sendIdx["@"]=10;
  56209. $13=$recv($14).__gt($15);
  56210. $ctx1.sendIdx[">"]=1;
  56211. self._assert_($13);
  56212. $ctx1.sendIdx["assert:"]=3;
  56213. $17=(5).__at((6));
  56214. $ctx1.sendIdx["@"]=11;
  56215. $18=(6).__at((6));
  56216. $ctx1.sendIdx["@"]=12;
  56217. $16=$recv($17).__gt($18);
  56218. self._deny_($16);
  56219. $ctx1.sendIdx["deny:"]=3;
  56220. $20=(4).__at((5));
  56221. $ctx1.sendIdx["@"]=13;
  56222. $21=(4).__at((5));
  56223. $ctx1.sendIdx["@"]=14;
  56224. $19=$recv($20).__gt_eq($21);
  56225. $ctx1.sendIdx[">="]=1;
  56226. self._assert_($19);
  56227. $23=(4).__at((5));
  56228. $ctx1.sendIdx["@"]=15;
  56229. $22=$recv($23).__gt_eq((5).__at((5)));
  56230. self._deny_($22);
  56231. return self;
  56232. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  56233. },
  56234. args: [],
  56235. 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)",
  56236. referencedClasses: [],
  56237. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  56238. }),
  56239. $globals.PointTest);
  56240. $core.addMethod(
  56241. $core.method({
  56242. selector: "testEgality",
  56243. protocol: 'tests',
  56244. fn: function (){
  56245. var self=this;
  56246. return $core.withContext(function($ctx1) {
  56247. var $2,$3,$1,$5,$4;
  56248. $2=(3).__at((4));
  56249. $ctx1.sendIdx["@"]=1;
  56250. $3=(3).__at((4));
  56251. $ctx1.sendIdx["@"]=2;
  56252. $1=$recv($2).__eq($3);
  56253. $ctx1.sendIdx["="]=1;
  56254. self._assert_($1);
  56255. $5=(3).__at((5));
  56256. $ctx1.sendIdx["@"]=3;
  56257. $4=$recv($5).__eq((3).__at((6)));
  56258. self._deny_($4);
  56259. return self;
  56260. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  56261. },
  56262. args: [],
  56263. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  56264. referencedClasses: [],
  56265. messageSends: ["assert:", "=", "@", "deny:"]
  56266. }),
  56267. $globals.PointTest);
  56268. $core.addMethod(
  56269. $core.method({
  56270. selector: "testNew",
  56271. protocol: 'tests',
  56272. fn: function (){
  56273. var self=this;
  56274. return $core.withContext(function($ctx1) {
  56275. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  56276. $3=$recv($globals.Point)._new();
  56277. $ctx1.sendIdx["new"]=1;
  56278. $2=$recv($3)._x_((3));
  56279. $ctx1.sendIdx["x:"]=1;
  56280. $1=$recv($2)._y();
  56281. $ctx1.sendIdx["y"]=1;
  56282. self._assert_equals_($1,nil);
  56283. $ctx1.sendIdx["assert:equals:"]=1;
  56284. $7=$recv($globals.Point)._new();
  56285. $ctx1.sendIdx["new"]=2;
  56286. $6=$recv($7)._x_((3));
  56287. $5=$recv($6)._x();
  56288. $ctx1.sendIdx["x"]=1;
  56289. $4=$recv($5).__eq((0));
  56290. $ctx1.sendIdx["="]=1;
  56291. self._deny_($4);
  56292. $ctx1.sendIdx["deny:"]=1;
  56293. $10=$recv($globals.Point)._new();
  56294. $ctx1.sendIdx["new"]=3;
  56295. $9=$recv($10)._y_((4));
  56296. $ctx1.sendIdx["y:"]=1;
  56297. $8=$recv($9)._x();
  56298. self._assert_equals_($8,nil);
  56299. self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  56300. return self;
  56301. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  56302. },
  56303. args: [],
  56304. 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",
  56305. referencedClasses: ["Point"],
  56306. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  56307. }),
  56308. $globals.PointTest);
  56309. $core.addMethod(
  56310. $core.method({
  56311. selector: "testTranslateBy",
  56312. protocol: 'tests',
  56313. fn: function (){
  56314. var self=this;
  56315. return $core.withContext(function($ctx1) {
  56316. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  56317. $2=(3).__at((3));
  56318. $ctx1.sendIdx["@"]=1;
  56319. $3=(0).__at((1));
  56320. $ctx1.sendIdx["@"]=2;
  56321. $1=$recv($2)._translateBy_($3);
  56322. $ctx1.sendIdx["translateBy:"]=1;
  56323. $4=(3).__at((4));
  56324. $ctx1.sendIdx["@"]=3;
  56325. self._assert_equals_($1,$4);
  56326. $ctx1.sendIdx["assert:equals:"]=1;
  56327. $6=(3).__at((3));
  56328. $ctx1.sendIdx["@"]=4;
  56329. $8=(1)._negated();
  56330. $ctx1.sendIdx["negated"]=1;
  56331. $7=(0).__at($8);
  56332. $ctx1.sendIdx["@"]=5;
  56333. $5=$recv($6)._translateBy_($7);
  56334. $ctx1.sendIdx["translateBy:"]=2;
  56335. $9=(3).__at((2));
  56336. $ctx1.sendIdx["@"]=6;
  56337. self._assert_equals_($5,$9);
  56338. $ctx1.sendIdx["assert:equals:"]=2;
  56339. $11=(3).__at((3));
  56340. $ctx1.sendIdx["@"]=7;
  56341. $12=(2).__at((3));
  56342. $ctx1.sendIdx["@"]=8;
  56343. $10=$recv($11)._translateBy_($12);
  56344. $ctx1.sendIdx["translateBy:"]=3;
  56345. $13=(5).__at((6));
  56346. $ctx1.sendIdx["@"]=9;
  56347. self._assert_equals_($10,$13);
  56348. $ctx1.sendIdx["assert:equals:"]=3;
  56349. $15=(3).__at((3));
  56350. $ctx1.sendIdx["@"]=10;
  56351. $16=$recv((3)._negated()).__at((0));
  56352. $ctx1.sendIdx["@"]=11;
  56353. $14=$recv($15)._translateBy_($16);
  56354. self._assert_equals_($14,(0).__at((3)));
  56355. return self;
  56356. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  56357. },
  56358. args: [],
  56359. 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.",
  56360. referencedClasses: [],
  56361. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  56362. }),
  56363. $globals.PointTest);
  56364. $core.addClass('QueueTest', $globals.TestCase, [], 'Kernel-Tests');
  56365. $core.addMethod(
  56366. $core.method({
  56367. selector: "testNextIfAbsent",
  56368. protocol: 'tests',
  56369. fn: function (){
  56370. var self=this;
  56371. var queue;
  56372. return $core.withContext(function($ctx1) {
  56373. var $2,$1;
  56374. queue=$recv($globals.Queue)._new();
  56375. $recv(queue)._nextPut_("index1");
  56376. $2=$recv(queue)._nextIfAbsent_("empty");
  56377. $ctx1.sendIdx["nextIfAbsent:"]=1;
  56378. $1=$recv($2).__eq("index1");
  56379. $ctx1.sendIdx["="]=1;
  56380. self._assert_($1);
  56381. self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  56382. return self;
  56383. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  56384. },
  56385. args: [],
  56386. 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'",
  56387. referencedClasses: ["Queue"],
  56388. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  56389. }),
  56390. $globals.QueueTest);
  56391. $core.addMethod(
  56392. $core.method({
  56393. selector: "testQueueNext",
  56394. protocol: 'tests',
  56395. fn: function (){
  56396. var self=this;
  56397. var queue;
  56398. return $core.withContext(function($ctx1) {
  56399. var $1,$3,$2,$5,$4;
  56400. queue=$recv($globals.Queue)._new();
  56401. $1=queue;
  56402. $recv($1)._nextPut_("index1");
  56403. $ctx1.sendIdx["nextPut:"]=1;
  56404. $recv($1)._nextPut_("index2");
  56405. $3=$recv(queue)._next();
  56406. $ctx1.sendIdx["next"]=1;
  56407. $2=$recv($3).__eq("index1");
  56408. $ctx1.sendIdx["="]=1;
  56409. self._assert_($2);
  56410. $5=$recv(queue)._next();
  56411. $ctx1.sendIdx["next"]=2;
  56412. $4=$recv($5).__eq("index");
  56413. self._deny_($4);
  56414. self._should_raise_((function(){
  56415. return $core.withContext(function($ctx2) {
  56416. return $recv(queue)._next();
  56417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56418. }),$globals.Error);
  56419. return self;
  56420. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  56421. },
  56422. args: [],
  56423. 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",
  56424. referencedClasses: ["Queue", "Error"],
  56425. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  56426. }),
  56427. $globals.QueueTest);
  56428. $core.addClass('RandomTest', $globals.TestCase, [], 'Kernel-Tests');
  56429. $core.addMethod(
  56430. $core.method({
  56431. selector: "testAtRandomNumber",
  56432. protocol: 'tests',
  56433. fn: function (){
  56434. var self=this;
  56435. var val;
  56436. return $core.withContext(function($ctx1) {
  56437. (100)._timesRepeat_((function(){
  56438. return $core.withContext(function($ctx2) {
  56439. val=(10)._atRandom();
  56440. val;
  56441. self._assert_($recv(val).__gt((0)));
  56442. $ctx2.sendIdx["assert:"]=1;
  56443. return self._assert_($recv(val).__lt((11)));
  56444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56445. }));
  56446. return self;
  56447. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  56448. },
  56449. args: [],
  56450. 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]",
  56451. referencedClasses: [],
  56452. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  56453. }),
  56454. $globals.RandomTest);
  56455. $core.addMethod(
  56456. $core.method({
  56457. selector: "testAtRandomSequenceableCollection",
  56458. protocol: 'tests',
  56459. fn: function (){
  56460. var self=this;
  56461. var val;
  56462. return $core.withContext(function($ctx1) {
  56463. var $3,$4,$2,$1;
  56464. (100)._timesRepeat_((function(){
  56465. return $core.withContext(function($ctx2) {
  56466. val="abc"._atRandom();
  56467. val;
  56468. $3=$recv(val).__eq("a");
  56469. $ctx2.sendIdx["="]=1;
  56470. $4=$recv(val).__eq("b");
  56471. $ctx2.sendIdx["="]=2;
  56472. $2=$recv($3).__or($4);
  56473. $1=$recv($2).__or($recv(val).__eq("c"));
  56474. $ctx2.sendIdx["|"]=1;
  56475. return self._assert_($1);
  56476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56477. }));
  56478. return self;
  56479. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  56480. },
  56481. args: [],
  56482. 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].",
  56483. referencedClasses: [],
  56484. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  56485. }),
  56486. $globals.RandomTest);
  56487. $core.addMethod(
  56488. $core.method({
  56489. selector: "textNext",
  56490. protocol: 'tests',
  56491. fn: function (){
  56492. var self=this;
  56493. return $core.withContext(function($ctx1) {
  56494. var $1;
  56495. (10000)._timesRepeat_((function(){
  56496. var current,next;
  56497. return $core.withContext(function($ctx2) {
  56498. next=$recv($recv($globals.Random)._new())._next();
  56499. next;
  56500. self._assert_($recv(next).__gt_eq((0)));
  56501. $ctx2.sendIdx["assert:"]=1;
  56502. self._assert_($recv(next).__lt((1)));
  56503. $1=$recv(current).__eq(next);
  56504. $ctx2.sendIdx["="]=1;
  56505. self._deny_($1);
  56506. return $recv(next).__eq(current);
  56507. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  56508. }));
  56509. return self;
  56510. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  56511. },
  56512. args: [],
  56513. 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 ]",
  56514. referencedClasses: ["Random"],
  56515. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  56516. }),
  56517. $globals.RandomTest);
  56518. $core.addClass('StreamTest', $globals.TestCase, [], 'Kernel-Tests');
  56519. $core.addMethod(
  56520. $core.method({
  56521. selector: "collectionClass",
  56522. protocol: 'accessing',
  56523. fn: function (){
  56524. var self=this;
  56525. return $core.withContext(function($ctx1) {
  56526. return $recv(self._class())._collectionClass();
  56527. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  56528. },
  56529. args: [],
  56530. source: "collectionClass\x0a\x09^ self class collectionClass",
  56531. referencedClasses: [],
  56532. messageSends: ["collectionClass", "class"]
  56533. }),
  56534. $globals.StreamTest);
  56535. $core.addMethod(
  56536. $core.method({
  56537. selector: "newCollection",
  56538. protocol: 'accessing',
  56539. fn: function (){
  56540. var self=this;
  56541. return $core.withContext(function($ctx1) {
  56542. return $recv(self._collectionClass())._new();
  56543. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  56544. },
  56545. args: [],
  56546. source: "newCollection\x0a\x09^ self collectionClass new",
  56547. referencedClasses: [],
  56548. messageSends: ["new", "collectionClass"]
  56549. }),
  56550. $globals.StreamTest);
  56551. $core.addMethod(
  56552. $core.method({
  56553. selector: "newStream",
  56554. protocol: 'accessing',
  56555. fn: function (){
  56556. var self=this;
  56557. return $core.withContext(function($ctx1) {
  56558. return $recv($recv(self._collectionClass())._new())._stream();
  56559. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  56560. },
  56561. args: [],
  56562. source: "newStream\x0a\x09^ self collectionClass new stream",
  56563. referencedClasses: [],
  56564. messageSends: ["stream", "new", "collectionClass"]
  56565. }),
  56566. $globals.StreamTest);
  56567. $core.addMethod(
  56568. $core.method({
  56569. selector: "testAtStartAtEnd",
  56570. protocol: 'tests',
  56571. fn: function (){
  56572. var self=this;
  56573. var stream;
  56574. return $core.withContext(function($ctx1) {
  56575. var $1,$2,$3,$4;
  56576. stream=self._newStream();
  56577. $1=$recv(stream)._atStart();
  56578. $ctx1.sendIdx["atStart"]=1;
  56579. self._assert_($1);
  56580. $ctx1.sendIdx["assert:"]=1;
  56581. $2=$recv(stream)._atEnd();
  56582. $ctx1.sendIdx["atEnd"]=1;
  56583. self._assert_($2);
  56584. $ctx1.sendIdx["assert:"]=2;
  56585. $recv(stream)._nextPutAll_(self._newCollection());
  56586. $3=$recv(stream)._atEnd();
  56587. $ctx1.sendIdx["atEnd"]=2;
  56588. self._assert_($3);
  56589. $4=$recv(stream)._atStart();
  56590. $ctx1.sendIdx["atStart"]=2;
  56591. self._deny_($4);
  56592. $ctx1.sendIdx["deny:"]=1;
  56593. $recv(stream)._position_((1));
  56594. self._deny_($recv(stream)._atEnd());
  56595. $ctx1.sendIdx["deny:"]=2;
  56596. self._deny_($recv(stream)._atStart());
  56597. return self;
  56598. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  56599. },
  56600. args: [],
  56601. 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",
  56602. referencedClasses: [],
  56603. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  56604. }),
  56605. $globals.StreamTest);
  56606. $core.addMethod(
  56607. $core.method({
  56608. selector: "testContents",
  56609. protocol: 'tests',
  56610. fn: function (){
  56611. var self=this;
  56612. var stream;
  56613. return $core.withContext(function($ctx1) {
  56614. var $1,$2;
  56615. stream=self._newStream();
  56616. $1=stream;
  56617. $2=self._newCollection();
  56618. $ctx1.sendIdx["newCollection"]=1;
  56619. $recv($1)._nextPutAll_($2);
  56620. self._assert_equals_($recv(stream)._contents(),self._newCollection());
  56621. return self;
  56622. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  56623. },
  56624. args: [],
  56625. 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",
  56626. referencedClasses: [],
  56627. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  56628. }),
  56629. $globals.StreamTest);
  56630. $core.addMethod(
  56631. $core.method({
  56632. selector: "testIsEmpty",
  56633. protocol: 'tests',
  56634. fn: function (){
  56635. var self=this;
  56636. var stream;
  56637. return $core.withContext(function($ctx1) {
  56638. var $1;
  56639. stream=self._newStream();
  56640. $1=$recv(stream)._isEmpty();
  56641. $ctx1.sendIdx["isEmpty"]=1;
  56642. self._assert_($1);
  56643. $recv(stream)._nextPutAll_(self._newCollection());
  56644. self._deny_($recv(stream)._isEmpty());
  56645. return self;
  56646. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  56647. },
  56648. args: [],
  56649. 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",
  56650. referencedClasses: [],
  56651. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  56652. }),
  56653. $globals.StreamTest);
  56654. $core.addMethod(
  56655. $core.method({
  56656. selector: "testPosition",
  56657. protocol: 'tests',
  56658. fn: function (){
  56659. var self=this;
  56660. var collection,stream;
  56661. return $core.withContext(function($ctx1) {
  56662. var $1,$2,$3;
  56663. collection=self._newCollection();
  56664. stream=self._newStream();
  56665. $recv(stream)._nextPutAll_(collection);
  56666. $1=$recv(stream)._position();
  56667. $ctx1.sendIdx["position"]=1;
  56668. self._assert_equals_($1,$recv(collection)._size());
  56669. $ctx1.sendIdx["assert:equals:"]=1;
  56670. $recv(stream)._position_((0));
  56671. $2=$recv(stream)._position();
  56672. $ctx1.sendIdx["position"]=2;
  56673. self._assert_equals_($2,(0));
  56674. $ctx1.sendIdx["assert:equals:"]=2;
  56675. $recv(stream)._next();
  56676. $ctx1.sendIdx["next"]=1;
  56677. $3=$recv(stream)._position();
  56678. $ctx1.sendIdx["position"]=3;
  56679. self._assert_equals_($3,(1));
  56680. $ctx1.sendIdx["assert:equals:"]=3;
  56681. $recv(stream)._next();
  56682. self._assert_equals_($recv(stream)._position(),(2));
  56683. return self;
  56684. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  56685. },
  56686. args: [],
  56687. 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",
  56688. referencedClasses: [],
  56689. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  56690. }),
  56691. $globals.StreamTest);
  56692. $core.addMethod(
  56693. $core.method({
  56694. selector: "testReading",
  56695. protocol: 'tests',
  56696. fn: function (){
  56697. var self=this;
  56698. var stream,collection;
  56699. return $core.withContext(function($ctx1) {
  56700. var $1,$2;
  56701. collection=self._newCollection();
  56702. stream=self._newStream();
  56703. $1=stream;
  56704. $recv($1)._nextPutAll_(collection);
  56705. $recv($1)._position_((0));
  56706. $recv(collection)._do_((function(each){
  56707. return $core.withContext(function($ctx2) {
  56708. $2=$recv(stream)._next();
  56709. $ctx2.sendIdx["next"]=1;
  56710. return self._assert_equals_($2,each);
  56711. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56712. }));
  56713. self._assert_($recv($recv(stream)._next())._isNil());
  56714. return self;
  56715. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  56716. },
  56717. args: [],
  56718. 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",
  56719. referencedClasses: [],
  56720. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  56721. }),
  56722. $globals.StreamTest);
  56723. $core.addMethod(
  56724. $core.method({
  56725. selector: "testStreamContents",
  56726. protocol: 'tests',
  56727. fn: function (){
  56728. var self=this;
  56729. return self;
  56730. },
  56731. args: [],
  56732. source: "testStreamContents",
  56733. referencedClasses: [],
  56734. messageSends: []
  56735. }),
  56736. $globals.StreamTest);
  56737. $core.addMethod(
  56738. $core.method({
  56739. selector: "testWrite",
  56740. protocol: 'tests',
  56741. fn: function (){
  56742. var self=this;
  56743. var stream,collection;
  56744. return $core.withContext(function($ctx1) {
  56745. collection=self._newCollection();
  56746. stream=self._newStream();
  56747. $recv(collection)._do_((function(each){
  56748. return $core.withContext(function($ctx2) {
  56749. return $recv(stream).__lt_lt(each);
  56750. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56751. }));
  56752. self._assert_equals_($recv(stream)._contents(),collection);
  56753. return self;
  56754. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  56755. },
  56756. args: [],
  56757. 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",
  56758. referencedClasses: [],
  56759. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  56760. }),
  56761. $globals.StreamTest);
  56762. $core.addMethod(
  56763. $core.method({
  56764. selector: "testWriting",
  56765. protocol: 'tests',
  56766. fn: function (){
  56767. var self=this;
  56768. var stream,collection;
  56769. return $core.withContext(function($ctx1) {
  56770. var $1;
  56771. collection=self._newCollection();
  56772. stream=self._newStream();
  56773. $ctx1.sendIdx["newStream"]=1;
  56774. $recv(collection)._do_((function(each){
  56775. return $core.withContext(function($ctx2) {
  56776. return $recv(stream)._nextPut_(each);
  56777. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56778. }));
  56779. $1=$recv(stream)._contents();
  56780. $ctx1.sendIdx["contents"]=1;
  56781. self._assert_equals_($1,collection);
  56782. $ctx1.sendIdx["assert:equals:"]=1;
  56783. stream=self._newStream();
  56784. $recv(stream)._nextPutAll_(collection);
  56785. self._assert_equals_($recv(stream)._contents(),collection);
  56786. return self;
  56787. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  56788. },
  56789. args: [],
  56790. 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",
  56791. referencedClasses: [],
  56792. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  56793. }),
  56794. $globals.StreamTest);
  56795. $core.addMethod(
  56796. $core.method({
  56797. selector: "collectionClass",
  56798. protocol: 'accessing',
  56799. fn: function (){
  56800. var self=this;
  56801. return nil;
  56802. },
  56803. args: [],
  56804. source: "collectionClass\x0a\x09^ nil",
  56805. referencedClasses: [],
  56806. messageSends: []
  56807. }),
  56808. $globals.StreamTest.klass);
  56809. $core.addMethod(
  56810. $core.method({
  56811. selector: "isAbstract",
  56812. protocol: 'testing',
  56813. fn: function (){
  56814. var self=this;
  56815. return $core.withContext(function($ctx1) {
  56816. return $recv(self._collectionClass())._isNil();
  56817. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)});
  56818. },
  56819. args: [],
  56820. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  56821. referencedClasses: [],
  56822. messageSends: ["isNil", "collectionClass"]
  56823. }),
  56824. $globals.StreamTest.klass);
  56825. $core.addClass('ArrayStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  56826. $core.addMethod(
  56827. $core.method({
  56828. selector: "newCollection",
  56829. protocol: 'accessing',
  56830. fn: function (){
  56831. var self=this;
  56832. return $core.withContext(function($ctx1) {
  56833. return [true,(1),(3).__at((4)),"foo"];
  56834. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  56835. },
  56836. args: [],
  56837. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  56838. referencedClasses: [],
  56839. messageSends: ["@"]
  56840. }),
  56841. $globals.ArrayStreamTest);
  56842. $core.addMethod(
  56843. $core.method({
  56844. selector: "collectionClass",
  56845. protocol: 'accessing',
  56846. fn: function (){
  56847. var self=this;
  56848. return $globals.Array;
  56849. },
  56850. args: [],
  56851. source: "collectionClass\x0a\x09^ Array",
  56852. referencedClasses: ["Array"],
  56853. messageSends: []
  56854. }),
  56855. $globals.ArrayStreamTest.klass);
  56856. $core.addClass('StringStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  56857. $core.addMethod(
  56858. $core.method({
  56859. selector: "newCollection",
  56860. protocol: 'accessing',
  56861. fn: function (){
  56862. var self=this;
  56863. return "hello world";
  56864. },
  56865. args: [],
  56866. source: "newCollection\x0a\x09^ 'hello world'",
  56867. referencedClasses: [],
  56868. messageSends: []
  56869. }),
  56870. $globals.StringStreamTest);
  56871. $core.addMethod(
  56872. $core.method({
  56873. selector: "collectionClass",
  56874. protocol: 'accessing',
  56875. fn: function (){
  56876. var self=this;
  56877. return $globals.String;
  56878. },
  56879. args: [],
  56880. source: "collectionClass\x0a\x09^ String",
  56881. referencedClasses: ["String"],
  56882. messageSends: []
  56883. }),
  56884. $globals.StringStreamTest.klass);
  56885. $core.addClass('UndefinedTest', $globals.TestCase, [], 'Kernel-Tests');
  56886. $core.addMethod(
  56887. $core.method({
  56888. selector: "testCopying",
  56889. protocol: 'tests',
  56890. fn: function (){
  56891. var self=this;
  56892. return $core.withContext(function($ctx1) {
  56893. self._assert_equals_(nil._copy(),nil);
  56894. return self;
  56895. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  56896. },
  56897. args: [],
  56898. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  56899. referencedClasses: [],
  56900. messageSends: ["assert:equals:", "copy"]
  56901. }),
  56902. $globals.UndefinedTest);
  56903. $core.addMethod(
  56904. $core.method({
  56905. selector: "testDeepCopy",
  56906. protocol: 'tests',
  56907. fn: function (){
  56908. var self=this;
  56909. return $core.withContext(function($ctx1) {
  56910. self._assert_($recv(nil._deepCopy()).__eq(nil));
  56911. return self;
  56912. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  56913. },
  56914. args: [],
  56915. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  56916. referencedClasses: [],
  56917. messageSends: ["assert:", "=", "deepCopy"]
  56918. }),
  56919. $globals.UndefinedTest);
  56920. $core.addMethod(
  56921. $core.method({
  56922. selector: "testIfNil",
  56923. protocol: 'tests',
  56924. fn: function (){
  56925. var self=this;
  56926. return $core.withContext(function($ctx1) {
  56927. var $1,$3,$2,$4,$6,$5,$receiver;
  56928. if(($receiver = nil) == null || $receiver.isNil){
  56929. $1=true;
  56930. } else {
  56931. $1=nil;
  56932. };
  56933. self._assert_equals_($1,true);
  56934. $ctx1.sendIdx["assert:equals:"]=1;
  56935. if(($receiver = nil) == null || $receiver.isNil){
  56936. $3=nil;
  56937. } else {
  56938. $3=true;
  56939. };
  56940. $2=$recv($3).__eq(true);
  56941. $ctx1.sendIdx["="]=1;
  56942. self._deny_($2);
  56943. $ctx1.sendIdx["deny:"]=1;
  56944. if(($receiver = nil) == null || $receiver.isNil){
  56945. $4=true;
  56946. } else {
  56947. $4=false;
  56948. };
  56949. self._assert_equals_($4,true);
  56950. if(($receiver = nil) == null || $receiver.isNil){
  56951. $6=false;
  56952. } else {
  56953. $6=true;
  56954. };
  56955. $5=$recv($6).__eq(true);
  56956. self._deny_($5);
  56957. return self;
  56958. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  56959. },
  56960. args: [],
  56961. 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",
  56962. referencedClasses: [],
  56963. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  56964. }),
  56965. $globals.UndefinedTest);
  56966. $core.addMethod(
  56967. $core.method({
  56968. selector: "testIsNil",
  56969. protocol: 'tests',
  56970. fn: function (){
  56971. var self=this;
  56972. return $core.withContext(function($ctx1) {
  56973. self._assert_(nil._isNil());
  56974. self._deny_(nil._notNil());
  56975. return self;
  56976. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  56977. },
  56978. args: [],
  56979. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  56980. referencedClasses: [],
  56981. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  56982. }),
  56983. $globals.UndefinedTest);
  56984. });
  56985. define("amber_core/SUnit-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  56986. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  56987. $core.addPackage('SUnit-Tests');
  56988. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  56989. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  56990. $core.addClass('ExampleSetTest', $globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
  56991. $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.";
  56992. $core.addMethod(
  56993. $core.method({
  56994. selector: "setUp",
  56995. protocol: 'running',
  56996. fn: function (){
  56997. var self=this;
  56998. return $core.withContext(function($ctx1) {
  56999. self["@empty"]=$recv($globals.Set)._new();
  57000. self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  57001. return self;
  57002. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  57003. },
  57004. args: [],
  57005. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  57006. referencedClasses: ["Set"],
  57007. messageSends: ["new", "with:with:"]
  57008. }),
  57009. $globals.ExampleSetTest);
  57010. $core.addMethod(
  57011. $core.method({
  57012. selector: "testAdd",
  57013. protocol: 'tests',
  57014. fn: function (){
  57015. var self=this;
  57016. return $core.withContext(function($ctx1) {
  57017. $recv(self["@empty"])._add_((5));
  57018. self._assert_($recv(self["@empty"])._includes_((5)));
  57019. return self;
  57020. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  57021. },
  57022. args: [],
  57023. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  57024. referencedClasses: [],
  57025. messageSends: ["add:", "assert:", "includes:"]
  57026. }),
  57027. $globals.ExampleSetTest);
  57028. $core.addMethod(
  57029. $core.method({
  57030. selector: "testGrow",
  57031. protocol: 'tests',
  57032. fn: function (){
  57033. var self=this;
  57034. return $core.withContext(function($ctx1) {
  57035. $recv(self["@empty"])._addAll_((1)._to_((100)));
  57036. self._assert_equals_($recv(self["@empty"])._size(),(100));
  57037. return self;
  57038. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  57039. },
  57040. args: [],
  57041. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  57042. referencedClasses: [],
  57043. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  57044. }),
  57045. $globals.ExampleSetTest);
  57046. $core.addMethod(
  57047. $core.method({
  57048. selector: "testIllegal",
  57049. protocol: 'tests',
  57050. fn: function (){
  57051. var self=this;
  57052. return $core.withContext(function($ctx1) {
  57053. self._should_raise_((function(){
  57054. return $core.withContext(function($ctx2) {
  57055. return $recv(self["@empty"])._at_((5));
  57056. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57057. }),$globals.Error);
  57058. $ctx1.sendIdx["should:raise:"]=1;
  57059. self._should_raise_((function(){
  57060. return $core.withContext(function($ctx2) {
  57061. return $recv(self["@empty"])._at_put_((5),"abc");
  57062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57063. }),$globals.Error);
  57064. return self;
  57065. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  57066. },
  57067. args: [],
  57068. 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",
  57069. referencedClasses: ["Error"],
  57070. messageSends: ["should:raise:", "at:", "at:put:"]
  57071. }),
  57072. $globals.ExampleSetTest);
  57073. $core.addMethod(
  57074. $core.method({
  57075. selector: "testIncludes",
  57076. protocol: 'tests',
  57077. fn: function (){
  57078. var self=this;
  57079. return $core.withContext(function($ctx1) {
  57080. var $1;
  57081. $1=$recv(self["@full"])._includes_((5));
  57082. $ctx1.sendIdx["includes:"]=1;
  57083. self._assert_($1);
  57084. $ctx1.sendIdx["assert:"]=1;
  57085. self._assert_($recv(self["@full"])._includes_("abc"));
  57086. return self;
  57087. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  57088. },
  57089. args: [],
  57090. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  57091. referencedClasses: [],
  57092. messageSends: ["assert:", "includes:"]
  57093. }),
  57094. $globals.ExampleSetTest);
  57095. $core.addMethod(
  57096. $core.method({
  57097. selector: "testOccurrences",
  57098. protocol: 'tests',
  57099. fn: function (){
  57100. var self=this;
  57101. return $core.withContext(function($ctx1) {
  57102. var $1,$2;
  57103. $1=$recv(self["@empty"])._occurrencesOf_((0));
  57104. $ctx1.sendIdx["occurrencesOf:"]=1;
  57105. self._assert_equals_($1,(0));
  57106. $ctx1.sendIdx["assert:equals:"]=1;
  57107. $2=$recv(self["@full"])._occurrencesOf_((5));
  57108. $ctx1.sendIdx["occurrencesOf:"]=2;
  57109. self._assert_equals_($2,(1));
  57110. $ctx1.sendIdx["assert:equals:"]=2;
  57111. $recv(self["@full"])._add_((5));
  57112. self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1));
  57113. return self;
  57114. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  57115. },
  57116. args: [],
  57117. 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",
  57118. referencedClasses: [],
  57119. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  57120. }),
  57121. $globals.ExampleSetTest);
  57122. $core.addMethod(
  57123. $core.method({
  57124. selector: "testRemove",
  57125. protocol: 'tests',
  57126. fn: function (){
  57127. var self=this;
  57128. return $core.withContext(function($ctx1) {
  57129. var $1;
  57130. $recv(self["@full"])._remove_((5));
  57131. $1=$recv(self["@full"])._includes_("abc");
  57132. $ctx1.sendIdx["includes:"]=1;
  57133. self._assert_($1);
  57134. self._deny_($recv(self["@full"])._includes_((5)));
  57135. return self;
  57136. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  57137. },
  57138. args: [],
  57139. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  57140. referencedClasses: [],
  57141. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  57142. }),
  57143. $globals.ExampleSetTest);
  57144. $core.addClass('SUnitAsyncTest', $globals.TestCase, ['flag'], 'SUnit-Tests');
  57145. $core.addMethod(
  57146. $core.method({
  57147. selector: "fakeError",
  57148. protocol: 'helpers',
  57149. fn: function (){
  57150. var self=this;
  57151. return $core.withContext(function($ctx1) {
  57152. self["@flag"]="bad";
  57153. self._timeout_((30));
  57154. self["@flag"]=$recv(self._async_((function(){
  57155. return $core.withContext(function($ctx2) {
  57156. self["@flag"]="ok";
  57157. self["@flag"];
  57158. return self._error_("Intentional");
  57159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57160. })))._valueWithTimeout_((20));
  57161. return self;
  57162. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  57163. },
  57164. args: [],
  57165. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  57166. referencedClasses: [],
  57167. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  57168. }),
  57169. $globals.SUnitAsyncTest);
  57170. $core.addMethod(
  57171. $core.method({
  57172. selector: "fakeErrorFailingInTearDown",
  57173. protocol: 'helpers',
  57174. fn: function (){
  57175. var self=this;
  57176. return $core.withContext(function($ctx1) {
  57177. self["@flag"]="bad";
  57178. self._timeout_((30));
  57179. self["@flag"]=$recv(self._async_((function(){
  57180. return $core.withContext(function($ctx2) {
  57181. return self._error_("Intentional");
  57182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57183. })))._valueWithTimeout_((20));
  57184. return self;
  57185. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  57186. },
  57187. args: [],
  57188. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  57189. referencedClasses: [],
  57190. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  57191. }),
  57192. $globals.SUnitAsyncTest);
  57193. $core.addMethod(
  57194. $core.method({
  57195. selector: "fakeFailure",
  57196. protocol: 'helpers',
  57197. fn: function (){
  57198. var self=this;
  57199. return $core.withContext(function($ctx1) {
  57200. self["@flag"]="bad";
  57201. self._timeout_((30));
  57202. self["@flag"]=$recv(self._async_((function(){
  57203. return $core.withContext(function($ctx2) {
  57204. self["@flag"]="ok";
  57205. self["@flag"];
  57206. return self._assert_(false);
  57207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57208. })))._valueWithTimeout_((20));
  57209. return self;
  57210. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  57211. },
  57212. args: [],
  57213. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  57214. referencedClasses: [],
  57215. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  57216. }),
  57217. $globals.SUnitAsyncTest);
  57218. $core.addMethod(
  57219. $core.method({
  57220. selector: "fakeMultipleTimeoutFailing",
  57221. protocol: 'helpers',
  57222. fn: function (){
  57223. var self=this;
  57224. return $core.withContext(function($ctx1) {
  57225. var $1;
  57226. self._timeout_((100));
  57227. $ctx1.sendIdx["timeout:"]=1;
  57228. $1=self._async_((function(){
  57229. return $core.withContext(function($ctx2) {
  57230. self._timeout_((20));
  57231. return $recv(self._async_((function(){
  57232. return $core.withContext(function($ctx3) {
  57233. return self._finished();
  57234. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57235. })))._valueWithTimeout_((30));
  57236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57237. }));
  57238. $ctx1.sendIdx["async:"]=1;
  57239. $recv($1)._valueWithTimeout_((20));
  57240. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57241. return self;
  57242. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  57243. },
  57244. args: [],
  57245. 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",
  57246. referencedClasses: [],
  57247. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  57248. }),
  57249. $globals.SUnitAsyncTest);
  57250. $core.addMethod(
  57251. $core.method({
  57252. selector: "fakeMultipleTimeoutPassing",
  57253. protocol: 'helpers',
  57254. fn: function (){
  57255. var self=this;
  57256. return $core.withContext(function($ctx1) {
  57257. var $1;
  57258. self._timeout_((20));
  57259. $ctx1.sendIdx["timeout:"]=1;
  57260. $1=self._async_((function(){
  57261. return $core.withContext(function($ctx2) {
  57262. self._timeout_((40));
  57263. return $recv(self._async_((function(){
  57264. return $core.withContext(function($ctx3) {
  57265. return self._finished();
  57266. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57267. })))._valueWithTimeout_((20));
  57268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57269. }));
  57270. $ctx1.sendIdx["async:"]=1;
  57271. $recv($1)._valueWithTimeout_((10));
  57272. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57273. return self;
  57274. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  57275. },
  57276. args: [],
  57277. 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",
  57278. referencedClasses: [],
  57279. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  57280. }),
  57281. $globals.SUnitAsyncTest);
  57282. $core.addMethod(
  57283. $core.method({
  57284. selector: "fakeTimeout",
  57285. protocol: 'helpers',
  57286. fn: function (){
  57287. var self=this;
  57288. return $core.withContext(function($ctx1) {
  57289. self._timeout_((10));
  57290. $recv(self._async_((function(){
  57291. return $core.withContext(function($ctx2) {
  57292. return self._finished();
  57293. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57294. })))._valueWithTimeout_((20));
  57295. return self;
  57296. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  57297. },
  57298. args: [],
  57299. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  57300. referencedClasses: [],
  57301. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  57302. }),
  57303. $globals.SUnitAsyncTest);
  57304. $core.addMethod(
  57305. $core.method({
  57306. selector: "selectorSetOf:",
  57307. protocol: 'private',
  57308. fn: function (aCollection){
  57309. var self=this;
  57310. return $core.withContext(function($ctx1) {
  57311. return $recv($recv(aCollection)._collect_((function(each){
  57312. return $core.withContext(function($ctx2) {
  57313. return $recv(each)._selector();
  57314. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57315. })))._asSet();
  57316. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  57317. },
  57318. args: ["aCollection"],
  57319. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  57320. referencedClasses: [],
  57321. messageSends: ["asSet", "collect:", "selector"]
  57322. }),
  57323. $globals.SUnitAsyncTest);
  57324. $core.addMethod(
  57325. $core.method({
  57326. selector: "setUp",
  57327. protocol: 'running',
  57328. fn: function (){
  57329. var self=this;
  57330. self["@flag"]="ok";
  57331. return self;
  57332. },
  57333. args: [],
  57334. source: "setUp\x0a\x09flag := 'ok'",
  57335. referencedClasses: [],
  57336. messageSends: []
  57337. }),
  57338. $globals.SUnitAsyncTest);
  57339. $core.addMethod(
  57340. $core.method({
  57341. selector: "tearDown",
  57342. protocol: 'running',
  57343. fn: function (){
  57344. var self=this;
  57345. return $core.withContext(function($ctx1) {
  57346. self._assert_equals_("ok",self["@flag"]);
  57347. return self;
  57348. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  57349. },
  57350. args: [],
  57351. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  57352. referencedClasses: [],
  57353. messageSends: ["assert:equals:"]
  57354. }),
  57355. $globals.SUnitAsyncTest);
  57356. $core.addMethod(
  57357. $core.method({
  57358. selector: "testAsyncErrorsAndFailures",
  57359. protocol: 'tests',
  57360. fn: function (){
  57361. var self=this;
  57362. var suite,runner,result,assertBlock;
  57363. return $core.withContext(function($ctx1) {
  57364. var $1,$2,$3,$4;
  57365. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  57366. return $core.withContext(function($ctx2) {
  57367. return $recv(self._class())._selector_(each);
  57368. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57369. }));
  57370. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  57371. self._timeout_((200));
  57372. result=$recv(runner)._result();
  57373. $ctx1.sendIdx["result"]=1;
  57374. assertBlock=self._async_((function(){
  57375. return $core.withContext(function($ctx2) {
  57376. $1=self._selectorSetOf_($recv(result)._errors());
  57377. $ctx2.sendIdx["selectorSetOf:"]=1;
  57378. $2=["fakeError"]._asSet();
  57379. $ctx2.sendIdx["asSet"]=1;
  57380. self._assert_equals_($1,$2);
  57381. $ctx2.sendIdx["assert:equals:"]=1;
  57382. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  57383. return self._finished();
  57384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57385. }));
  57386. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  57387. return $core.withContext(function($ctx2) {
  57388. $3=$recv($recv(ann)._result()).__eq_eq(result);
  57389. if($core.assert($3)){
  57390. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  57391. return $recv($4)._ifTrue_(assertBlock);
  57392. };
  57393. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  57394. }));
  57395. $recv(runner)._run();
  57396. return self;
  57397. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  57398. },
  57399. args: [],
  57400. 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",
  57401. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  57402. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  57403. }),
  57404. $globals.SUnitAsyncTest);
  57405. $core.addMethod(
  57406. $core.method({
  57407. selector: "testAsyncNeedsTimeout",
  57408. protocol: 'tests',
  57409. fn: function (){
  57410. var self=this;
  57411. return $core.withContext(function($ctx1) {
  57412. self._should_raise_((function(){
  57413. return $core.withContext(function($ctx2) {
  57414. return self._async_((function(){
  57415. }));
  57416. $ctx2.sendIdx["async:"]=1;
  57417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57418. }),$globals.Error);
  57419. self._timeout_((0));
  57420. self._shouldnt_raise_((function(){
  57421. return $core.withContext(function($ctx2) {
  57422. return self._async_((function(){
  57423. }));
  57424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  57425. }),$globals.Error);
  57426. self._finished();
  57427. return self;
  57428. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  57429. },
  57430. args: [],
  57431. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  57432. referencedClasses: ["Error"],
  57433. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  57434. }),
  57435. $globals.SUnitAsyncTest);
  57436. $core.addMethod(
  57437. $core.method({
  57438. selector: "testFinishedNeedsTimeout",
  57439. protocol: 'tests',
  57440. fn: function (){
  57441. var self=this;
  57442. return $core.withContext(function($ctx1) {
  57443. self._should_raise_((function(){
  57444. return $core.withContext(function($ctx2) {
  57445. return self._finished();
  57446. $ctx2.sendIdx["finished"]=1;
  57447. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57448. }),$globals.Error);
  57449. self._timeout_((0));
  57450. self._shouldnt_raise_((function(){
  57451. return $core.withContext(function($ctx2) {
  57452. return self._finished();
  57453. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57454. }),$globals.Error);
  57455. return self;
  57456. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  57457. },
  57458. args: [],
  57459. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  57460. referencedClasses: ["Error"],
  57461. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  57462. }),
  57463. $globals.SUnitAsyncTest);
  57464. $core.addMethod(
  57465. $core.method({
  57466. selector: "testIsAsyncReturnsCorrectValues",
  57467. protocol: 'tests',
  57468. fn: function (){
  57469. var self=this;
  57470. return $core.withContext(function($ctx1) {
  57471. var $1,$2;
  57472. $1=self._isAsync();
  57473. $ctx1.sendIdx["isAsync"]=1;
  57474. self._deny_($1);
  57475. $ctx1.sendIdx["deny:"]=1;
  57476. self._timeout_((0));
  57477. $2=self._isAsync();
  57478. $ctx1.sendIdx["isAsync"]=2;
  57479. self._assert_($2);
  57480. self._finished();
  57481. self._deny_(self._isAsync());
  57482. return self;
  57483. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  57484. },
  57485. args: [],
  57486. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  57487. referencedClasses: [],
  57488. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  57489. }),
  57490. $globals.SUnitAsyncTest);
  57491. $core.addMethod(
  57492. $core.method({
  57493. selector: "testPass",
  57494. protocol: 'tests',
  57495. fn: function (){
  57496. var self=this;
  57497. return $core.withContext(function($ctx1) {
  57498. self["@flag"]="bad";
  57499. self._timeout_((10));
  57500. self["@flag"]=$recv(self._async_((function(){
  57501. return $core.withContext(function($ctx2) {
  57502. self._assert_(true);
  57503. self._finished();
  57504. self["@flag"]="ok";
  57505. return self["@flag"];
  57506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57507. })))._valueWithTimeout_((5));
  57508. return self;
  57509. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  57510. },
  57511. args: [],
  57512. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  57513. referencedClasses: [],
  57514. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  57515. }),
  57516. $globals.SUnitAsyncTest);
  57517. $core.addMethod(
  57518. $core.method({
  57519. selector: "testTimeouts",
  57520. protocol: 'tests',
  57521. fn: function (){
  57522. var self=this;
  57523. var suite,runner,result,assertBlock;
  57524. return $core.withContext(function($ctx1) {
  57525. var $1,$2,$3;
  57526. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  57527. return $core.withContext(function($ctx2) {
  57528. return $recv(self._class())._selector_(each);
  57529. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57530. }));
  57531. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  57532. self._timeout_((200));
  57533. result=$recv(runner)._result();
  57534. $ctx1.sendIdx["result"]=1;
  57535. assertBlock=self._async_((function(){
  57536. return $core.withContext(function($ctx2) {
  57537. $1=self._selectorSetOf_($recv(result)._errors());
  57538. $ctx2.sendIdx["selectorSetOf:"]=1;
  57539. self._assert_equals_($1,$recv($globals.Set)._new());
  57540. $ctx2.sendIdx["assert:equals:"]=1;
  57541. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  57542. return self._finished();
  57543. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57544. }));
  57545. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  57546. return $core.withContext(function($ctx2) {
  57547. $2=$recv($recv(ann)._result()).__eq_eq(result);
  57548. if($core.assert($2)){
  57549. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  57550. return $recv($3)._ifTrue_(assertBlock);
  57551. };
  57552. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  57553. }));
  57554. $recv(runner)._run();
  57555. return self;
  57556. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  57557. },
  57558. args: [],
  57559. 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",
  57560. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  57561. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  57562. }),
  57563. $globals.SUnitAsyncTest);
  57564. $core.addMethod(
  57565. $core.method({
  57566. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  57567. protocol: 'tests',
  57568. fn: function (){
  57569. var self=this;
  57570. var x;
  57571. return $core.withContext(function($ctx1) {
  57572. var $1;
  57573. self["@flag"]="bad";
  57574. self._timeout_((10));
  57575. x=(0);
  57576. $1=self._async_((function(){
  57577. return $core.withContext(function($ctx2) {
  57578. self._finished();
  57579. $ctx2.sendIdx["finished"]=1;
  57580. self["@flag"]="ok";
  57581. self["@flag"];
  57582. x=$recv(x).__plus((1));
  57583. $ctx2.sendIdx["+"]=1;
  57584. x;
  57585. return self._assert_equals_(x,(1));
  57586. $ctx2.sendIdx["assert:equals:"]=1;
  57587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57588. }));
  57589. $ctx1.sendIdx["async:"]=1;
  57590. self["@flag"]=$recv($1)._valueWithTimeout_((0));
  57591. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57592. self["@flag"]=$recv(self._async_((function(){
  57593. return $core.withContext(function($ctx2) {
  57594. self._finished();
  57595. self["@flag"]="ok";
  57596. self["@flag"];
  57597. x=$recv(x).__plus((1));
  57598. x;
  57599. return self._assert_equals_(x,(1));
  57600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57601. })))._valueWithTimeout_((0));
  57602. return self;
  57603. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  57604. },
  57605. args: [],
  57606. 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.",
  57607. referencedClasses: [],
  57608. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  57609. }),
  57610. $globals.SUnitAsyncTest);
  57611. });
  57612. define('amber/devel',[
  57613. './lang',
  57614. './compatibility', // pre-fetch, dep of ./boot
  57615. './boot', // pre-fetch, dep of ./helpers
  57616. './helpers', // pre-fetch, dep of ./deploy
  57617. './deploy', // pre-fetch, dep of ./lang
  57618. // --- packages of the development only Amber begin here ---
  57619. 'amber_core/SUnit',
  57620. 'amber_core/Compiler-Tests',
  57621. 'amber_core/Kernel-Tests',
  57622. 'amber_core/SUnit-Tests'
  57623. // --- packages of the development only Amber end here ---
  57624. ], function (amber) { return amber; });
  57625. define("amber_cli/AmberCli", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  57626. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  57627. $core.addPackage('AmberCli');
  57628. $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
  57629. $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  57630. $core.addClass('AmberCli', $globals.Object, [], 'AmberCli');
  57631. $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.";
  57632. $core.addMethod(
  57633. $core.method({
  57634. selector: "commandLineSwitches",
  57635. protocol: 'commandline',
  57636. fn: function (){
  57637. var self=this;
  57638. var switches;
  57639. return $core.withContext(function($ctx1) {
  57640. switches=$recv($recv(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  57641. return $core.withContext(function($ctx2) {
  57642. return $recv(each)._selector();
  57643. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57644. }));
  57645. $ctx1.sendIdx["collect:"]=1;
  57646. switches=$recv(switches)._select_((function(each){
  57647. return $core.withContext(function($ctx2) {
  57648. return $recv(each)._match_("^[^:]*:$");
  57649. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  57650. }));
  57651. switches=$recv(switches)._collect_((function(each){
  57652. return $core.withContext(function($ctx2) {
  57653. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  57654. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  57655. }));
  57656. return switches;
  57657. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.klass)});
  57658. },
  57659. args: [],
  57660. 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",
  57661. referencedClasses: [],
  57662. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  57663. }),
  57664. $globals.AmberCli.klass);
  57665. $core.addMethod(
  57666. $core.method({
  57667. selector: "config:",
  57668. protocol: 'commands',
  57669. fn: function (args){
  57670. var self=this;
  57671. return $core.withContext(function($ctx1) {
  57672. $recv($recv($globals.Configurator)._new())._start();
  57673. return self;
  57674. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.klass)});
  57675. },
  57676. args: ["args"],
  57677. source: "config: args\x0a\x09Configurator new start",
  57678. referencedClasses: ["Configurator"],
  57679. messageSends: ["start", "new"]
  57680. }),
  57681. $globals.AmberCli.klass);
  57682. $core.addMethod(
  57683. $core.method({
  57684. selector: "handleArguments:",
  57685. protocol: 'commandline',
  57686. fn: function (args){
  57687. var self=this;
  57688. var selector;
  57689. return $core.withContext(function($ctx1) {
  57690. var $1;
  57691. $1=$recv(args)._first();
  57692. $ctx1.sendIdx["first"]=1;
  57693. selector=self._selectorForCommandLineSwitch_($1);
  57694. $recv(args)._remove_($recv(args)._first());
  57695. self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  57696. return self;
  57697. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.klass)});
  57698. },
  57699. args: ["args"],
  57700. 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)",
  57701. referencedClasses: ["Array"],
  57702. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  57703. }),
  57704. $globals.AmberCli.klass);
  57705. $core.addMethod(
  57706. $core.method({
  57707. selector: "help:",
  57708. protocol: 'commands',
  57709. fn: function (args){
  57710. var self=this;
  57711. return $core.withContext(function($ctx1) {
  57712. $recv($globals.Transcript)._show_("Available commands");
  57713. $recv(self._commandLineSwitches())._do_((function(each){
  57714. return $core.withContext(function($ctx2) {
  57715. return $recv(console)._log_(each);
  57716. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57717. }));
  57718. return self;
  57719. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.klass)});
  57720. },
  57721. args: ["args"],
  57722. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  57723. referencedClasses: ["Transcript"],
  57724. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  57725. }),
  57726. $globals.AmberCli.klass);
  57727. $core.addMethod(
  57728. $core.method({
  57729. selector: "init:",
  57730. protocol: 'commands',
  57731. fn: function (args){
  57732. var self=this;
  57733. return $core.withContext(function($ctx1) {
  57734. $recv($recv($globals.Initer)._new())._start();
  57735. return self;
  57736. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.klass)});
  57737. },
  57738. args: ["args"],
  57739. source: "init: args\x0a\x09Initer new start",
  57740. referencedClasses: ["Initer"],
  57741. messageSends: ["start", "new"]
  57742. }),
  57743. $globals.AmberCli.klass);
  57744. $core.addMethod(
  57745. $core.method({
  57746. selector: "main",
  57747. protocol: 'startup',
  57748. fn: function (){
  57749. var self=this;
  57750. var args;
  57751. return $core.withContext(function($ctx1) {
  57752. var $3,$2,$1,$4;
  57753. $3=$recv("Welcome to Amber version ".__comma($recv($globals.Smalltalk)._version())).__comma(" (NodeJS ");
  57754. $ctx1.sendIdx[","]=3;
  57755. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  57756. $ctx1.sendIdx[","]=2;
  57757. $1=$recv($2).__comma(").");
  57758. $ctx1.sendIdx[","]=1;
  57759. $recv($globals.Transcript)._show_($1);
  57760. args=$recv(process)._argv();
  57761. $recv(args)._removeFrom_to_((1),(2));
  57762. $4=$recv(args)._isEmpty();
  57763. if($core.assert($4)){
  57764. self._help_(nil);
  57765. } else {
  57766. return self._handleArguments_(args);
  57767. };
  57768. return self;
  57769. }, function($ctx1) {$ctx1.fill(self,"main",{args:args},$globals.AmberCli.klass)});
  57770. },
  57771. args: [],
  57772. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09Parses commandline arguments and starts the according subprogram.\x22\x0a\x09| args |\x0a\x09\x0a\x09Transcript show: 'Welcome to Amber version ', 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\x09(args isEmpty)\x0a\x09\x09ifTrue: [self help: nil]\x0a\x09\x09ifFalse: [^self handleArguments: args]",
  57773. referencedClasses: ["Transcript", "Smalltalk"],
  57774. messageSends: ["show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"]
  57775. }),
  57776. $globals.AmberCli.klass);
  57777. $core.addMethod(
  57778. $core.method({
  57779. selector: "repl:",
  57780. protocol: 'commands',
  57781. fn: function (args){
  57782. var self=this;
  57783. return $core.withContext(function($ctx1) {
  57784. return $recv($recv($globals.Repl)._new())._createInterface();
  57785. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.klass)});
  57786. },
  57787. args: ["args"],
  57788. source: "repl: args\x0a\x09^ Repl new createInterface",
  57789. referencedClasses: ["Repl"],
  57790. messageSends: ["createInterface", "new"]
  57791. }),
  57792. $globals.AmberCli.klass);
  57793. $core.addMethod(
  57794. $core.method({
  57795. selector: "selectorForCommandLineSwitch:",
  57796. protocol: 'commandline',
  57797. fn: function (aSwitch){
  57798. var self=this;
  57799. var command,selector;
  57800. return $core.withContext(function($ctx1) {
  57801. var $1;
  57802. $1=$recv(self._commandLineSwitches())._includes_(aSwitch);
  57803. if($core.assert($1)){
  57804. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  57805. return $core.withContext(function($ctx2) {
  57806. return $recv($recv(each)._second())._asUppercase();
  57807. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  57808. }))).__comma(":");
  57809. selector;
  57810. } else {
  57811. selector="help:";
  57812. selector;
  57813. };
  57814. return selector;
  57815. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.klass)});
  57816. },
  57817. args: ["aSwitch"],
  57818. 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",
  57819. referencedClasses: [],
  57820. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  57821. }),
  57822. $globals.AmberCli.klass);
  57823. $core.addMethod(
  57824. $core.method({
  57825. selector: "serve:",
  57826. protocol: 'commands',
  57827. fn: function (args){
  57828. var self=this;
  57829. return $core.withContext(function($ctx1) {
  57830. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  57831. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.klass)});
  57832. },
  57833. args: ["args"],
  57834. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  57835. referencedClasses: ["FileServer"],
  57836. messageSends: ["start", "createServerWithArguments:"]
  57837. }),
  57838. $globals.AmberCli.klass);
  57839. $core.addMethod(
  57840. $core.method({
  57841. selector: "version:",
  57842. protocol: 'commands',
  57843. fn: function (arguments_){
  57844. var self=this;
  57845. return self;
  57846. },
  57847. args: ["arguments"],
  57848. source: "version: arguments",
  57849. referencedClasses: [],
  57850. messageSends: []
  57851. }),
  57852. $globals.AmberCli.klass);
  57853. $core.addClass('BaseFileManipulator', $globals.Object, ['path', 'fs'], 'AmberCli');
  57854. $core.addMethod(
  57855. $core.method({
  57856. selector: "dirname",
  57857. protocol: 'private',
  57858. fn: function (){
  57859. var self=this;
  57860. return $core.withContext(function($ctx1) {
  57861. return __dirname;
  57862. return self;
  57863. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  57864. },
  57865. args: [],
  57866. source: "dirname\x0a\x09<return __dirname>",
  57867. referencedClasses: [],
  57868. messageSends: []
  57869. }),
  57870. $globals.BaseFileManipulator);
  57871. $core.addMethod(
  57872. $core.method({
  57873. selector: "initialize",
  57874. protocol: 'initialization',
  57875. fn: function (){
  57876. var self=this;
  57877. return $core.withContext(function($ctx1) {
  57878. (
  57879. $ctx1.supercall = true,
  57880. ($globals.BaseFileManipulator.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  57881. $ctx1.supercall = false;
  57882. self["@path"]=$recv(require)._value_("path");
  57883. $ctx1.sendIdx["value:"]=1;
  57884. self["@fs"]=$recv(require)._value_("fs");
  57885. return self;
  57886. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  57887. },
  57888. args: [],
  57889. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  57890. referencedClasses: [],
  57891. messageSends: ["initialize", "value:"]
  57892. }),
  57893. $globals.BaseFileManipulator);
  57894. $core.addMethod(
  57895. $core.method({
  57896. selector: "rootDirname",
  57897. protocol: 'private',
  57898. fn: function (){
  57899. var self=this;
  57900. return $core.withContext(function($ctx1) {
  57901. return $recv(self["@path"])._join_with_(self._dirname(),"..");
  57902. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  57903. },
  57904. args: [],
  57905. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  57906. referencedClasses: [],
  57907. messageSends: ["join:with:", "dirname"]
  57908. }),
  57909. $globals.BaseFileManipulator);
  57910. $core.addClass('Configurator', $globals.BaseFileManipulator, [], 'AmberCli');
  57911. $core.addMethod(
  57912. $core.method({
  57913. selector: "initialize",
  57914. protocol: 'initialization',
  57915. fn: function (){
  57916. var self=this;
  57917. return $core.withContext(function($ctx1) {
  57918. (
  57919. $ctx1.supercall = true,
  57920. ($globals.Configurator.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  57921. $ctx1.supercall = false;
  57922. return self;
  57923. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  57924. },
  57925. args: [],
  57926. source: "initialize\x0a\x09super initialize",
  57927. referencedClasses: [],
  57928. messageSends: ["initialize"]
  57929. }),
  57930. $globals.Configurator);
  57931. $core.addMethod(
  57932. $core.method({
  57933. selector: "start",
  57934. protocol: 'action',
  57935. fn: function (){
  57936. var self=this;
  57937. return $core.withContext(function($ctx1) {
  57938. var $receiver;
  57939. self._writeConfigThenDo_((function(err){
  57940. return $core.withContext(function($ctx2) {
  57941. if(($receiver = err) == null || $receiver.isNil){
  57942. return $recv(process)._exit();
  57943. } else {
  57944. return $recv(process)._exit_((111));
  57945. };
  57946. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  57947. }));
  57948. return self;
  57949. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  57950. },
  57951. args: [],
  57952. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  57953. referencedClasses: [],
  57954. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  57955. }),
  57956. $globals.Configurator);
  57957. $core.addMethod(
  57958. $core.method({
  57959. selector: "writeConfigThenDo:",
  57960. protocol: 'action',
  57961. fn: function (aBlock){
  57962. var self=this;
  57963. return $core.withContext(function($ctx1) {
  57964. $recv($recv($recv(require)._value_("amber-dev"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  57965. return self;
  57966. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  57967. },
  57968. args: ["aBlock"],
  57969. source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  57970. referencedClasses: [],
  57971. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  57972. }),
  57973. $globals.Configurator);
  57974. $core.addClass('FileServer', $globals.BaseFileManipulator, ['http', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  57975. $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.";
  57976. $core.addMethod(
  57977. $core.method({
  57978. selector: "base64Decode:",
  57979. protocol: 'private',
  57980. fn: function (aString){
  57981. var self=this;
  57982. return $core.withContext(function($ctx1) {
  57983. return (new Buffer(aString, 'base64').toString());
  57984. return self;
  57985. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  57986. },
  57987. args: ["aString"],
  57988. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  57989. referencedClasses: [],
  57990. messageSends: []
  57991. }),
  57992. $globals.FileServer);
  57993. $core.addMethod(
  57994. $core.method({
  57995. selector: "basePath",
  57996. protocol: 'accessing',
  57997. fn: function (){
  57998. var self=this;
  57999. return $core.withContext(function($ctx1) {
  58000. var $1,$receiver;
  58001. $1=self["@basePath"];
  58002. if(($receiver = $1) == null || $receiver.isNil){
  58003. return $recv(self._class())._defaultBasePath();
  58004. } else {
  58005. return $1;
  58006. };
  58007. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  58008. },
  58009. args: [],
  58010. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  58011. referencedClasses: [],
  58012. messageSends: ["ifNil:", "defaultBasePath", "class"]
  58013. }),
  58014. $globals.FileServer);
  58015. $core.addMethod(
  58016. $core.method({
  58017. selector: "basePath:",
  58018. protocol: 'accessing',
  58019. fn: function (aString){
  58020. var self=this;
  58021. return $core.withContext(function($ctx1) {
  58022. self["@basePath"]=aString;
  58023. self._validateBasePath();
  58024. return self;
  58025. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  58026. },
  58027. args: ["aString"],
  58028. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  58029. referencedClasses: [],
  58030. messageSends: ["validateBasePath"]
  58031. }),
  58032. $globals.FileServer);
  58033. $core.addMethod(
  58034. $core.method({
  58035. selector: "checkDirectoryLayout",
  58036. protocol: 'initialization',
  58037. fn: function (){
  58038. var self=this;
  58039. return $core.withContext(function($ctx1) {
  58040. var $1;
  58041. $1=$recv(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  58042. if(!$core.assert($1)){
  58043. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  58044. $ctx1.sendIdx["warn:"]=1;
  58045. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  58046. $ctx1.sendIdx["warn:"]=2;
  58047. $recv(console)._warn_(" You can also specify a page to be served by default,");
  58048. $ctx1.sendIdx["warn:"]=3;
  58049. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  58050. };
  58051. return self;
  58052. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  58053. },
  58054. args: [],
  58055. 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.'].",
  58056. referencedClasses: [],
  58057. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  58058. }),
  58059. $globals.FileServer);
  58060. $core.addMethod(
  58061. $core.method({
  58062. selector: "fallbackPage",
  58063. protocol: 'accessing',
  58064. fn: function (){
  58065. var self=this;
  58066. return self["@fallbackPage"];
  58067. },
  58068. args: [],
  58069. source: "fallbackPage\x0a\x09^ fallbackPage",
  58070. referencedClasses: [],
  58071. messageSends: []
  58072. }),
  58073. $globals.FileServer);
  58074. $core.addMethod(
  58075. $core.method({
  58076. selector: "fallbackPage:",
  58077. protocol: 'accessing',
  58078. fn: function (aString){
  58079. var self=this;
  58080. self["@fallbackPage"]=aString;
  58081. return self;
  58082. },
  58083. args: ["aString"],
  58084. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  58085. referencedClasses: [],
  58086. messageSends: []
  58087. }),
  58088. $globals.FileServer);
  58089. $core.addMethod(
  58090. $core.method({
  58091. selector: "handleGETRequest:respondTo:",
  58092. protocol: 'request handling',
  58093. fn: function (aRequest,aResponse){
  58094. var self=this;
  58095. var uri,filename;
  58096. return $core.withContext(function($ctx1) {
  58097. var $1;
  58098. uri=$recv(self["@url"])._parse_($recv(aRequest)._url());
  58099. filename=$recv(self["@path"])._join_with_(self._basePath(),$recv(uri)._pathname());
  58100. $recv(self["@fs"])._exists_do_(filename,(function(aBoolean){
  58101. return $core.withContext(function($ctx2) {
  58102. if($core.assert(aBoolean)){
  58103. $1=$recv($recv(self["@fs"])._statSync_(filename))._isDirectory();
  58104. if($core.assert($1)){
  58105. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  58106. } else {
  58107. return self._respondFileNamed_to_(filename,aResponse);
  58108. };
  58109. } else {
  58110. return self._respondNotFoundTo_(aResponse);
  58111. };
  58112. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  58113. }));
  58114. return self;
  58115. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  58116. },
  58117. args: ["aRequest", "aResponse"],
  58118. 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]]]",
  58119. referencedClasses: [],
  58120. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  58121. }),
  58122. $globals.FileServer);
  58123. $core.addMethod(
  58124. $core.method({
  58125. selector: "handleOPTIONSRequest:respondTo:",
  58126. protocol: 'request handling',
  58127. fn: function (aRequest,aResponse){
  58128. var self=this;
  58129. return $core.withContext(function($ctx1) {
  58130. $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)]));
  58131. $recv(aResponse)._end();
  58132. return self;
  58133. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  58134. },
  58135. args: ["aRequest", "aResponse"],
  58136. 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",
  58137. referencedClasses: [],
  58138. messageSends: ["writeHead:options:", "end"]
  58139. }),
  58140. $globals.FileServer);
  58141. $core.addMethod(
  58142. $core.method({
  58143. selector: "handlePUTRequest:respondTo:",
  58144. protocol: 'request handling',
  58145. fn: function (aRequest,aResponse){
  58146. var self=this;
  58147. var file,stream;
  58148. return $core.withContext(function($ctx1) {
  58149. var $1,$2,$3,$4;
  58150. $1=self._isAuthenticated_(aRequest);
  58151. if(!$core.assert($1)){
  58152. self._respondAuthenticationRequiredTo_(aResponse);
  58153. return nil;
  58154. };
  58155. file=".".__comma($recv(aRequest)._url());
  58156. $ctx1.sendIdx[","]=1;
  58157. stream=$recv(self["@fs"])._createWriteStream_(file);
  58158. $recv(stream)._on_do_("error",(function(error){
  58159. return $core.withContext(function($ctx2) {
  58160. $2=console;
  58161. $3="Error creating WriteStream for file ".__comma(file);
  58162. $ctx2.sendIdx[","]=2;
  58163. $recv($2)._warn_($3);
  58164. $ctx2.sendIdx["warn:"]=1;
  58165. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  58166. $ctx2.sendIdx["warn:"]=2;
  58167. $recv(console)._warn_(" The exact error is: ".__comma(error));
  58168. return self._respondNotCreatedTo_(aResponse);
  58169. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  58170. }));
  58171. $ctx1.sendIdx["on:do:"]=1;
  58172. $recv(stream)._on_do_("close",(function(){
  58173. return $core.withContext(function($ctx2) {
  58174. return self._respondCreatedTo_(aResponse);
  58175. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58176. }));
  58177. $ctx1.sendIdx["on:do:"]=2;
  58178. $recv(aRequest)._setEncoding_("utf8");
  58179. $recv(aRequest)._on_do_("data",(function(data){
  58180. return $core.withContext(function($ctx2) {
  58181. return $recv(stream)._write_(data);
  58182. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  58183. }));
  58184. $ctx1.sendIdx["on:do:"]=3;
  58185. $recv(aRequest)._on_do_("end",(function(){
  58186. return $core.withContext(function($ctx2) {
  58187. $4=$recv(stream)._writable();
  58188. if($core.assert($4)){
  58189. return $recv(stream)._end();
  58190. };
  58191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58192. }));
  58193. return self;
  58194. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  58195. },
  58196. args: ["aRequest", "aResponse"],
  58197. 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]]",
  58198. referencedClasses: [],
  58199. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  58200. }),
  58201. $globals.FileServer);
  58202. $core.addMethod(
  58203. $core.method({
  58204. selector: "handleRequest:respondTo:",
  58205. protocol: 'request handling',
  58206. fn: function (aRequest,aResponse){
  58207. var self=this;
  58208. return $core.withContext(function($ctx1) {
  58209. var $2,$1,$4,$3,$5;
  58210. $2=$recv(aRequest)._method();
  58211. $ctx1.sendIdx["method"]=1;
  58212. $1=$recv($2).__eq("PUT");
  58213. $ctx1.sendIdx["="]=1;
  58214. if($core.assert($1)){
  58215. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  58216. };
  58217. $4=$recv(aRequest)._method();
  58218. $ctx1.sendIdx["method"]=2;
  58219. $3=$recv($4).__eq("GET");
  58220. $ctx1.sendIdx["="]=2;
  58221. if($core.assert($3)){
  58222. self._handleGETRequest_respondTo_(aRequest,aResponse);
  58223. };
  58224. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  58225. if($core.assert($5)){
  58226. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  58227. };
  58228. return self;
  58229. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  58230. },
  58231. args: ["aRequest", "aResponse"],
  58232. 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]",
  58233. referencedClasses: [],
  58234. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  58235. }),
  58236. $globals.FileServer);
  58237. $core.addMethod(
  58238. $core.method({
  58239. selector: "host",
  58240. protocol: 'accessing',
  58241. fn: function (){
  58242. var self=this;
  58243. return self["@host"];
  58244. },
  58245. args: [],
  58246. source: "host\x0a\x09^ host",
  58247. referencedClasses: [],
  58248. messageSends: []
  58249. }),
  58250. $globals.FileServer);
  58251. $core.addMethod(
  58252. $core.method({
  58253. selector: "host:",
  58254. protocol: 'accessing',
  58255. fn: function (hostname){
  58256. var self=this;
  58257. self["@host"]=hostname;
  58258. return self;
  58259. },
  58260. args: ["hostname"],
  58261. source: "host: hostname\x0a\x09host := hostname",
  58262. referencedClasses: [],
  58263. messageSends: []
  58264. }),
  58265. $globals.FileServer);
  58266. $core.addMethod(
  58267. $core.method({
  58268. selector: "initialize",
  58269. protocol: 'initialization',
  58270. fn: function (){
  58271. var self=this;
  58272. return $core.withContext(function($ctx1) {
  58273. var $1;
  58274. (
  58275. $ctx1.supercall = true,
  58276. ($globals.FileServer.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  58277. $ctx1.supercall = false;
  58278. self["@http"]=self._require_("http");
  58279. $ctx1.sendIdx["require:"]=1;
  58280. self["@util"]=self._require_("util");
  58281. $ctx1.sendIdx["require:"]=2;
  58282. self["@url"]=self._require_("url");
  58283. $1=self._class();
  58284. $ctx1.sendIdx["class"]=1;
  58285. self["@host"]=$recv($1)._defaultHost();
  58286. self["@port"]=$recv(self._class())._defaultPort();
  58287. self["@username"]=nil;
  58288. self["@password"]=nil;
  58289. self["@fallbackPage"]=nil;
  58290. return self;
  58291. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  58292. },
  58293. args: [],
  58294. 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.",
  58295. referencedClasses: [],
  58296. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  58297. }),
  58298. $globals.FileServer);
  58299. $core.addMethod(
  58300. $core.method({
  58301. selector: "isAuthenticated:",
  58302. protocol: 'private',
  58303. fn: function (aRequest){
  58304. var self=this;
  58305. var header,token,auth,parts;
  58306. return $core.withContext(function($ctx1) {
  58307. var $2,$1,$3,$4,$5,$6,$9,$10,$8,$7,$receiver;
  58308. $2=$recv(self["@username"])._isNil();
  58309. $ctx1.sendIdx["isNil"]=1;
  58310. $1=$recv($2)._and_((function(){
  58311. return $core.withContext(function($ctx2) {
  58312. return $recv(self["@password"])._isNil();
  58313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58314. }));
  58315. $ctx1.sendIdx["and:"]=1;
  58316. if($core.assert($1)){
  58317. return true;
  58318. };
  58319. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  58320. $ctx1.sendIdx["at:"]=1;
  58321. if(($receiver = $3) == null || $receiver.isNil){
  58322. header="";
  58323. } else {
  58324. header=$3;
  58325. };
  58326. $4=$recv(header)._isEmpty();
  58327. if($core.assert($4)){
  58328. return false;
  58329. } else {
  58330. $5=$recv(header)._tokenize_(" ");
  58331. $ctx1.sendIdx["tokenize:"]=1;
  58332. if(($receiver = $5) == null || $receiver.isNil){
  58333. token="";
  58334. } else {
  58335. token=$5;
  58336. };
  58337. token;
  58338. $6=$recv(token)._at_((2));
  58339. $ctx1.sendIdx["at:"]=2;
  58340. auth=self._base64Decode_($6);
  58341. auth;
  58342. parts=$recv(auth)._tokenize_(":");
  58343. parts;
  58344. $9=self["@username"];
  58345. $10=$recv(parts)._at_((1));
  58346. $ctx1.sendIdx["at:"]=3;
  58347. $8=$recv($9).__eq($10);
  58348. $ctx1.sendIdx["="]=1;
  58349. $7=$recv($8)._and_((function(){
  58350. return $core.withContext(function($ctx2) {
  58351. return $recv(self["@password"]).__eq($recv(parts)._at_((2)));
  58352. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  58353. }));
  58354. if($core.assert($7)){
  58355. return true;
  58356. } else {
  58357. return false;
  58358. };
  58359. };
  58360. return self;
  58361. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  58362. },
  58363. args: ["aRequest"],
  58364. 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\x09(header isEmpty)\x0a\x09ifTrue: [^ false]\x0a\x09ifFalse: [\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].",
  58365. referencedClasses: [],
  58366. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="]
  58367. }),
  58368. $globals.FileServer);
  58369. $core.addMethod(
  58370. $core.method({
  58371. selector: "password:",
  58372. protocol: 'accessing',
  58373. fn: function (aPassword){
  58374. var self=this;
  58375. self["@password"]=aPassword;
  58376. return self;
  58377. },
  58378. args: ["aPassword"],
  58379. source: "password: aPassword\x0a\x09password := aPassword.",
  58380. referencedClasses: [],
  58381. messageSends: []
  58382. }),
  58383. $globals.FileServer);
  58384. $core.addMethod(
  58385. $core.method({
  58386. selector: "port",
  58387. protocol: 'accessing',
  58388. fn: function (){
  58389. var self=this;
  58390. return self["@port"];
  58391. },
  58392. args: [],
  58393. source: "port\x0a\x09^ port",
  58394. referencedClasses: [],
  58395. messageSends: []
  58396. }),
  58397. $globals.FileServer);
  58398. $core.addMethod(
  58399. $core.method({
  58400. selector: "port:",
  58401. protocol: 'accessing',
  58402. fn: function (aNumber){
  58403. var self=this;
  58404. self["@port"]=aNumber;
  58405. return self;
  58406. },
  58407. args: ["aNumber"],
  58408. source: "port: aNumber\x0a\x09port := aNumber",
  58409. referencedClasses: [],
  58410. messageSends: []
  58411. }),
  58412. $globals.FileServer);
  58413. $core.addMethod(
  58414. $core.method({
  58415. selector: "require:",
  58416. protocol: 'private',
  58417. fn: function (aModuleString){
  58418. var self=this;
  58419. return $core.withContext(function($ctx1) {
  58420. return $recv(require)._value_(aModuleString);
  58421. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  58422. },
  58423. args: ["aModuleString"],
  58424. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  58425. referencedClasses: [],
  58426. messageSends: ["value:"]
  58427. }),
  58428. $globals.FileServer);
  58429. $core.addMethod(
  58430. $core.method({
  58431. selector: "respondAuthenticationRequiredTo:",
  58432. protocol: 'request handling',
  58433. fn: function (aResponse){
  58434. var self=this;
  58435. return $core.withContext(function($ctx1) {
  58436. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  58437. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  58438. $recv(aResponse)._end();
  58439. return self;
  58440. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  58441. },
  58442. args: ["aResponse"],
  58443. 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.",
  58444. referencedClasses: [],
  58445. messageSends: ["writeHead:options:", "write:", "end"]
  58446. }),
  58447. $globals.FileServer);
  58448. $core.addMethod(
  58449. $core.method({
  58450. selector: "respondCreatedTo:",
  58451. protocol: 'request handling',
  58452. fn: function (aResponse){
  58453. var self=this;
  58454. return $core.withContext(function($ctx1) {
  58455. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  58456. $recv(aResponse)._end();
  58457. return self;
  58458. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  58459. },
  58460. args: ["aResponse"],
  58461. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  58462. referencedClasses: [],
  58463. messageSends: ["writeHead:options:", "end"]
  58464. }),
  58465. $globals.FileServer);
  58466. $core.addMethod(
  58467. $core.method({
  58468. selector: "respondDirectoryNamed:from:to:",
  58469. protocol: 'request handling',
  58470. fn: function (aDirname,aUrl,aResponse){
  58471. var self=this;
  58472. return $core.withContext(function($ctx1) {
  58473. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  58474. $2=$recv(aUrl)._pathname();
  58475. $ctx1.sendIdx["pathname"]=1;
  58476. $1=$recv($2)._endsWith_("/");
  58477. if($core.assert($1)){
  58478. $3=$recv(aDirname).__comma("index.html");
  58479. $ctx1.sendIdx[","]=1;
  58480. self._respondFileNamed_to_($3,aResponse);
  58481. } else {
  58482. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  58483. $7=$recv(aUrl)._search();
  58484. if(($receiver = $7) == null || $receiver.isNil){
  58485. $6="";
  58486. } else {
  58487. $6=$7;
  58488. };
  58489. $4=$recv($5).__comma($6);
  58490. $ctx1.sendIdx[","]=2;
  58491. self._respondRedirect_to_($4,aResponse);
  58492. };
  58493. return self;
  58494. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  58495. },
  58496. args: ["aDirname", "aUrl", "aResponse"],
  58497. 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]",
  58498. referencedClasses: [],
  58499. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  58500. }),
  58501. $globals.FileServer);
  58502. $core.addMethod(
  58503. $core.method({
  58504. selector: "respondFileNamed:to:",
  58505. protocol: 'request handling',
  58506. fn: function (aFilename,aResponse){
  58507. var self=this;
  58508. var type,filename;
  58509. return $core.withContext(function($ctx1) {
  58510. var $1,$2,$3,$4;
  58511. filename=aFilename;
  58512. $recv(self["@fs"])._readFile_do_(filename,(function(ex,file){
  58513. return $core.withContext(function($ctx2) {
  58514. $1=$recv(ex)._notNil();
  58515. if($core.assert($1)){
  58516. $2=console;
  58517. $3=$recv(filename).__comma(" does not exist");
  58518. $ctx2.sendIdx[","]=1;
  58519. $recv($2)._log_($3);
  58520. return self._respondNotFoundTo_(aResponse);
  58521. } else {
  58522. type=$recv(self._class())._mimeTypeFor_(filename);
  58523. type;
  58524. $4=$recv(type).__eq("application/javascript");
  58525. if($core.assert($4)){
  58526. type=$recv(type).__comma(";charset=utf-8");
  58527. type;
  58528. };
  58529. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  58530. $recv(aResponse)._write_encoding_(file,"binary");
  58531. return $recv(aResponse)._end();
  58532. };
  58533. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  58534. }));
  58535. return self;
  58536. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  58537. },
  58538. args: ["aFilename", "aResponse"],
  58539. 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]]",
  58540. referencedClasses: [],
  58541. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  58542. }),
  58543. $globals.FileServer);
  58544. $core.addMethod(
  58545. $core.method({
  58546. selector: "respondInternalErrorTo:",
  58547. protocol: 'request handling',
  58548. fn: function (aResponse){
  58549. var self=this;
  58550. return $core.withContext(function($ctx1) {
  58551. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  58552. $recv(aResponse)._write_("500 Internal server error");
  58553. $recv(aResponse)._end();
  58554. return self;
  58555. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  58556. },
  58557. args: ["aResponse"],
  58558. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  58559. referencedClasses: [],
  58560. messageSends: ["writeHead:options:", "write:", "end"]
  58561. }),
  58562. $globals.FileServer);
  58563. $core.addMethod(
  58564. $core.method({
  58565. selector: "respondNotCreatedTo:",
  58566. protocol: 'request handling',
  58567. fn: function (aResponse){
  58568. var self=this;
  58569. return $core.withContext(function($ctx1) {
  58570. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  58571. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  58572. $recv(aResponse)._end();
  58573. return self;
  58574. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  58575. },
  58576. args: ["aResponse"],
  58577. 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.",
  58578. referencedClasses: [],
  58579. messageSends: ["writeHead:options:", "write:", "end"]
  58580. }),
  58581. $globals.FileServer);
  58582. $core.addMethod(
  58583. $core.method({
  58584. selector: "respondNotFoundTo:",
  58585. protocol: 'request handling',
  58586. fn: function (aResponse){
  58587. var self=this;
  58588. return $core.withContext(function($ctx1) {
  58589. var $2,$1;
  58590. $2=self._fallbackPage();
  58591. $ctx1.sendIdx["fallbackPage"]=1;
  58592. $1=$recv($2)._isNil();
  58593. if(!$core.assert($1)){
  58594. return self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  58595. };
  58596. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  58597. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  58598. $ctx1.sendIdx["write:"]=1;
  58599. $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>");
  58600. $ctx1.sendIdx["write:"]=2;
  58601. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  58602. $ctx1.sendIdx["write:"]=3;
  58603. $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>");
  58604. $ctx1.sendIdx["write:"]=4;
  58605. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  58606. $ctx1.sendIdx["write:"]=5;
  58607. $recv(aResponse)._write_("</ul></p></body></html>");
  58608. $recv(aResponse)._end();
  58609. return self;
  58610. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  58611. },
  58612. args: ["aResponse"],
  58613. 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",
  58614. referencedClasses: [],
  58615. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  58616. }),
  58617. $globals.FileServer);
  58618. $core.addMethod(
  58619. $core.method({
  58620. selector: "respondOKTo:",
  58621. protocol: 'request handling',
  58622. fn: function (aResponse){
  58623. var self=this;
  58624. return $core.withContext(function($ctx1) {
  58625. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  58626. $recv(aResponse)._end();
  58627. return self;
  58628. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  58629. },
  58630. args: ["aResponse"],
  58631. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  58632. referencedClasses: [],
  58633. messageSends: ["writeHead:options:", "end"]
  58634. }),
  58635. $globals.FileServer);
  58636. $core.addMethod(
  58637. $core.method({
  58638. selector: "respondRedirect:to:",
  58639. protocol: 'request handling',
  58640. fn: function (aString,aResponse){
  58641. var self=this;
  58642. return $core.withContext(function($ctx1) {
  58643. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  58644. $recv(aResponse)._end();
  58645. return self;
  58646. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  58647. },
  58648. args: ["aString", "aResponse"],
  58649. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  58650. referencedClasses: [],
  58651. messageSends: ["writeHead:options:", "end"]
  58652. }),
  58653. $globals.FileServer);
  58654. $core.addMethod(
  58655. $core.method({
  58656. selector: "start",
  58657. protocol: 'starting',
  58658. fn: function (){
  58659. var self=this;
  58660. return $core.withContext(function($ctx1) {
  58661. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  58662. self._checkDirectoryLayout();
  58663. $1=$recv(self["@http"])._createServer_((function(request,response){
  58664. return $core.withContext(function($ctx2) {
  58665. return self._handleRequest_respondTo_(request,response);
  58666. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  58667. }));
  58668. $recv($1)._on_do_("error",(function(error){
  58669. return $core.withContext(function($ctx2) {
  58670. $2=console;
  58671. $3="Error starting server: ".__comma(error);
  58672. $ctx2.sendIdx[","]=1;
  58673. return $recv($2)._log_($3);
  58674. $ctx2.sendIdx["log:"]=1;
  58675. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  58676. }));
  58677. $ctx1.sendIdx["on:do:"]=1;
  58678. $recv($1)._on_do_("listening",(function(){
  58679. return $core.withContext(function($ctx2) {
  58680. $4=console;
  58681. $8=self._host();
  58682. $ctx2.sendIdx["host"]=1;
  58683. $7="Starting file server on http://".__comma($8);
  58684. $6=$recv($7).__comma(":");
  58685. $ctx2.sendIdx[","]=3;
  58686. $10=self._port();
  58687. $ctx2.sendIdx["port"]=1;
  58688. $9=$recv($10)._asString();
  58689. $5=$recv($6).__comma($9);
  58690. $ctx2.sendIdx[","]=2;
  58691. return $recv($4)._log_($5);
  58692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58693. }));
  58694. $recv($1)._listen_host_(self._port(),self._host());
  58695. return self;
  58696. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  58697. },
  58698. args: [],
  58699. 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.",
  58700. referencedClasses: [],
  58701. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  58702. }),
  58703. $globals.FileServer);
  58704. $core.addMethod(
  58705. $core.method({
  58706. selector: "startOn:",
  58707. protocol: 'starting',
  58708. fn: function (aPort){
  58709. var self=this;
  58710. return $core.withContext(function($ctx1) {
  58711. self._port_(aPort);
  58712. self._start();
  58713. return self;
  58714. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  58715. },
  58716. args: ["aPort"],
  58717. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  58718. referencedClasses: [],
  58719. messageSends: ["port:", "start"]
  58720. }),
  58721. $globals.FileServer);
  58722. $core.addMethod(
  58723. $core.method({
  58724. selector: "username:",
  58725. protocol: 'accessing',
  58726. fn: function (aUsername){
  58727. var self=this;
  58728. self["@username"]=aUsername;
  58729. return self;
  58730. },
  58731. args: ["aUsername"],
  58732. source: "username: aUsername\x0a\x09username := aUsername.",
  58733. referencedClasses: [],
  58734. messageSends: []
  58735. }),
  58736. $globals.FileServer);
  58737. $core.addMethod(
  58738. $core.method({
  58739. selector: "validateBasePath",
  58740. protocol: 'private',
  58741. fn: function (){
  58742. var self=this;
  58743. return $core.withContext(function($ctx1) {
  58744. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  58745. $1=self["@fs"];
  58746. $2=self._basePath();
  58747. $ctx1.sendIdx["basePath"]=1;
  58748. $recv($1)._stat_then_($2,(function(err,stat){
  58749. return $core.withContext(function($ctx2) {
  58750. if(($receiver = err) == null || $receiver.isNil){
  58751. $3=$recv(stat)._isDirectory();
  58752. if(!$core.assert($3)){
  58753. $4=console;
  58754. $7=self._basePath();
  58755. $ctx2.sendIdx["basePath"]=2;
  58756. $6="Warning: --base-path parameter ".__comma($7);
  58757. $ctx2.sendIdx[","]=2;
  58758. $5=$recv($6).__comma(" is not a directory.");
  58759. $ctx2.sendIdx[","]=1;
  58760. return $recv($4)._warn_($5);
  58761. $ctx2.sendIdx["warn:"]=1;
  58762. };
  58763. } else {
  58764. $8=console;
  58765. $9=$recv("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  58766. $ctx2.sendIdx[","]=3;
  58767. return $recv($8)._warn_($9);
  58768. };
  58769. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  58770. }));
  58771. return self;
  58772. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  58773. },
  58774. args: [],
  58775. 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.' ]].",
  58776. referencedClasses: [],
  58777. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  58778. }),
  58779. $globals.FileServer);
  58780. $core.addMethod(
  58781. $core.method({
  58782. selector: "withBasePath:",
  58783. protocol: 'private',
  58784. fn: function (aBaseRelativePath){
  58785. var self=this;
  58786. return $core.withContext(function($ctx1) {
  58787. return $recv(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  58788. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  58789. },
  58790. args: ["aBaseRelativePath"],
  58791. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  58792. referencedClasses: [],
  58793. messageSends: ["join:with:", "basePath"]
  58794. }),
  58795. $globals.FileServer);
  58796. $core.addMethod(
  58797. $core.method({
  58798. selector: "writeData:toFileNamed:",
  58799. protocol: 'private',
  58800. fn: function (data,aFilename){
  58801. var self=this;
  58802. return $core.withContext(function($ctx1) {
  58803. $recv(console)._log_(aFilename);
  58804. return self;
  58805. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  58806. },
  58807. args: ["data", "aFilename"],
  58808. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  58809. referencedClasses: [],
  58810. messageSends: ["log:"]
  58811. }),
  58812. $globals.FileServer);
  58813. $globals.FileServer.klass.iVarNames = ['mimeTypes'];
  58814. $core.addMethod(
  58815. $core.method({
  58816. selector: "commandLineSwitches",
  58817. protocol: 'accessing',
  58818. fn: function (){
  58819. var self=this;
  58820. var switches;
  58821. return $core.withContext(function($ctx1) {
  58822. switches=$recv(self._methodsInProtocol_("accessing"))._collect_((function(each){
  58823. return $core.withContext(function($ctx2) {
  58824. return $recv(each)._selector();
  58825. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58826. }));
  58827. $ctx1.sendIdx["collect:"]=1;
  58828. switches=$recv(switches)._select_((function(each){
  58829. return $core.withContext(function($ctx2) {
  58830. return $recv(each)._match_("^[^:]*:$");
  58831. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  58832. }));
  58833. switches=$recv(switches)._collect_((function(each){
  58834. return $core.withContext(function($ctx2) {
  58835. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  58836. $ctx2.sendIdx["replace:with:"]=1;
  58837. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  58838. }));
  58839. return switches;
  58840. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.klass)});
  58841. },
  58842. args: [],
  58843. 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",
  58844. referencedClasses: [],
  58845. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  58846. }),
  58847. $globals.FileServer.klass);
  58848. $core.addMethod(
  58849. $core.method({
  58850. selector: "createServerWithArguments:",
  58851. protocol: 'initialization',
  58852. fn: function (options){
  58853. var self=this;
  58854. var server,popFront,front,optionName,optionValue,switches;
  58855. return $core.withContext(function($ctx1) {
  58856. var $1,$2,$3,$4,$5,$6,$7,$8;
  58857. var $early={};
  58858. try {
  58859. switches=self._commandLineSwitches();
  58860. server=self._new();
  58861. $recv(options)._ifEmpty_((function(){
  58862. throw $early=[server];
  58863. }));
  58864. $1=$recv($recv(options)._size())._even();
  58865. if(!$core.assert($1)){
  58866. $recv(console)._log_("Using default parameters.");
  58867. $ctx1.sendIdx["log:"]=1;
  58868. $2=console;
  58869. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  58870. $ctx1.sendIdx[","]=1;
  58871. $recv($2)._log_($3);
  58872. $ctx1.sendIdx["log:"]=2;
  58873. $4=console;
  58874. $5="Use any of the following ones: ".__comma(switches);
  58875. $ctx1.sendIdx[","]=2;
  58876. $recv($4)._log_($5);
  58877. $ctx1.sendIdx["log:"]=3;
  58878. return server;
  58879. };
  58880. popFront=(function(args){
  58881. return $core.withContext(function($ctx2) {
  58882. front=$recv(args)._first();
  58883. front;
  58884. $recv(args)._remove_(front);
  58885. return front;
  58886. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  58887. });
  58888. $recv((function(){
  58889. return $core.withContext(function($ctx2) {
  58890. return $recv(options)._notEmpty();
  58891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58892. }))._whileTrue_((function(){
  58893. return $core.withContext(function($ctx2) {
  58894. optionName=$recv(popFront)._value_(options);
  58895. $ctx2.sendIdx["value:"]=1;
  58896. optionName;
  58897. optionValue=$recv(popFront)._value_(options);
  58898. optionValue;
  58899. $6=$recv(switches)._includes_(optionName);
  58900. if($core.assert($6)){
  58901. optionName=self._selectorForCommandLineSwitch_(optionName);
  58902. optionName;
  58903. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  58904. } else {
  58905. $7=console;
  58906. $8=$recv(optionName).__comma(" is not a valid commandline option");
  58907. $ctx2.sendIdx[","]=3;
  58908. $recv($7)._log_($8);
  58909. $ctx2.sendIdx["log:"]=4;
  58910. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  58911. };
  58912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58913. }));
  58914. return server;
  58915. }
  58916. catch(e) {if(e===$early)return e[0]; throw e}
  58917. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.klass)});
  58918. },
  58919. args: ["options"],
  58920. 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.",
  58921. referencedClasses: ["Array"],
  58922. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  58923. }),
  58924. $globals.FileServer.klass);
  58925. $core.addMethod(
  58926. $core.method({
  58927. selector: "defaultBasePath",
  58928. protocol: 'accessing',
  58929. fn: function (){
  58930. var self=this;
  58931. return "./";
  58932. },
  58933. args: [],
  58934. source: "defaultBasePath\x0a\x09^ './'",
  58935. referencedClasses: [],
  58936. messageSends: []
  58937. }),
  58938. $globals.FileServer.klass);
  58939. $core.addMethod(
  58940. $core.method({
  58941. selector: "defaultHost",
  58942. protocol: 'accessing',
  58943. fn: function (){
  58944. var self=this;
  58945. return "127.0.0.1";
  58946. },
  58947. args: [],
  58948. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  58949. referencedClasses: [],
  58950. messageSends: []
  58951. }),
  58952. $globals.FileServer.klass);
  58953. $core.addMethod(
  58954. $core.method({
  58955. selector: "defaultMimeTypes",
  58956. protocol: 'accessing',
  58957. fn: function (){
  58958. var self=this;
  58959. 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"]);
  58960. },
  58961. args: [],
  58962. 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}",
  58963. referencedClasses: [],
  58964. messageSends: []
  58965. }),
  58966. $globals.FileServer.klass);
  58967. $core.addMethod(
  58968. $core.method({
  58969. selector: "defaultPort",
  58970. protocol: 'accessing',
  58971. fn: function (){
  58972. var self=this;
  58973. return (4000);
  58974. },
  58975. args: [],
  58976. source: "defaultPort\x0a\x09^ 4000",
  58977. referencedClasses: [],
  58978. messageSends: []
  58979. }),
  58980. $globals.FileServer.klass);
  58981. $core.addMethod(
  58982. $core.method({
  58983. selector: "main",
  58984. protocol: 'initialization',
  58985. fn: function (){
  58986. var self=this;
  58987. var fileServer,args;
  58988. return $core.withContext(function($ctx1) {
  58989. var $1;
  58990. var $early={};
  58991. try {
  58992. args=$recv(process)._argv();
  58993. $recv(args)._removeFrom_to_((1),(3));
  58994. $recv(args)._detect_ifNone_((function(each){
  58995. return $core.withContext(function($ctx2) {
  58996. $1=$recv(each).__eq("--help");
  58997. if($core.assert($1)){
  58998. return $recv($globals.FileServer)._printHelp();
  58999. };
  59000. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59001. }),(function(){
  59002. return $core.withContext(function($ctx2) {
  59003. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  59004. fileServer;
  59005. throw $early=[$recv(fileServer)._start()];
  59006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59007. }));
  59008. return self;
  59009. }
  59010. catch(e) {if(e===$early)return e[0]; throw e}
  59011. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.klass)});
  59012. },
  59013. args: [],
  59014. 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]",
  59015. referencedClasses: ["FileServer"],
  59016. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  59017. }),
  59018. $globals.FileServer.klass);
  59019. $core.addMethod(
  59020. $core.method({
  59021. selector: "mimeTypeFor:",
  59022. protocol: 'accessing',
  59023. fn: function (aString){
  59024. var self=this;
  59025. return $core.withContext(function($ctx1) {
  59026. return $recv(self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  59027. return "text/plain";
  59028. }));
  59029. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.klass)});
  59030. },
  59031. args: ["aString"],
  59032. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  59033. referencedClasses: [],
  59034. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  59035. }),
  59036. $globals.FileServer.klass);
  59037. $core.addMethod(
  59038. $core.method({
  59039. selector: "mimeTypes",
  59040. protocol: 'accessing',
  59041. fn: function (){
  59042. var self=this;
  59043. return $core.withContext(function($ctx1) {
  59044. var $1,$receiver;
  59045. $1=self["@mimeTypes"];
  59046. if(($receiver = $1) == null || $receiver.isNil){
  59047. self["@mimeTypes"]=self._defaultMimeTypes();
  59048. return self["@mimeTypes"];
  59049. } else {
  59050. return $1;
  59051. };
  59052. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.klass)});
  59053. },
  59054. args: [],
  59055. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  59056. referencedClasses: [],
  59057. messageSends: ["ifNil:", "defaultMimeTypes"]
  59058. }),
  59059. $globals.FileServer.klass);
  59060. $core.addMethod(
  59061. $core.method({
  59062. selector: "printHelp",
  59063. protocol: 'accessing',
  59064. fn: function (){
  59065. var self=this;
  59066. return $core.withContext(function($ctx1) {
  59067. $recv(console)._log_("Available commandline options are:");
  59068. $ctx1.sendIdx["log:"]=1;
  59069. $recv(console)._log_("--help");
  59070. $ctx1.sendIdx["log:"]=2;
  59071. $recv(self._commandLineSwitches())._do_((function(each){
  59072. return $core.withContext(function($ctx2) {
  59073. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  59074. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59075. }));
  59076. return self;
  59077. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.klass)});
  59078. },
  59079. args: [],
  59080. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  59081. referencedClasses: [],
  59082. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  59083. }),
  59084. $globals.FileServer.klass);
  59085. $core.addMethod(
  59086. $core.method({
  59087. selector: "selectorForCommandLineSwitch:",
  59088. protocol: 'accessing',
  59089. fn: function (aSwitch){
  59090. var self=this;
  59091. return $core.withContext(function($ctx1) {
  59092. var $1;
  59093. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  59094. return $core.withContext(function($ctx2) {
  59095. return $recv($recv(each)._second())._asUppercase();
  59096. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59097. }));
  59098. $ctx1.sendIdx["replace:with:"]=1;
  59099. return $recv($1).__comma(":");
  59100. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.klass)});
  59101. },
  59102. args: ["aSwitch"],
  59103. 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 ]), ':'",
  59104. referencedClasses: [],
  59105. messageSends: [",", "replace:with:", "asUppercase", "second"]
  59106. }),
  59107. $globals.FileServer.klass);
  59108. $core.addClass('Initer', $globals.BaseFileManipulator, ['childProcess', 'nmPath'], 'AmberCli');
  59109. $core.addMethod(
  59110. $core.method({
  59111. selector: "bowerInstallThenDo:",
  59112. protocol: 'action',
  59113. fn: function (aBlock){
  59114. var self=this;
  59115. var child;
  59116. return $core.withContext(function($ctx1) {
  59117. var $1,$3,$2;
  59118. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]);
  59119. $1=child;
  59120. $recv($1)._on_do_("error",aBlock);
  59121. $ctx1.sendIdx["on:do:"]=1;
  59122. $recv($1)._on_do_("close",(function(code){
  59123. return $core.withContext(function($ctx2) {
  59124. $3=$recv(code).__eq((0));
  59125. if($core.assert($3)){
  59126. $2=nil;
  59127. } else {
  59128. $2=code;
  59129. };
  59130. return $recv(aBlock)._value_($2);
  59131. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  59132. }));
  59133. return self;
  59134. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  59135. },
  59136. args: ["aBlock"],
  59137. 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 ]) ]",
  59138. referencedClasses: [],
  59139. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  59140. }),
  59141. $globals.Initer);
  59142. $core.addMethod(
  59143. $core.method({
  59144. selector: "finishMessage",
  59145. protocol: 'action',
  59146. fn: function (){
  59147. var self=this;
  59148. return $core.withContext(function($ctx1) {
  59149. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  59150. $recv((function(){
  59151. }))._valueWithTimeout_((600));
  59152. return self;
  59153. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  59154. },
  59155. args: [],
  59156. 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",
  59157. referencedClasses: ["String"],
  59158. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  59159. }),
  59160. $globals.Initer);
  59161. $core.addMethod(
  59162. $core.method({
  59163. selector: "gruntInitThenDo:",
  59164. protocol: 'action',
  59165. fn: function (aBlock){
  59166. var self=this;
  59167. var child,sanitizedTemplatePath;
  59168. return $core.withContext(function($ctx1) {
  59169. var $1,$3,$2;
  59170. sanitizedTemplatePath=$recv($recv($recv(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  59171. $ctx1.sendIdx["replace:with:"]=1;
  59172. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  59173. $1=child;
  59174. $recv($1)._on_do_("error",aBlock);
  59175. $ctx1.sendIdx["on:do:"]=1;
  59176. $recv($1)._on_do_("close",(function(code){
  59177. return $core.withContext(function($ctx2) {
  59178. $3=$recv(code).__eq((0));
  59179. if($core.assert($3)){
  59180. $2=nil;
  59181. } else {
  59182. $2=code;
  59183. };
  59184. return $recv(aBlock)._value_($2);
  59185. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  59186. }));
  59187. return self;
  59188. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  59189. },
  59190. args: ["aBlock"],
  59191. 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 ]) ]",
  59192. referencedClasses: [],
  59193. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  59194. }),
  59195. $globals.Initer);
  59196. $core.addMethod(
  59197. $core.method({
  59198. selector: "gruntThenDo:",
  59199. protocol: 'action',
  59200. fn: function (aBlock){
  59201. var self=this;
  59202. var child;
  59203. return $core.withContext(function($ctx1) {
  59204. var $1,$3,$2;
  59205. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  59206. $1=child;
  59207. $recv($1)._on_do_("error",aBlock);
  59208. $ctx1.sendIdx["on:do:"]=1;
  59209. $recv($1)._on_do_("close",(function(code){
  59210. return $core.withContext(function($ctx2) {
  59211. $3=$recv(code).__eq((0));
  59212. if($core.assert($3)){
  59213. $2=nil;
  59214. } else {
  59215. $2=code;
  59216. };
  59217. return $recv(aBlock)._value_($2);
  59218. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  59219. }));
  59220. return self;
  59221. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  59222. },
  59223. args: ["aBlock"],
  59224. 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 ]) ]",
  59225. referencedClasses: [],
  59226. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  59227. }),
  59228. $globals.Initer);
  59229. $core.addMethod(
  59230. $core.method({
  59231. selector: "initialize",
  59232. protocol: 'initialization',
  59233. fn: function (){
  59234. var self=this;
  59235. return $core.withContext(function($ctx1) {
  59236. (
  59237. $ctx1.supercall = true,
  59238. ($globals.Initer.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  59239. $ctx1.supercall = false;
  59240. self["@childProcess"]=$recv(require)._value_("child_process");
  59241. self["@nmPath"]=$recv(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  59242. return self;
  59243. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  59244. },
  59245. args: [],
  59246. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  59247. referencedClasses: [],
  59248. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  59249. }),
  59250. $globals.Initer);
  59251. $core.addMethod(
  59252. $core.method({
  59253. selector: "npmInstallThenDo:",
  59254. protocol: 'action',
  59255. fn: function (aBlock){
  59256. var self=this;
  59257. var child;
  59258. return $core.withContext(function($ctx1) {
  59259. var $1;
  59260. child=$recv(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  59261. $1=$recv(child)._stdout();
  59262. $ctx1.sendIdx["stdout"]=1;
  59263. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  59264. return self;
  59265. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  59266. },
  59267. args: ["aBlock"],
  59268. 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 }",
  59269. referencedClasses: [],
  59270. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  59271. }),
  59272. $globals.Initer);
  59273. $core.addMethod(
  59274. $core.method({
  59275. selector: "npmScriptForModule:named:",
  59276. protocol: 'npm',
  59277. fn: function (aString,anotherString){
  59278. var self=this;
  59279. var modulePath,packageJson,binSection,scriptPath;
  59280. return $core.withContext(function($ctx1) {
  59281. var $1,$3,$4,$2,$5;
  59282. $1=self["@path"];
  59283. $3=$recv($globals.JSObjectProxy)._on_(require);
  59284. $4=$recv(aString).__comma("/package.json");
  59285. $ctx1.sendIdx[","]=1;
  59286. $2=$recv($3)._resolve_($4);
  59287. modulePath=$recv($1)._dirname_($2);
  59288. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  59289. binSection=$recv(packageJson)._at_("bin");
  59290. $ctx1.sendIdx["at:"]=1;
  59291. $5=$recv(binSection)._isString();
  59292. if($core.assert($5)){
  59293. scriptPath=binSection;
  59294. } else {
  59295. scriptPath=$recv(binSection)._at_(anotherString);
  59296. };
  59297. return $recv(self["@path"])._join_with_(modulePath,scriptPath);
  59298. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  59299. },
  59300. args: ["aString", "anotherString"],
  59301. 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",
  59302. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  59303. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  59304. }),
  59305. $globals.Initer);
  59306. $core.addMethod(
  59307. $core.method({
  59308. selector: "start",
  59309. protocol: 'action',
  59310. fn: function (){
  59311. var self=this;
  59312. return $core.withContext(function($ctx1) {
  59313. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  59314. self._gruntInitThenDo_((function(error){
  59315. return $core.withContext(function($ctx2) {
  59316. if(($receiver = error) == null || $receiver.isNil){
  59317. return self._bowerInstallThenDo_((function(error2){
  59318. return $core.withContext(function($ctx3) {
  59319. if(($receiver = error2) == null || $receiver.isNil){
  59320. return self._npmInstallThenDo_((function(error3){
  59321. return $core.withContext(function($ctx4) {
  59322. if(($receiver = error3) == null || $receiver.isNil){
  59323. return self._gruntThenDo_((function(error4){
  59324. return $core.withContext(function($ctx5) {
  59325. if(($receiver = error4) == null || $receiver.isNil){
  59326. self._finishMessage();
  59327. return $recv(process)._exit();
  59328. } else {
  59329. $7=console;
  59330. $recv($7)._log_("grunt exec error:");
  59331. $ctx5.sendIdx["log:"]=7;
  59332. $recv($7)._log_(error4);
  59333. return $recv(process)._exit_((104));
  59334. };
  59335. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  59336. }));
  59337. } else {
  59338. $5=console;
  59339. $recv($5)._log_("npm install exec error:");
  59340. $ctx4.sendIdx["log:"]=5;
  59341. $6=$recv($5)._log_(error3);
  59342. $ctx4.sendIdx["log:"]=6;
  59343. $6;
  59344. return $recv(process)._exit_((103));
  59345. $ctx4.sendIdx["exit:"]=3;
  59346. };
  59347. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  59348. }));
  59349. } else {
  59350. $3=console;
  59351. $recv($3)._log_("bower install exec error:");
  59352. $ctx3.sendIdx["log:"]=3;
  59353. $4=$recv($3)._log_(error2);
  59354. $ctx3.sendIdx["log:"]=4;
  59355. $4;
  59356. return $recv(process)._exit_((102));
  59357. $ctx3.sendIdx["exit:"]=2;
  59358. };
  59359. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  59360. }));
  59361. } else {
  59362. $1=console;
  59363. $recv($1)._log_("grunt-init exec error:");
  59364. $ctx2.sendIdx["log:"]=1;
  59365. $2=$recv($1)._log_(error);
  59366. $ctx2.sendIdx["log:"]=2;
  59367. $2;
  59368. return $recv(process)._exit_((101));
  59369. $ctx2.sendIdx["exit:"]=1;
  59370. };
  59371. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  59372. }));
  59373. return self;
  59374. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  59375. },
  59376. args: [],
  59377. 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 ]]]]]]]]",
  59378. referencedClasses: [],
  59379. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  59380. }),
  59381. $globals.Initer);
  59382. $core.addClass('Repl', $globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  59383. $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.";
  59384. $core.addMethod(
  59385. $core.method({
  59386. selector: "addVariableNamed:to:",
  59387. protocol: 'private',
  59388. fn: function (aString,anObject){
  59389. var self=this;
  59390. var newClass,newObject;
  59391. return $core.withContext(function($ctx1) {
  59392. newClass=self._subclass_withVariable_($recv(anObject)._class(),aString);
  59393. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  59394. newObject=$recv(newClass)._new();
  59395. self._setPreviousVariablesFor_from_(newObject,anObject);
  59396. return newObject;
  59397. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  59398. },
  59399. args: ["aString", "anObject"],
  59400. 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",
  59401. referencedClasses: [],
  59402. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  59403. }),
  59404. $globals.Repl);
  59405. $core.addMethod(
  59406. $core.method({
  59407. selector: "assignNewVariable:do:",
  59408. protocol: 'private',
  59409. fn: function (buffer,aBlock){
  59410. var self=this;
  59411. return $core.withContext(function($ctx1) {
  59412. var $2,$3,$1,$receiver;
  59413. return self._parseAssignment_do_(buffer,(function(name,expr){
  59414. var varName,value;
  59415. return $core.withContext(function($ctx2) {
  59416. if(($receiver = name) == null || $receiver.isNil){
  59417. varName=self._nextResultName();
  59418. } else {
  59419. varName=name;
  59420. };
  59421. varName;
  59422. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  59423. self["@session"];
  59424. $recv((function(){
  59425. return $core.withContext(function($ctx3) {
  59426. $2=$recv(varName).__comma(" := ");
  59427. if(($receiver = expr) == null || $receiver.isNil){
  59428. $3=buffer;
  59429. } else {
  59430. $3=expr;
  59431. };
  59432. $1=$recv($2).__comma($3);
  59433. $ctx3.sendIdx[","]=1;
  59434. value=self._eval_on_($1,self["@session"]);
  59435. return value;
  59436. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  59437. }))._on_do_($globals.Error,(function(e){
  59438. return $core.withContext(function($ctx3) {
  59439. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  59440. value=nil;
  59441. return value;
  59442. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  59443. }));
  59444. return $recv(aBlock)._value_value_(varName,value);
  59445. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  59446. }));
  59447. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  59448. },
  59449. args: ["buffer", "aBlock"],
  59450. 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]",
  59451. referencedClasses: ["Error", "ConsoleErrorHandler"],
  59452. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  59453. }),
  59454. $globals.Repl);
  59455. $core.addMethod(
  59456. $core.method({
  59457. selector: "clearScreen",
  59458. protocol: 'actions',
  59459. fn: function (){
  59460. var self=this;
  59461. var esc,cls;
  59462. return $core.withContext(function($ctx1) {
  59463. var $1;
  59464. esc=$recv($globals.String)._fromCharCode_((27));
  59465. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  59466. $ctx1.sendIdx[","]=2;
  59467. cls=$recv($1).__comma("[0;0f");
  59468. $ctx1.sendIdx[","]=1;
  59469. $recv($recv(process)._stdout())._write_(cls);
  59470. $recv(self["@interface"])._prompt();
  59471. return self;
  59472. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  59473. },
  59474. args: [],
  59475. 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",
  59476. referencedClasses: ["String"],
  59477. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  59478. }),
  59479. $globals.Repl);
  59480. $core.addMethod(
  59481. $core.method({
  59482. selector: "close",
  59483. protocol: 'actions',
  59484. fn: function (){
  59485. var self=this;
  59486. return $core.withContext(function($ctx1) {
  59487. $recv($recv(process)._stdin())._destroy();
  59488. return self;
  59489. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  59490. },
  59491. args: [],
  59492. source: "close\x0a\x09process stdin destroy",
  59493. referencedClasses: [],
  59494. messageSends: ["destroy", "stdin"]
  59495. }),
  59496. $globals.Repl);
  59497. $core.addMethod(
  59498. $core.method({
  59499. selector: "commands",
  59500. protocol: 'accessing',
  59501. fn: function (){
  59502. var self=this;
  59503. return self["@commands"];
  59504. },
  59505. args: [],
  59506. source: "commands\x0a\x09^ commands",
  59507. referencedClasses: [],
  59508. messageSends: []
  59509. }),
  59510. $globals.Repl);
  59511. $core.addMethod(
  59512. $core.method({
  59513. selector: "createInterface",
  59514. protocol: 'actions',
  59515. fn: function (){
  59516. var self=this;
  59517. return $core.withContext(function($ctx1) {
  59518. self["@interface"]=$recv(self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  59519. $recv(self["@interface"])._on_do_("line",(function(buffer){
  59520. return $core.withContext(function($ctx2) {
  59521. return self._processLine_(buffer);
  59522. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  59523. }));
  59524. $ctx1.sendIdx["on:do:"]=1;
  59525. $recv(self["@interface"])._on_do_("close",(function(){
  59526. return $core.withContext(function($ctx2) {
  59527. return self._close();
  59528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59529. }));
  59530. self._printWelcome();
  59531. self._setupHotkeys();
  59532. self._setPrompt();
  59533. $recv(self["@interface"])._prompt();
  59534. return self;
  59535. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  59536. },
  59537. args: [],
  59538. 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",
  59539. referencedClasses: [],
  59540. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  59541. }),
  59542. $globals.Repl);
  59543. $core.addMethod(
  59544. $core.method({
  59545. selector: "encapsulateVariable:withValue:in:",
  59546. protocol: 'private',
  59547. fn: function (aString,anObject,aClass){
  59548. var self=this;
  59549. var compiler;
  59550. return $core.withContext(function($ctx1) {
  59551. var $1,$4,$3,$2,$5,$6;
  59552. compiler=$recv($globals.Compiler)._new();
  59553. $1=compiler;
  59554. $4=$recv(aString).__comma(": anObject ^ ");
  59555. $ctx1.sendIdx[","]=3;
  59556. $3=$recv($4).__comma(aString);
  59557. $ctx1.sendIdx[","]=2;
  59558. $2=$recv($3).__comma(" := anObject");
  59559. $ctx1.sendIdx[","]=1;
  59560. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  59561. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  59562. $5=compiler;
  59563. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  59564. $ctx1.sendIdx[","]=4;
  59565. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  59566. return self;
  59567. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  59568. },
  59569. args: ["aString", "anObject", "aClass"],
  59570. 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'.",
  59571. referencedClasses: ["Compiler"],
  59572. messageSends: ["new", "install:forClass:protocol:", ","]
  59573. }),
  59574. $globals.Repl);
  59575. $core.addMethod(
  59576. $core.method({
  59577. selector: "eval:",
  59578. protocol: 'actions',
  59579. fn: function (buffer){
  59580. var self=this;
  59581. return $core.withContext(function($ctx1) {
  59582. return self._eval_on_(buffer,$recv($globals.DoIt)._new());
  59583. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  59584. },
  59585. args: ["buffer"],
  59586. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  59587. referencedClasses: ["DoIt"],
  59588. messageSends: ["eval:on:", "new"]
  59589. }),
  59590. $globals.Repl);
  59591. $core.addMethod(
  59592. $core.method({
  59593. selector: "eval:on:",
  59594. protocol: 'actions',
  59595. fn: function (buffer,anObject){
  59596. var self=this;
  59597. var result;
  59598. return $core.withContext(function($ctx1) {
  59599. var $1,$2;
  59600. $1=$recv(buffer)._isEmpty();
  59601. if(!$core.assert($1)){
  59602. $recv((function(){
  59603. return $core.withContext(function($ctx2) {
  59604. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  59605. return result;
  59606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59607. }))._tryCatch_((function(e){
  59608. return $core.withContext(function($ctx2) {
  59609. $2=$recv(e)._isSmalltalkError();
  59610. if($core.assert($2)){
  59611. return $recv(e)._resignal();
  59612. } else {
  59613. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  59614. };
  59615. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)});
  59616. }));
  59617. };
  59618. return result;
  59619. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  59620. },
  59621. args: ["buffer", "anObject"],
  59622. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer isEmpty ifFalse: [\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 ifTrue: [ e resignal ]\x0a\x09\x09\x09 \x09 ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  59623. referencedClasses: ["Compiler"],
  59624. messageSends: ["ifFalse:", "isEmpty", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  59625. }),
  59626. $globals.Repl);
  59627. $core.addMethod(
  59628. $core.method({
  59629. selector: "executeCommand:",
  59630. protocol: 'private',
  59631. fn: function (aString){
  59632. var self=this;
  59633. return $core.withContext(function($ctx1) {
  59634. var $1;
  59635. var $early={};
  59636. try {
  59637. $recv(self._commands())._keysAndValuesDo_((function(names,cmd){
  59638. return $core.withContext(function($ctx2) {
  59639. $1=$recv(names)._includes_(aString);
  59640. if($core.assert($1)){
  59641. $recv(cmd)._value();
  59642. throw $early=[true];
  59643. };
  59644. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  59645. }));
  59646. return false;
  59647. }
  59648. catch(e) {if(e===$early)return e[0]; throw e}
  59649. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  59650. },
  59651. args: ["aString"],
  59652. 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",
  59653. referencedClasses: [],
  59654. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  59655. }),
  59656. $globals.Repl);
  59657. $core.addMethod(
  59658. $core.method({
  59659. selector: "initialize",
  59660. protocol: 'initialization',
  59661. fn: function (){
  59662. var self=this;
  59663. return $core.withContext(function($ctx1) {
  59664. (
  59665. $ctx1.supercall = true,
  59666. ($globals.Repl.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  59667. $ctx1.supercall = false;
  59668. self["@session"]=$recv($globals.DoIt)._new();
  59669. self["@readline"]=$recv(require)._value_("readline");
  59670. $ctx1.sendIdx["value:"]=1;
  59671. self["@util"]=$recv(require)._value_("util");
  59672. self._setupCommands();
  59673. return self;
  59674. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  59675. },
  59676. args: [],
  59677. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  59678. referencedClasses: ["DoIt"],
  59679. messageSends: ["initialize", "new", "value:", "setupCommands"]
  59680. }),
  59681. $globals.Repl);
  59682. $core.addMethod(
  59683. $core.method({
  59684. selector: "instanceVariableNamesFor:",
  59685. protocol: 'private',
  59686. fn: function (aClass){
  59687. var self=this;
  59688. return $core.withContext(function($ctx1) {
  59689. var $1,$2,$receiver;
  59690. $1=$recv(aClass)._superclass();
  59691. $ctx1.sendIdx["superclass"]=1;
  59692. if(($receiver = $1) == null || $receiver.isNil){
  59693. return $recv(aClass)._instanceVariableNames();
  59694. } else {
  59695. $2=$recv(aClass)._instanceVariableNames();
  59696. $ctx1.sendIdx["instanceVariableNames"]=1;
  59697. return $recv($2)._copyWithAll_(self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  59698. };
  59699. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  59700. },
  59701. args: ["aClass"],
  59702. 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]",
  59703. referencedClasses: [],
  59704. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  59705. }),
  59706. $globals.Repl);
  59707. $core.addMethod(
  59708. $core.method({
  59709. selector: "isIdentifier:",
  59710. protocol: 'private',
  59711. fn: function (aString){
  59712. var self=this;
  59713. return $core.withContext(function($ctx1) {
  59714. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  59715. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  59716. },
  59717. args: ["aString"],
  59718. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  59719. referencedClasses: [],
  59720. messageSends: ["match:", "asRegexp"]
  59721. }),
  59722. $globals.Repl);
  59723. $core.addMethod(
  59724. $core.method({
  59725. selector: "isVariableDefined:",
  59726. protocol: 'private',
  59727. fn: function (aString){
  59728. var self=this;
  59729. return $core.withContext(function($ctx1) {
  59730. return $recv(self._instanceVariableNamesFor_($recv(self["@session"])._class()))._includes_(aString);
  59731. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  59732. },
  59733. args: ["aString"],
  59734. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  59735. referencedClasses: [],
  59736. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  59737. }),
  59738. $globals.Repl);
  59739. $core.addMethod(
  59740. $core.method({
  59741. selector: "nextResultName",
  59742. protocol: 'private',
  59743. fn: function (){
  59744. var self=this;
  59745. return $core.withContext(function($ctx1) {
  59746. var $1,$receiver;
  59747. $1=self["@resultCount"];
  59748. if(($receiver = $1) == null || $receiver.isNil){
  59749. self["@resultCount"]=(1);
  59750. } else {
  59751. self["@resultCount"]=$recv(self["@resultCount"]).__plus((1));
  59752. };
  59753. return "res".__comma($recv(self["@resultCount"])._asString());
  59754. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  59755. },
  59756. args: [],
  59757. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  59758. referencedClasses: [],
  59759. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  59760. }),
  59761. $globals.Repl);
  59762. $core.addMethod(
  59763. $core.method({
  59764. selector: "onKeyPress:",
  59765. protocol: 'private',
  59766. fn: function (key){
  59767. var self=this;
  59768. return $core.withContext(function($ctx1) {
  59769. var $1;
  59770. $1=$recv($recv(key)._ctrl())._and_((function(){
  59771. return $core.withContext(function($ctx2) {
  59772. return $recv($recv(key)._name()).__eq("l");
  59773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59774. }));
  59775. if($core.assert($1)){
  59776. self._clearScreen();
  59777. };
  59778. return self;
  59779. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  59780. },
  59781. args: ["key"],
  59782. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  59783. referencedClasses: [],
  59784. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  59785. }),
  59786. $globals.Repl);
  59787. $core.addMethod(
  59788. $core.method({
  59789. selector: "parseAssignment:do:",
  59790. protocol: 'private',
  59791. fn: function (aString,aBlock){
  59792. var self=this;
  59793. var assignment;
  59794. return $core.withContext(function($ctx1) {
  59795. var $2,$1;
  59796. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  59797. return $core.withContext(function($ctx2) {
  59798. return $recv(s)._trimBoth();
  59799. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  59800. }));
  59801. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  59802. return $core.withContext(function($ctx2) {
  59803. $2=$recv(assignment)._first();
  59804. $ctx2.sendIdx["first"]=1;
  59805. return self._isIdentifier_($2);
  59806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59807. }));
  59808. if($core.assert($1)){
  59809. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  59810. $ctx1.sendIdx["value:value:"]=1;
  59811. } else {
  59812. return $recv(aBlock)._value_value_(nil,nil);
  59813. };
  59814. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  59815. },
  59816. args: ["aString", "aBlock"],
  59817. 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 ]",
  59818. referencedClasses: [],
  59819. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  59820. }),
  59821. $globals.Repl);
  59822. $core.addMethod(
  59823. $core.method({
  59824. selector: "presentResultNamed:withValue:",
  59825. protocol: 'private',
  59826. fn: function (varName,value){
  59827. var self=this;
  59828. return $core.withContext(function($ctx1) {
  59829. var $3,$2,$1;
  59830. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  59831. $ctx1.sendIdx[","]=3;
  59832. $2=$recv($3).__comma(" = ");
  59833. $ctx1.sendIdx[","]=2;
  59834. $1=$recv($2).__comma($recv(value)._asString());
  59835. $ctx1.sendIdx[","]=1;
  59836. $recv($globals.Transcript)._show_($1);
  59837. $recv($globals.Transcript)._cr();
  59838. $recv(self["@interface"])._prompt();
  59839. return self;
  59840. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  59841. },
  59842. args: ["varName", "value"],
  59843. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  59844. referencedClasses: ["Transcript"],
  59845. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  59846. }),
  59847. $globals.Repl);
  59848. $core.addMethod(
  59849. $core.method({
  59850. selector: "printWelcome",
  59851. protocol: 'actions',
  59852. fn: function (){
  59853. var self=this;
  59854. return $core.withContext(function($ctx1) {
  59855. $recv($globals.Transcript)._show_("Type :q to exit.");
  59856. $recv($globals.Transcript)._cr();
  59857. return self;
  59858. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  59859. },
  59860. args: [],
  59861. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  59862. referencedClasses: ["Transcript"],
  59863. messageSends: ["show:", "cr"]
  59864. }),
  59865. $globals.Repl);
  59866. $core.addMethod(
  59867. $core.method({
  59868. selector: "processLine:",
  59869. protocol: 'private',
  59870. fn: function (buffer){
  59871. var self=this;
  59872. var show;
  59873. return $core.withContext(function($ctx1) {
  59874. var $1,$2;
  59875. show=(function(varName,value){
  59876. return $core.withContext(function($ctx2) {
  59877. return self._presentResultNamed_withValue_(varName,value);
  59878. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  59879. });
  59880. $1=self._executeCommand_(buffer);
  59881. if(!$core.assert($1)){
  59882. $2=self._isVariableDefined_(buffer);
  59883. if($core.assert($2)){
  59884. $recv(show)._value_value_(buffer,$recv(self["@session"])._perform_(buffer));
  59885. } else {
  59886. self._assignNewVariable_do_(buffer,show);
  59887. };
  59888. };
  59889. return self;
  59890. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  59891. },
  59892. args: ["buffer"],
  59893. 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]]",
  59894. referencedClasses: [],
  59895. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  59896. }),
  59897. $globals.Repl);
  59898. $core.addMethod(
  59899. $core.method({
  59900. selector: "prompt",
  59901. protocol: 'accessing',
  59902. fn: function (){
  59903. var self=this;
  59904. return "amber >> ";
  59905. },
  59906. args: [],
  59907. source: "prompt\x0a\x09^ 'amber >> '",
  59908. referencedClasses: [],
  59909. messageSends: []
  59910. }),
  59911. $globals.Repl);
  59912. $core.addMethod(
  59913. $core.method({
  59914. selector: "setPreviousVariablesFor:from:",
  59915. protocol: 'private',
  59916. fn: function (newObject,oldObject){
  59917. var self=this;
  59918. return $core.withContext(function($ctx1) {
  59919. $recv(self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  59920. return $core.withContext(function($ctx2) {
  59921. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  59922. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59923. }));
  59924. return self;
  59925. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  59926. },
  59927. args: ["newObject", "oldObject"],
  59928. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  59929. referencedClasses: [],
  59930. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  59931. }),
  59932. $globals.Repl);
  59933. $core.addMethod(
  59934. $core.method({
  59935. selector: "setPrompt",
  59936. protocol: 'actions',
  59937. fn: function (){
  59938. var self=this;
  59939. return $core.withContext(function($ctx1) {
  59940. $recv(self["@interface"])._setPrompt_(self._prompt());
  59941. return self;
  59942. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  59943. },
  59944. args: [],
  59945. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  59946. referencedClasses: [],
  59947. messageSends: ["setPrompt:", "prompt"]
  59948. }),
  59949. $globals.Repl);
  59950. $core.addMethod(
  59951. $core.method({
  59952. selector: "setupCommands",
  59953. protocol: 'initialization',
  59954. fn: function (){
  59955. var self=this;
  59956. return $core.withContext(function($ctx1) {
  59957. var $2,$1;
  59958. $2=$recv([":q"]).__minus_gt((function(){
  59959. return $core.withContext(function($ctx2) {
  59960. return $recv(process)._exit();
  59961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59962. }));
  59963. $ctx1.sendIdx["->"]=1;
  59964. $1=[$2,$recv([""]).__minus_gt((function(){
  59965. return $core.withContext(function($ctx2) {
  59966. return $recv(self["@interface"])._prompt();
  59967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59968. }))];
  59969. self["@commands"]=$recv($globals.Dictionary)._from_($1);
  59970. return self;
  59971. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  59972. },
  59973. args: [],
  59974. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  59975. referencedClasses: ["Dictionary"],
  59976. messageSends: ["from:", "->", "exit", "prompt"]
  59977. }),
  59978. $globals.Repl);
  59979. $core.addMethod(
  59980. $core.method({
  59981. selector: "setupHotkeys",
  59982. protocol: 'initialization',
  59983. fn: function (){
  59984. var self=this;
  59985. return $core.withContext(function($ctx1) {
  59986. var $receiver;
  59987. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  59988. return $core.withContext(function($ctx2) {
  59989. if(($receiver = key) == null || $receiver.isNil){
  59990. return key;
  59991. } else {
  59992. return self._onKeyPress_(key);
  59993. };
  59994. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  59995. }));
  59996. return self;
  59997. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  59998. },
  59999. args: [],
  60000. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  60001. referencedClasses: [],
  60002. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  60003. }),
  60004. $globals.Repl);
  60005. $core.addMethod(
  60006. $core.method({
  60007. selector: "subclass:withVariable:",
  60008. protocol: 'private',
  60009. fn: function (aClass,varName){
  60010. var self=this;
  60011. return $core.withContext(function($ctx1) {
  60012. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  60013. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  60014. },
  60015. args: ["aClass", "varName"],
  60016. 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'",
  60017. referencedClasses: ["ClassBuilder"],
  60018. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  60019. }),
  60020. $globals.Repl);
  60021. $core.addMethod(
  60022. $core.method({
  60023. selector: "subclassNameFor:",
  60024. protocol: 'private',
  60025. fn: function (aClass){
  60026. var self=this;
  60027. return $core.withContext(function($ctx1) {
  60028. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  60029. $2=$recv(aClass)._name();
  60030. $ctx1.sendIdx["name"]=1;
  60031. $1=$recv($2)._matchesOf_("\x5cd+$");
  60032. $ctx1.sendIdx["matchesOf:"]=1;
  60033. if(($receiver = $1) == null || $receiver.isNil){
  60034. return $recv($recv(aClass)._name()).__comma("2");
  60035. } else {
  60036. var counter;
  60037. $6=$recv(aClass)._name();
  60038. $ctx1.sendIdx["name"]=2;
  60039. $5=$recv($6)._matchesOf_("\x5cd+$");
  60040. $4=$recv($5)._first();
  60041. $3=$recv($4)._asNumber();
  60042. counter=$recv($3).__plus((1));
  60043. counter;
  60044. $7=$recv(aClass)._name();
  60045. $ctx1.sendIdx["name"]=3;
  60046. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  60047. };
  60048. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  60049. },
  60050. args: ["aClass"],
  60051. 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'].",
  60052. referencedClasses: [],
  60053. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  60054. }),
  60055. $globals.Repl);
  60056. $core.addMethod(
  60057. $core.method({
  60058. selector: "main",
  60059. protocol: 'initialization',
  60060. fn: function (){
  60061. var self=this;
  60062. return $core.withContext(function($ctx1) {
  60063. $recv(self._new())._createInterface();
  60064. return self;
  60065. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.klass)});
  60066. },
  60067. args: [],
  60068. source: "main\x0a\x09self new createInterface",
  60069. referencedClasses: [],
  60070. messageSends: ["createInterface", "new"]
  60071. }),
  60072. $globals.Repl.klass);
  60073. });
  60074. (function () {
  60075. define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) {
  60076. amber.initialize().then(function () {
  60077. amber.globals.AmberCli._main();
  60078. });
  60079. });
  60080. }());
  60081. require(["app"]);
  60082. });
  60083. define.require('__wrap__');
  60084. }((function amdefine(module, requireFn) {
  60085. 'use strict';
  60086. var defineCache = {},
  60087. loaderCache = {},
  60088. alreadyCalled = false,
  60089. path = require('path'),
  60090. makeRequire, stringRequire;
  60091. /**
  60092. * Trims the . and .. from an array of path segments.
  60093. * It will keep a leading path segment if a .. will become
  60094. * the first path segment, to help with module name lookups,
  60095. * which act like paths, but can be remapped. But the end result,
  60096. * all paths that use this function should look normalized.
  60097. * NOTE: this method MODIFIES the input array.
  60098. * @param {Array} ary the array of path segments.
  60099. */
  60100. function trimDots(ary) {
  60101. var i, part;
  60102. for (i = 0; ary[i]; i+= 1) {
  60103. part = ary[i];
  60104. if (part === '.') {
  60105. ary.splice(i, 1);
  60106. i -= 1;
  60107. } else if (part === '..') {
  60108. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  60109. //End of the line. Keep at least one non-dot
  60110. //path segment at the front so it can be mapped
  60111. //correctly to disk. Otherwise, there is likely
  60112. //no path mapping for a path starting with '..'.
  60113. //This can still fail, but catches the most reasonable
  60114. //uses of ..
  60115. break;
  60116. } else if (i > 0) {
  60117. ary.splice(i - 1, 2);
  60118. i -= 2;
  60119. }
  60120. }
  60121. }
  60122. }
  60123. function normalize(name, baseName) {
  60124. var baseParts;
  60125. //Adjust any relative paths.
  60126. if (name && name.charAt(0) === '.') {
  60127. //If have a base name, try to normalize against it,
  60128. //otherwise, assume it is a top-level require that will
  60129. //be relative to baseUrl in the end.
  60130. if (baseName) {
  60131. baseParts = baseName.split('/');
  60132. baseParts = baseParts.slice(0, baseParts.length - 1);
  60133. baseParts = baseParts.concat(name.split('/'));
  60134. trimDots(baseParts);
  60135. name = baseParts.join('/');
  60136. }
  60137. }
  60138. return name;
  60139. }
  60140. /**
  60141. * Create the normalize() function passed to a loader plugin's
  60142. * normalize method.
  60143. */
  60144. function makeNormalize(relName) {
  60145. return function (name) {
  60146. return normalize(name, relName);
  60147. };
  60148. }
  60149. function makeLoad(id) {
  60150. function load(value) {
  60151. loaderCache[id] = value;
  60152. }
  60153. load.fromText = function (id, text) {
  60154. //This one is difficult because the text can/probably uses
  60155. //define, and any relative paths and requires should be relative
  60156. //to that id was it would be found on disk. But this would require
  60157. //bootstrapping a module/require fairly deeply from node core.
  60158. //Not sure how best to go about that yet.
  60159. throw new Error('amdefine does not implement load.fromText');
  60160. };
  60161. return load;
  60162. }
  60163. makeRequire = function (systemRequire, exports, module, relId) {
  60164. function amdRequire(deps, callback) {
  60165. if (typeof deps === 'string') {
  60166. //Synchronous, single module require('')
  60167. return stringRequire(systemRequire, exports, module, deps, relId);
  60168. } else {
  60169. //Array of dependencies with a callback.
  60170. //Convert the dependencies to modules.
  60171. deps = deps.map(function (depName) {
  60172. return stringRequire(systemRequire, exports, module, depName, relId);
  60173. });
  60174. //Wait for next tick to call back the require call.
  60175. if (callback) {
  60176. process.nextTick(function () {
  60177. callback.apply(null, deps);
  60178. });
  60179. }
  60180. }
  60181. }
  60182. amdRequire.toUrl = function (filePath) {
  60183. if (filePath.indexOf('.') === 0) {
  60184. return normalize(filePath, path.dirname(module.filename));
  60185. } else {
  60186. return filePath;
  60187. }
  60188. };
  60189. return amdRequire;
  60190. };
  60191. //Favor explicit value, passed in if the module wants to support Node 0.4.
  60192. requireFn = requireFn || function req() {
  60193. return module.require.apply(module, arguments);
  60194. };
  60195. function runFactory(id, deps, factory) {
  60196. var r, e, m, result;
  60197. if (id) {
  60198. e = loaderCache[id] = {};
  60199. m = {
  60200. id: id,
  60201. uri: __filename,
  60202. exports: e
  60203. };
  60204. r = makeRequire(requireFn, e, m, id);
  60205. } else {
  60206. //Only support one define call per file
  60207. if (alreadyCalled) {
  60208. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  60209. }
  60210. alreadyCalled = true;
  60211. //Use the real variables from node
  60212. //Use module.exports for exports, since
  60213. //the exports in here is amdefine exports.
  60214. e = module.exports;
  60215. m = module;
  60216. r = makeRequire(requireFn, e, m, module.id);
  60217. }
  60218. //If there are dependencies, they are strings, so need
  60219. //to convert them to dependency values.
  60220. if (deps) {
  60221. deps = deps.map(function (depName) {
  60222. return r(depName);
  60223. });
  60224. }
  60225. //Call the factory with the right dependencies.
  60226. if (typeof factory === 'function') {
  60227. result = factory.apply(m.exports, deps);
  60228. } else {
  60229. result = factory;
  60230. }
  60231. if (result !== undefined) {
  60232. m.exports = result;
  60233. if (id) {
  60234. loaderCache[id] = m.exports;
  60235. }
  60236. }
  60237. }
  60238. stringRequire = function (systemRequire, exports, module, id, relId) {
  60239. //Split the ID by a ! so that
  60240. var index = id.indexOf('!'),
  60241. originalId = id,
  60242. prefix, plugin;
  60243. if (index === -1) {
  60244. id = normalize(id, relId);
  60245. //Straight module lookup. If it is one of the special dependencies,
  60246. //deal with it, otherwise, delegate to node.
  60247. if (id === 'require') {
  60248. return makeRequire(systemRequire, exports, module, relId);
  60249. } else if (id === 'exports') {
  60250. return exports;
  60251. } else if (id === 'module') {
  60252. return module;
  60253. } else if (loaderCache.hasOwnProperty(id)) {
  60254. return loaderCache[id];
  60255. } else if (defineCache[id]) {
  60256. runFactory.apply(null, defineCache[id]);
  60257. return loaderCache[id];
  60258. } else {
  60259. if(systemRequire) {
  60260. return systemRequire(originalId);
  60261. } else {
  60262. throw new Error('No module with ID: ' + id);
  60263. }
  60264. }
  60265. } else {
  60266. //There is a plugin in play.
  60267. prefix = id.substring(0, index);
  60268. id = id.substring(index + 1, id.length);
  60269. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  60270. if (plugin.normalize) {
  60271. id = plugin.normalize(id, makeNormalize(relId));
  60272. } else {
  60273. //Normalize the ID normally.
  60274. id = normalize(id, relId);
  60275. }
  60276. if (loaderCache[id]) {
  60277. return loaderCache[id];
  60278. } else {
  60279. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  60280. return loaderCache[id];
  60281. }
  60282. }
  60283. };
  60284. //Create a define function specific to the module asking for amdefine.
  60285. function define(id, deps, factory) {
  60286. if (Array.isArray(id)) {
  60287. factory = deps;
  60288. deps = id;
  60289. id = undefined;
  60290. } else if (typeof id !== 'string') {
  60291. factory = id;
  60292. id = deps = undefined;
  60293. }
  60294. if (deps && !Array.isArray(deps)) {
  60295. factory = deps;
  60296. deps = undefined;
  60297. }
  60298. if (!deps) {
  60299. deps = ['require', 'exports', 'module'];
  60300. }
  60301. //Set up properties for this module. If an ID, then use
  60302. //internal cache. If no ID, then use the external variables
  60303. //for this node module.
  60304. if (id) {
  60305. //Put the module in deep freeze until there is a
  60306. //require call for it.
  60307. defineCache[id] = [id, deps, factory];
  60308. } else {
  60309. runFactory(id, deps, factory);
  60310. }
  60311. }
  60312. //define.require, which has access to all the values in the
  60313. //cache. Useful for AMD modules that all have IDs in the file,
  60314. //but need to finally export a value to node based on one of those
  60315. //IDs.
  60316. define.require = function (id) {
  60317. if (loaderCache[id]) {
  60318. return loaderCache[id];
  60319. }
  60320. if (defineCache[id]) {
  60321. runFactory.apply(null, defineCache[id]);
  60322. return loaderCache[id];
  60323. }
  60324. };
  60325. define.amd = {};
  60326. return define;
  60327. }(module)), require));